import{An as e,D as t,F as n,Ht as r,L as i,Lt as a,Nn as o,Zt as s,_n as c,an as l,en as u,g as d,m as f,on as p,rn as m,wn as h,wt as g}from"./app-4kCgdoJR.js";var _={class:`flex items-center justify-between border-b px-6 py-3 dark:border-gray-700`},v={class:`text-xl font-semibold`},y={class:`grid grid-cols-6 gap-6 p-6`},b={class:`col-span-6 sm:col-span-3`},x={class:`col-span-6 sm:col-span-3`},S={class:`col-span-6 sm:col-span-3`},C={class:`col-span-6 sm:col-span-3`},w={class:`col-span-full`},T={class:`col-span-6 sm:col-span-3`},E={class:`flex justify-end gap-2 border-t bg-gray-50 px-6 py-3 dark:border-gray-700 dark:bg-gray-950`},D={__name:`Form`,props:[`current`,`halls`],emits:[`close`,`done`],setup(D,{emit:O}){let k=O,A=D,j=r({_method:A.current?.id?`put`:`post`,hall_id:A.current?.hall_id,name:A.current?.name,seats:A.current?.seats??4,description:A.current?.description,sort_order:A.current?.sort_order??0,active:A.current?.id?A.current?.active==1:!0}),M=()=>{j.reset(),k(`close`)};function N(){j.post(A.current?.id?a(`pos.tables.update`,A.current.id):a(`pos.tables.store`),{onSuccess:()=>{j.reset(),k(`done`),k(`close`)}})}return(r,a)=>(c(),m(`form`,{onSubmit:s(N,[`prevent`])},[u(`div`,_,[u(`h1`,v,o(D.current?.id?r.$t(`Edit {x}`,{x:r.$t(`Table`)}):r.$t(`Add {x}`,{x:r.$t(`Table`)})),1)]),u(`div`,y,[u(`div`,b,[p(e(t),{id:`name`,modelValue:e(j).name,"onUpdate:modelValue":a[0]||=t=>e(j).name=t,error:e(j).errors.name,label:r.$t(`Table Name`)},null,8,[`modelValue`,`error`,`label`])]),u(`div`,x,[p(e(i),{id:`hall_id`,json:!0,valueKey:`id`,labelKey:`name`,label:r.$t(`Hall`),suggestions:D.halls,modelValue:e(j).hall_id,"onUpdate:modelValue":a[1]||=t=>e(j).hall_id=t,error:e(j).errors.hall_id},null,8,[`label`,`suggestions`,`modelValue`,`error`])]),u(`div`,S,[p(e(t),{id:`seats`,type:`number`,modelValue:e(j).seats,"onUpdate:modelValue":a[2]||=t=>e(j).seats=t,error:e(j).errors.seats,label:r.$t(`Number of Seats`)},null,8,[`modelValue`,`error`,`label`])]),u(`div`,C,[p(e(t),{id:`sort_order`,type:`number`,modelValue:e(j).sort_order,"onUpdate:modelValue":a[3]||=t=>e(j).sort_order=t,error:e(j).errors.sort_order,label:r.$t(`Sort Order`)},null,8,[`modelValue`,`error`,`label`])]),u(`div`,w,[p(e(d),{id:`description`,rows:`3`,modelValue:e(j).description,"onUpdate:modelValue":a[4]||=t=>e(j).description=t,error:e(j).errors.description,label:r.$t(`Description`)},null,8,[`modelValue`,`error`,`label`])]),u(`div`,T,[p(e(f),{id:`active`,label:r.$t(`Active`),modelValue:e(j).active,"onUpdate:modelValue":a[5]||=t=>e(j).active=t},null,8,[`label`,`modelValue`])])]),u(`div`,E,[p(e(g),{type:`button`,onClick:M},{default:h(()=>[l(o(r.$t(`Cancel`)),1)]),_:1}),p(e(n),{type:`submit`,loading:e(j).processing},{default:h(()=>[l(o(r.$t(`Save`)),1)]),_:1},8,[`loading`])])],32))}};export{D as default};