import{An as e,D as t,F as n,Ht as r,Nn as i,Zt as a,_n as o,an as s,en as c,g as l,m as u,on as d,rn as f,wn as p,wt as m}from"./app-4kCgdoJR.js";var h={class:`border-b border-gray-200 px-6 py-4 dark:border-gray-700`},g={class:`sm:flex sm:items-baseline sm:justify-between`},_={class:`sm:w-0 sm:flex-1`},v={class:`text-focus text-base font-semibold`},y={class:`text-mute mt-1 truncate text-sm`},b={class:`grid grid-cols-6 gap-6 p-6`},x={class:`col-span-6`},S={class:`col-span-6`},C={class:`col-span-6 sm:col-span-3`},w={class:`col-span-full`},T={class:`flex flex-row justify-end bg-gray-100 px-6 py-4 text-end dark:bg-gray-950`},E={__name:`Form`,props:[`current`],emits:[`close`,`done`],setup(E,{emit:D}){let O=E,k=D,A=r({_method:O.current?.id?`put`:`post`,name:O.current?.name||``,description:O.current?.description||``,sort_order:O.current?.sort_order||0,active:O.current?.active??!0});function j(){let e=O.current?.id?`put`:`post`,t=O.current?.id?route(`service-types.update`,{service_type:O.current.id}):route(`service-types.store`);A.transform(e=>({...e,active:+!!e.active}))[e](t,{preserveScroll:!0,onSuccess:e=>{k(`done`,e.props.flash?.data),k(`close`)}})}return(r,D)=>(o(),f(`form`,{onSubmit:a(j,[`prevent`])},[c(`div`,h,[c(`div`,g,[c(`div`,_,[c(`h1`,v,i(E.current?.id?r.$t(`Edit {x}`,{x:r.$t(`Service Type`)}):r.$t(`Add {x}`,{x:r.$t(`Service Type`)})),1),c(`p`,y,i(r.$t(`Please fill the form below to {action} {record}.`,{record:r.$t(`service_type`),action:E.current?.id?r.$t(`edit`):r.$t(`add`)})),1)])])]),c(`div`,b,[c(`div`,x,[d(e(t),{label:r.$t(`Name`),required:!0,modelValue:e(A).name,"onUpdate:modelValue":D[0]||=t=>e(A).name=t,error:e(A).errors.name,placeholder:r.$t(`Enter service type name`)},null,8,[`label`,`modelValue`,`error`,`placeholder`])]),c(`div`,S,[d(e(l),{rows:`3`,label:r.$t(`Description`),modelValue:e(A).description,"onUpdate:modelValue":D[1]||=t=>e(A).description=t,error:e(A).errors.description,placeholder:r.$t(`Enter description (optional)`)},null,8,[`label`,`modelValue`,`error`,`placeholder`])]),c(`div`,C,[d(e(t),{type:`number`,label:r.$t(`Sort Order`),modelValue:e(A).sort_order,"onUpdate:modelValue":D[2]||=t=>e(A).sort_order=t,error:e(A).errors.sort_order,placeholder:r.$t(`0`)},null,8,[`label`,`modelValue`,`error`,`placeholder`])]),c(`div`,w,[d(e(u),{label:r.$t(`Active`),modelValue:e(A).active,"onUpdate:modelValue":D[3]||=t=>e(A).active=t},null,8,[`label`,`modelValue`])])]),c(`div`,T,[d(e(m),{onClick:r.close},{default:p(()=>[s(i(r.$t(`Cancel`)),1)]),_:1},8,[`onClick`]),d(e(n),{class:`ms-3`,loading:e(A).processing},{default:p(()=>[s(i(r.$t(`Save`)),1)]),_:1},8,[`loading`])])],32))}};export{E as default};