1import{a as ne}from"./chunk-C6NQCHSD.js";import{a as te}from"./chunk-2KP27GBH.js";import"./chunk-H7NHQG5R.js";import{a as ee}from"./chunk-HZ6OFQFZ.js";import{a as X}from"./chunk-OCGBHMAU.js";import"./chunk-Y5JZEXHH.js";import{a as Z}from"./chunk-PBQAI6PT.js";import{a as Q}from"./chunk-VHEKEBKZ.js";import"./chunk-R3FQUAW3.js";import"./chunk-RQJM5YXQ.js";import{a as Y}from"./chunk-2FJVMB6B.js";import{a as q,b as K}from"./chunk-3M75U6ED.js";import"./chunk-7CG6YTEJ.js";import"./chunk-OTZ2GYQO.js";import"./chunk-CAVH7CEE.js";import{e as J}from"./chunk-ODENK2RA.js";import{a as N}from"./chunk-6BXP5JV5.js";import"./chunk-7BVWSGV7.js";import{a as H}from"./chunk-PJAAIMNK.js";import"./chunk-J2737D6V.js";import{b as W}from"./chunk-JJ7S5BBI.js";import"./chunk-FYFF4OYG.js";import{B as M,Ed as x,Fd as V,Ld as $,Nd as G,V as E,ae as R,be as j,ce as z,l as A,ld as I,nd as F,qd as L,rd as U,yd as O}from"./chunk-U3FRP2OH.js";import"./chunk-MT6FXMKE.js";import{$b as y,F as T,Hb as D,Ma as u,O as B,Y as d,bc as S,cd as w,f as C,ga as h,gc as a,hc as m,ic as p,jc as g,kd as s,ld as l,rb as o,s as P,ua as r,uc as f,ud as k,wc as _}from"./chunk-5VQKZTJF.js";import{a as b,b as v}from"./chunk-OKNOHCUX.js";var ae=i=>({"tw:opacity-60 tw:pointer-events-none":i});function re(i,ie){if(i&1&&g(0,"ui-input-error",8),i&2){let e=_();a("message",e.getIfscErrorMessage())}}function se(i,ie){if(i&1&&g(0,"ui-input-error",8),i&2){let e=_();a("message",e.getAccountErrorMessage())}}var Ee=(()=>{class i{org=u(null);orgSettings=u(null);isLoading=u(!1);isTogglingSettings=u(!1);isSaving=u(!1);bankPaymentForm;showUnmaskedAccount=u(!1);sectionDescription=k(()=>{let e=this.orgSettings();return e?e.bank_payment_file_settings?.enabled?this.translocoService.translate("bankPaymentFile.sectionDescriptionEnabled"):this.translocoService.translate("bankPaymentFile.sectionDescriptionDisabled"):""});buttonLabel=k(()=>this.orgSettings()?.bank_payment_file_settings?.enabled?this.translocoService.translate("bankPaymentFile.disableButtonLabel"):this.translocoService.translate("bankPaymentFile.enableButtonLabel"));isFormDisabled=k(()=>!this.orgSettings()?.bank_payment_file_settings?.enabled);ButtonType=E;componentDestroyed$=new C;formBuilder=r($);orgService=r(H);orgSettingsService=r(Z);toastMessageService=r(Y);translocoService=r(R);maskNumberPipe=r(X);routingService=r(N);trackingService=r(J);constructor(){this.bankPaymentForm=this.formBuilder.group({branch_ifsc:["",[F.pattern(/^[A-Za-z]{4}0[\dA-Za-z]{6}$/)]],branch_account:["",[F.pattern(/^\d+$/)]]})}get branchIfscControl(){return this.bankPaymentForm.get("branch_ifsc")}get branchAccountControl(){return this.bankPaymentForm.get("branch_account")}markFormGroupTouched(){for(let e of Object.keys(this.bankPaymentForm.controls))this.bankPaymentForm.get(e)?.markAsTouched()}ngOnInit(){this.trackingService.eventTrack("Settings bank payment file page visited"),this.isLoading.set(!0),T([this.orgService.getCurrentOrgWithBankDetails(),this.orgSettingsService.get()]).pipe(h(this.componentDestroyed$),B(e=>(this.toastMessageService.showErrorToast(this.translocoService.translate("bankPaymentFile.toggleErrorToast")),P([null,null]))),d(()=>this.isLoading.set(!1))).subscribe(([e,n])=>{this.org.set(e),this.orgSettings.set(n),e&&this.bankPaymentForm.patchValue({branch_ifsc:e.branch_ifsc||"",branch_account:e.branch_account||""})})}ngOnDestroy(){this.componentDestroyed$.next(),this.componentDestroyed$.complete()}toggleBankPaymentFileSettings(){let e=this.orgSettings();if(!e)return;this.isTogglingSettings.set(!0);let n={bank_payment_file_settings:v(b({},e.bank_payment_file_settings),{enabled:!e.bank_payment_file_settings.enabled})},t=n.bank_payment_file_settings.enabled?this.translocoService.translate("bankPaymentFile.enabledStatus"):this.translocoService.translate("bankPaymentFile.disabledStatus");this.orgSettingsService.postResourceSettings(n,"bank_payment_file_settings","enabled").pipe(h(this.componentDestroyed$),d(()=>this.isTogglingSettings.set(!1))).subscribe({next:()=>{this.trackingService.eventTrack("Toggled bank payment file settings",{mode:t,page:"Settings bank payment file"}),this.routingService.reloadCurrentPage()},error:c=>{this.toastMessageService.showErrorToast(this.translocoService.translate("bankPaymentFile.toggleErrorToast")),this.trackingService.eventTrack("Unable to toggle bank payment file settings",{mode:t,page:"Settings bank payment file",error:c})}})}editBankAccountNumber(){let e=this.org();e&&this.bankPaymentForm.patchValue({branch_account:e.branch_account||""})}
1save(){if(this.bankPaymentForm.invalid){this.markFormGroupTouched();return}let e=this.org();if(!e)return;this.isSaving.set(!0);let n=b(b({},e),this.bankPaymentForm.value);this.orgService.updateOrg(n).pipe(h(this.componentDestroyed$),d(()=>this.isSaving.set(!1))).subscribe({next:t=>{let c=v(b({},t),{branch_ifsc:this.bankPaymentForm.value.branch_ifsc,branch_account:this.bankPaymentForm.value.branch_account,is_bank_account_added:!0});this.org.set(c),this.toastMessageService.showSuccessToast(this.translocoService.translate("bankPaymentFile.successToast")),this.trackingService.eventTrack("Bank details saved",{page:"Settings bank payment file"}),this.showUnmaskedAccount.set(!1)},error:t=>{this.toastMessageService.showErrorToast(this.translocoService.translate("bankPaymentFile.saveErrorToast")),this.trackingService.eventTrack("Bank details save failed",{page:"Settings bank payment file",error:t})}})}getIfscErrorMessage(){return this.branchIfscControl?.hasError("pattern")?this.translocoService.translate("bankPaymentFile.invalidIfscError"):""}getAccountErrorMessage(){return this.branchAccountControl?.hasError("pattern")?this.translocoService.translate("bankPaymentFile.invalidAccountNumberError"):""}getDisplayValue(){let e=this.branchAccountControl?.value;return e?this.showUnmaskedAccount()?e:this.maskNumberPipe.transform(e):""}onAccountFocus(){this.showUnmaskedAccount.set(!0)}onAccountBlur(){this.showUnmaskedAccount.set(!1)}onAccountInput(e){let n=e.target;this.branchAccountControl?.setValue(n.value)}static \u0275fac=function(n){return new(n||i)};static \u0275cmp=D({type:i,selectors:[["feature-bank-payment-file"]],decls:23,vars:38,consts:[[1,"feature-bank-payment-file","tw:flex","tw:flex-col","tw:gap-spacing-12","tw:mt-spacing-4"],[3,"buttonClicked","title","description","buttonLabel","showLoaderOnButton"],[3,"ngClass"],[3,"header","subtitle"],[1,"tw:flex","tw:flex-col","tw:gap-spacing-24",3,"formGroup"],[1,"tw:flex","tw:flex-col","tw:gap-spacing-2"],[3,"label"],["pInputText","","type","text","formControlName","branch_ifsc",3,"placeholder"],[3,"message"],["pInputText","","type","text","formControlName","branch_account","autocomplete","off",3,"focus","blur","input","placeholder","value"],[1,"tw:mt-spacing-20","tw:flex","tw:justify-start"],[3,"buttonClick","buttonType","label","isDisabled","isLoading","customClasses"]],template:function(n,t){n&1&&(m(0,"div",0)(1,"ui-page-header",1),s(2,"transloco"),f("buttonClicked",function(){return t.toggleBankPaymentFileSettings()}),p(),m(3,"div",2)(4,"ui-section-box",3),s(5,"transloco"),s(6,"transloco"),m(7,"form",4)(8,"div",5),g(9,"ui-input-label",6),s(10,"transloco"),g(11,"input",7),s(12,"transloco"),y(13,re,1,1,"ui-input-error",8),p(),m(14,"div",5),g(15,"ui-input-label",6),s(16,"transloco"),m(17,"input",9),s(18,"transloco"),f("focus",function(){return t.onAccountFocus()})("blur",function(){return t.onAccountBlur()})("input",function(oe){return t.onAccountInput(oe)}),p(),y(19,se,1,1,"ui-input-error",8),p(),m(20,"div",10)(21,"ui-button",11),s(22,"transloco"),f("buttonClick",function(){return t.save()}),p()()()()()()),n&2&&(o(),a("title",l(2,20,"bankPaymentFile.title"))("description",t.sectionDescription())("buttonLabel",t.buttonLabel())("showLoaderOnButton",t.isTogglingSettings()),o(2),a("ngClass",w(36,ae,t.isFormDisabled())),o(),a("header",l(5,22,"bankPaymentFile.bankDetail
1sHeader"))("subtitle",l(6,24,"bankPaymentFile.bankDetailsSubtitle")),o(3),a("formGroup",t.bankPaymentForm),o(2),a("label",l(10,26,"bankPaymentFile.ifscCodeLabel")),o(2),a("placeholder",l(12,28,"bankPaymentFile.ifscCodePlaceholder")),o(2),S(t.branchIfscControl!=null&&t.branchIfscControl.invalid&&(t.branchIfscControl!=null&&t.branchIfscControl.touched)?13:-1),o(2),a("label",l(16,30,"bankPaymentFile.accountNumberLabel")),o(2),a("placeholder",l(18,32,"bankPaymentFile.accountNumberPlaceholder"))("value",t.getDisplayValue()),o(2),S(t.branchAccountControl!=null&&t.branchAccountControl.invalid&&(t.branchAccountControl!=null&&t.branchAccountControl.touched)?19:-1),o(2),a("buttonType",t.ButtonType.PRIMARY)("label",l(22,34,"bankPaymentFile.saveButtonLabel"))("isDisabled",t.isFormDisabled()||t.bankPaymentForm.invalid)("isLoading",t.isSaving())("customClasses","tw:w-[150px]"))},dependencies:[M,A,G,O,I,L,U,V,x,z,K,q,ne,te,ee,Q,W,j],encapsulation:2})}return i})();export{Ee as FeatureBankPaymentFileComponent};
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.