import{i as b,Z as w,r as a,c as n,a as o,b as e,w as c,t as r,F as x,j as y,h as k,o as i,e as h}from"./app-CK3cEAAe.js";import{I as v}from"./moment-BywspGD9.js";import{S as $,t as L,p as V}from"./SearchInput-C5NjNnwl.js";import{L as N}from"./Layout-DIVdUaBZ.js";import{m as C}from"./mapValues-BykAXOI1.js";import{P as S}from"./Pagination-MejnxKj7.js";import{_ as B}from"./FlashMessages-ByEdcHWZ.js";const I={components:{Icon:v,Link:b,Head:w,Pagination:S,SearchInput:$},layout:N,props:{title:String,filters:Object},data(){return{form:{search:this.filters.search}}},watch:{form:{deep:!0,handler:L(function(){this.$inertia.get(this.route("languages"),V(this.form),{preserveState:!0})},150)}},methods:{deleteLanguage(t){confirm("Are you sure you want to delete this language?")&&this.$inertia.delete(this.route("languages.delete",t))},reset(){this.form=C(this.form,()=>null)}}},j={class:"mb-6 flex justify-between items-center"},H={class:"bg-white rounded-md shadow overflow-x-auto"},A={class:"w-full whitespace-nowrap"},F={class:"text-left font-bold"},P={class:"px-6 pt-6 pb-4"},R={class:"px-6 pt-6 pb-4"},D={class:"border-t"},E={class:"border-t"},O={class:"border-t w-px"},T=["onClick"],U={key:0},Z={class:"border-t px-6 py-4",colspan:"4"};function q(t,d,m,z,u,p){const f=a("Head"),_=a("search-input"),l=a("Link"),g=a("icon");return i(),n("div",null,[o(f,{title:t.$t(m.title)},null,8,["title"]),e("div",j,[o(_,{modelValue:u.form.search,"onUpdate:modelValue":d[0]||(d[0]=s=>u.form.search=s),class:"w-full max-w-md mr-4",onReset:p.reset},null,8,["modelValue","onReset"]),o(l,{class:"btn-indigo",href:this.route("languages.create")},{default:c(()=>[e("span",null,r(t.$t("Add New")),1)]),_:1},8,["href"])]),e("div",H,[e("table",A,[e("tbody",null,[e("tr",F,[e("th",P,r(t.$t("Name")),1),e("th",R,r(t.$t("Code")),1)]),(i(!0),n(x,null,y(t.$page.props.languages,s=>(i(),n("tr",{key:s.id,class:"hover:bg-gray-100 focus-within:bg-gray-100"},[e("td",D,[o(l,{class:"px-6 py-4 flex items-center focus:text-indigo-500",href:this.route("languages.edit",s.id)},{default:c(()=>[h(r(s.name),1)]),_:2},1032,["href"])]),e("td",E,[o(l,{class:"px-6 py-4 flex items-center focus:text-indigo-500",href:this.route("languages.edit",s.id)},{default:c(()=>[h(r(s.code),1)]),_:2},1032,["href"])]),e("td",O,[e("div",{class:"px-4 flex items-center cursor-pointer",onClick:G=>p.deleteLanguage(s.id),tabindex:"-1"},[o(g,{name:"trash",class:"block w-6 h-6 fill-gray-400"})],8,T)])]))),128)),t.$page.props.languages.length===0?(i(),n("tr",U,[e("td",Z,r(t.$t("No languages found.")),1)])):k("",!0)])])])])}const ee=B(I,[["render",q]]);export{ee as default};
