1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679 |
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class SubForm {
- constructor() {
- this.Index = 0;
- }
- init(formpropertyid, prop, callback) {
- var instance = SubForm.Instance();
- }
- loadControl(containerid, prop) {
- var ControlJsonText = JSON.parse(prop.ControlJsonText);
- var html = '';
- var parentPkid = Unibase.Platform.Forms.Components.FormViewer.instance.Pk_Value;
- html = '<div class="divSubForm" class="SubformInstalledAppId" data-subforminstalledappid="' + ControlJsonText.InstalledAppId + '"><input type="hidden" id="SubformInstalledAppId_' + prop.FormPropertyId + '" value="' + ControlJsonText.InstalledAppId + '" ><div class="divNextSubForm_' + prop.UniqueId + ' hidden"></div><div class="divNextSubFormList_' + prop.UniqueId + ' divCheckRequired"><div class="subformControlData"></div><div class="subformBtnContainer text-center"></div><div class="subformTableDataList"></div></div></div>';
- if (ControlJsonText.EnableSubFormSettings == true) {
- html += '<div class="col-sm-3 div_SubFormdetails" id="div_subformsettings">' +
- '<a href="javascript:;" class="btn btn-success text-white btnAddSubForm btnSubform_' + prop.UniqueId + '" id="btnAddSubForm_' + prop.UniqueId + '" data-subformcount="0" data-islistsubform="false" /><span>' + ControlJsonText.ButtonName + '</span></a>' +
- '</div>';
- }
- $("#" + containerid).html(html);
- if (ControlJsonText.EnableSubFormSettings == true) {
- $("#btnAddSubForm_" + prop.UniqueId).click(function () {
- var childformdata = ControlJsonText.FormInfo;
- Unibase.Forms.Controls.SubForm.Instance().addButtonClick(childformdata, prop.UniqueId, ControlJsonText.SubFormName, ControlJsonText.ChildFormId, 0);
- });
- var html = '<div class="divSubFormUl loadfirstsubformdata hidden divNextSubForm_' + prop.UniqueId + ' divNextSubForm_' + prop.FormPropertyId + ' divNextSubForm_' + prop.UniqueId + '_0"><div class="card-header"><span class="pull-left">' + ControlJsonText.SubFormName + '-0' + '</span><a class="ml-auto btn-xs pull-right btn btn-icon btn-icon-circle btn-pink btn-icon-style-3 remove-icon_' + prop.FormPropertyId + '" href="javascript:;" title="Remove row" onclick="Unibase.Forms.Controls.SubForm.Instance().SubFormRemove(' + prop.FormPropertyId + ",0,\'" + ControlJsonText.SubFormName + '\');"><span class="btn-icon-wrap"><i class="fa fa-times remove-icon_ ' + prop.FormPropertyId + '"></i><span></span></span></a></div><div class="card-body divSubForm_' + prop.UniqueId + '" id="divSubForm_' + prop.UniqueId + '"></div></div>';
- $(".divNextSubForm_" + prop.UniqueId).after(html);
- var childformdata = ControlJsonText.FormInfo;
- if (childformdata == undefined) {
- Unibase.Platform.Forms.Managers.FormManager.Instance().getForm(ControlJsonText.ChildFormId).then(function (response) {
- var forminfo = response.result;
- var formviewerObj = {
- FormId: 0,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: null,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var subformhtml = Unibase.Platform.Forms.Components.FormViewer.instance.loadFormHtml(forminfo, true, "container-subform-0", formviewerObj, null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(subformhtml.JsFiles, function () {
- $("#divSubForm_" + prop.UniqueId).html(subformhtml.TotalFormHtml);
- });
- });
- }
- else {
- if (parentPkid != 0) {
- var forminfos = childformdata;
- for (var i = 0; i < forminfos.length; i++) {
- var forminfo = forminfos[i];
- var childPkid = forminfos[i].Pk_Value;
- Unibase.Forms.Controls.SubForm.Instance().addButtonClick(forminfo, prop.UniqueId, ControlJsonText.SubFormName, ControlJsonText.ChildFormId, childPkid);
- }
- }
- }
- $("#btnAddSubForm_" + prop.UniqueId).attr("data-subformcount", 1);
- }
- if (ControlJsonText.EnableListFormSettings == true) {
- var childformdata = ControlJsonText.FormInfo;
- if (childformdata == undefined) {
- Unibase.Platform.Forms.Managers.FormManager.Instance().getForm(ControlJsonText.ChildFormId).then(function (response) {
- var forminfo = response.result;
- var formviewerObj = {
- FormId: 0,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: null,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var subformhtml = Unibase.Platform.Forms.Components.FormViewer.instance.loadFormHtml(forminfo, true, "container-subformlist-1", formviewerObj, null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(subformhtml.JsFiles, function () {
- var listhtml = '<div class="divSubFormList_' + prop.UniqueId + '">' + subformhtml.TotalFormHtml + '</div>';
- listhtml += '<div class="col-sm-3 div_SubFormList" id="div_subformlist">' +
- '<a href="javascript:;" class="btn btn-success text-white btnSubform_' + prop.UniqueId + '" id="btnAddSubFormList_' + prop.UniqueId + '" data-subformcount="1" data-islistsubform="true"/><span class="fa fa-plus"></span></a>' +
- '</div><div id="divSubFormListData_' + prop.UniqueId + '" class="hidden"></div></div>';
- $(".divNextSubForm_" + prop.UniqueId).after(listhtml);
- $("#btnAddSubFormList_" + prop.UniqueId).click(function () {
- Unibase.Forms.Controls.SubForm.Instance().addButtonClickForList(prop.UniqueId, 0, forminfos, ControlJsonText, prop);
- });
- });
- });
- }
- else {
- var forminfos = childformdata;
- Unibase.Forms.Controls.SubForm.instance.loadSubformData(forminfos, ControlJsonText, prop);
- }
- }
- }
- loadSubformData(forminfos, ControlJsonText, prop) {
- var instance = this;
- for (var i = 0; i < forminfos.length; i++) {
- var forminfo = forminfos[i];
- var childPkid = forminfos[i].Pk_Value;
- var formviewerObj = {
- FormId: 0,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: null,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var subformhtml = Unibase.Platform.Forms.Components.FormViewer.instance.loadFormHtml(forminfo, true, "container-subformlist-1", formviewerObj, null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(subformhtml.JsFiles, function () {
- var listhtml = '<form id="subformformValidate_' + prop.UniqueId + '" data-validate="parsley"><div class="divSubFormList_' + prop.UniqueId + ' divSubFormList" >' + subformhtml.TotalFormHtml + '</div>';
- listhtml += '<div class="div_SubFormList text-center" id="div_subformlist"></div></form>';
- $(".divNextSubFormList_" + prop.UniqueId + ' .subformControlData').html(listhtml);
- let issubFormListDivLoaded = $('.subformTableDataList').find("#divSubFormListData_" + prop.UniqueId);
- if (issubFormListDivLoaded.length == 0) {
- let addBtnHtml = '<a href="javascript:;" class="btn btn-success text-white btnSubform_' + prop.UniqueId + '" id="btnAddSubFormList_' + prop.UniqueId + '" data-subformcount="1" data-islistsubform="true"/>Add</a>';
- $(".divNextSubFormList_" + prop.UniqueId + ' .subformBtnContainer').html(addBtnHtml);
- let subformListHtml = '<div class="table-responsive"><table class="table sub-form-table hidden"><tbody id="divSubFormListData_' + prop.UniqueId + '"></tbody></table></div><div class="hidden subFormListFooter" id="subFormTableFooter_' + prop.UniqueId + '"><div class="d-flex flex-wrap justify-content-between align-items-center"><div class="checkListTotal"><span class="font-weight-500 text-dark">Total: </span><span class="visibleRowsCount"></span> of <span class="totalRowsCount"></span></div><div class="checkListMoreBtn hidden"><a href="javascript:;" onclick="Unibase.Forms.Controls.SubForm.Instance().loadMoreSubFormlist(' + prop.UniqueId + ');" class="btn btn-success btn-sm text-white loadMoreBtn">More</a></div></div></div>';
- $(".divNextSubFormList_" + prop.UniqueId + ' .subformTableDataList').html(subformListHtml);
- }
- $("#btnAddSubFormList_" + prop.UniqueId).off().click(function () {
- let formDivId = "subformformValidate_" + prop.UniqueId;
- var viewererobj = new Unibase.Platform.Forms.Components.FormViewer();
- let result = viewererobj.requiredFieldValidation(formDivId);
- if (result == false) {
- let requiredFieldsLength = $("#" + formDivId + " .form-group-required").length;
- if (requiredFieldsLength == 1) {
- let subFormPropertyName = $('.form-group-required').parents('.control-group').data('validatename');
- MessageHelper.Instance().showError(subFormPropertyName + " is required", 'div_ErrorMessage_' + ControlJsonText.ParentFormId);
- }
- else {
- MessageHelper.Instance().showError("Mandatory fields are missing", 'div_ErrorMessage_' + ControlJsonText.ParentFormId);
- }
- return false;
- }
- else {
- Unibase.Forms.Controls.SubForm.Instance().addButtonClickForList(prop.UniqueId, childPkid, forminfos, ControlJsonText, prop);
- }
- });
- });
- }
- }
- addButtonClick(ChildFormData, FormPropertyId, SubFormName, ChildFormId, Pk_Value) {
- $(".loadfirstsubformdata").addClass('hidden');
- var Index = Number($("#btnAddSubForm_" + FormPropertyId).attr("data-subformcount"));
- var namelength = Number($(".divNextSubForm_" + FormPropertyId + ".subformcls").length) + 1;
- var subformname = SubFormName + '-' + namelength;
- var CurrentContainer = $(".divNextSubForm_" + FormPropertyId);
- var html = '<div class="subformcls divNextSubForm_' + FormPropertyId + ' card subform_' + Index + '" data-index="' + Index + '"><div class="card-header"><span class="pull-left subformname subforname_' + FormPropertyId + '">' + subformname + '</span><a class="ml-auto btn-xs pull-right btn btn-icon btn-icon-circle btn-pink btn-icon-style-3 remove-icon_' + FormPropertyId + '_' + Index + '" href="javascript:;" title="Remove row" onclick="Unibase.Forms.Controls.SubForm.Instance().SubFormRemove(' + FormPropertyId + "," + Index + ",\'" + SubFormName + '\');"><span class="btn-icon-wrap"><i class="fa fa-times remove-icon_ ' + FormPropertyId + '_' + Index + '"></i><span></span></span></a></div><div class="card-body divSubForm_' + FormPropertyId + '" id="divSubForm_' + FormPropertyId + '_' + Index + '"></div></div>';
- $(CurrentContainer).last().after(html);
- if (ChildFormData == undefined) {
- Unibase.Platform.Forms.Managers.FormManager.Instance().getForm(ChildFormId).then(function (response) {
- var forminfo = response.result;
- var formviewerObj = {
- FormId: 0,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: null,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var subformhtml = Unibase.Platform.Forms.Components.FormViewer.instance.loadFormHtml(forminfo, true, "container-subform-" + Index, formviewerObj, null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(subformhtml.JsFiles, function () {
- $("#divSubForm_" + FormPropertyId + '_' + Index).html(subformhtml.TotalFormHtml);
- $("#btnAddSubForm_" + FormPropertyId).attr("data-subformcount", Index + 1);
- });
- });
- }
- else {
- var forminfos = ChildFormData;
- for (var i = 0; i < forminfos.length; i++) {
- var forminfo = forminfos[i];
- var childPkid = forminfos[i].Pk_Value;
- var formviewerObj = {
- FormId: 0,
- AppConfigurationId: 0,
- Pk_Value: childPkid,
- PortletWidgetId: 0,
- OnSuccess: null,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var subformhtml = Unibase.Platform.Forms.Components.FormViewer.instance.loadFormHtml(forminfo, true, "container-subform-" + Index, formviewerObj, null);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(subformhtml.JsFiles, function () {
- $("#divSubForm_" + FormPropertyId + '_' + Index).html(subformhtml.TotalFormHtml);
- $("#btnAddSubForm_" + FormPropertyId).attr("data-subformcount", Index + 1);
- });
- }
- }
- }
- addButtonClickForList(FormPropertyId, pk_value, forminfos, ControlJsonText, prop) {
- var temp = $("#btnAddSubFormList_" + FormPropertyId).attr("data-subformcount");
- var Index = temp;
- var html = '';
- var ItemRowLen = $('.CheckList-row-' + Index).length;
- var isFormValid = true;
- $(".divSubFormList_" + FormPropertyId).find(".value-control").each(function () {
- let value = $(this).val();
- value = $.trim(value);
- if ((value == "" || value == null || value == "0" || value == undefined)) {
- isFormValid = false;
- }
- else {
- isFormValid = true;
- return false;
- }
- });
- if (isFormValid) {
- if ($("#divSubFormListData_" + FormPropertyId + ' tr').length == 0) {
- $("#divSubFormListData_" + FormPropertyId).closest('table').removeClass('hidden').addClass('mt-20');
- html += `<tr class="bg-light">`;
- $(".divSubFormList_" + FormPropertyId).find(".value-control").each(function () {
- var formpropertyname = $(this).parents(".container-subformlist-1").attr("data-formpropertyname");
- var controlname = $(this).parents(".container-subformlist-1").attr("data-controlname");
- var placeholdernameAuto = $(this).parents(".container-subformlist-1").attr("data-validatename");
- var placeholdername = $(this).parents(".container-subformlist-1").find(".value-control").attr("data-placeholder");
- var hiddenitem = controlname == "HiddenField" ? "hidden" : "";
- html += '<th ' + hiddenitem + '><div class="container-subform-list-' + Index + '" class="divsubformlist_placeholder" data-formpropertyname="' + formpropertyname + '"><input type="hidden" class="' + placeholdernameAuto + '" value="' + placeholdernameAuto + '"/><span class="CheckListItemName_placeholder" ' + hiddenitem + ' id="CheckListItemName_Placeholder' + Index + '" ><strong>' + placeholdernameAuto + '</strong></span>' +
- '<input type="hidden" value=' + Index + ' class="CheckListId_placeholder">' +
- '<input type="hidden" value=' + Index + ' class="hf_CheckListIndex_placeholder"></div></th>';
- });
- html += '<th class="font-weight-bold text-right">Delete</th></tr>';
- }
- let isHidden = "";
- $("#subFormTableFooter_" + FormPropertyId).removeClass('hidden');
- if ($("#divSubFormListData_" + FormPropertyId + ' tr').length >= 6) {
- isHidden = "hidden";
- $("#subFormTableFooter_" + FormPropertyId + " .checkListMoreBtn").removeClass('hidden');
- }
- html += '<tr class="' + isHidden + ' CheckList-item-row divSubForm_' + FormPropertyId + ' CheckList-row-' + Index + '" id="li_CheklistItem_' + Index + '" >' +
- '<input type="hidden" class="hf_CheckListId" value="' + Index + '">';
- var check = -1;
- $(".divSubFormList_" + FormPropertyId).find(".value-control").each(function () {
- if (($(this).val() == "") && ($(this).parents('.control-group').data('controlname') == 'NumberBox')) {
- $(this).val('0');
- }
- $(this).parent('.floating-label-form-group').removeClass('floating-label-form-group-with-value');
- var value = $(this).val();
- if ((value == "" || value == null || value == "0" || value == undefined) && (check != 1)) {
- check = 1;
- }
- else {
- check = 0;
- }
- var formpropertyname = $(this).parents(".container-subformlist-1").attr("data-formpropertyname");
- var controlname = $(this).parents(".container-subformlist-1").attr("data-controlname");
- var hiddenitem = controlname == "HiddenField" ? "hidden" : "";
- var text = "";
- if (controlname == "AutoComplete") {
- text = $("#" + $(this).attr("data-autotextid") + " option:selected").text();
- }
- else if (controlname == "DatePicker") {
- text = $(this).siblings('.datepicker-input').val();
- }
- else if (controlname == "DropDown") {
- text = $(this).find(":selected").text();
- }
- else if (controlname == "CascadingAutocomplete") {
- text = $("#" + $(this).attr("data-autotextid") + " option:selected").text();
- }
- else if (controlname == "Select2") {
- text = $(this).attr("data-text");
- }
- else {
- text = $(this).val();
- }
- var Id = $(this).attr("id");
- if (controlname == "HiddenField") {
- $("#" + Id).val("0");
- }
- if (controlname == "AutoComplete") {
- var autocompleteId = $(this).parent().find('select').attr("id");
- $("#" + autocompleteId).empty();
- }
- html += '<td ' + hiddenitem + '><div class="container-subform-list-' + Index + '" class="divsubformlist" data-formpropertyname="' + formpropertyname + '"><input type="hidden" class="value-control" value="' + value + '"/><span class="CheckListItemName" ' + hiddenitem + ' id="CheckListItemName_' + Index + '" >' + text + '</span>' +
- '<input type="hidden" value=' + Index + ' class="CheckListId" >' +
- '<input type="hidden" value=' + Index + ' class="hf_CheckListIndex"></div></td>';
- });
- html += '<td class="text-right">' +
- '<a class="btn-icon" href="javascript:;" onclick="Unibase.Forms.Controls.SubForm.Instance().removeChekList(' + Index + ',' + FormPropertyId + ');" >' +
- '<i class="fa fa-trash-o text-danger" ></i></a>' +
- '</td>' +
- '</tr>';
- $(".hf_CheckListId").val(Index);
- $("#divSubFormListData_" + FormPropertyId).append(html);
- $("#btnAddSubFormList_" + FormPropertyId).attr("data-subformcount", Number(Index) + 1);
- let totalRowsCount = $("#divSubFormListData_" + FormPropertyId + ' tr').length - 1;
- let visibleRowsCount = totalRowsCount - $("#divSubFormListData_" + FormPropertyId + ' tr.hidden').length;
- $("#subFormTableFooter_" + FormPropertyId).find('span.totalRowsCount').text(totalRowsCount);
- $("#subFormTableFooter_" + FormPropertyId).find('span.visibleRowsCount').text(visibleRowsCount);
- Unibase.Forms.Controls.SubForm.instance.loadSubformData(forminfos, ControlJsonText, prop);
- }
- }
- loadMoreSubFormlist(FormPropertyId) {
- $("#divSubFormListData_" + FormPropertyId + " tr.hidden").each(function (index, item) {
- if (index < 5) {
- $(item).removeClass('hidden');
- let totalRowsCount = $("#divSubFormListData_" + FormPropertyId + ' tr').length - 1;
- let visibleRowsCount = totalRowsCount - $("#divSubFormListData_" + FormPropertyId + ' tr.hidden').length;
- $("#subFormTableFooter_" + FormPropertyId).find('span.visibleRowsCount').text(visibleRowsCount);
- if (visibleRowsCount == totalRowsCount) {
- $("#subFormTableFooter_" + FormPropertyId + " .checkListMoreBtn").addClass('hidden');
- }
- }
- });
- }
- loadControl_delete(containerid, prop) {
- var Index = 0;
- SubForm.instance.Subprops = [];
- SubForm.instance.Subprops.push(prop);
- let html = '';
- var id = JSON.parse(prop.ControlJsonText);
- SubForm.Instance().EnableListFormSettings = id.EnableListFormSettings;
- SubForm.Instance().EnableSubFormSettings = id.EnableSubFormSettings;
- Unibase.Forms.Controls.SubForm.instance.loadingjsfiles(id);
- if ($('#EnableSubForm').length != 0 && $("#isclcikevent").val() == "true") {
- var FormPropertyId = prop.FormPropertyId + Number($("#SubFormIndex").val());
- html += '<div id="divSub_' + FormPropertyId + '" class="div_' + FormPropertyId + '"><input type="hidden" id="hdn_Containerid" value="' + containerid + '">';
- html += '</div>';
- }
- else {
- html += '<div id="div_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '" class="div_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '">';
- html += '</div>';
- }
- if ($('#EnableSubForm').length == 0) {
- html += '<input type="hidden" id="SubFormIndex" value="0">';
- }
- else if ($('#EnableSubForm').length != 0 && $("#isclcikevent").val() == "true") {
- html += '<input type="hidden" id="IsSubFormExist" value="true">';
- }
- SubForm.instance.Index = moment().valueOf();
- $("#" + containerid).html(html);
- if ($('#EnableSubForm').length == 0) {
- var html1 = '<div class="lastdiv"></div><div id="Subform_id"><input type="hidden" id="isclcikevent" value="false"><input type="hidden" id="SubformInstalledAppId" value="' + id.InstalledAppId + '"><input type="hidden" id="subform_FormPropertyId" value="' + prop.FormPropertyId + '"><input type="hidden" id="checkedevent" value="false"><input type="hidden" id="SubFormButtonText" value="' + id.ButtonName + '"><div class="row" id="EnableSubForm"></div>' +
- '<input type="hidden" id="Subform_ChildFormId" value="' + id.ChildFormId + '"><input type="hidden" id="MultipleSubFormIndex" value="0"><input type="hidden" id="Subform_DocPropertyName" value="' + prop.DocPropertyName + '"><input type="hidden" id="Subform_SectionName" value=""><input type="hidden" id="Subform_SubFormName" value="' + id.SubFormName + '"><input type="hidden" id="Subform_SectionId" value="' + prop.SectionId + '">';
- if (id.EnableSubFormSettings == true) {
- html1 += '<div class="col-sm-3 div_SubFormdetails" id="div_subformsettings">' +
- '<a href="javascript:;" class="btn btn-success text-white" onclick="Unibase.Forms.Controls.SubForm.Instance().subFormSettings(' + id.ChildFormId + ',Unibase.Forms.Controls.SubForm.Instance().Subprops[' + Index + '])"><span>' + id.ButtonName + '</span></a>' +
- '</div>';
- }
- html1 += '</div>';
- $("#" + containerid).append(html1);
- var value = Number($('#MultipleSubFormIndex').val());
- $('#MultipleSubFormIndex').val(value + 1);
- }
- }
- LoadCheckListForm(Index) {
- var len = $('.CheckList-row').length;
- if (len == 0) {
- len = 1;
- }
- let html = '<div class="card div_CheckListform col-sm-12"><div class="card-header"><span>Add Check Lists</span></div><div class="card-body CheckListform"><div class="CheckListform-row col-sm-2" id="CheckListform-row"></div><div class="CheckList-row added-row value-row card" id="div_Checklist_' + len + '">' +
- '<ul id="ul_chekList_items">' +
- '<li class="list-group-item" >' +
- '<div class="row">' +
- '<div class="col-11 ml-10" >' +
- '<div class="floating-label-form-group" ><input type="text" maxlength="500" class="form-control floating-label-control CheckListItem" id="txt_CheckListItem_' + len + '" data-isdynamic="false" placeholder="Checklist Item *" data-placeholder="Checklist Item *" data-label="Checklist Item *">' +
- '<input type="hidden" id="hf_CheckListId_' + len + '" ></div> ' +
- '</div>' +
- '<div class="row"><div class="col-6"><a id="btnAddItemPayout" href="javascript:;" onclick=" Unibase.Forms.Controls.SubForm.Instance().addNewCheckListItem(' + len + ')" class="btn-icon "><i class="fa fa-plus ml-25 mt-20"></i></a></div>' +
- '</div ></div >' +
- '</li>' +
- '<li class="CheckList-row-' + len + '" id="hfli_ChecklistItem_' + len + '"></li>' +
- '</ul></div>' +
- '</div>';
- $('#div_' + $("#Subform_DocPropertyName").val() + '_' + $("#subform_FormPropertyId").val() + '').after(html);
- }
- addNewCheckListItem(len) {
- var currentindex = 0;
- var formpropertyid = 0;
- var Index = Number(currentindex);
- var d = $(".hf_CheckListId").val();
- var i = Number(d);
- if (d == undefined) {
- Index = Index + 1;
- }
- else {
- Index = i + 1;
- }
- $("#SubFormIndex").val(Index);
- var BasicaddNewCheckListItem_Template = Unibase.Forms.Controls.SubForm.Instance().GetCheckListItem(Index, formpropertyid);
- var container_div = '<div class="container-subform-' + Index + '">' + BasicaddNewCheckListItem_Template + '</div>';
- $('#div_' + $("#Subform_DocPropertyName").val() + '_' + $("#subform_FormPropertyId").val() + '').after(BasicaddNewCheckListItem_Template);
- }
- GetCheckListItem(len, formpropertyid) {
- var temp = len;
- var Index = temp;
- var html = '';
- var emptyformpropertyname = "";
- var ItemRowLen = $('.CheckList-row-' + Index).length;
- let formpropertid;
- html += '<li class="list-group-item CheckList-item-row CheckList-row-' + Index + '" id="li_CheklistItem_' + Index + '">' +
- '<input type="hidden" class="hf_CheckListId" value="' + Index + '">' +
- '<div class="row" > ' +
- '<div class="col-11 row">';
- $(".container-subform-list-0").find(".value-control").each(function () {
- var id = $(this).attr('id');
- var FrmPropertyName = $(this).parents('.container-subform-list-0').data('formpropertyname');
- var FrmPrtyid = $(this).parents('.container-subform-list-0').data('formpropertyid');
- let formpropertyname = $("#" + id).val();
- formpropertid = $("#" + id).val();
- var cntrlclass = $(this).attr('class');
- var cls = cntrlclass.split(' ');
- var arraycontainsbycontrollername = (cls.indexOf("txtSeriesAutoComplete_" + FrmPropertyName) > -1);
- if (arraycontainsbycontrollername == true) {
- formpropertid = $("#" + id + " option:selected").val();
- formpropertyname = $("#" + id + " option:selected").text();
- var seriesautocompelete = $("#" + id + " option:selected").val();
- if (seriesautocompelete == undefined || seriesautocompelete == "0") {
- formpropertyname = "";
- }
- }
- var Autocompletecontrollername = (cls.indexOf("txtAutoComplete_" + FrmPropertyName) > -1);
- if (Autocompletecontrollername == true) {
- formpropertid = $("#" + id + " option:selected").val();
- formpropertyname = $("#" + id + " option:selected").text();
- var autocompelete = $("#" + id + " option:selected").val();
- if (autocompelete == undefined || seriesautocompelete == "0") {
- formpropertyname = "";
- }
- }
- var DropDowncontrollername = "ddl_" + FrmPropertyName + "_" + FrmPrtyid;
- if (DropDowncontrollername == id) {
- formpropertid = $("#" + id + " option:selected").val();
- formpropertyname = $("#" + id + " option:selected").text();
- var DropDown = $("#" + id + " option:selected").val();
- if (DropDown == undefined || seriesautocompelete == "0") {
- formpropertyname = "";
- }
- }
- if (formpropertyname != "" && formpropertyname != null) {
- if (formpropertid == "0") {
- formpropertyname = "";
- }
- html += '<div class="container-subform-' + Index + '" data-formpropertyname="' + FrmPropertyName + '"><input type="hidden" class="value-control" value="' + formpropertid + '"/><span class="CheckListItemName pl-25 col-sm-3" id="CheckListItemName_' + Index + '" >' + formpropertyname + '</span>' +
- '<input type="hidden" value=' + Index + ' class="CheckListId" >' +
- '<input type="hidden" value=' + Index + ' class="hf_CheckListIndex"></div>';
- $("#" + id).val(0);
- $("#" + id + " option:selected").val(0);
- $("#" + id + " option:selected").text('-- Select --');
- }
- emptyformpropertyname += formpropertyname;
- });
- html += '</div><div class="col-1 ml-md-2 pl-md-60">' +
- '<a class="btn-icon" href="javascript:;" onclick="Unibase.Forms.Controls.SubForm.Instance().removeChekList(' + Index + ',' + formpropertyid + ');" >' +
- '<i class="fa fa-trash-o text-danger" ></i></a>' +
- '</div></div>' +
- '</li>';
- $(".hf_CheckListId").val(Index);
- if (emptyformpropertyname == "" || emptyformpropertyname == "0") {
- html = "";
- }
- return html;
- }
- removeChekList(CheckListIndex, formProperyId) {
- let checkListItem = $('#divSubFormListData_' + formProperyId + ' #li_CheklistItem_' + CheckListIndex);
- let tableDiv = $(checkListItem).closest('table');
- let tableBody = $(checkListItem).parent('tbody');
- let tableFooter = $(tableDiv).parent('.table-responsive').next('.subFormListFooter');
- if ($(tableDiv).find('tr').length == 2) {
- $(tableDiv).addClass('hidden').removeClass('mt-20');
- $(tableFooter).addClass('hidden');
- $(checkListItem).parent().html('');
- }
- $(checkListItem).remove();
- let totalRowsCount = tableBody.find('tr').length - 1;
- let visibleRowsCount = totalRowsCount - tableBody.find('tr.hidden').length;
- if (visibleRowsCount <= 5) {
- if ($(tableBody).find('tr.hidden').length > 0) {
- $(tableBody).find('tr.hidden').first().removeClass('hidden');
- visibleRowsCount += 1;
- }
- }
- $(tableFooter).find('span.totalRowsCount').text(totalRowsCount);
- $(tableFooter).find('span.visibleRowsCount').text(visibleRowsCount);
- if (visibleRowsCount == totalRowsCount) {
- tableFooter.find('.checkListMoreBtn').addClass('hidden');
- }
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return ``;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return ``;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#txt_" + formpropertyid).val(propval);
- }
- subFormSettings(formid, prop) {
- var setting = JSON.parse(prop.ControlJsonText);
- var subformlistSetting = setting.EnableListFormSettings;
- var containerClass = "container-subform-" + $("#SubFormIndex").val();
- if (subformlistSetting == true) {
- containerClass = "container-subform-list-" + $("#SubFormIndex").val();
- }
- var rowid = moment().valueOf();
- $("#isclcikevent").val("true");
- $("#Subform_id").addClass('hidden');
- $(".div_SubFormdetails").addClass('hidden');
- var sectionnanme = $("#section_" + prop.SectionId).text();
- var value = Number($("#SubFormIndex").val()) + 1;
- $("#SubFormIndex").val(value);
- $("#Subform_SectionName").val(sectionnanme);
- $("#Subform_SectionId").val(prop.SectionId);
- SubForm.instance.Index = rowid;
- var successCallBack = {
- CallBack: function (id) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var rowid = Bizgaze.Forms.Controls.Tax.Instance().length;
- Bizgaze.Forms.Controls.Tax.Instance().bindLedgers(rowid, response.result.LedgerId, response.result.LedgerName);
- });
- },
- Parameters: null,
- };
- var formviewerObj = {
- FormId: Number($("#Subform_ChildFormId").val()),
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successCallBack,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var viewererobj = new Unibase.Platform.Forms.Components.FormViewer();
- viewererobj.init(formviewerObj);
- }
- SubFormRemove(formpropertyid, Index, subformname) {
- var totalcount = Number($("#btnAddSubForm_" + formpropertyid).data("subformcount"));
- $("#btnAddSubForm_" + formpropertyid).data("subformcount", totalcount - 1);
- $('.divNextSubForm_' + formpropertyid + '.subform_' + Index).remove();
- SubForm.instance.refreshList(formpropertyid, subformname);
- }
- refreshList(formpropertyid, subformname) {
- var index = 0;
- $('.divNextSubForm_' + formpropertyid + '.subformcls').each(function () {
- index++;
- $(this).find(".subforname_" + formpropertyid).text(subformname + "-" + index);
- });
- }
- loadhtml(Index, prop, RoleClass, SubformIndex) {
- var html = "";
- let subformlistSetting;
- var setting = JSON.parse(prop.ControlJsonText);
- if (setting != null) {
- subformlistSetting = setting.EnableListFormSettings;
- }
- else {
- subformlistSetting = false;
- }
- var containerClass = "container-subform-" + SubformIndex;
- if (subformlistSetting == true) {
- containerClass = "container-subform-list-" + SubformIndex;
- }
- if ($("#isclcikevent").val() == "true") {
- html += '<div id="control-container-' + prop.UniqueId + '" class="control-group ' + containerClass + ' divCustomProperties_' + prop.DocPropertyName + ' controldata_' + prop.DocPropertyId + ' col-sm-' + prop.PropertyWidth + RoleClass + '" data-size="' + prop.PropertyWidth + '" data-propertyname="' + prop.DocPropertyName + '" data-propertyid="' + prop.DocPropertyId + '" data-doctypeid="' + prop.DocTypeId + '" data-level="' + prop.Level + '" data-doctypetable="' + prop.DocTypeTableName + '" data-doctypename="' + prop.DocTypeName + '" data-isdefault="' + prop.IsDefault + '" data-RowIndex="' + prop.RowIndex + '" data-formpropertyid="' + prop.FormPropertyId + '" data-controlname="' + prop.ControlName + '" data-formpropertyname="' + prop.FormPropertyName + '" data-validatename="' + prop.LabelName + '"></div>';
- }
- else if (prop.ControlName == "SubForm") {
- html += '<div id="control-container-' + prop.FormPropertyId + '" class="control-group divCustomProperties divCustomProperties_' + prop.DocPropertyName + ' controldata_' + prop.DocPropertyId + ' col-sm-12' + RoleClass + '" data-size="' + prop.PropertyWidth + '" data-propertyname="' + prop.DocPropertyName + '" data-propertyid="' + prop.DocPropertyId + '" data-doctypeid="' + prop.DocTypeId + '" data-level="' + prop.Level + '" data-doctypetable="' + prop.DocTypeTableName + '" data-doctypename="' + prop.DocTypeName + '" data-isdefault="' + prop.IsDefault + '" data-RowIndex="' + prop.RowIndex + '" data-formpropertyid="' + prop.FormPropertyId + '" data-controlname="' + prop.ControlName + '" data-formpropertyname="' + prop.FormPropertyName + '" data-validatename="' + prop.LabelName + '"></div>';
- }
- return html;
- }
- finalhtml(html, totalform, prop, script, formcontainerclass) {
- var Subtotalform = '<script type="text/javascript">' +
- '$(document).ready(function () {' +
- 'var _fileCacheHelper = Unibase.Platform.Helpers.FileCacheHelper.Instance();' +
- '_fileCacheHelper.loadJsFile("' + prop.JsUrl + '", function () {' + script +
- prop.FormJsVariableName + '.Instance();';
- if (prop.JsText != "" && prop.JsText != null) {
- var RegExp_Prop = new RegExp("{{container}}", "gi");
- var jstext = prop.JsText.replace(RegExp_Prop, formcontainerclass);
- Subtotalform += jstext;
- }
- Subtotalform += '});});</script>';
- if ($("#IsSubFormExist").val() == "true") {
- $("#subform_FormPropertyId").val();
- var Id = Number($("#subform_FormPropertyId").val()) + Number($("#SubFormIndex").val());
- ;
- var Containerid1 = $("#hdn_Containerid").val();
- var sub1 = html;
- sub1 += Subtotalform;
- $("#" + Containerid1).removeClass();
- $("#" + Containerid1).addClass('control-group divCustomProperties controldata_ col-sm-12');
- $("#" + Containerid1).find('#divSub_' + Id).append(sub1);
- $("#IsSubFormExist").val("false");
- }
- else if ($("#isclcikevent").val() == "true") {
- $(".div_SubFormdetai").empty();
- $(".div_SubFormdetai").removeAttr("style");
- var rowid1 = moment().valueOf();
- var SectionName = $("#Subform_SectionName").val();
- var SectionId = $("#Subform_SectionId").val();
- var ChildFormId = Number($("#Subform_ChildFormId").val());
- var index = SubForm.instance.Index;
- var FormPropertyid = $("#subform_FormPropertyId").val();
- var sub = '<div class="section_' + SectionName + ' card">';
- sub += '<div class="card-header" id="section_' + SectionId + '">' + SectionName + '</div>';
- sub = '<div class="dummy ' + formcontainerclass + '">' + html + '</div>';
- sub += Subtotalform;
- sub += '</div>';
- sub += '<div class="lastdiv"></div><div class="col-sm-3 div_SubFormdetai" style="padding-bottom:20px" id="div_subformsettings' + index + '">' +
- '<a href="javascript:;" class="btn btn-success text-white" title="Delete Item" onclick="Unibase.Forms.Controls.SubForm.Instance().subFormSettings(' + ChildFormId + ',Unibase.Forms.Controls.SubForm.Instance().Subprops[0])"><span>' + $("#SubFormButtonText").val() + '</span></a>' +
- '</div>';
- $(".lastdiv:last").after(sub);
- $("#IsSubFormExist").val("false");
- }
- else {
- $('#div_' + $("#Subform_DocPropertyName").val() + '_' + $("#subform_FormPropertyId").val() + '').append(totalform);
- }
- }
- loadingjsfiles(props) {
- Unibase.Platform.Forms.Managers.FormManager.Instance().getForm(props.ChildFormId).then(function (response) {
- var data = response.result;
- var json = JSON.parse(data.FormJson);
- for (var k = 0; k < json.Sections.length; k++) {
- var section = json.Sections[k];
- for (var j = 0; j < section.FormProperties.length; j++) {
- var prop = section.FormProperties[j];
- if (prop != undefined) {
- if (prop.PropertyType != "Section") {
- var controljsurl = prop.ControlJsUrl;
- controljsurl = controljsurl;
- var _fileCacheHelper = Unibase.Platform.Helpers.FileCacheHelper.Instance();
- _fileCacheHelper.loadJsFile(controljsurl, function () { });
- }
- }
- }
- }
- var subformlistSetting = props.EnableListFormSettings;
- var containerClass = "container-subform-" + $("#SubFormIndex").val();
- if (subformlistSetting == true) {
- containerClass = "container-subform-list-" + $("#SubFormIndex").val();
- }
- var successCallBack = {
- CallBack: function (id) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var rowid = Bizgaze.Forms.Controls.Tax.Instance().length;
- Bizgaze.Forms.Controls.Tax.Instance().bindLedgers(rowid, response.result.LedgerId, response.result.LedgerName);
- });
- },
- Parameters: null,
- };
- var formviewerObj = {
- FormId: props.ChildFormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successCallBack,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- var viewererobj = new Unibase.Platform.Forms.Components.FormViewer();
- viewererobj.init(formviewerObj);
- });
- }
- removeRequiredclass(container) {
- $("." + container).find('.type-control').each(function () {
- var id = $(this).attr('id');
- var viewererobj = new Unibase.Platform.Forms.Components.FormViewer();
- viewererobj.removeRequiredClass("#" + id);
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new SubForm();
- }
- return this.instance;
- }
- }
- Controls.SubForm = SubForm;
- class SubFormSetting {
- }
- Controls.SubFormSetting = SubFormSetting;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let Files;
- (function (Files) {
- let Managers;
- (function (Managers) {
- class FileManager extends Platform.Core.BaseManager {
- validateDocument(Id, InstalledAppId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/validatedocument/pkid/' + Id + '/installedappid/' + InstalledAppId;
- return yield this.dataHelper().postAsync(url, null).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- validateDocumentByGroup(Id, InstalledAppId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/validatedocumentbygroup/pkid/' + Id + '/installedappid/' + InstalledAppId;
- return yield this.dataHelper().postAsync(url, null).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getDocumentTypes() {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/documenttypes';
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getDocumentFile(Id) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/getdocumentfile/fileid/' + Id;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getDocumentBase64File(Id) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/getebase64documentfile/id/' + Id;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getDocumentByRefId(refid, formpropertyid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/getdocumentbyrefid/refid/' + refid + '/formpropertyid/' + formpropertyid;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result !== "")
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- deleteDocumentFile(DocumentFileId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/deletedocumentfile/documentfileid/' + DocumentFileId;
- return yield this.dataHelper().postAsync(url, null).then(function (response) {
- return response;
- });
- });
- }
- updateFileProvider(fileproviderid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/updatefileprovider/fileproviderid/' + fileproviderid;
- return yield this.dataHelper().postAsync(url, null).then(function (response) {
- return response;
- });
- });
- }
- getfileprovider() {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/gettenant';
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- _tempFileSave(postData) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/forms/uploadfile';
- return yield this.dataHelper().postAsync(url, postData).then(function (response) {
- return response;
- });
- });
- }
- getDocumentByRefIdApi(RefId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/platform/files/getdocumentbyrefidapi/refid/' + RefId;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result !== "")
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new FileManager();
- }
- return this.instance;
- }
- }
- Managers.FileManager = FileManager;
- })(Managers = Files.Managers || (Files.Managers = {}));
- })(Files = Platform.Files || (Platform.Files = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class hiddenfield {
- init(formpropertyid, prop, callback) {
- var instance = new hiddenfield();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- var defaultvalue = "0";
- if (prop.PropertySettings != null) {
- for (var i = 0; i < prop.PropertySettings.length; i++) {
- var data = prop.PropertySettings[i];
- if (prop.DataTypeId == 9) {
- if (data.ControlPropertyName == "DefaultValue" && data.ControlPropertyValue != "") {
- defaultvalue = data.ControlPropertyValue;
- }
- }
- }
- }
- let html = '<div class="hidden">' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '"><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<input type="hidden" id="hdn_' + prop.FormPropertyId + '" class="hdn_' + prop.DocPropertyName + ' form-control type-control value-control floating-label-control" placeholder="' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + reqMark + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '" value="' + defaultvalue + '">' +
- '</div>';
- $("#" + containerid).html(html);
- if (Unibase.Platform.Forms.Components.FormViewer.Instance().DesignerMode == false) {
- $("#" + containerid).addClass("hidden");
- }
- else {
- $("#" + containerid).removeClass("hidden");
- }
- $(".divCustomFormProperties[data-sectionname='Hidden']").css("height", "25");
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "DefaultValue" && data.ControlPropertyValue != "") {
- $("#hdn_" + formpropertyid).attr("DefaultValue", data.ControlPropertyValue);
- $("#hdn_" + formpropertyid).val(data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#hdn_" + formpropertyid).val(propval);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new hiddenfield();
- }
- return this.instance;
- }
- }
- Controls.hiddenfield = hiddenfield;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class AutoComplete extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this.FormAutoUniqueId = null;
- this.loadCascading = true;
- this.container = null;
- this.DocPropertyId = 0;
- this.FormPropertyId = 0;
- this.FormPropertyName = "";
- this.FormId = 0;
- this.totalreportdatafilter = [];
- this.totalreportid = 0;
- this.mappingtextcolumn = null;
- this.mappingidcolumn = null;
- }
- init(formpropertyid, prop, callback) {
- var instance = AutoComplete.Instance();
- var container = $("#txtAutoComplete_" + prop.UniqueId);
- instance.LoadAutoComplete(container, null).then(function () {
- if (callback != null)
- callback();
- });
- var autoSettingData = JSON.parse(prop.ControlJsonText);
- if (autoSettingData.AppConfigId != 0) {
- $(container).change(function () {
- if ($("#txtAutoComplete_" + prop.UniqueId + " option:selected").text() == "Create New") {
- var autoContainer = "autocomplete_" + prop.FormPropertyId;
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormByAppConfiguration(autoSettingData.AppConfigId).then(function (response) {
- var formid = response.result.FormId;
- $("#txtAutoComplete_" + prop.UniqueId).text('');
- $("#hfAutoCompleteId_" + prop.UniqueId).val('');
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).FormPropertyName = prop.FormPropertyName;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).container = "#txtAutoComplete_" + prop.UniqueId;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).DocPropertyId = prop.DocPropertyId;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).FormPropertyId = prop.FormPropertyId;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).FormId = formid;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).FormAutoUniqueId = "autocomplete_" + prop.UniqueId + "_" + response.result.FormId;
- var successCallBack = {
- CallBack: function (id) {
- let AppConfigType = Unibase.Platform.Forms.Components.FormViewer.instance.AppConfigType;
- Unibase.Platform.Forms.Components.FormViewer.instance.AppConfigType = 0;
- Unibase.Platform.Forms.Managers.FormManager.Instance().getAutocompleteSelectedData(Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).DocPropertyId, id, Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).FormPropertyId, 0).then(function (response) {
- var selectedOptions = new Option(response.result[0].DisplayText, response.result[0].Value, true);
- $(Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).container).append(selectedOptions).trigger('change');
- Unibase.Platform.Forms.Components.FormViewer.instance.AppConfigType = AppConfigType;
- });
- },
- Parameters: null,
- };
- var formviewerObj = {
- FormId: formid,
- AppConfigurationId: autoSettingData.AppConfigId,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successCallBack,
- OnFail: null,
- OnLoad: null,
- FormContainer: null,
- };
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- });
- }
- else {
- var IdFormPropertyid = $("#hfAutoCompleteId_" + prop.UniqueId).data("textformpropertyid");
- $("#hdn_" + IdFormPropertyid).val($("#txtAutoComplete_" + prop.UniqueId + " option:selected").text());
- }
- });
- }
- }
- loadControl(containerid, prop) {
- var instance = this;
- var jsfiles = ["platform/controls/cascadingautocomplete/cascadingautocomplete.component.js", "platform/controls/cascadingautocomplete/cascadingautocomplete.settings.js"];
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- }
- var IsTagSelect = false;
- var text;
- if (prop.ControlJsonText != "" && prop.ControlJsonText != null && prop.ControlJsonText != undefined) {
- var text = JSON.parse(prop.ControlJsonText);
- if (text["IsTagSelect"] == true) {
- IsTagSelect = true;
- }
- }
- var divclass = text.ShowTotalReportData == true ? 'col-sm-11 col-11' : 'col-sm-12';
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = `<div id="div_${prop.DocPropertyName}" style=""><label for="lbl" id="lbl_${prop.DocPropertyName}">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger hide ${Isrequired}" id="spnIsRequired_${prop.FormPropertyId}"> *</span></label><div class="input-group ">` +
- '<div class="' + divclass + '" style="margin:0px;padding:0px;"><select id="txtAutoComplete_' + prop.UniqueId + '" class="txtAutoComplete_' + prop.DocPropertyName + ' form-control type-control text-control select_address ' + required + ' " data-isdefault="' + prop.IsDefault + '" style="width:100%;" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-istagselect="' + IsTagSelect + '" data-propertyid="' + prop.DocPropertyId + '" data-propertyname="' + prop.DocPropertyName + '" data-formpropertyid="' + prop.FormPropertyId + '" data-formid="' + text.FormId + '" value="0" data-textformpropertyid="' + text.TextFormPropertyId + '" data-showtotalreportdata="' + text.ShowTotalReportData + '" ></select>' +
- '<input type="hidden" id="hfAutoCompleteId_' + prop.UniqueId + '" value="0" class="hfAutoCompleteId_' + prop.DocPropertyName + ' form-control value-control" data-autotextid="txtAutoComplete_' + prop.UniqueId + '" data-required="' + prop.IsRequired + '" data- data-regularexp="" data-validatemsg="" />' + helpTextHtml + '</div>';
- if (text.ShowTotalReportData == true) {
- html += '<div class=" col-sm-1 col-1 input-group-append" style=";margin:0px;padding:0px;">' +
- '<a class="CheckOutButton align-items-center btn btn-primary btn-xs d-flex h-100 justify-content-center" href="javascript:;" id="hf_totalreportdata_' + prop.UniqueId + '" onclick="javascript:return Unibase.Forms.Controls.AutoComplete.Instance().loadTotalReportData(' + text.TotalDataReportId + ',' + "'" + text.MappingTextColumn + "'" + ',' + "'" + text.MappingIdColumn + "','" + "txtAutoComplete_" + prop.UniqueId + "'" + ',' + prop.FormPropertyId + ')" > <i class="la la-retweet font-18 line-height-12"></i></a></div>';
- }
- html += '</div><input type="hidden" id="hfId_' + prop.DocPropertyName + '" value=""><label for="Validation" id="lblValidation_' + prop.DocPropertyName + '"></label></div>';
- $("#" + containerid).html(html);
- $("#" + containerid).find("#txtAutoComplete_" + prop.UniqueId).on('change', function () {
- instance.fileCacheHelper.loadJsFiles(jsfiles, function () {
- var controlJson = prop.ControlJsonText;
- if (instance.loadCascading) {
- Unibase.Forms.Controls.CascadingAutocomplete.Instance().ChildCascadingData(false, prop.FormPropertyId, Number($("#txtAutoComplete_" + prop.UniqueId).val()), 0, '');
- }
- instance.loadCascading = true;
- });
- });
- }
- loadTotalReportData(ReportId, TextColumn, IdColumn, Element, FormPropertyId) {
- Unibase.Platform.Analytics.Viewers.TableViewer.Instance().IsSelectable = true;
- Unibase.Platform.Analytics.Viewers.TableViewer.Instance().TextColumn = TextColumn;
- Unibase.Platform.Analytics.Viewers.TableViewer.Instance().IdColumn = IdColumn;
- Unibase.Platform.Analytics.Viewers.TableViewer.Instance().AutoCompleteElement = Element;
- var localinstance = Unibase.Platform.Analytics.Components.ReportViewer.Instance();
- let reportViewerInstance = Unibase.Platform.Helpers.NavigationHelper.reportViewerInstance;
- var isInstance = false;
- const containerid = "reportviewer_" + ReportId;
- if (reportViewerInstance.length > 0)
- isInstance = reportViewerInstance.find(rv => rv.childcontainerid == "reportviewer_" + ReportId) ? true : false;
- if (!isInstance) {
- reportViewerInstance.push({
- instance: localinstance,
- childcontainerid: containerid,
- parentcontainerid: null
- });
- }
- else {
- var tempinstance = reportViewerInstance.find(rv => rv.childcontainerid == "reportviewer_" + ReportId);
- localinstance = tempinstance.instance;
- }
- var autoContainer = "autocomplete_" + FormPropertyId;
- localinstance.dynamicFilters = Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).totalreportdatafilter;
- if (ReportId != undefined)
- Unibase.Platform.Helpers.NavigationHelper.Instance().popup(ReportId, containerid, localinstance, function () {
- $(`#ViewerFooter_${containerid}`).removeClass('d-none').find(`#div_pagination_${containerid}`).addClass('d-none');
- $(`#ReportClose_${containerid}`).removeClass('hidden pull-right');
- $(`#reportCloseBtn_${containerid}`).removeClass('d-none');
- }, Unibase.Platform.Helpers.Size.DockLeft);
- }
- reportOnClick(TextColumn, IdColumn, element) {
- var selectedOptions = new Option(TextColumn, IdColumn, true);
- $("#" + element).append(selectedOptions);
- jQuery("#" + element).val(IdColumn).trigger('change');
- Unibase.Platform.Helpers.NavigationHelper.Instance().closePopUp();
- Unibase.Platform.Analytics.Viewers.TableViewer.Instance().IsSelectable = false;
- }
- loadControlSettings() {
- return ``;
- }
- LoadAutoComplete(Container, Parameters) {
- return __awaiter(this, void 0, void 0, function* () {
- var DocPropertyId = Container.data('propertyid');
- var DocPropertyName = Container.data('propertyname');
- var FormPropertyId = Container.data('formpropertyid');
- var FormId = Container.data('formid');
- var ColumnName = "0";
- var Value = "0";
- var reportfilter = [];
- if (Parameters != null && Parameters != "") {
- ColumnName = Parameters.map(function (item) { return item.ColumnName; }).toString();
- Value = Parameters.map(function (item) { return item.Value + "|"; }).toString();
- }
- var uniqueid = $(Container).attr('id').split('_')[1];
- var textCol = Container;
- var idCol = $("#hfAutoCompleteId_" + uniqueid);
- var istagselect = false;
- if ($("#txtAutoComplete_" + uniqueid).data("istagselect") == true) {
- istagselect = true;
- }
- var showtotalreportdata = $(Container).data("showtotalreportdata");
- if (showtotalreportdata) {
- if (Parameters != null && Parameters != "") {
- Parameters.map(function (item) {
- var reportfilterobj = { ParameterName: item.ColumnName, ParameterValue: item.Value.toString(), ExpOp: Unibase.Platform.Core.Enums.ExpressionOperator.Equals };
- reportfilter.push(reportfilterobj);
- });
- }
- var autoContainer = "autocomplete_" + FormPropertyId;
- Unibase.Forms.Controls.AutoComplete.localInstance(autoContainer).totalreportdatafilter = reportfilter;
- }
- var bindedData = undefined;
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autocomplete/docpropertyid/' + DocPropertyId + '/columnname/' + ColumnName + '/value/' + Value + '/formpropertyid/' + FormPropertyId + '/formid/' + FormId + '/bindeddata/' + bindedData;
- AutoCompleteHelper.getHelper().Create(textCol, idCol, url, function (response) {
- var data = response;
- }, istagselect);
- $(textCol).on('select2:open', function () {
- var id = $(textCol).attr("id");
- let searchField = $('#select2-' + id + '-results').parents('.select2-container').find('.select2-search__field');
- if (istagselect == true && searchField.val() == "") {
- searchField.val($("#" + id + " option:selected").text());
- }
- });
- $(textCol).on('select2:select', function () {
- if (istagselect == true) {
- var id = $(textCol).attr("id");
- var isFreeText = $("#" + id + " option:selected").attr('data-select2-tag');
- if (isFreeText == "true") {
- $(textCol).attr('data-addldata', "");
- }
- }
- });
- var autocompleteid1 = $(".txtAutoComplete_" + DocPropertyName).attr('id');
- });
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return ``;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- if (propval != "null") {
- var instance = this;
- var autojson = JSON.parse(propval);
- var IdValue = autojson.AutoCompleteIdColumn;
- var TextValue = autojson.AutoCompleteTextColumn;
- var selectedOptions = new Option(TextValue, IdValue, true);
- if (IdValue != "0") {
- $("#txtAutoComplete_" + formpropertyid).append(selectedOptions);
- instance.loadCascading = false;
- jQuery("#txtAutoComplete_" + formpropertyid).val(IdValue).trigger("change");
- }
- }
- }
- GetOrAddCurrentAutoCompleteInstance(ContainerId) {
- if (ContainerId != undefined && ContainerId != null && ContainerId != "") {
- let isInstance = false;
- let formControlInstance = Unibase.Platform.Forms.Components.FormViewer.formControlInstances;
- if (formControlInstance.length > 0)
- isInstance = formControlInstance.find(fv => fv.containerid == ContainerId) ? true : false;
- var viewerInstance = new Unibase.Forms.Controls.AutoComplete();
- var currentinstance = {
- instance: viewerInstance,
- containerid: ContainerId,
- };
- if (isInstance == true) {
- viewerInstance = formControlInstance.find(fv => fv.containerid == ContainerId).instance;
- }
- if (!isInstance)
- formControlInstance.push(currentinstance);
- return viewerInstance;
- }
- }
- static localInstance(ContainerId) {
- var formobj = new Unibase.Forms.Controls.AutoComplete();
- this.instance = formobj.GetOrAddCurrentAutoCompleteInstance(ContainerId);
- return this.instance;
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new AutoComplete();
- }
- return this.instance;
- }
- }
- Controls.AutoComplete = AutoComplete;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class Series {
- init(formpropertyid, prop, callback) {
- var instance = Series.Instance();
- var container = "control-container-" + prop.UniqueId;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/series/managers/seriesmanager.js', function () {
- instance.sereisAutoComplete(container, prop).then(function () {
- if (callback != null)
- callback();
- });
- });
- }
- loadControl(containerid, prop) {
- var requiredClass = 'required';
- let ControlId = 'txt_' + prop.FormPropertyId;
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- let html = '<div id="divAutoComplete_' + prop.FormPropertyId + '" class="div_' + prop.DocPropertyName + '" style="border-bottom:0;">' +
- '<label for= "lbl" id = "lbl_' + prop.DocPropertyName + '" >' + prop.LabelName + '<span class="text-danger hide ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '"> *</span></label>' +
- '<div class="input-group"><select id="txtSeriesAutoComplete_' + prop.FormPropertyId + '" class="txt_series_autocomplete txtSeriesAutoComplete_' + prop.FormPropertyId + ' value-control txtSeriesAutoComplete_' + prop.DocPropertyName + ' form-control text-control ' + required + '" data-isdefault="' + prop.IsDefault + '" style="width:100%;" placeholder = "' + prop.Placeholder + '" data-required="' + prop.IsRequired + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" ><option value="">-- Select --</option></select>';
- html += '</div></div>';
- if (prop.ControlJsonText != "" && prop.ControlJsonText != null) {
- var Response = prop;
- var data = JSON.parse(prop.ControlJsonText);
- if (data != null && data != "") {
- html += '<div id="divTxtBox_' + data.FormPropertyId + '" class="hidden"><div class="floating-label-form-group divTxtBox_' + data.FormPropertyId + '" >' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">Code<span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + data.FormPropertyId + '"> *</span></label>' +
- '<div class="manualseriesvalue"data-id="' + data.FormPropertyId + '">' +
- '<input type="text" onchange ="Unibase.Forms.Controls.Series.Instance().TextSeriesChange(' + data.FormPropertyId + ',' + prop.FormPropertyId + ');" id="TextSeries_' + data.FormPropertyId + '"" class="TextManualSeries form-control floating-label-control" placeholder="Enter Manual Series" data-placeholder="Enter Manual Series" data-label=Code data-regularexp="" data-validatemsg="">' +
- '<input type="hidden" class="manualseriesvalue" id="hfManualseries_' + data.FormPropertyId + '" value="" /><span id="clearManualSeries" onclick="Unibase.Forms.Controls.Series.Instance().clearManualSeries(`' + containerid + '`,' + data.FormPropertyId + ',' + prop.FormPropertyId + ')" class="fa fa-close font-15 mr-10 field-icon"></span>' +
- '</div>' +
- '</div></div>';
- }
- }
- $("#" + containerid).html(html);
- if (prop.Value == "0")
- Unibase.Forms.Controls.Series.Instance().EditSeries(prop);
- if (prop.Value != "0")
- $('.divisManualSeries_' + prop.FormPropertyId).addClass("hidden");
- $("#txtSeriesAutoComplete_" + prop.FormPropertyId).change(function () {
- var seriesTypeData = $("#txtSeriesAutoComplete_" + prop.FormPropertyId).select2('data')[0];
- var isManual = seriesTypeData.AddlData;
- if (isManual) {
- $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
- $("#TextSeries_" + data.FormPropertyId).addClass('required');
- var code = $('#hdn_' + data.FormPropertyId).val();
- if (code != null && code != undefined && code != "" && code != "0" && prop.Value != "0") {
- $('#TextSeries_' + data.FormPropertyId).val(code);
- $('#clearManualSeries').addClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).addClass("floating-label-form-group-with-value");
- }
- }
- else {
- $('#divAutoComplete_' + prop.FormPropertyId).removeClass("hidden");
- $('#divTxtBox_' + data.FormPropertyId).addClass("hidden");
- $('#TextSeries_' + data.FormPropertyId).val("");
- $("#TextSeries_" + data.FormPropertyId).removeClass('required');
- }
- });
- }
- TextSeriesChange(FormPropertyId, SeriesId) {
- if ($('#TextSeries_' + FormPropertyId).val() != "") {
- $('#TextSeries_' + FormPropertyId).removeClass('required');
- var hiddenpropid = $("#control-container-" + FormPropertyId).attr('data-formpropertyid');
- if (hiddenpropid == FormPropertyId) {
- $('#hdn_' + FormPropertyId).val($('#TextSeries_' + FormPropertyId).val());
- $('.txtSeriesAutoComplete_' + SeriesId).removeClass('required');
- }
- }
- }
- clearManualSeries(containerId, codeFormPropertyId, seriesFormPropertyId) {
- $(".txtSeriesAutoComplete_" + seriesFormPropertyId + " option:selected").text('');
- var html = '<option value=""></option>';
- $('.txt_series_autocomplete').append(html);
- $(".txt_series_autocomplete").val("");
- $('#TextSeries_' + codeFormPropertyId).val("");
- $('#divAutoComplete_' + seriesFormPropertyId).removeClass("hidden");
- $('#divTxtBox_' + codeFormPropertyId).addClass("hidden");
- $('#TextSeries_' + codeFormPropertyId).val("");
- $("#TextSeries_" + codeFormPropertyId).removeClass('required');
- }
- EditSeries(prop) {
- if (prop.Value == "0") {
- var data = JSON.parse(prop.ControlJsonText);
- $('#divTxtBox_' + data.FormPropertyId).removeClass("hidden");
- $('#divAutoComplete_' + prop.FormPropertyId).addClass("hidden");
- var Code = $('#hdn_' + data.FormPropertyId).val();
- $('#TextSeries_' + data.FormPropertyId).val(Code);
- $('#divTxtBox_' + data.FormPropertyId).addClass('floating-label-form-group-with-value');
- var html = '<option value="0"></option>';
- $('.txt_series_autocomplete').append(html);
- $(".txt_series_autocomplete").val(0).trigger('change');
- $(".TextManualSeries").prop('disabled', true);
- }
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#txtSeriesAutoComplete_" + formpropertyid).val(propval).trigger('change');
- }
- LoadSeriesAutoComplete(docPropertyName, DocPropertyId, containerid) {
- var FormPropertyId = $('#' + containerid).find(".txtSeriesAutoComplete_" + docPropertyName).parents(".divCustomProperties").data("formpropertyid");
- var installedappid = $("#" + containerid).parents(".formValidate").find("#hf_FormInstalledAppId").val();
- var appkeyid = $("#" + containerid).parents(".formValidate").find("#hf_FormAppKeyId").val();
- var TextId = $('#' + containerid).find("#txtSeriesAutoComplete_" + FormPropertyId);
- var hiddenId = $('#' + containerid).find("#hfSeriesAutoCompleteId_" + FormPropertyId + '_' + docPropertyName);
- }
- sereisAutoComplete(containerid, prop) {
- return __awaiter(this, void 0, void 0, function* () {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- var Forminstalledappid = Unibase.Platform.Forms.Components.FormViewer.instance.FormInstalledAppId;
- var issubform = $("#" + containerid).attr('data-issubform');
- if (issubform == "true") {
- var subforminstalledappid = $("#" + containerid).parents(".control-group").attr("data-installedappid");
- installedappid = Number(subforminstalledappid);
- }
- else if (installedappid == undefined) {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- }
- else {
- var installedappid = Unibase.Platform.Forms.Components.FormViewer.instance.InstalledAppId;
- }
- var Id = Forminstalledappid;
- if (installedappid == Forminstalledappid || Forminstalledappid == 0) {
- Id = installedappid;
- }
- else {
- Id = Forminstalledappid;
- }
- yield Unibase.Platform.Series.Managers.SeriesManager.Instance().getActiveSeries(0, Id).then(function (response) {
- var controlData = [];
- var count = response.result.length;
- for (let i = 0; i < response.result.length; i++) {
- var controls = response.result[i];
- if (count == 1) {
- controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering, selected: true });
- }
- else {
- controlData.push({ id: controls.SeriesId, text: controls.SeriesName, AddlData: controls.ManualNumbering });
- }
- }
- $('.txtSeriesAutoComplete_' + prop.FormPropertyId).select2({
- placeholder: 'Select Control',
- data: controlData,
- theme: "default select2ErrorClass",
- });
- if (prop.Value == null && prop.Value !== "0") {
- $('.divisManualSeries_' + prop.DocPropertyId).removeClass("hidden");
- $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', false);
- }
- else {
- $('.divisManualSeries_' + prop.DocPropertyId).addClass("hidden");
- $('#txtSeriesAutoComplete_' + prop.FormPropertyId).prop('disabled', true);
- }
- });
- });
- }
- static Instance() {
- if (this.instance === undefined)
- this.instance = new Series();
- return this.instance;
- }
- }
- Controls.Series = Series;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class CheckBox {
- init(formpropertyid, prop, callback) {
- var instance = CheckBox.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = `<div id="div_${prop.DocPropertyName}" class="div_${prop.DocPropertyId} form-group floating-label mt-sm-10 mb-0"><br><label for= "lbl" id="lbl_${prop.DocPropertyName}" style="align:center;">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnIsRequired_${prop.DocPropertyName}">*</span></label>` +
- '<input type="hidden" id="hdnchk_' + prop.DocPropertyName + '" class="form-control value-control ' + required + '" data-isdefault="' + prop.IsDefault + '" data-required="' + prop.IsRequired + '" data-regularexp="" data-validatemsg="" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-ismultiple="' + prop.IsMultiple + '" value="false" />' +
- '<span id="spnChk_' + prop.FormPropertyId + '" data-isswitch="' + prop.IsSwitch + '"></span><input type="hidden" id="hfId" value="false"><label for="Validation" id="lblValidation_' + prop.DocPropertyName + '"></label><input type="hidden" id="hfFormPropertyId" value="" />' + helpTextHtml + '</div>';
- $("#" + containerid).html(html);
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("platform/controls/subform/subform.component.js", function () {
- Unibase.Forms.Controls.CheckBox.instance.GetDocPropertiesByPropId(containerid, prop.DocPropertyName, prop);
- });
- }
- GetDocPropertiesByPropId(containerid, DocPropertyName, prop) {
- var html = "";
- var data1 = JSON.parse(prop.ControlJsonText);
- var instance = Unibase.Forms.Controls.CheckBox.Instance();
- for (var i = 0; i < data1.length; i++) {
- var res = data1[i];
- if (Unibase.Forms.Controls.SubForm.Instance().Index != undefined && Unibase.Forms.Controls.SubForm.Instance().Index != 0) {
- var id = DocPropertyName + '_' + res.ColumnText + Number($("#SubFormIndex").val());
- }
- else {
- var id = DocPropertyName;
- if (res.ColumnText != null && res.ColumnText != "") {
- id = DocPropertyName + '_' + res.ColumnText;
- }
- }
- if (res.IsSwitch == true) {
- if (res.ColumnText == undefined)
- res.ColumnText = "";
- if (res.IsMultiple == false)
- html += '<label id="lblCheckBox_' + DocPropertyName + '" class="lblCheckBox_' + DocPropertyName + ' ' + ' switch m-t pull-right"><input type="checkbox" id="chk_' + DocPropertyName + '" class="type-control chk_' + id + '" name="' + DocPropertyName + '" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(' + res.DocPropertyId + ',' + "'" + DocPropertyName + "'" + ')" placeholder = "' + prop.Placeholder + '"/><span></span></label>';
- else
- html += '<div class="switch m-t"><input type="checkbox" id="chk_' + DocPropertyName + '" class="type-control chk_' + id + '" name="' + DocPropertyName + '" onclick="Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(' + res.DocPropertyId + ',' + "'" + DocPropertyName + "'" + ')" placeholder = "' + prop.Placeholder + '"/><label class="col-sm-6" for="chk_' + id + '">' + res.ColumnText + '</label><span></span> </div>';
- }
- else {
- var checkclass = "";
- if (res.ColumnText == null || res.ColumnText == "") {
- res.ColumnText = "";
- checkclass += "pull-right";
- }
- var onclick = "Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClick('" + DocPropertyName + "'," + res.CheckBoxColumnId + ")";
- if (res.IsMultiple == false) {
- onclick = "Unibase.Forms.Controls.CheckBox.Instance().CheckBoxClickSingle(" + prop.DocPropertyId + ",'" + DocPropertyName + "')";
- }
- var _subform = $(".btnAddSubForm");
- if (_subform.length > 0) {
- const Index = Number($(".btnAddSubForm").attr("data-subformcount")) - 1;
- html += '<div class="custom-control custom-checkbox divEnablePieces checkbox-primary ' + checkclass + '"><input type="checkbox" class="type-control custom-control-input" id = chk_' + id + '_' + Index + ' name="' + DocPropertyName + '" onclick="' + onclick + '" placeholder = "' + prop.Placeholder + '"><label class="custom-control-label" for = chk_' + id + '_' + Index + '>' + res.ColumnText + '</label><span></span> </div>';
- }
- else {
- html += '<div class="custom-control custom-checkbox divEnablePieces checkbox-primary ' + checkclass + '"><input type="checkbox" class="type-control custom-control-input" id = chk_' + id + ' name="' + DocPropertyName + '" onclick="' + onclick + '" placeholder = "' + prop.Placeholder + '"><label class="custom-control-label" for = chk_' + id + '>' + res.ColumnText + '</label><span></span> </div>';
- }
- }
- }
- $("#" + containerid).find('.div_' + prop.DocPropertyId).find("#spnChk_" + prop.FormPropertyId).html(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- if (propval == "True") {
- $("#chk_" + DocPropertyName).prop("checked", true);
- $("#hdnchk_" + DocPropertyName).val("true");
- }
- }
- CheckBoxClick(DocPropertyName, CheckBoxColumnId) {
- var ids = $("#hdnchk_" + DocPropertyName).val();
- if ($("#chk_" + CheckBoxColumnId).is(':checked')) {
- if (ids != "") {
- ids += CheckBoxColumnId + "|";
- }
- else {
- ids = CheckBoxColumnId + "|";
- }
- }
- else {
- var tg = ids.split('|');
- ids = "";
- for (var i = 0; i < tg.length; i++) {
- var a = tg[i];
- if (a != CheckBoxColumnId && tg[i] != '') {
- ids += tg[i] + "|";
- }
- }
- }
- $("#hdnchk_" + DocPropertyName).val(ids);
- }
- CheckBoxClickSingle(DocPropertyId, DocPropertyName) {
- if ($("#chk_" + DocPropertyName).is(':checked')) {
- $("#hdnchk_" + DocPropertyName).val("true");
- }
- else {
- $("#hdnchk_" + DocPropertyName).val("false");
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new CheckBox();
- }
- return this.instance;
- }
- }
- Controls.CheckBox = CheckBox;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class DatePicker {
- constructor() {
- this._bizgaze_dateFormat = 'DD/MM/YYYY';
- this.IsTimePicker = false;
- this._time = false;
- this.propval = "";
- this.dtime = false;
- this.disableFutureDate = false;
- }
- init(formpropertyid, prop, callback) {
- var instance = DatePicker.Instance();
- let TimePicker = prop.PropertySettings.filter(t => t.ControlPropertyName == "IsTime" && t.ControlPropertyValue == "true");
- if (TimePicker.length > 0) {
- instance.IsTimePicker = true;
- }
- else {
- instance.IsTimePicker = false;
- }
- if (callback != null && callback != 1)
- callback();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- var container = "control-container-" + formpropertyid;
- $("#" + container).find('#date_' + prop.FormPropertyId + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + prop.FormPropertyId).val(picker.startDate.format('YYYY/MM/DD'));
- });
- var currentYear = (new Date()).getFullYear();
- if (this._time == true) {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- });
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- this._time = false;
- }
- else {
- $("#" + container).find('#date_' + prop.FormPropertyId).daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + prop.FormPropertyId).val(end.format('YYYY-MM-DD'));
- });
- }
- if (instance.propval == "") {
- $("#" + container).find('#date_' + prop.FormPropertyId).val('');
- }
- $(".date_" + prop.DocPropertyName).keypress(function (e) {
- $(".date_" + prop.DocPropertyName).attr("maxlength", "10");
- if (e.which != 8 && e.which != 0 && (e.which < 47 || e.which > 57)) {
- return false;
- }
- else {
- var value = $(".date_" + prop.DocPropertyName).val().toString().replace(/^(\d\d)(\d)$/g, '$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/[^\d\/]/g, '');
- $(".date_" + prop.DocPropertyName).val(value);
- }
- });
- $(".date_" + prop.DocPropertyName).focusout(function (e) {
- if ($(".date_" + prop.DocPropertyName).val() == "") {
- $('#hfdate_' + prop.FormPropertyId).val("");
- }
- });
- instance.loadPropertySettings(prop.PropertySettings, formpropertyid, prop.DocPropertyName);
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var requiredClass = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
- var ExcludedStages = prop.ExcludedStages.split('|');
- Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
- requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
- reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
- }
- let ControlId = 'txt_' + prop.DocPropertyId;
- if (prop.IsRequired)
- requiredClass = 'required';
- let isReadOnly = '';
- if (!Unibase.Themes.Compact.Components.Index.Instance().desktopMode) {
- isReadOnly = 'readonly';
- }
- const { helpTooltipHtml, helpTextHtml, helpClass } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- let html = `<div class="floating-label-form-group CancelBtnFloating_${prop.UniqueId} ${helpClass}" id ="div_${prop.UniqueId}">` +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<div class="input-group">' +
- '<input type="hidden" id="hfdate_' + prop.UniqueId + '" class="value-control hfdate_' + prop.DocPropertyName + '" value=""/>' +
- '<input type="text" id="date_' + prop.UniqueId + '" class="form-control type-control datepicker-input hasDatepicker ' + requiredClass + ' floating-label-control txt_' + prop.UniqueId + ' date_' + prop.DocPropertyName + '" placeholder="' + prop.LabelName + " " + reqMark + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + " " + reqMark + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '"' + isReadOnly + '>' +
- '<span class="input-group-addon mt-10 cursor-pointer"><i class="fa fa-calendar calender_' + prop.DocPropertyName + '"></i></span>' +
- '<input type="hidden" id="hf_' + prop.ControlId + '" /></div>' + helpTextHtml + '</div>';
- $("#" + containerid).append(html);
- Unibase.Forms.Controls.DatePicker.Instance().loadDate(prop.UniqueId, prop);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadDate(formpropertyid, prop) {
- var container = "control-container-" + formpropertyid;
- if (this._time == true) {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- });
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- this._time = false;
- }
- else {
- $("#" + container).find('#date_' + prop.FormPropertyId).daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + prop.FormPropertyId).val(end.format('YYYY-MM-DD'));
- });
- }
- $(`.calender_${prop.DocPropertyName}`).click(function () {
- $(this).parents('.input-group').find('.datepicker-input').trigger('click');
- });
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- var instance = this;
- var istime = false;
- var dateNow = new Date();
- var container = "control-container-" + formpropertyid;
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "IsTodayDate") {
- if (data.ControlPropertyValue == "true") {
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- if (DateTime_Value == "") {
- var maxDate;
- if (instance.disableFutureDate)
- maxDate = new Date();
- else
- maxDate = new Date(2050, 11, 31);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- maxDate: maxDate
- });
- var todayDate = $("#" + container).find('#date_' + formpropertyid).val();
- var hfformat = "YYYY/MM/DD";
- var tdate = moment(todayDate, "DD/MM/YYYY").format("YYYY/MM/DD");
- $("#" + container).find('#hfdate_' + formpropertyid).val(tdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD'));
- $("#" + container).find('#div_' + formpropertyid).addClass('floating-label-form-group-with-value');
- });
- }
- $("#" + container).find('#div_' + formpropertyid).addClass('floating-label-form-group-with-value');
- $("#" + container).find('#date_' + formpropertyid).keypress(function (e) {
- $(this).attr("maxlength", "10");
- if (e.which != 8 && e.which != 0 && (e.which < 47 || e.which > 57)) {
- return false;
- }
- else {
- var value = $(this).val().toString().replace(/^(\d\d)(\d)$/g, '$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/[^\d\/]/g, '');
- $(this).val(value);
- }
- });
- if (instance.dtime == false) {
- if (istime == true) {
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- var cdate = new Date();
- var currentdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(cdate, "DD/MM/YYYY HH:mm");
- $("#" + container).find('#date_' + formpropertyid).val(currentdate);
- var hfcdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(cdate, "YYYY/MM/DD HH:mm");
- $("#" + container).find('#hfdate_' + formpropertyid).val(hfcdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- let curren = new Date();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('show.daterangepicker', function (ev, picker) {
- var dateTime_New = $("#" + container).find('#date_' + formpropertyid).val();
- var hours = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") - 2, dateTime_New.toString().indexOf(":"));
- if (hours.substring(0, 1) == "0") {
- hours = hours.substring(1);
- }
- var minutes = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") + 1, dateTime_New.toString().indexOf(":") + 3);
- if (minutes.substring(0, 1) == "0") {
- minutes = minutes.substring(1);
- }
- $('.show-calendar').find('.hourselect option:selected').removeAttr('selected');
- $('.show-calendar').find('.minuteselect option:selected').removeAttr('selected');
- $('.hourselect option[value="' + hours + '"]').attr("selected", "selected");
- $('.minuteselect option[value="' + minutes + '"]').attr("selected", "selected");
- });
- }
- }
- }
- }
- if (data.ControlPropertyName == "IsTime") {
- if (instance.dtime == false) {
- if (data.ControlPropertyValue == "true") {
- istime = true;
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- var cdate = new Date();
- var currentdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(cdate, "DD/MM/YYYY HH:mm");
- $("#" + container).find('#date_' + formpropertyid).val(currentdate);
- var hfcdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(cdate, "YYYY/MM/DD HH:mm");
- $("#" + container).find('#hfdate_' + formpropertyid).val(hfcdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- let curren = new Date();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('show.daterangepicker', function (ev, picker) {
- var dateTime_New = $("#" + container).find('#date_' + formpropertyid).val();
- var hours = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") - 2, dateTime_New.toString().indexOf(":"));
- if (hours.substring(0, 1) == "0") {
- hours = hours.substring(1);
- }
- var minutes = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") + 1, dateTime_New.toString().indexOf(":") + 3);
- if (minutes.substring(0, 1) == "0") {
- minutes = minutes.substring(1);
- }
- $('.show-calendar').find('.hourselect option:selected').removeAttr('selected');
- $('.show-calendar').find('.minuteselect option:selected').removeAttr('selected');
- $('.hourselect option[value="' + hours + '"]').attr("selected", "selected");
- $('.minuteselect option[value="' + minutes + '"]').attr("selected", "selected");
- });
- $(".hasDatepicker").keypress(function (e) {
- $(this).attr("maxlength", "19");
- var value = $(this).val().toString().replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/^(\d\d\/\d\d\/\d\d\d\d)(\d)/g, '$1 ').replace(/^(\d\d\/\d\d\/\d\d\d\d\s\d\d)(\d)/g, '$1:$2$2:');
- $(this).val(value);
- });
- }
- }
- }
- if (data.ControlPropertyName == "DisableFutureDate") {
- if (data.ControlPropertyValue == "true") {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- singleDatePicker: true,
- showDropdowns: true,
- autoUpdateInput: false,
- minYear: 1901,
- maxDate: new Date(),
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + formpropertyid).val(end.format('YYYY-MM-DD'));
- });
- $('#date_' + formpropertyid + '.datepicker-input').keyup(function (e) {
- let dateString = $(this).val();
- let errorMsgDiv = $(this).parents('.formValidate').find('.form-error-message').attr('id');
- let myDate = moment(dateString, ['DD/MM/YYYY', 'D/M/YYYY', 'DD/M/YYYY', 'D/MM/YYYY'], true);
- MessageHelper.Instance().hideMessage();
- $(this).attr('data-isValid', 'false');
- if (dateString.length >= 8 && dateString != "") {
- if (myDate.isValid() == false) {
- MessageHelper.Instance().showError('Enter Correct Date Format!.', errorMsgDiv);
- }
- else if (moment(dateString, 'DD/MM/YYYY').isSameOrBefore(moment().format()) == false) {
- MessageHelper.Instance().showError('You cannot enter a date in the future.', errorMsgDiv);
- }
- else if (moment(dateString, 'DD/MM/YYYY').isSameOrAfter('01/01/1901', 'year') == false) {
- MessageHelper.Instance().showError('You cannot enter a date before 1901.', errorMsgDiv);
- }
- else {
- MessageHelper.Instance().hideMessage();
- $('#hfdate_' + formpropertyid).val(moment(dateString, 'DD/MM/YYYY').format('YYYY-MM-DD'));
- $(this).attr('data-isValid', 'true');
- }
- }
- });
- instance.disableFutureDate = true;
- $('#date_' + formpropertyid + '.datepicker-input').focusout(function (e) {
- let isDateValid = $(this).attr('data-isValid');
- if (isDateValid == 'false') {
- $(this).val("");
- $('#hfdate_' + formpropertyid).val("");
- $(this).attr('data-isValid', 'true');
- }
- });
- }
- }
- }
- }
- instance.propval = "";
- instance.dtime = false;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- var format = "DD/MM/YYYY";
- var hfformat = "YYYY/MM/DD";
- var hfdate = "";
- if (instance.IsTimePicker) {
- instance.propval = moment(propval).format("DD/MM/YYYY HH:mm");
- hfdate = moment(propval).format("YYYY/MM/DD HH:mm");
- instance._time = true;
- $('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- instance.dtime = true;
- }
- else {
- instance.propval = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDate1(propval, format);
- hfdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(propval, hfformat);
- }
- var formattedPropVal = Unibase.Platform.Helpers.DateTimeHelper.Instance().serverDateformat(instance.propval);
- if (instance.propval == "Invalid date" || formattedPropVal == "01/01/1901" || formattedPropVal == "01/01/1900" || formattedPropVal == "01/01/2001" || formattedPropVal == "01/01/0001") {
- instance.propval = "";
- }
- $("#hfdate_" + formpropertyid).val(hfdate);
- $("#date_" + formpropertyid).val(instance.propval);
- if ($("#date_" + formpropertyid).val() != "") {
- $("#div_" + formpropertyid).addClass("floating-label-form-group-with-value");
- }
- }
- static Instance() {
- if (this.instance === undefined)
- this.instance = new DatePicker();
- return this.instance;
- }
- }
- Controls.DatePicker = DatePicker;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class TextBox {
- init(formpropertyid, prop, callback) {
- var instance = TextBox.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.UniqueId);
- instance.loadPropertySettings(prop.PropertySettings, prop.UniqueId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var requiredClass = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
- var ExcludedStages = prop.ExcludedStages.split('|');
- Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
- requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
- reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
- }
- let ControlId = 'txt_' + prop.UniqueId;
- if (prop.IsRequired)
- requiredClass = 'required';
- const { helpTooltipHtml, helpTextHtml, helpClass } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- let html = `<div class="floating-label-form-group div_txt div_${prop.DocPropertyName} ${helpClass}" id="TxtDiv_${prop.FormPropertyId}">
- <label for="lbl" id="lbl_${ControlId}" class="lbl_txt">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnIsRequired_${prop.FormPropertyId}"> *</span></label>
- <input type="text" id="${ControlId}" class="type-control form-control type-control value-control ${requiredClass} floating-label-control txt_${prop.DocPropertyName}" placeholder="${prop.LabelName} ${reqMark}" data-placeholder="${prop.Placeholder}" data-label="${prop.LabelName} ${reqMark}" data-regularexp="${regExpr}" data-validatemsg="${ErrMsg}">
- <input type="hidden" id="hf_${prop.ControlId}" />
- ${helpTextHtml}
- </div>`;
- $("#" + containerid).append(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "MaxLength" && data.ControlPropertyValue != "") {
- $("#txt_" + formpropertyid).attr("MaxLength", data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- if (propval == 'null')
- propval = '';
- var decodeText = unescape(propval);
- $("#txt_" + formpropertyid).val(decodeText);
- if (decodeText != "") {
- $("#TxtDiv_" + formpropertyid).addClass("floating-label-form-group-with-value");
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new TextBox();
- }
- return this.instance;
- }
- }
- Controls.TextBox = TextBox;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class Dropdown extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this.loadCascading = true;
- }
- init(formpropertyid, prop, callback) {
- var instance = new Dropdown();
- instance.loadControlSettings(prop, prop.UniqueId).then(function () {
- if (callback != null)
- callback();
- });
- $('#ddl_' + prop.DocPropertyName + '').focusin(function () {
- $('#ddl_' + prop.DocPropertyName + '').attr('style', 'border:solid 2px rgb(0, 165, 230);border-radius:5px;border-shadow: 3px 3px 3px 3px;');
- });
- $('#ddl_' + prop.DocPropertyName + '').focusout(function () {
- $('#ddl_' + prop.DocPropertyName + '').attr('style', 'none');
- });
- }
- loadControl(containerid, prop) {
- var instance = this;
- var jsfiles = ["platform/controls/cascadingautocomplete/cascadingautocomplete.component.js", "platform/controls/cascadingautocomplete/cascadingautocomplete.settings.js"];
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var CurrentStageId = '';
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- }
- var dropdownJson = JSON.parse(prop.ControlJsonText);
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = '<div id="div_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '" class="div_' + prop.FormPropertyId + ' floating-label-form-group-with-value">' +
- '<label for="lbl" id="lbl_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '">' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '"> *</span></label>' +
- '<select id="ddl_' + prop.UniqueId + '" class="form-control type-control ' + required + ' value-control dropdown_' + prop.DocPropertyName + '" data-propertyname="" data-isdefault="' + prop.IsDefault + '" data-propdoctypename="' + prop.DocPropertyName + '" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-isparent="false">';
- if (dropdownJson[0].EnableSelectOption == true) {
- if (prop.IsRequired) {
- html += '<option value="">--Select--</option>';
- }
- else {
- html += '<option value="0">--Select--</option>';
- }
- }
- html += '</select>' + helpTextHtml +
- '</div>';
- $("#" + containerid).html(html);
- $("#" + containerid).find("#ddl_" + prop.UniqueId).on('change', function () {
- instance.fileCacheHelper.loadJsFiles(jsfiles, function () {
- if (instance.loadCascading) {
- Unibase.Forms.Controls.CascadingAutocomplete.Instance().ChildCascadingData(false, prop.FormPropertyId, 0, 0, '');
- }
- instance.loadCascading = true;
- });
- });
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return __awaiter(this, void 0, void 0, function* () {
- if (controlsettingjson != "" && controlsettingjson != null && controlsettingjson != undefined) {
- var container = "control-container-" + formpropertyid;
- var response = JSON.parse(controlsettingjson.ControlJsonText);
- if (response != null) {
- if ((response.length == 1) && (response[0].ReportId != 0)) {
- yield Unibase.Platform.Forms.Managers.FormManager.Instance().dynamicDropDown(response[0].DropDownColumnId).then(function (res) {
- var drpDwnData = [];
- let result = res.result;
- for (let i = 0; i < result.length; i++) {
- var drpDwn = result[i];
- drpDwnData.push({ id: drpDwn.ColumnText, text: drpDwn.ColumnValue });
- }
- $('#' + container).find("#ddl_" + formpropertyid).select2({
- placeholder: 'Select',
- theme: "default select2ErrorClass",
- data: drpDwnData,
- width: '100%',
- });
- });
- }
- else {
- $('#' + container).find("#ddl_" + controlsettingjson.DocPropertyName).find('option').remove();
- var data = '';
- for (var i = 0; i < response.length; i++) {
- var columnvalue = controlsettingjson.datatypeid == 3 ? response[i].ColumnNumber : response[i].ColumnValue;
- if (response[i].IsParent == true) {
- $('#' + container).find("#ddl_" + controlsettingjson.DocPropertyName).data("isparent", response[i].IsParent);
- }
- data += '<option value="' + columnvalue + '" columnvalue="' + response[i].DropDownColumnId + '">' + response[i].ColumnText + '</option>';
- }
- $('#' + container).find("#ddl_" + formpropertyid).append(data);
- }
- }
- }
- });
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- instance.loadCascading = false;
- $("#ddl_" + formpropertyid).val(propval).trigger('change');
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new Dropdown();
- return this._instance;
- }
- }
- Controls.Dropdown = Dropdown;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class TextEditor extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var instance = new TextEditor();
- var container = "control-container-" + formpropertyid;
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- var summernoteid = $("#" + container).find(".txtSummernote_" + prop.DocPropertyName).attr('id');
- var data = null;
- if (prop.ControlJsonText != "") {
- data = JSON.parse(prop.ControlJsonText);
- }
- if (data != null) {
- Unibase.Platform.Analytics.Managers.ReportManager.Instance().getHeaderColumns(data.TokenReportId).then(function (response) {
- var Data = new Array();
- for (let i = 0; i < response.length; i++) {
- var result = response[i].title;
- Data.push(result);
- }
- var placeholder = $("#summernote_" + prop.FormPropertyId).data('placeholder');
- var _fileCacheHelper = instance.fileCacheHelper;
- _fileCacheHelper.loadJsFile("libs/summernote/summernote.min.js", function () {
- _fileCacheHelper.loadCssFile("libs/summernote/summernote.css", function () {
- instance.loadSummernote(prop.FormPropertyId, placeholder, Data);
- });
- });
- });
- }
- else {
- var placeholder = $("#summernote_" + prop.FormPropertyId).data('placeholder');
- var _fileCacheHelper = instance.fileCacheHelper;
- _fileCacheHelper.loadJsFile("libs/summernote/summernote.min.js", function () {
- _fileCacheHelper.loadCssFile("libs/summernote/summernote.css", function () {
- instance.loadSummernote(prop.FormPropertyId, placeholder, Unibase.Data);
- });
- });
- }
- $(".divCustomProperties_" + prop.DocPropertyName).find('.note-editor').find('.note-eventButton').addClass('hidden');
- $(".divCustomProperties_" + prop.DocPropertyName).find(".note-editable").attr("id", "note-editable" + prop.DocPropertyName);
- if (prop.ControlJsonText != "") {
- data = JSON.parse(prop.ControlJsonText);
- }
- if (data != "" && data != null) {
- if (data.tokenreportid != 0) {
- $(".divCustomProperties_" + prop.DocPropertyName).find('.note-editor').find('.note-eventButton').removeClass('hidden');
- $("#SummerNoteToken_" + prop.DocPropertyName).change(function () {
- var tokentext = $("#SummerNoteToken_" + prop.DocPropertyName + " option:selected").text();
- var tokenlisttext = "{{" + tokentext + "}}";
- $(".summernote_" + prop.DocPropertyName).summernote('editor.restoreRange');
- $(".summernote_" + prop.DocPropertyName).summernote('editor.focus');
- $(".summernote_" + prop.DocPropertyName).summernote('editor.insertText', tokenlisttext);
- $("#SummerNoteToken_" + prop.DocPropertyName).text("Tokens");
- });
- $("#SummerNoteToken_" + prop.DocPropertyName).css("height", "35").css("width", "102").css("padding-right", "0").css("padding-top", "1");
- $("#SummerNoteToken_" + prop.DocPropertyName).parent().css("height", "40").css("width", "200").css("padding-left", "-10px").css("padding-top", "-10px").css("margin-top", "-2px");
- $("#SummerNoteToken_" + prop.DocPropertyName).parent().parent().css("height", "35").css("padding", "0").css("background-color", "transparent");
- $('.select2-container--default').css('width', '100%');
- }
- else {
- $(".divCustomProperties_" + prop.DocPropertyName).find('.note-editor').find('.note-eventButton').addClass('hidden');
- }
- }
- else {
- $(".divCustomProperties_" + prop.DocPropertyName).find('.note-editor').find('.note-eventButton').addClass('hidden');
- }
- if (callback != null)
- callback();
- }
- loadSummernote(FormPropertyId, Placeholder, Data) {
- $(".summernote_" + FormPropertyId).summernote({
- height: 100,
- minHeight: null,
- maxHeight: null,
- placeholder: Placeholder,
- disableDragAndDrop: true,
- codemirror: {
- mode: 'text/html',
- lineNumbers: true
- },
- toolbar: [
- ['font', ['bold', 'italic', 'underline']],
- ['color', ['color']],
- ['view', ['fullscreen', 'codeview', 'help']],
- ['table', ['table']],
- ],
- hint: {
- match: /\B[@!](\w*)$/,
- search: function (keyword, callback) {
- callback($.grep(Data, function (i) {
- var user = i;
- return user.indexOf(keyword) === 0;
- }));
- },
- content: function (i) {
- var user = i;
- return $('<span>@' + user + '</span>')[0];
- }
- }
- });
- $(".note-editor").css("z-index", "0");
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- var isCodeView = "false";
- var propSettings = prop.PropertySettings.find(x => x.ControlPropertyName == "IsCodeView");
- if (propSettings != null || propSettings != undefined) {
- if (propSettings.ControlPropertyValue == "true") {
- isCodeView = "true";
- }
- }
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = '<div id="div" class="TextEditor"><input type="hidden" id="txthdn_' + prop.FormPropertyId + '" data-event="Unibase.Forms.Controls.TextEditor.Instance().getobj(' + prop.FormPropertyId + ',\'' + isCodeView + '\');" class="TextEditor value-control" data-iscodeview="' + isCodeView + '">' +
- '<span class="text-danger ' + Isrequired + '" id = "spnIsRequired_' + prop.DocPropertyName + '" ></span >' +
- '<div class="type-control summernote_' + prop.DocPropertyName + ' summernote_' + prop.FormPropertyId + ' ' + required + '" style="display: block;" id="summernote_' + prop.FormPropertyId + '" data-propdoctypename="' + prop.DocPropertyName + '" data-required="' + prop.IsRequired + '" data-regularexp="" data-validatemsg="" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-iscodeview="' + isCodeView + '"></div>' +
- '<label for="Validation" id="lblValidation"></label></div>' + helpTooltipHtml + helpTextHtml;
- if (isCodeView == "false") {
- html = '<div class=""><input type="hidden" id="txthdn_' + prop.FormPropertyId + '" class="TextEditor" data-iscodeview="' + isCodeView + '">' +
- '<div class="input-group">' +
- '<textarea id="textarea_' + prop.FormPropertyId + '" class="type-control value-control floating-label-control" rows="5" style="width:100%;" placeholder="' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.Placeholder + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '" data-event="Unibase.Forms.Controls.TextEditor.Instance().getobj(' + prop.FormPropertyId + ',\'' + isCodeView + '\');" ></textarea>' +
- '</div></div>' + helpTooltipHtml + helpTextHtml;
- }
- $("#" + containerid).html(html);
- $("#summernote_" + prop.FormPropertyId).on("summernote.change", function (e) {
- var val = $("#control-container-" + prop.FormPropertyId).find('.note-editable').text();
- });
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var iscodeview = $("#txthdn_" + formpropertyid).data("iscodeview");
- if (iscodeview == false) {
- $("#textarea_" + formpropertyid).val(unescape(propval));
- }
- else {
- var decodedData = unescape(propval);
- var decode = HtmlHelper.getHelper().decode(decodedData);
- $("#summernote_" + formpropertyid).summernote('code', decode);
- }
- }
- getobj(formPropertyId, isCodeView) {
- var finalval = "";
- if (isCodeView == "false") {
- finalval = $("#textarea_" + formPropertyId).val().toString();
- finalval = finalval.trim();
- }
- else {
- var code = $("#summernote_" + formPropertyId).summernote('code');
- finalval = HtmlHelper.getHelper().encode(code);
- finalval = finalval.trim();
- }
- return finalval;
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new TextEditor();
- }
- return this.instance;
- }
- }
- Controls.TextEditor = TextEditor;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class hiddenfield {
- init(formpropertyid, prop, callback) {
- var instance = new hiddenfield();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- var defaultvalue = "0";
- if (prop.PropertySettings != null) {
- for (var i = 0; i < prop.PropertySettings.length; i++) {
- var data = prop.PropertySettings[i];
- if (prop.DataTypeId == 9) {
- if (data.ControlPropertyName == "DefaultValue" && data.ControlPropertyValue != "") {
- defaultvalue = data.ControlPropertyValue;
- }
- }
- }
- }
- let html = '<div class="hidden">' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '"><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<input type="hidden" id="hdn_' + prop.FormPropertyId + '" class="hdn_' + prop.DocPropertyName + ' form-control type-control value-control floating-label-control" placeholder="' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + reqMark + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '" value="' + defaultvalue + '">' +
- '</div>';
- $("#" + containerid).html(html);
- if (Unibase.Platform.Forms.Components.FormViewer.Instance().DesignerMode == false) {
- $("#" + containerid).addClass("hidden");
- }
- else {
- $("#" + containerid).removeClass("hidden");
- }
- $(".divCustomFormProperties[data-sectionname='Hidden']").css("height", "25");
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "DefaultValue" && data.ControlPropertyValue != "") {
- $("#hdn_" + formpropertyid).attr("DefaultValue", data.ControlPropertyValue);
- $("#hdn_" + formpropertyid).val(data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#hdn_" + formpropertyid).val(propval);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new hiddenfield();
- }
- return this.instance;
- }
- }
- Controls.hiddenfield = hiddenfield;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class CascadingAutocomplete {
- constructor() {
- this.cascadingArray = [];
- this.loadCascading = true;
- }
- init(formpropertyid, prop, callback) {
- var instance = CascadingAutocomplete.Instance();
- var container = "control-container-" + formpropertyid;
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var instance = this;
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- var data = JSON.parse(prop.ControlJsonText);
- var cascArray = CascadingAutocomplete.instance.cascadingArray;
- var isexist = Unibase.Forms.Controls.CascadingAutocomplete.Instance().cascadingArray.find(x => x.UniqueId == prop.UniqueId) ? true : false;
- data["UniqueId"] = prop.UniqueId;
- if (isexist == false)
- CascadingAutocomplete.instance.cascadingArray.push(data);
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = `<div id="div_${prop.UniqueId}">
- <label for="ddl_cascading_${prop.UniqueId}" id="lbl_cascading_${prop.UniqueId}" class="font-bold" style="color:grey">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnCascading_${prop.UniqueId}"> *</span></label>` +
- '<div class="input-group">' +
- '<select id="ddl_cascading_' + prop.UniqueId + '" class="ddl_cascading_' + prop.DocPropertyName + ' form-control type-control text-control ' + required + ' " data-isdefault="' + prop.IsDefault + '" style="width:100%;" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" data-propertyid="' + prop.DocPropertyId + '" data-propertyname="' + prop.DocPropertyName + '" data-formpropertyid="' + prop.FormPropertyId + '" value="0" ></select>' +
- '<input type="hidden" id="hfddl_cascading_' + prop.UniqueId + '" value="0" data-autotextid="ddl_cascading_' + prop.UniqueId + '" class="hfAutoCompleteId_' + prop.DocPropertyName + ' form-control value-control" />' + helpTextHtml + '</div></div>';
- $("#" + containerid).html(html);
- $("#ddl_cascading_" + prop.UniqueId).select2({
- placeholder: prop.Placeholder,
- width: '100%',
- });
- $("#" + containerid).find("#ddl_cascading_" + prop.UniqueId).on('change', function () {
- if (instance.loadCascading) {
- Unibase.Forms.Controls.CascadingAutocomplete.Instance().ChildCascadingData(false, prop.FormPropertyId, Number($("#ddl_cascading_" + prop.UniqueId).val()), 0, '');
- }
- instance.loadCascading = true;
- });
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- if (propval != "") {
- var cascInfo = JSON.parse(propval);
- instance.ChildCascadingData(true, cascInfo.ParentFormPropertyId, cascInfo.ReportColumnText, cascInfo.ReportColumnValueId, cascInfo.ReportColumnValue);
- if (cascInfo.ReportColumnValueId != 0) {
- var cascOption = new Option(cascInfo.ReportColumnValue, cascInfo.ReportColumnValueId, true);
- $("#ddl_cascading_" + formpropertyid).append(cascOption);
- instance.loadCascading = false;
- jQuery("#ddl_cascading_" + formpropertyid).val(cascInfo.ReportColumnValueId).trigger('change');
- }
- }
- }
- ChildCascadingData(isEditForm, ParentFormPropertyId, ParentTextColumnValue, Id, Value) {
- var instance = this;
- var hdn_cascading_array = CascadingAutocomplete.instance.cascadingArray;
- if (hdn_cascading_array != undefined) {
- var list = hdn_cascading_array.filter(x => x.ParentFormPropertyId == ParentFormPropertyId);
- for (var i = 0; i < list.length; i++) {
- var listitem = list[i];
- var casFormPropId = listitem.UniqueId;
- var response = listitem;
- var reportId = response.ReportId;
- var formPropertyId = response.FormPropertyId;
- var parentFormPropertyId = response.ParentFormPropertyId;
- var applyFor = response.ApplyFor;
- var formId = Number($(".formValidate:visible").find("#hf_FormId").val());
- if (!isEditForm) {
- $("#ddl_cascading_" + casFormPropId).val(null).trigger("change");
- }
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/getcascadingautocompletedata/formpropertyid/' + formPropertyId + '/parentidcolumn/' + applyFor + '/parentcolumnvalue/' + ParentTextColumnValue + '/parentformpropertyid/' + parentFormPropertyId;
- AutoCompleteHelper.getHelper().Create("#ddl_cascading_" + casFormPropId, "#hfddl_cascading_" + casFormPropId, url, function (response) {
- });
- }
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new CascadingAutocomplete();
- }
- return this.instance;
- }
- }
- Controls.CascadingAutocomplete = CascadingAutocomplete;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class CascadingAutocomplete_Settings {
- loadControlPropertiesHtml(controlpropList, container) {
- return ``;
- }
- bindPropertySettings(prop) {
- var propertySettings = prop.PropertySettings;
- return "";
- }
- savePropertySettings(prop) {
- var propertySettings = prop.PropertySettings;
- return "";
- }
- loadSettingHtml(container) {
- let html = `<section class="card"><div class="card-header"><h6><b>Cascading Settings</b></h6></div><div class="card-body"><div class="row"><div class="col-sm-6 mt-10" id ="CasCadingdddDocProp"><label for="lblDocPropertyName" id="lblDocPropertyName" class="font-bold" style="color:grey">Parent Property<span class="text-danger" id="spnIsRequired_ParentProperty"> *</span></label><select id="ddlParentProperty" class="form-control value-control required" data-controlpropertyname="Width"></select><input type="hidden" id="hfddlParentProperty"/></div></div><div class="row"><div class="col-sm-6"><label class="font-bold" style="color:grey">Report<span class="text-danger" id="spnIsRequired_Report"> *</span></label><select id="ddl_cascAutocompleteReport" class="form-control value-control required" data-placeholder="Select" placeholder="Select"></select><input type="hidden" id="hfddl_cascAutocompleteReport" class="hfddl_cascAutocompleteReport form-control value-control" data-isdynamic="true"/></div></div><div class="row"><div class="col-sm-4"><label class="font-bold" style="color:grey">Id Column<span class="text-danger" id="spnIsRequired_IdColumn"> *</span></label><select id="ddl_cascAutocompleteIdColumn" class="form-control value-control required" data-placeholder="Select" placeholder="Select"></select><input type="hidden" id="hfddl_cascAutocompleteIdColumn" class="hfddl_cascAutocompleteIdColumn form-control value-control" data-isdynamic="true"/></div><div class="col-sm-4"><label class="font-bold" style="color:grey">Text Column<span class="text-danger" id="spnIsRequired_TextColumn"> *</span></label><select id="ddl_cascAutocompleteTextColumn" class="form-control value-control required" data-placeholder="Select" placeholder="Select"></select><input type="hidden" id="hfddl_cascAutocompleteTextColumn" class="hfddl_cascAutocompleteTextColumn form-control value-control" data-isdynamic="true"/></div><div class="col-sm-4"><label class="font-bold" style="color:grey">Apply For<span class="text-danger" id="spnIsRequired_ApplyFor"> *</span></label><select id="ddl_cascAutocompleteApplyFor" class="form-control value-control required" data-placeholder="Select" placeholder="Select"></select><input type="hidden" id="hfddl_cascAutocompleteApplyFor" class="hfddl_cascAutocompleteApplyFor form-control value-control" data-isdynamic="true"/></div></div></div></section>`;
- $(container).append(html);
- this.GetDocPropertyDetails();
- $("#ddl_cascAutocompleteReport").on("change", function () {
- $("#ddl_cascAutocompleteIdColumn").val(null).trigger("change");
- $("#ddl_cascAutocompleteTextColumn").val(null).trigger("change");
- });
- }
- bindControlData(controldatajson) {
- if (controldatajson != undefined && controldatajson != "") {
- var result = controldatajson;
- var parentName = Unibase.Platform.Forms.Components.FormBuilder.Instance().FormPropertiesJson.find(x => x.FormPropertyId == result.ParentFormPropertyId).FormPropertyName;
- var parent = new Option(parentName, result.ParentFormPropertyId, true);
- $("#ddlParentProperty").append(parent);
- jQuery("#ddlParentProperty").val(result.ParentFormPropertyId).trigger('change');
- var report = new Option(result.ReportName, result.ReportId, true);
- $("#ddl_cascAutocompleteReport").append(report);
- jQuery("#ddl_cascAutocompleteReport").val(result.ReportId).trigger('change');
- var reportColumnText = new Option(result.ReportColumnText, result.ReportColumnTextId, true);
- $("#ddl_cascAutocompleteTextColumn").append(reportColumnText);
- jQuery("#ddl_cascAutocompleteTextColumn").val(result.ReportColumnTextId).trigger('change');
- var reportColumnValue = new Option(result.ReportColumnValue, result.ReportColumnValueId, true);
- $("#ddl_cascAutocompleteIdColumn").append(reportColumnValue);
- jQuery("#ddl_cascAutocompleteIdColumn").val(result.ReportColumnValueId).trigger('change');
- var reportColumnApplyFor = new Option(result.ApplyFor, result.ApplyForId, true);
- $("#ddl_cascAutocompleteApplyFor").append(reportColumnApplyFor);
- jQuery("#ddl_cascAutocompleteApplyFor").val(result.ApplyForId).trigger('change');
- }
- }
- GetDocPropertyDetails() {
- let FormId = Unibase.Platform.Forms.Components.FormBuilder.Instance().FormId;
- let CurDocPropertyId = Unibase.Platform.Forms.Components.PropertyEditor.Instance().DocPropertyId;
- var parentProperties = Unibase.Platform.Forms.Components.FormBuilder.Instance().FormPropertiesJson.filter(x => x.ControlName == "DropDown" || x.ControlName == "CascadingAutocomplete" || x.ControlName == "AutoComplete");
- var parentProps = [];
- for (let i = 0; i < parentProperties.length; i++) {
- parentProps.push({ id: parentProperties[i].UniqueId, text: parentProperties[i].FormPropertyName });
- }
- $("#ddlParentProperty").select2({
- placeholder: 'Select',
- data: parentProps,
- width: '100%',
- });
- var reportsurl = _appsettings.server_url() + '/apis/v4/unibase/platform/analytics/reports';
- AutoCompleteHelper.getHelper().Create($("#ddl_cascAutocompleteReport"), $("#hfddl_cascAutocompleteReport"), reportsurl, function (response) {
- var data = response;
- });
- $("#ddl_cascAutocompleteReport").change(function () {
- var reportId = $("#ddl_cascAutocompleteReport").val();
- var reportcolumnsurl = _appsettings.server_url() + '/apis/v4/unibase/platform/analytics/reportcolumnsautocomplete/reportid/' + Number(reportId);
- AutoCompleteHelper.getHelper().Create($("#ddl_cascAutocompleteTextColumn"), $("#hfddl_cascAutocompleteTextColumn"), reportcolumnsurl, function (response) {
- var data = response;
- });
- AutoCompleteHelper.getHelper().Create($("#ddl_cascAutocompleteIdColumn"), $("#hfddl_cascAutocompleteIdColumn"), reportcolumnsurl, function (response) {
- var data = response;
- });
- AutoCompleteHelper.getHelper().Create($("#ddl_cascAutocompleteApplyFor"), $("#hfddl_cascAutocompleteApplyFor"), reportcolumnsurl, function (response) {
- var data = response;
- });
- });
- }
- SaveControlData(controldatajson) {
- var instance = this;
- var parentFormProp = Number($("#ddlParentProperty option:selected").val());
- var parentProp = Unibase.Platform.Forms.Components.FormBuilder.Instance().FormPropertiesJson.find(x => x.UniqueId == parentFormProp);
- var data = {
- CascadingId: 0,
- ControlId: Number(Unibase.Platform.Forms.Components.ControlEditor.Instance().ControlId),
- ReportId: Number($("#ddl_cascAutocompleteReport option:selected").val()),
- ReportName: $("#ddl_cascAutocompleteReport option:selected").text(),
- ReportColumnTextId: Number($("#ddl_cascAutocompleteTextColumn option:selected").val()),
- ReportColumnText: $("#ddl_cascAutocompleteTextColumn option:selected").text(),
- ReportColumnValueId: Number($("#ddl_cascAutocompleteIdColumn option:selected").val()),
- ReportColumnValue: $("#ddl_cascAutocompleteIdColumn option:selected").text(),
- ApplyForId: Number($("#ddl_cascAutocompleteApplyFor option:selected").val()),
- ApplyFor: $("#ddl_cascAutocompleteApplyFor option:selected").text(),
- ParentFormPropertyId: parentFormProp,
- ParentDocPropertyId: parentProp.DocPropertyId,
- };
- var ControlJsonText = JSON.stringify(data);
- return ControlJsonText;
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new CascadingAutocomplete_Settings();
- return this._instance;
- }
- }
- Controls.CascadingAutocomplete_Settings = CascadingAutocomplete_Settings;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class select2 {
- constructor() {
- this.Ids = [];
- this.data = [];
- }
- init(formpropertyid, prop, callback) {
- var container = $(".select2_" + prop.FormPropertyId);
- Unibase.Forms.Controls.select2.Instance().loadControlSettings(container, null).then(function () {
- if (callback != null)
- callback();
- });
- $(".select2_" + prop.FormPropertyId).on('select2:select', function (e) {
- var ids = $(".select2_" + prop.FormPropertyId).val().toString().replace(/,/g, '|');
- $("#hdnselect2_" + prop.FormPropertyId).val(ids);
- });
- $(".select2_" + prop.FormPropertyId).on('select2:unselect', function (e) {
- $("#hdnselect2_" + prop.FormPropertyId).val(0);
- var ids = $(".select2_" + prop.FormPropertyId).val().toString().replace(/,/g, '|');
- $("#hdnselect2_" + prop.FormPropertyId).val(ids);
- });
- }
- loadControl(containerid, prop) {
- Unibase.Forms.Controls.select2.Instance().data = [];
- Unibase.Forms.Controls.select2.Instance().Ids = [];
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- }
- var IsTagSelect = false;
- if (prop.ControlJsonText != "" && prop.ControlJsonText != null && prop.ControlJsonText != undefined) {
- var text = JSON.parse(prop.ControlJsonText);
- if (text["IsTagSelect"] == true) {
- IsTagSelect = true;
- }
- }
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = '<div id="div_' + prop.DocPropertyName + '" class="floating-label-form-group-with-value floating-validate" style="border-bottom:0;"><label for= "lbl" id = "lbl_' + prop.DocPropertyName + '" >' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger hide ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '"> *</span></label >' +
- '<input type="hidden" id="hdnselect2_' + prop.FormPropertyId + '" class="value-control" value="0" data-text="">' +
- '<select id="select2_' + prop.FormPropertyId + '" class=" select2_' + prop.FormPropertyId + ' type-control select2_' + prop.DocPropertyName + ' form-control text-control ' + required + '" multiple="multiple" data-isdynamic="' + prop.IsDefault + '" data-istagselect="' + IsTagSelect + '" style="width:100%;" data-propdoctypename="' + prop.DocTypeName + '" data-propertyid="' + prop.DocPropertyId + '" data-propertyname="' + prop.DocPropertyName + '" data-formpropertyid="' + prop.FormPropertyId + '" data-regularexp="" data-validatemsg="" data-textformpropertyid="' + text.TextFormPropertyId + '"><option>Select</option></select>' + helpTextHtml +
- '</div>';
- $("#" + containerid).html(html);
- }
- loadControlSettings(Container, Parameters) {
- return __awaiter(this, void 0, void 0, function* () {
- var ColumnName = "0";
- var Value = "0";
- var DocPropertyId = Container.data('propertyid');
- var DocPropertyName = Container.data('propertyname');
- var FormPropertyId = Container.data('formpropertyid');
- if (Parameters != null && Parameters != "") {
- ColumnName = Parameters.map(function (item) { return item.ColumnName; }).toString();
- Value = Parameters.map(function (item) { return item.Value + "|"; }).toString();
- }
- var userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/select2post';
- var data = select2.instance.data.find(x => x.formpropertyid == FormPropertyId);
- $(".select2_" + FormPropertyId).select2({
- multiple: true,
- allowClear: false,
- data: select2.instance.data,
- placeholder: 'Select',
- ajax: {
- url: function (request) {
- var reqUrl = url;
- return reqUrl;
- },
- contentType: 'application/json',
- type: "POST",
- delay: 250,
- data: function (params) {
- var query = {
- term: params.term,
- DocPropertyId: DocPropertyId,
- ColumnName: ColumnName,
- FormPropertyId: FormPropertyId,
- Value: Value,
- bindedData: "",
- authToken: userinfo.sessionId,
- SelectedIds: $(".select2_" + FormPropertyId).val().toString().replace(/,/g, '|'),
- };
- return JSON.stringify(query);
- },
- beforeSend: function (xhr) {
- if (userinfo !== undefined && userinfo !== null) {
- xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
- xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
- }
- },
- processResults: function (data, params) {
- return {
- results: jQuery.map(JSON.parse(data.result), function (item) {
- return {
- id: item.Value,
- text: item.DisplayText
- };
- })
- };
- }
- },
- templateResult: function (item) { return item.text; },
- templateSelection: function (item) { return item.text; },
- }).on('select2:select', function () {
- Unibase.Forms.Controls.select2.Instance().assigningDataText(FormPropertyId, this);
- }).on('select2:unselect', function () {
- Unibase.Forms.Controls.select2.Instance().assigningDataText(FormPropertyId, this);
- });
- $(".select2_" + FormPropertyId).val(select2.instance.Ids).trigger('change');
- var autocompleteid1 = $(".select2_" + DocPropertyName).attr('id');
- if (autocompleteid1 != undefined) {
- var eventList = $.data($("#" + autocompleteid1)[0], "events");
- if (eventList != undefined) {
- eventList.change.unshift(eventList.change.pop());
- }
- }
- });
- }
- assigningDataText(FormPropertyId, instance) {
- let selectedValues = '';
- let length = $(instance).select2('data').length;
- $(instance).select2('data').forEach(function (obj, i) {
- if (i == length - 1) {
- selectedValues = selectedValues + obj.text;
- }
- else {
- selectedValues = selectedValues + obj.text + '|';
- }
- });
- $(`#hdnselect2_${FormPropertyId}`).attr('data-text', selectedValues);
- }
- loadControlSettings_delete(Container, Parameters) {
- return __awaiter(this, void 0, void 0, function* () {
- var ColumnName = "0";
- var Value = "0";
- var DocPropertyId = Container.data('propertyid');
- var DocPropertyName = Container.data('propertyname');
- var FormPropertyId = Container.data('formpropertyid');
- if (Parameters != null && Parameters != "") {
- ColumnName = Parameters.map(function (item) { return item.ColumnName; }).toString();
- Value = Parameters.map(function (item) { return item.Value + "|"; }).toString();
- }
- var userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
- var url = _appsettings.server_url() + '/apis/v4/unibase/platform/forms/autocomplete/docpropertyid/' + DocPropertyId + '/columnname/' + ColumnName + '/value/' + Value + '/formpropertyid/' + FormPropertyId + '/formid/0';
- url = url + "/term/";
- url = url.replace('#', '');
- var data = select2.instance.data.find(x => x.formpropertyid == FormPropertyId);
- $(".select2_" + FormPropertyId).select2({
- multiple: true,
- allowClear: false,
- data: select2.instance.data,
- placeholder: 'Select',
- ajax: {
- url: function (request) {
- var reqUrl = url;
- var term = request.term;
- if (term == undefined || term == "")
- reqUrl = reqUrl + term + "/authtoken/" + userinfo.sessionId;
- else
- reqUrl = reqUrl + term + "/authtoken/" + userinfo.sessionId;
- return reqUrl;
- },
- beforeSend: function (xhr) {
- if (userinfo !== undefined && userinfo !== null) {
- xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
- xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
- }
- },
- delay: 250,
- dataType: 'json',
- processResults: function (data) {
- var selectData = [];
- var Data = JSON.parse(data.result);
- for (var i = 0; i < Data.length; i++) {
- selectData.push({
- id: Data[i].Value,
- text: Data[i].DisplayText
- });
- }
- ;
- return { results: selectData };
- }
- },
- templateResult: function (item) { return item.text; },
- templateSelection: function (item) { return item.text; },
- });
- $(".select2_" + FormPropertyId).val(select2.instance.Ids).trigger('change');
- var autocompleteid1 = $(".select2_" + DocPropertyName).attr('id');
- if (autocompleteid1 != undefined) {
- var eventList = $.data($("#" + autocompleteid1)[0], "events");
- if (eventList != undefined) {
- eventList.change.unshift(eventList.change.pop());
- }
- }
- });
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- throw new Error("Method not implemented.");
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- return __awaiter(this, void 0, void 0, function* () {
- if (propval != null || propval != "" || propval != undefined) {
- var selectedvalues = JSON.parse(propval);
- if (selectedvalues != 0) {
- $("#hdnselect2_" + formpropertyid).val(selectedvalues[selectedvalues.length - 1]);
- for (var i = 0; i < selectedvalues.length; i++) {
- var data = selectedvalues[i];
- if ((data.id != undefined && data.text != undefined) && (data.id != "" && data.text != "")) {
- select2.instance.Ids.push(data.id);
- var newOption = new Option(data.text, data.id, true, true);
- $(".select2_" + formpropertyid).append(newOption).trigger('change');
- }
- }
- }
- }
- });
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new select2();
- }
- return this.instance;
- }
- }
- Controls.select2 = select2;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class DatePicker {
- constructor() {
- this._bizgaze_dateFormat = 'DD/MM/YYYY';
- this.IsTimePicker = false;
- this._time = false;
- this.propval = "";
- this.dtime = false;
- this.disableFutureDate = false;
- }
- init(formpropertyid, prop, callback) {
- var instance = DatePicker.Instance();
- let TimePicker = prop.PropertySettings.filter(t => t.ControlPropertyName == "IsTime" && t.ControlPropertyValue == "true");
- if (TimePicker.length > 0) {
- instance.IsTimePicker = true;
- }
- else {
- instance.IsTimePicker = false;
- }
- if (callback != null && callback != 1)
- callback();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- var container = "control-container-" + formpropertyid;
- $("#" + container).find('#date_' + prop.FormPropertyId + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + prop.FormPropertyId).val(picker.startDate.format('YYYY/MM/DD'));
- });
- var currentYear = (new Date()).getFullYear();
- if (this._time == true) {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- });
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- this._time = false;
- }
- else {
- $("#" + container).find('#date_' + prop.FormPropertyId).daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- maxDate: new Date(2050, 11, 31)
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + prop.FormPropertyId).val(end.format('YYYY-MM-DD'));
- });
- }
- if (instance.propval == "") {
- $("#" + container).find('#date_' + prop.FormPropertyId).val('');
- }
- $(".date_" + prop.DocPropertyName).keypress(function (e) {
- $(".date_" + prop.DocPropertyName).attr("maxlength", "10");
- if (e.which != 8 && e.which != 0 && (e.which < 47 || e.which > 57)) {
- return false;
- }
- else {
- var value = $(".date_" + prop.DocPropertyName).val().toString().replace(/^(\d\d)(\d)$/g, '$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/[^\d\/]/g, '');
- $(".date_" + prop.DocPropertyName).val(value);
- }
- });
- $(".date_" + prop.DocPropertyName).focusout(function (e) {
- if ($(".date_" + prop.DocPropertyName).val() == "") {
- $('#hfdate_' + prop.FormPropertyId).val("");
- }
- });
- instance.loadPropertySettings(prop.PropertySettings, formpropertyid, prop.DocPropertyName);
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var requiredClass = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
- var ExcludedStages = prop.ExcludedStages.split('|');
- Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
- requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
- reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
- }
- let ControlId = 'txt_' + prop.DocPropertyId;
- if (prop.IsRequired)
- requiredClass = 'required';
- let isReadOnly = '';
- if (!Unibase.Themes.Compact.Components.Index.Instance().desktopMode) {
- isReadOnly = 'readonly';
- }
- const { helpTooltipHtml, helpTextHtml, helpClass } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- let html = `<div class="floating-label-form-group CancelBtnFloating_${prop.UniqueId} ${helpClass}" id ="div_${prop.UniqueId}">` +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<div class="input-group">' +
- '<input type="hidden" id="hfdate_' + prop.UniqueId + '" class="value-control hfdate_' + prop.DocPropertyName + '" value=""/>' +
- '<input type="text" id="date_' + prop.UniqueId + '" class="form-control type-control datepicker-input hasDatepicker ' + requiredClass + ' floating-label-control txt_' + prop.UniqueId + ' date_' + prop.DocPropertyName + '" placeholder="' + prop.LabelName + " " + reqMark + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + " " + reqMark + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '"' + isReadOnly + '>' +
- '<span class="input-group-addon mt-10 cursor-pointer"><i class="fa fa-calendar calender_' + prop.DocPropertyName + '"></i></span>' +
- '<input type="hidden" id="hf_' + prop.ControlId + '" /></div>' + helpTextHtml + '</div>';
- $("#" + containerid).append(html);
- Unibase.Forms.Controls.DatePicker.Instance().loadDate(prop.UniqueId, prop);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadDate(formpropertyid, prop) {
- var container = "control-container-" + formpropertyid;
- if (this._time == true) {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- });
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- this._time = false;
- }
- else {
- $("#" + container).find('#date_' + prop.FormPropertyId).daterangepicker({
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + prop.FormPropertyId).val(end.format('YYYY-MM-DD'));
- });
- }
- $(`.calender_${prop.DocPropertyName}`).click(function () {
- $(this).parents('.input-group').find('.datepicker-input').trigger('click');
- });
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- var instance = this;
- var istime = false;
- var dateNow = new Date();
- var container = "control-container-" + formpropertyid;
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "IsTodayDate") {
- if (data.ControlPropertyValue == "true") {
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- if (DateTime_Value == "") {
- var maxDate;
- if (instance.disableFutureDate)
- maxDate = new Date();
- else
- maxDate = new Date(2050, 11, 31);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- maxDate: maxDate
- });
- var todayDate = $("#" + container).find('#date_' + formpropertyid).val();
- var hfformat = "YYYY/MM/DD";
- var tdate = moment(todayDate, "DD/MM/YYYY").format("YYYY/MM/DD");
- $("#" + container).find('#hfdate_' + formpropertyid).val(tdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD'));
- $("#" + container).find('#div_' + formpropertyid).addClass('floating-label-form-group-with-value');
- });
- }
- $("#" + container).find('#div_' + formpropertyid).addClass('floating-label-form-group-with-value');
- $("#" + container).find('#date_' + formpropertyid).keypress(function (e) {
- $(this).attr("maxlength", "10");
- if (e.which != 8 && e.which != 0 && (e.which < 47 || e.which > 57)) {
- return false;
- }
- else {
- var value = $(this).val().toString().replace(/^(\d\d)(\d)$/g, '$1/$2').replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/[^\d\/]/g, '');
- $(this).val(value);
- }
- });
- if (instance.dtime == false) {
- if (istime == true) {
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- var cdate = new Date();
- var currentdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(cdate, "DD/MM/YYYY HH:mm");
- $("#" + container).find('#date_' + formpropertyid).val(currentdate);
- var hfcdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(cdate, "YYYY/MM/DD HH:mm");
- $("#" + container).find('#hfdate_' + formpropertyid).val(hfcdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- let curren = new Date();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('show.daterangepicker', function (ev, picker) {
- var dateTime_New = $("#" + container).find('#date_' + formpropertyid).val();
- var hours = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") - 2, dateTime_New.toString().indexOf(":"));
- if (hours.substring(0, 1) == "0") {
- hours = hours.substring(1);
- }
- var minutes = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") + 1, dateTime_New.toString().indexOf(":") + 3);
- if (minutes.substring(0, 1) == "0") {
- minutes = minutes.substring(1);
- }
- $('.show-calendar').find('.hourselect option:selected').removeAttr('selected');
- $('.show-calendar').find('.minuteselect option:selected').removeAttr('selected');
- $('.hourselect option[value="' + hours + '"]').attr("selected", "selected");
- $('.minuteselect option[value="' + minutes + '"]').attr("selected", "selected");
- });
- }
- }
- }
- }
- if (data.ControlPropertyName == "IsTime") {
- if (instance.dtime == false) {
- if (data.ControlPropertyValue == "true") {
- istime = true;
- var DateTime_Value = $("#" + container).find('#date_' + formpropertyid).val();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- var cdate = new Date();
- var currentdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalTime(cdate, "DD/MM/YYYY HH:mm");
- $("#" + container).find('#date_' + formpropertyid).val(currentdate);
- var hfcdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDateTime(cdate, "YYYY/MM/DD HH:mm");
- $("#" + container).find('#hfdate_' + formpropertyid).val(hfcdate);
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('apply.daterangepicker', function (ev, picker) {
- $("#" + container).find('#date_' + formpropertyid).val(picker.startDate.format('DD/MM/YYYY HH:mm'));
- $("#" + container).find('#hfdate_' + formpropertyid).val(picker.startDate.format('YYYY/MM/DD HH:mm'));
- });
- let curren = new Date();
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').on('show.daterangepicker', function (ev, picker) {
- var dateTime_New = $("#" + container).find('#date_' + formpropertyid).val();
- var hours = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") - 2, dateTime_New.toString().indexOf(":"));
- if (hours.substring(0, 1) == "0") {
- hours = hours.substring(1);
- }
- var minutes = dateTime_New.toString().substring(dateTime_New.toString().indexOf(":") + 1, dateTime_New.toString().indexOf(":") + 3);
- if (minutes.substring(0, 1) == "0") {
- minutes = minutes.substring(1);
- }
- $('.show-calendar').find('.hourselect option:selected').removeAttr('selected');
- $('.show-calendar').find('.minuteselect option:selected').removeAttr('selected');
- $('.hourselect option[value="' + hours + '"]').attr("selected", "selected");
- $('.minuteselect option[value="' + minutes + '"]').attr("selected", "selected");
- });
- $(".hasDatepicker").keypress(function (e) {
- $(this).attr("maxlength", "19");
- var value = $(this).val().toString().replace(/^(\d\d\/\d\d)(\d+)$/g, '$1/$2').replace(/^(\d\d\/\d\d\/\d\d\d\d)(\d)/g, '$1 ').replace(/^(\d\d\/\d\d\/\d\d\d\d\s\d\d)(\d)/g, '$1:$2$2:');
- $(this).val(value);
- });
- }
- }
- }
- if (data.ControlPropertyName == "DisableFutureDate") {
- if (data.ControlPropertyValue == "true") {
- $("#" + container).find('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- singleDatePicker: true,
- showDropdowns: true,
- autoUpdateInput: false,
- minYear: 1901,
- maxDate: new Date(),
- locale: {
- format: 'DD/MM/YYYY',
- firstDay: 1,
- },
- }, function (start, end, label) {
- $("#" + container).find('#hfdate_' + formpropertyid).val(end.format('YYYY-MM-DD'));
- });
- $('#date_' + formpropertyid + '.datepicker-input').keyup(function (e) {
- let dateString = $(this).val();
- let errorMsgDiv = $(this).parents('.formValidate').find('.form-error-message').attr('id');
- let myDate = moment(dateString, ['DD/MM/YYYY', 'D/M/YYYY', 'DD/M/YYYY', 'D/MM/YYYY'], true);
- MessageHelper.Instance().hideMessage();
- $(this).attr('data-isValid', 'false');
- if (dateString.length >= 8 && dateString != "") {
- if (myDate.isValid() == false) {
- MessageHelper.Instance().showError('Enter Correct Date Format!.', errorMsgDiv);
- }
- else if (moment(dateString, 'DD/MM/YYYY').isSameOrBefore(moment().format()) == false) {
- MessageHelper.Instance().showError('You cannot enter a date in the future.', errorMsgDiv);
- }
- else if (moment(dateString, 'DD/MM/YYYY').isSameOrAfter('01/01/1901', 'year') == false) {
- MessageHelper.Instance().showError('You cannot enter a date before 1901.', errorMsgDiv);
- }
- else {
- MessageHelper.Instance().hideMessage();
- $('#hfdate_' + formpropertyid).val(moment(dateString, 'DD/MM/YYYY').format('YYYY-MM-DD'));
- $(this).attr('data-isValid', 'true');
- }
- }
- });
- instance.disableFutureDate = true;
- $('#date_' + formpropertyid + '.datepicker-input').focusout(function (e) {
- let isDateValid = $(this).attr('data-isValid');
- if (isDateValid == 'false') {
- $(this).val("");
- $('#hfdate_' + formpropertyid).val("");
- $(this).attr('data-isValid', 'true');
- }
- });
- }
- }
- }
- }
- instance.propval = "";
- instance.dtime = false;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- var format = "DD/MM/YYYY";
- var hfformat = "YYYY/MM/DD";
- var hfdate = "";
- if (instance.IsTimePicker) {
- instance.propval = moment(propval).format("DD/MM/YYYY HH:mm");
- hfdate = moment(propval).format("YYYY/MM/DD HH:mm");
- instance._time = true;
- $('#date_' + formpropertyid + '.datepicker-input').daterangepicker({
- autoUpdateInput: false,
- timePicker: true,
- timePicker24Hour: true,
- singleDatePicker: true,
- showDropdowns: true,
- minYear: 1901,
- locale: {
- format: 'DD/MM/YYYY HH:mm',
- firstDay: 1,
- },
- });
- instance.dtime = true;
- }
- else {
- instance.propval = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDate1(propval, format);
- hfdate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerLocalDate(propval, hfformat);
- }
- var formattedPropVal = Unibase.Platform.Helpers.DateTimeHelper.Instance().serverDateformat(instance.propval);
- if (instance.propval == "Invalid date" || formattedPropVal == "01/01/1901" || formattedPropVal == "01/01/1900" || formattedPropVal == "01/01/2001" || formattedPropVal == "01/01/0001") {
- instance.propval = "";
- }
- $("#hfdate_" + formpropertyid).val(hfdate);
- $("#date_" + formpropertyid).val(instance.propval);
- if ($("#date_" + formpropertyid).val() != "") {
- $("#div_" + formpropertyid).addClass("floating-label-form-group-with-value");
- }
- }
- static Instance() {
- if (this.instance === undefined)
- this.instance = new DatePicker();
- return this.instance;
- }
- }
- Controls.DatePicker = DatePicker;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class RadioBox {
- init(formpropertyid, prop, callback) {
- var instance = RadioBox.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null && prop.StagesForRequired != "") {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- }
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = '<div id="div_' + prop.DocPropertyName + '" class="div_' + prop.DocPropertyName + '_' + prop.FormPropertyId + '"><label for= "lbl" id = "lbl_' + prop.DocPropertyName + '" >' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyName + '"> *</span></label ><br />' +
- '<input type="hidden" id="hdnRdb_' + prop.DocPropertyName + '" value="0" class="value-control" data-isdefault="' + prop.IsDefault + '" data-propdoctypename="' + prop.DocTypeName + '" data-required="' + prop.IsRequired + '" data-regularexp="' + regExpr + '" data-validatemsg="' + ErrMsg + '" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + '" />' +
- '<span id="spnRdb_' + prop.DocPropertyName + '" class="spnRdb_' + prop.DocPropertyName + ' text-control" ></span>' +
- '<input type = "hidden" id = "hfId_' + prop.DocPropertyName + '" value = "0" ><label for="Validation" id="lblValidation_' + prop.DocPropertyName + '"></label><input type = "hidden" id = "hfFormPropertyId" value = "' + prop.FormPropertyId + '" />' + helpTextHtml + '</div>';
- $("#" + containerid).html(html);
- Unibase.Forms.Controls.RadioBox.Instance().getControlOptions(containerid, prop.DocPropertyName, prop);
- }
- getControlOptions(containerid, DocPropertyName, prop) {
- var hiddenids = $('#hdnRdb_' + DocPropertyName).val();
- var html = '';
- var data = JSON.parse(prop.ControlJsonText);
- if (prop.PropertySettings[0].ControlPropertyValue == "true") {
- html = '<span class="row">';
- }
- for (var i = 0; i < data.length; i++) {
- var assignValue = "";
- if (hiddenids != '') {
- if (hiddenids == data[i].ColumnValue) {
- assignValue = "checked";
- }
- }
- var textcolumn;
- if (data[i].ColumnValue.includes(" ") || data[i].ColumnValue.includes("/") || data[i].ColumnValue.includes("&")) {
- textcolumn = data[i].ColumnValue.replaceAll(" ", "").replaceAll("/", "").replaceAll("&", "");
- }
- else {
- textcolumn = data[i].ColumnValue;
- }
- if (Unibase.Forms.Controls.SubForm.Instance().Index != undefined && Unibase.Forms.Controls.SubForm.Instance().Index != 0) {
- var id = DocPropertyName + '_' + textcolumn + Number($("#SubFormIndex").val());
- }
- else {
- var id = DocPropertyName + '_' + textcolumn;
- }
- var columnvalue = prop.datatypeid == 3 ? data[i].ColumnNumber : data[i].ColumnValue;
- let val = columnvalue;
- if (prop.PropertySettings[0].ControlPropertyValue == "true") {
- html += '<div class="custom-control custom-radio col-sm-6 col-md-4 col-xl-3 p-0"><label id="lbl_' + id + '" class="btn btn-xs btn-rounded btn btn-light lblid_' + id + ' setting_radio' + DocPropertyName + ' mx-10 d-block" onclick="Unibase.Forms.Controls.RadioBox.Instance().radioButtonClick(' + "'" + DocPropertyName + "' ," + "'" + columnvalue + "'" + " ," + "'" + id + "'" + ')" style="height:30px" for="rdb_' + id + '">' + data[i].ColumnText + '</label><input type="radio" id="rdb_' + id + '" name="roleid" class="radio-tabview type-control custom-control-input rdb_' + DocPropertyName + '"/></div>';
- if (i == data.length - 1) {
- html += '</span>';
- }
- }
- else {
- html += '<div class="custom-control custom-radio">' +
- '<input type = "radio" id="rdb_' + id + '" name="' + DocPropertyName + '" class="type-control custom-control-input rdb_' + DocPropertyName + '_' + columnvalue + '" onclick="Unibase.Forms.Controls.RadioBox.Instance().radioButtonClick(' + "'" + DocPropertyName + "' ," + "'" + columnvalue + "'" + " ," + "'" + id + "'" + ')" ' + assignValue + '>' +
- '<label class="custom-control-label" for="rdb_' + id + '">' + data[i].ColumnText + '</label></div >';
- }
- }
- $("#" + containerid).find('.div_' + DocPropertyName + '_' + prop.FormPropertyId).find(".spnRdb_" + DocPropertyName).html(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "IsTabView") {
- $("#txt_" + formpropertyid).attr("MaxLength", data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- let value = propval;
- propval = propval.replaceAll(" ", "").replaceAll("/", "").replaceAll("&", "");
- if ($(".rdb_" + DocPropertyName).hasClass("radio-tabview")) {
- var _id = $(".lblid_" + DocPropertyName + "_" + propval);
- if (_id.length > 0) {
- var id = _id.attr("id").replace("lbl_", "");
- Unibase.Forms.Controls.RadioBox.Instance().radioButtonClick(DocPropertyName, value, id);
- }
- }
- else {
- $(".rdb_" + DocPropertyName + "_" + propval).prop("checked", true);
- $("#hdnRdb_" + DocPropertyName).val(value);
- }
- }
- radioButtonClick(DocPropertyName, ColumnValue, id) {
- if ($(".rdb_" + DocPropertyName).hasClass("radio-tabview")) {
- $(".setting_radio" + DocPropertyName).removeClass("btn-primary");
- $(".setting_radio" + DocPropertyName).addClass("btn-light");
- $("#lbl_" + id).removeClass("btn-light");
- $("#lbl_" + id).addClass("btn-primary");
- $("#hdnRdb_" + DocPropertyName).val(ColumnValue);
- }
- else {
- $("#hdnRdb_" + DocPropertyName).val(ColumnValue);
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new RadioBox();
- }
- return this.instance;
- }
- }
- Controls.RadioBox = RadioBox;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Managers;
- (function (Managers) {
- class PriceListManager extends Unibase.Platform.Core.BaseManager {
- saveMrp(obj) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/savemrp';
- return yield this.dataHelper().postAsync(url, obj).then(function (response) {
- return response;
- });
- });
- }
- getItem(itemid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/unibase/transact/items/getitem/itemid/' + itemid;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- editMrp(MrpId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/getmrp/mrpid/' + MrpId;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- exportList(PriceListId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelist/export/pricelistid/' + PriceListId;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null)
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- saveBatch(obj) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/savebatch';
- return yield this.dataHelper().postAsync(url, obj).then(function (response) {
- return response;
- });
- });
- }
- getbatch(batchid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelist/getbatch/batchid/' + batchid;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result !== '')
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getpricecodes(lobid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/pricecode/' + lobid;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- return response;
- });
- });
- }
- getPriceCodeByContact(ContactId, LobId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelist/getpricecodebycontact/contactid/' + ContactId + '/lobid/' + LobId;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result != "")
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- getpricelists(pricelistid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/pricelist/' + pricelistid;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- return response;
- });
- });
- }
- postdatafilter(request) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/savepricelist';
- return yield this.dataHelper().postAsync(url, request).then(function (response) {
- return response;
- });
- });
- }
- pricelistvalues(request) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/savepricevalues';
- return yield this.dataHelper().postAsync(url, request).then(function (response) {
- Unibase.Apps.Transact.Controls.CreatePriceList.Instance().editPriceList(Number($("#gridPager2").find('.pagination').find(".active").text()) - 1, 2, "");
- return response;
- });
- });
- }
- CreatePriceListItems(voucherid, contactid, page, searchtext) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/getpricelistitems/id/' + voucherid + '/page/' + page + '/rows/10/query/' + searchtext;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result != "")
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- EditPriceListItems(voucherid, contactid, page, searchtext) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/pricelistitems/id/' + voucherid + '/page/' + page + '/rows/10/query/' + searchtext;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- return response;
- });
- });
- }
- getlobs(ContactId) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/automationrules/getruleautotaggroups/' + ContactId;
- return yield this.dataHelper().getAsync(url).then(function (response) {
- return JSON.parse(response.result);
- });
- });
- }
- saveContactDefault(obj) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelists/contactdefault';
- return yield this.dataHelper().postAsync(url, obj).then(function (response) {
- return response;
- });
- });
- }
- getPriceValue(itemid) {
- return __awaiter(this, void 0, void 0, function* () {
- const url = 'apis/v4/bizgaze/transact/pricelist/getlatestpricevalue/itemid/' + itemid + '/mrpid/0/lobid/0';
- return yield this.dataHelper().getAsync(url).then(function (response) {
- if (response.result !== null && response.result !== '')
- response.result = JSON.parse(response.result);
- return response;
- });
- });
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new Bizgaze.Apps.Transact.Managers.PriceListManager();
- return this._instance;
- }
- }
- Managers.PriceListManager = PriceListManager;
- })(Managers = Transact.Managers || (Transact.Managers = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
-
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Enums;
- (function (Enums) {
- let DcType;
- (function (DcType) {
- DcType[DcType["Inward"] = 1] = "Inward";
- DcType[DcType["Outward"] = 2] = "Outward";
- DcType[DcType["ClaimInward"] = 3] = "ClaimInward";
- DcType[DcType["ClaimOutward"] = 4] = "ClaimOutward";
- })(DcType = Enums.DcType || (Enums.DcType = {}));
- let StockStatus;
- (function (StockStatus) {
- StockStatus[StockStatus["Active"] = 1] = "Active";
- StockStatus[StockStatus["Delivered"] = 2] = "Delivered";
- StockStatus[StockStatus["Damaged"] = 3] = "Damaged";
- StockStatus[StockStatus["Missing"] = 4] = "Missing";
- StockStatus[StockStatus["Allocated"] = 5] = "Allocated";
- StockStatus[StockStatus["Expired"] = 6] = "Expired";
- StockStatus[StockStatus["InActive"] = 7] = "InActive";
- StockStatus[StockStatus["Void"] = 8] = "Void";
- StockStatus[StockStatus["Transfer"] = 9] = "Transfer";
- })(StockStatus = Enums.StockStatus || (Enums.StockStatus = {}));
- let StockType;
- (function (StockType) {
- StockType[StockType["Item"] = 1] = "Item";
- StockType[StockType["Package"] = 2] = "Package";
- StockType[StockType["Asset"] = 3] = "Asset";
- })(StockType = Enums.StockType || (Enums.StockType = {}));
- let OrderType;
- (function (OrderType) {
- OrderType[OrderType["Sales"] = 1] = "Sales";
- OrderType[OrderType["Purchase"] = 2] = "Purchase";
- OrderType[OrderType["SalesOpportunity"] = 3] = "SalesOpportunity";
- OrderType[OrderType["PurchaseOpportunity"] = 4] = "PurchaseOpportunity";
- OrderType[OrderType["SalesClaim"] = 5] = "SalesClaim";
- OrderType[OrderType["PurchaseClaim"] = 6] = "PurchaseClaim";
- OrderType[OrderType["SalesEstimate"] = 7] = "SalesEstimate";
- OrderType[OrderType["PurchaseEstimate"] = 8] = "PurchaseEstimate";
- OrderType[OrderType["OrderTransfer"] = 9] = "OrderTransfer";
- OrderType[OrderType["InwardOrder"] = 10] = "InwardOrder";
- OrderType[OrderType["OutwardOrder"] = 11] = "OutwardOrder";
- OrderType[OrderType["SalesContract"] = 12] = "SalesContract";
- OrderType[OrderType["PurchaseContract"] = 13] = "PurchaseContract";
- OrderType[OrderType["PurchasePlanning"] = 14] = "PurchasePlanning";
- OrderType[OrderType["WorkOrder"] = 15] = "WorkOrder";
- OrderType[OrderType["ProductionPlanning"] = 16] = "ProductionPlanning";
- })(OrderType = Enums.OrderType || (Enums.OrderType = {}));
- let PriceType;
- (function (PriceType) {
- PriceType[PriceType["None"] = 1] = "None";
- PriceType[PriceType["CompositePrice"] = 2] = "CompositePrice";
- PriceType[PriceType["PiecePrice"] = 3] = "PiecePrice";
- PriceType[PriceType["Both"] = 4] = "Both";
- })(PriceType = Enums.PriceType || (Enums.PriceType = {}));
- let InventoryApplyType;
- (function (InventoryApplyType) {
- InventoryApplyType[InventoryApplyType["Packs"] = 1] = "Packs";
- InventoryApplyType[InventoryApplyType["Quantity"] = 2] = "Quantity";
- InventoryApplyType[InventoryApplyType["Numbers"] = 3] = "Numbers";
- InventoryApplyType[InventoryApplyType["Pieces"] = 4] = "Pieces";
- InventoryApplyType[InventoryApplyType["PacksAndPieces"] = 5] = "PacksAndPieces";
- })(InventoryApplyType = Enums.InventoryApplyType || (Enums.InventoryApplyType = {}));
- let OrderStatus;
- (function (OrderStatus) {
- OrderStatus[OrderStatus["Draft"] = 1] = "Draft";
- OrderStatus[OrderStatus["Approval"] = 2] = "Approval";
- OrderStatus[OrderStatus["Active"] = 3] = "Active";
- OrderStatus[OrderStatus["Rejected"] = 4] = "Rejected";
- OrderStatus[OrderStatus["Partial"] = 5] = "Partial";
- OrderStatus[OrderStatus["Completed"] = 6] = "Completed";
- OrderStatus[OrderStatus["Void"] = 7] = "Void";
- })(OrderStatus = Enums.OrderStatus || (Enums.OrderStatus = {}));
- let PaymentDiscountType;
- (function (PaymentDiscountType) {
- PaymentDiscountType[PaymentDiscountType["Discount"] = 1] = "Discount";
- PaymentDiscountType[PaymentDiscountType["Penalty"] = 2] = "Penalty";
- PaymentDiscountType[PaymentDiscountType["TDS"] = 3] = "TDS";
- })(PaymentDiscountType = Enums.PaymentDiscountType || (Enums.PaymentDiscountType = {}));
- let PaymentType;
- (function (PaymentType) {
- PaymentType[PaymentType["Receipt"] = 1] = "Receipt";
- PaymentType[PaymentType["Payment"] = 2] = "Payment";
- })(PaymentType = Enums.PaymentType || (Enums.PaymentType = {}));
- let PaymentMode;
- (function (PaymentMode) {
- PaymentMode[PaymentMode["None"] = 0] = "None";
- PaymentMode[PaymentMode["Cash"] = 1] = "Cash";
- PaymentMode[PaymentMode["Cheque"] = 2] = "Cheque";
- PaymentMode[PaymentMode["Online"] = 3] = "Online";
- PaymentMode[PaymentMode["Neft"] = 4] = "Neft";
- PaymentMode[PaymentMode["Rtgs"] = 5] = "Rtgs";
- PaymentMode[PaymentMode["FundTransfer"] = 6] = "FundTransfer";
- PaymentMode[PaymentMode["Adjustment"] = 7] = "Adjustment";
- PaymentMode[PaymentMode["Upi"] = 8] = "Upi";
- PaymentMode[PaymentMode["Cards"] = 9] = "Cards";
- PaymentMode[PaymentMode["MultiplePayments"] = 10] = "MultiplePayments";
- })(PaymentMode = Enums.PaymentMode || (Enums.PaymentMode = {}));
- let PaymentSettingType;
- (function (PaymentSettingType) {
- PaymentSettingType[PaymentSettingType["Discount"] = 1] = "Discount";
- PaymentSettingType[PaymentSettingType["Penalty"] = 2] = "Penalty";
- PaymentSettingType[PaymentSettingType["TDS"] = 3] = "TDS";
- PaymentSettingType[PaymentSettingType["MultiplePaymentMode"] = 4] = "MultiplePaymentMode";
- PaymentSettingType[PaymentSettingType["CompanyWisePayments"] = 5] = "CompanyWisePayments";
- })(PaymentSettingType = Enums.PaymentSettingType || (Enums.PaymentSettingType = {}));
- let InventoryType;
- (function (InventoryType) {
- InventoryType[InventoryType["Item"] = 1] = "Item";
- InventoryType[InventoryType["Service"] = 2] = "Service";
- InventoryType[InventoryType["Package"] = 3] = "Package";
- InventoryType[InventoryType["Assembly"] = 4] = "Assembly";
- InventoryType[InventoryType["Coupons"] = 5] = "Coupons";
- InventoryType[InventoryType["Discount"] = 6] = "Discount";
- InventoryType[InventoryType["Expense"] = 7] = "Expense";
- InventoryType[InventoryType["Subscription"] = 8] = "Subscription";
- })(InventoryType = Enums.InventoryType || (Enums.InventoryType = {}));
- let InvoiceStatus;
- (function (InvoiceStatus) {
- InvoiceStatus[InvoiceStatus["Draft"] = 1] = "Draft";
- InvoiceStatus[InvoiceStatus["Active"] = 2] = "Active";
- InvoiceStatus[InvoiceStatus["Confirmed"] = 3] = "Confirmed";
- InvoiceStatus[InvoiceStatus["PartialPaid"] = 4] = "PartialPaid";
- InvoiceStatus[InvoiceStatus["Paid"] = 5] = "Paid";
- InvoiceStatus[InvoiceStatus["Void"] = 6] = "Void";
- })(InvoiceStatus = Enums.InvoiceStatus || (Enums.InvoiceStatus = {}));
- let InvoiceType;
- (function (InvoiceType) {
- InvoiceType[InvoiceType["Sales"] = 1] = "Sales";
- InvoiceType[InvoiceType["Purchase"] = 2] = "Purchase";
- InvoiceType[InvoiceType["SalesReturn"] = 3] = "SalesReturn";
- InvoiceType[InvoiceType["PurchaseReturn"] = 4] = "PurchaseReturn";
- InvoiceType[InvoiceType["Transfer"] = 5] = "Transfer";
- InvoiceType[InvoiceType["DebitNote"] = 6] = "DebitNote";
- InvoiceType[InvoiceType["CreditNote"] = 7] = "CreditNote";
- InvoiceType[InvoiceType["Income"] = 8] = "Income";
- InvoiceType[InvoiceType["Expense"] = 9] = "Expense";
- InvoiceType[InvoiceType["InwardTransfer"] = 10] = "InwardTransfer";
- InvoiceType[InvoiceType["OutwardTransfer"] = 11] = "OutwardTransfer";
- })(InvoiceType = Enums.InvoiceType || (Enums.InvoiceType = {}));
- })(Enums = Transact.Enums || (Transact.Enums = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
-
- var Unibase;
- (function (Unibase) {
- let Core;
- (function (Core) {
- let Helpers;
- (function (Helpers) {
- class NumberHelper {
- roundNumber1(number, Int64s) {
- let dnum = Math.pow(10, Int64s);
- var n = parseFloat(((number * dnum) / dnum).toString());
- return n.toFixed(Int64s);
- }
- roundNumber(number, Int64s) {
- let Int64Value = 0;
- Int64s = Int64s || 0;
- number *= parseFloat((Math.pow(10, (Int64s + 1))).toString());
- Int64Value = parseInt((Math.floor(number)).toString()) - (Math.floor(number / 10) * 10);
- number = Math.floor(number / 10);
- if (Int64Value >= 5) {
- number += 1;
- }
- number /= parseFloat((Math.pow(10, (Int64s))).toString());
- return number.toFixed(Int64s);
- }
- DelimiterNumber(number) {
- var parts = number.toString().split(".");
- parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
- return parts.join(".");
- }
- format(num, digits, InMillions) {
- var si = [];
- if (InMillions) {
- si = [
- { value: 1, symbol: "" },
- { value: 1E3, symbol: "k" },
- { value: 1E6, symbol: "M" },
- { value: 1E9, symbol: "G" },
- { value: 1E12, symbol: "T" },
- { value: 1E15, symbol: "P" },
- { value: 1E18, symbol: "E" }
- ];
- }
- else {
- si = [
- { value: 1, symbol: "" },
- { value: 1E3, symbol: "k" },
- { value: 1E5, symbol: "L" },
- { value: 1E7, symbol: "Cr" },
- { value: 1E9, symbol: "KCr" },
- { value: 1E11, symbol: "LCr" }
- ];
- }
- var rx = /\.0+$|(\.[0-9]*[1-9])0+$/;
- var i;
- for (i = si.length - 1; i > 0; i--) {
- if (num >= si[i].value) {
- break;
- }
- }
- return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol;
- }
- static Instance() {
- if (this.instance === null || this.instance === undefined)
- this.instance = new NumberHelper();
- return this.instance;
- }
- }
- Helpers.NumberHelper = NumberHelper;
- })(Helpers = Core.Helpers || (Core.Helpers = {}));
- })(Core = Unibase.Core || (Unibase.Core = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class NumberBox {
- init(formpropertyid, prop, callback) {
- var instance = NumberBox.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- var formid = $("#number_" + prop.UniqueId).parents('.formValidate').attr('id');
- var errormsg = $("#" + formid).find('.bizgaze_FormErrorMessages').attr('id');
- $("#number_" + prop.UniqueId).keyup(function (e) {
- if (e.which == 8 || e.which == 46) {
- let numVal = $("#number_" + prop.UniqueId).val().toString();
- if (numVal.startsWith('.') == false) {
- return true;
- }
- }
- if (e.which === 9) {
- return true;
- }
- if (prop.DataTypeId == Number(Unibase.Platform.Analytics.Reports.Enums.DataType.decimal)) {
- var regex = /^[0-9]+\.?[0-9]*$/;
- var result = regex.test($("#number_" + prop.UniqueId).val().toString());
- if (result == false) {
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Allow only Decimal Values");
- $("#number_" + prop.UniqueId).val('');
- return false;
- }
- }
- else if (prop.DataTypeId == Number(Unibase.Platform.Analytics.Reports.Enums.DataType.int64) || prop.DataTypeId == Number(Unibase.Platform.Analytics.Reports.Enums.DataType.int32)) {
- var regex = /^[0-9]*$/;
- var result = regex.test($("#number_" + prop.UniqueId).val().toString());
- if (result == false) {
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Numbers only Allowed");
- $("#number_" + prop.UniqueId).val('');
- return false;
- }
- }
- });
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var required = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.StagesForRequired != null) {
- var StagesForRequired = prop.StagesForRequired.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- required = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- const { helpTooltipHtml, helpTextHtml, helpClass } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = `<div id="div_${prop.DocPropertyName}" class="floating-label-form-group ${helpClass}"><label for= "lbl" id="lbl_${prop.FormPropertyId}">${helpTooltipHtml}<span class="label-name">${prop.LabelName}</span><span class="text-danger ${Isrequired}" id="spnIsRequired_${prop.FormPropertyId}"> *</span></label>
- <input type="text" id="number_${prop.UniqueId}" class="type-control creditnumber form-control value-control ${required} floating-label-control number_${prop.DocPropertyName}" data-isdefault="${prop.IsDefault}" data-propdoctypename="${prop.DocTypeName}" data-required="${prop.IsRequired}" data-regularexp="${regExpr}" data-validatemsg="${ErrMsg}" placeholder = "${prop.LabelName} ${reqMark}" data-placeholder="${prop.Placeholder}" data-label="${prop.LabelName} ${reqMark}" value="" />
- <input type="hidden" id="hfId" value=""><label for="Validation" id="lblValidation_${prop.DocPropertyName}"></label><input type="hidden" id="hfFormPropertyId" value="" />${helpTextHtml}</div>`;
- $("#" + containerid).html(html);
- eval('_floatingLabelHelper.init()');
- }
- numberBoxValue(uniqueId, isRequired) {
- var currentValue = $("#number_" + uniqueId).val();
- if (isRequired) {
- if (currentValue == "0") {
- return "";
- }
- else {
- return currentValue;
- }
- }
- else {
- if (currentValue == "" || currentValue == undefined) {
- return "0";
- }
- else {
- return currentValue;
- }
- }
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "DefaultValue" && data.ControlPropertyValue != "") {
- $("#number_" + formpropertyid).val(data.ControlPropertyValue);
- $("#number_" + formpropertyid).addClass("floating-label-form-group-with-value");
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- $("#number_" + formpropertyid).val(propval);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new NumberBox();
- }
- return this.instance;
- }
- }
- Controls.NumberBox = NumberBox;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class ImagePicker {
- constructor() {
- this.fileData = [];
- }
- jsFiles() {
- return ["apps/communications/ai/components/resumeparsingmanager.js"];
- }
- init(formpropertyid, prop, callback) {
- var instance = this;
- var errormsg = $(".bizgaze_FormErrorMessages:visible").attr("id");
- if ($("#img_" + prop.FormPropertyId).val() == "") {
- instance.fileData[formpropertyid] = [];
- }
- $('#browse_' + prop.FormPropertyId).click(function () {
- $("#img_" + prop.FormPropertyId).click();
- });
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- $("#img_" + formpropertyid).change(function (e) {
- $("#editFileName_" + formpropertyid).addClass("hidden");
- if (!$("#editFileName_" + formpropertyid).hasClass("hidden") && instance.fileData[formpropertyid] != []) {
- var fileReq = {
- FileId: 1,
- FilePath: instance.fileData[formpropertyid].FilePath,
- };
- instance.fileData[formpropertyid] = fileReq;
- }
- $("#img_" + formpropertyid).removeAttr("style");
- var file = $("#img_" + formpropertyid).get(0);
- var files = file.files;
- if (!files[0].type.match('image.*')) {
- $("#img_" + formpropertyid).val('');
- MessageHelper.Instance().showError("Please Select Image File.", errormsg);
- }
- else {
- instance.selectImageFile(files[0], prop.DocPropertyName, formpropertyid, null);
- var item = { Files: files[0] };
- instance.getBase64(item).then(function (response) {
- var filePath = null;
- if (instance.fileData[formpropertyid].FilePath != null) {
- filePath = instance.fileData[formpropertyid].FilePath;
- }
- instance.fileData[formpropertyid] = response;
- instance.fileData[formpropertyid].FilePath = filePath;
- });
- }
- });
- if (callback != null) {
- callback();
- }
- }
- selectImageFile(file, DocPropertyName, formpropertyid, imgurl) {
- var instance = this;
- $("#fileCount").addClass('hidden');
- var html = "";
- var imgShow = "";
- var filename = "";
- if (file != null) {
- var tmppath = URL.createObjectURL(file);
- imgShow = tmppath;
- filename = file.name;
- $("#requiredImgInput_" + formpropertyid).val(filename);
- instance.fileHtml(filename, formpropertyid, DocPropertyName, imgShow);
- }
- else {
- filename = DocPropertyName;
- $("#requiredImgInput_" + formpropertyid).val(filename);
- DocPropertyName = "";
- var src = "";
- var path = 'apis/v4/Documents/GetFile?path=' + imgurl;
- Unibase.Platform.Analytics.Managers.ReportManager.Instance().dataHelper().getAsync(path).then(function (response) {
- src = 'data:image/png;base64,' + response.file;
- }).then(function () {
- instance.fileHtml(filename, formpropertyid, DocPropertyName, src);
- });
- }
- }
- fileHtml(filename, formpropertyid, DocPropertyName, imgShow) {
- if (filename.length > 15) {
- var File_Extension = filename.substr(filename.lastIndexOf("."));
- filename = filename.substr(0, 15) + '...' + File_Extension;
- }
- var html = '<li class="list-group-item b-a clear p-0 mb-15" id="list-file_' + formpropertyid + '" style="border: none">' +
- '<span class="block fileuploads filename hidden">' +
- '<span class="pull-left">' +
- '<span class="fa fa-trash-o fa-lg text-danger mr-15" style="cursor:pointer" href="javascript:;" onclick="javascript:Unibase.Forms.Controls.ImagePicker.Instance().removeFile(' + formpropertyid + ',\'' + filename + '\'' + ',\'' + DocPropertyName + '\'' + '); " title="Click to Delete"></span>' +
- '<img id="img_upload " class="mr-20" style="height:35px;width:35px;vertical-align:middle;" alt="" src="' + imgShow + '">' +
- '<span class="h6 fileName" title="' + filename + '">' + filename + '</span>' +
- '</span></span></li>';
- $('.fileuploads_' + formpropertyid).find('.thumb_output_').html(html);
- $('#list-file_' + formpropertyid).find('.fileuploads').removeClass("hidden");
- }
- removeFile(formpropertyid, filename, docpropertyname) {
- $('#img_' + formpropertyid).val(null);
- $("#list-file_" + formpropertyid).remove();
- $("#requiredImgInput_" + formpropertyid).val("");
- $("#editFileName_" + formpropertyid).addClass("hidden");
- }
- loadControl(containerid, prop) {
- var isrequired = 'hidden';
- var required = '';
- if (prop.IsRequired != null) {
- isrequired = (prop.IsRequired) ? '' : 'hidden';
- required = (prop.IsRequired) ? 'required' : '';
- }
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- var html = '<div id="ImageUpload" class="form-group floating-label focus m-0 pt-10 pb-10">' +
- '<label for="lbl" id="lbl_' + prop.UniqueId + '" >' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + isrequired + '" id="spnIsRequired_' + prop.UniqueId + '"> *</span></label >' +
- '<input id="requiredImgInput_' + prop.UniqueId + '" class="hidden d-none value-control form-control requiredImgInput ' + required + '" type="text" val="">' +
- '<input id="img_' + prop.UniqueId + '" type="file" class="hidden fileUpload_ d-none" data-propertyname="' + prop.DocPropertyName + '" data-isdefault="' + prop.IsDefault + '" data-propdoctypename="' + prop.DocTypeName + '" data-required="' + prop.IsRequired + '" onclick="this.value=null;" />' +
- '<input type="button" value="Choose Image" style="color:black;margin-left:20px;height: 30px;width: 130px;" id="browse_' + prop.UniqueId + '" /><label class="hidden" id="editFileName_' + prop.UniqueId + '"></label>' +
- '<label for="file_' + prop.DocPropertyName + '"><span id="fileCount"></span></label><input type="hidden" id="hfId" value="">' +
- '<label for="Validation" id="lblValidation_' + prop.DocPropertyName + '"></label>' +
- '<input type="hidden" id="hfFormPropertyId" value="" />' + helpTextHtml + '</div>' +
- '<div class="row ml-15 fileuploads_' + prop.FormPropertyId + ' filename"><div class="row col-md-12 pl-2"><div class="row">' +
- '<ul class="list-group mb-n mt-n-15 no-border thumb_output_">' +
- '<li class="hidden no-border"></li>' +
- '</ul></div></div></div>';
- $("#" + containerid).html(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var instance = this;
- if (propval != "") {
- var splitArray = propval.split("/");
- var fileName = splitArray[splitArray.length - 1];
- propval = propval.replaceAll("/", "\\");
- var fileReq = {
- FileId: 0,
- FilePath: propval,
- };
- instance.fileData[formpropertyid] = fileReq;
- $("#editFileName_" + formpropertyid).removeClass("hidden");
- instance.selectImageFile(null, fileName, formpropertyid, propval);
- }
- }
- fileObj(formpropertyid) {
- var instance = this;
- var file = $("#img_" + formpropertyid).get(0);
- var files = file.files;
- if (files.length == 0 && $("#editFileName_" + formpropertyid).hasClass("hidden")) {
- var filepath = instance.fileData[formpropertyid].FilePath;
- if (instance.fileData[formpropertyid].FilePath != undefined) {
- filepath = null;
- }
- var fileReq = {
- FileId: 1,
- FilePath: filepath,
- };
- instance.fileData[formpropertyid] = fileReq;
- }
- return instance.fileData[formpropertyid];
- }
- getBase64(item) {
- return __awaiter(this, void 0, void 0, function* () {
- var filename = "";
- filename = item.Files.DocumentFileName;
- if (filename == undefined)
- filename = item.Files.name;
- let file = item.Files;
- let fileInfo = item.Files.name.split('.');
- return new Promise((resolve, reject) => {
- let instance;
- let content = '';
- const reader = new FileReader();
- reader.readAsDataURL(item.Files);
- reader.onloadend = function () {
- return __awaiter(this, void 0, void 0, function* () {
- var base64String = reader.result.toString().replace(/^data:.+;base64,/, '');
- var fileReq = {
- FileData: base64String,
- FileName: fileInfo[0],
- FileType: fileInfo[1],
- ByteData: null
- };
- resolve(fileReq);
- });
- };
- reader.onerror = function (e) {
- reject(e);
- };
- });
- });
- }
- static Instance() {
- if (this._instance === undefined)
- this._instance = new ImagePicker();
- return this._instance;
- }
- }
- Controls.ImagePicker = ImagePicker;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- };
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class Tag extends Unibase.Platform.Core.BaseComponent {
- constructor() {
- super(...arguments);
- this.editData = [];
- this.isFormEdit = [];
- }
- init(formpropertyid, prop, callback) {
- var instance = Unibase.Forms.Controls.Tag.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- var controlJsonText = JSON.parse(prop.ControlJsonText);
- var containerId = "control-container-" + formpropertyid;
- $("#" + containerId).find("#hdn_tagtype").val(controlJsonText.TagTypeId);
- $("#" + containerId).find("#hdn_tagcategoryid_controljson").val(controlJsonText.TagCategoryId);
- if (controlJsonText.TagTypeId == 1)
- instance.isGroupWiseTag = false;
- else
- instance.isGroupWiseTag = true;
- var initBindData = {
- isBindData: true,
- propVal: "",
- isEdit: false,
- };
- instance.editData[formpropertyid] = initBindData;
- var isApplyFilter = controlJsonText.IsApplyFilter;
- if (isApplyFilter) {
- if (callback != null) {
- var bindData = {
- isBindData: false,
- propVal: "",
- isEdit: true,
- };
- instance.editData[formpropertyid] = bindData;
- callback();
- }
- }
- else {
- instance.getTagsByTagTypeId(containerId, prop.UniqueId, controlJsonText.TagTypeId, controlJsonText.TagCategoryId, isApplyFilter).then(function () {
- if (callback != null) {
- callback();
- }
- });
- }
- }
- loadControl(containerid, prop) {
- var instance = this;
- $("#" + containerid).append('<div id="tagControlParentDiv"><div id="hiddenFieldsDiv"><input type="hidden" id="hdn_tagtype" val="0"/><input type="hidden" id="hdn_taggroups" val="0"/><input type="hidden" id="hdn_tagcategories" val="0"/><input type="hidden" id="hdn_tagcategoryid_controljson" val="0"/><input type="hidden" id="hdn_tagcontrol_' + prop.UniqueId + '" class="hdn_tagcontrol type-control value-control" value="Unibase.Forms.Controls.Tag.Instance().tagItemObj();"><div id="tagControlEmpty" class="row"><small class="ml-10 text-danger">No tags found...</small></div></div><div id="tagControl"></div></div>');
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- }
- bindEditFormDetails(formPropertyId, propval, DocPropertyName) {
- var instance = this;
- var editData = instance.editData[formPropertyId];
- if (editData.isBindData) {
- var groupWiseTagsList = JSON.parse(propval.replace(/'/g, '"'));
- var containerid = "control-container-" + formPropertyId;
- var items = [];
- if (groupWiseTagsList.length > 0) {
- for (let k = 0; k < groupWiseTagsList.length; k++) {
- $("#chkGroupWiseTag_" + groupWiseTagsList[k].TagGroupId + "").prop('checked', true);
- }
- var tagItemsList = groupWiseTagsList[0].TagItems;
- for (let i = 0; i < tagItemsList.length; i++) {
- let tagId = tagItemsList[i].TagId;
- let parentTagId = tagItemsList[i].ParentRootId;
- let uniqueId = formPropertyId + "_" + parentTagId;
- if ($("#hfTagShowType_" + uniqueId).val() == Unibase.Platform.Forms.Enums.TagShowType.Select2) {
- var selectedTag = new Option(tagItemsList[i].TagName, tagId.toString(), true);
- $("#ddlMultiChildTags_single_" + uniqueId).append(selectedTag);
- items.push(tagId.toString());
- $("#ddlMultiChildTags_single_" + uniqueId).val(items).trigger("change");
- var selectedTags = $("#ddlMultiChildTags_single_" + uniqueId).val();
- $("#" + containerid).find("#hfSelectedGroupId_" + uniqueId).val(selectedTags);
- }
- else {
- if ($("#hfIsMultiple_" + uniqueId).val() == "true") {
- $("#chkIsChecked_" + formPropertyId + "_" + tagId).prop('checked', true);
- var chktagids = $("#bindtags_" + uniqueId).find(".chkselectedTags:checked").map(function () {
- return jQuery(this).data('tagid');
- });
- chktagids = Array.from(chktagids);
- $("#" + containerid).find("#hfSelectedGroupId_" + uniqueId).val(chktagids);
- }
- else {
- $("#rdBtntag_" + formPropertyId + "_" + tagId).prop('checked', true);
- var rbdtagids = $("#bindtags_" + uniqueId).find(".rdBtntag:checked").map(function () {
- return jQuery(this).data('tagid');
- });
- rbdtagids = Array.from(rbdtagids);
- $("#" + containerid).find("#hfSelectedGroupId_" + uniqueId).val(rbdtagids);
- }
- }
- }
- }
- }
- else {
- var bindData = {
- isBindData: true,
- propVal: propval,
- isEdit: true
- };
- instance.editData[formPropertyId] = bindData;
- }
- }
- bindFilterHiddenFields(tagGroupIds, tagCategoryIds) {
- var instance = this;
- var containerId = $("#tagControl:visible").parents(".divCustomProperties").attr("id");
- var uniquePropId = $("#" + containerId).find("#tagControl").parents(".divCustomProperties").data("uniqueid");
- var tagTypeId = Number($("#" + containerId).find("#tagControlParentDiv").find("#hdn_tagtype").val());
- var tagCategoryId = Number($("#" + containerId).find("#hdn_tagcategoryid_controljson").val());
- $("#" + containerId).find("#hdn_taggroups").val(tagGroupIds);
- $("#" + containerId).find("#hdn_tagcategories").val(tagCategoryIds);
- instance.refreshControl(containerId, uniquePropId, tagTypeId, tagCategoryId);
- }
- refreshControl(containerId, uniquePropId, tagTypeId, tagCategoryId) {
- var instance = this;
- $("#" + containerId).find("#tagControl").empty();
- instance.getTagsByTagTypeId(containerId, uniquePropId, tagTypeId, tagCategoryId, true);
- }
- getTagsByTagTypeId(containerId, uniquePropId, tagTypeId, tagCategoryId, isApplyFilter) {
- return __awaiter(this, void 0, void 0, function* () {
- var instance = this;
- var tagCategoryIds = $("#" + containerId).find("#hdn_tagcategories").val();
- if (tagCategoryIds == undefined && tagCategoryIds == null && tagCategoryIds != "") {
- tagCategoryIds = "0";
- }
- var tagGroupIds = $("#" + containerId).find("#hdn_taggroups").val();
- if (tagGroupIds == undefined && tagGroupIds == null && tagGroupIds == "") {
- tagGroupIds = "0";
- }
- var reqObj = {
- TagSettingTypeId: tagTypeId,
- TagCategoryId: tagCategoryId,
- TagGroupIds: tagGroupIds,
- TagCategoryIds: tagCategoryIds,
- };
- yield Unibase.Platform.Forms.Managers.TagManager.Instance().getTagsByTagTypeId(reqObj).then(function (response) {
- return __awaiter(this, void 0, void 0, function* () {
- var result = response.result;
- $("#" + containerId).find("#tagControlEmpty").addClass("hidden");
- if (response.status == Unibase.Data.Status.Success) {
- if (response.result.length > 0) {
- if (tagTypeId == 1) {
- var parentTags = result[0].TagList;
- yield instance.bindTagHTML(containerId, uniquePropId, parentTags, 0);
- }
- else if (tagTypeId == 2) {
- yield instance.bindTagGroupHTML(containerId, uniquePropId, result);
- }
- }
- if (isApplyFilter) {
- var isEdit = instance.editData[uniquePropId].isEdit;
- if (isEdit) {
- var propVal = instance.editData[uniquePropId].propVal;
- instance.bindEditFormDetails(uniquePropId, propVal, "");
- var initBindData = {
- isBindData: true,
- propVal: "",
- isEdit: false,
- };
- instance.editData[uniquePropId] = initBindData;
- }
- }
- }
- });
- });
- });
- }
- bindTagGroupHTML(containerId, uniquePropId, result) {
- return __awaiter(this, void 0, void 0, function* () {
- var instance = this;
- for (var i = 0; i < result.length; i++) {
- var data = result[i];
- var tagGroupHtml = '<li class="list-group-item col-sm-12 GroupWiseTags" id="liGroupWiseTags_' + data.TagGroupId + '"><a class="clear" onclick="Unibase.Forms.Controls.Tag.Instance().onClickEventsforGroups(' + data.TagGroupId + ')" href="javascript:" style="text-decoration:underline;color:deepskyblue">' + data.GroupName + '</a><input type="checkbox" id="chkGroupWiseTag_' + data.TagGroupId + '" class="pull-right chkGroupWiseTag" data-taggroupid="' + data.TagGroupId + '"><div class="hidden" draggable="true" id="divTags_' + data.TagGroupId + '"><span id="spnMessage" class=""></span><div class="divCustomFormProperties hidden" id="divCustomForm' + data.TagGroupId + '"></div></div></li>';
- $("#" + containerId).append(tagGroupHtml);
- $("#chkGroupWiseTag_" + data.TagGroupId + "").change(function (res) {
- if ($(this).prop('checked') == false) {
- for (let j = 0; j < $(this).parent().find('select').length; j++) {
- $('#' + $(this).parent().find('select')[j].id).val(null).trigger("change");
- $(this).parent().find('.hfSelectedGroupId').val("");
- }
- for (let k = 0; k < $(this).parent().find("input[type='radio'],input[type='checkbox']").length; k++) {
- $('#' + $(this).parent().find("input[type='radio'],input[type='checkbox']")[k].id).prop('checked', false);
- $(this).parent().find('.hfSelectedGroupId').val("");
- }
- }
- });
- yield instance.bindTagHTML(containerId, uniquePropId, data.TagList, data.TagGroupId);
- }
- });
- }
- bindTagHTML(containerId, uniquePropId, parentTags, TagGId) {
- return __awaiter(this, void 0, void 0, function* () {
- var instance = this;
- var taghtml = '';
- var parentTagsLen = 0;
- if (parentTags != null && parentTags != "" && parentTags != undefined) {
- parentTagsLen = parentTags.length;
- }
- if (parentTagsLen != 0) {
- for (var i = 0; i < parentTagsLen; i++) {
- $("#" + containerId).find("#tagControlEmpty").addClass("hidden");
- var requiredCls = "";
- var spanForReq = "";
- var uniqueId = uniquePropId + '_' + parentTags[i].TagId;
- if (parentTags[i].IsRequired == true) {
- spanForReq = '<span class="text-danger " id="spnIsRequired_' + uniqueId + '"> *</span>';
- requiredCls = 'requiredtagsDiv required';
- }
- var hiddenclass = "hidden";
- if (TagGId == 0)
- hiddenclass = "";
- var html = '<div id="div_' + uniqueId + '" class="GroupWiseTagsDiv form-group floating-label focus divtaggroup_' + parentTags[i].TagGroupId + ' divtagid_' + parentTags[i].TagId + ' divtags divtag_' + TagGId + ' ' + hiddenclass + '"><label id="lblTagParentName_' + uniqueId + '">' + parentTags[i].TagName + '</label> ' + spanForReq + '' +
- '<input type="hidden" data-taggroupid="' + parentTags[i].TagGroupId + '" class="hfSelectedGroupId" id="hfSelectedGroupId_' + uniqueId + '" value="" />' +
- '<input type="hidden" id="hfRootTagId_' + uniqueId + '" value="' + parentTags[i].TagId + '" />' +
- '<input type="hidden" id="hfTagShowType_' + uniqueId + '" value="' + parentTags[i].TagShowTypeId + '" />' +
- '<input type="hidden" id="hfIsMultiple_' + uniqueId + '" value="' + parentTags[i].IsMultiple + '" />' +
- '<div id="bindtags_' + uniqueId + '" class="row floating-label-form-group-with-value bindtags_' + uniqueId + ' ' + requiredCls + '"></div></div>';
- if (TagGId == 0)
- $("#" + containerId).find("#tagControl").append(html);
- else
- $("#" + containerId).find("#liGroupWiseTags_" + TagGId).append(html);
- var tagCategoryId = parentTags[i].TagCategoryId;
- var tagShowType = parentTags[i].TagShowTypeId;
- var tagId = parentTags[i].TagId;
- var tagGroupId = parentTags[i].TagGroupId;
- var isMultiple = parentTags[i].IsMultiple;
- var tagsInfo;
- if (tagShowType == Unibase.Platform.Forms.Enums.TagShowType.Select2) {
- taghtml = '';
- var MaxSize = 0;
- var multiple = "";
- if (isMultiple) {
- MaxSize = 50;
- multiple = "multiple";
- }
- else {
- MaxSize = 1;
- }
- taghtml += '<div class="col-12 col-xl-6 d-flex justify-content-between align-items-center tags-select2-container"><div style="flex-grow:2"><select id="ddlMultiChildTags_single_' + uniqueId + '" class="ddlMultiChildTags_single" ' + multiple + ' style="width:100%" data-maxsize="' + MaxSize + '"></select></div>' +
- '<div class="bg-light border border-left-0 d-flex h-100 justify-content-center align-items-center px-10 rounded-bottom-left-0 rounded-top-left-0" style="border-radius:10px;"><a href="javascript:;" onclick="javascript:return Unibase.Forms.Controls.Tag.Instance().tagSelectionPopup(' + tagId + ',' + isMultiple + ',' + uniquePropId + ',' + tagGroupId + ',\'' + containerId + '\')" ><i class="fa fa-pencil"></i></a></div></div>';
- if (TagGId == 0)
- $("#" + containerId).find("#bindtags_" + uniqueId).html(taghtml);
- else
- $("#" + containerId).find("#liGroupWiseTags_" + TagGId).find("#bindtags_" + uniqueId).html(taghtml);
- instance.loadSelect2ForTags(tagId, uniquePropId, tagCategoryId, tagGroupId, "", "", containerId);
- instance.select2ChangeEvent(uniqueId, TagGId, containerId);
- }
- else if (tagShowType == Unibase.Platform.Forms.Enums.TagShowType.Checkbox) {
- var tagresult = parentTags[i]._children;
- if (tagresult.length > 0) {
- var uniquekey = uniquePropId + '_' + tagresult[0].ParentRootId;
- if (isMultiple) {
- taghtml = '';
- for (var j = 0; j < tagresult.length; j++) {
- if (tagresult[j].ParentId != 0) {
- var selected = '';
- if (tagsInfo != undefined && tagsInfo.length > 0) {
- var id = tagsInfo.find(x => x == tagresult[j].TagId) ? true : false;
- if (id == true) {
- selected = "checked";
- }
- }
- taghtml += '<span class="col-sm-6"><div class="col-sm-12">' +
- '<span class="m-l-xs"><input type="checkbox" data-tagid="' + tagresult[j].TagId + '" class="mr-5 chkselectedTags chkselectedTags_' + tagresult[j].TagId + '" onclick="javascript:return Unibase.Forms.Controls.Tag.Instance().checkEvent(' + tagresult[j].TagId + ',' + "'" + containerId + "'" + ',' + uniquePropId + ',' + tagresult[0].ParentRootId + ',' + TagGId + ')" id="chkIsChecked_' + uniquePropId + '_' + tagresult[j].TagId + '" ' + selected + '>' + tagresult[j].TagName + '</span>' +
- '</div></span>';
- }
- if (j == tagresult.length - 1) {
- if (TagGId == 0)
- $("#" + containerId).find("#bindtags_" + uniquekey).html(taghtml);
- else
- $("#" + containerId).find("#liGroupWiseTags_" + TagGId).find("#bindtags_" + uniquekey).html(taghtml);
- }
- }
- }
- else {
- taghtml = '';
- for (var k = 0; k < tagresult.length; k++) {
- if (tagresult[k].ParentId != 0) {
- var radioSelected = '';
- if (tagsInfo != undefined && tagsInfo.length > 0) {
- var id = tagsInfo.find(x => x == tagresult[k].TagId) ? true : false;
- if (id == true) {
- radioSelected = "checked";
- }
- }
- taghtml += '<div class="col-sm-12">' +
- '<span class="col-sm-6"><input data-tagid="' + tagresult[k].TagId + '" name="parenttag_' + tagresult[k].ParentRootId + '" class="rdBtntag" onclick="javascript:return Unibase.Forms.Controls.Tag.Instance().checkRadioEvent(' + tagresult[k].TagId + ',' + "'" + containerId + "'" + ',' + uniquePropId + ',' + tagresult[0].ParentRootId + ',' + TagGId + ')" id="rdBtntag_' + uniquePropId + '_' + tagresult[k].TagId + '" value="' + tagresult[k].TagId + '" type="radio" name="rdBtnTags" mutiple="false" ' + radioSelected + ' > ' + tagresult[k].TagName + '</span></div>';
- }
- if (k == tagresult.length - 1) {
- if (TagGId == 0)
- $("#" + containerId).find("#bindtags_" + uniquekey).html(taghtml);
- else
- $("#" + containerId).find("#liGroupWiseTags_" + TagGId).find("#bindtags_" + uniquekey).html(taghtml);
- }
- }
- }
- }
- else {
- }
- }
- else {
- }
- }
- }
- else {
- var hiddenclass = "hidden";
- if (TagGId == 0)
- hiddenclass = "";
- var html = '<div id="div_' + uniqueId + '" class="list-group-item GroupWiseTagsDiv form-group floating-label focus divtags divtag_' + TagGId + ' ' + hiddenclass + '"><input type="hidden" data-taggroupid="' + TagGId + '" class="hfSelectedGroupId" id="hfSelectedGroupId_' + uniqueId + '" value="" /><div class="row"><small class="ml-10 text-danger">No tags found...</small></div></div>';
- if (TagGId == 0)
- $("#" + containerId).find("#tagControl").append(html);
- else
- $("#" + containerId).find("#liGroupWiseTags_" + TagGId).append(html);
- }
- });
- }
- loadSelect2ForTags(TagId, UniquePropId, TagCategoryId, TagGroupId, SelectedIds, Parameters, containerid) {
- var instance = this;
- var uniqueId = UniquePropId + '_' + TagId;
- var Select2SelectedValues = [];
- if (SelectedIds != "" && SelectedIds != null) {
- var ColumnName = "0";
- var Value = "0";
- if (Parameters != null && Parameters != "") {
- ColumnName = Parameters.map(function (item) { return item.ColumnName; }).toString();
- Value = Parameters.map(function (item) { return item.Value + "|"; }).toString();
- }
- if (SelectedIds == "-1") {
- Select2SelectedValues.push({ id: "-1", text: "All" });
- }
- else {
- var postData = {
- ColumnName: ColumnName,
- FormPropertyId: 0,
- Value: Value,
- bindedData: 0,
- authToken: 0,
- term: 0,
- SelectedIds: SelectedIds,
- };
- Unibase.Platform.Forms.Managers.TagManager.Instance().getSelectedTags(SelectedIds).then(function (response) {
- var result = response.result;
- if (result.length != 0) {
- for (var i = 0; i < result.length; i++) {
- Select2SelectedValues.push({ id: result[i].TagId, text: result[i].TagName });
- }
- }
- });
- }
- }
- if (Select2SelectedValues.length > 0) {
- var Ids = [];
- for (var i = 0; i < Select2SelectedValues.length; i++) {
- if (Select2SelectedValues[i].id != 0) {
- Ids.push(Select2SelectedValues[i].id);
- }
- Ids.push(Select2SelectedValues[i].id);
- }
- }
- var ColumnName = "0";
- var Value = "0";
- if (Parameters != null && Parameters != "") {
- ColumnName = Parameters.map(function (item) { return item.ColumnName; }).toString();
- Value = Parameters.map(function (item) { return item.Value + "|"; }).toString();
- }
- postData = null;
- $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).empty();
- instance.bindSelect2Tags(containerid, Select2SelectedValues, Ids, uniqueId, TagGroupId, TagCategoryId, TagId, ColumnName, Value);
- }
- bindSelect2Tags(containerid, Select2SelectedValues, Ids, uniqueId, TagGroupId, TagCategoryId, TagId, ColumnName, Value) {
- var istagselect = false;
- if ($("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).data("istagselect") == "true") {
- istagselect = true;
- }
- var postData = null;
- var userinfo = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
- var sessionid = userinfo.sessionId;
- $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).select2({
- placeholder: "Select",
- tags: istagselect,
- allowClear: true,
- theme: "default select2ErrorClass",
- data: Select2SelectedValues,
- ajax: {
- url: function (request) {
- var reqUrl = _appsettings.server_url() + "/apis/v4/unibase/platform/forms/autotagsforassignment";
- return reqUrl;
- },
- type: "POST",
- contentType: 'application/json',
- dataType: 'json',
- data: function (params) {
- var ParticipantsCount = 0;
- var p = $("#" + containerid).find("#ddlMultiChildTags_single_" + uniqueId).val();
- var Participant = (p == null) ? "" : p.toString();
- ParticipantsCount = Participant.replace(/,/g, "|");
- if (ParticipantsCount == "") {
- ParticipantsCount = "0";
- }
- var Term = params.term;
- sessionid = sessionid.replace('#', '');
- postData = {
- TagGroupId: TagGroupId,
- TagCatagoryId: TagCategoryId,
- TagId: TagId,
- ColumnName: ColumnName,
- FormPropertyId: 0,
- Value: Value,
- bindedData: ParticipantsCount,
- authToken: sessionid,
- term: Term,
- };
- return JSON.stringify(postData);
- },
- beforeSend: function (xhr) {
- if (userinfo !== undefined && userinfo !== null) {
- xhr.setRequestHeader("Authorization", "Basic " + userinfo.sessionId);
- xhr.setRequestHeader('geoposition', userinfo.latd + ':' + userinfo.lgId);
- }
- },
- processResults: function (data) {
- return {
- results: jQuery.map(JSON.parse(data.result), function (item) {
- return {
- id: item.Value,
- text: item.SelectText,
- addlInfo: item.addlData
- };
- })
- };
- },
- },
- escapeMarkup: function (m) {
- return m;
- },
- templateResult: formatRepo,
- templateSelection: formatRepoSelection,
- });
- var newText = [];
- function formatRepo(repo) {
- if (repo.loading) {
- return repo.text;
- }
- var markup = "";
- if (repo.text.includes('|')) {
- newText = repo.text.split('|');
- markup =
- "<div class='select2-result-repository__meta'>" +
- "<div class='select2-result-repository__title'><strong>" + newText[0] + "</strong></div>";
- markup += "<div class='select2-result-repository__statistics'>" +
- "<div class='select2-result-repository__forks'><i class='fa fa-envelope'></i> " + newText[1] + "</div>" +
- "</div>" +
- "</div></div>";
- }
- else {
- markup =
- "<div class='select2-result-repository__meta'>" +
- "<div class='select2-result-repository__title'>" + repo.text + "</div>";
- }
- return markup;
- }
- function formatRepoSelection(repo) {
- if (repo.id != 0) {
- newText = repo.text.split('|');
- return newText[0];
- }
- if (repo.id === '') {
- return 'Select';
- }
- }
- $("#ddlMultiChildTags_single_" + uniqueId).css("border-color", "rgb(255, 255, 255)");
- jQuery("#ddlMultiChildTags_single_" + uniqueId).val(Ids).trigger('change');
- $('.select2-search__field').css('width', '100%');
- }
- tagSelectionPopup(tagId, IsMultiple, UniquePropId, tagGroupId, containerId) {
- var instance = this;
- instance.fileCacheHelper.loadJsFile('platform/tag/component/tagselection.js', function () {
- Unibase.Platform.Forms.Components.TagSelection.Instance().loadTagSelectionForm(tagId, IsMultiple, UniquePropId, tagGroupId, containerId);
- });
- }
- select2ChangeEvent(uniqueId, taggroupid, containerid) {
- var instance = this;
- $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).on('select2:select', function (e) {
- var selectedValues = $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).val();
- if (selectedValues != null) {
- selectedValues = selectedValues.toString();
- }
- $("#" + containerid).find("#hfSelectedGroupId_" + uniqueId).val(selectedValues);
- if (instance.isGroupWiseTag) {
- instance.refreshChkGroupWiseTags(taggroupid, true);
- }
- });
- $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).on('select2:unselect', function (e) {
- var selectedValues = $("#" + containerid).find('#ddlMultiChildTags_single_' + uniqueId).val();
- if (selectedValues != null) {
- selectedValues = selectedValues.toString();
- }
- $("#" + containerid).find("#hfSelectedGroupId_" + uniqueId).val(selectedValues);
- if (instance.isGroupWiseTag) {
- instance.refreshChkGroupWiseTags(taggroupid, false);
- }
- });
- }
- checkEvent(tagId, containerId, UniquePropId, rootTagId, tagGroupId) {
- var instance = this;
- var uniqueKey = UniquePropId + '_' + rootTagId;
- var selectedValues = $("#" + containerId).find("#hfSelectedGroupId_" + uniqueKey).val();
- if ($("#" + containerId).find("#chkIsChecked_" + UniquePropId + '_' + tagId).is(':checked')) {
- if (selectedValues == undefined || selectedValues == "")
- selectedValues = tagId.toString();
- else
- selectedValues += "," + tagId;
- if (instance.isGroupWiseTag) {
- if (selectedValues == undefined || selectedValues == "")
- $("#chkGroupWiseTag_" + tagGroupId).prop("checked", false);
- else
- $("#chkGroupWiseTag_" + tagGroupId).prop("checked", true);
- }
- }
- else {
- var array = selectedValues.toString().split(",");
- var index = array.findIndex(x => x == tagId);
- array.splice(index, 1);
- selectedValues = array.toString();
- if (instance.isGroupWiseTag) {
- if (!selectedValues && !$(`#liGroupWiseTags_${tagGroupId} .chkselectedTags:checked`).length)
- $("#chkGroupWiseTag_" + tagGroupId).prop("checked", false);
- else
- $("#chkGroupWiseTag_" + tagGroupId).prop("checked", true);
- }
- }
- $("#" + containerId).find("#hfSelectedGroupId_" + uniqueKey).val(selectedValues);
- }
- checkRadioEvent(tagId, containerId, UniquePropId, rootTagId, tagGroupId) {
- var instance = this;
- var uniqueKey = UniquePropId + '_' + rootTagId;
- if ($("#" + containerId).find("#rdBtntag_" + UniquePropId + '_' + tagId).is(':checked')) {
- $("#" + containerId).find("#hfSelectedGroupId_" + uniqueKey).val(tagId.toString());
- if (instance.isGroupWiseTag) {
- instance.refreshChkGroupWiseTags(tagGroupId, true);
- }
- }
- else {
- $("#" + containerId).find("#hfSelectedGroupId_" + uniqueKey).val("");
- if (instance.isGroupWiseTag) {
- instance.refreshChkGroupWiseTags(tagGroupId, false);
- }
- }
- }
- onClickEventsforGroups(tagGroupId) {
- var HiddenStatus = $('.divtag_' + tagGroupId).hasClass("hidden");
- if (HiddenStatus) {
- $('.divtag_' + tagGroupId).removeClass("hidden");
- }
- else {
- $('.divtag_' + tagGroupId).addClass("hidden");
- }
- }
- refreshChkGroupWiseTags(TagGroupId, IsInclude) {
- var instance = this;
- var IsValue = instance.findValue(TagGroupId);
- if (TagGroupId != undefined && TagGroupId != "") {
- if (IsInclude == true && IsValue == true) {
- $("#chkGroupWiseTag_" + TagGroupId).prop("checked", true);
- }
- else if (IsInclude == true && IsValue == false) {
- $("#chkGroupWiseTag_" + TagGroupId).prop("checked", false);
- }
- else if (IsInclude == false && IsValue == true) {
- $("#chkGroupWiseTag_" + TagGroupId).prop("checked", true);
- }
- else if (IsInclude == false && IsValue == false) {
- $("#chkGroupWiseTag_" + TagGroupId).prop("checked", false);
- }
- }
- }
- findValue(TagGroupId) {
- var IsValue = false;
- $("#liGroupWiseTags_" + TagGroupId).find(".hfSelectedGroupId").each(function () {
- var tagIds = $(this).val().toString().split(',');
- if (tagIds.length > 1) {
- IsValue = true;
- return false;
- }
- if (tagIds[0] != "") {
- IsValue = true;
- return false;
- }
- });
- return IsValue;
- }
- tagItemObj() {
- var instance = this;
- var tagItemArray = new Array();
- var groupWiseTagArray = new Array();
- if (instance.isGroupWiseTag) {
- $(".GroupWiseTags").each(function () {
- var tagItemArray = new Array();
- var isTagGroup = $(this).find('.chkGroupWiseTag').prop('checked');
- if (isTagGroup) {
- $(".GroupWiseTagsDiv").each(function () {
- var selectedGroupIds = $(this).find(".hfSelectedGroupId").val();
- if (selectedGroupIds != undefined && selectedGroupIds != "") {
- var tagIds = selectedGroupIds.toString().split(',');
- for (var i = 0; i < tagIds.length; i++) {
- if (Number(tagIds[i]) != 0) {
- tagItemArray.push({
- TagItemId: 0,
- TagId: Number(tagIds[i]),
- });
- }
- }
- }
- });
- groupWiseTagArray.push({
- TagItemId: 0,
- TagGroupId: Number($(this).find('.chkGroupWiseTag').data("taggroupid")),
- TagItems: tagItemArray,
- });
- }
- });
- }
- else {
- $(".GroupWiseTagsDiv").each(function () {
- var tagItemArray = new Array();
- var selectedGroupIds = $(this).find(".hfSelectedGroupId").val();
- if (selectedGroupIds != undefined && selectedGroupIds != "") {
- var tagIds = selectedGroupIds.toString().split(',');
- if (tagIds[0] != "" && tagIds.length > 0) {
- for (var i = 0; i < tagIds.length; i++) {
- if (Number(tagIds[i]) != 0) {
- tagItemArray.push({
- TagItemId: 0,
- TagId: Number(tagIds[i]),
- });
- }
- }
- }
- if (tagItemArray.length > 0) {
- groupWiseTagArray.push({
- TagItemId: 0,
- TagGroupId: Number($(this).find(".hfSelectedGroupId").data("taggroupid")),
- TagItems: tagItemArray,
- });
- }
- }
- });
- }
- var checkrequired = true;
- if (instance.isGroupWiseTag) {
- $(".GroupWiseTagsDiv").addClass("hidden");
- $(".requiredtagsDiv").closest(".GroupWiseTagsDiv").each(function (e) {
- var isGroupChecked = $(this).closest(".GroupWiseTags").find(".chkGroupWiseTag").prop("checked");
- var value = $(this).find(".hfSelectedGroupId").val();
- if (value == "" && isGroupChecked) {
- $(this).find('.select2-selection').addClass("form-group-required");
- checkrequired = false;
- if (instance.isGroupWiseTag) {
- $(this).removeClass("hidden");
- }
- }
- });
- }
- else {
- $(".requiredtagsDiv").closest(".GroupWiseTagsDiv").each(function (e) {
- var value = $(this).find(".hfSelectedGroupId").val();
- if (value == "") {
- $(this).find('.select2-selection').addClass("form-group-required");
- checkrequired = false;
- if (instance.isGroupWiseTag) {
- $(this).removeClass("hidden");
- }
- }
- });
- }
- if (checkrequired == false) {
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Mandatory fields are missing");
- return false;
- }
- else {
- return groupWiseTagArray;
- }
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new Tag();
- }
- return this.instance;
- }
- }
- Controls.Tag = Tag;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Unibase;
- (function (Unibase) {
- let Forms;
- (function (Forms) {
- let Controls;
- (function (Controls) {
- class TimePicker {
- init(formpropertyid, prop, callback) {
- var instance = TimePicker.Instance();
- instance.loadControlSettings(prop.ControlJsonText, prop.FormPropertyId);
- instance.loadPropertySettings(prop.PropertySettings, prop.FormPropertyId);
- var formid = $("#time_" + prop.DocPropertyName).parents('.formValidate').attr('id');
- var errormsg = $("#" + formid).find('.bizgaze_FormErrorMessages').attr('id');
- if (callback != null)
- callback();
- }
- loadControl(containerid, prop) {
- var regExpr = "";
- var ErrMsg = "";
- var validationlist = prop.Validations;
- if (validationlist != null) {
- for (var i = 0; i < validationlist.length; i++) {
- regExpr += validationlist[i].RegularExp + '||';
- ErrMsg += validationlist[i].ErrorMessage + '||';
- }
- }
- var Isrequired = prop.IsRequired != true ? 'hidden' : '';
- var requiredClass = prop.IsRequired != true ? '' : 'required';
- var reqMark = prop.IsRequired != true ? '' : '*';
- var CurrentStageId = $("#hf_" + $("#hfLayout_InstalledPageId").val() + "_StageId").val();
- if (prop.IncludedStages != null && prop.IncludedStages != "") {
- var StagesForRequired = prop.IncludedStages.split('|');
- Isrequired = StagesForRequired.find(x => x == CurrentStageId) ? '' : 'hidden';
- requiredClass = StagesForRequired.find(x => x == CurrentStageId) ? 'required' : '';
- reqMark = StagesForRequired.find(x => x == CurrentStageId) ? '*' : '';
- }
- if (prop.ExcludedStages != null && prop.ExcludedStages != "") {
- var ExcludedStages = prop.ExcludedStages.split('|');
- Isrequired = ExcludedStages.find(x => x == CurrentStageId) ? 'hidden' : '';
- requiredClass = ExcludedStages.find(x => x == CurrentStageId) ? '' : 'required';
- reqMark = ExcludedStages.find(x => x == CurrentStageId) ? '' : '*';
- }
- let ControlId = 'txt_' + prop.DocPropertyId;
- if (prop.IsRequired)
- requiredClass = 'required';
- const { helpTooltipHtml, helpTextHtml } = Unibase.Platform.Forms.Components.FormViewer.Instance().getControlHelpHtml(prop);
- let html = '<div class="floating-label-form-group floating-label-form-group-with-value">' +
- '<label for="lbl" id="lbl_' + prop.ControlId + '">' + helpTooltipHtml + '<span class="label-name">' + prop.LabelName + '</span><span class="text-danger ' + Isrequired + '" id="spnIsRequired_' + prop.DocPropertyId + '"> *</span></label>' +
- '<div class="input-group">' +
- '<input type="time" id = "time_' + prop.DocPropertyName + '" class="type-control form-control value-control ' + requiredClass + '" data - propdoctypename="${prop.DocTypeName}" data-regularexp="' + regExpr + '" data - validatemsg="' + ErrMsg + '" placeholder = "' + prop.Placeholder + '" data-placeholder="' + prop.Placeholder + '" data-label="' + prop.LabelName + reqMark + '" /> ' +
- '<input type="hidden" id="hfId" value=""><label for="Validation" id="lblValidation_"' + prop.DocPropertyName + '"></label><input type="hidden" id="hfFormPropertyId" value="" /></div>' + helpTextHtml + '</div>';
- $("#" + containerid).append(html);
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return null;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- return null;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- var time = propval.split(" ");
- let timeVal = time[1];
- let meridiem = time[2];
- if (typeof meridiem != "undefined") {
- let [hours, minutes] = timeVal.split(':');
- let formattedTime = "";
- if (meridiem == 'PM') {
- if (hours === '12') {
- hours = '00';
- }
- hours = parseInt(hours, 10) + 12;
- formattedTime = `${hours}:${minutes}`;
- time[1] = formattedTime;
- }
- else if (hours.length == 1) {
- hours = "0" + hours;
- formattedTime = `${hours}:${minutes}`;
- time[1] = formattedTime;
- }
- }
- $("#time_" + DocPropertyName).val(time[1]);
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new TimePicker();
- }
- return this.instance;
- }
- }
- Controls.TimePicker = TimePicker;
- })(Controls = Forms.Controls || (Forms.Controls = {}));
- })(Forms = Unibase.Forms || (Unibase.Forms = {}));
- })(Unibase || (Unibase = {}));
-
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class Wallet extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var instance = this;
- instance.flag = 0;
- instance.isWalletLoading = false;
- var jsfiles = ['apps/transact/managers/payments/paymentmanager.js', 'platform/core/helpers/numberhelper/numberhelper.js', 'apps/transact/controls/payments/paymentsummary.components.js'];
- instance.fileCacheHelper.loadJsFiles(jsfiles, function () {
- });
- }
- loadControl(containerid, prop) {
- var instance = this;
- instance.transactionId = prop.FormPropertyId;
- var html = '<div class="col-sm-12 transactonList_div transactonList_div_TRN' + prop.FormPropertyId + ' p-0"><div class="transactonList_item transactonList_item_TRN' + prop.FormPropertyId + '" name="' + prop.FormPropertyId + '"><div id="walletControl_transactonListDiv" class="col-sm-12 transactonList_div transactonList_div_TRN2 p-0"><div class="row rowWallets" id="walletControlList"><div class="col-sm-3 mt-20 text-ul"><u><a href="javascript:;" class="h6" onclick="Bizgaze.Apps.Transact.Controls.Wallet.Instance().toggleWallets(\'TRN' + prop.FormPropertyId + '\');" >Wallet : <span class="txtWalletsTotalAmt">0.00</span></a></u></div>' +
- '<div class="col-sm-3"></div><div class="d-none d-sm-block col-sm-2 text-right m-r-n"><div class="mt-30"><label class="h6">Adjusted : </label></div></div><div class="block d-sm-none col-sm-2 m-r-n"><div class="mt-30"><label class="h6">Adjusted : </label></div></div><div class="col-sm-4"><div class="floating-label-form-group mt-15"><input data-trnid="TRN' + prop.FormPropertyId + '" id="txtIdTotalWalletAdjusted_TRN' + prop.FormPropertyId + '" class="form-control txtTotalWalletAdjusted txtTotalWalletAdjusted_TRN' + prop.FormPropertyId + ' floating-label-control m-b-n" type="text" onkeypress="return Bizgaze.Apps.Transact.Controls.Wallet.Instance().isDecimalplusNoLongPress(event,this.id);" onkeyup="Bizgaze.Apps.Transact.Controls.Wallet.Instance().totalWalletAdjustment(event,this);"/></div></div></div>' +
- '<input type="hidden" id="hdn_walletcontrol" class="value-control" value="Bizgaze.Apps.Transact.Controls.Wallet.Instance().walletControlObj(\'TRN' + prop.FormPropertyId + '\');"/>' +
- '<section class="mt-5 secWallets secWallets_TRN' + prop.FormPropertyId + ' hidden"><div class="list-group divWallet_List"></div></section></div><input type="hidden" class="hf_AdvanceJournalAllocId" id="hf_AdvanceJournalAllocId_TRN' + instance.transactionId + '" value="">';
- $("#" + containerid).html(html);
- if (prop.PropertySettings != null) {
- for (var i = 0; i < prop.PropertySettings.length; i++) {
- var data = prop.PropertySettings[i];
- if (data.ControlPropertyName == "ControlType" && data.ControlPropertyValue != "") {
- this.controlType = data.ControlPropertyValue;
- }
- }
- }
- if (this.controlType == "1") {
- instance.journalTypeId = 2;
- }
- else if (this.controlType == "2") {
- instance.journalTypeId = 1;
- }
- else if (this.controlType == "3") {
- instance.journalTypeId = 3;
- }
- }
- loadInvoiceWallets(response) {
- var instance = this;
- var trnId = instance.transactionId;
- var result = response;
- var element = $('.transactonList_item_TRN' + trnId + '');
- var divWallets = element.find('.divWallet_List');
- $(divWallets).empty();
- $(divWallets).html('<div class="list-group-item m-b-n divWallet_List_item hidden"></div>');
- var walletsTotalBal = 0;
- var adjustdTotalAmount = 0;
- if (result.length != 0) {
- for (var i = 0; i < result.length; i++) {
- var item = result[i];
- walletsTotalBal += Number(item.TotalAmount - item.CurrentAmount);
- adjustdTotalAmount += Number(item.CurrentAmount);
- function datediff(date2, today) {
- today = new Date(today.split('/')[2], today.split('/')[1] - 1, today.split('/')[0]);
- date2 = new Date(date2.split('/')[2], date2.split('/')[1] - 1, date2.split('/')[0]);
- var timeDiff = Math.abs(today.getTime() - date2.getTime());
- var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
- return diffDays;
- }
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth() + 1;
- var yyyy = today.getFullYear();
- if (dd < 10) {
- dd = '0' + dd;
- }
- if (mm < 10) {
- mm = '0' + mm;
- }
- today = dd + '/' + mm + '/' + yyyy;
- var wBalance = Number(item.TotalAmount);
- var NumOfDays = datediff(Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(item.JournalDate, null), today);
- instance.bindWalletsHtml(item, wBalance, NumOfDays, item.CurrentAmount, trnId);
- }
- }
- if (walletsTotalBal > 0)
- element.find('.txtWalletsTotalAmt').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(walletsTotalBal, 2));
- else
- element.find('.txtWalletsTotalAmt').text("0.00");
- if (adjustdTotalAmount > 0)
- element.find('.txtTotalWalletAdjusted').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(adjustdTotalAmount, 2));
- else
- element.find('.txtTotalWalletAdjusted').val("0.00");
- }
- loadPaymentWallets(contactId) {
- var instance = this;
- if (contactId != null && contactId != 0 && contactId != undefined) {
- var instance = this;
- var trnId = instance.transactionId;
- var paymentid = 0;
- if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var hiddenFieldPaymentId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_paymentid");
- if (hiddenFieldPaymentId != null || hiddenFieldPaymentId != undefined) {
- paymentid = Number(hiddenFieldPaymentId.Value);
- }
- }
- var lobid = Number($(".txtAutoComplete_lobid").val());
- if (isNaN(lobid)) {
- lobid = 0;
- }
- var date = "";
- var userDate = $(".date_journaldate").val();
- if (userDate != undefined && userDate != null && userDate != "") {
- var formattedUserDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(userDate);
- date = moment(formattedUserDate).format("YYYY-MM-DD");
- }
- else {
- var curDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- date = moment(curDate).format("YYYY-MM-DD");
- }
- var adjustedTotal = 0;
- instance.isWalletLoading = true;
- instance.navigationHelper.showLoading();
- var element = $('.transactonList_item_TRN' + trnId + '');
- Bizgaze.Apps.Transact.Managers.PaymentManager.Instance().getPendings(Number(contactId), paymentid, null, instance.journalTypeId, lobid, date, "Wallets").then(function (response) {
- var result = response.result;
- var divWallets = element.find('.divWallet_List');
- $(divWallets).empty();
- $(divWallets).html('<div class="list-group-item m-b-n divWallet_List_item hidden"></div>');
- var walletsTotalBal = 0;
- if (result.length != 0) {
- for (var i = 0; i < result.length; i++) {
- var item = result[i];
- adjustedTotal += item.Amount;
- walletsTotalBal += Number(item.JournalAlloc.TotalAmount - item.JournalAlloc.AdjustedAmount);
- function datediff(date2, today) {
- today = new Date(today.split('/')[2], today.split('/')[1] - 1, today.split('/')[0]);
- date2 = new Date(date2.split('/')[2], date2.split('/')[1] - 1, date2.split('/')[0]);
- var timeDiff = Math.abs(today.getTime() - date2.getTime());
- var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
- return diffDays;
- }
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth() + 1;
- var yyyy = today.getFullYear();
- if (dd < 10) {
- dd = '0' + dd;
- }
- if (mm < 10) {
- mm = '0' + mm;
- }
- today = dd + '/' + mm + '/' + yyyy;
- var wBalance = Number(item.JournalAlloc.TotalAmount - item.JournalAlloc.AdjustedAmount);
- var NumOfDays = datediff(Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(item.JournalAlloc.JournalDate, null), today);
- instance.bindWalletsHtml(item.JournalAlloc, wBalance, NumOfDays, item.Amount, trnId);
- }
- }
- if (walletsTotalBal > 0)
- element.find('.txtWalletsTotalAmt').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(walletsTotalBal, 2));
- else
- element.find('.txtWalletsTotalAmt').text("0.00");
- }).then(function () {
- $(".txtTotalWalletAdjusted").val(adjustedTotal);
- element.find('.secWallets_' + trnId + '').addClass('hidden');
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- instance.isWalletLoading = false;
- var isDueLoading = Bizgaze.Apps.Transact.Controls.Dues.Instance().isDueLoading;
- if (instance.isWalletLoading == false && isDueLoading == false) {
- instance.navigationHelper.hideLoading();
- }
- });
- }
- }
- toggleWallets(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- element.find('.secWallets_' + trnId + '').toggleClass('hidden');
- }
- isDecimal(evt, id) {
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode == 46) {
- var val = document.getElementById(id);
- var txt = val.value;
- if (!(txt.indexOf(".") > -1)) {
- return true;
- }
- }
- if (charCode > 31 && (charCode < 48 || charCode > 57))
- return false;
- return true;
- }
- isDecimalplusNoLongPress(evt, id) {
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46)
- return false;
- else {
- var val = document.getElementById(id);
- var len = val.value.length;
- var index = val.value.indexOf('.');
- if (index > 0 && charCode == 46) {
- return false;
- }
- if (index > 0) {
- var CharAfterdot = (len + 1) - index;
- if (CharAfterdot > 3) {
- return false;
- }
- }
- }
- return true;
- }
- initFlag() {
- var instance = this;
- instance.flag = 0;
- }
- bindWalletsHtml(journalAlloc, wBalance, NumOfDays, Amount, formPropId) {
- var instance = this;
- var html = '<div class="list-group-item divWallet_Item" id="divWallet_List_item_' + journalAlloc.JournalId + '"><div class="row">' +
- '<input type="hidden" class="hf_JournalAllocId" value="' + journalAlloc.JournalAllocId + '" />' +
- '<input type="hidden" class="hf_RefAllocId" value="' + journalAlloc.RefAllocId + '" />' +
- '<input type="hidden" class="hf_JournalId" value="' + journalAlloc.JournalId + '" />' +
- '<input type="hidden" class="hf_AdjustedAmount" value="' + journalAlloc.AdjustedAmount + '" />' +
- '<div class="col-sm-4"><div class="floating-label-form-group m-b floating-label-form-group-with-value h-100 py-1 card m-0 p-0 border-0 shadow-none" style="border:0px"><div class="h6 h-100 card-header align-items-center d-flex p-0">' + journalAlloc.JournalNo + ' (' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(wBalance, 2) + ')</div><input class="form-control value-control text-dark" disabled type="text" value="' + Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(journalAlloc.JournalDate, null) + ' (' + NumOfDays + ' days)"></div></div>' +
- '<div class="col-sm-4"><div class="floating-label-form-group m-b floating-label-form-group-with-value py-1 card h-100 m-0 p-0 border-0 shadow-none" style="border:0px"><div class="h6 h-100 card-header align-items-center d-flex p-0">Remaining Amt</div><input class="hfWalletAmount" type="hidden" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(wBalance, 2) + '" /><input id="lblWalletRemaing_' + journalAlloc.JournalId + '" class="form-control value-control lblWalletRemaing text-dark" disabled type="text" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(wBalance - Amount, 2) + '"></div></div>' +
- '<div class="col-sm-4"><div class="floating-label-form-group m-b py-1 card h-100 m-0 p-0 border-0 shadow-none"><div class="h6 card-header align-items-center d-flex p-0 h-100">Adjusted Amt</div><input id="txtWalletCurrentAmount_' + journalAlloc.JournalId + '" type="text" value="' + Amount + '" class="form-control txtWalletCurrentAmount floating-label-control value-control" placeholder="Amount" data-label="Amount" onkeypress="return Bizgaze.Apps.Transact.Controls.Wallet.Instance().isDecimalplusNoLongPress(event,this.id)" onkeyup="Bizgaze.Apps.Transact.Controls.Wallet.Instance().AdjustWalletAmount(\'' + journalAlloc.JournalId + '\',\'' + "TRN" + formPropId + '\',event);" /></div></div>' +
- '</div></div>';
- var element = $('.transactonList_item_TRN' + formPropId + '');
- element.find('.divWallet_List_item').before(html);
- }
- bindWalletEvents() {
- }
- totalWalletAdjustment(evt, curElement) {
- var instance = this;
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode == 190 || charCode == 110 || charCode == 46) {
- return true;
- }
- var errormsg = $(".bizgaze_FormErrorMessages:visible").attr("id");
- instance.initFlag();
- if (instance.controlType != "3") {
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().loadPaymentSummary();
- }
- var trnId = curElement.dataset.trnid;
- var element = $('.transactonList_item_' + trnId + '');
- var curAdjAmt = Number(element.find('.txtTotalWalletAdjusted').val());
- var totWalletAmt = Number(element.find('.txtWalletsTotalAmt').text());
- if (curAdjAmt > totWalletAmt) {
- var totWalletAmt = Number(element.find('.txtWalletsTotalAmt').text());
- element.find('.txtTotalWalletAdjusted_' + trnId).val(totWalletAmt);
- MessageHelper.Instance().showError("Cannot adjust more than your wallets", errormsg);
- }
- instance.updatePayment(trnId);
- }
- walletsTotal(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var amount = 0;
- var wTotals = element.find('.txtTotalWalletAdjusted').val();
- wTotals = Number(wTotals);
- if (wTotals > 0)
- amount += wTotals;
- return amount;
- }
- updatePayment(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var walletsTotal = instance.walletsTotal(trnId);
- if (Number(walletsTotal) != 0) {
- element.find('.txtTotalWalletAdjusted').val(walletsTotal);
- $(element).find('.divWallet_Item').each(function (index) {
- var wAmount = Number($(this).find('.hfWalletAmount').val());
- var wCurrentAmt = 0;
- if (walletsTotal >= wAmount) {
- if (wAmount != 0) {
- walletsTotal -= wAmount;
- wCurrentAmt = wAmount;
- wAmount = 0;
- }
- }
- else {
- wAmount -= walletsTotal;
- wCurrentAmt = walletsTotal;
- walletsTotal = 0;
- }
- $(this).find('.txtWalletCurrentAmount').val(wCurrentAmt);
- $(this).find('.lblWalletRemaing').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(wAmount, 2));
- });
- }
- else if (Number(walletsTotal) == 0) {
- element.find('.txtTotalWalletAdjusted').val(walletsTotal);
- element.find('.txtWalletCurrentAmount').val(walletsTotal);
- $('.divWallet_Item').each(function () {
- $(this).find(".lblWalletRemaing").val($(this).find(".hfWalletAmount").val());
- });
- }
- }
- AdjustWalletAmount(jId, trnId, evt) {
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode == 190 || charCode == 110 || charCode == 46) {
- return true;
- }
- var instance = this;
- instance.flag = 0;
- var formId = $(".transactonList_div_" + trnId).parents("form").attr("id").split('_')[1];
- var x = document.getElementById("divWallet_List_item_" + jId).parentElement.parentElement.getAttribute("class");
- var elementforPayment = $('.transactonList_item_' + trnId + '');
- var totAdjustment = $(elementforPayment).find('.txtTotalWalletAdjusted_' + trnId + '').val();
- var totWallet = 0;
- var totWalletAmt = Number(elementforPayment.find('.txtWalletsTotalAmt').text());
- $(elementforPayment).find('.divWallet_Item').each(function () {
- var xyz = Number($(this).find('.txtWalletCurrentAmount').val());
- if (!isNaN(xyz))
- totWallet += xyz;
- });
- var element = elementforPayment.find('#divWallet_List_item_' + jId + '');
- var Amt = $("#hf_TotalCreditAmount").val();
- if (instance.controlType == "3")
- Amt = totWallet;
- if (totWallet <= totWalletAmt) {
- var OrgwalletAmount = Number($(element).find('.hfWalletAmount').val());
- var txtWalletCurrentAmount = 0;
- txtWalletCurrentAmount = Number($(element).find('.txtWalletCurrentAmount').val());
- if (txtWalletCurrentAmount == 0 || txtWalletCurrentAmount == undefined) {
- $(element).find('.txtWalletCurrentAmount').val(0.00);
- $(element).find('.lblWalletRemaing').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(OrgwalletAmount, 2));
- var ttWallet = 0;
- $(elementforPayment).find('.divWallet_Item').each(function () {
- var pqr = Number($(this).find('.txtWalletCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalWalletAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- return false;
- }
- if (txtWalletCurrentAmount > OrgwalletAmount) {
- $(element).find('.txtWalletCurrentAmount').val(OrgwalletAmount);
- $(element).find('.lblWalletRemaing').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- }
- else {
- var walletAmount = OrgwalletAmount - txtWalletCurrentAmount;
- $(element).find('.txtWalletCurrentAmount').val(txtWalletCurrentAmount);
- $(element).find('.lblWalletRemaing').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(walletAmount, 2));
- }
- var ttWallet = 0;
- $(elementforPayment).find('.divWallet_Item').each(function () {
- var pqr = Number($(this).find('.txtWalletCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalWalletAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- }
- else {
- MessageHelper.Instance().showError("You don't have enough amount in that wallets", 'div_ErrorMessage_' + formId);
- $(element).find('.txtWalletCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(Number($(element).find('.hfWalletAmount').val()), 2));
- $(element).find('.lblWalletRemaing').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- var ttWallet = 0;
- $(elementforPayment).find('.divWallet_Item').each(function () {
- var pqr = Number($(this).find('.txtWalletCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalWalletAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- }
- if (instance.controlType != "3") {
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- Bizgaze.Apps.Transact.Controls.Dues.Instance().clearDues();
- }
- }
- walletControlObj(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var data = new Array();
- element.find('.divWallet_Item').each(function (index) {
- if ($(this).find('.txtWalletCurrentAmount').val() != 0 && $(this).find('.txtWalletCurrentAmount').val() != '' && $(this).find('.txtWalletCurrentAmount').val() != undefined) {
- var jAId = Number($(this).find('.hf_JournalAllocId').val());
- if (instance.journalTypeId == 1) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- Debit: Number($(this).find('.txtWalletCurrentAmount').val()),
- RefAllocId: Number($(this).find('.hf_RefAllocId').val()),
- AllocType: 2,
- AllocTypeId: 2
- });
- }
- else if (instance.journalTypeId == 2) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- Credit: Number($(this).find('.txtWalletCurrentAmount').val()),
- RefAllocId: Number($(this).find('.hf_RefAllocId').val()),
- AllocType: 2,
- AllocTypeId: 2
- });
- }
- else if (instance.controlType == "3") {
- let Notes = "";
- let Debit = 0;
- let Credit = 0;
- if ($(".hdn_invoicetypeid").val() == "1") {
- Notes = "Adjustment SalesReturn against " + $(".hdn_tempjournalno").val();
- Debit = Number($(this).find('.txtWalletCurrentAmount').val());
- }
- else {
- Notes = " Adjustment PurchaseReturn against " + $(".hdn_tempjournalno").val();
- Credit = Number($(this).find('.txtWalletCurrentAmount').val());
- }
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- RefAllocId: Number($(this).find('.hf_RefAllocId').val()),
- JournalId: Number($(this).find(".hf_JournalId").val()),
- AdjustedAmount: Number($(this).find('.hf_AdjustedAmount').val()),
- TotalAmount: Number($(this).find(".txtWalletsTotalAmt").text()),
- IsWallet: true,
- CurrentAmount: Number($(this).find('.txtWalletCurrentAmount').val()),
- AllocType: 2,
- Discount: 0,
- RefNo: "",
- Credit: Credit,
- Debit: Debit
- });
- }
- }
- });
- if (Number($(".totAdvance").first().text()) > 0) {
- var jAId = Number($(this).find('.hf_AdvanceJournalAllocId').val());
- if (instance.journalTypeId == 1) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- LedgerId: Number($(".txtAutoComplete_contactid option:selected").val()),
- Credit: Number($(".totAdvance").first().text()),
- RefAllocId: 0,
- AllocType: 3,
- AllocTypeId: 3,
- });
- }
- else if (instance.journalTypeId == 2) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- LedgerId: Number($(".txtAutoComplete_contactid option:selected").val()),
- Debit: Number($(".totAdvance").first().text()),
- RefAllocId: 0,
- AllocType: 3,
- AllocTypeId: 3,
- });
- }
- }
- return data;
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return ``;
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- return ``;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- return ``;
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new Wallet();
- }
- return this.instance;
- }
- }
- Controls.Wallet = Wallet;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
-
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class Dues extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var instance = this;
- instance.flag = 0;
- instance.isDueLoading = false;
- var jsfiles = ['apps/transact/managers/payments/paymentmanager.js', 'platform/core/helpers/numberhelper/numberhelper.js'];
- instance.fileCacheHelper.loadJsFiles(jsfiles, function () {
- });
- }
- loadControl(containerid, prop) {
- var instance = this;
- instance.transactionId = prop.FormPropertyId;
- var html = '<div class="col-sm-12 transactonList_div transactonList_div_TRN' + instance.transactionId + ' p-0"><div class="transactonList_item transactonList_item_TRN' + instance.transactionId + '" name="' + instance.transactionId + '"><div id="dueControl_transactonListDiv" class="col-sm-12 transactonList_div transactonList_div_TRN2 p-0"><div class="row rowDues" id="dueControlList"><input type="hidden" id="hf_TotalDiscountAmount" value=""/><input type="hidden" id="hf_DiscountAccountId" value="0"/><input type="hidden" id="hf_PenalityAccountId" value="0"/><input type="hidden" id="hf_TDSAccountId" value="0"/><input type="hidden" id="hf_DiscountAccountName" value=""/><input type="hidden" id="hf_PenalityAccountName" value=""/><input type="hidden" id="hf_TDSAccountName" value=""/><div class="col-sm-3 mt-20 text-ul"><u><a href="javascript:;" class="h6" onclick="Bizgaze.Apps.Transact.Controls.Dues.Instance().toggleDues(\'TRN' + instance.transactionId + '\');" style="color:#5ba8fb;">Dues : <span class="txtDuesTotalAmt">0.00</span></a></u></div>' +
- '<div class="col-sm-3"></div><div class="d-none d-sm-block col-sm-3 text-right m-r-n"><div class="mt-10"><a href="javascript:;" name="disabled" class="btn btn-sm btn-success" onclick="Bizgaze.Apps.Transact.Controls.Dues.Instance().AutoAdjustDues(\'TRN' + instance.transactionId + '\');" id="btnAutoAdjustDues">Auto Adjust</a></div></div><div class="block d-sm-none col-sm-2 m-r-n"><div class="mt-10"><a href="javascript:;" name="disabled" class="btn btn-sm btn-success" onclick="Bizgaze.Apps.Transact.Controls.Dues.Instance().AutoAdjustDues(\'TRN' + instance.transactionId + '\');" id="btnAutoAdjustDues">Auto Adjust</a></div></div><div class="col-sm-3"><div class="floating-label-form-group m-t-md"><input data-trnid="TRN' + instance.transactionId + '" class="form-control txtTotalDueAdjusted txtTotalDueAdjusted_TRN' + instance.transactionId + ' floating-label-control m-b-n" type="text" style="cursor: not-allowed;" disabled="disabled"/></div></div></div>' +
- '<input type="hidden" id="hdn_duecontrol" class="value-control" value="Bizgaze.Apps.Transact.Controls.Dues.Instance().dueControlObj(\'TRN' + instance.transactionId + '\');"/>' +
- '<section class="mt-5 secDues secDues_TRN' + instance.transactionId + ' hidden"><div class="list-group divDue_List"></div></section>';
- $("#" + containerid).html(html);
- var controlType = "0";
- if (prop.PropertySettings != null) {
- for (var i = 0; i < prop.PropertySettings.length; i++) {
- var data = prop.PropertySettings[i];
- if (data.ControlPropertyName == "ControlType" && data.ControlPropertyValue != "") {
- controlType = data.ControlPropertyValue;
- }
- }
- }
- if (controlType == "1") {
- instance.journalTypeId = 2;
- }
- else if (controlType == "2") {
- instance.journalTypeId = 1;
- }
- else if (controlType == "3") {
- }
- }
- loadPaymentDues(contactId) {
- var instance = this;
- if (contactId != null && contactId != 0 && contactId != undefined) {
- var instance = this;
- var trnId = instance.transactionId;
- var paymentid = 0;
- if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
- var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
- var hiddenFieldPaymentId = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_paymentid");
- if (hiddenFieldPaymentId != null || hiddenFieldPaymentId != undefined) {
- paymentid = Number(hiddenFieldPaymentId.Value);
- }
- }
- var lobid = Number($(".txtAutoComplete_lobid").val());
- if (isNaN(lobid)) {
- lobid = 0;
- }
- var date = "";
- var userDate = $(".date_journaldate").val();
- if (userDate != undefined && userDate != null && userDate != "") {
- var formattedUserDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().formatServerDate(userDate);
- date = moment(formattedUserDate).format("YYYY-MM-DD");
- }
- else {
- var curDate = Unibase.Platform.Helpers.DateTimeHelper.Instance().currentDate();
- date = moment(curDate).format("YYYY-MM-DD");
- }
- var duesTotalBal = 0;
- var adjustedTotal = 0;
- instance.isDueLoading = true;
- instance.navigationHelper.showLoading();
- var element = $('.transactonList_item_TRN' + trnId + '');
- Bizgaze.Apps.Transact.Managers.PaymentManager.Instance().getPendings(Number(contactId), paymentid, null, instance.journalTypeId, lobid, date, "Dues").then(function (response) {
- var totalDue = 0;
- var result = response.result;
- var divDues = element.find('.divDue_List');
- $(divDues).empty();
- $(divDues).html('<div class="list-group-item m-b-n divDue_List_item hidden"></div>');
- if (result.length != 0) {
- for (var i = 0; i < result.length; i++) {
- var item = result[i];
- if (i == 0) {
- $("#hf_DiscountAccountId").val(item.DiscountAccountId);
- $("#hf_PenalityAccountId").val(item.PenalityAccountId);
- $("#hf_TDSAccountId").val(item.TDSAccountId);
- $("#hf_DiscountAccountName").val(item.DiscountAccountName);
- $("#hf_PenalityAccountName").val(item.PenalityAccountName);
- $("#hf_TDSAccountName").val(item.TDSAccountName);
- var accountsObj = {
- DiscountAccountId: item.DiscountAccountId,
- PenalityAccountId: item.PenalityAccountId,
- TDSAccountId: item.TDSAccountId,
- DiscountAccountName: item.DiscountAccountName,
- PenalityAccountName: item.PenalityAccountName,
- TDSAccountName: item.TDSAccountName,
- };
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().bindAccounts(accountsObj);
- }
- adjustedTotal += item.Amount;
- duesTotalBal += Number(item.JournalAlloc.TotalAmount - item.JournalAlloc.AdjustedAmount);
- function datediff(date2, today) {
- today = new Date(today.split('/')[2], today.split('/')[1] - 1, today.split('/')[0]);
- date2 = new Date(date2.split('/')[2], date2.split('/')[1] - 1, date2.split('/')[0]);
- var timeDiff = Math.abs(today.getTime() - date2.getTime());
- var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24));
- return diffDays;
- }
- var today = new Date();
- var dd = today.getDate();
- var mm = today.getMonth() + 1;
- var yyyy = today.getFullYear();
- if (dd < 10) {
- dd = '0' + dd;
- }
- if (mm < 10) {
- mm = '0' + mm;
- }
- today = dd + '/' + mm + '/' + yyyy;
- var dBalance = 0;
- var tBalance = 0;
- dBalance = Number(item.JournalAlloc.TotalAmount - item.JournalAlloc.AdjustedAmount);
- instance.damount = dBalance;
- tBalance = Number(item.JournalAlloc.TotalAmount);
- var date = $(".date_journaldate").val().toString();
- var NumOfDays = 0;
- if (paymentid == 0) {
- NumOfDays = datediff(Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(item.JournalAlloc.JournalDate, null), date);
- }
- else {
- var PaymentDate = Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_paymentdate").Value;
- NumOfDays = datediff(Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(item.JournalAlloc.JournalDate, null), date);
- }
- instance.bindDuesHtml(item, dBalance, NumOfDays, trnId, tBalance);
- }
- }
- if (duesTotalBal > 0)
- element.find('.txtDuesTotalAmt').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(duesTotalBal, 2));
- else
- element.find('.txtDuesTotalAmt').text("0.00");
- if (duesTotalBal > 0) {
- $(".anchor_totalDue").text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(duesTotalBal, 2));
- }
- else {
- $(".anchor_totalDue").text("0.00");
- }
- }).then(function () {
- $(".txtTotalDueAdjusted").val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(adjustedTotal, 2));
- $(".secDues").removeClass("hidden");
- element.find('.secDues_' + trnId + '').addClass('hidden');
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- instance.isDueLoading = false;
- var isWalletLoading = Bizgaze.Apps.Transact.Controls.Wallet.Instance().isWalletLoading;
- if (instance.isDueLoading == false && isWalletLoading == false) {
- instance.navigationHelper.hideLoading();
- }
- });
- }
- }
- toggleDues(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- element.find('.secDues_' + trnId + '').toggleClass('hidden');
- }
- AutoAdjustDues(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var btnColor = $(element).find('#btnAutoAdjustDues').attr('class');
- if ($(element).find('#btnAutoAdjustDues').attr("name") == "enabled") {
- }
- else {
- $(element).find('#btnAutoAdjustDues').attr("name", "enabled");
- }
- instance.updatePayment(trnId);
- var totAdj = 0;
- $(element).find('.divDue_Item').each(function () {
- var xyz = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(xyz))
- totAdj += xyz;
- });
- $('.txtTotalDueAdjusted').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totAdj, 2));
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- }
- clearDues() {
- var instance = this;
- var trnId = "TRN" + instance.transactionId;
- var totalDueAdjAmt = Number($(".totAdjusted").first().text());
- var totalCreditAmt = Number($(".totAmount").first().text());
- if ((totalDueAdjAmt < totalCreditAmt) || (totalDueAdjAmt > totalCreditAmt)) {
- $(".txtTotalDueAdjusted").val(0);
- $(".totAdjusted").text(0.00);
- var elementforPayment = $('.transactonList_item_' + trnId + '');
- $(elementforPayment).find('.divDue_Item').each(function () {
- $(this).find('.txtCurrentAmount').val(0);
- var walletAmt = $(this).find('.hfDueAmount').val();
- $(this).find('.lblDueBalance').val(walletAmt);
- });
- }
- }
- updatePayment(trnId) {
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var advanceAmt = 0;
- var total = 0;
- var ttWalAdj = Number($('.txtTotalWalletAdjusted').val());
- var totWalAdj = (isNaN(ttWalAdj)) ? 0 : Number($('.txtTotalWalletAdjusted').val());
- var prevamount = Number($("#txt_TotalCreditAmount").val()) + totWalAdj;
- $(".paymentmodelistitem").each(function () {
- if (!($(this).hasClass("hidden"))) {
- var amount = Number($(this).find('.paymentamount').val());
- $(this).find('.amount').text(amount);
- total = Number(prevamount) + Number(amount);
- prevamount = total;
- }
- });
- var paymentTotal = Number(total) == 0 ? prevamount : Number(total);
- $("#hf_TotalCreditAmount").val(paymentTotal);
- $(element).find('.divDue_Item').each(function (index) {
- var amount = Number($("#txt_TotalCreditAmount").val());
- var txtDiscountAmount = Number($(this).find('.txtDiscountAmount').val());
- var txtTdsAmount = Number($(this).find('.txtTdsAmount').val());
- var currentAmount = Number($(this).find('.txtCurrentAmount').val());
- var discamount = Number($(this).find('.hfDiscountAmount').val());
- var dueAmount = 0;
- if (discamount == 0) {
- dueAmount = Number($(this).find('.hfDueAmount').val()) - txtDiscountAmount - txtTdsAmount;
- }
- else {
- dueAmount = (Number($(this).find('.hfDueAmount').val()) + discamount) - txtDiscountAmount - txtTdsAmount;
- }
- var txtCurrentAmt = 0;
- if (paymentTotal >= dueAmount) {
- if (dueAmount != 0) {
- paymentTotal -= dueAmount;
- txtCurrentAmt = dueAmount;
- dueAmount = 0;
- advanceAmt = paymentTotal;
- }
- }
- else {
- dueAmount -= paymentTotal;
- txtCurrentAmt = paymentTotal;
- paymentTotal = 0;
- }
- if (Number(paymentTotal) < 0.01) {
- paymentTotal = 0;
- }
- $(this).find('.txtCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(txtCurrentAmt, 2));
- $(this).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(dueAmount, 2));
- });
- }
- bindDuesHtml(item, dBalance, NumOfDays, formPropId, tBalance) {
- var instance = this;
- var discAmount = item.DiscountAmount;
- if (item.PaymentTermMode == 2) {
- discAmount = discAmount * -1;
- }
- var tdsAttr = "";
- if (item.TCSAmount > 0) {
- tdsAttr = "disabled";
- }
- var journalAlloc = item.JournalAlloc;
- var Amount = item.Amount;
- var html = '<div class="list-group-item divDue_Item" id="divDue_List_item_' + journalAlloc.JournalId + '"><div class="row">' +
- '<input type="hidden" class="hf_JournalAllocId" value="' + journalAlloc.JournalAllocId + '" />' +
- '<input type="hidden" class="hf_RefAllocId" value="' + journalAlloc.RefAllocId + '" />' +
- '<div class="col-sm-3"><div class="floating-label-form-group m-b floating-label-form-group-with-value" style="border:0px"><span class="h6">' + journalAlloc.JournalNo + ' (' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(tBalance, 2) + ')</span><br/><input class="form-control value-control text-dark" disabled type="text" value="' + Unibase.Platform.Helpers.DateTimeHelper.Instance().formatLocalDateformat(journalAlloc.JournalDate, null) + ' (' + NumOfDays + ' days)"></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group m-b floating-label-form-group-with-value" style="border:0px"><span class="h6">Balance</span><input class="hfOrgDueAmount" type="hidden" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(dBalance - discAmount - item.TDSAmount, 2) + '"><input class="hfDueAmount" type="hidden" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(dBalance - discAmount - item.TDSAmount, 2) + '"><input id="lblDueBalance_' + journalAlloc.JournalId + '" class="form-control value-control lblDueBalance text-dark" disabled type="text" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(dBalance - discAmount - Amount - item.TDSAmount, 2) + '" placeholder="Balance" data-label="Balance"></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group m-b floating-label-form-group-with-value"><span class="h6">Discount</span><br /><input class="hfDiscountAmount" type="hidden" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(discAmount, 2) + '" /><input class="form-control value-control floating-label-control txtDiscountAmount" type="text" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(discAmount, 2) + '" id="txtDiscountAmount_' + journalAlloc.JournalId + '" class="form-control value-control floating-label-control txtCurrentAmount" placeholder="Discount Amount" data-label="Discount Amount" onclick="this.select()" onkeypress="return Bizgaze.Apps.Transact.Controls.Dues.Instance().isSignDecimalplusNoLongPress(event,this.id)" onkeyup="Bizgaze.Apps.Transact.Controls.Dues.Instance().discountValidation(event,this.id,\'' + journalAlloc.JournalId + '\',\'' + "TRN" + formPropId + '\')" /></div></div>' +
- '<div class="col-sm-2"><div class="floating-label-form-group m-b floating-label-form-group-with-value"><span class="h6">TDS</span><br /><input class="hfTdsAmount" type="hidden" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(item.TDSAmount, 2) + '" /><input class="form-control value-control floating-label-control txtTdsAmount" ' + tdsAttr + ' type="text" value="' + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(item.TDSAmount, 2) + '" id="txtTdsAmount_' + journalAlloc.JournalId + '" class="form-control value-control floating-label-control" placeholder="TDS Amount" data-label="TDS Amount" onclick="this.select()" oninput="return Bizgaze.Apps.Transact.Controls.Dues.Instance().isDecimalplusNoLongPress(event,this.id)" onkeyup="Bizgaze.Apps.Transact.Controls.Dues.Instance().tdsValidation(event,this.id,\'' + journalAlloc.JournalId + '\',\'' + "TRN" + formPropId + '\')" /></div></div>' +
- '<div class="col-sm-3"><div class="floating-label-form-group m-b"><span class="h6">Adjusted Amount</span><br><input id="txtCurrentAmount_' + journalAlloc.JournalId + '" type="text" data-previousvalue="0" value="' + Amount + '" class="form-control value-control floating-label-control txtCurrentAmount" placeholder="Amount" data-label="Amount" onclick="this.select()" oninput="return Bizgaze.Apps.Transact.Controls.Dues.Instance().isDecimalplusNoLongPress(event,this.id)" onkeyup="Bizgaze.Apps.Transact.Controls.Dues.Instance().AdjustDueAmount(event,\'' + journalAlloc.JournalId + '\',\'' + "TRN" + formPropId + '\');"/></div></div>' +
- '</div></div>';
- var element = $('.transactonList_item_TRN' + formPropId + '');
- element.find('.divDue_List_item').before(html);
- }
- bindDueEvents() {
- }
- tdsValidation(evt, id, jId, trnId) {
- var instance = this;
- instance.flag = 0;
- var val = document.getElementById(id);
- var curDueAmount = Number(val.value);
- var elementforPayment = $('.transactonList_item_' + trnId);
- var element = elementforPayment.find('#divDue_List_item_' + jId);
- var tdsAccountId = Number($("#hf_TDSAccountId").val());
- var totDueAmount = Number($(element).find('.hfDueAmount').val());
- instance.AdjustDueAmount(evt, jId, trnId);
- if (totDueAmount < curDueAmount) {
- $(element).find('.txtTdsAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("TDSAmount cannot be greater than Due Amount");
- return false;
- }
- var adjustedAmt = $(element).find('.txtCurrentAmount').val();
- if (adjustedAmt != 0) {
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- }
- return true;
- }
- discountValidation(evt, id, jId, trnId) {
- var instance = this;
- instance.flag = 0;
- var val = document.getElementById(id);
- var isNegativeValue = (val.value.match(/-/g) || []).length;
- var curDueAmount = Number(val.value);
- var elementforPayment = $('.transactonList_item_' + trnId);
- var element = elementforPayment.find('#divDue_List_item_' + jId);
- var discountAccountId = Number($("#hf_DiscountAccountId").val());
- var penalityAccountId = Number($("#hf_PenalityAccountId").val());
- var totDueAmount = Number($(element).find('.hfDueAmount').val());
- var isDiscAmount = Math.sign(curDueAmount);
- if (isNaN(isDiscAmount)) {
- $(element).find('.txtDiscountAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- return false;
- }
- instance.AdjustDueAmount(evt, jId, trnId);
- if (totDueAmount < curDueAmount) {
- $(element).find('.txtDiscountAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Discount cannot be greater than Due Amount");
- return false;
- }
- var adjustedAmt = $(element).find('.txtCurrentAmount').val();
- if (adjustedAmt != 0) {
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- }
- return true;
- }
- AdjustDueAmount(event, jId, trnId) {
- var instance = this;
- instance.flag = 0;
- const maxAmt = Number($(event.target).parents('.divDue_Item').find('.hfOrgDueAmount').val());
- const currVal = Number($(event.target).val());
- if (currVal > maxAmt) {
- $(event.target).val(maxAmt);
- }
- var formId = $(".transactonList_div_" + trnId).parents("form").attr("id").split('_')[1];
- var elementforPayment = $('.transactonList_item_' + trnId + '');
- var totDue = 0;
- var totDueAmt = Number(elementforPayment.find('.txtDuesTotalAmt').text());
- $(elementforPayment).find('.divDue_Item').each(function () {
- var xyz = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(xyz))
- totDue += xyz;
- });
- var element = elementforPayment.find('#divDue_List_item_' + jId + '');
- var previousValue = $(element).find('.txtCurrentAmount').data("previousvalue");
- var crAmt = totDueAmt;
- var totalAmt = Number($(".totAmount").first().text());
- var OrgdueAmount = Number($(element).find('.hfOrgDueAmount').val());
- var DueAmount = Number($(element).find('.hfDueAmount').val());
- var txtCurrentAmt = $(element).find('.txtCurrentAmount').val();
- var txtDiscountAmt = Number($(element).find('.txtDiscountAmount').val());
- var txtTDSAmt = Number($(element).find('.txtTdsAmount').val());
- var hf_DiscountAmount = Number($(element).find(".hfDiscountAmount").val());
- var hf_TDSAmount = Number($(element).find(".hfTdsAmount").val());
- var lblDueBalance = Number($(element).find(".lblDueBalance").val());
- var totalAmount = OrgdueAmount + hf_DiscountAmount + hf_TDSAmount;
- var txtDueBal = 0;
- if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt != 0 && txtTDSAmt != 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt != 0 && txtTDSAmt == 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt != 0 && txtTDSAmt != 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt == 0 && txtTDSAmt != 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt == 0 && txtTDSAmt == 0 && hf_DiscountAmount != 0) {
- txtDueBal = OrgdueAmount + hf_DiscountAmount;
- }
- else if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt == 0 && txtTDSAmt != 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt != 0 && txtTDSAmt != 0 && lblDueBalance != 0) {
- txtDueBal = totalAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt != 0 && hf_TDSAmount != 0 && lblDueBalance == 0 && totalAmount != txtCurrentAmt && hf_DiscountAmount == 0) {
- txtDueBal = Number(txtCurrentAmt) - txtDiscountAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt != 0 && hf_TDSAmount != 0 && lblDueBalance == 0 && totalAmount != txtCurrentAmt && hf_DiscountAmount != 0 && txtTDSAmt != 0) {
- txtDueBal = totalAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt != 0 && txtTDSAmt != 0 && lblDueBalance == 0) {
- txtDueBal = OrgdueAmount - txtTDSAmt;
- }
- else if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt == 0 && txtTDSAmt != 0) {
- txtDueBal = OrgdueAmount + hf_DiscountAmount;
- }
- else if ((txtCurrentAmt == 0 || txtCurrentAmt == "") && txtDiscountAmt != 0 && txtTDSAmt == 0 && hf_DiscountAmount != 0) {
- txtDueBal = (OrgdueAmount + hf_TDSAmount + hf_DiscountAmount) - txtDiscountAmt;
- }
- else if ((txtCurrentAmt != 0) && txtDiscountAmt == 0 && txtTDSAmt == 0 && lblDueBalance == 0 && hf_DiscountAmount != 0) {
- txtDueBal = OrgdueAmount + hf_DiscountAmount;
- }
- else if ((txtDiscountAmt == 0 && hf_DiscountAmount != 0) && (txtTDSAmt == 0 && hf_TDSAmount != 0) && txtCurrentAmt == 0) {
- txtDueBal = totalAmount;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt != 0 && txtTDSAmt == 0 && lblDueBalance != 0) {
- txtDueBal = totalAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt == 0 && txtTDSAmt == 0 && lblDueBalance != 0) {
- txtDueBal = totalAmount - txtTDSAmt;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt != 0 && txtTDSAmt == 0 && lblDueBalance == 0 && txtCurrentAmt == totalAmount) {
- txtDueBal = totalAmount - txtDiscountAmt;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt != 0 && txtTDSAmt == 0 && lblDueBalance == 0) {
- txtDueBal = OrgdueAmount + hf_DiscountAmount - txtDiscountAmt;
- }
- else if (txtCurrentAmt == lblDueBalance && txtCurrentAmt != "" && txtCurrentAmt != 0) {
- txtDueBal = OrgdueAmount + hf_DiscountAmount + hf_TDSAmount;
- }
- else if (txtCurrentAmt != 0 && txtDiscountAmt != 0 && txtTDSAmt != 0 && hf_DiscountAmount == 0 && hf_TDSAmount == 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt - txtTDSAmt;
- }
- else if (txtCurrentAmt == 0 && DueAmount != 0 && OrgdueAmount != 0 && hf_DiscountAmount != 0 && hf_TDSAmount != 0 && txtDiscountAmt != 0 && txtTDSAmt != 0) {
- txtDueBal = OrgdueAmount;
- }
- else if (txtCurrentAmt == 0 && txtDiscountAmt != 0 && hf_TDSAmount != 0 && hf_DiscountAmount == 0 && hf_TDSAmount != 0) {
- txtDueBal = OrgdueAmount - txtDiscountAmt;
- }
- else if (totalAmount == txtCurrentAmt) {
- txtDueBal = totalAmount;
- }
- else {
- txtDueBal = OrgdueAmount;
- }
- if (txtDueBal < 0) {
- txtDueBal = 0;
- }
- $(' #lblDueBalance_' + jId + '').val(txtDueBal);
- if (totDue <= crAmt) {
- if (totDue <= totalAmt) {
- if (totDue <= totDueAmt) {
- if (txtCurrentAmt == 0 || txtCurrentAmt == undefined) {
- $(element).find('.txtCurrentAmount').val(0.00);
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(txtDueBal, 2));
- var ttWallet = 0;
- $(elementforPayment).find('.divDue_Item').each(function () {
- var pqr = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- var currentValue = Number($(element).find('.txtCurrentAmount').val());
- $(element).find('.txtCurrentAmount').data("previousvalue", currentValue);
- return false;
- }
- if (Number(txtCurrentAmt) + txtDiscountAmt + txtTDSAmt > OrgdueAmount) {
- var walletAmount_ = 0;
- if ((hf_DiscountAmount != 0 && txtDiscountAmt == 0)) {
- walletAmount_ = Number(hf_DiscountAmount);
- }
- else if ((hf_TDSAmount != 0 && txtTDSAmt == 0)) {
- walletAmount_ = walletAmount_ + Number(hf_TDSAmount);
- }
- if (txtDiscountAmt == 0) {
- $(element).find('.txtDiscountAmount').val(0.00);
- }
- if (txtTDSAmt == 0) {
- $(element).find('.txtTdsAmount').val(0.00);
- }
- $(element).find('.txtCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(txtDueBal, 2));
- if (txtCurrentAmt == totalAmount) {
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- }
- else {
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(walletAmount_, 2));
- }
- }
- else {
- var walletAmount = txtDueBal - Number(txtCurrentAmt);
- if (walletAmount < 0) {
- walletAmount = 0;
- }
- if (hf_TDSAmount != 0 && txtTDSAmt == 0 && txtDiscountAmt == 0 && hf_DiscountAmount != 0) {
- walletAmount = hf_DiscountAmount + hf_TDSAmount + walletAmount;
- }
- $(element).find('.txtCurrentAmount').val(txtCurrentAmt);
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(walletAmount, 2));
- }
- var ttWallet = 0;
- $(elementforPayment).find('.divDue_Item').each(function () {
- var pqr = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- }
- else {
- $(element).find('.txtCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(OrgdueAmount - txtDiscountAmt - txtTDSAmt, 2));
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(0, 2));
- var ttWallet = 0;
- $(elementforPayment).find('.divDue_List_item').each(function () {
- var pqr = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- }
- }
- else {
- MessageHelper.Instance().showError("You cannot adjust without enough credits", 'div_ErrorMessage_' + formId);
- $(element).find('.txtCurrentAmount').val(previousValue);
- }
- }
- else {
- var ttWallet = 0;
- $(elementforPayment).find('.divDue_Item').each(function () {
- var pqr = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(pqr))
- ttWallet += pqr;
- });
- var newAmt = Number(crAmt) - (Number(ttWallet) - Number(txtCurrentAmt));
- var OldCurAdjAmt = Number($(element).find('.txtCurrentAmount').val());
- if (newAmt >= 0) {
- if (newAmt >= Number($(element).find('.hfDueAmount').val())) {
- var curAdjAmt = ttWallet - OldCurAdjAmt;
- var newAdjAmt = txtDueBal;
- $(element).find('.txtCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(newAdjAmt, 2));
- $(element).find('.lblDueBalance').val(0.00);
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(curAdjAmt + newAdjAmt, 2));
- }
- else {
- var curAdjAmt = ttWallet - OldCurAdjAmt;
- var newAdjAmt = OrgdueAmount - newAmt;
- $(element).find('.txtCurrentAmount').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(newAmt, 2));
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(newAdjAmt, 2));
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(curAdjAmt + newAdjAmt, 2));
- }
- }
- else {
- $(element).find('.txtCurrentAmount').val(0);
- $(element).find('.lblDueBalance').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(Number($(element).find('.hfWalletAmount').val()), 2));
- $(elementforPayment).find('.txtTotalDueAdjusted_' + trnId + '').val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(ttWallet, 2));
- }
- }
- Bizgaze.Apps.Transact.Controls.PaymentSummary.Instance().updatePaymentSummaryTotal();
- var currentValue = Number($(element).find('.txtCurrentAmount').val());
- $(element).find('.txtCurrentAmount').data("previousvalue", currentValue);
- }
- isDecimalplusNoLongPress(evt, id) {
- let value = $('#' + id).val();
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode == 46) {
- return false;
- }
- if (value) {
- if (value.split('.').length >= 2) {
- if (value.split('.')[1]) {
- if (value.split('.')[1].length >= 2) {
- let valNew = parseFloat(`${value}`).toFixed(2);
- $('#' + id).val(valNew);
- }
- }
- }
- }
- return true;
- }
- isSignDecimalplusNoLongPress(evt, id) {
- var instance = this;
- instance.flag++;
- var charCode = (evt.which) ? evt.which : evt.keyCode;
- if (instance.flag <= 4) {
- if (charCode == 46) {
- var val = document.getElementById(id);
- var txt = val.value;
- if (!(txt.indexOf(".") > -1)) {
- return true;
- }
- }
- if (charCode == 45) {
- return true;
- }
- if (charCode > 31 && (charCode < 48 || charCode > 57))
- return false;
- }
- else {
- return false;
- }
- return true;
- }
- initFlag() {
- var instance = this;
- instance.flag = 0;
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return ``;
- }
- loadPropertySettings(propertysettings, formpropertyid) {
- if (propertysettings != null) {
- for (var i = 0; i < propertysettings.length; i++) {
- var data = propertysettings[i];
- if (data.ControlPropertyName == "ControlType" && data.ControlPropertyValue != "") {
- $("#hdn_" + formpropertyid).attr("ControlType", data.ControlPropertyValue);
- $("#hdn_" + formpropertyid).val(data.ControlPropertyValue);
- }
- }
- }
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- return ``;
- }
- dueControlObj(trnId) {
- var walletamount = Number($('.txtTotalWalletAdjusted').val());
- var dueamount = Number($('.txtTotalDueAdjusted ').val());
- if (walletamount > 0 && dueamount == 0) {
- Unibase.Platform.Forms.Components.FormViewer.Instance().showError("Error! Wallet amount is not adjusted against Dues. Remove the excess amount from wallets & save!");
- return false;
- }
- var instance = this;
- var element = $('.transactonList_item_' + trnId + '');
- var data = new Array();
- element.find('.divDue_Item').each(function (index) {
- var balanceAmount = Number($(this).find('.lblDueBalance').val());
- var isDueObj = false;
- if ($(this).find('.txtCurrentAmount').val() != 0 && $(this).find('.txtCurrentAmount').val() != '' && $(this).find('.txtCurrentAmount').val() != undefined) {
- isDueObj = true;
- }
- else if (!isNaN(balanceAmount) && balanceAmount == 0) {
- isDueObj = true;
- }
- if (isDueObj) {
- var jAId = Number($(this).find('.hf_JournalAllocId').val());
- var journalTypeId = 2;
- var discountAmount = Number($(this).find('.txtDiscountAmount').val());
- var tdsAmount = Number($(this).find('.txtTdsAmount').val());
- if (instance.journalTypeId == 1) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- Credit: Number($(this).find('.txtCurrentAmount').val()),
- RefAllocId: Number($(this).find('.hf_RefAllocId').val()),
- AllocType: 2,
- AllocTypeId: 2,
- Discount: discountAmount,
- TDSAmount: tdsAmount,
- });
- }
- else if (journalTypeId == 2) {
- data.push({
- JournalAllocId: isNaN(jAId) ? 0 : jAId,
- Debit: Number($(this).find('.txtCurrentAmount').val()),
- RefAllocId: Number($(this).find('.hf_RefAllocId').val()),
- AllocType: 2,
- AllocTypeId: 2,
- Discount: discountAmount,
- TDSAmount: tdsAmount,
- });
- }
- }
- });
- return data;
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new Dues();
- }
- return this.instance;
- }
- }
- Controls.Dues = Dues;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
-
- var Bizgaze;
- (function (Bizgaze) {
- let Apps;
- (function (Apps) {
- let Transact;
- (function (Transact) {
- let Controls;
- (function (Controls) {
- class PaymentSummary extends Unibase.Platform.Core.BaseComponent {
- init(formpropertyid, prop, callback) {
- var instance = this;
- }
- loadControl(containerid, prop) {
- var instance = this;
- var containerhtml = `<div id="paymentSummaryContainer"></div>`;
- $("#" + containerid).html(containerhtml);
- instance.loadPaymentSummaryControl("paymentSummaryContainer");
- }
- loadPaymentSummaryControl(containerid) {
- var instance = this;
- var html = '<div class="row clearfix">' +
- '<div class="col-md-4 ">' +
- '<div class="header row form-group col-sm-12"><div id="paymentmodesummary" class="col-6"><strong class="row">Mode</strong></div><div id="paymentmodeamountsummary" class="col-6"><strong class="row">Amount</strong></div></div>' +
- '<div class="row col-sm-12 form-group paymentsummaryItem hidden" id="div_wallet_summary"><div class="col-sm-6 col-6"><span>Wallets</span></div><div class="col-sm-6 col-6"><strong><span id="spn_wallet_amount"></span></strong></div></div>' +
- '<div class="row col-sm-12 form-group paymentsummaryItem hidden" id="div_coupon_summary"><div class="col-sm-6 col-6"><span>Coupons</span></div><div class="col-sm-6 col-6"><strong><span id="spn_coupon_amount"></span></strong></div></div>' +
- '</div>' +
- '<div class="col-md-3">' +
- '<div id="div_Discount" class="hidden col-sm-12 form-group floating-label-form-group floating-label-form-group-with-value border-0 pb-10">' +
- '<label for="lbl" id="lbl_Discount">Discount Account<span class="text-danger" id="spnlbl_Discount"> *</span></label>' +
- '<div class="input-group"><select id="txtAutoComplete_DiscountAccount" class="txtAutoComplete_DiscountAccount hidden form-control text-control select2-hidden-accessible" style="width:100%;" placeholder="Select Discount Account"></select><input type="hidden" id="hfAutoComplete_DiscountAccount" value="" class="hfAutoComplete_DiscountAccount form-control"/></div>' +
- '</div>' +
- '<div id="div_Penality" class="hidden col-sm-12 form-group floating-label-form-group floating-label-form-group-with-value border-0 pb-10">' +
- '<label for="lbl" id="lbl_Penality">Penality Account<span class="text-danger" id="spnlbl_Penality"> *</span></label>' +
- '<div class="input-group"><select id="txtAutoComplete_PenalityAccount" class="txtAutoComplete_PenalityAccount hidden form-control text-control select2-hidden-accessible" style="width:100%;" placeholder="Select Penality Account"></select><input type="hidden" id="hfAutoComplete_PenalityAccount" value="" class="hfAutoComplete_PenalityAccount form-control"/></div>' +
- '</div>' +
- '<div id="div_TDS" class="hidden col-sm-12 form-group floating-label-form-group floating-label-form-group-with-value border-0 pb-10">' +
- '<label for="lbl" id="lbl_TDS">TDS Account<span class="text-danger" id="spnlbl_TDS"> *</span></label>' +
- '<div class="input-group"><select id="txtAutoComplete_TDSAccount" class="txtAutoComplete_TDSAccount hidden form-control text-control select2-hidden-accessible" style="width:100%;" placeholder="Select TDS Account"></select><input type="hidden" id="hfAutoComplete_TDSAccount" value="" class="hfAutoComplete_TDSAccount form-control"/></div>' +
- '</div>' +
- '</div>' +
- '<div class="col-md-5 no-padder text-right d-none d-md-block" id="divTotalAmount">' +
- '<input type="hidden" class="totBalance" id="totBalance"></input>' +
- '<div class="row col-sm-12 form-group">' +
- '<div class="col-sm-6 text-right">' +
- '<span>Total Amount</span>' +
- '</div>' +
- '<div class="col-md-6 text-right">' +
- '<strong>' +
- '<span class="totAmount" id="totAmount">0.00</span>' +
- ' </strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divDiscountAmount">' +
- '<div class="col-md-6 text-right">' +
- '<span>Discount</span>' +
- '</div>' +
- '<div class="col-md-6 text-right ">' +
- '<strong>' +
- '<span class="totDiscount" id="totDiscount">0.00</span>' +
- '</strong>' +
- ' </div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divPenalityAmount">' +
- '<div class="col-md-6 text-right">' +
- '<span>Penality</span>' +
- '</div>' +
- '<div class="col-md-6 text-right ">' +
- '<strong>' +
- '<span class="totPenality" id="totPenality">0.00</span>' +
- '</strong>' +
- ' </div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divAdjustedAmount">' +
- '<div class="col-sm-6 text-right">' +
- '<span>Adjusted</span>' +
- '</div>' +
- '<div class="col-sm-6 text-right">' +
- '<strong>' +
- '<span class="totAdjusted" id="totAdjusted">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divAdvanceAmount">' +
- '<div class="col-sm-6 text-right">' +
- '<span>Advance</span>' +
- '</div>' +
- '<div class="col-sm-6 text-right">' +
- '<strong>' +
- '<span class="totAdvance" id="totAdvance">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12" id="divTdsAmount">' +
- '<div class="col-md-6 text-right">' +
- '<span>TDS</span>' +
- '</div>' +
- '<div class="col-md-6 text-right">' +
- '<strong>' +
- '<span class="totTds" id="totTds">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '<div class="col-sm-12 no-padder d-md-none border-top border-dark " id="divTotalAmount">' +
- '<input type="hidden" class="totBalance" id="totBalance"></input>' +
- '<div class="row col-sm-12 form-group pt-10">' +
- '<div class="col-6 text-left">' +
- '<span>Total Amount</span>' +
- '</div>' +
- '<div class="col-6 text-left">' +
- '<strong>' +
- '<span class="totAmount" id="totAmount">0.00</span>' +
- ' </strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divDiscountAmount">' +
- '<div class="col-6 ">' +
- '<span>Discount</span>' +
- '</div>' +
- '<div class="col-6 ">' +
- '<strong>' +
- '<span class="totDiscount" id="totDiscount">0.00</span>' +
- '</strong>' +
- ' </div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divPenalityAmount">' +
- '<div class="col-6 ">' +
- '<span>Penality</span>' +
- '</div>' +
- '<div class="col-6 ">' +
- '<strong>' +
- '<span class="totPenality" id="totPenality">0.00</span>' +
- '</strong>' +
- ' </div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divAdjustedAmount">' +
- '<div class="col-6 ">' +
- '<span>Adjusted.</span>' +
- '</div>' +
- '<div class="col-6 ">' +
- '<strong>' +
- '<span class="totAdjusted" id="totAdjusted">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12 form-group summary" id="divAdvanceAmount">' +
- '<div class="col-6">' +
- '<span>Advance</span>' +
- '</div>' +
- '<div class="col-6">' +
- '<strong>' +
- '<span class="totAdvance" id="totAdvance">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '<div class="row col-sm-12" id="divTdsAmount">' +
- '<div class="col-6">' +
- '<span>TDS</span>' +
- '</div>' +
- '<div class="col-6">' +
- '<strong>' +
- '<span class="totTds" id="totTds">0.00</span>' +
- '</strong>' +
- '</div>' +
- '</div>' +
- '</div>' +
- '</div>';
- $("#" + containerid).html(html);
- instance.loadAccounts();
- }
- loadPaymentSummary() {
- var instance = this;
- var dueFormPropertyId = $("#dueControlList").parents(".divCustomProperties").data("formpropertyid");
- var totAdjAmount = 0;
- var totTds = 0;
- var totDiscount = 0;
- var totPenality = 0;
- var elementforDue = $('.transactonList_item_TRN' + dueFormPropertyId + '');
- $(elementforDue).find('.divDue_Item').each(function () {
- var curAdjAmt = Number($(this).find('.txtCurrentAmount').val());
- if (!isNaN(curAdjAmt) && curAdjAmt != 0) {
- totAdjAmount += curAdjAmt;
- var curDiscAmt = Number($(this).find(".txtDiscountAmount").val());
- if (!isNaN(curDiscAmt) && curDiscAmt != 0) {
- if (curDiscAmt > 0) {
- totDiscount += curDiscAmt;
- }
- else {
- totPenality += curDiscAmt;
- }
- }
- var curTds = Number($(this).find(".txtTdsAmount").val());
- if (!isNaN(curTds) && curTds != 0) {
- totTds += curTds;
- }
- }
- });
- $('.txtTotalDueAdjusted').val(totAdjAmount);
- var ttCreditAmt = 0;
- if ($("#paymentslist li").length > 1) {
- var amt = 0;
- $("#paymentslist li").each(function (e) {
- var curAmt = Number($(this).find(".spn_payment_amount").text());
- if (!isNaN(curAmt)) {
- amt += curAmt;
- }
- });
- ttCreditAmt = amt;
- }
- else {
- var amt = Number($("#txt_TotalCreditAmount").val());
- if (!isNaN(amt)) {
- ttCreditAmt = amt;
- }
- }
- var walletFormPropertyId = $("#walletControlList").parents(".divCustomProperties").data("formpropertyid");
- var elementforPayment = $('.transactonList_item_TRN' + walletFormPropertyId);
- var totWalletAdjusted = Number($(elementforPayment).find('.txtTotalWalletAdjusted_TRN' + walletFormPropertyId).val());
- if (!isNaN(totWalletAdjusted)) {
- ttCreditAmt += totWalletAdjusted;
- }
- $("#hf_TotalCreditAmount").val(ttCreditAmt);
- var advanceAmt = Number($("#hf_TotalCreditAmount").val()) - Number($('.txtTotalDueAdjusted').val());
- var advAmt = (advanceAmt > 0) ? advanceAmt : 0;
- $('.totAdvance').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(advAmt, 2));
- var totAdjusted = Number($('.txtTotalDueAdjusted').val());
- $('.totAdjusted').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totAdjusted, 2));
- var totAmountCredited = Number($("#hf_TotalCreditAmount").val());
- $('.totAmount').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totAmountCredited, 2));
- $('.totDiscount').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totDiscount, 2));
- $('.totPenality').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totPenality, 2));
- $('.totTds').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totTds, 2));
- instance.showOrHideAccounts(totDiscount, totPenality, totTds);
- }
- updatePaymentSummary() {
- var instance = this;
- var cashAmt = 0;
- var chequeAmt = 0;
- var onlineAmt = 0;
- var neftAmt = 0;
- var rtgs = 0;
- var fundTransfer = 0;
- var adjustment = 0;
- var upiAmt = 0;
- var cardAmt = 0;
- var totalAmount = 0;
- var hasAdjustment = false;
- $("#paymentslist li").each(function () {
- var curPaymentMode = Number($(this).find("#hf_PaymentModeId").val());
- var curAmt = Number($(this).find(".spn_payment_amount").text());
- var flag = 1;
- if (!isNaN(curPaymentMode) && !isNaN(curAmt)) {
- flag = 1;
- }
- else {
- flag = 0;
- var ddlPaymentModeId = $("#txtAutoComplete_paymentmodeid").val();
- if (ddlPaymentModeId != null && ddlPaymentModeId != 0 && ddlPaymentModeId != undefined && ddlPaymentModeId != "0") {
- flag = 1;
- curPaymentMode = Number($("#txtAutoComplete_paymentmodeid").val());
- curAmt = Number($("#txt_TotalCreditAmount").val());
- }
- }
- if (flag == 1) {
- totalAmount += curAmt;
- if (curPaymentMode == 1) {
- cashAmt += curAmt;
- }
- else if (curPaymentMode == 2) {
- chequeAmt += curAmt;
- }
- else if (curPaymentMode == 3) {
- onlineAmt += curAmt;
- }
- else if (curPaymentMode == 4) {
- neftAmt += curAmt;
- }
- else if (curPaymentMode == 5) {
- rtgs += curAmt;
- }
- else if (curPaymentMode == 6) {
- fundTransfer += curAmt;
- }
- else if (curPaymentMode == 7) {
- hasAdjustment = true;
- adjustment += curAmt;
- }
- else if (curPaymentMode == 8) {
- upiAmt += curAmt;
- }
- else if (curPaymentMode == 9) {
- cardAmt += curAmt;
- }
- }
- });
- $('.paymentmodes').remove();
- if (cashAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>Cash</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(cashAmt, 2) + "</span>");
- }
- if (chequeAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>Cheque</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(chequeAmt, 2) + "</span>");
- }
- if (onlineAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>Online</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(onlineAmt, 2) + "</span>");
- }
- if (neftAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>NEFT</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(neftAmt, 2) + "</span>");
- }
- if (rtgs > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>RTGS</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(rtgs, 2) + "</span>");
- }
- if (fundTransfer > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>FundTransfer</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(fundTransfer, 2) + "</span>");
- }
- if (adjustment > 0 || hasAdjustment) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>Adjustment</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(adjustment, 2) + "</span>");
- }
- if (upiAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>UPI</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(upiAmt, 2) + "</span>");
- }
- if (cardAmt > 0) {
- $("#paymentmodesummary").append("<span class='row paymentmodes'>Card</span>");
- $("#paymentmodeamountsummary").append("<span class='row paymentmodes'>" + Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(cardAmt, 2) + "</span>");
- }
- instance.updatePaymentSummaryTotal();
- }
- updatePaymentSummaryTotal() {
- var instance = this;
- var amt = 0;
- var totalCreditAmt = Number($("#txt_TotalCreditAmount").val());
- if (!isNaN(totalCreditAmt)) {
- amt = totalCreditAmt;
- }
- $("#paymentslist li").each(function (e) {
- var curAmt = Number($(this).find(".spn_payment_amount").text());
- if (!isNaN(curAmt)) {
- amt += curAmt;
- }
- });
- var discAmt = 0;
- var tdsAmt = 0;
- var penalityAmt = 0;
- $("#dueControl_transactonListDiv .divDue_Item").each(function (e) {
- var curAdjAmt = Number($(this).find(".txtCurrentAmount").val());
- if (!isNaN(curAdjAmt) && curAdjAmt != 0) {
- var curDiscAmt = Number($(this).find(".txtDiscountAmount").val());
- if (!isNaN(curDiscAmt)) {
- if (curDiscAmt > 0) {
- discAmt += curDiscAmt;
- }
- else {
- penalityAmt += curDiscAmt;
- }
- }
- }
- });
- $("#dueControl_transactonListDiv .divDue_Item").each(function (e) {
- var curAdjAmt = Number($(this).find(".txtCurrentAmount").val());
- if (!isNaN(curAdjAmt) && curAdjAmt != 0) {
- var curTdsAmt = Number($(this).find(".txtTdsAmount").val());
- if (!isNaN(curTdsAmt)) {
- tdsAmt += curTdsAmt;
- }
- }
- });
- var walletAmt = Number($(".txtTotalWalletAdjusted").val());
- if (!isNaN(walletAmt)) {
- amt += walletAmt;
- }
- var totAdj = Number($(".txtTotalDueAdjusted").val());
- if (totAdj != null && totAdj != undefined && !isNaN(totAdj)) {
- $(".totAdjusted").text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(totAdj, 2));
- }
- else {
- totAdj = 0;
- }
- if (amt != null && amt != undefined && !isNaN(amt)) {
- $("#hf_TotalCreditAmount").val(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(amt, 2));
- $(".totAmount").text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(amt, 2));
- }
- else {
- amt = 0;
- }
- var advanceAmt = amt - totAdj;
- var advAmt = (advanceAmt > 0) ? advanceAmt : 0;
- $('.totAdvance').text(Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(advAmt, 2));
- var totDiscountAmount = Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(discAmt, 2);
- $('.totDiscount').text(totDiscountAmount);
- var totPenalityAmount = Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(penalityAmt, 2);
- $('.totPenality').text(totPenalityAmount);
- var totTDSAmount = Unibase.Core.Helpers.NumberHelper.Instance().roundNumber(tdsAmt, 2);
- $('.totTds').text(totTDSAmount);
- instance.showOrHideAccounts(discAmt, penalityAmt, tdsAmt);
- }
- loadAccounts() {
- var instance = this;
- var discount = 'Discount Account';
- var paymentTypeId = Number($(".hdn_paymenttypeid").val());
- var url = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/ledgerautocomplete';
- var url1 = _appsettings.server_url() + '/apis/v4/bizgaze/transact/ledgers/receiptledgerautocomplete/discount/' + discount + '/paymenttypeid/' + paymentTypeId;
- AutoCompleteHelper.getHelper().Create("#txtAutoComplete_DiscountAccount", "#hfAutoComplete_DiscountAccount", url1, function (response) {
- });
- AutoCompleteHelper.getHelper().Create("#txtAutoComplete_PenalityAccount", "#hfAutoComplete_PenalityAccount", url, null);
- AutoCompleteHelper.getHelper().Create("#txtAutoComplete_TDSAccount", "#hfAutoComplete_TDSAccount", url, null);
- $("#txtAutoComplete_DiscountAccount").on('select2:select', function (e) {
- instance.accountsOnChange(Transact.Enums.PaymentDiscountType.Discount);
- });
- $("#txtAutoComplete_PenalityAccount").on('select2:select', function (e) {
- instance.accountsOnChange(Transact.Enums.PaymentDiscountType.Penalty);
- });
- $("#txtAutoComplete_TDSAccount").on('select2:select', function (e) {
- instance.accountsOnChange(Transact.Enums.PaymentDiscountType.TDS);
- });
- }
- accountsOnChange(accountType) {
- var instance = this;
- var accountId = 0;
- var accountName = "";
- var controlId = "";
- var hiddenFieldControlId = "";
- if (accountType == Transact.Enums.PaymentDiscountType.Discount) {
- accountId = Number($("#txtAutoComplete_DiscountAccount").val());
- accountName = $("#txtAutoComplete_DiscountAccount").text();
- controlId = "#txtAutoComplete_DiscountAccount";
- hiddenFieldControlId = "#hfAutoComplete_DiscountAccount";
- }
- else if (accountType == Transact.Enums.PaymentDiscountType.Penalty) {
- accountId = Number($("#txtAutoComplete_PenalityAccount").val());
- accountName = $("#txtAutoComplete_PenalityAccount").text();
- controlId = "#txtAutoComplete_PenalityAccount";
- hiddenFieldControlId = "#hfAutoComplete_PenalityAccount";
- }
- else if (accountType == Transact.Enums.PaymentDiscountType.TDS) {
- accountId = Number($("#txtAutoComplete_TDSAccount").val());
- accountName = $("#txtAutoComplete_TDSAccount").text();
- controlId = "#txtAutoComplete_TDSAccount";
- hiddenFieldControlId = "#hfAutoComplete_TDSAccount";
- }
- if (accountId == 0)
- accountName = "Select Account";
- if (accountId == 1 || accountId == -1)
- accountName = "Create New";
- if (accountName == "Create New") {
- $("#txtAutoComplete_DiscountAccount").val(null).trigger("change");
- $("#txtAutoComplete_PenalityAccount").val(null).trigger("change");
- $("#txtAutoComplete_TDSAccount").val(null).trigger("change");
- var FormUniqueId = "Bizgaze_Extension_Transact_Ledgers_App_Ledgers_CreateForm";
- var AppConfigurationUnique = "Bizgaze_Extension_Transact_Ledgers_AppConfiguration_CreateLedgers";
- Unibase.Platform.Forms.Managers.FormManager.Instance().getFormbyUniqueId(FormUniqueId).then(function (response) {
- var obj = {
- controlid: controlId,
- hiddenid: hiddenFieldControlId
- };
- var successobj = {
- CallBack: function (id, obj) {
- Bizgaze.Apps.Transact.Managers.LedgerManager.Instance().getLedgerById(id).then(function (response) {
- var createdLedger = new Option(response.result.LedgerName, response.result.LedgerId, true);
- $(obj.controlid + " option").remove();
- $(obj.controlid).append(createdLedger).trigger('change');
- $(obj.hiddenid).val(response.result.LedgerId);
- $(obj.controlid).parents(".transactonList_item").find('.hf_AccountId').val(response.result.LedgerId);
- });
- },
- Parameters: obj,
- };
- var formviewerObj = {
- FormId: response.result.FormId,
- AppConfigurationId: 0,
- Pk_Value: 0,
- PortletWidgetId: 0,
- OnSuccess: successobj,
- OnFail: null,
- OnLoad: null,
- };
- instance.fileCacheHelper.loadJsFile("apps/transact/managers/ledgers/ledgermanager.js", function () {
- Unibase.Platform.Forms.Components.FormViewer.instance.init(formviewerObj);
- });
- });
- }
- }
- bindAccounts(accountsObj) {
- if (accountsObj.DiscountAccountName != null && accountsObj.DiscountAccountName != "" && accountsObj.DiscountAccountName != undefined) {
- var selectedDiscountAcc = new Option(accountsObj.DiscountAccountName, accountsObj.DiscountAccountId, true);
- $("#txtAutoComplete_DiscountAccount").append(selectedDiscountAcc);
- }
- if (accountsObj.PenalityAccountName != null && accountsObj.PenalityAccountName != "" && accountsObj.PenalityAccountName != undefined) {
- var selectedPenalityAcc = new Option(accountsObj.PenalityAccountName, accountsObj.PenalityAccountId, true);
- $("#txtAutoComplete_PenalityAccount").append(selectedPenalityAcc);
- }
- if (accountsObj.TDSAccountName != null && accountsObj.TDSAccountName != "" && accountsObj.TDSAccountName != undefined) {
- var selectedTDSAcc = new Option(accountsObj.TDSAccountName, accountsObj.TDSAccountId, true);
- $("#txtAutoComplete_TDSAccount").append(selectedTDSAcc);
- }
- }
- showOrHideAccounts(discount, penality, tds) {
- if (discount == 0) {
- $("#div_Discount").addClass("hidden");
- $("#txtAutoComplete_DiscountAccount").removeClass("required");
- }
- else {
- $("#div_Discount").removeClass("hidden");
- $("#txtAutoComplete_DiscountAccount").addClass("required");
- }
- if (penality == 0) {
- $("#div_Penality").addClass("hidden");
- $("#txtAutoComplete_PenalityAccount").removeClass("required");
- }
- else {
- $("#div_Penality").removeClass("hidden");
- $("#txtAutoComplete_PenalityAccount").addClass("required");
- }
- if (tds == 0) {
- $("#div_TDS").addClass("hidden");
- $("#txtAutoComplete_TDSAccount").removeClass("required");
- }
- else {
- $("#div_TDS").removeClass("hidden");
- $("#txtAutoComplete_TDSAccount").addClass("required");
- }
- }
- getPaymentByRemoteId(remoteId, netTotal) {
- var sum = 0;
- Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/transact/managers/payments/paymentmanager.js", function () {
- Bizgaze.Apps.Transact.Managers.PaymentManager.Instance().getPaymentByRemoteId(remoteId).then(function (response) {
- var response = response.result;
- if (response != null) {
- for (var i = 0; i < response.length; i++) {
- var data = response[i];
- var totalAmount = data.paymentamount;
- sum = sum + totalAmount;
- }
- var orderAmount = netTotal - sum;
- if (orderAmount > 0) {
- $("#txt_TotalCreditAmount").parent().addClass("floating-label-form-group-with-value");
- $("#txt_TotalCreditAmount").val(orderAmount);
- }
- else {
- $("#txt_TotalCreditAmount").parent().addClass("floating-label-form-group-with-value");
- $("#txt_TotalCreditAmount").val(0);
- }
- }
- else {
- $("#txt_TotalCreditAmount").val(netTotal);
- }
- });
- });
- }
- loadControlSettings(controlsettingjson, formpropertyid) {
- return ``;
- }
- loadPropertySettings(propertysettings, formpropertyid, DocPropertyName) {
- return ``;
- }
- bindEditFormDetails(formpropertyid, propval, DocPropertyName) {
- return ``;
- }
- static Instance() {
- if (this.instance === undefined) {
- this.instance = new PaymentSummary();
- }
- return this.instance;
- }
- }
- Controls.PaymentSummary = PaymentSummary;
- })(Controls = Transact.Controls || (Transact.Controls = {}));
- })(Transact = Apps.Transact || (Apps.Transact = {}));
- })(Apps = Bizgaze.Apps || (Bizgaze.Apps = {}));
- })(Bizgaze || (Bizgaze = {}));
-
- var Unibase;
- (function (Unibase) {
- let Platform;
- (function (Platform) {
- let Apps;
- (function (Apps) {
- let Enums;
- (function (Enums) {
- let AppType;
- (function (AppType) {
- AppType[AppType["App"] = 1] = "App";
- AppType[AppType["Setting"] = 2] = "Setting";
- AppType[AppType["Configuration"] = 3] = "Configuration";
- })(AppType = Enums.AppType || (Enums.AppType = {}));
- })(Enums = Apps.Enums || (Apps.Enums = {}));
- })(Apps = Platform.Apps || (Platform.Apps = {}));
- })(Platform = Unibase.Platform || (Unibase.Platform = {}));
- })(Unibase || (Unibase = {}));
|