import{u as d,j as e,H as m}from"./app-BQEFzdw6.js";import{A as c}from"./AppLayout-kozc03ce.js";import{P as p}from"./PageHeader-Bj1OQnqr.js";import{F as s}from"./FormField-HY4WrCzQ.js";import"./useThemeColor-qPCpc713.js";function g({items:o}){const{data:r,setData:a,post:l,processing:i,errors:n}=d({inventory_item_id:"",quantity:"",type:"adjustment",notes:"",transaction_date:new Date().toISOString().substring(0,10)});function u(t){t.preventDefault(),l(route("inventory.adjustments.store"))}return e.jsxs(c,{children:[e.jsx(m,{title:"Stock Adjustment"}),e.jsx(p,{title:"Stock Adjustment",back:route("inventory.items.index")}),e.jsx("div",{className:"p-4 sm:p-6 max-w-xl",children:e.jsxs("form",{onSubmit:u,className:"card p-6 space-y-4",children:[e.jsx(s,{label:"Item",error:n.inventory_item_id,required:!0,children:e.jsxs("select",{className:"form-input",value:r.inventory_item_id,onChange:t=>a("inventory_item_id",t.target.value),children:[e.jsx("option",{value:"",children:"Select Item…"}),(o??[]).map(t=>e.jsxs("option",{value:t.id,children:[t.name," (Current: ",t.current_stock," ",t.unit,")"]},t.id))]})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(s,{label:"Adjustment Qty (+ or -)",error:n.quantity,required:!0,children:e.jsx("input",{type:"number",className:"form-input",value:r.quantity,onChange:t=>a("quantity",t.target.value)})}),e.jsx(s,{label:"Date",error:n.transaction_date,children:e.jsx("input",{type:"date",className:"form-input",value:r.transaction_date,onChange:t=>a("transaction_date",t.target.value)})})]}),e.jsx(s,{label:"Reason / Notes",error:n.notes,required:!0,children:e.jsx("textarea",{className:"form-input",rows:3,value:r.notes,onChange:t=>a("notes",t.target.value),placeholder:"Reason for adjustment…"})}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"submit",disabled:i,className:"btn btn-primary",children:i?"Saving…":"Record Adjustment"}),e.jsx("a",{href:route("inventory.items.index"),className:"btn",children:"Cancel"})]})]})})]})}export{g as default};
