import{r as m,a as C,b as D,c as p,e as o,j as V,k as n,l as u,u as i,i as f,v as q,F as x,g as B,p as E,q as L,s as $,o as d,f as j,x as v,d as N,y as F,t as I}from"./app-OFnD_EfZ.js";import{_ as M}from"./CustomTable-wjyxWH_G.js";import{b as T,s as R,a as U}from"./index-BtxfWzR4.js";import{r as z}from"./MagnifyingGlassIcon-BNDw92ps.js";import{r as K}from"./PencilIcon-DlHVKXpT.js";/* empty css                                                    */const S={class:"sm:p-2 md:p-4 mt-4 sm:mt-0"},Y=["href","onClick"],A={class:"flex flex-col sm:flex-row sm:justify-end sm:items-center mb-4 gap-3 sm:gap-0"},G={class:"flex flex-col sm:flex-row gap-3 w-full sm:w-auto justify-between"},H={class:"relative w-full sm:w-64"},J={class:"text-blue-900 hover:underline text-sm rounded border border-gray-200 shadow px-1 py-1"},ae={__name:"Index",setup(O){const _=E(),b=m([{route:"/Equipment/Index",label:"設備清單"},{route:"/EquipmentCategories/Index",label:"檢查項目"}]),w=a=>["px-4 py-2 transition-colors duration-300",a===_.currentRoute.value.path?"border-b-2 border-blue-500 text-blue-600 font-semibold":"text-gray-500 hover:text-gray-700"],l=m([]),c=m("");C(async()=>{const a=await B.get("/api/equipment-categories");l.value=a.data.data,l.value.forEach(e=>{e.banks[0]&&(e.final_updated=h(e.banks[0].updated_at))})});const g=D(()=>{if(!c.value.trim())return l.value;const a=c.value.toLowerCase();return l.value.filter(e=>{var s,r,t;return((s=e.code)==null?void 0:s.toLowerCase().includes(a))||((r=e.name)==null?void 0:r.toLowerCase().includes(a))||((t=e.remark)==null?void 0:t.toLowerCase().includes(a))})});function h(a){var e=new Date(a),s=""+(e.getMonth()+1),r=""+e.getDate(),t=e.getFullYear();return s.length<2&&(s="0"+s),r.length<2&&(r="0"+r),[t,s,r].join("-")}return(a,e)=>{const s=L("router-link"),r=$("ripple");return d(),p(x,null,[e[2]||(e[2]=o("h2",{class:"flex items-center text-xl sm:text-3xl px-3 font-semibold text-black dark:text-white"},[o("div",{class:"text-sm mr-2"},":::"),V(" 設備管理 ")],-1)),o("div",S,[n(i(T),{value:a.$route.path,class:"flex space-x-4 mb-4"},{default:u(()=>[n(i(R),{"pt:tabList":"bg-transparent text-sm","pt:activeBar":"bg-transparent"},{default:u(()=>[(d(!0),p(x,null,j(b.value,t=>(d(),v(i(U),{key:t.label,value:t.route,pt:{root:w(t.route)}},{default:u(()=>[t.route?(d(),v(s,{key:0,to:t.route,custom:""},{default:u(({href:y,navigate:k})=>[f((d(),p("a",{href:y,onClick:k,class:"flex items-center"},[o("i",{class:F(t.icon)},null,2),o("span",null,I(t.label),1)],8,Y)),[[r]])]),_:2},1032,["to"])):N("",!0)]),_:2},1032,["value","pt"]))),128))]),_:1})]),_:1},8,["value"]),o("div",A,[o("div",G,[o("div",H,[n(i(z),{class:"absolute left-2 top-1/2 transform -translate-y-1/2 w-5 h-5 text-gray-400"}),f(o("input",{"onUpdate:modelValue":e[0]||(e[0]=t=>c.value=t),type:"text",placeholder:"搜尋",class:"border rounded px-3 py-2 text-sm w-full sm:w-64 pl-8"},null,512),[[q,c.value]])])])]),n(M,{items:g.value,columns:[{label:"名稱",field:"name"},{label:"最後編輯日期",field:"final_updated"}],modelValue:l.value,"onUpdate:modelValue":e[1]||(e[1]=t=>l.value=t),rows:5,selectable:!1},{action:u(({data:t})=>[o("button",J,[n(s,{to:`/EquipmentBank/${t.id}`,class:"hover:underline text-sm"},{default:u(()=>[n(i(K),{class:"w-5 h-5"})]),_:2},1032,["to"])])]),_:1},8,["items","modelValue"])])],64)}}};export{ae as default};
