PageSourceSearch

https://app.nextservice.ai/_nuxt/Cz_D64zU.js

js nextservice.ai collected 2026-10-05 12:19:31 UTC 9,767 bytes, 1 lines download raw bytes

1import{_ as ue,a as me,b as de}from"./BxqFQt5z.js";import{_ as ce}from"./fYXKesmp.js";import{_ as fe}from"./DzUFlH_f.js";import{_ as H}from"./BEjQI2GI.js";import{_ as R}from"./Cul8e6M_.js";import{a as J,_ as W}from"./ChtBTa7N.js";import{_ as Y}from"./BKawZoVz.js";import{_ as q}from"./BOZdWnI3.js";import{_ as pe}from"./Dxy42zG2.js";import{_ as I}from"./eY_C2HQg.js";import{r as O,h as _e}from"./P5erXJtz.js";import{d as se,J as ie,r as l,ae as G,D as le,w as K,a as N,b as e,e as a,o as w,f as o,l as m,C as V,g as r,q as F,H as ve,s as ge,y as ye,c as k,I as be,W as xe,N as he,h as B,i as $e,P as we,ad as Q}from"./DHvuqvus.js";import{_ as X,a as Z,b as ee,c as te,d as oe}from"./Dnyb5q5v.js";import{_ as Ce,a as Se,b as ae,c as ne}from"./Izs8xUIC.js";import{u as ke}from"./CfVWCJLj.js";import{u as Ve}from"./DUNAcksN.js";import{u as re}from"./c0ZmTZXs.js";import{_ as Ee}from"./DwtBe7Uo.js";import{_ as Pe}from"./DjwC5oVn.js";import{t as Re}from"./4IvvoSZW.js";import{o as Ie,s as De}from"./GiQOLwvz.js";import{_ as Ue}from"./D0GSvvrH.js";import"./C2CxWxY3.js";import"./CPdmLAjH.js";import"./Dc6PsyJm.js";import"./EJI4Tf_6.js";import"./mjpYhX_L.js";import"./CvpFnLlg.js";import"./C9NiGX-J.js";import"./RB8NJGzm.js";import"./CevMyRiB.js";import"./B3UK58yt.js";import"./UIwsB3ZE.js";import"./DFgkDSfM.js";import"./D-VFx-vP.js";import"./DZEJXt5M.js";import"./DWxfQlHC.js";import"./l-lzLHU9.js";import"./tY5T60-X.js";import"./Kt0SlCk8.js";import"./C30i1zjd.js";import"./Dj5HWj1K.js";import"./Y4sEX2FZ.js";import"./qaA5tcgd.js";import"./yegyGoGs.js";import"./C-017vRl.js";import"./C1dTkrXI.js";import"./BNCFaTEt.js";import"./DjdP5Jsz.js";import"./DxsOasUc.js";import"./f43TDgFL.js";import"./Dw00tmVh.js";import"./DlKg5tbf.js";import"./q2OLsOyu.js";import"./DFxOGB2_.js";import"./DhNZ13GY.js";import"./JkS7F8fJ.js";import"./CZrQ9aBr.js";import"./CoDBpkH-.js";import"./Bf6c7hY5.js";import"./Q44RrEk5.js";import"./BQ_j8d3G.js";import"./yuVcaEny.js";import"./DbOJK3Y5.js";import"./CNA64o7P.js";import"./DgwU2koS.js";import"./C5N5Y1DG.js";import"./Dvr4lk9c.js";import"./CyaK_vFW.js";import"./BmTpb2hC.js";import"./Bc8Ran7y.js";import"./BsrwAaw_.js";import"./Di5L3bt9.js";import"./ICLLeFMo.js";import"./BDlpqF4y.js";import"./d7sQJBkx.js";const ze={class:"flex flex-col gap-2"},Ae={class:"flex flex-col gap-2"},Te={class:"flex flex-col gap-2"},Me={class:"flex flex-col gap-2"},Be=se({__name:"CollectPayment",props:{invoice:{}},emits:["updated"],setup(L,{emit:D}){const h=L,u=D,$=ie(),C=l(null),g=l(null),c="a"+O(),_="a"+O(),S=(i=null)=>{i&&(g.value=i);const t=g.value.elements(),s=_e(getComputedStyle(document.documentElement).getPropertyValue("--foreground"));C.value=t.create("card",{style:{base:{color:s,fontFamily:"Arial, sans-serif",fontSmoothing:"antialiased"},invalid:{color:"#fa755a",iconColor:"#fa755a"}}}),C.value.mount("#"+c)},{load:U}=Ve(),z=G("organization");U(z.value.stripe_account_id).then(i=>{S(i)});const y=l(!1),{handleError:A}=re(),{toast:b}=le(),f=l("card");async function T(){y.value=!0;let i=null;if(f.value==="card"){const s=await g.value.createPaymentMethod({type:"card",card:C.value});if(s.error){const n=document.getElementById(_);n&&(n.textContent=s.error.message||null),y.value=!1;return}else i=s.paymentMethod.id}try{const t={paymentMethodId:i,amount:d.value,paymentMethod:f.value,receipts:p.value},s=new FormData;ke(s,t),await F(`/api/invoices/byUuid/${h.invoice.uuid}/collectPayment`,{method:"post",body:s}),y.value=!1,u("updated"),b({title:"Payment completed successfully",variant:"success",description:"Your payment has been processed."}),ve("paymentCollected")}catch(t){A(t),y.value=!1}}const d=l(),p=l([]),E={style:"currency",currency:G("branch").value.billing_currency,currencyDisplay:"code",currencySign:"accounting"};K(()=>h.invoice.due_amount,i=>{i&&(d.value=parseFloat(i))},{immediate:!0}),K(f,i=>{i==="card"&&ge(()=>{S()})});function M(i){let t=i.target.files||i.dataTransfer.files;if(!t.length){p.value=[];return}p.value=Array.from(t)}return(i,t)=>{var P;const s=ce,n=fe;return(P=e($).user)!=null&&P.organization.stripe_verified?(w(),N(e(R),{key:0},{default:a(()=>[o(e(W),null,{default:a(()=>[o(e(J),null,{default:a(()=>t[3]||(t[3]=[m("Collect Payment")])),_:1}),o(e(Y),null,{default:a(()=>t[4]||(t[4]=[m(" Collect payment from customer. ")])),_:1})]),_:1}),o(e(q),{class:"grid gap-6"},{default:a(()=>[o(e(Ce),{modelValue:e(f),"onUpdate:modelValue":t[2]||(t[2]=x=>V(f)?f.value=x:null)},{default:a(()=>[o(e(Se),{class:"grid w-full grid-cols-2"},{default:a(()=>[o(e(ae),{value:"card"},{default:a(()=>t[5]||(t[5]=[m(" Card ")])),_:1}),o(e(ae),{value:"cash"},{default:a(()=>t[6]||(t[6]=[m(" Cash ")])),_:1})]),_:1}),o(e(ne),{value:"card"},{default:a(()=>[o(e(R),{class:"p-2 flex flex-col gap-4"},{default:a(()=>[r("div",ze,[o(e(I),{for:c},{default:a(()=>t[7]||(t[7]=[m("Payment Information")])),_:1}),r("div",{id:c,class:"bg-background border border-input text-sm rounded-md block w-full p-2.5"}),r("div",{id:_,role:"alert",class:"text-red-500 mt-2"})]),r("div",Ae,[o(e(I),{for:"amount"},{default:a(()=>t[8]||(t[8]=[m("Amount to Charge")])),_:1}
1),o(e(X),{class:"gap-2",min:0,step:.01,"format-options":E,modelValue:e(d),"onUpdate:modelValue":t[0]||(t[0]=x=>V(d)?d.value=x:null)},{default:a(()=>[o(e(Z),null,{default:a(()=>[o(e(ee)),o(e(te)),o(e(oe))]),_:1})]),_:1},8,["modelValue"])])]),_:1})]),_:1}),o(e(ne),{value:"cash"},{default:a(()=>[o(e(R),{class:"p-2 flex flex-col gap-4"},{default:a(()=>[r("div",Te,[o(e(I),{for:"amount"},{default:a(()=>t[9]||(t[9]=[m("Amount to Charge")])),_:1}),o(e(X),{class:"gap-2",min:0,step:.01,"format-options":E,modelValue:e(d),"onUpdate:modelValue":t[1]||(t[1]=x=>V(d)?d.value=x:null)},{default:a(()=>[o(e(Z),null,{default:a(()=>[o(e(ee)),o(e(te)),o(e(oe))]),_:1})]),_:1},8,["modelValue"])]),r("div",Me,[o(e(I),{for:"receipt"},{default:a(()=>t[10]||(t[10]=[m("Upload proof of receipt")])),_:1}),o(s,{id:"receipt",multiple:"",type:"file",onChange:M})])]),_:1})]),_:1})]),_:1},8,["modelValue"])]),_:1}),o(e(pe),null,{default:a(()=>[o(e(H),{loading:e(y),onClick:T,class:"w-full"},{default:a(()=>t[11]||(t[11]=[m(" Continue ")])),_:1},8,["loading"])]),_:1})]),_:1})):(w(),N(e(R),{key:1},{default:a(()=>[o(e(W),null,{default:a(()=>[o(e(J),null,{default:a(()=>t[12]||(t[12]=[m("Configure Stripe")])),_:1}),o(e(Y),null,{default:a(()=>t[13]||(t[13]=[m(" Your stripe account is not connected, please connect to start accepting payments. ")])),_:1})]),_:1}),o(e(q),{class:"grid gap-6"},{default:a(()=>[o(n,{to:{name:"settings-bank"}},{default:a(()=>[o(e(H),{size:"sm"},{default:a(()=>t[14]||(t[14]=[m("Configure Stripe")])),_:1})]),_:1})]),_:1})]),_:1}))}}}),Ne={class:"p-4 mx-auto"},Fe={key:0,class:"flex justify-center items-center min-h-[60vh]"},Le={key:1,class:"flex flex-col lg:flex-row gap-4 lg:gap-8"},je={class:"w-full lg:w-2/3 flex flex-col gap-4"},He={class:"w-full lg:w-1/3 flex flex-col gap-4 order-first lg:order-last"},Je={class:"lg:sticky lg:top-4"},po=se({__name:"[id]",setup(L){const D=ye(),h=k(()=>D.params.id),u=l({}),$=l(!0),C=l(!1);be(()=>{g(),window.addEventListener("resize",g),c()}),xe(()=>{window.removeEventListener("resize",g)});function g(){C.value=window.innerWidth<1024}function c(){$.value=!0,F("/api/invoices/"+h.value,{params:{with:JSON.stringify(["invoiceItems","invoiceable","customer.contacts"])}}).then(s=>{const n=s;u.value={...n.data,invoice_date:new Date(n.data.invoice_date),due_date:new Date(n.data.due_date)},$.value=!1}).catch(()=>{$.value=!1})}const _=l(!1),S=ie(),U=k(()=>S.user.organization);Q("organization",U);const z=k(()=>{var s;return(s=S.user)==null?void 0:s.branch});Q("branch",z);const y=k(()=>{var s,n;return((s=u.value)==null?void 0:s.status)!=="Paid"&&((n=u.value)==null?void 0:n.status)!=="Refund"}),A=k(()=>u.value.status!=="Refund"&&u.value.status!=="Due"),b=l(!1),f=l(),{handleError:T}=re(),{toast:d}=le(),p=l(!1);function j(){p.value=!0}function E(s){b.value||(b.value=!0,F(`/api/invoices/${h.value}/refund`,{method:"post",body:s}).then(n=>{b.value=!1,p.value=!1,c(),f.value.fetchData(),d({title:"Refunded",description:"Transaction successfully refunded",variant:"success"})}).catch(n=>{b.value=!1,T(n)}))}const M=Re(Ie({reason:De().nullish()})),t=he({validationSchema:M}).handleSubmit(async s=>{E(s)});return(s,n)=>{const P=me,x=de;return w(),B("div",Ne,[e($)?(w(),B("div",Fe,n[4]||(n[4]=[r("div",{class:"flex flex-col items-center gap-2"},[r("div",{class:"animate-spin rounded-full h-12 w-12 border-b-2 border-gray-900"}),r("p",{class:"text-gray-600"},"Loading invoice...")],-1)]))):(w(),B("div",Le,[r("div",je,[o(P,{"edit-mode":e(_),"onUpdate:editMode":n[0]||(n[0]=v=>V(_)?_.value=v:null),invoice:e(u),onUpdated:c},null,8,["edit-mode","invoice"]),o(ue,{ref_key:"tableRef",ref:f,onUpdated:c,"invoice-id":e(h)},null,8,["invoice-id"])]),r("div",He,[r("div",Je,[e(u).status!=="Paid"&&e(u).due_amount>0?(w(),N(Be,{key:0,onUpdated:c,invoice:e(u),class:"bg-white rounded-lg shadow-md mb-4"},null,8,["invoice"])):$e("",!0),o(x,{editable:e(y),refundable:e(A),onRefund:j,invoice:e(u),onEdit:n[1]||(n[1]=v=>_.value=!e(_)),class:"bg-white rounded-lg shadow-sm"},null,8,["editable","refundable","invoice"])])])])),o(Ee,{onConfirm:e(t),modelValue:e(p),"onUpdate:modelValue":n[3]||(n[3]=v=>V(p)?p.value=v:null),loading:e(b),class:"max-w-[90%] md:max-w-[500px] p-1 md:p-4 roun
1ded-md","confirm-label":"Refund",description:"Clicking refund will result in full refund of this invoice.",title:"Please confirm full refund"},{content:a(()=>[r("form",{onSubmit:n[2]||(n[2]=(...v)=>e(t)&&e(t)(...v)),class:"px-2 md:px-6"},[o(Pe,{name:"reason",label:"Refund Reason"},{control:a(({componentField:v})=>[o(e(Ue),we(v,{placeholder:"Enter reason for refund...",class:"w-full"}),null,16)]),_:1})],32)]),_:1},8,["onConfirm","modelValue","loading"])])}}});export{po as default};

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.