import{b as r}from"./app-DTeOhhdM.js";const i={title:"Quotation Details",breadcrumb:"Home - Quotation View",backRoute:"product-quotation.index",approvableType:"productQuotationMaster",getNumber:e=>e.quotation_number,getDate:e=>e.date,getTotalAmount:e=>{var t;return((t=e.product_quotation_details)==null?void 0:t.reduce((a,l)=>a+(Number(l.total)||0),0))||0},getStatusBadge:e=>!e.approval_status||e.approval_status==="draft"?r.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-gray-100 text-gray-800",children:"DRAFT"}):null,getApprovalStatusBadge:e=>{const t=e.approval_status;return!t||t==="draft"?null:t==="approved"?r.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-green-100 text-green-800",children:"Approved"}):t==="rejected"?r.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-red-100 text-red-800",children:"Rejected"}):t==="pending"?r.jsx("span",{className:"px-2 py-0.5 text-xs font-medium rounded bg-yellow-100 text-yellow-800",children:"Pending Approval"}):null},summaryFields:[{label:"Quotation No",value:e=>e.quotation_number},{label:"Date",value:e=>new Date(e.date).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"})},{label:"Status",value:e=>r.jsx("div",{className:"flex flex-wrap gap-1 items-center",children:e.approval_status==="draft"||!e.approval_status?i.getStatusBadge(e):i.getApprovalStatusBadge(e)})},{label:"Total Amount",value:e=>{var a;return`৳${(((a=e.product_quotation_details)==null?void 0:a.reduce((l,n)=>l+(Number(n.total)||0),0))||0).toFixed(2)}`}}],infoCards:[{title:"Quotation Info",fields:[{label:"Setting",getValue:e=>{var t;return((t=e.product_quotation_setting)==null?void 0:t.title)||"N/A"}},{label:"Delivery Lead Time",getValue:e=>e.delivery_lead_time?new Date(e.delivery_lead_time).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric"}):"N/A"},{label:"Validity Period",getValue:e=>e.validity_period||"N/A"},{label:"Payment Term",getValue:e=>e.payment_term||"N/A"}]},{title:"Client Info",fields:[{label:"Name",getValue:e=>{var t;return((t=e.client)==null?void 0:t.name)||"N/A"}},{label:"Code",getValue:e=>{var t;return((t=e.client)==null?void 0:t.code)||"N/A"}},{label:"Phone",getValue:e=>{var t;return((t=e.client)==null?void 0:t.number)||"N/A"}},{label:"Email",getValue:e=>{var t;return((t=e.client)==null?void 0:t.email)||"N/A"}}]}],itemsField:"product_quotation_details",itemsLabel:"Quotation Items",getTableColumns:(e,t)=>[{header:"Product",field:"product",sortable:!0,render:a=>{var l,n,o,s;return r.jsxs("div",{children:[r.jsx("div",{className:"text-sm font-medium text-gray-900",children:a.product_name||((l=a.product)==null?void 0:l.name)||((o=(n=a.attribute)==null?void 0:n.product)==null?void 0:o.name)||"Unknown Product"}),((s=a.attribute)==null?void 0:s.sku)&&r.jsxs("div",{className:"text-xs text-gray-500 mt-0.5",children:["SKU: ",a.attribute.sku]})]})}},{header:"Qty",field:"quantity",align:"center",sortable:!0,render:a=>{var l,n;return r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-gray-900",children:parseFloat(a.quantity||0).toFixed(2)}),((n=(l=a.attribute)==null?void 0:l.unit)==null?void 0:n.name)&&r.jsx("span",{className:"text-gray-500 ml-1 text-xs",children:a.attribute.unit.name})]})}},{header:"Unit Price",field:"unit_price",align:"right",sortable:!0,render:a=>parseFloat(a.unit_price||0).toFixed(2)},{header:"Tax",field:"tax",align:"right",sortable:!0,render:a=>parseFloat(a.tax||0).toFixed(2)},{header:"VAT",field:"vat",align:"right",sortable:!0,render:a=>parseFloat(a.vat||0).toFixed(2)},{header:"Total",field:"total",align:"right",sortable:!0,render:a=>parseFloat(a.total||0).toFixed(2)}],getSortValue:(e,t)=>{var a,l,n;switch(t){case"product":return e.product_name||((a=e.product)==null?void 0:a.name)||((n=(l=e.attribute)==null?void 0:l.product)==null?void 0:n.name)||"";case"quantity":return parseFloat(e.quantity||0);case"unit_price":return parseFloat(e.unit_price||0);case"tax":return parseFloat(e.tax||0);case"vat":return parseFloat(e.vat||0);case"total":return parseFloat(e.total||0);default:return""}},renderTableFooter:(e,t,a)=>r.jsxs("tr",{className:"bg-gray-50",children:[r.jsxs("td",{colSpan:3,className:"px-4 py-3 text-sm font-semibold text-gray-700",children:["Total Items: ",r.jsx("span",{className:"text-gray-900",children:e.product_quotation_details.length})]}),r.jsx("td",{colSpan:3,className:"px-4 py-3 text-sm font-semibold text-gray-700 text-right",children:"Total Amount:"}),r.jsx("td",{className:"px-4 py-3 text-sm font-bold text-gray-900 text-right",children:a.toFixed(2)})]})};export{i as quotationSingleViewConfig};
