import{u as m,j as e,H as u}from"./app-BQEFzdw6.js";import{A as p}from"./AppLayout-kozc03ce.js";import{P as d}from"./PageHeader-Bj1OQnqr.js";import{F as s}from"./FormField-HY4WrCzQ.js";import"./useThemeColor-qPCpc713.js";const h=["referral","facebook","instagram","website","walk_in","cold_call","exhibition","other"],x=["Residential","Commercial","Office","Retail","Hospitality","Other"];function b({users:i=[]}){const{data:t,setData:r,post:n,processing:o,errors:l}=m({name:"",phone:"",email:"",source:"referral",project_type:"",estimated_value:"",assigned_to:"",follow_up_at:"",notes:""});function c(a){a.preventDefault(),n(route("crm.leads.store"))}return e.jsxs(p,{children:[e.jsx(u,{title:"New Lead"}),e.jsx(d,{title:"New Lead",back:route("crm.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.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(s,{label:"Full Name",error:l.name,required:!0,children:e.jsx("input",{className:"form-input",value:t.name,onChange:a=>r("name",a.target.value),placeholder:"Client name"})}),e.jsx(s,{label:"Phone",error:l.phone,required:!0,children:e.jsx("input",{className:"form-input",value:t.phone,onChange:a=>r("phone",a.target.value),placeholder:"+880..."})}),e.jsx(s,{label:"Email",error:l.email,children:e.jsx("input",{type:"email",className:"form-input",value:t.email,onChange:a=>r("email",a.target.value)})}),e.jsx(s,{label:"Source",error:l.source,required:!0,children:e.jsx("select",{className:"form-input",value:t.source,onChange:a=>r("source",a.target.value),children:h.map(a=>e.jsx("option",{value:a,className:"capitalize",children:a.replace(/_/g," ")},a))})}),e.jsxs(s,{label:"Project Type",error:l.project_type,children:[e.jsx("input",{className:"form-input",list:"project-types",value:t.project_type,onChange:a=>r("project_type",a.target.value),placeholder:"Residential, Commercial…"}),e.jsx("datalist",{id:"project-types",children:x.map(a=>e.jsx("option",{value:a},a))})]}),e.jsx(s,{label:"Estimated Value (৳)",error:l.estimated_value,children:e.jsx("input",{type:"number",className:"form-input",min:"0",step:"1000",value:t.estimated_value,onChange:a=>r("estimated_value",a.target.value)})}),e.jsx(s,{label:"Assign To",error:l.assigned_to,children:e.jsxs("select",{className:"form-input",value:t.assigned_to,onChange:a=>r("assigned_to",a.target.value),children:[e.jsx("option",{value:"",children:"Unassigned"}),i.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})}),e.jsx(s,{label:"Follow-up Date",error:l.follow_up_at,children:e.jsx("input",{type:"datetime-local",className:"form-input",value:t.follow_up_at,onChange:a=>r("follow_up_at",a.target.value)})})]}),e.jsx(s,{label:"Notes",error:l.notes,children:e.jsx("textarea",{className:"form-input",rows:3,value:t.notes,onChange:a=>r("notes",a.target.value),placeholder:"Initial notes, requirements…"})}),e.jsxs("div",{className:"flex gap-3 pt-2",children:[e.jsx("button",{type:"submit",disabled:o,className:"btn btn-primary",children:o?"Saving…":"Create Lead"}),e.jsx("a",{href:route("crm.index"),className:"btn",children:"Cancel"})]})]})})]})}export{b as default};
