import{j as e,H as d,L as r}from"./app-BQEFzdw6.js";import{A as c}from"./AppLayout-kozc03ce.js";import{P as n}from"./PageHeader-Bj1OQnqr.js";import{B as l}from"./Badge-CiLdjUlo.js";import{a as i}from"./formatters-ClI693-F.js";import{F as m}from"./PlusIcon-ElxOOThC.js";import{F as o}from"./EyeIcon-CkYifINe.js";import"./useThemeColor-qPCpc713.js";import"./dayjs.min-BDUBcDj6.js";const x={draft:"gray",pending:"warning",approved:"success",rejected:"danger",converted:"info"};function b({requisitions:t}){return e.jsxs(c,{children:[e.jsx(d,{title:"Purchase Requisitions"}),e.jsx(n,{title:"Purchase Requisitions",subtitle:`${(t.data??t).length} requisitions`,children:e.jsxs(r,{href:route("procurement.requisitions.create"),className:"btn btn-primary flex items-center gap-2",children:[e.jsx(m,{className:"w-4 h-4"})," New Requisition"]})}),e.jsx("div",{className:"p-4 sm:p-6",children:e.jsx("div",{className:"card overflow-hidden",children:e.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[e.jsx("thead",{className:"bg-gray-50",children:e.jsx("tr",{children:["Code","Date","Project","Required By","Status","Actions"].map(s=>e.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:s},s))})}),e.jsxs("tbody",{className:"divide-y divide-gray-100",children:[(t.data??t).map(s=>{var a;return e.jsxs("tr",{className:"hover:bg-gray-50",children:[e.jsx("td",{className:"px-4 py-3 text-sm font-mono text-primary-600",children:s.code}),e.jsx("td",{className:"px-4 py-3 text-sm",children:i(s.request_date)}),e.jsx("td",{className:"px-4 py-3 text-sm",children:((a=s.project)==null?void 0:a.name)??"—"}),e.jsx("td",{className:"px-4 py-3 text-sm",children:s.required_by?i(s.required_by):"—"}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(l,{variant:x[s.status],children:s.status})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx(r,{href:route("procurement.requisitions.show",s.id),className:"text-gray-400 hover:text-primary-600",children:e.jsx(o,{className:"w-4 h-4"})})})]},s.id)}),(t.data??t).length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-gray-400",children:"No requisitions found."})})]})]})})})]})}export{b as default};
