whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> /home/qbizpnmr/arif.umairtax.com/public/Payment-D_bOZN71.js
import{bP as k,bf as b,r as C,e as V,$ as w,u as x,ap as N,Y as g,bt as P,bS as j,i as u,j as s,bT as O,p as y,a3 as R,O as U,bX as D,Q as I,e1 as L,bV as F,bW as H,a7 as M,a8 as Q,bE as W}from"./bundle.OlIVtvc7.js";import{b as $}from"./payments-BhlrdSKU.js";import{u as q}from"./useActions-5wRXt2Qd.js";import{B as X}from"./Banner-D9Q__Gmd.js";import{P as Y}from"./PreviousNextNavigation-zAd8_mLU.js";/** * Invoice Ninja (https://invoiceninja.com). * * @link https://github.com/invoiceninja/invoiceninja source repository * * @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com) * * @license https://www.elastic.co/licensing/elastic-license */function z({setErrors:a,isFormBusy:t,setIsFormBusy:l}){const c=k();return async i=>{if(t)return;b.processing(),l(!0),a(void 0),await c({excludeToasters:!0});const d={...i};delete d.invoices,delete d.credits,await c({excludeToasters:!0}),C("PUT",V("/api/v1/payments/:id",{id:i.id}),d).then(()=>{b.success("updated_payment")}).catch(n=>{var e;((e=n.response)==null?void 0:e.status)===422&&(b.dismiss(),a(n.response.data))}).finally(()=>{w(["payments"]),l(!1)})}}function G(a){const[t]=x(),{isAdmin:l,isOwner:c}=N(),i=g(),d=P(),{id:n}=j(),{payment:e}=a,p=i("edit_payment")||d(e),o=i("view_payment")||i("edit_payment")||d(e);let r=[{name:t("edit"),href:u("/payments/:id/edit",{id:n})},{name:t("apply"),href:u("/payments/:id/apply",{id:n}),enabled:p},{name:t("refund"),href:u("/payments/:id/refund",{id:n}),enabled:p},{name:t("documents"),href:u("/payments/:id/documents",{id:n}),enabled:o,formatName:()=>{var m;return s.jsx(O,{numberOfDocuments:(m=e==null?void 0:e.documents)==null?void 0:m.length})}},{name:t("activity"),href:u("/payments/:id/activity",{id:n})},{name:t("custom_fields"),href:u("/payments/:id/payment_fields",{id:n}),enabled:l||c}];return e&&(e.amount-e.applied>0&&!e.is_deleted||(r=r.filter(({name:m})=>m!==t("apply"))),e.amount!==e.refunded&&!e.is_deleted||(r=r.filter(({name:m})=>m!==t("refund")))),r}function se(){const[a]=x(),t=g(),l=P(),{id:c}=j(),{data:i}=$({id:c,include:"credits"}),[d,n]=y.useState(),[e,p]=y.useState(!1),[o,r]=y.useState(),m=[{name:a("payments"),href:"/payments"},{name:a("edit_payment"),href:u("/payments/:id/edit",{id:c})}],T=G({payment:o}),_=z({setErrors:n,isFormBusy:e,setIsFormBusy:p}),S=q();y.useEffect(()=>{i&&r(i)},[i]);const{changeTemplateVisible:A,setChangeTemplateVisible:E,changeTemplateResources:B}=R();return U({on:["App\\Events\\Payment\\PaymentWasUpdated"],callback:({data:f})=>{var h,v;((h=D())==null?void 0:h.toString())!==f["x-socket-id"]&&((v=document.getElementById("paymentUpdateBanner"))==null||v.classList.remove("hidden"))}}),s.jsxs(I,{title:a("payment"),breadcrumbs:m,...(t("edit_payment")||l(o))&&o&&{onSaveClick:()=>_(o),navigationTopRight:s.jsx(W,{label:a("more_actions"),resource:o,actions:S,cypressRef:"paymentActionDropdown"}),disableSaveButton:!o||e},aboveMainContainer:s.jsx(X,{id:"paymentUpdateBanner",className:"hidden",variant:"orange",children:a("payment_status_changed")}),afterBreadcrumbs:s.jsx(Y,{entity:"payment"}),children:[s.jsxs(L,{breadcrumbs:[],children:[s.jsx(F,{tabs:T,disableBackupNavigation:!0}),s.jsx(H,{context:{errors:d,payment:o,setPayment:r}})]}),s.jsx(M,{entity:"payment",entities:B,visible:A,setVisible:E,labelFn:f=>s.jsxs("div",{className:"flex flex-col space-y-1",children:[s.jsx(Q,{children:a("number")}),s.jsx("span",{children:f.number})]}),bulkUrl:"/api/v1/payments/bulk"})]})}export{se as default};
Copyright ©2021 || Defacer Indonesia