whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> /home/qbizpnmr/arif.umairtax.com/public/Edit-Cx1RH3iU.js
import{u as F,d as D,a as w,f as L,j as t,bi as E,i as I,es as P,l as T,b2 as B,aA as z,L as O,cq as R,p as A,t as q,C as G,by as g,cx as S,E as H,cz as V,bC as J}from"./bundle.OlIVtvc7.js";import{u as K,C as Q}from"./usePaymentTypes-BHeQ2Qab.js";import{P as U}from"./PaymentStatus-z209A_tu.js";import{I as W}from"./InfoCard-BvC2FhUQ.js";import{C as X}from"./ClientActionButtons-DC8u7uNL.js";import"./payment-status-DaLbqgbM.js";function k(e,d,s){var o,n;if(s){const c=(o=e==null?void 0:e.credits)==null?void 0:o.find(u=>u.id==d.credit_id);return(c==null?void 0:c.number)||""}const i=(n=e==null?void 0:e.invoices)==null?void 0:n.find(c=>c.id==d.invoice_id);return(i==null?void 0:i.number)||""}function Y(e){var n,c,u,v,a,r,m,x,y,h,j,f;const[d]=F(),s=D(),i=w(),{dateFormat:o}=L();return t.jsxs(t.Fragment,{children:[e.paymentable.invoice_id&&t.jsxs("div",{className:"grid grid-cols-1 gap-2 my-2 border-t border-b py-4",style:{borderColor:i.$20},children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{style:{color:i.$3},children:d("invoice")}),t.jsx(E,{to:I("/invoices/:id/edit",{id:e.paymentable.invoice_id}),children:t.jsxs("div",{className:"flex items-center gap-2",style:{color:i.$3,colorScheme:i.$0},children:[t.jsx("span",{children:k(e.payment,e.paymentable)}),t.jsx("div",{children:t.jsx(P,{color:"#0062FF",size:"1.1rem"})})]})})]})}),t.jsxs("div",{className:"flex items-center justify-center space-x-5",children:[t.jsx("span",{style:{color:i.$3},children:s(((n=e==null?void 0:e.paymentable)==null?void 0:n.amount)||0,(c=e.payment.client)==null?void 0:c.country_id,(u=e.payment)==null?void 0:u.currency_id)}),t.jsx("span",{style:{color:i.$3},children:T(new Date(e.paymentable.created_at*1e3).toString(),o)}),e.paymentable.refunded>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("span",{style:{color:"red"},children:s(((v=e==null?void 0:e.paymentable)==null?void 0:v.refunded)||0,(a=e.payment.client)==null?void 0:a.country_id,(r=e.payment)==null?void 0:r.currency_id)}),t.jsx("span",{style:{color:"red"},children:d("refunded")})]})]})]}),e.paymentable.credit_id&&t.jsxs("div",{className:"grid grid-cols-1 gap-2 my-2 border-t border-b py-4",style:{borderColor:i.$20},children:[t.jsx("div",{className:"flex items-center justify-center",children:t.jsxs("div",{className:"flex items-center space-x-2",children:[t.jsx("span",{style:{color:i.$3},children:d("credit")}),t.jsx(E,{to:I("/credits/:id/edit",{id:e.paymentable.credit_id}),children:t.jsxs("div",{className:"flex items-center gap-2",style:{color:i.$3,colorScheme:i.$0},children:[t.jsx("span",{children:k(e.payment,e.paymentable,!0)}),t.jsx("div",{children:t.jsx(P,{color:"#0062FF",size:"1.1rem"})})]})})]})}),t.jsxs("div",{className:"flex items-center justify-center space-x-5",children:[t.jsx("span",{style:{color:i.$3},children:s(((m=e==null?void 0:e.paymentable)==null?void 0:m.amount)||0,(x=e.payment.client)==null?void 0:x.country_id,(y=e.payment)==null?void 0:y.currency_id)}),t.jsx("span",{style:{color:i.$3},children:T(new Date(e.paymentable.created_at*1e3).toString(),o)}),e.paymentable.refunded>0&&t.jsxs("div",{className:"flex items-center space-x-1",children:[t.jsx("span",{style:{color:"red"},children:s(((h=e==null?void 0:e.paymentable)==null?void 0:h.refunded)||0,(j=e.payment.client)==null?void 0:j.country_id,(f=e.payment)==null?void 0:f.currency_id)}),t.jsx("span",{style:{color:"red"},children:d("refunded")})]})]})]})]})}function Z(e){var o,n,c,u,v,a,r,m,x,y,h,j,f,C,$,N,l,_,b;const[d]=F(),s=w(),i=D();return t.jsxs("div",{children:[t.jsxs("div",{className:B("border-t mt-6 pt-6 px-4 md:px-6",{"pb-4":e.payment.paymentables.length}),style:{borderColor:s.$20},children:[t.jsx("div",{className:"flex justify-center mb-5",children:t.jsx(U,{entity:e.payment})}),t.jsxs("div",{className:B("grid grid-cols-2 gap-3 text-sm md:text-base",{"sm:grid-cols-4":((o=e==null?void 0:e.payment)==null?void 0:o.applied)<((n=e==null?void 0:e.payment)==null?void 0:n.amount),"sm:grid-cols-3":((c=e==null?void 0:e.payment)==null?void 0:c.applied)>=((u=e==null?void 0:e.payment)==null?void 0:u.amount)}),children:[t.jsxs("div",{className:"rounded-md p-3 flex items-center flex-col shadow-sm border",style:{borderColor:s.$20},children:[t.jsx("span",{className:"text-xs mb-1",style:{color:s.$22},children:d("amount")}),t.jsx("span",{className:"font-medium text-base md:text-lg",style:{color:s.$3},children:i(((v=e==null?void 0:e.payment)==null?void 0:v.amount)||0,(a=e.payment.client)==null?void 0:a.country_id,(r=e.payment)==null?void 0:r.currency_id)})]}),t.jsxs("div",{className:"rounded-md p-3 flex items-center flex-col shadow-sm border",style:{borderColor:s.$20},children:[t.jsx("span",{className:"text-xs mb-1",style:{color:s.$22},children:d("applied")}),t.jsx("span",{className:"font-medium text-base md:text-lg",style:{color:s.$3},children:i(((m=e==null?void 0:e.payment)==null?void 0:m.applied)||0,(x=e.payment.client)==null?void 0:x.country_id,(y=e.payment)==null?void 0:y.currency_id)})]}),t.jsxs("div",{className:"rounded-md p-3 flex items-center flex-col shadow-sm border",style:{borderColor:s.$20},children:[t.jsx("span",{className:"text-xs mb-1",style:{color:s.$22},children:d("refunded")}),t.jsx("span",{className:"font-medium text-base md:text-lg",style:{color:s.$3},children:i(((h=e==null?void 0:e.payment)==null?void 0:h.refunded)||0,(j=e.payment.client)==null?void 0:j.country_id,(f=e.payment)==null?void 0:f.currency_id)})]}),((C=e==null?void 0:e.payment)==null?void 0:C.applied)<(($=e==null?void 0:e.payment)==null?void 0:$.amount)&&t.jsxs("div",{className:"rounded-md p-3 flex items-center flex-col shadow-sm border",style:{borderColor:s.$20},children:[t.jsx("span",{className:"text-xs mb-1",style:{color:s.$22},children:d("unapplied")}),t.jsx("span",{className:"font-medium text-base md:text-lg",style:{color:s.$3},children:i(((N=e==null?void 0:e.payment)==null?void 0:N.amount)-((l=e==null?void 0:e.payment)==null?void 0:l.applied)||0,(_=e.payment.client)==null?void 0:_.country_id,(b=e.payment)==null?void 0:b.currency_id)})]})]})]}),e.payment.paymentables.length?t.jsx("div",{className:"pb-2",children:e.payment.paymentables.map(M=>t.jsx(Y,{payment:e.payment,paymentable:M},M.id))}):t.jsx(z,{borderColor:s.$20})]})}function p(e){const[d]=F(),{client:s}=e,i=w();return t.jsx(t.Fragment,{children:s&&t.jsx("div",{className:"col-span-12 lg:col-span-3 px-4 sm:px-6",children:t.jsx(W,{title:d("client"),value:t.jsx(X,{displayClientName:!0,client:s}),className:"h-full",style:{borderColor:i.$24}})})})}function se(){var x,y,h,j,f,C,$,N;const{documentTitle:e}=O("edit_payment"),[d]=F(),s=K(),i=R(),{setPayment:o,payment:n,errors:c}=i,[u,v]=A.useState(!!(n!=null&&n.exchange_currency_id)),a=q(),r=w(),m=(l,_)=>{o(b=>b&&{...b,[l]:_})};return t.jsxs(G,{title:e,className:"shadow-sm",style:{borderColor:r.$24},headerStyle:{borderColor:r.$20},children:[(n==null?void 0:n.client)&&t.jsx("div",{className:"pt-2",children:t.jsx(p,{client:n.client})}),n&&t.jsx(Z,{payment:n}),t.jsx(g,{leftSide:d("payment_number"),children:t.jsx(S,{style:{color:r.$3,colorScheme:r.$0},id:"number",value:n==null?void 0:n.number,onValueChange:l=>m("number",l),errorMessage:c==null?void 0:c.errors.number})}),t.jsx(g,{leftSide:d("payment_date"),children:t.jsx(S,{style:{color:r.$3,colorScheme:r.$0},id:"date",type:"date",value:n==null?void 0:n.date,onValueChange:l=>m("date",l),errorMessage:c==null?void 0:c.errors.date})}),t.jsx(g,{leftSide:d("payment_type"),children:t.jsx(H,{value:n==null?void 0:n.type_id,onValueChange:l=>m("type_id",l),errorMessage:c==null?void 0:c.errors.type_id,withBlank:!0,customSelector:!0,style:{color:r.$3,colorScheme:r.$0},children:s.map(([l,_],b)=>t.jsx("option",{value:l,children:_},b))})}),t.jsx(g,{leftSide:d("transaction_reference"),children:t.jsx(S,{style:{color:r.$3,colorScheme:r.$0},id:"transaction_reference",onValueChange:l=>m("transaction_reference",l),value:n==null?void 0:n.transaction_reference,errorMessage:c==null?void 0:c.errors.transaction_reference})}),t.jsx(g,{leftSide:d("private_notes"),children:t.jsx(S,{style:{color:r.$3,colorScheme:r.$0},element:"textarea",id:"private_notes",value:n==null?void 0:n.private_notes,onValueChange:l=>m("private_notes",l),errorMessage:c==null?void 0:c.errors.private_notes})}),((x=a==null?void 0:a.custom_fields)==null?void 0:x.payment1)&&t.jsx(V,{field:"custom_value1",defaultValue:n==null?void 0:n.custom_value1,value:(y=a==null?void 0:a.custom_fields)==null?void 0:y.payment1,onValueChange:l=>m("custom_value1",l.toString())}),((h=a==null?void 0:a.custom_fields)==null?void 0:h.payment2)&&t.jsx(V,{field:"custom_value2",defaultValue:n==null?void 0:n.custom_value2,value:(j=a==null?void 0:a.custom_fields)==null?void 0:j.payment2,onValueChange:l=>m("custom_value2",l.toString())}),((f=a==null?void 0:a.custom_fields)==null?void 0:f.payment3)&&t.jsx(V,{field:"custom_value3",defaultValue:n==null?void 0:n.custom_value3,value:(C=a==null?void 0:a.custom_fields)==null?void 0:C.payment3,onValueChange:l=>m("custom_value3",l.toString())}),(($=a==null?void 0:a.custom_fields)==null?void 0:$.payment4)&&t.jsx(V,{field:"custom_value4",defaultValue:n==null?void 0:n.custom_value4,value:(N=a==null?void 0:a.custom_fields)==null?void 0:N.payment4,onValueChange:l=>m("custom_value4",l.toString())}),t.jsx(g,{leftSide:d("convert_currency"),children:t.jsx(J,{style:{color:r.$3,colorScheme:r.$0},checked:!!(n!=null&&n.exchange_currency_id),onChange:l=>{v(l),l||(m("exchange_currency_id",""),m("exchange_rate",1))}})}),n&&(!!(n!=null&&n.exchange_currency_id)||u)&&t.jsx(Q,{exchangeRate:n.exchange_rate.toString()||"1",exchangeCurrencyId:n.exchange_currency_id||"1",currencyId:n.currency_id||"1",amount:n==null?void 0:n.amount,onChange:(l,_)=>{m("exchange_rate",l),m("exchange_currency_id",_)},onExchangeRateChange:l=>m("exchange_rate",l)})]})}export{se as default};
Copyright ©2021 || Defacer Indonesia