import{b as e,d as c}from"./app-DTeOhhdM.js";import"./numberToWords.min-02Sh2OYb.js";function U({list:n,info:A}){var i,x,o,h;if(!n||Object.keys(n).length===0)return null;const f=t=>t.product_attribute||t.productAttribute||null,r=(t,a)=>{if(!t)return null;const d=t[a]||t[a.replace(/_/g,(s,l)=>l===0?"":s.charAt(1).toUpperCase()+s.slice(2))];return(d==null?void 0:d.name)||null},w=t=>t?new Date(t).toLocaleDateString("en-US",{day:"2-digit",month:"2-digit",year:"numeric"}):"N/A";return e.jsx("div",{className:"bg-gray-100 p-10 text-sm text-gray-900 font-sans hidden print:block",children:e.jsxs("div",{className:"w-full bg-white",children:[e.jsx("table",{className:"w-full mb-6",children:e.jsx("tbody",{children:e.jsxs("tr",{children:[e.jsxs("td",{className:"w-1/2 align-top",children:[e.jsx("h1",{className:"text-2xl font-bold mb-2",children:c.name}),e.jsx("p",{children:c.address}),e.jsxs("p",{children:["Email: ",c.email]}),e.jsxs("p",{children:["Phone: ",c.phone]})]}),e.jsxs("td",{className:"w-1/2 text-right align-top",children:[e.jsx("h2",{className:"text-xl font-semibold",children:"PURCHASE ORDER"}),e.jsxs("p",{className:"mt-2",children:["PO #: ",e.jsx("strong",{children:n.po_no||"N/A"}),e.jsx("br",{}),"Date:"," ",e.jsx("strong",{children:w(n.po_date)}),e.jsx("br",{})]})]})]})})}),e.jsx("table",{className:"w-full mb-6",children:e.jsx("tbody",{children:e.jsxs("tr",{children:[n.supplier&&e.jsxs("td",{className:"w-1/2 align-top",children:[e.jsx("h3",{className:"font-semibold mb-2",children:"Supplier"}),e.jsx("p",{children:((i=n.supplier)==null?void 0:i.name)||"N/A"}),e.jsx("p",{children:((x=n.supplier)==null?void 0:x.address)||""}),e.jsxs("p",{children:["Email: ",((o=n.supplier)==null?void 0:o.email)||"N/A"]}),e.jsxs("p",{children:["Phone: ",((h=n.supplier)==null?void 0:h.number)||"N/A"]})]}),e.jsxs("td",{className:"w-1/2 align-top text-right",children:[e.jsx("h3",{className:"font-semibold mb-2",children:"Ship To"}),e.jsx("p",{children:c.name}),e.jsx("p",{children:c.address})]})]})})}),e.jsxs("table",{className:"w-full border border-gray-300 mb-6",children:[e.jsx("thead",{className:"bg-gray-100 text-xs uppercase text-gray-700",children:e.jsxs("tr",{children:[e.jsx("th",{className:"border px-3 py-2 text-left",children:"#"}),e.jsx("th",{className:"border px-3 py-2 text-left",children:"Product"}),e.jsx("th",{className:"border px-3 py-2 text-right",children:"Cartton/Box"}),e.jsx("th",{className:"border px-3 py-2 text-right",children:"Qty (pcs)"}),e.jsx("th",{className:"border px-3 py-2 text-right",children:"Unit Price"}),e.jsx("th",{className:"border px-3 py-2 text-right",children:"Get Qty"})]})}),e.jsx("tbody",{children:n.details.map((t,a)=>{var d;return e.jsxs("tr",{children:[e.jsx("td",{className:"border px-3 py-2",children:a+1}),e.jsxs("td",{className:"border px-3 py-2",children:[e.jsx("div",{className:"font-medium text-gray-800",children:((d=t.product_info)==null?void 0:d.name)||"N/A"}),(()=>{const s=f(t);if(!s)return null;const l=r(s,"product_type")||r(s,"productType"),p=r(s,"size"),m=r(s,"color"),j=r(s,"model"),_=r(s,"gold_unit")||r(s,"goldUnit"),u=s.gold_weight,b=r(s,"diamond_unit")||r(s,"diamondUnit"),g=s.diamond_weight,N=r(s,"brand"),y=r(s,"origin");return e.jsxs(e.Fragment,{children:[s.sku&&e.jsx("div",{className:"mt-1",children:e.jsxs("span",{className:"text-[10px] text-gray-500 bg-gray-100 px-1.5 py-0.5 rounded-sm font-normal inline-block",children:["SKU: ",s.sku]})}),e.jsxs("div",{className:"text-[10px] text-gray-600 mt-1 flex flex-wrap items-center gap-x-1.5 gap-y-0.5",children:[l&&e.jsx("span",{children:l}),p&&e.jsxs("span",{children:["• ",p]}),m&&e.jsxs("span",{children:["• ",m]}),j&&e.jsxs("span",{children:["• ",j]}),_&&u&&e.jsxs("span",{className:"text-amber-700",children:["• Gold ",e.jsx("b",{children:u})," ",_]}),b&&g&&e.jsxs("span",{className:"text-blue-700",children:["• Dia ",e.jsx("b",{children:g})," ",b]}),N&&e.jsxs("span",{className:"text-gray-500",children:["• ",N]}),y&&e.jsxs("span",{children:["• Origin: ",y]})]})]})})()]}),e.jsx("td",{className:"border px-3 py-2 text-right",children:t.carton_box??""}),e.jsxs("td",{className:"border px-3 py-2 text-right",children:[t.quantity||0," ",(()=>{var l;const s=t.product_attribute||t.productAttribute;return((l=s==null?void 0:s.unit)==null?void 0:l.name)||"pcs"})()]}),e.jsx("td",{className:"border px-3 py-2 text-right"}),e.jsx("td",{className:"border px-3 py-2 text-right"})]},a)})})]}),e.jsx("table",{className:"w-full mt-10",children:e.jsx("tbody",{children:e.jsxs("tr",{children:[e.jsxs("td",{className:"w-1/2 text-left",children:[e.jsx("p",{className:"mb-1",children:"_________________________"}),e.jsx("p",{className:"text-gray-600",children:"Authorized Signature"})]}),e.jsxs("td",{className:"w-1/2 text-right",children:[e.jsx("p",{className:"mb-1",children:"_________________________"}),e.jsx("p",{className:"text-gray-600",children:"Supplier Signature"})]})]})})})]})})}export{U as default};
