import{u as d,j as e,H as u}from"./app-BQEFzdw6.js";import{A as p}from"./AppLayout-kozc03ce.js";import{P as m}from"./PageHeader-Bj1OQnqr.js";import{F as n}from"./FormField-HY4WrCzQ.js";import"./useThemeColor-qPCpc713.js";function _({clients:i}){const{data:t,setData:r,post:o,processing:l,errors:s}=d({name:"",client_id:"",description:"",start_date:"",end_date:"",contract_value:"",status:"planning"});function c(a){a.preventDefault(),o(route("projects.store"))}return e.jsxs(p,{children:[e.jsx(u,{title:"New Project"}),e.jsx(m,{title:"New Project",back:route("projects.index")}),e.jsx("div",{className:"p-4 sm:p-6 max-w-2xl mx-auto",children:e.jsxs("form",{onSubmit:c,className:"card p-6 space-y-4",children:[e.jsx(n,{label:"Project Name",error:s.name,required:!0,children:e.jsx("input",{className:"form-input",value:t.name,onChange:a=>r("name",a.target.value)})}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(n,{label:"Client",error:s.client_id,children:e.jsxs("select",{className:"form-input",value:t.client_id,onChange:a=>r("client_id",a.target.value),children:[e.jsx("option",{value:"",children:"-- No Client --"}),(i??[]).map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})}),e.jsx(n,{label:"Status",error:s.status,children:e.jsx("select",{className:"form-input",value:t.status,onChange:a=>r("status",a.target.value),children:["planning","in_progress","on_hold","completed","cancelled"].map(a=>e.jsx("option",{value:a,children:a.replace("_"," ")},a))})}),e.jsx(n,{label:"Contract Value (৳)",error:s.contract_value,children:e.jsx("input",{type:"number",className:"form-input",value:t.contract_value,onChange:a=>r("contract_value",a.target.value)})}),e.jsx("div",{}),e.jsx(n,{label:"Start Date",error:s.start_date,children:e.jsx("input",{type:"date",className:"form-input",value:t.start_date,onChange:a=>r("start_date",a.target.value)})}),e.jsx(n,{label:"End Date",error:s.end_date,children:e.jsx("input",{type:"date",className:"form-input",value:t.end_date,onChange:a=>r("end_date",a.target.value)})})]}),e.jsx(n,{label:"Description",error:s.description,children:e.jsx("textarea",{className:"form-input",rows:3,value:t.description,onChange:a=>r("description",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?"Creating…":"Create Project"}),e.jsx("a",{href:route("projects.index"),className:"btn",children:"Cancel"})]})]})})]})}export{_ as default};
