import{u as y,c as h,b as o,t as i,a as s,g as e,w as p,d as f,l as k,o as V,P as _}from"./app-CYVHboi-.js";import{_ as d}from"./InputError-u5FIXCwc.js";import{_ as x}from"./SecondaryButton-CHQvCfls.js";import{_ as u}from"./InputLabel-dHPaqRUC.js";import{_ as w}from"./LoadingButton-CH88QwYm.js";import{_ as S}from"./CheckBox-FJj299Iw.js";import{_ as v}from"./Input-VvJHlcSh.js";import{_ as N}from"./Textarea-D40HahXW.js";import"./browser-BwNzv7vE.js";import"./Keyboard-VWzCpVN-.js";import"./composable-DK3kcOvi.js";const U={class:"flex items-center justify-between border-b px-6 py-3 dark:border-gray-700"},B={class:"text-xl font-semibold"},C={class:"max-h-[70vh] space-y-6 overflow-y-auto p-6"},H={class:"flex items-center"},j={class:"ms-2 text-sm text-gray-600 dark:text-gray-400"},A={class:"flex justify-end gap-2 border-t bg-gray-50 px-6 py-3 dark:border-gray-700 dark:bg-gray-950"},J={__name:"Form",props:["current"],emits:["close","done"],setup(c,{emit:g}){const m=g,l=c,t=y({_method:l.current?.id?"put":"post",name:l.current?.name,description:l.current?.description,sort_order:l.current?.sort_order??0,active:l.current?.id?l.current?.active==1:!0}),b=()=>{t.reset(),m("close")};function $(){t.post(l.current?.id?_("pos.halls.update",l.current.id):_("pos.halls.store"),{onSuccess:()=>{t.reset(),m("done"),m("close")}})}return(r,a)=>(V(),h("form",{onSubmit:k($,["prevent"])},[o("div",U,[o("h1",B,i(c.current?.id?r.$t("Edit {x}",{x:r.$t("Hall")}):r.$t("Add {x}",{x:r.$t("Hall")})),1)]),o("div",C,[o("div",null,[s(e(u),{for:"name",value:r.$t("Hall Name")},null,8,["value"]),s(e(v),{id:"name",type:"text",class:"mt-1 block w-full",modelValue:e(t).name,"onUpdate:modelValue":a[0]||(a[0]=n=>e(t).name=n),required:"",autofocus:"",autocomplete:"name"},null,8,["modelValue"]),s(e(d),{class:"mt-2",message:e(t).errors.name},null,8,["message"])]),o("div",null,[s(e(u),{for:"description",value:r.$t("Description")},null,8,["value"]),s(e(N),{id:"description",class:"mt-1 block w-full",modelValue:e(t).description,"onUpdate:modelValue":a[1]||(a[1]=n=>e(t).description=n),placeholder:r.$t("Optional description for this hall")},null,8,["modelValue","placeholder"]),s(e(d),{class:"mt-2",message:e(t).errors.description},null,8,["message"])]),o("div",null,[s(e(u),{for:"sort_order",value:r.$t("Sort Order")},null,8,["value"]),s(e(v),{id:"sort_order",type:"number",class:"mt-1 block w-full",modelValue:e(t).sort_order,"onUpdate:modelValue":a[2]||(a[2]=n=>e(t).sort_order=n),min:"0",autocomplete:"sort_order"},null,8,["modelValue"]),s(e(d),{class:"mt-2",message:e(t).errors.sort_order},null,8,["message"])]),o("div",null,[o("label",H,[s(e(S),{checked:e(t).active,"onUpdate:checked":a[3]||(a[3]=n=>e(t).active=n)},null,8,["checked"]),o("span",j,i(r.$t("Active")),1)]),s(e(d),{class:"mt-2",message:e(t).errors.active},null,8,["message"])])]),o("div",A,[s(e(x),{type:"button",onClick:b},{default:p(()=>[f(i(r.$t("Cancel")),1)]),_:1}),s(e(w),{type:"submit",loading:e(t).processing},{default:p(()=>[f(i(r.$t("Save")),1)]),_:1},8,["loading"])])],32))}};export{J as default};
