PageSourceSearch

https://toolschoolco.com/form-payments-manager.component-A74XUHJH.js

js toolschoolco.com collected 2026-10-08 05:32:54 UTC 12,515 bytes, 15 lines download raw bytes

1import{a as $t}from"./chunk-5VGQYTCD.js";import{a as _t}from"./chunk-RXUCDVD6.js";import{a as ft,c as S}from"./chunk-V54J47D2.js";import"./chunk-DCKVT4S2.js";import"./chunk-HONAAT3O.js";import{a as xt,b as wt,c as Lt,g as Et,h as Tt,j as Rt,m as Ft}from"./chunk-Y5LX7653.js";import{a as Bt,b as kt,c as It,f as Ot,i as Dt}from"./chunk-XSGRDUZP.js";import"./chunk-7ZPUDG7H.js";import{c as St,d as vt}from"./chunk-NALSONZ3.js";import"./chunk-VAQUBKT2.js";import"./chunk-TMBGVCK3.js";import"./chunk-RCJ2JWKO.js";import{a as at}from"./chunk-WHJRKT62.js";import{a as it,o as nt}from"./chunk-NP3AJYFF.js";import"./chunk-5XDP3Y2K.js";import"./chunk-6I74GBYL.js";import"./chunk-ZBQER4EA.js";import"./chunk-TCLRYFEX.js";import{a as et}from"./chunk-5WNW7KVI.js";import{a as ht,b as yt,c as Mt,e as bt,f as Pt,g as Ct,h as v}from"./chunk-GLOW3WYR.js";import"./chunk-MR6ZP72Q.js";import"./chunk-5HYPQGVU.js";import"./chunk-57BZZ5FX.js";import"./chunk-WCHZOWXJ.js";import{D as pt,K as ut,L as gt,c as ot,h as rt,i as st,n as mt,q as lt,r as dt,s as ct}from"./chunk-XBODCV6O.js";import"./chunk-3UPR23LF.js";import"./chunk-J3WIPPQT.js";import{b as _}from"./chunk-VUN6SQCC.js";import"./chunk-VDM4I3FW.js";import"./chunk-TGRBT4WK.js";import"./chunk-NLMA2RKH.js";import"./chunk-57NSJIO3.js";import"./chunk-6BWROWLZ.js";import"./chunk-DVV3F6I7.js";import"./chunk-XYUW7X7Y.js";import"./chunk-36WATGJX.js";import"./chunk-ZODBMDVC.js";import{d as P,l as C}from"./chunk-64XQRBXT.js";import"./chunk-VKXFJRUQ.js";import"./chunk-WY3TPGUQ.js";import"./chunk-GUSXJSAP.js";import"./chunk-E2DUAA55.js";import"./chunk-PG3N3OH3.js";import"./chunk-OH3XPIE7.js";import"./chunk-FZAHKTAU.js";import{k as Q,l as X}from"./chunk-SJGRCHOO.js";import"./chunk-HDAOBKSU.js";import"./chunk-LWPJTN3K.js";import{H as Z,X as tt}from"./chunk-QFFG7T2F.js";import"./chunk-UUDOJHC4.js";import"./chunk-GSODPBCU.js";import"./chunk-OYATTVDC.js";import"./chunk-BKYS2XZ2.js";import"./chunk-WUHLWO3B.js";import{a as I,e as O}from"./chunk-UB3W44UE.js";import{la as Y,sa as J,ua as K}from"./chunk-KQPWQIEB.js";import"./chunk-FPPZ4BUR.js";import{$a as g,Ad as o,Bd as u,Id as z,Ja as s,Jd as G,K as F,Kd as W,Ob as m,Pc as j,Qa as y,Ra as M,Rc as V,Sc as H,Tc as p,Uc as n,Vc as a,Wa as A,X as $,be as f,cd as U,ce as h,fc as b,g as E,jd as c,ne as k,q as T,ra as N,vd as q,y as R}from"./chunk-GBGS7SLL.js";import"./chunk-DAZ3MHQI.js";import"./chunk-JQE4WEKA.js";import"./chunk-QHBN7R45.js";import"./chunk-WYFIINDB.js";import{a as w,b as L}from"./chunk-XFB3PWAV.js";var Nt=(()=>{let r=class r{constructor(){this.titleId=$t("update-outstanding-balance-dialog-title"),this.matSnackBar=s(_),this.dialogRef=s(ht),this.data=s(yt),this.formService=s(S),this.outstandingBalance=this.data.formData.find(t=>t.name.includes("outstandingBalance"))?.data||0}saveBalance(){try{let t=this.data.formData.map(i=>i.name.includes("outstandingBalance")?L(w({},i),{data:this.outstandingBalance}):i);this.formService.updateSubmission(this.data.formId,this.data.submissionId,{data:t}).pipe($(1)).subscribe(()=>{this.matSnackBar.open("Outstanding balance updated successfully","Close",{duration:3e3}),this.dialogRef.close(!0)})}catch{this.matSnackBar.open("Error updating outstanding balance","Close",{duration:3e3}),this.dialogRef.close(!1)}}cancel(){this.dialogRef.close()}};r.\u0275fac=function(i){return new(i||r)},r.\u0275cmp=b({type:r,selectors:[["app-update-outstanding-balance-dialog"]],decls:14,vars:3,consts:[["balanceForm","ngForm"],["mat-dialog-title","",3,"id"],["appearance","fill",2,"width","100%"],["matInput","","type","number","name","outstandingBalance","required","",3,"ngModelChange","ngModel"],["align","end"],["mat-button","",3,"click"],["mat-raised-button","","color","primary",3,"click","disabled"]],template:function(i,e){if(i&1){let l=U();n(0,"h2",1),o(1,"Update Outstanding Balance"),a(),n(2,"mat-dialog-content")(3,"form",null,0)(5,"mat-form-field",2)(6,"mat-label"),o(7,"Outstanding Balance"),a(),n(8,"input",3),W("ngModelChange",function(B){return y(l),G(e.outstandingBalance,B)||(e.outstandingBalance=B),M(B)}),a()()()(),n(9,"mat-dialog-actions",4)(10,"button",5),c("click",function(){return y(l),M(e.cancel())}),o(11,"Cancel"),a(),n(12,"button",6),c("click",function(){return y(l),M(e.saveBalance())}),o(13," Save "),a()()}if(i&2){let l=q(4);p("id",e.titleId),m(8),z("ngModel",e.outstandingBalance),m(4),p("disabled",!l.valid)}},dependencies:[v,bt,Ct,Pt,at,nt,it,ut,dt,ot,ct,rt,st,pt,lt,mt,gt,C,P,vt,St],styles:["mat-dialog-content[_ngcontent-%COMP%]{min-width:300px}"]});let d=r;return d})();function Vt(d,r){if(d&1&&(n(0,"mat-list-item")(1,"span",10),o(2,"Stripe Payment"),a(),n(3,"span",11),o(4),f(5,"currency"),a(),n(6,"span",12),o(7),f(8,"date"),a()()),d&2){let D=r.$implicit;m(4),u(h(5,2,D.amount)),m(3),u(h(8,4,D.timestamp.toDate()))}}var ke=(()=>
1{let r=class r{constructor(){this.formService=s(S),this.activatedRoute=s(Z),this.destroyRef=s(A),this.formModel=ft,this.formId=this.activatedRoute.snapshot.params.id,this.router=s(tt),this.mailerService=s(et),this.snackBar=s(_),this.form=O(this.formService.getById(this.formId)),this.submissionId=this.activatedRoute.snapshot.params.submissionId,this.refreshTrigger$=new E(0),this.submission$=this.refreshTrigger$.pipe(N(()=>this.getSubmission(this.formId,this.submissionId))),this.submission=O(this.submission$),this.adjustedPaymentHistory=k(()=>{let t=this.form();return t?this.fetchAdjustedPayments(this.submissionId,t):[]}),this.dialog=s(Mt),this.stripeService=s(_t),this.formPaymentsInfo=g(this.form()?.formPaymentsInfo),this.totalPaid=g(0),this.outstandingBalance=g(0),this.paymentHistory=g([]),this.dueDate=k(()=>this.formPaymentsInfo()?.dueDate??"Not Set")}openUpdateOutstandingBalanceDialog(){this.dialog.open(Nt,{data:{formId:this.formId,submissionId:this.submissionId,formData:this.submission()?.data},width:"400px"}).afterClosed().subscribe(i=>{i&&this.refreshTrigger$.next(this.refreshTrigger$.getValue()+1)})}ngOnInit(){this.submission$.pipe(F(t=>!!t),I(this.destroyRef)).subscribe(t=>{this.handleSubmissionPaymentData(t)}),this.formService.getSubmissionPayments(this.formId,this.submissionId).pipe(I(this.destroyRef)).subscribe(t=>{this.paymentHistory.set(t)})}handleSubmissionPaymentData(t){let{data:i}=t;for(let e of i)e.name.includes("outstandingBalance")&&this.outstandingBalance.set(e.data),e.name.includes("paymentStatus"),e.name.includes("stripePaymentAmount")&&(t.paymentSummary?.totalPaid?this.totalPaid.set(t.paymentSummary.totalPaid):this.totalPaid.set(e.data))}loadPaymentHistory(t,i){return T(this.stripeService.getProductTransactions({productId:t})).pipe(R(e=>e.filter(l=>l.customerEmail===i)))}getSubmission(t,i){return this.formService.getSubmissionById(t,i)}fetchAdjustedPayments(t,i){return i?.getAdjustedPaymentsBySubmissionId(t)||[]}goBack(){this.router.navigate(["/form",this.formId,"submissions"])}getPaymentLink(t){return`${window.location.origin}/pay-balance/${this.formId}/${this.submissionId}?email=${encodeURIComponent(t)}`}copyPaymentLink(){let t=this.submission()?.data.find(e=>e.name.toLowerCase().includes("email"))?.data;if(!t){this.snackBar.open("No email found in submission","Close",{duration:3e3});return}let i=this.getPaymentLink(t);navigator.clipboard.writeText(i),this.snackBar.open("Payment link copied to clipboard!","Close",{duration:3e3})}async sendPaymentLinkEmail(){if(!this.submission()){this.snackBar.open("No submission data available","Close",{duration:3e3});return}let t=this.submission()?.data.find(e=>e.name.toLowerCase().includes("email"))?.data;if(!t){this.snackBar.open("No email found in submission","Close",{duration:3e3});return}let i=this.getPaymentLink(t);try{let e={to:t,message:{subject:`Payment Request for ${this.form()?.title}`,html:`
2            <p>Hello,</p>
3            <p>You have a pending payment for ${this.form()?.title}.</p>
4            <p>Outstanding Balance: ${this.outstandingBalance()} USD</p>
5            <p>Please click the link below to complete your payment:</p>
6            <p><a href="${i}">Make Payment</a></p>
7            <p>If you have any questions, please contact us.</p>
8          `},createdAt:new Date,sendGrid:!0,emails:[t],subject:`Payment Request for ${this.form()?.title}`,html:`
9          <p>Hello,</p>
10          <p>You have a pending payment for ${this.form()?.title}.</p>
11          <p>Outstanding Balance: ${this.outstandingBalance()} USD</p>
12          <p>Please click the link below to complete your payment:</p>
13          <p><a href="${i}">Make Payment</a></p>
14          <p>If you have any questions, please contact us.</p>
15        `};await this.mailerService.createMailerRequest(e),this.snackBar.open("Payment link sent successfully","Close",{duration:3e3})}catch{this.snackBar.open("Error sending payment link email","Close",{duration:3e3})}}};r.\u0275fac=function(i){return new(i||r)},r.\u0275cmp=b({type:r,selectors:[["app-form-payments-manager"]],decls:42,vars:9,consts:[[1,"container"],["mat-button","",1,"back-button",3,"click"],["aria-hidden","true"],[1,"p-4"],[1,"payment-summary"],[1,"mt-4"],["mat-subheader",""],["mat-raised-button","","color","primary",3,"click"],["mat-raised-button","","color","accent",1,"ml-2",3,"click","disabled"],["mat-raised-button","",1,"ml-2",3,"click","disabled"],["matListItemTitle",""],["matListItemLine",""],["matListItemMeta",""]],template:function(i,e){i&1&&(n(0,"div",0)(1,"button",1),c("click",function(){return e.goBack()}),n(2,"mat-icon",2),o(3,"arrow_back"),a(),o(4," Back to Submissions "),a(),n(5,"div",3)(6,"div",4)(7,"mat-card")(8,"h3"),o(9,"Total Paid"),a(),n(10,"p"),o(11),f(12,"currency"),a()(),n(13,"mat-card")(14,"h3"),o(15,"Due Date"),a(),n(16,"p"),o(17),a()(),n(18,"mat-card")(19,"h3"),o(20,"Outstanding Balance"),a(),n(21,"p"),o(22),f(23,"currency"),a()()(),n(24,"mat-card",5)(25,"mat-card-header")(26,"mat-card-title"),o(27,"Payment History"),a()(),n(28,"mat-card-content")(29,"mat-list"),V(30,Vt,9,6,"mat-list-item",null,j),a()()(),n(32,"div",5)(33,"div",6)(34,"button",7),c("click",function(){return e.openUpdateOutstandingBalanceDialog()}),o(35," Adjust Outstanding Balance "),a(),n(36,"button",8),c("click",function(){return e.sendPaymentLinkEmail()}),o(37," Send Payment Link "),a(),n(38,"button",9),c("click",function(){return e.copyPaymentLink()}),n(39,"mat-icon",2),o(40,"content_copy"),a(),o(41," Copy Payment Link "),a()()()()()),i&2&&(m(11),u(h(12,5,e.totalPaid())),m(6),u(e.dueDate()),m(5),u(h(23,7,e.outstandingBalance())),m(8),H(e.paymentHistory()),m(6),p("disabled",e.outstandingBalance()===0),m(2),p("disabled",e.outstandingBalance()===0))},dependencies:[Dt,Bt,It,Ot,kt,Ft,Et,Tt,Rt,wt,xt,Lt,v,C,P,X,Q,K,Y,J],styles:[".payment-summary[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;padding:8px;gap:16px;justify-content:space-around}.payment-summary[_ngcontent-%COMP%]   mat-card[_ngcontent-%COMP%]{flex:1;
15min-width:200px;padding:16px;text-align:center}.payment-summary[_ngcontent-%COMP%]   mat-card[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{margin-bottom:8px;font-size:1.2rem;color:var(--gth-brand-blue)}.payment-summary[_ngcontent-%COMP%]   mat-card[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{font-size:1rem;font-weight:700;color:var(--gth-brand-green)}.payment-history[_ngcontent-%COMP%]{margin-top:24px}.payment-history[_ngcontent-%COMP%]   h3[_ngcontent-%COMP%]{font-size:1.5rem;margin-bottom:16px;color:#00617f}.payment-history[_ngcontent-%COMP%]   mat-list[_ngcontent-%COMP%]{border:1px solid #e0e0e0;border-radius:8px;max-width:600px;margin:0 auto;padding:16px}.payment-history[_ngcontent-%COMP%]   mat-list[_ngcontent-%COMP%]   .payment-item[_ngcontent-%COMP%]{display:flex;flex-direction:column}.payment-history[_ngcontent-%COMP%]   mat-list[_ngcontent-%COMP%]   .payment-item[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]{margin:4px 0}.payment-history[_ngcontent-%COMP%]   mat-list[_ngcontent-%COMP%]   .payment-item[_ngcontent-%COMP%]   p[_ngcontent-%COMP%]   strong[_ngcontent-%COMP%]{color:var(--gth-brand-green)}@media screen and (max-width:600px){.payment-summary[_ngcontent-%COMP%]{flex-direction:column}}.mt-4[_ngcontent-%COMP%]{margin-top:1rem}mat-list-item[_ngcontent-%COMP%]{margin-bottom:8px}mat-list-item[_ngcontent-%COMP%]   [matListItemTitle][_ngcontent-%COMP%]{font-weight:500;color:var(--gth-brand-blue)}mat-list-item[_ngcontent-%COMP%]   [matListItemLine][_ngcontent-%COMP%]{color:var(--gth-brand-green);font-weight:500}mat-list-item[_ngcontent-%COMP%]   [matListItemMeta][_ngcontent-%COMP%]{color:#0000008a;font-size:.875rem}"]});let d=r;return d})();export{ke as FormPaymentsManagerComponent};

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.