import{u as c,j as e,H as x}from"./app-BQEFzdw6.js";import{A as p}from"./AppLayout-kozc03ce.js";import{P as u}from"./PageHeader-Bj1OQnqr.js";import{F as i}from"./FormField-HY4WrCzQ.js";import"./useThemeColor-qPCpc713.js";function N({purchaseOrder:s,vendors:v,projects:j}){var n;const{data:t,setData:r,put:o,processing:l,errors:d}=c({expected_delivery_date:s.expected_delivery_date??"",delivery_address:s.delivery_address??"",notes:s.notes??""});function m(a){a.preventDefault(),o(route("procurement.purchase-orders.update",s.id))}return e.jsxs(p,{children:[e.jsx(x,{title:`Edit PO ${s.code}`}),e.jsx(u,{title:`Edit PO: ${s.code}`,back:route("procurement.purchase-orders.show",s.id)}),e.jsxs("div",{className:"p-4 sm:p-6 max-w-2xl mx-auto",children:[e.jsx("div",{className:"card p-4 mb-4 bg-amber-50 border border-amber-200 text-sm text-amber-800",children:"Only delivery details and notes can be edited after a PO is created."}),e.jsxs("form",{onSubmit:m,className:"card p-6 space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm text-gray-600 mb-2",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Vendor:"})," ",(n=s.vendor)==null?void 0:n.name]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Status:"})," ",e.jsx("span",{className:"capitalize",children:s.status})]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Order Date:"})," ",s.order_date]}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:"Total:"})," ",Number(s.grand_total).toLocaleString("en-IN"),"৳"]})]}),e.jsx(i,{label:"Expected Delivery Date",error:d.expected_delivery_date,children:e.jsx("input",{type:"date",className:"form-input",value:t.expected_delivery_date,onChange:a=>r("expected_delivery_date",a.target.value)})}),e.jsx(i,{label:"Delivery Address",error:d.delivery_address,children:e.jsx("textarea",{className:"form-input",rows:2,value:t.delivery_address,onChange:a=>r("delivery_address",a.target.value)})}),e.jsx(i,{label:"Notes",error:d.notes,children:e.jsx("textarea",{className:"form-input",rows:3,value:t.notes,onChange:a=>r("notes",a.target.value)})}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"submit",disabled:l,className:"btn btn-primary",children:l?"Saving…":"Save Changes"}),e.jsx("a",{href:route("procurement.purchase-orders.show",s.id),className:"btn",children:"Cancel"})]})]})]})]})}export{N as default};
