import{u as g,c as v,b as a,t as m,a as d,g as e,w as p,d as c,l as $,o as y,P as b}from"./app-CYVHboi-.js";import{_ as h}from"./SecondaryButton-CHQvCfls.js";import{_ as S}from"./AutoComplete-Ao6jtcfm.js";import{_ as k}from"./LoadingButton-CH88QwYm.js";import{_ as u}from"./Input-VvJHlcSh.js";import{_ as U}from"./Textarea-D40HahXW.js";import{_ as w}from"./Toggle-rA2phDZD.js";import"./browser-BwNzv7vE.js";import"./InputError-u5FIXCwc.js";import"./InputLabel-dHPaqRUC.js";import"./Keyboard-VWzCpVN-.js";import"./composable-DK3kcOvi.js";const N={class:"flex items-center justify-between border-b px-6 py-3 dark:border-gray-700"},T={class:"text-xl font-semibold"},j={class:"grid grid-cols-6 gap-6 p-6"},B={class:"col-span-6 sm:col-span-3"},C={class:"col-span-6 sm:col-span-3"},x={class:"col-span-6 sm:col-span-3"},A={class:"col-span-6 sm:col-span-3"},D={class:"col-span-full"},E={class:"col-span-6 sm:col-span-3"},F={class:"flex justify-end gap-2 border-t bg-gray-50 px-6 py-3 dark:border-gray-700 dark:bg-gray-950"},R={__name:"Form",props:["current","halls"],emits:["close","done"],setup(i,{emit:_}){const n=_,t=i,r=g({_method:t.current?.id?"put":"post",hall_id:t.current?.hall_id,name:t.current?.name,seats:t.current?.seats??4,description:t.current?.description,sort_order:t.current?.sort_order??0,active:t.current?.id?t.current?.active==1:!0}),f=()=>{r.reset(),n("close")};function V(){r.post(t.current?.id?b("pos.tables.update",t.current.id):b("pos.tables.store"),{onSuccess:()=>{r.reset(),n("done"),n("close")}})}return(o,s)=>(y(),v("form",{onSubmit:$(V,["prevent"])},[a("div",N,[a("h1",T,m(i.current?.id?o.$t("Edit {x}",{x:o.$t("Table")}):o.$t("Add {x}",{x:o.$t("Table")})),1)]),a("div",j,[a("div",B,[d(e(u),{id:"name",modelValue:e(r).name,"onUpdate:modelValue":s[0]||(s[0]=l=>e(r).name=l),error:e(r).errors.name,label:o.$t("Table Name")},null,8,["modelValue","error","label"])]),a("div",C,[d(e(S),{id:"hall_id",json:!0,valueKey:"id",labelKey:"name",label:o.$t("Hall"),suggestions:i.halls,modelValue:e(r).hall_id,"onUpdate:modelValue":s[1]||(s[1]=l=>e(r).hall_id=l),error:e(r).errors.hall_id},null,8,["label","suggestions","modelValue","error"])]),a("div",x,[d(e(u),{id:"seats",type:"number",modelValue:e(r).seats,"onUpdate:modelValue":s[2]||(s[2]=l=>e(r).seats=l),error:e(r).errors.seats,label:o.$t("Number of Seats")},null,8,["modelValue","error","label"])]),a("div",A,[d(e(u),{id:"sort_order",type:"number",modelValue:e(r).sort_order,"onUpdate:modelValue":s[3]||(s[3]=l=>e(r).sort_order=l),error:e(r).errors.sort_order,label:o.$t("Sort Order")},null,8,["modelValue","error","label"])]),a("div",D,[d(e(U),{id:"description",rows:"3",modelValue:e(r).description,"onUpdate:modelValue":s[4]||(s[4]=l=>e(r).description=l),error:e(r).errors.description,label:o.$t("Description")},null,8,["modelValue","error","label"])]),a("div",E,[d(e(w),{id:"active",label:o.$t("Active"),modelValue:e(r).active,"onUpdate:modelValue":s[5]||(s[5]=l=>e(r).active=l)},null,8,["label","modelValue"])])]),a("div",F,[d(e(h),{type:"button",onClick:f},{default:p(()=>[c(m(o.$t("Cancel")),1)]),_:1}),d(e(k),{type:"submit",loading:e(r).processing},{default:p(()=>[c(m(o.$t("Save")),1)]),_:1},8,["loading"])])],32))}};export{R as default};
