1import{b as v,r as S,j as s}from"./vendor-react--XLkiizY.js";import{L as _,r as k}from"./app-DA0-a1Sf.js";import{H as C}from"./heading-42nDL0kL.js";import{P as w}from"./pagination-DMponHjB.js";import{S as P}from"./index-Cocwtaaq.js";import{B as o}from"./button-DfzfHxUh.js";import{D as z,a as E,b as A,c as H,d as L,e as T}from"./dialog--jtFYe1n.js";import{a as c,A as $}from"./app-layout-Bo7KNq5U.js";import{q,r as B,s as F}from"./vendor-lucide-CrM7nrTS.js";/* empty css */import"./app-logo-icon-BN_F9IPW.js";import"./use-current-url-kwwR8rX1.js";import"./index-Be-XYTui.js";const R=[{title:"Departments",href:c.departments.index.url()}];function ee(D){const e=v.c(22),{departments:t}=D,[n,d]=S.useState(null);let m;e[0]!==n?(m=function(){n&&k.delete(c.departments.destroy.url(n.id),{preserveScroll:!0,onSuccess:()=>d(null)})},e[0]=n,e[1]=m):m=e[1];const N=m;let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=s.jsx(P,{title:"Departments",description:"Manage job departments",url:"/admin/departments",robots:"noindex,follow"}),e[2]=x):x=e[2];let p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p=s.jsx(C,{level:"h1",title:"Departments",description:"Create and manage job departments."}),e[3]=p):p=e[3];let h;e[4]===Symbol.for("react.memo_cache_sentinel")?(h=c.departments.create.url(),e[4]=h):h=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsxs("div",{className:"flex items-center justify-between",children:[p,s.jsx(_,{href:h,children:s.jsxs(o,{children:[s.jsx(F,{className:"mr-2 size-4"}),"New Department"]})})]}),e[5]=f):f=e[5];let a;e[6]!==t.current_page||e[7]!==t.data||e[8]!==t.last_page||e[9]!==t.links?(a=s.jsxs("div",{className:"flex h-full flex-1 flex-col gap-6 p-4",children:[f,t.data.length===0?s.jsx("div",{className:"flex flex-1 items-center justify-center rounded-xl border border-dashed p-12",children:s.jsx("p",{className:"text-muted-foreground",children:"No departments yet."})}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"overflow-x-auto rounded-xl border bg-card",children:s.jsxs("table",{className:"w-full text-left",children:[s.jsx("thead",{className:"border-b bg-muted/50",children:s.jsxs("tr",{children:[s.jsx("th",{scope:"col",className:"px-4 py-3 font-semibold",children:"Name"}),s.jsx("th",{scope:"col",className:"px-4 py-3 font-semibold",children:"Slug"}),s.jsx("th",{scope:"col",className:"px-4 py-3 font-semibold",children:"Jobs"}),s.jsx("th",{scope:"col",className:"px-4 py-3 font-semibold",children:"Actions"})]})}),s.jsx("tbody",{className:"divide-y",children:t.data.map(l=>s.jsxs("tr",{className:"transition-colors hover:bg-muted/50",children:[s.jsx("td",{className:"px-4 py-3 font-semibold",children:s.jsx(_,{href:c.departments.edit.url(l.id),className:"hover:underline focus-visible:rounded-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none",children:l.name})}),s.jsx("td",{className:"px-4 py-3",children:l.slug}),s.jsx("td",{className:"px-4 py-3",children:l.jobs_count??0}),s.jsx("td",{className:"px-4 py-3",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(_,{href:c.departments.edit.url(l.id),children:s.jsx(o,{variant:"ghost",size:"icon","aria-label":`Edit ${l.name}`,title:"Edit department",children:s.jsx(q,{className:"size-4"})})}),s.jsx(o,{variant:"ghost",size:"icon",onClick:()=>d(l),"aria-label":`Delete ${l.name}`,title:"Delete department",disabled:(l.jobs_count??0)>0,children:s.jsx(B,{className:"size-4"})})]})})]},l.id))})]})}),s.jsx(w,{links:t.links,currentPage:t.current_page,lastPage:t.last_page})]})]}),e[6]=t.current_page,e[7]=t.data,e[8]=t.last_page,e[9]=t.links,e[10]=a):a=e[10];const y=!!n;let u;e[11]===Symbol.for("react.memo_cache_sentinel")?(u=()=>d(null),e[11]=u):u=e[11];let j;e[12]===Symbol.for("react.memo_cache_sentinel")?(j=s.jsxs(z,{children:[s.jsx(E,{children:"Delete Department"}),s.jsx(A,{children:"Are you sure you want to delete this department? This action cannot be undone."})]}),e[12]=j):j=e[12];let b;e[13]===Symbol.for("react.memo_cache_sentinel")?(b=s.jsx(o,{variant:"outline",onClick:()=>d(null),children:"Cancel"}),e[13]=b):b=e[13];let r;
1e[14]!==N?(r=s.jsxs(H,{children:[j,s.jsxs(L,{children:[b,s.jsx(o,{variant:"destructive",onClick:N,children:"Delete"})]})]}),e[14]=N,e[15]=r):r=e[15];let i;e[16]!==r||e[17]!==y?(i=s.jsx(T,{open:y,onOpenChange:u,children:r}),e[16]=r,e[17]=y,e[18]=i):i=e[18];let g;return e[19]!==i||e[20]!==a?(g=s.jsxs($,{breadcrumbs:R,children:[x,a,i]}),e[19]=i,e[20]=a,e[21]=g):g=e[21],g}export{ee as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.