12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668 |
- 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 py-1 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 border-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 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 border-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 m-0 p-0 border-0 shadow-none"><div class="h6 card-header align-items-center d-flex p-0 h-100 border-0">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 tdsamount = Number($(this).find('.hfTdsAmount').val());
- var dueAmount = 0;
- if ((discamount == 0) && (tdsamount == 0)) {
- $('.lblDueBalance').val();
- dueAmount = Number($(this).find('.hfDueAmount').val()) - txtDiscountAmount - txtTdsAmount;
- }
- if ((discamount != 0) && (tdsamount != 0)) {
- dueAmount = (Number($(this).find('.hfDueAmount').val()) + tdsamount + discamount) - txtDiscountAmount - txtTdsAmount;
- }
- if ((discamount != 0) && (tdsamount == 0)) {
- dueAmount = (Number($(this).find('.hfDueAmount').val()) + discamount) - txtDiscountAmount - txtTdsAmount;
- }
- if ((discamount == 0) && (tdsamount != 0)) {
- dueAmount = (Number($(this).find('.hfDueAmount').val()) + tdsamount) - 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 = {}));
|