import{r as c,j as e,H as o,L as m,a as r}from"./app-BQEFzdw6.js";import{A as x}from"./AppLayout-kozc03ce.js";import{P as p}from"./PageHeader-Bj1OQnqr.js";import{B as g}from"./Badge-CiLdjUlo.js";import{f as h,a as u}from"./formatters-ClI693-F.js";import{F as f}from"./PlusIcon-ElxOOThC.js";import"./useThemeColor-qPCpc713.js";import"./dayjs.min-BDUBcDj6.js";const y={planning:"gray",in_progress:"info",on_hold:"warning",completed:"success",cancelled:"danger"};function A({projects:a,filters:t}){const[l,n]=c.useState((t==null?void 0:t.status)??"");function d(s){n(s),r.get(route("projects.index"),{status:s},{preserveState:!0,replace:!0})}const i=["","planning","in_progress","on_hold","completed","cancelled"];return e.jsxs(x,{children:[e.jsx(o,{title:"Projects"}),e.jsx(p,{title:"Projects",subtitle:`${(a.data??a).length} projects`,children:e.jsxs(m,{href:route("projects.create"),className:"btn btn-primary flex items-center gap-2",children:[e.jsx(f,{className:"w-4 h-4"})," New Project"]})}),e.jsxs("div",{className:"p-4 sm:p-6",children:[e.jsx("div",{className:"flex gap-2 mb-4 flex-wrap",children:i.map(s=>e.jsx("button",{onClick:()=>d(s),className:`px-3 py-1 text-sm rounded-full border ${l===s?"bg-primary-600 text-white border-primary-600":"border-gray-300 text-gray-600 hover:bg-gray-50"}`,children:s?s.replace("_"," "):"All"},s))}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[(a.data??a).map(s=>e.jsxs("div",{className:"card p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>r.get(route("projects.show",s.id)),children:[e.jsxs("div",{className:"flex items-start justify-between mb-2",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-mono text-xs text-primary-500",children:s.code}),e.jsx("h3",{className:"font-semibold text-gray-900",children:s.name})]}),e.jsx(g,{variant:y[s.status],children:s.status.replace("_"," ")})]}),s.client&&e.jsx("p",{className:"text-sm text-gray-500 mb-2",children:s.client.name}),e.jsxs("div",{className:"flex items-center justify-between text-sm text-gray-600 mt-3 pt-3 border-t border-gray-100",children:[e.jsx("span",{children:h(s.contract_value)}),s.end_date&&e.jsx("span",{children:u(s.end_date)})]}),s.progress_pct>0&&e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex justify-between text-xs text-gray-500 mb-1",children:[e.jsx("span",{children:"Progress"}),e.jsxs("span",{children:[s.progress_pct,"%"]})]}),e.jsx("div",{className:"w-full bg-gray-200 rounded-full h-1.5",children:e.jsx("div",{className:"bg-primary-500 h-1.5 rounded-full",style:{width:`${s.progress_pct}%`}})})]})]},s.id)),(a.data??a).length===0&&e.jsx("div",{className:"col-span-3 text-center py-12 text-gray-400",children:"No projects found."})]})]})]})}export{A as default};
