import{Z as g,i as w,r as o,c as i,o as l,a as e,b as t,w as m,t as d,f as x,F as y,j as k,e as v}from"./app-BLo7SiiE.js";import{I as V}from"./moment-C7JtfGJw.js";import{t as L,S as N,p as I}from"./SearchInput-BQxs0-MZ.js";import{L as S}from"./Layout-BEAmuehS.js";import{m as j}from"./mapValues-BsTqcYnb.js";import{P as B}from"./Pagination-Bj-Q2plQ.js";import{_ as C}from"./FlashMessages-DImpr6PL.js";const D={metaInfo:{title:"Departments"},components:{Icon:V,Link:w,Pagination:B,SearchInput:N,Head:g},layout:S,props:{title:String,filters:Object,departments:Object},data(){return{form:{search:this.filters.search}}},watch:{form:{deep:!0,handler:L(function(){this.$inertia.get(this.route("departments"),I(this.form),{preserveState:!0})},150)}},methods:{reset(){this.form=j(this.form,()=>null)}}},H={class:"mb-6 flex justify-between items-center"},F={class:"hidden md:inline"},O={class:"bg-white rounded-md shadow overflow-x-auto"},P={class:"w-full whitespace-nowrap"},R={class:"text-left font-bold"},$={class:"px-6 pt-6 pb-4"},E={class:"border-t"},T={class:"border-t w-px"},U={key:0};function Z(n,a,r,q,p,f){const h=o("Head"),u=o("search-input"),c=o("Link"),_=o("icon"),b=o("pagination");return l(),i("div",null,[e(h,{title:n.$t(r.title)},null,8,["title"]),t("div",H,[e(u,{modelValue:p.form.search,"onUpdate:modelValue":a[0]||(a[0]=s=>p.form.search=s),class:"w-full max-w-md mr-4",onReset:f.reset},null,8,["modelValue","onReset"]),e(c,{class:"btn-indigo",href:this.route("departments.create")},{default:m(()=>[t("span",null,d(n.$t("Create")),1),t("span",F," "+d(n.$t("Department")),1)]),_:1},8,["href"])]),t("div",O,[t("table",P,[t("tbody",null,[t("tr",R,[t("th",$,d(n.$t("Name")),1)]),(l(!0),i(y,null,k(r.departments.data,s=>(l(),i("tr",{key:s.id,class:"hover:bg-gray-100 focus-within:bg-gray-100"},[t("td",E,[e(c,{class:"px-6 py-4 flex items-center focus:text-indigo-500",href:this.route("departments.edit",s.id)},{default:m(()=>[v(d(s.name),1)]),_:2},1032,["href"])]),t("td",T,[e(c,{class:"px-4 flex items-center",href:this.route("departments.edit",s.id),tabindex:"-1"},{default:m(()=>[e(_,{name:"cheveron-right",class:"block w-6 h-6 fill-gray-400"})]),_:2},1032,["href"])])]))),128)),r.departments.data.length===0?(l(),i("tr",U,a[1]||(a[1]=[t("td",{class:"border-t px-6 py-4",colspan:"4"},"No departments found.",-1)]))):x("",!0)])])]),e(b,{class:"mt-6",links:r.departments.links},null,8,["links"])])}const W=C(D,[["render",Z]]);export{W as default};
