PageSourceSearch

https://live.trueshield.ai/816.ec2470492305b303.js

js trueshield.ai collected 2026-10-05 13:07:38 UTC 82,177 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunktrueshieldai=self.webpackChunktrueshieldai||[]).push([[816],{1816:(tn,P,s)=>{s.r(P),s.d(P,{BillingModule:()=>Qe});var p=s(177),D=s(1188),d=s(4823),k=s(5077),C=s(3092),g=s(5670),t=s(7705),v=s(3871),y=s(5136),_=s(7421),F=s(2788),I=s(8661);function z(a,l){if(1&a&&(t.j41(0,"span",15),t.EFF(1),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.JRh(null==e.userDetails?null:e.userDetails.current_active_currency_code)}}function X(a,l){1&a&&(t.j41(0,"span"),t.EFF(1," Proceed"),t.k0s())}function V(a,l){1&a&&(t.j41(0,"span",16),t.nrm(1,"mat-spinner",17),t.k0s()),2&a&&(t.R7$(1),t.Y8G("diameter",30))}const L=function(a){return{"opacity-5":a}};let H=(()=>{class a{constructor(e,i,n,o,r){this._commonService=e,this._dialog=i,this._apiService=n,this._dialogRef=o,this.data=r,this.formattedAmount="",this.isAmountValid=!1,this.isLoading=!1,this.isInputFocused=!1}ngOnInit(){try{const e=localStorage?.getItem("userDetails");e&&(this.userDetails=JSON?.parse(e)),this.alertBalance=this.data?.balanceData?.alert_balance?.replace(/[^0-9]/g,""),this.alertBalance&&(this.amount=this.alertBalance,this.formattedAmount=this._commonService?.formatWithCommas(this.alertBalance),this.isAmountValid=+this.amount>99)}catch{}}onAmountInput(e){try{let i=e?.target?.value.replace(/\D/g,"");i.startsWith("0")&&(i=i?.substring(1)),this.amount=i,this.formattedAmount=this._commonService?.formatWithCommas(i),e.target.value=this.formattedAmount,this.isAmountValid=+this.amount>=100}catch{}}balanceProceed(){try{(this._dialog?.open(k.D,{disableClose:!0,data:{title:C.$?.confirm,message:C.$?.alertBalance}})).afterClosed().subscribe(i=>{i&&(this.isLoading=!0,this.updateAlertBalance())})}catch{}}updateAlertBalance(){try{const e=g.k?.billing?.updateAlertBalance,i={balance:Number(this.amount),bill_id:this.data?.billingId};this._apiService.post(e,i).subscribe({next:n=>{n?(this._dialogRef?.close({amount:this.amount}),this.isLoading=!1):this.isLoading=!1},error:n=>{this.isLoading=!1,console.error(n)}})}catch(e){this.isLoading=!1,console.error(e)}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(v.h),t.rXU(d.bZ),t.rXU(y.G),t.rXU(d.CP),t.rXU(d.Vh))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-alert-balance-dialog"]],decls:20,vars:11,consts:[["mat-dialog-title","",1,"fnt-weight-600","fnt-size-16","pb-0","mb-0","px-3"],[1,"pb-2"],[1,"text-gray","fnt-size-12","pl-4"],["mat-dialog-content","",1,"message","fnt-size-16","text-gray","letter-space-0"],[1,"input-field"],[1,"w-100","input-field-remove-hover"],[1,"d-flex","justify-content-center","align-items-center"],["class","mr-1",4,"ngIf"],["matInput","","placeholder","Please enter amount","maxlength","10","type","tel",3,"readonly","value","input","focus","blur"],["align","center",1,"pb-4"],[1,"row","col-12","height-50","fnt-size-14"],[1,"col","bg-white","text-blue","border-radius-0","border-blue","letter-space-0","shadow-none","mr-2","focus-none",3,"mat-dialog-close","disabled"],[1,"col","border-0","bg-blue","text-white","border-radius-0","letter-space-0","p-2","shadow-none",3,"disabled","ngClass","click"],[4,"ngIf"],["class","d-flex justify-content-center",4,"ngIf"],[1,"mr-1"],[1,"d-flex","justify-content-center"],[1,"custom-spinner",3,"diameter"]],template:function(i,n){1&i&&(t.j41(0,"h5",0),t.EFF(1," Low Balance Alert\n"),t.k0s(),t.j41(2,"div",1)(3,"i",2),t.EFF(4,"Enter the amount to set your low balance alert"),t.k0s()(),t.j41(5,"div",3)(6,"div",4)(7,"mat-form-field",5)(8,"mat-label"),t.EFF(9,"Amount"),t.k0s(),t.j41(10,"div",6),t.DNE(11,z,2,1,"span",7),t.j41(12,"input",8),t.bIt("input",function(r){return n.onAmountInput(r)})("focus",function(){return n.isInputFocused=!0})("blur",function(){return n.isInputFocused=!1}),t.k0s()()()()(),t.j41(13,"mat-dialog-actions",9)(14,"div",10)(15,"button",11),t.EFF(16," Cancel "),t.k0s(),t.j41(17,"button",12),t.bIt("click",function(){return n.balanceProceed()}),t.DNE(18,X,2,0,"span",13),t.DNE(19,V,2,1,"span",14),t.k0s()()()),2&i&&(t.R7$(11),t.Y8G("ngIf",!(0==(null==n.formattedAmount?null:n.formattedAmount.length)&&!n.isInputFocused)),t.R7$(1),t.Y8G("readonly",n.isLoading)("value",n.formattedAmount),t.R7$(3),t.Y8G("mat-dialog-close",!1)("disabled",n.isLoading),t.R7$(2),t.Y8G("disabled",n.isLoading||!n.isAmountValid)("ngClass",t.eq3(9,L,n.isLoading||!n.isAmountValid)),t.R7$(1),t.Y8G("ngIf",!n.isLoading),t.R7$(1),t.Y8G("ngIf",n.isLoading))},dependencies:[p.YU,p.bT,_.rl,_.nJ,F.fg,I.LG,d.tx,d.BI,d.Yi,d.E7]})}}return a})();var u=s(9417),E=s(2471);function Z(a,l){1&a&&(t.j41(0,"mat-error"),t.EFF(1," UTR ID must be 10 alphanumeric characters. "),t.k0s())}function q(a,l){1&a&&(t.j41(0,"div",21),t.nrm(1,"img",22),t.j41(2,"span",23),t.EFF(3," Drag & Drop Or "),t.j41(4,"b",24),t.EFF(5,"Upload file"),t.k0s()(),t.j41(6,"span",25),t.EFF(7," Supported formats: png, jpg, jpeg, bmp, pdf "),t.k0s()())}function J(a,l){if(1&a){const e=t.RV6();t.j41(0,"div",28)(1,"mat-icon",29),t.nrm(2,"img",30),t.k0s(),t.j41(3,"span",31),t.nrm(4,"input",32),t.k0s(),t.j41(5,"mat-icon",33),t.bIt("click",function(){const o=t.eBV(e).index,r=t.XpG(2);return t.Njj(r.removeFile(o))}),t.EFF(6,"close"),t.k0s()()}if(2&a){const e=l.$implicit,i=l.index;t.R7$(4),t.Mz_("placeholder","Uploaded File ",i+1,""),t.Y8G("value",e.name)}}function W(a,l){if(1&a){const e=t.RV6();t.j41(0,"div",26),t.bIt("keydown.enter",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.onContinueClick())})("dragover",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.handleDrag(n,!0))})("dragleave",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.handleDrag(n,!1))})("drop",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onDrop(n))}),t.DNE(1,J,7,2,"div",27),t.k0s()}if(2&a){const e=t.XpG();t.R7$(1),t.Y8G("ngForOf",e.uploadedFile)}}function K(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Submit"),t.k0s())}function Q(a,l){1&a&&t.nrm(0,"mat-spinner",34),2&a&&t.Y8G("diameter",25)}const tt=function(a){return{"pointer-events":a}};let et=(()=>{class a{constructor(e,i,n,o,r){this._dialog=e,this._dialogRef=i,this._commonService=n,this._apiService=o,this.data=r,this.formattedAmount="",this.isAmountValid=!1,this.uploadedFile=[],this.isFileOver=!1,this.isAnalysisLoader=!1,this.isUploading=!1,this.utrId=""}
1ngOnInit(){}onResize(e){this.eSize=window?.innerWidth}uploadFile(){try{document.getElementById("fileInput")?.click()}catch{}}handleDrag(e,i){e.preventDefault(),e.stopPropagation(),this.isFileOver=i}handleFileInput(e){const i=e.target;if(i?.files&&i.files.length>0){const n=i.files[0];["image/png","image/jpeg","image/jpg","image/bmp","application/pdf"].includes(n.type)?(this.uploadedFile=[n],i.value=""):this._commonService.errorSnackBar("Unsupported file format. Please upload a valid file.")}else this._commonService.errorSnackBar("No file selected.")}onDrop(e){try{e.preventDefault(),e.stopPropagation();const i=e?.dataTransfer?.files;if(i&&i.length>0){const n=i[0];["image/png","image/jpeg","image/jpg","image/bmp","application/pdf"].includes(n.type)?this.uploadedFile=[n]:this._commonService.errorSnackBar("Unsupported file format. Please upload a valid file.")}}catch(i){console.error(i),this._commonService.errorSnackBar("An error occurred during file upload.")}finally{this.isFileOver=!1}}removeFile(e){this.uploadedFile.splice(e,1)}onContinueClick(){try{this.startAnalysis()}catch(e){console.error(e)}}showError(e){try{this._commonService?.errorSnackBar(e)}catch(i){console.error(i),alert(`Error: ${e}`)}}startAnalysis(){if(this.isAnalysisLoader=!0,!this.uploadedFile?.length)return this.showError("No files uploaded. Please upload at least one file."),void(this.isAnalysisLoader=!1);try{const e=this.uploadedFile.map(n=>n);if(!e.length)return this.showError("Error processing files. No valid files found."),void(this.isAnalysisLoader=!1);this.prepareRequestData(e)}catch(e){console.error("Unexpected Error:",e),this.showError("An unexpected error occurred. Please try again."),this.isAnalysisLoader=!1}}prepareRequestData(e){const i=new FormData;try{return e?.forEach((n,o)=>{if(!(n instanceof File))throw new Error(`Invalid file at index ${o}`);i.append("pdfFile",n,n.name)}),i}catch(n){return console.error("Error preparing request data:",n.message),new FormData}}balanceProceed(){try{const i=document.querySelector('input[placeholder="Enter UTR ID"]')?.value?.trim(),n=this.uploadedFile;if(!i&&0===n.length)return void this.showError("Provide a valid UTR ID or payment proof.");const o={title:C.$?.confirm,message:C.$?.upadatePayment,utrId:i,files:n};(this._dialog?.open(k.D,{disableClose:!0,data:o})).afterClosed().subscribe(m=>{if(m){this.isUploading=!0;const f=new FormData;f.append("utr_id",i),f.append("amount",this.data?.formattedAmount),n.forEach(c=>{c instanceof File&&f.append("pdfFile",c,c.name)});const b=g.k?.billing?.addPaymentProof;this._apiService.post(b,f).subscribe({next:c=>{c?(this._commonService.successSnackBar(c?.message||"Success"),this.isUploading=!1,this._dialogRef.close(!0)):this.isUploading=!1},error:c=>{console.error(c),this.isUploading=!1}})}})}catch(e){console.error("Error during confirmation process:",e)}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(d.bZ),t.rXU(d.CP),t.rXU(v.h),t.rXU(y.G),t.rXU(d.Vh))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-payment-update-dialog"]],hostBindings:function(i,n){1&i&&t.bIt("resize",function(r){return n.onResize(r)},!1,t.tSv)},decls:26,vars:17,consts:[["mat-dialog-title","",1,"fnt-weight-600","pb-0"],[1,"fnt-size-12","px-4","text-gray"],["mat-dialog-content","",1,"message","fnt-size-16","text-gray","letter-space-0",3,"ngClass"],[1,"input-field"],[1,"w-100","input-field-remove-hover"],[1,"d-flex","justify-content-center","align-items-center"],["matInput","","name","utrId","placeholder","Enter UTR ID","maxlength","22","minlength","10","type","text","pattern","^[A-Z0-9]{10,22}$",3,"ngModel","readonly","required","ngModelChange"],["utrIdInput","ngModel"],[4,"ngIf"],[1,"line-container","py-1","opacity-5"],[1,"line"],[1,"upload-container-border","mb-4","hand-pointer","w-100",3,"ngStyle","click","dragover","dragleave","drop"],["class","py-5 bg-light-blue my-3 d-flex justify-content-center align-items-center flex-column hand-pointer letter-space-0 border-gray-dashed",4,"ngIf"],["class","border-gray-dashed w-100 p-3",3,"keydown.enter","dragover","dragleave","drop",4,"ngIf"],["type","file","id","fileInput","hidden","","accept",".png, .jpg, .jpeg, .pdf",3,"change"],["align","center",1,"pb-4"],[1,"row","col-12","height-50"],[1,"col","bg-white","text-blue","border-radius-0","border-blue","fnt-size-14","letter-space-0","shadow-none","mr-2","focus-none",3,"disabled","ngClass","mat-dialog-close"],[1,"col","border-0","bg-blue","text-white","border-radius-0","fnt-size-14","letter-space-0","p-2","shadow-none",3,"disabled","ngClass","click"],[1,"d-flex","justify-content-center"],["class","custom-spinner",3,"diameter",4,"ngIf"],[1,"py-5","bg-light-blue","my-3","d-flex","justify-content-center","align-items-center","flex-column","hand-pointer","letter-space-0","border-gray-dashed"],["width","30","src","assets/trialCenter/upload-blue.svg","alt","upload-icon"],[1,"mt-3","fnt-size-14","w-100","text-center"],[1,"text-blue","fnt-weight-400"],[1,"text-gray","fnt-size-10","mt-2"],[1,"border-gray-dashed","w-100","p-3",3,"keydown.enter","dragover","dragleave","drop"],["class","bg-light-blue height-40 px-3 py-2 d-flex align-items-center",4,"ngFor","ngForOf"],[1,"bg-light-blue","height-40","px-3","py-2","d-flex","align-items-center"],[1,"d-flex","align-items-center","file-icon","position-relative"],["width","18","src","assets/trialCenter/PdfIcon.svg","alt","Pdf-icon",1,"align-middle","position-absolute"],[1,"flex-grow-1"],["matInput","","readonly","",1,"fnt-size-14","fnt-weight-600","bg-transparent","border-0","mb-1","ml-2","w-100",3,"value","placeholder"],[1,"fnt-size-16","ml-4","mt-1","d-flex","align-items-center","hand-pointer",3,"click"],[1,"custom-spinner",3,"diameter"]],template:function(i,n){if(1&i&&(t.j41(0,"h2",0),t.EFF(1,"Payment Confirmation"),t.k0s(),t.j41(2,"i",1),t.EFF(3,"Kindly share the UTR ID or payment receipt to proceed with verification\n"),t.k0s(),t.j41(4,"div",2)(5,"div",3)(6,"mat-form-field",4)(7,"div",5)(8,"input",6,7),t.bIt("ngModelChange",function(r){return n.utrId=r}),t.k0s()(),t.DNE(10,Z,2,0,"mat-error",8),t.k0s()(),t.j41(11,"div",9)(12,"span",10),t.EFF(13,"OR"),t.k0s()(),t.j41(14,"div",11),t.bIt("click",function(){return n.uploadFile()})("dragover",function(r){return n.handleDrag(r,!0)})("dragleave",function(r){return n.handleDrag(r,!1)})("drop",function(r){return n.onDrop(r)}),t.DNE(15,q,8,0,"div",12),t.DNE(16,W,2,1,"div",13),t.k0s(),t.j41(17,"input",14),t.bIt("change",function(r){return n.handleFileInput(r)}),t.k0s()(),t.j41(18,"mat-dialog-actions",15)(19,"div",16)(20,"button",17),t.EFF(21," Cancel "),t.k0s(),t.j41(22,"button",18),t.bIt("click",function(){return n.isUploading?"":n.balanceProceed()}),t.DNE(23,K,2,0,"span",8),t.j41(24,"span",19),t.DNE(25,Q,1,1,"mat-spinner",20),t.k0s()()()()),2&i){const o=t.sdS(9);t.R7$(4),t.Y8G("ngClass",n.isUploading?"opacity-5":""),t.R7$(4),t.Y8G("ngModel",n.utrId)("readonly",n.isUploading)("required",!n.uploadedFile.length),t.R7$(2),t.Y8G("ngIf",(null==o?null:o.invalid)&&
1(null==o?null:o.dirty)&&n.utrId),t.R7$(4),t.Y8G("ngStyle",t.eq3(15,tt,n.isUploading?"none":"auto")),t.R7$(1),t.Y8G("ngIf",0===(null==n.uploadedFile?null:n.uploadedFile.length)),t.R7$(1),t.Y8G("ngIf",n.uploadedFile.length>0),t.R7$(4),t.Y8G("disabled",n.isUploading)("ngClass",n.isUploading?"opacity-5":"")("mat-dialog-close",!1),t.R7$(2),t.Y8G("disabled",n.isUploading||(null==o?null:o.invalid))("ngClass",n.isUploading||null!=o&&o.invalid?"opacity-5":""),t.R7$(1),t.Y8G("ngIf",!n.isUploading),t.R7$(2),t.Y8G("ngIf",n.isUploading)}},dependencies:[p.YU,p.Sq,p.bT,p.B3,u.me,u.BC,u.YS,u.xh,u.tU,u.R_,u.vS,_.rl,_.TL,F.fg,I.LG,E.An,d.tx,d.BI,d.Yi,d.E7]})}}return a})();var nt=s(1413),B=s(152),it=s(5484);function at(a,l){if(1&a&&(t.j41(0,"mat-error"),t.EFF(1),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.SpI(" Minimum amount should be ",e.currencySymbol,"500 ")}}function ot(a,l){1&a&&(t.j41(0,"mat-error"),t.EFF(1," Amount is required "),t.k0s())}function lt(a,l){1&a&&(t.j41(0,"mat-hint",12),t.EFF(1," Minimum amount: \u20b9500 "),t.k0s())}function rt(a,l){if(1&a&&(t.j41(0,"span",31),t.EFF(1),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.JRh(e.currencySymbol)}}function st(a,l){if(1&a&&(t.j41(0,"div",20)(1,"div"),t.EFF(2),t.k0s(),t.j41(3,"div"),t.EFF(4),t.k0s()()),2&a){const e=t.XpG();t.R7$(2),t.SpI("CGST (",(null==e.paymentDetails?null:e.paymentDetails.cgst)||"-",")"),t.R7$(2),t.Lme("",e.currencySymbol,"",(null==e.gstData?null:e.gstData.cgst_amount)||0,"")}}function ct(a,l){if(1&a&&(t.j41(0,"div",20)(1,"div"),t.EFF(2),t.k0s(),t.j41(3,"div"),t.EFF(4),t.k0s()()),2&a){const e=t.XpG();t.R7$(2),t.SpI("SGST (",(null==e.paymentDetails?null:e.paymentDetails.sgst)||"-",")"),t.R7$(2),t.Lme("",e.currencySymbol,"",(null==e.gstData?null:e.gstData.sgst_amount)||0,"")}}function dt(a,l){if(1&a&&(t.j41(0,"div",20)(1,"div"),t.EFF(2),t.k0s(),t.j41(3,"div"),t.EFF(4),t.k0s()()),2&a){const e=t.XpG();t.R7$(2),t.SpI("IGST (",(null==e.paymentDetails?null:e.paymentDetails.igst)||"-",")"),t.R7$(2),t.Lme("",e.currencySymbol,"",(null==e.gstData?null:e.gstData.igst_amount)||0,"")}}function mt(a,l){if(1&a){const e=t.RV6();t.j41(0,"div",32)(1,"button",33),t.bIt("click",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.initiatePayment())}),t.EFF(2),t.k0s()()}if(2&a){const e=t.XpG();t.R7$(1),t.Y8G("disabled",e.amountControl.invalid||e.isPaymentProcessing||e.paymentInitiated),t.R7$(1),t.SpI(" ",e.isPaymentProcessing?"Generating link...":e.paymentInitiated?"Processing...":"Pay Now"," ")}}function ut(a,l){if(1&a&&(t.j41(0,"div",26)(1,"div",27),t.EFF(2,"State"),t.k0s(),t.j41(3,"div",29),t.EFF(4),t.nI1(5,"titlecase"),t.k0s()()),2&a){const e=t.XpG();t.R7$(4),t.SpI(" ",t.bMT(5,1,(null==e.billingDetails?null:e.billingDetails.state)||"-")," ")}}function pt(a,l){if(1&a&&(t.j41(0,"div",26)(1,"div",27),t.EFF(2,"GST number"),t.k0s(),t.j41(3,"div",29),t.EFF(4),t.k0s()()),2&a){const e=t.XpG();t.R7$(4),t.JRh((null==e.billingDetails?null:e.billingDetails.gst_number)||"-")}}const gt=function(a){return{"no-currency":a}},_t=function(a){return{"pl-0":a}};let ft=(()=>{class a{constructor(e,i,n,o,r){this._commonService=e,this._dialog=i,this._apiService=n,this._dialogRef=o,this.data=r,this.formattedAmount="",this.isAmountValid=!1,this.amountSubject=new nt.B,this.amountControl=new u.MJ("",[u.k0.required,m=>{const f=+m.value;return f&&f<500?{minAmount:{value:m.value,min:500}}:null}]),this.currencySymbol="\u20b9",this.currentCountry="",this.isPaymentProcessing=!1,this.paymentInitiated=!1,this.isInputFocused=!1,this.showCurrencySymbol=!1,this.subscriptions=[]}onResize(e){this.eSize=window.innerWidth}ngOnInit(){try{this.eSize=window?.innerWidth,this.billingDetails=this.data?.billingDetails,this.paymentDetails=this.data?.paymentDetails,this.payment_option=this.data?.payment_option,this.upiDetails=this.data?.upi,this.setCurrencySymbol(),this.resetInputState(),this.listenForCountryChanges();const e=this.amountSubject?.pipe((0,B.B)(1e3))?.subscribe(n=>{this.getGstDetails(n)});e&&this.subscriptions.push(e);const i=this.amountControl.valueChanges.subscribe(n=>{n&&(this.formattedAmount=this._commonService?.formatWithCommas(n))});this.subscriptions.push(i)}catch{}}resetInputState(){this.isInputFocused=!1,this.amount="",this.formattedAmount="",this.isAmountValid=!1,this.amountControl.reset(),this.updateCurrencySymbolVisibility(),this.isPaymentProcessing=!1,this.paymentInitiated=!1}ngOnChanges(e){e.data&&this.refreshCurrencySymbol()}refreshCurrencySymbol(){try{this.data?.billingDetails&&this.data.billingDetails!==this.billingDetails&&(this.billingDetails=this.data.billingDetails,this.setCurrencySymbol())}catch(e){console.error("Error refreshing currency symbol:",e)}}listenForCountryChanges(){try{this.countryCheckInterval=setInterval(()=>{this.checkCountryChange()},2e3)}catch(e){console.error("Error setting up country change listener:",e)}}checkCountryChange(){try{const e=localStorage?.getItem("userDetails");if(e){const n=JSON?.parse(e)?.current_active_country_title?.trim()?.toLowerCase();n!==this.currentCountry&&(this.currentCountry=n,this.setCurrencySymbol())}}catch(e){console.error("Error checking country change:",e)}}updateCurrencySymbol(e){try{const i=e?.trim()?.toLowerCase();this.currentCountry=i,this.currencySymbol="canada"===i||"usa"===i?"$":"\u20b9"}catch(i){console.error("Error manually updating currency symbol:",i)}}setCurrencySymbol(){try{const e=localStorage?.getItem("userDetails");if(e){const i=JSON?.parse(e);this.currentCountry=i?.current_active_country_title?.trim()?.toLowerCase(),this.currencySymbol="canada"===this.currentCountry||"usa"===this.currentCountry?"$":"\u20b9"}else this.setCurrencyFromBillingDetails()}catch(e){console.error("Error setting currency symbol from user profile:",e),this.setCurrencyFromBillingDetails()}}setCurrencyFromBillingDetails(){try{if(this.billingDetails?.country){const e=this.billingDetails.country?.trim()?.toLowerCase();this.currentCountry=e,this.currencySymbol="canada"===e||"usa"===e?"$":"\u20b9"}else this.currencySymbol="\u20b9",this.currentCountry="india"}catch(e){console.error("Error setting currency from billing details:",e),this.currencySymbol="\u20b9",this.currentCountry="india"}}getCurrencySymbol(){return this.currencySymbol}getCurrentCountry(){return this.currentCountry}getGstDetails(e){try{const i={amount:e},n=g.k?.billing?.getPaymentDetails;this._apiService.get(n,i).subscribe({next:o=>{o&&(this.gstData=o?.data?.paymentDetails)}})}catch{}}onAmountInput(e){try{let i=e?.target?.value?.replace(/\D/g,"");i.startsWith("0")&&(i=i?.substring(1)),this.amount=i,this.formattedAmount=this._commonService?.formatWithCommas(i),this.isAmountValid=+this.amount>=5,this.amountSubject.next(this.amount),this.amountControl.setValue(i),e.target.value=this.formattedAmount,this.updateCurrencySymbolVisibility()}catch(i){console.error(i)}}onInputFocus(){this.isInputFocused=!0,this.showCurrencySymbol=!0}onInputBlur(){this.isInputFocused=!1,this.amountControl.markAsTouched(),this.updateCurrencySymbolVisibility()}updateCurrencySymbolVisibility(){this.showCurrencySymbol=this.isInputFocused||this.amount&&this.amount.length>0&&"0"!==this.amount}clearAmount(){this.amount="",this.formattedAmount="",this.isAmountValid=!1,this.updateCurrencySymbolVisibility()}showCurrency(){this.showCurrencySymbol=!0}hideCurrency(){this.showCurrencySymbol=!1}confirmationPaymentUpdate(){try{(this._dialog?.open(et,{disableClose:!0,width:"500px",data:{formattedAmount:this.formattedAmount}})).afterClosed()?.subscribe(i=>{i&&this._dialogRef.close(!0)})}catch{}}initiatePayment(){try{if(this.paymentInitiated)return void console.log("Payment already initiated, preventing duplicate transaction");if(this.amountControl.invalid||!this.amount)return this.amountControl.markAsTouched(),void this._commonService.errorSnackBar("Please enter a valid amount");if(!this.gstData?.total_amount)return void this._commonService.errorSnackBar("Total payable amount is not available. Please wait for calculation.");const e=Number(this.gstData.total_amount);if(!e||e<=0)return void this._commonService.errorSnackBar("Invalid total payable amount");const i=Number(this.amount);if(!i||i<=0)return void this._commonService.errorSnackBar("Invalid amount");this.paymentInitiated=!0,this.isPaymentProcessing=!0;const n=g.k?.billing?.makePayment;this._apiService.post(n,{amount:e,net_amount:i}).subscribe({next:r=>{this.isPaymentProcessing=!1;const m=r?.data?.payment_link;m?(this._commonService.successSnackBar("Redirecting to secure payment page..."),window.location.href=m):(this.paymentInitiated=!1,this._commonService.errorSnackBar("Payment link is missing in the response"))},error:r=>{this.isPaymentProcessing=!1,this.paymentInitiated=!1,this._commonService.errorSnackBar(r?.error?.message||"Payment failed. Please try again.")}})}catch(e){this.isPaymentProcessing=!1,this.paymentInitiated=!1,console.error(e)}}
1ngOnDestroy(){try{this.subscriptions.forEach(e=>{e&&!e.closed&&e.unsubscribe()}),this.subscriptions=[],this.countryCheckInterval&&(clearInterval(this.countryCheckInterval),this.countryCheckInterval=null),this.amountSubject&&this.amountSubject.complete()}catch(e){console.error("Error in ngOnDestroy:",e)}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(v.h),t.rXU(d.bZ),t.rXU(y.G),t.rXU(d.CP),t.rXU(d.Vh))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-add-balance-dialog"]],hostBindings:function(i,n){1&i&&t.bIt("resize",function(r){return n.onResize(r)},!1,t.tSv)},features:[t.OA$],decls:73,vars:29,consts:[[1,"set-dialog-height"],[1,"d-flex","justify-content-between","align-items-center","w-100"],[1,"d-flex","flex-column"],["mat-dialog-title","",1,"fnt-weight-600","fnt-size-16","pb-0","mb-0","px-3"],[1,"fnt-size-12","text-gray","pl-4"],["mat-dialog-close","",1,"hand-pointer","text-gray","mr-3"],["mat-dialog-content","",1,"fnt-size-16","letter-space-0"],[1,"row","px-0","mx-0"],[1,"col-12","col-lg-6","px-0","pr-lg-4"],[1,"info-card","h-100"],[1,"pb-2"],[1,"section-title"],[1,"text-gray","fnt-size-12"],[1,"input-field"],[1,"w-100","input-field-remove-hover"],[1,"fnt-size-14"],["matInput","","placeholder","Please enter amount (minimum \u20b9500)","maxlength","10","type","tel",1,"letter-space-0","amount-input",3,"ngClass","formControl","input","focus","blur"],[4,"ngIf"],["class","text-gray fnt-size-12",4,"ngIf"],["class","currency-symbol",4,"ngIf"],[1,"d-flex","flex-row","justify-content-between","text-gray","fnt-size-12","pb-2"],["class","d-flex flex-row justify-content-between text-gray fnt-size-12 pb-2",4,"ngIf"],[1,"d-flex","flex-row","justify-content-between","text-dark","fnt-size-14","fnt-weight-600","pb-2"],["class","d-flex justify-content-end mt-3",4,"ngIf"],[1,"col-12","col-lg-6","pr-0","mt-4","mt-lg-0",3,"ngClass"],[1,"border-gray","bg-lightgray","p-3","rounded","info-card-body"],[1,"d-flex","flex-row","justify-content-between","fnt-size-12","pb-2"],[1,"text-gray","pr-3"],[1,"text-wrap","text-break","text-right"],[1,"text-dark"],["class","d-flex flex-row justify-content-between fnt-size-12 pb-2",4,"ngIf"],[1,"currency-symbol"],[1,"d-flex","justify-content-end","mt-3"],["mat-raised-button","","type","button",1,"bg-blue","text-white","border-radius-0","fnt-size-12","letter-space-0","shadow-none","px-4","py-2","pay-now-btn",3,"disabled","click"]],template:function(i,n){1&i&&(t.j41(0,"div",0)(1,"div",1)(2,"div",2)(3,"h5",3),t.EFF(4," Add Balance "),t.k0s(),t.j41(5,"i",4),t.EFF(6,"Add balance effortlessly with secure payment and billing options"),t.k0s()(),t.j41(7,"mat-icon",5),t.EFF(8,"close"),t.k0s()(),t.j41(9,"div",6)(10,"div",7)(11,"div",8)(12,"div",9)(13,"div",10)(14,"div",11),t.EFF(15," Payment Summary "),t.k0s(),t.j41(16,"i",12),t.EFF(17," Enter the amount to get a detailed summary"),t.k0s()(),t.j41(18,"div",13)(19,"mat-form-field",14)(20,"mat-label",15),t.EFF(21,"Amount"),t.k0s(),t.j41(22,"input",16),t.bIt("input",function(r){return n.onAmountInput(r)})("focus",function(){return n.onInputFocus()})("blur",function(){return n.onInputBlur()}),t.k0s(),t.DNE(23,at,2,1,"mat-error",17),t.DNE(24,ot,2,0,"mat-error",17),t.DNE(25,lt,2,0,"mat-hint",18),t.k0s(),t.DNE(26,rt,2,1,"span",19),t.k0s(),t.j41(27,"div",20)(28,"div"),t.EFF(29,"Amount"),t.k0s(),t.j41(30,"div"),t.EFF(31),t.k0s()(),t.DNE(32,st,5,3,"div",21),t.DNE(33,ct,5,3,"div",21),t.DNE(34,dt,5,3,"div",21),t.j41(35,"div",22)(36,"div"),t.EFF(37,"Total payable amount"),t.k0s(),t.j41(38,"div"),t.EFF(39),t.k0s()(),t.DNE(40,mt,3,2,"div",23),t.k0s()(),t.j41(41,"div",24)(42,"div",9)(43,"div",10)(44,"div",11),t.EFF(45," Billing Details "),t.k0s(),t.j41(46,"i",12),t.EFF(47,"Check your billing information here"),t.k0s()(),t.j41(48,"div",25)(49,"div",26)(50,"div",27),t.EFF(51,"Company name"),t.k0s(),t.j41(52,"div",28),t.EFF(53),t.nI1(54,"titlecase"),t.k0s()(),t.j41(55,"div",26)(56,"div",27),t.EFF(57,"Phone number"),t.k0s(),t.j41(58,"div",29),t.EFF(59),t.k0s()(),t.j41(60,"div",26)(61,"div",27),t.EFF(62,"Email"),t.k0s(),t.j41(63,"div",29),t.EFF(64),t.k0s()(),t.DNE(65,ut,6,3,"div",30),t.DNE(66,pt,5,1,"div",30),t.j41(67,"div",26)(68,"div",27),t.EFF(69,"Address"),t.k0s(),t.j41(70,"div",28),t.EFF(71),t.nI1(72,"titlecase"),t.k0s()()()()()()()()),2&i&&(t.R7$(22),t.Y8G("ngClass",t.eq3(25,gt,!n.showCurrencySymbol))("formControl",n.amountControl),t.R7$(1),t.Y8G("ngIf",n.amountControl.hasError("minAmount")),t.R7$(1),t.Y8G("ngIf",n.amountControl.hasError("required")),t.R7$(1),t.Y8G("ngIf",!n.amountControl.hasError("minAmount")&&!n.amountControl.hasError("required")),t.R7$(1),t.Y8G("ngIf",n.showCurrencySymbol),t.R7$(5),t.Lme("",n.currencySymbol,"",(null==n.gstData?null:n.gstData.amount)||0,""),t.R7$(1),t.Y8G("ngIf",null==n.paymentDetails?null:n.paymentDetails.cgst),t.R7$(1),t.Y8G("ngIf",null==n.paymentDetails?null:n.paymentDetails.sgst),t.R7$(1),t.Y8G("ngIf",null==n.paymentDetails?null:n.paymentDetails.igst),t.R7$(5),t.Lme("",n.currencySymbol,"",(null==n.gstData?null:n.gstData.total_amount)||0,""),t.R7$(1),t.Y8G("ngIf",n.isAmountValid&&(null==n.gstData?null:n.gstData.total_amount)),t.R7$(1),t.Y8G("ngClass",t.eq3(27,_t,n.eSize<600)),t.R7$(12),t.SpI(" ",t.bMT(54,21,(null==n.billingDetails?null:n.billingDetails.company_name)||"-")," "),t.R7$(6),t.SpI(" ",(null==n.billingDetails?null:n.billingDetails.phone_number)||"-"," "),t.R7$(5),t.SpI(" ",(null==n.billingDetails?null:n.billingDetails.email.toLowerCase())||"-"," "),t.R7$(1),t.Y8G("ngIf",null==n.billingDetails?null:n.billingDetails.state),t.R7$(1),t.Y8G("ngIf",null==n.billingDetails?null:n.billingDetails.gst_number),t.R7$(5),t.SpI(" ",t.bMT(72,23,(null==n.billingDetails?null:n.billingDetails.address)||"-")," "))},dependencies:[p.YU,p.bT,u.me,u.BC,u.tU,_.rl,_.nJ,_.MV,_.TL,F.fg,it.$z,u.l_,E.An,d.tx,d.BI,d.Yi,p.PV],styles:[".info-card[_ngcontent-%COMP%]{border:1px solid #e6e6eb;border-radius:12px;padding:20px;background-color:#fff;box-shadow:0 8px 20px #00000008}.info-card-body[_ngcontent-%COMP%]{background-color:#f9fafc;border-radius:10px}.section-title[_ngcontent-%COMP%]{font-size:16px;font-weight:600;color:#1f1f1f}.currency-symbol[_ngcontent-%COMP%]{position:absolute;
1left:20px;top:50%;transform:translateY(-50%);color:#000000de;font-size:16px;font-weight:500;z-index:10;pointer-events:none;-webkit-user-select:none;user-select:none;font-family:Roboto,sans-serif;transition:all .2s ease;opacity:1}.currency-symbol.ng-hide[_ngcontent-%COMP%]{opacity:0;transform:translateY(-50%) scale(.8)}.mat-form-field.mat-focused[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{color:#1976d2}.mat-form-field.mat-form-field-invalid[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{color:#f44336}.position-relative[_ngcontent-%COMP%]{position:relative}.amount-input[_ngcontent-%COMP%]{padding-left:28px!important;width:100%;border:none;outline:none;transition:padding-left .2s ease}.input-field[_ngcontent-%COMP%]{position:relative}.amount-input.no-currency[_ngcontent-%COMP%]{padding-left:8px!important}.input-field[_ngcontent-%COMP%]   .mat-form-field[_ngcontent-%COMP%]{position:relative}.input-field[_ngcontent-%COMP%]   .mat-form-field[_ngcontent-%COMP%]   .mat-form-field-infix[_ngcontent-%COMP%]{padding-left:0;padding-right:0}.input-field[_ngcontent-%COMP%]   input.mat-input-element[_ngcontent-%COMP%]{padding-left:28px;transition:padding-left .2s ease}.input-field[_ngcontent-%COMP%]   input.mat-input-element.no-currency[_ngcontent-%COMP%]{padding-left:8px}.input-field[_ngcontent-%COMP%]   .mat-form-field-wrapper[_ngcontent-%COMP%], .input-field[_ngcontent-%COMP%]   .mat-form-field-flex[_ngcontent-%COMP%]{position:relative}.mat-form-field-appearance-outline[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{left:12px}.mat-form-field-appearance-fill[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{left:8px}.input-field[_ngcontent-%COMP%]   .mat-form-field-label[_ngcontent-%COMP%]{margin-left:0}.input-field[_ngcontent-%COMP%]   .mat-form-field-label-wrapper[_ngcontent-%COMP%]{padding-left:0}.input-field[_ngcontent-%COMP%]   .mat-form-field-infix[_ngcontent-%COMP%]{margin-left:0}.input-field[_ngcontent-%COMP%]   .position-relative[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{left:8px;top:50%;transform:translateY(-50%)}.input-field[_ngcontent-%COMP%]   .mat-form-field-infix[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{padding-left:28px!important;transition:padding-left .2s ease}.input-field[_ngcontent-%COMP%]   .mat-form-field-label-wrapper[_ngcontent-%COMP%]   .mat-form-field-label[_ngcontent-%COMP%]{transform:translateY(-1.28125em) scale(.75);transform-origin:left top}@media (max-width: 600px){.currency-symbol[_ngcontent-%COMP%]{left:6px;font-size:14px}.amount-input[_ngcontent-%COMP%]{padding-left:24px!important}.amount-input.no-currency[_ngcontent-%COMP%]{padding-left:6px!important}.input-field[_ngcontent-%COMP%]   input.mat-input-element[_ngcontent-%COMP%]{padding-left:24px}.input-field[_ngcontent-%COMP%]   input.mat-input-element.no-currency[_ngcontent-%COMP%]{padding-left:6px}.mat-form-field-appearance-outline[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{left:10px}.mat-form-field-appearance-fill[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%], .input-field[_ngcontent-%COMP%]   .position-relative[_ngcontent-%COMP%]   .currency-symbol[_ngcontent-%COMP%]{left:6px}.input-field[_ngcontent-%COMP%]   .mat-form-field-infix[_ngcontent-%COMP%]   input[_ngcontent-%COMP%]{padding-left:24px!important}}.pay-now-btn[_ngcontent-%COMP%]{min-width:140px;transition:opacity .2s ease}.pay-now-btn[disabled][_ngcontent-%COMP%]{opacity:.6;cursor:not-allowed}mat-error[_ngcontent-%COMP%]{font-size:12px;color:#f44336;margin-top:4px;transition:all .3s ease-in-out;animation:_ngcontent-%COMP%_slideInError .3s ease-out}@keyframes _ngcontent-%COMP%_slideInError{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.mat-input-invalid[_ngcontent-%COMP%]{border-color:#f44336!important}.input-field[_ngcontent-%COMP%]   mat-error[_ngcontent-%COMP%]{position:relative;z-index:1;margin-bottom:8px}"]})}}return a})();var ht=s(6697),R=s(6354),$=s(9437),S=s(7673),T=s(3294),w=s(5558),G=s(4883),M=s(2836),N=s(5230),j=s(8604);function yt(a,l){if(1&a&&(t.j41(0,"mat-option",37),t.EFF(1),t.k0s()),2&a){const e=l.$implicit;t.Y8G("value",e),t.R7$(1),t.SpI(" ",e," ")}}function bt(a,l){1&a&&(t.j41(0,"mat-error",38),t.EFF(1," Company name is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Ct(a,l){if(1&a&&(t.j41(0,"span",39),t.EFF(1),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.SpI(" ",(null==e.userDetails?null:e.userDetails.current_active_country_code)||91," ")}}function vt(a,l){if(1&a&&(t.j41(0,"mat-error",39),t.EFF(1),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.SpI(" Please enter a valid ",e.getPhoneLength(),"-digit phone number ")}}function Dt(a,l){1&a&&(t.j41(0,"mat-error",38),t.EFF(1," Address is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Ft(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Email is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function It(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Enter a valid email address"),t.k0s())}function St(a,l){if(1&a&&(t.j41(0,"mat-error",38),t.DNE(1,Ft,4,0,"span",34),t.DNE(2,It,2,0,"span",34),t.k0s()),2&a){t.XpG();const e=t.sdS(43);t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.required),t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.email)}}function jt(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"GST number is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function kt(a,l){1&a&&(t.j41(0,"span"),t.EFF(1," Please enter a valid GST number (e.g., 12ABCDE3456Z1Z)"),t.k0s())}function Et(a,l){if(1&a&&(t.j41(0,"mat-error",38),t.DNE(1,jt,4,0,"span",34),t.DNE(2,kt,2,0,"span",34),t.k0s()),2&a){t.XpG();const e=t.sdS(6);t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.required),t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.pattern)}}const x=function(a){return{"opacity-5":a}};function Bt(a,l){if(1&a){const e=t.RV6();t.j41(0,"div",6)(1,"mat-form-field",26)(2,"mat-label"),t.EFF(3,"GST number"),t.k0s(),t.j41(4,"div",8)(5,"input",40,41),t.bIt("input",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onInputChange(n,"gst"))})("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.gstNumber=n)})("ngModelChange",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.gstNumber=n.gstNumber.toUpperCase())}),t.k0s()(),t.DNE(7,Et,3,2,"mat-error",14),t.k0s()()}if(2&a){const e=t.sdS(6),i=t.XpG();t.R7$(1),t.Y8G("ngClass",t.eq3(6,x,null==i.data?null:i.data.gst_number)),t.R7$(4),t.Y8G("disabled",i.loader)("ngModel",i.gstNumber)("pattern","^\\d{2}[A-Z]{5}\\d{4}[A-Z]{1}\\d{1}[A-Z\\d]{1}[A-Z\\d]{1}$")("readonly",!(null==i.data||!i.data.gst_number)),t.R7$(2),t.Y8G("ngIf",e.invali
1d&&e.touched)}}function Gt(a,l){if(1&a&&(t.j41(0,"mat-option",42),t.EFF(1),t.nI1(2,"titlecase"),t.k0s()),2&a){const e=l.$implicit;t.Y8G("value",null==e?null:e.id),t.R7$(1),t.SpI(" ",t.bMT(2,2,null==e?null:e.title)," ")}}function xt(a,l){1&a&&(t.j41(0,"mat-error",38),t.EFF(1," State is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Pt(a,l){1&a&&(t.j41(0,"span"),t.EFF(1," Proceed"),t.k0s())}function Rt(a,l){1&a&&t.nrm(0,"mat-spinner",43),2&a&&t.Y8G("diameter",25)}const $t=function(a){return{"pl-0":a}},Tt=function(a,l){return{"mr-2":a,"opacity-5":l}};let Y=(()=>{class a{onResize(e){this.eSize=window.innerWidth}constructor(e,i,n,o,r){this._commonService=e,this._dialog=i,this._dialogRef=n,this._apiService=o,this.data=r,this.formattedAmount="",this.isAmountValid=!1,this.isInputFocused=!1,this.filteredCompanies=[],this.loader=!1,this.companyName="",this.phoneNumber="",this.address="",this.email="",this.gstNumber="",this.state="",this.country="",this.countryStatus=!1,this.stateType=[],this.isPhoneTouched=!1}ngOnInit(){this.eSize=window.innerWidth;const e=localStorage?.getItem("userDetails");if(e&&(this.userDetails=JSON?.parse(e)),this.getStateListData(),this.data){const i=this.data;this.companyName=i?.company_name||"",this.phoneNumber=i?.phone_number||"",this.address=i?.address||"",this.email=i?.email||"",this.gstNumber=i?.gst_number||"",this.state=i?.state||"",this.country=i?.country||"All",this.billingId=i?.id,this.state_id=i?.state_id}}onAmountInput(e){try{const i=e?.target?.value.replace(/\D/g,"");this.amount=i,this.formattedAmount=this._commonService?.formatWithCommas(i),e.target.value=this.formattedAmount,this.isAmountValid=+this.amount>=100}catch{}}updateBill(){try{(this._dialog?.open(k.D,{disableClose:!0,data:{title:C.$?.confirm,message:C.$?.upadatebill}})).afterClosed().subscribe(i=>{i&&this.updateBillDetails()})}catch{}}updateBillDetails(){try{this.loader=!0;const e={id:this.billingId,company_name:this._commonService.trimExtraSpaces(this.companyName),email:this.email,phone_number:this.phoneNumber,gst_number:this.gstNumber,address:this._commonService.trimExtraSpaces(this.address),state_id:this.state_id,country_id:this.data?.country_id},i=g.k?.billing?.createBill;this._apiService.post(i,e).subscribe({next:n=>{this._commonService.successSnackBar(n?.message),n?(this._dialogRef.close(!0),this.loader=!1):this.loader=!1},error:n=>{console.error(n),this.loader=!1}})}catch{this.loader=!1}}validatePhoneNumber(e){const i=e?.key?.charCodeAt(0);(i<48||i>57)&&e.preventDefault()}onInputChange(e,i=""){try{if("gst"===i){let n=e.target.value.trim();n=n.replace(/[^A-Za-z0-9\s]/g,""),e.target.value=n}else this._commonService.removeInputSpaces(e)}catch{}}isFormValid(){try{const e=/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d{1}[A-Z\d]{1}[A-Z\d]{1}$/,i="canada"===this.country?.toLowerCase()||"usa"===this.country?.toLowerCase()||"uae"===this.country?.toLowerCase()||""!==this.gstNumber?.trim()&&e?.test(this.gstNumber);let n;return n="+1"===this.userDetails?.current_active_country_code?/^[2-9]\d{9}$/:"+971"===this.userDetails?.current_active_country_code?/^[2-9]\d{7}$/:/^[6-9]\d{9}$/,""!==this.companyName.trim()&&""!==this.phoneNumber.trim()&&n?.test(this.phoneNumber)&&""!==this.address.trim()&&""!==this.email.trim()&&/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(this.email)&&i&&null!=this.state_id&&""!==this.state_id}catch(e){return console.error(e),!1}}getCompanySuggestions(e){try{return this._apiService.get(`${g.k?.auth?.companyList}?company_name=${encodeURIComponent(e)}`).pipe((0,R.T)(i=>{try{return i?.data?.companyList?.map(n=>n?.companyName)||[]}catch(n){return console.error(n),[]}}),(0,$.W)(i=>(console.error(i),(0,S.of)([]))))}catch{return(0,S.of)([])}}onCompanyNameChange(e){try{e&&e?.length>2?this.getCompanySuggestions(e).pipe((0,B.B)(500),(0,T.F)(),(0,w.n)(()=>this.getCompanySuggestions(e)))?.subscribe(i=>{this.filteredCompanies=i}):this.filteredCompanies=[]}catch(i){console.error(i)}}onCompanySelected(e){try{const i=e?.option?.value;this.companyName=i}catch(i){console.error(i)}}getStateListData(){try{const e=g.k?.common?.getAllStatus;this._apiService.get(e,{type:G.iI?.STATE_TYPE,main_id:this.data?.country_id}).subscribe({next:n=>{n&&(this.stateType=n?.data?.allStatus)}})}catch(e){console.error(e)}}getStateList(e){this.countryStatus=e?.value}onPhoneInput(e){try{const i=e?.target?.value?.replace(/\D/g,"");e.target.value=i,this.userDetails.user_phone=i,"+91"===this.userDetails?.current_active_country_code?i.length>0&&!/^[6-9]\d{0,9}$/.test(i)&&(e.target.value=i?.slice(0,-1),this.userDetails.user_phone=i?.slice(0,-1)):"+1"===this.userDetails?.current_active_country_code?i.length>0&&!/^[2-9]\d{0,9}$/.test(i)&&(e.target.value=i?.slice(0,-1),this.userDetails.user_phone=i?.slice(0,-1)):"+971"===this.userDetails?.current_active_country_code&&i.length>0&&!/^[2-9]\d{0,7}$/.test(i)&&(e.target.value=i?.slice(0,-1),this.userDetails.user_phone=i?.slice(0,-1))}catch(i){console.error(i)}}isPhoneNumberInvalid(){const e=this.userDetails?.user_phone||"",i=this.userDetails?.current_active_country_code;return""===e||("+91"===i?!/^[6-9]\d{9}
1$/.test(e):"+1"===i?!/^[2-9]\d{9}$/.test(e):"+971"===i?!/^[2-9]\d{7}$/.test(e):e.length<8)}getMaxLength(){return"+971"===this.userDetails?.current_active_country_code?8:10}getPhoneLength(){return"+971"===this.userDetails?.current_active_country_code?8:10}onInputBlur(){this.isInputFocused=!1,this.isPhoneTouched=!0}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(v.h),t.rXU(d.bZ),t.rXU(d.CP),t.rXU(y.G),t.rXU(d.Vh))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-update-billing-dialog"]],hostBindings:function(i,n){1&i&&t.bIt("resize",function(r){return n.onResize(r)},!1,t.tSv)},decls:62,vars:40,consts:[["mat-dialog-title","",1,"fnt-weight-600","fnt-size-16","pb-0","mb-0","px-3"],[1,"pb-2"],[1,"text-gray","fnt-size-12","pl-4"],[1,"message","fnt-size-16","text-gray","letter-space-0","p-3"],[1,"row","px-0","mx-0","h-100"],[1,"col","px-0","mx-0","h-100"],[1,"input-field"],[1,"w-100","input-field-remove-hover","opacity-5"],[1,"d-flex","justify-content-center","align-items-center"],["matInput","","placeholder","Please enter company name","maxlength","50","type","text","required","",3,"ngModel","disabled","matAutocomplete","readonly","ngModelChange"],["companyNameInput","ngModel"],[3,"optionSelected"],["auto","matAutocomplete"],[3,"value",4,"ngFor","ngForOf"],["class","m-0",4,"ngIf"],[1,"input-field","mb-4"],[1,"w-100","input-field-remove-hover","filter-padding-remove"],["class","fnt-size-14",4,"ngIf"],["type","tel","matInput","","placeholder","Enter phone number",1,"pl-1","fnt-size-14",3,"disabled","maxlength","ngModel","ngModelChange","input","focus","blur"],[1,"w-100","input-field-remove-hover"],["matInput","","required","","placeholder","Please enter address","rows","5",2,"resize","none","overflow-y","auto",3,"ngModel","disabled","ngModelChange"],["addressInput","ngModel"],[1,"col","pr-0","h-100",3,"ngClass"],["matInput","","placeholder","Please enter email","maxlength","50","type","text","required","","email","",3,"disabled","ngModel","ngModelChange","input"],["emailInput","ngModel"],["class","input-field",4,"ngIf"],[1,"w-100","input-field-remove-hover",3,"ngClass"],["required","",1,"fnt-size-14","fnt-weight-600","letter-space-0",3,"ngModel","disabled","ngModelChange","selectionChange"],["stateInput","ngModel"],["class","font-weight-300 fnt-size-12 letter-space-0",3,"value",4,"ngFor","ngForOf"],[1,"pb-4","px-0","mx-0"],[1,"row","px-4","mx-0","col-12","col-md-12","height-50","justify-content-end"],[1,"col-6","col-md-2","bg-white","text-blue","border-radius-0","border-blue","fnt-size-14","letter-space-0","shadow-none","focus-none",3,"disabled","ngClass","mat-dialog-close"],[1,"col-6","col-md-2","bg-blue","text-white","border-radius-0","border-0","fnt-size-14","letter-space-0","shadow-none",3,"disabled","ngClass","click"],[4,"ngIf"],[1,"d-flex","justify-content-center"],["class","custom-spinner",3,"diameter",4,"ngIf"],[3,"value"],[1,"m-0"],[1,"fnt-size-14"],["matInput","","placeholder","Please enter GST number","maxlength","15","type","text","required","",3,"disabled","ngModel","pattern","readonly","input","ngModelChange"],["gstNumberInput","ngModel"],[1,"font-weight-300","fnt-size-12","letter-space-0",3,"value"],[1,"custom-spinner",3,"diameter"]],template:function(i,n){if(1&i&&(t.j41(0,"h5",0),t.EFF(1," Update Billing Details\n"),t.k0s(),t.j41(2,"div",1)(3,"i",2),t.EFF(4,"Review and update your billing information for accuracy"),t.k0s()(),t.j41(5,"div",3)(6,"div",4)(7,"div",5)(8,"div",6)(9,"mat-form-field",7)(10,"mat-label"),t.EFF(11,"Company name"),t.k0s(),t.j41(12,"div",8)(13,"input",9,10),t.bIt("ngModelChange",function(r){return n.companyName=r})("ngModelChange",function(r){return n.onCompanyNameChange(r)}),t.k0s(),t.j41(15,"mat-autocomplete",11,12),t.bIt("optionSelected",function(r){return n.onCompanySelected(r)}),t.DNE(17,yt,2,2,"mat-option",13),t.k0s()(),t.DNE(18,bt,4,0,"mat-error",14),t.k0s()(),t.j41(19,"div",15)(20,"mat-form-field",16)(21,"mat-label"),t.EFF(22,"Phone number"),t.k0s(),t.j41(23,"div",8),t.DNE(24,Ct,2,1,"span",17),t.j41(25,"input",18),t.bIt("ngModelChange",function(r){return n.phoneNumber=r})("input",function(r){return n.onPhoneInput(r)})("focus",function(){return n.isInputFocused=!0})("blur",function(){return n.onInputBlur()}),t.k0s()()(),t.DNE(26,vt,2,1,"mat-error",17),t.k0s(),t.j41(27,"div",6)(28,"mat-form-field",19)(29,"mat-label"),t.EFF(30,"Address"),t.k0s(),t.j41(31,"div",8)(32,"textarea",20,21),t.bIt("ngModelChange",function(r){return n.address=r}),t.EFF(34,"            "),t.k0s()(),t.DNE(35,Dt,4,0,"mat-error",14),t.k0s()()(),t.j41(36,"div",22)(37,"div",6)(38,"mat-form-field",19)(39,"mat-label"),t.EFF(40,"Email"),t.k0s(),t.j41(41,"div",8)(42,"input",23,24),t.bIt("ngModelChange",function(r){return n.email=r})("input",function(r){return n.onInputChange(r)}),t.k0s()(),t.DNE(44,St,3,2,"mat-error",14),t.k0s()(),t.DNE(45,Bt,8,8,"div",25),t.j41(46,"div",6)(47,"mat-form-field",26)(48,"mat-label"),t.EFF(49,"State"),t.k0s(),t.j41(50,"mat-select",27,28),t.bIt("ngModelChange",function(r){return n.state_id=r})("selectionChange",function(r){return n.getStateList(r)}),t.DNE(52,Gt,3,4,"mat-option",29),t.k0s(),t.DNE(53,xt,4,0,"mat-error",14),t.k0s()()()()(),t.j41(54,"mat-dialog-actions",30)(55,"div",31)(56,"button",32),t.EFF(57," Cancel "),t.k0s(),t.j41(58,"button",33),t.bIt("click",function(){return n.loader?"":n.updateBill
1()}),t.DNE(59,Pt,2,0,"span",34),t.j41(60,"span",35),t.DNE(61,Rt,1,1,"mat-spinner",36),t.k0s()()()()),2&i){const o=t.sdS(14),r=t.sdS(16),m=t.sdS(33),f=t.sdS(43),b=t.sdS(51);t.R7$(13),t.Y8G("ngModel",n.companyName)("disabled",n.loader)("matAutocomplete",r)("readonly",!0),t.R7$(4),t.Y8G("ngForOf",n.filteredCompanies),t.R7$(1),t.Y8G("ngIf",o.invalid&&o.touched),t.R7$(6),t.Y8G("ngIf",!(0==(null==n.phoneNumber?null:n.phoneNumber.length)&&!n.isInputFocused)),t.R7$(1),t.Y8G("disabled",n.loader)("maxlength",n.getMaxLength())("ngModel",n.phoneNumber),t.R7$(1),t.Y8G("ngIf",n.isPhoneTouched&&n.isPhoneNumberInvalid()),t.R7$(6),t.Y8G("ngModel",n.address)("disabled",n.loader),t.R7$(3),t.Y8G("ngIf",m.invalid&&m.touched),t.R7$(1),t.Y8G("ngClass",t.eq3(31,$t,n.eSize<600)),t.R7$(6),t.Y8G("disabled",n.loader)("ngModel",n.email),t.R7$(2),t.Y8G("ngIf",f.invalid&&f.touched),t.R7$(1),t.Y8G("ngIf","india"==n.country.toLowerCase()),t.R7$(2),t.Y8G("ngClass",t.eq3(33,x,null==n.data?null:n.data.state_id)),t.R7$(3),t.Y8G("ngModel",n.state_id)("disabled",null==n.data?null:n.data.state_id),t.R7$(2),t.Y8G("ngForOf",n.stateType),t.R7$(1),t.Y8G("ngIf",b.invalid&&b.touched),t.R7$(3),t.Y8G("disabled",n.loader)("ngClass",t.l_i(35,Tt,n.eSize>768,n.loader))("mat-dialog-close",!1),t.R7$(2),t.Y8G("disabled",n.loader||!n.isFormValid())("ngClass",t.eq3(38,x,n.loader||!n.isFormValid())),t.R7$(1),t.Y8G("ngIf",!n.loader),t.R7$(2),t.Y8G("ngIf",n.loader)}},dependencies:[p.YU,p.Sq,p.bT,u.me,u.BC,u.YS,u.tU,u.R_,u.Dg,u.vS,_.rl,_.nJ,_.TL,F.fg,I.LG,M.VO,N.wT,j.$3,j.pN,d.tx,d.BI,d.E7,p.PV]})}}return a})();var wt=s(5312),U=s(1471),Mt=s(2200),A=s(3008),Nt=s(493);function Yt(a,l){if(1&a){const e=t.RV6();t.j41(0,"span")(1,"button",8),t.bIt("click",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.updateBilling())}),t.nrm(2,"img",9),t.k0s()()}}function Ut(a,l){if(1&a&&(t.j41(0,"div",2)(1,"div",3),t.EFF(2,"GST number"),t.k0s(),t.j41(3,"div",10),t.EFF(4),t.k0s()()),2&a){const e=t.XpG();t.R7$(4),t.SpI(" ",(null==e.billingData?null:e.billingData.gst_number)||"-"," ")}}let At=(()=>{class a{constructor(e,i){this._dialog=e,this._apiService=i,this.country=""}ngOnInit(){this.country=this.billingData?.country}updateBilling(){try{const e=this._dialog?.open(Y,{disableClose:!0,width:"800px",data:this.billingData});e.afterClosed().subscribe(i=>{i&&(this.getBillData(),e.close(!0))})}catch{}}getBillData(){try{const e=g.k?.billing?.getBillDetails;this._apiService.get(e).subscribe({next:i=>{i&&(this.billingData=i?.data)},error:i=>{console.error(i)}})}catch{}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(d.bZ),t.rXU(y.G))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-billing-details"]],inputs:{billingData:"billingData",editUserList:"editUserList"},decls:40,vars:17,consts:[[1,"my-4","pl-2","border-gray"],[1,"p-2"],[1,"d-flex","flex-row","p-2","fnt-size-14"],[1,"col-3","px-0","text-start","text-gray"],[1,"col-9","pr-0","pl-2","d-flex","justify-content-between","align-items-center"],[1,"d-flex","justify-content-between","align-items-center","w-100"],[4,"ngIf"],["class","d-flex flex-row p-2 fnt-size-14",4,"ngIf"],[1,"border-0","bg-white",3,"click"],["width","20","src","assets/credentials/edit-icon.svg","alt","edit"],[1,"col-9","pr-0","pl-2","d-flex","justify-content-between","align-items-center","text-uppercase"]],template:function(i,n){1&i&&(t.j41(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),t.EFF(4,"Company name"),t.k0s(),t.j41(5,"div",4)(6,"div",5)(7,"span"),t.EFF(8),t.nI1(9,"titlecase"),t.k0s(),t.DNE(10,Yt,3,0,"span",6),t.k0s()()(),t.j41(11,"div",2)(12,"div",3),t.EFF(13,"Billing email"),t.k0s(),t.j41(14,"div",4),t.EFF(15),t.k0s()(),t.j41(16,"div",2)(17,"div",3),t.EFF(18,"Phone number"),t.k0s(),t.j41(19,"div",4),t.EFF(20),t.k0s()(),t.DNE(21,Ut,5,1,"div",7),t.j41(22,"div",2)(23,"div",3),t.EFF(24,"Billing address"),t.k0s(),t.j41(25,"div",4),t.EFF(26),t.nI1(27,"titlecase"),t.k0s()(),t.j41(28,"div",2)(29,"div",3),t.EFF(30,"State"),t.k0s(),t.j41(31,"div",4),t.EFF(32),t.nI1(33,"titlecase"),t.k0s()(),t.j41(34,"div",2)(35,"div",3),t.EFF(36,"Country"),t.k0s(),t.j41(37,"div",4),t.EFF(38),t.nI1(39,"titlecase"),t.k0s()()()()),2&i&&(t.R7$(8),t.SpI(" ",t.bMT(9,9,(null==n.billingData?null:n.billingData.company_name)||"-")," "),t.R7$(2),t.Y8G("ngIf",n.editUserList),t.R7$(5),t.SpI(" ",(null==n.billingData?null:n.billingData.email.toLowerCase())||"-"," "),t.R7$(5),t.Lme(" ",null!=n.billingData&&n.billingData.phone_number?null==n.billingData?null:n.billingData.country_code:""," ",(null==n.billingData?null:n.billingData.phone_number)||"-"," "),t.R7$(1),t.Y8G("ngIf","india"==(null==n.country?null:n.country.toLowerCase())),t.R7$(5),t.SpI(" ",t.bMT(27,11,(null==n.billingData?null:n.billingData.address)||"-")," "),t.R7$(6),t.SpI(" ",t.bMT(33,13,(null==n.billingData?null:n.billingData.state)||"-")," "),t.R7$(6),t.SpI(" ",t.bMT(39,15,null==n.billingData?null:n.billingData.country)," "))},dependencies:[p.bT,p.PV]})}}return a})();var Ot=s(8089),h=s(5686),zt=s(9217),Xt=s(5645),Vt=s(141),Lt=s(3470);function Ht(a,l){if(1&a&&(t.j41(0,"th",13)(1,"div"),t.EFF(2),t.k0s()()),2&a){const e=t.XpG().$implicit;t.R7$(2),t.SpI(" ",e," ")}}function Zt(a,l){if(1&a&&(t.qex(0),t.EFF(1),t.bVm()),2&a){const e=t.XpG().$implicit,i=t.XpG().$implicit;t.R7$(1),t.SpI(" ",e[i]||"-"," ")}}const qt=function(a,l,e){return{"bg-green":a,"bg-tomato":l,"bg-orange":e}}
1,Jt=function(){return{"text-white":!0}};function Wt(a,l){if(1&a&&(t.qex(0),t.j41(1,"mat-chip",15)(2,"span",16),t.EFF(3),t.nI1(4,"titlecase"),t.k0s()(),t.bVm()),2&a){const e=t.XpG().$implicit,i=t.XpG().$implicit;t.R7$(1),t.Y8G("ngClass",t.sMw(5,qt,"success"===(null==e[i]?null:e[i].toLowerCase()),"failed"===(null==e[i]?null:e[i].toLowerCase())||"rejected"===(null==e[i]?null:e[i].toLowerCase()),"pending"===(null==e[i]?null:e[i].toLowerCase()))),t.R7$(1),t.Y8G("ngClass",t.lJ4(9,Jt)),t.R7$(1),t.SpI(" ",t.bMT(4,3,e[i])," ")}}function Kt(a,l){if(1&a&&(t.j41(0,"small",22),t.EFF(1),t.k0s()),2&a){const e=t.XpG().ngIf;t.R7$(1),t.JRh(e.meta)}}function Qt(a,l){if(1&a&&(t.qex(0),t.j41(1,"div",17)(2,"mat-icon",18),t.EFF(3),t.k0s(),t.j41(4,"div",19)(5,"span",20),t.EFF(6),t.k0s(),t.DNE(7,Kt,2,1,"small",21),t.k0s()(),t.bVm()),2&a){const e=l.ngIf;t.R7$(1),t.Y8G("ngClass",e.class),t.R7$(2),t.JRh(e.icon),t.R7$(3),t.JRh(e.label),t.R7$(1),t.Y8G("ngIf",e.meta)}}function te(a,l){if(1&a&&(t.qex(0),t.DNE(1,Qt,8,4,"ng-container",4),t.bVm()),2&a){const e=t.XpG().$implicit,i=t.XpG().$implicit,n=t.XpG(2);t.R7$(1),t.Y8G("ngIf",n.getModeDetails(e[i]))}}function ee(a,l){if(1&a){const e=t.RV6();t.j41(0,"img",25),t.bIt("click",function(){t.eBV(e);
1const n=t.XpG(2).$implicit,o=t.XpG().$implicit,r=t.XpG(2);return t.Njj(r.downloadInvoice(n[o]))}),t.k0s()}}function ne(a,l){1&a&&(t.j41(0,"span",26),t.EFF(1,"-"),t.k0s())}function ie(a,l){if(1&a&&(t.qex(0),t.DNE(1,ee,1,0,"img",23),t.DNE(2,ne,2,0,"span",24),t.bVm()),2&a){const e=t.XpG().$implicit,i=t.XpG().$implicit;t.R7$(1),t.Y8G("ngIf","-"!==e[i]),t.R7$(1),t.Y8G("ngIf","-"===e[i])}}function ae(a,l){if(1&a&&(t.nrm(0,"app-hidden-text",28),t.nI1(1,"titlecase")),2&a){const e=t.XpG(2).$implicit,i=t.XpG().$implicit;t.Y8G("content",t.bMT(1,2,e[i]))("limit",40)}}function oe(a,l){if(1&a&&(t.j41(0,"span"),t.EFF(1),t.nI1(2,"titlecase"),t.k0s()),2&a){const e=t.XpG(2).$implicit,i=t.XpG().$implicit;t.R7$(1),t.JRh(t.bMT(2,1,e[i]))}}function le(a,l){if(1&a&&(t.qex(0),t.DNE(1,ae,2,4,"app-hidden-text",27),t.DNE(2,oe,3,3,"span",4),t.bVm()),2&a){const e=t.XpG().$implicit,i=t.XpG().$implicit;t.R7$(1),t.Y8G("ngIf",(null==e[i]?null:e[i].length)>30),t.R7$(1),t.Y8G("ngIf",(null==e[i]?null:e[i].length)<=30)}}function re(a,l){if(1&a){const e=t.RV6();t.qex(0),t.j41(1,"div",31),t.bIt("click",function(){t.eBV(e);
1const n=t.XpG(2).$implicit,o=t.XpG().$implicit,r=t.XpG(2);return t.Njj(r.openPaymentLink(n[o]))}),t.j41(2,"mat-icon",32),t.EFF(3,"open_in_new"),t.k0s(),t.j41(4,"span"),t.EFF(5,"Open link"),t.k0s()(),t.bVm()}}function se(a,l){1&a&&(t.j41(0,"span",33),t.EFF(1,"-"),t.k0s())}function ce(a,l){if(1&a&&(t.qex(0),t.DNE(1,re,6,0,"ng-container",29),t.DNE(2,se,2,0,"ng-template",null,30,t.C5r),t.bVm()),2&a){const e=t.sdS(3),i=t.XpG().$implicit,n=t.XpG().$implicit,o=t.XpG(2);t.R7$(1),t.Y8G("ngIf",o.isValidPaymentLink(i[n]))("ngIfElse",e)}}function de(a,l){if(1&a&&(t.j41(0,"td",14),t.DNE(1,Zt,2,1,"ng-container",4),t.DNE(2,Wt,5,10,"ng-container",4),t.DNE(3,te,2,1,"ng-container",4),t.DNE(4,ie,3,2,"ng-container",4),t.DNE(5,le,3,2,"ng-container",4),t.DNE(6,ce,4,2,"ng-container",4),t.k0s()),2&a){const e=t.XpG().$implicit;t.R7$(1),t.Y8G("ngIf","status"!==(null==e?null:e.toLowerCase())&&"Invoice"!==e&&"Mode"!==e&&"Remark"!==e&&"Link"!==e),t.R7$(1),t.Y8G("ngIf","status"===(null==e?null:e.toLowerCase())),t.R7$(1),t.Y8G("ngIf","Mode"===e),t.R7$(1),t.Y8G("ngIf","Invoice"===e),t.R7$(1),t.Y8G("ngIf","Remark"===e),t.R7$(1),t.Y8G("ngIf","Link"===e)}}function me(a,l){1&a&&(t.qex(0,10),t.DNE(1,Ht,3,1,"th",11),t.DNE(2,de,7,6,"td",12),t.bVm()),2&a&&t.Y8G("matColumnDef",l.$implicit)}function ue(a,l){1&a&&t.nrm(0,"tr",34)}function pe(a,l){1&a&&t.nrm(0,"tr",35)}function ge(a,l){if(1&a&&(t.j41(0,"table",6),t.DNE(1,me,3,1,"ng-container",7),t.DNE(2,ue,1,0,"tr",8),t.DNE(3,pe,1,0,"tr",9),t.k0s()),2&a){const e=t.XpG();t.Y8G("dataSource",e.tableData),t.R7$(1),t.Y8G("ngForOf",e.displayedColumns),t.R7$(1),t.Y8G("matHeaderRowDef",e.displayedColumns)("matHeaderRowDefSticky",!0),t.R7$(1),t.Y8G("matRowDefColumns",e.displayedColumns)}}function _e(a,l){1&a&&(t.j41(0,"div",36),t.nrm(1,"app-no-data-found",37),t.k0s())}function fe(a,l){1&a&&t.nrm(0,"div",39)}function he(a,l){if(1&a&&(t.j41(0,"div"),t.DNE(1,fe,1,0,"div",38),t.k0s()),2&a){const e=t.XpG();t.R7$(1),t.Y8G("ngForOf",e.loaderArr)}}const ye=function(a){return{"hide-page-label":a}},be=function(){return[5,10,20]};function Ce(a,l){if(1&a){const e=t.RV6();t.j41(0,"mat-paginator",40),t.bIt("page",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onPageChange(n))}),t.k0s()}if(2&a){const e=t.XpG();t.Y8G("ngClass",t.eq3(5,ye,e.eSize<600))("pageSize",e.pageSize)("pageSizeOptions",t.lJ4(7,be))("length",e.totalItems)("pageIndex",e.pageIndex)}}let ve=(()=>{class a{constructor(e,i){this._apiService=e,this._commonService=i,this.displayedColumns=[],this.loading=!0,this.loaderArr=new Array(10),this.modeConfigMap={UPI:{label:"UPI",meta:"Instant transfer",icon:"qr_code_2",class:"mode-upi"},CARD:{label:"Card",meta:"Debit / Credit",icon:"credit_card",class:"mode-card"},NB:{label:"Net Banking",meta:"Internet banking",icon:"account_balance",class:"mode-nb"},LINK:{label:"Payment Link",meta:"Manual checkout",icon:"link",class:"mode-link"},REFUND:{label:"Refund",meta:"Payment reversed",icon:"undo",class:"mode-refund"}},this.pageIndex=0,this.pageSize=10,this.totalItems=0}ngOnInit(){this.getPaymentHistory()}ngOnChanges(e){e.refresh?.currentValue&&(this.getPaymentHistory(),setTimeout(()=>{this.refresh=!1},0))}getPaymentHistory(){try{this.loading=!0;const e=g.k?.billing?.getPaymentHistory;this._apiService.get(e,{page:this.pageIndex+1,pageSize:this.pageSize}).subscribe({next:n=>{if(!n)return void(this.loading=!1);const o=n?.data?.rows??n?.data??[],r=n?.data?.totalRows??o?.length??0;o?.length>0&&(this.displayedColumns=this._commonService.tableDisplayColumns(o[0]),this.tableData=o),this.totalItems=r,this.loading=!1},error:n=>{console.error(n),this.loading=!1}})}catch{this.loading=!1}}onPageChange(e){try{this.pageIndex=e?.pageIndex,this.pageSize=e?.pageSize,this.getPaymentHistory()}catch(i){console.error(i)}}downloadInvoice(e){try{if(!e)return;window.open(e,"_blank")}catch(i){console.error(i)}}getModeDetails(e){const i=(e||"").toUpperCase();return this.modeConfigMap[i]||{label:e||"Other",meta:"",icon:"payments",class:"mode-default"}}isValidPaymentLink(e){return!!e&&"-"!==e&&/^https?:\/\//i.test(e)}openPaymentLink(e){try{if(!this.isValidPaymentLink(e))return;window.open(e,"_blank")}catch(i){console.error(i)}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(y.G),t.rXU(v.h))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-payment-history"]],inputs:{refresh:"refresh"},features:[t.OA$],decls:6,vars:4,consts:[[1,"px-3","py-3"],[1,"table-responsive"],["mat-table","","class","overflow-auto border-gray",3,"dataSource",4,"ngIf"],["class","height-300 d-flex align-items-center justify-content-center border-gray",4,"ngIf"],[4,"ngIf"],["showFirstLastButtons","","class","pb-2 custom-paginator","appTablePagination","",3,"ngClass","pageSize","pageSizeOptions","length","pageIndex","page",4,"ngIf"],["mat-table","",1,"overflow-auto","border-gray",3,"dataSource"],[3,"matColumnDef",4,"ngFor","ngForOf"],["class","text-gray text-nowrap","mat-header-row","",4,"matHeaderRowDef","matHeaderRowDefSticky"],["class","text-nowrap","mat-row","",4,"matRowDef","matRowDefColumns"],[3,"matColumnDef"],["mat-header-cell","","class","fnt-weight-600 fnt-size-14",4,"matHeaderCellDef"],["mat-cell","",4,"matCellDef"],["mat-header-cell","",1,"fnt-weight-600","fnt-size-14"],["mat-cell",""],[1,"dynamic-chip","w-100",3,"ngClass"],[3,"ngClass"],[1,"mode-chip",3,"ngClass"],[1,"mode-icon"],[1,"mode-text"],[1,"mode-label"],["class","mode-meta",4,"ngIf"],[1,"mode-meta"],["class","hand-pointer pl-3","src","assets/trialCenter/download.svg","alt","download",3,"click",4,"ngIf"],["class","ml-4",4,"ngIf"],["src","assets/trialCenter/download.svg","alt","download",1,"hand-pointer","pl-3",3,"click"],[1,"ml-4"],[3,"content","limit",4,"ngIf"],[3,"content","limit"],[4,"ngIf","ngIfElse"],["noLink",""],[1,"link-pill","hand-pointer",3,"click"],[1,"link-icon"],[1,"text-gray"],["mat-header-row","",1,"text-gray","text-nowrap"],["mat-row","",1,"text-nowrap"],[1,"height-300","d-flex","align-items-center","justify-content-center","border-gray"],["title","No result found!"],["class","mx-auto w-95 height-40 my-1 animate-shimmer rounded",4,"ngFor","ngForOf"],[1,"mx-auto","w-95","height-40","my-1","animate-shimmer","rounded"],["showFirstLastButtons","","appTablePagination","",1,"pb-2","custom-paginator",3,"ngClass","pageSize","pageSizeOptions","length","pageIndex","page"]],template:function(i,n){1&i&&(t.j41(0,"div",0)(1,"div",1),t.DNE(2,ge,4,5,"table",2),t.DNE(3,_e,2,0,"div",3),t.DNE(4,he,2,1,"div",4),t.k0s(),t.DNE(5,Ce,1,8,"mat-paginator",5),t.k0s()),2&i&&(t.R7$(2),t.Y8G("ngIf",!n.loading&&(null==n.tableData?null:n.tableData.length)>0),t.R7$(1),t.Y8G("ngIf",!(n.loading||n.tableData&&0!=(null==n.tableData?null:n.tableData.length))),t.R7$(1),t.Y8G("ngIf",n.loading),t.R7$(1),t.Y8G("ngIf",n.tableData&&(null==n.tableData?null:n.tableData.length)>0))},dependencies:[p.YU,p.Sq,p.bT,Ot.Jl,E.An,h.Zl,h.tL,h.ji,h.cC,h.YV,h.iL,h.KS,h.$R,h.YZ,h.NB,zt.iy,Xt.l,Vt.p,Lt.c,p.PV],styles:[".mode-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:8px;border-radius:999px;padding:6px 14px;font-size:12px;font-weight:600;width:-moz-fit-content;width:fit-content}.mode-icon[_ngcontent-%COMP%]{font-size:18px}.mode-text[_ngcontent-%COMP%]{display:flex;flex-direction:column;line-height:1.1}.mode-label[_ngcontent-%COMP%]{text-transform:capitalize}.mode-meta[_ngcontent-%COMP%]{font-size:10px;font-weight:400;opacity:.8}.mode-upi[_ngcontent-%COMP%]{background:#e6f0ff;color:#0b57d0}.mode-card[_ngcontent-%COMP%]{background:#fff2e7;color:#b54708}.mode-nb[_ngcontent-%COMP%]{background:#e8f5e9;color:#1b5e20}.mode-link[_ngcontent-%COMP%]{background:#ede7f6;color:#5e35b1}.mode-refund[_ngcontent-%COMP%]{background:#fdecea;color:#b3261e}.mode-default[_ngcontent-%COMP%]{background:#f0f0f0;color:#333}.link-pill[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;border:1px solid #cfd8dc;color:#0b57d0;font-weight:600;font-size:12px;transition:all .2s ease}.link-pill[_ngcontent-%COMP%]:hover{background:#0b57d0;color:#fff;border-color:#0b57d0}.link-icon[_ngcontent-%COMP%]{font-size:18px}"]})}}return a})();function De(a,l){1&a&&(t.j41(0,"div",5)(1,"div",6)(2,"h5",7),t.EFF(3,"Add Billing Details"),t.k0s(),t.j41(4,"div")(5,"i",8),t.EFF(6,"Provide your details to complete billing"),t.k0s()()()())}function Fe(a,l){if(1&a&&(t.j41(0,"mat-option",43),t.EFF(1),t.k0s()),2&a){const e=l.$implicit;t.Y8G("value",e),t.R7$(1),t.SpI(" ",e," ")}}function Ie(a,l){1&a&&(t.j41(0,"mat-error",44),t.EFF(1," Company name is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Se(a,l){if(1&a&&(t.j41(0,"span",45),t.EFF(1),t.k0s()),2&a){const e=t.XpG(2);t.R7$(1),t.SpI(" ","+91"==e.countryCode?"+91":"+1"," ")}}function je(a,l){1&a&&(t.j41(0,"mat-error"),t.EFF(1," Phone number is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function ke(a,l){1&a&&(t.j41(0,"mat-error"),t.EFF(1," Please enter a valid 10-digit phone number "),t.k0s())}function Ee(a,l){if(1&a&&(t.j41(0,"mat-option",46),t.EFF(1),t.k0s()),2&a){const e=l.$implicit;t.Y8G("value",e.id),t.R7$(1),t.SpI(" ",null==e?null:e.title," ")}}function Be(a,l){1&a&&(t.j41(0,"mat-error",44),t.EFF(1," Country is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Ge(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Email is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function xe(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Enter a valid email address"),t.k0s())}function Pe(a,l){if(1&a&&(t.j41(0,"mat-error",44),t.DNE(1,Ge,4,0,"span",25),t.DNE(2,xe,2,0,"span",25),t.k0s()),2&a){t.XpG();const e=t.sdS(34);t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.required),t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.email)}}function Re(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"GST number is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function $e(a,l){1&a&&(t.j41(0,"span"),t.EFF(1," Please enter a valid GST number (e.g., 12ABCDE3456Z1Z) "),t.k0s())}function Te(a,l){if(1&a&&(t.j41(0,"mat-error",44),t.DNE(1,Re,4,0,"span",25),t.DNE(2,$e,2,0,"span",25),t.k0s()),2&a){t.XpG();const e=t.sdS(41);t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.required),t.R7$(1),t.Y8G("ngIf",null==e.errors?null:e.errors.pattern)}}function we(a,l){if(1&a&&(t.j41(0,"mat-option",46),t.EFF(1),t.nI1(2,"titlecase"),t.k0s()),2&a){const e=l.$implicit;t.Y8G("value",null==e?null:e.id),t.R7$(1),t.SpI(" ",t.bMT(2,2,null==e?null:e.title)," ")}}function Me(a,l){1&a&&(t.j41(0,"mat-error",44),t.EFF(1," State is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Ne(a,l){1&a&&(t.j41(0,"mat-error",44),t.EFF(1," Address is "),t.j41(2,"strong"),t.EFF(3,"required"),t.k0s()())}function Ye(a,l){1&a&&(t.j41(0,"span"),t.EFF(1,"Continue"),t.k0s())}function Ue(a,l){1&a&&t.nrm(0,"mat-spinner",47),2&a&&t.Y8G("diameter",25)}const O=function(a){return{"opacity-5":a}};function Ae(a,l){if(1&a){const e=t.RV6();t.j41(0,"div",9)(1,"div",10)(2,"mat-form-field",11)(3,"mat-label",12),t.EFF(4,"Company name"),t.k0s(),t.j41(5,"div",13)(6,"input",14,15),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.companyName=n)})("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onCompanyNameChange(n))}),t.k0s(),t.j41(8,"mat-autocomplete",16,17),t.bIt("optionSelected",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onCompanySelected(n))}),t.DNE(10,Fe,2,2,"mat-option",18),t.k0s()(),t.DNE(11,Ie,4,0,"mat-error",19),t.k0s(),t.j41(12,"mat-form-field",20)(13,"mat-label",21),t.EFF(14,"Phone number"),t.k0s(),t.j41(15,"div",13),t.DNE(16,Se,2,1,"span",22),t.j41(17,"input",23,24),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.phoneNumber=n)})("input",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onInputChange(n))})("focus",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.isInputFocused=!0)})("blur",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.isInputFocused=!1)})("keypress",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.validatePhoneNumber(n))}),t.k0s()(),t.DNE(19,je,4,0,"mat-error",25),t.DNE(20,ke,2,0,"mat-error",25),t.k0s(),t.j41(21,"mat-form-field",11)(22,"mat-label",26),t.EFF(23,"Country"),t.k0s(),t.j41(24,"mat-select",27,28),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.country=n)})("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.getCountryType(n))}),t.DNE(26,Ee,2,2,"mat-option",29),t.k0s(),t.DNE(27,Be,4,0,"mat-error",19),t.k0s()(),t.j41(28,"div",30)(29,"mat-form-field",11)(30,"mat-label",21),t.EFF(31,"Billing email"),t.k0s(),t.j41(32,"div",13)(33,"input",31,32),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.email=n)})("input",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onInputChange(n))}),t.k0s()(),t.DNE(35,Pe,3,2,"mat-error",19),t.k0s(),t.j41(36,"mat-form-field",11)(37,"mat-label",21),t.EFF(38,"GST number"),t.k0s(),t.j41(39,"div",13)(40,"input",33,34),t.bIt("input",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.onInputChange(n,"gst"))})("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.gstNumber=n)})("ngModelChange",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.gstNumber=n.gstNumber.toUpperCase())}),t.k0s()(),t.DNE(42,Te,3,2,"mat-error",19),t.k0s(),t.j41(43,"mat-form-field",11)(44,"mat-label",21),t.EFF(45,"State"),t.k0s(),t.j41(46,"mat-select",35,36),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.state=n)})("selectionChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.getStateList(n))}),t.DNE(48,we,3,4,"mat-option",29),t.k0s(),t.DNE(49,Me,4,0,"mat-error",19),t.k0s()(),t.j41(50,"div",30)(51,"mat-form-field",11)(52,"mat-label",21),t.EFF(53,"Address"),t.k0s(),t.j41(54,"textarea",37,38),t.bIt("ngModelChange",function(n){t.eBV(e);const o=t.XpG();return t.Njj(o.address=n)}),t.EFF(56,"        "),t.k0s(),t.DNE(57,Ne,4,0,"mat-error",19),t.k0s()(),t.j41(58,"div",39)(59,"button",40),t.bIt("click",function(){t.eBV(e);const n=t.XpG();return t.Njj(n.billingDetails())}),t.DNE(60,Ye,2,0,"span",25),t.j41(61,"span",41),t.DNE(62,Ue,1,1,"mat-spinner",42),t.k0s()()()()}if(2&a){const e=t.sdS(7),i=t.sdS(9),n=t.sdS(18),o=t.sdS(25),r=t.sdS(34),m=t.sdS(41),f=t.sdS(47),b=t.sdS(55),c=t.XpG();t.R7$(2),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(4),t.Y8G("ngModel",c.companyName)("disabled",c.loader)("matAutocomplete",i),t.R7$(4),t.Y8G("ngForOf",c.filteredCompanies),t.R7$(1),t.Y8G("ngIf",e.invali
1d&&e.touched),t.R7$(1),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(4),t.Y8G("ngIf",c.isInputFocused||c.phoneNumber),t.R7$(1),t.Y8G("ngModel",c.phoneNumber)("disabled",c.loader),t.R7$(2),t.Y8G("ngIf",n.hasError("required")),t.R7$(1),t.Y8G("ngIf",n.hasError("pattern")),t.R7$(1),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(3),t.Y8G("ngModel",c.country)("disabled",c.loader),t.R7$(2),t.Y8G("ngForOf",c.countryType),t.R7$(1),t.Y8G("ngIf",o.invalid&&o.touched),t.R7$(2),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(4),t.Y8G("ngModel",c.email)("disabled",c.loader),t.R7$(2),t.Y8G("ngIf",r.invalid&&r.touched),t.R7$(1),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(4),t.Y8G("disabled",c.loader)("ngModel",c.gstNumber)("pattern","^\\d{2}[A-Z]{5}\\d{4}[A-Z]{1}\\d{1}[A-Z\\d]{1}[A-Z\\d]{1}$"),t.R7$(2),t.Y8G("ngIf",(null==m?null:m.invalid)&&(null==m?null:m.touched)),t.R7$(1),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(3),t.Y8G("ngModel",c.state)("disabled",c.loader),t.R7$(2),t.Y8G("ngForOf",c.stateType),t.R7$(1),t.Y8G("ngIf",f.invalid&&f.touched),t.R7$(2),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(3),t.Y8G("ngModel",c.address)("disabled",c.loader),t.R7$(3),t.Y8G("ngIf",b.invalid&&b.touched),t.R7$(1),t.Y8G("ngClass",c.eSize<768?"col-12":"col-4"),t.R7$(1),t.Y8G("disabled",c.loader||!c.isFormValid())("ngClass",t.eq3(40,O,c.loader||!c.isFormValid())),t.R7$(1),t.Y8G("ngIf",!c.loader),t.R7$(2),t.Y8G("ngIf",c.loader)}}function Oe(a,l){1&a&&(t.j41(0,"div",5)(1,"div",65)(2,"h5",7),t.EFF(3,"Billing Details"),t.k0s(),t.j41(4,"div")(5,"i",8),t.EFF(6,"Enter accurate details for seamless billing"),t.k0s()()()())}function ze(a,l){1&a&&(t.j41(0,"span"),t.EFF(1," Add Balance "),t.k0s())}function Xe(a,l){1&a&&(t.j41(0,"span"),t.nrm(1,"mat-spinner",67),t.k0s()),2&a&&(t.R7$(1),t.Y8G("diameter",20))}function Ve(a,l){if(1&a){const e=t.RV6();t.j41(0,"button",66),t.bIt("click",function(){t.eBV(e);const n=t.XpG(2);return t.Njj(n.isBalanceloader?"":n.getAddBalanceDetails())}),t.DNE(1,ze,2,0,"span",25),t.DNE(2,Xe,2,1,"span",25),t.k0s()}if(2&a){const e=t.XpG(2);t.Y8G("disabled","SUCCESS"!=e.billingStatus)("ngClass",t.eq3(4,O,"SUCCESS"!=e.billingStatus)),t.R7$(1),t.Y8G("ngIf",!e.isBalanceloader),t.R7$(1),t.Y8G("ngIf",e.isBalanceloader)}}function Le(a,l){if(1&a){const e=t.RV6();t.j41(0,"div")(1,"button",68),t.bIt("click",function(){t.eBV(e);const n=t.XpG(2);return t.Njj(n.alertBalance())}),t.EFF(2," Edit "),t.k0s()()}}function He(a,l){if(1&a&&(t.j41(0,"div",48),t.DNE(1,Oe,7,0,"div",1),t.j41(2,"div",49)(3,"div",50)(4,"div",51)(5,"div",52)(6,"div",53),t.nrm(7,"img",54),t.j41(8,"div",55)(9,"div",56),t.EFF(10,"Available Balance"),t.k0s(),t.j41(11,"b"),t.EFF(12),t.k0s()()(),t.j41(13,"div"),t.DNE(14,Ve,3,6,"button",57),t.k0s()()()(),t.j41(15,"div",50)(16,"div",51)(17,"div",52)(18,"div",53),t.nrm(19,"img",58),t.j41(20,"div",55)(21,"div",56),t.EFF(22,"Low Balance Alert"),t.k0s(),t.j41(23,"b"),t.EFF(24),t.k0s(),t.j41(25,"div")(26,"i",8),t.EFF(27,"Get email alerts when balance falls below the threshold"),t.k0s()()()(),t.DNE(28,Le,3,0,"div",25),t.k0s()()()(),t.j41(29,"div",59)(30,"mat-tab-group",60)(31,"mat-tab",61),t.nrm(32,"app-payment-history",62),t.k0s(),t.j41(33,"mat-tab",63),t.nrm(34,"app-billing-details",64),t.k0s()()()()),2&a){const e=t.XpG();t.R7$(1),t.Y8G("ngIf",!e.loading&&e.isBillingData),t.R7$(11),t.SpI(" ",(null==e.balanceData?null:e.balanceData.remaining_balance)||0,""),t.R7$(2),t.Y8G("ngIf",e.createUserList),t.R7$(10),t.SpI(" ",(null==e.balanceData?null:e.balanceData.alert_balance)||0,""),t.R7$(4),t.Y8G("ngIf",e.editUserList),t.R7$(4),t.Y8G("refresh",e.refreshPaymentHistory),t.R7$(2),t.Y8G("billingData",e.billingData)("editUserList",e.editUserList)}}function Ze(a,l){1&a&&(t.j41(0,"div",69),t.nrm(1,"app-analysis-loader",70),t.k0s()),2&a&&(t.R7$(1),t.Y8G("subTitle",2))}const qe=[{path:"",component:(()=>{class a{constructor(e,i,n,o,r,m){this._dialog=e,this._apiService=i,this._commonService=n,this._route=o,this._router=r,this._roleService=m,this.countryType=[],this.stateType=[],this.isBillingData=!1,this.loading=!0,this.loader=!1,this.loaderArr=new Array(10),this.isInputFocused=!1,this.companyName="",this.phoneNumber="",this.state="",this.email="",this.gstNumber="",this.address="",this.filteredCompanies=[],this.isBalanceloader=!1,this.countryCode="",this.billingId=""}
1ngOnInit(){try{this.getCredentials(),this.eSize=window.innerWidth,this.getBillData();const e=localStorage.getItem("userDetails");e&&(this.userDetails=JSON.parse(e)),this.userDetails&&(this.companyName=this.userDetails.company_name,this.phoneNumber=this.userDetails.user_phone,this.email=this.userDetails.company_email,this.countryCode=this.userDetails?.current_active_country_code),this._route.queryParams.pipe((0,ht.s)(1)).subscribe(i=>{"addBalance"===i.action&&(this.getAddBalanceDetails(),this._router.navigate([],{queryParams:{action:null}}))})}catch{}}onResize(e){this.eSize=window.innerWidth}getBillData(){try{const e=g.k?.billing?.getBillDetails;this._apiService.get(e).subscribe({next:i=>{this.loading=!1,i?(this.billingData=i?.data,this.billingStatus=this.billingData?.status,this.billingId=this.billingData?.id,"SUCCESS"!=this.billingData?.status&&this.updateBilling(),this.billingData?.is_need_create?this.getAllStatusData():(this.isBillingData=!0,this.getBalanceDetails())):this.loading=!1},error:i=>{this.loading=!1}})}catch{this.loading=!1}}getAllStatusData(e=null){try{const i=g.k?.common?.getAllStatus,n={type:e?G.iI?.STATE_TYPE:G.iI?.COUNTRY_TYPE};e&&(n.main_id=e),this._apiService.get(i,n).subscribe({next:o=>{this.loading=!1,o?e?this.stateType=o?.data?.allStatus:this.countryType=o?.data?.allStatus:this.loading=!1}})}catch{this.loading=!1}}billingDetails(){try{if(!this.countryStatus||!this.stateStatus)return void this._commonService.errorSnackBar("Please select both country and state");const e=g.k?.billing?.createBill,i={company_name:this._commonService.trimExtraSpaces(this.companyName),email:this.email,phone_number:this.phoneNumber,country_id:this.countryStatus,state_id:this.stateStatus,gst_number:this.gstNumber,address:this._commonService.trimExtraSpaces(this.address)};this.loader=!0,this._apiService.post(e,i).subscribe({next:n=>{this.loader=!1,this._commonService.successSnackBar(n?.message),n?this.getBillData():this._commonService.errorSnackBar(n?.message||"Invalid")},error:n=>{this.loader=!1,"Bill details created Successfully"==n?.message&&(this.isBillingData=!0)}})}catch{this.loader=!1}}alertBalance(){try{const e=this._dialog?.open(H,{disableClose:!0,width:"500px",data:{balanceData:this.balanceData,billingId:this.billingId}});e.afterClosed().subscribe(i=>{i&&(this.getBalanceDetails(),e.close(!0))})}catch{}}getAddBalanceDetails(){try{this.isBalanceloader=!0;const e=g.k?.billing?.getPaymentDetails;this._apiService.get(e).subscribe({next:i=>{i?(this.isBalanceloader=!1,(this._dialog?.open(ft,{disableClose:!0,width:"800px",data:i?.data})).afterClosed().subscribe(o=>{o&&(this.refreshPaymentHistory=!1,setTimeout(()=>{this.refreshPaymentHistory=!0},0))})):this.isBalanceloader=!1},error:()=>{this.isBalanceloader=!1}})}catch(e){console.error(e),this.isBalanceloader=!1}}getCountryType(e){try{this.countryStatus=e,this.countryStatus&&this.getAllStatusData(this.countryStatus)}catch(i){console.error(i)}}getStateList(e){try{this.stateStatus=e?.value}catch(i){console.error(i)}}validatePhoneNumber(e){try{const i=e.key.charCodeAt(0);(i<48||i>57)&&e.preventDefault()}catch{}}onInputChange(e,i=""){try{if("gst"===i){let n=e.target.value.trim();n=n.replace(/[^A-Za-z0-9\s]/g,""),e.target.value=n}else this._commonService.removeInputSpaces(e)}catch{}}isFormValid(){try{const e=/^\d{2}[A-Z]{5}\d{4}[A-Z]{1}\d{1}[A-Z\d]{1}[A-Z\d]{1}$/,i=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;return""!==this.companyName.trim()&&""!==this.phoneNumber.trim()&&/^[6-9][0-9]{9}$/.test(this.phoneNumber)&&""!==this.address.trim()&&""!==this.email.trim()&&i.test(this.email)&&""!==this.gstNumber.trim()&&e.test(this.gstNumber)&&""!==this.country&&""!==this.state}catch{}}getBalanceDetails(){try{this.loading=!0;const e=g.k?.billing?.getBalanceDetails;this._apiService.get(e).subscribe(i=>{i&&(this.balanceData=i?.data,this.loading=!1)})}catch{}}onCompanySelected(e){try{const i=e?.option?.value;this.companyName=i}catch{}}getCompanySuggestions(e){try{return this._apiService.get(`${g.k?.auth?.companyList}?company_name=${encodeURIComponent(e)}`).pipe((0,R.T)(i=>{try{return i?.data?.companyList?.map(n=>n?.companyName)||[]}catch(n){return console.error(n),[]}}),(0,$.W)(i=>(console.error(i),(0,S.of)([]))))}catch{return(0,S.of)([])}}onCompanyNameChange(e){try{e&&e.length>2?this.getCompanySuggestions(e).pipe((0,B.B)(500),(0,T.F)(),(0,w.n)(()=>this.getCompanySuggestions(e))).subscribe(i=>{this.filteredCompanies=i}):this.filteredCompanies=[]}catch{}}updateBilling(){try{const e=this._dialog?.open(Y,{disableClose:!0,autoFocus:!1,width:"800px",data:this.billingData});e.afterClosed().subscribe(i=>{i&&(this.getBillData(),e.close(!0))})}catch{}}getCredentials(){const e=g.k?.auth?.getTokenInfo;this._apiService?.get(e)?.subscribe(i=>{if(!i)return;const n=this.decryptSyncText(i?.data);this.credentialData=JSON?.parse(n),this.roleDetails=this.credentialData?.roleDetails?.permission;const r=this.roleDetails.find(m=>"billing"===m.sub_role_name.toLowerCase())?.permission||[];this.viewUserList=r.some(m=>"view"===m.title?.toLowerCase()&&1===m.status),this.editUserList=r.some(m=>"edit"===m.title?.toLowerCase()&&1===m.status),this.createUserList=r.some(m=>"create"===m.title?.toLowerCase()&&1===m.status)})}decryptSyncText(e){try{return U?.AES?.decrypt(e,wt.c?.seceretEDKey)?.toString(U?.enc?.Utf8)||""}catch(i){return console.error(i),""}}static{this.\u0275fac=function(i){return new(i||a)(t.rXU(d.bZ),t.rXU(y.G),t.rXU(v.h),t.rXU(D.nX),t.rXU(D.Ix),t.rXU(Mt.Z))}}static{this.\u0275cmp=t.VBU({type:a,selectors:[["app-billing"]],hostBindings:function(i,n){1&i&&t.bIt("resize",function(r){return n.onResize(r)},!1,t.tSv)},decls:5,vars:5,consts:[[3,"ngClass"],["class","d-flex justify-content-between align-items-center flex-wrap",4,"ngIf"],["class","bg-white",4,"ngIf"],["class","p-4",4,"ngIf"],["class","d-flex justify-content-center align-items-center h-100",4,"ngIf"],[1,"d-flex","justify-content-between","align-items-center","flex-wrap"],[1,"px-3","pb-4"],[1,"fnt-weight-800","fnt-size-16","mb-0"],[1,"fnt-size-12","text-gray"],[1,"bg-white"],[1,"input-field","pt-3"],[1,"input-field-remove-hover",3,"ngClass"],[1,"fnt-size-14","text-nowrap"],[1,"d-flex","justify-content-center","align-items-center"],["matInput","","placeholder","Please enter company name","maxlength","100","type","text","required","",3,"ngModel","disabled","matAutocomplete","ngModelChange"],["companyNameInput","ngModel"],[3,"optionSelected"],["auto","matAutocomplete"],[3,"value",4,"ngFor","ngForOf"],["class","m-0",4,"ngIf"],[1,"my-2","input-field-remove-hover",3,"ngClass"],[1,"fnt-size-14"],["class","mr-1 text-gray fnt-size-14",4,"ngIf"],["type","tel","matInput","","placeholder","Enter phone number","maxlength","10","required","","pattern","^[6-9][0-9]{9}$",1,"pl-1","fnt-size-14",3,"ngModel","disabled","ngModelChange","input","focus","blur","keypress"],["phoneNumberInput","ngModel"],[4,"ngIf"],[1,"letter-space-0","fnt-size-14"],["required","",1,"fnt-size-14","fnt-weight-600","letter-space-0",3,"ngModel","disabled","ngModelChange"],["countryInput","ngModel"],["class","font-weight-300 fnt-size-12 letter-space-0",3,"value",4,"ngFor","ngForOf"],[1,"input-field"],["matInput","","placeholder","Please enter billing email","maxlength","60","type","text","required","","email","",3,"ngModel","disabled","ngModelChange","input"],["emailInput","ngModel"],["matInput","","placeholder","Please enter GST number","maxlength","15","type","text","required","",3,"disabled","ngModel","pattern","input","ngModelChange"],["gstNumberInput","ngModel"],["required","",1,"fnt-size-14","fnt-weight-600","letter-space-0",3,"ngModel","disabled","ngModelChange","selectionChange"],["stateInput","ngModel"],["matInput","","required","","placeholder","Please enter address","rows","4",2,"resize","none","overflow-y","auto",3,"ngModel","disabled","ngModelChange"],["addressInput","ngModel"],[1,"d-flex","justify-content-start","align-items-center","pb-3","px-3",3,"ngClass"],[1,"border-0","bg-blue","text-white","border-radius-0","fnt-size-14","letter-space-0","p-2","shadow-none","w-100",3,"disabled","ngClass","click"],[1,"d-flex","justify-content-center"],["class","custom-spinner",3,"diameter",4,"ngIf"],[3,"value"],[1,"m-0"],[1,"mr-1","text-gray","fnt-size-14"],[1,"font-weight-300","fnt-size-12","letter-space-0",3,"value"],[1,"custom-spinner",3,"diameter"],[1,"p-4"],[1,"row"],[1,"col-lg-6","pb-3"],[1,"d-flex","my-2","my-lg-3","h-100"],[1,"d-flex","flex-wrap","w-100","px-3","border-gray","align-items-center","justify-content-between","shadow-sm"],[1,"d-flex","flex-row","flex-wrap"],["src","assets/billing/wallet.svg","alt","wallet"],[1,"pl-3"],[1,"text-gray","fnt-size-14"],["class","ml-2 bg-white width-120 text-blue border-blue border-radius-0 fnt-size-14 letter-space-0 px-3 py-2 shadow-none",3,"disabled","ngClass","click",4,"ngIf"],["src","assets/billing/alert.svg","alt","alert"],[1,"pt-4","tab-section","tab-section-border"],["mat-stretch-tabs","false","mat-align-tabs","start"],["label","Payment History"],[3,"refresh"],["label","Billing Details"],[3,"billingData","editUserList"],[1,"mr-2","pb-2"],[1,"ml-2","bg-white","width-120","text-blue","border-blue","border-radius-0","fnt-size-14","letter-space-0","px-3","py-2","shadow-none",3,"disabled","ngClass","click"],["color","primary",1,"d-flex","align-items-center","w-100",3,"diameter"],[1,"ml-2","bg-white","text-blue","border-blue","border-radius-0","fnt-size-14","letter-space-0","px-5","py-2","shadow-none",3,"click"],[1,"d-flex","justify-content-center","align-items-center","h-100"],[1,"d-flex","justify-content-center","align-items-center","py-2",3,"subTitle"]],template:function(i,n){1&i&&(t.j41(0,"div",0),t.DNE(1,De,7,0,"div",1),t.DNE(2,Ae,63,42,"div",2),t.k0s(),t.DNE(3,He,35,8,"div",3),t.DNE(4,Ze,2,1,"div",4)),2&i&&(t.Y8G("ngClass",n.isBillingData?"":"p-4"),t.R7$(1),t.Y8G("ngIf",!n.loading&&!n.isBillingData),t.R7$(1),t.Y8G("ngIf",!n.loading&&!n.isBillingData),t.R7$(1),t.Y8G("ngIf",!n.loading&&n.isBillingData),t.R7$(1),t.Y8G("ngIf",n.loading))},dependencies:[p.YU,p.Sq,p.bT,u.me,u.BC,u.YS,u.tU,u.R_,u.Dg,u.vS,_.rl,_.nJ,_.TL,F.fg,I.LG,M.VO,N.wT,A.mq,A.T8,j.$3,j.pN,Nt.X,At,ve,p.PV]})}}return a})()}];let Je=(()=>{class a{static{this.\u0275fac=function(i){return new(i||a)}}static{this.\u0275mod=t.$C({type:a})}static{this.\u0275inj=t.G2t({imports:[D.iI.forChild(qe),D.iI]})}}return a})();var We=s(2096),Ke=s(3887);let Qe=(()=>{class a{static{this.\u0275fac=function(i){return new(i||a)}}static{this.\u0275mod=t.$C({type:a})}static{this.\u0275inj=t.G2t({imports:[D.iI,p.MD,Je,We.D,Ke.G]})}}return a})()}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.