whoami7 - Manager
:
/
home
/
qbizpnmr
/
arif.umairtax.com
/
public
/
Upload File:
files >> /home/qbizpnmr/arif.umairtax.com/public/useHandleProductChange-DQ23MQg-.js
import{u as b,a as N,t as P,j as e,C,by as m,cx as _,cy as w,l as F,cz as j,bc as E,E as H,bx as L,cA as g,bC as k,w as R,Y as T,cK as Y,p,cX as B,bq as $,i as D,a8 as z,b2 as q,cv as A,be as v,c2 as G}from"./bundle.OlIVtvc7.js";function K(d){var x,u,h,c;const[n]=b(),{purchaseOrder:s,handleChange:t,errors:a}=d,i=N(),l=P();return e.jsxs(e.Fragment,{children:[e.jsxs(C,{className:"col-span-12 xl:col-span-4 h-max shadow-sm",style:{borderColor:i.$24},children:[e.jsx(m,{leftSide:n("purchase_order_date"),children:e.jsx(_,{type:"date",value:s.date,onValueChange:o=>t("date",o),errorMessage:a==null?void 0:a.errors.date})}),e.jsx(m,{leftSide:n("due_date"),children:e.jsx(_,{type:"date",value:s.due_date,onValueChange:o=>t("due_date",o),errorMessage:a==null?void 0:a.errors.due_date})}),e.jsx(m,{leftSide:n("partial"),children:e.jsx(w,{value:s.partial||"",onValueChange:o=>t("partial",parseFloat(o)||0),changeOverride:!0,errorMessage:a==null?void 0:a.errors.partial})}),s&&s.partial>0&&e.jsx(m,{leftSide:n("partial_due_date"),children:e.jsx(_,{type:"date",value:F(s.partial_due_date.toString(),"YYYY-MM-DD"),onValueChange:o=>t("partial_due_date",o),errorMessage:a==null?void 0:a.errors.partial_due_date})}),s&&((x=l==null?void 0:l.custom_fields)==null?void 0:x.invoice1)&&e.jsx(j,{field:"invoice1",defaultValue:(s==null?void 0:s.custom_value1)||"",value:l.custom_fields.invoice1,onValueChange:o=>t("custom_value1",o.toString())}),s&&((u=l==null?void 0:l.custom_fields)==null?void 0:u.invoice2)&&e.jsx(j,{field:"invoice2",defaultValue:(s==null?void 0:s.custom_value2)||"",value:l.custom_fields.invoice2,onValueChange:o=>t("custom_value2",o.toString())})]}),e.jsxs(C,{className:"col-span-12 xl:col-span-4 h-max shadow-sm",style:{borderColor:i.$24},children:[e.jsx(m,{leftSide:n("po_number"),children:e.jsx(_,{value:s.number,onValueChange:o=>t("number",o),errorMessage:a==null?void 0:a.errors.number})}),e.jsx(m,{leftSide:n("discount"),children:e.jsxs(E,{children:[e.jsx("div",{className:"w-full lg:w-1/2",children:e.jsxs(H,{value:s.is_amount_discount.toString(),onValueChange:o=>t("is_amount_discount",JSON.parse(o)),errorMessage:a==null?void 0:a.errors.is_amount_discount,customSelector:!0,dismissable:!1,children:[e.jsx("option",{value:"false",children:n("percent")}),e.jsx("option",{value:"true",children:n("amount")})]})}),e.jsx("div",{className:"w-full lg:w-1/2",children:e.jsx(w,{value:s.discount||"",onValueChange:o=>t("discount",parseFloat(o)||0),errorMessage:a==null?void 0:a.errors.discount})})]})}),s&&((h=l==null?void 0:l.custom_fields)==null?void 0:h.invoice3)&&e.jsx(j,{field:"invoice3",defaultValue:(s==null?void 0:s.custom_value3)||"",value:l.custom_fields.invoice3,onValueChange:o=>t("custom_value3",o.toString())}),s&&((c=l==null?void 0:l.custom_fields)==null?void 0:c.invoice4)&&e.jsx(j,{field:"invoice4",defaultValue:(s==null?void 0:s.custom_value4)||"",value:l.custom_fields.invoice4,onValueChange:o=>t("custom_value4",o.toString())})]})]})}function W(d){const[n]=b(),s=N(),{purchaseOrder:t,handleChange:a,isDefaultTerms:i,isDefaultFooter:l,setIsDefaultFooter:x,setIsDefaultTerms:u}=d,h=[n("public_notes"),n("private_notes"),n("terms"),n("footer")];return e.jsx(C,{className:"col-span-12 xl:col-span-8 shadow-sm h-max",style:{borderColor:s.$24},children:e.jsxs(L,{tabs:h,withoutVerticalMargin:!0,withHorizontalPadding:!0,horizontalPaddingWidth:"1.5rem",fullRightPadding:!0,children:[e.jsx("div",{className:"mb-4 px-6",children:e.jsx(g,{value:t.public_notes||"",onChange:c=>a("public_notes",c)})}),e.jsx("div",{className:"mb-4 px-6",children:e.jsx(g,{value:t.private_notes||"",onChange:c=>a("private_notes",c)})}),e.jsxs("div",{className:"px-6",children:[e.jsx(g,{value:t.terms||"",onChange:c=>a("terms",c)}),e.jsx(m,{className:"mt-4",leftSide:e.jsx(k,{checked:i,onValueChange:c=>u(c)}),noExternalPadding:!0,noVerticalPadding:!0,children:e.jsx("span",{className:"font-medium",children:n("save_as_default_terms")})})]}),e.jsxs("div",{className:"px-6",children:[e.jsx(g,{value:t.footer||"",onChange:c=>a("footer",c)}),e.jsx(m,{className:"mt-4",leftSide:e.jsx(k,{checked:l,onValueChange:c=>x(c)}),noExternalPadding:!0,noVerticalPadding:!0,children:e.jsx("span",{className:"font-medium",children:n("save_as_default_footer")})})]})]})})}function X(d){var V,S;const[n]=b(),s=N(),t=R(),a=T(),{resource:i,initiallyVisible:l}=d,x=Y(),[u,h]=p.useState(),[c,o]=p.useState("");p.useEffect(()=>{c&&x.find(c).then(r=>h(r))},[c]),p.useEffect(()=>{var r;i&&o(i.vendor_id||((r=i.vendor)==null?void 0:r.id)||"")},[i==null?void 0:i.vendor_id,(V=i==null?void 0:i.vendor)==null?void 0:V.id]);const I=r=>{var f;return!!((f=d.resource)==null?void 0:f.invitations.find(M=>M.vendor_contact_id===r))};return e.jsxs("div",{className:"flex flex-col space-y-4",children:[e.jsxs("div",{className:"flex flex-col justify-between space-y-0.5",style:{color:s.$3},children:[d.readonly?e.jsxs("div",{className:"flex space-x-10",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:s.$22},children:n("vendor")}),e.jsx("span",{className:"text-sm font-medium",children:(S=i==null?void 0:i.vendor)==null?void 0:S.name})]}):e.jsx(B,{inputLabel:n("vendor"),onChange:r=>d.onChange(r.id),value:c,readonly:d.readonly,onClearButtonClick:d.onClearButtonClick,initiallyVisible:l,errorMessage:d.errorMessage}),u&&e.jsxs("div",{className:"space-x-2",children:[a("edit_vendor")&&e.jsx($,{className:"font-medium",to:D("/vendors/:id/edit",{id:u.id}),children:n("edit")}),a("edit_vendor")&&e.jsx("span",{className:"text-sm",style:{color:s.$21},children:"|"}),(a("view_vendor")||a("edit_vendor"))&&e.jsx($,{className:"font-medium",to:D("/vendors/:id",{id:u.id}),children:n("view")})]})]}),c&&u&&u.contacts.length>0&&e.jsxs("div",{children:[e.jsx(z,{className:"mb-2.5",children:n("contacts")}),e.jsx("div",{className:q("divide-y divide-dashed",{"divide-[#09090B1A]":!t.dark_mode,"divide-[#1f2e41]":t.dark_mode}),children:u.contacts.map((r,y)=>e.jsx("div",{className:"flex justify-between items-center first:pt-0 pt-2 pb-2",children:e.jsx("div",{className:"flex flex-col w-full",children:e.jsxs("div",{className:"flex space-x-2.5 w-full",children:[e.jsx(A,{id:r.id,value:r.id,checked:I(r.id),onChange:f=>d.onContactCheckboxChange(f.target.value,f.target.checked)}),e.jsxs("div",{className:"flex flex-col truncate",children:[e.jsx("span",{className:"text-sm font-medium",style:{color:s.$3},children:r.first_name.length>=1?`${r.first_name} ${r.last_name}`:r.email||u.name}),r.first_name&&e.jsx("span",{className:"text-sm",style:{color:s.$22},children:r.email})]})]})})},y))})]})]})}/** * 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 Q(d){return async n=>{const s=v.cloneDeep(n);s.line_items.push({...G(),quantity:1}),d(s)}}/** * 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 U(d){return async(n,s)=>{const t=v.cloneDeep(n);t.line_items.splice(s,1),d(t)}}/** * 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(d){return(n,s,t)=>{let a=[...n.invitations];const i=(a==null?void 0:a.find(l=>l.vendor_contact_id===s))||-1;if(i!==-1&&t===!1&&(a=a.filter(l=>l.vendor_contact_id!==s)),i===-1){const l={vendor_contact_id:"",client_contact_id:""};l.vendor_contact_id=s,a.push(l)}d("invitations",a)}}/** * 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 O(d){return(n,s,t,a)=>{const i=v.cloneDeep(n);i.line_items[a][s]!==t&&(v.set(i,`line_items.${a}.${s}`,t),d(i))}}/** * 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 ee(d){return(n,s,t)=>{const a=v.cloneDeep(n);v.set(a,`line_items.${s}`,t),d(a)}}export{K as D,W as F,X as V,U as a,Q as b,O as c,ee as d,Z as u};
Copyright ©2021 || Defacer Indonesia