import{useForm as V}from"./vendor/inertia-CR4tWtMT.js";import{n as B,g as N,d as j}from"./registry-DyIszw9-.js";import{_ as w}from"./PageHeader.vue_vue_type_script_setup_true_lang-Cr1rE6nR.js";import{_ as O,a as C,b as F,c as y,d as L}from"./SelectItem.vue_vue_type_script_setup_true_lang-DzMQtSP3.js";import{d as S,aT as n,W as c,a3 as a,u as e,X as t,bh as o,bK as i,a2 as p,F as g,b2 as k,Q as T}from"./vendor-reka-Edfq1EPl.js";import"./LocaleSwitcher.vue_vue_type_script_setup_true_lang-4M-c0Clb.js";const E={class:"sticky top-0 z-10 -mx-6 flex items-center justify-between border-y bg-background px-6 py-3"},U={class:"text-sm text-muted-foreground"},z={class:"py-6"},D={key:0,class:"rounded-md border border-dashed py-8 text-center text-sm text-muted-foreground"},K={key:1,class:"rounded-lg border"},P={class:"w-full text-sm"},Q={class:"border-b bg-muted/40"},W={class:"px-4 py-2.5 text-left font-medium text-muted-foreground"},X={class:"px-4 py-2.5 text-left font-medium text-muted-foreground"},q={class:"divide-y"},A={class:"px-4 py-3"},G={class:"font-medium"},H={class:"font-mono text-xs text-muted-foreground"},I={class:"w-64 px-4 py-3"},x="_none",et=S({__name:"Locations",props:{locations:{},assignments:{},menus:{}},setup(m){const b=m,{t:s}=B(),v=N(),h={};for(const l of Object.keys(b.locations)){const r=b.assignments[l];h[l]=r!=null?String(r):x}const d=V({locations:h});function $(){const l={};for(const[r,_]of Object.entries(d.locations))l[r]=_===x?"":_;d.transform(()=>({locations:l})).post(`/${v}/menus/locations`)}return(l,r)=>(n(),c("div",null,[a(w,{title:e(s)("menu.locations.title")},null,8,["title"]),t("div",E,[t("p",U,o(e(s)("menu.locations.description")),1),a(j,{type:"button",disabled:e(d).processing,onClick:$},{default:i(()=>[p(o(e(s)("menu.locations.save")),1)]),_:1},8,["disabled"])]),t("div",z,[Object.keys(m.locations).length===0?(n(),c("p",D,o(e(s)("menu.locations.no_locations")),1)):(n(),c("div",K,[t("table",P,[t("thead",null,[t("tr",Q,[t("th",W,o(e(s)("menu.locations.column_location")),1),t("th",X,o(e(s)("menu.locations.column_menu")),1)])]),t("tbody",q,[(n(!0),c(g,null,k(m.locations,(_,f)=>(n(),c("tr",{key:f,class:"bg-card"},[t("td",A,[t("p",G,o(_),1),t("p",H,o(f),1)]),t("td",I,[a(L,{modelValue:e(d).locations[f],"onUpdate:modelValue":u=>e(d).locations[f]=u},{default:i(()=>[a(O,null,{default:i(()=>[a(C,{placeholder:e(s)("menu.locations.none")},null,8,["placeholder"])]),_:1}),a(F,null,{default:i(()=>[a(y,{value:x},{default:i(()=>[p(o(e(s)("menu.locations.none")),1)]),_:1}),(n(!0),c(g,null,k(m.menus,u=>(n(),T(y,{key:u.id,value:String(u.id)},{default:i(()=>[p(o(u.name),1)]),_:2},1032,["value"]))),128))]),_:1})]),_:1},8,["modelValue","onUpdate:modelValue"])])]))),128))])])]))])]))}});export{et as default};
