import{u as $,c as v,b as t,t as n,a as i,g as e,w as u,d as p,l as V,o as _}from"./app-CYVHboi-.js";import{_ as g}from"./SecondaryButton-CHQvCfls.js";import{_ as k}from"./LoadingButton-CH88QwYm.js";import{_ as m}from"./Input-VvJHlcSh.js";import{_ as f}from"./Textarea-D40HahXW.js";import{_ as y}from"./Toggle-rA2phDZD.js";import"./browser-BwNzv7vE.js";import"./Keyboard-VWzCpVN-.js";import"./composable-DK3kcOvi.js";import"./InputError-u5FIXCwc.js";import"./InputLabel-dHPaqRUC.js";const w={class:"border-b border-gray-200 px-6 py-4 dark:border-gray-700"},S={class:"sm:flex sm:items-baseline sm:justify-between"},U={class:"sm:w-0 sm:flex-1"},C={class:"text-focus text-base font-semibold"},N={class:"text-mute mt-1 truncate text-sm"},B={class:"grid grid-cols-6 gap-6 p-6"},D={class:"col-span-6"},E={class:"col-span-6 sm:col-span-3"},T={class:"col-span-6 sm:col-span-3"},j={class:"col-span-6"},A={class:"col-span-6"},F={class:"col-span-full"},P={class:"flex flex-row justify-end bg-gray-100 px-6 py-4 text-end dark:bg-gray-950"},Q={__name:"Form",props:["current"],emits:["close","done"],setup(d,{emit:b}){const a=d,c=b,l=$({_method:a.current?.id?"put":"post",name:a.current?.name||"",email:a.current?.email||"",phone:a.current?.phone||"",skills:a.current?.skills||"",description:a.current?.description||"",active:a.current?.active??!0});function h(){const o=a.current?.id?"put":"post",r=a.current?.id?route("technicians.update",{technician:a.current.id}):route("technicians.store");l.transform(s=>({...s,active:s.active?1:0}))[o](r,{preserveScroll:!0,onSuccess:s=>{c("done",s.props.flash?.data),c("close")}})}return(o,r)=>(_(),v("form",{onSubmit:V(h,["prevent"])},[t("div",w,[t("div",S,[t("div",U,[t("h1",C,n(d.current?.id?o.$t("Edit {x}",{x:o.$t("Technician")}):o.$t("Add {x}",{x:o.$t("Technician")})),1),t("p",N,n(o.$t("Please fill the form below to {action} {record}.",{record:o.$t("technician"),action:d.current?.id?o.$t("edit"):o.$t("add")})),1)])])]),t("div",B,[t("div",D,[i(e(m),{label:o.$t("Name"),required:!0,modelValue:e(l).name,"onUpdate:modelValue":r[0]||(r[0]=s=>e(l).name=s),error:e(l).errors.name},null,8,["label","modelValue","error"])]),t("div",E,[i(e(m),{type:"email",label:o.$t("Email"),modelValue:e(l).email,"onUpdate:modelValue":r[1]||(r[1]=s=>e(l).email=s),error:e(l).errors.email},null,8,["label","modelValue","error"])]),t("div",T,[i(e(m),{label:o.$t("Phone"),modelValue:e(l).phone,"onUpdate:modelValue":r[2]||(r[2]=s=>e(l).phone=s),error:e(l).errors.phone},null,8,["label","modelValue","error"])]),t("div",j,[i(e(f),{rows:"2",label:o.$t("Skills"),modelValue:e(l).skills,"onUpdate:modelValue":r[3]||(r[3]=s=>e(l).skills=s),error:e(l).errors.skills,placeholder:o.$t("Skills (optional)")},null,8,["label","modelValue","error","placeholder"])]),t("div",A,[i(e(f),{rows:"3",label:o.$t("Description"),modelValue:e(l).description,"onUpdate:modelValue":r[4]||(r[4]=s=>e(l).description=s),error:e(l).errors.description,placeholder:o.$t("Description (optional)")},null,8,["label","modelValue","error","placeholder"])]),t("div",F,[i(e(y),{label:o.$t("Active"),modelValue:e(l).active,"onUpdate:modelValue":r[5]||(r[5]=s=>e(l).active=s)},null,8,["label","modelValue"])])]),t("div",P,[i(e(g),{onClick:o.close},{default:u(()=>[p(n(o.$t("Cancel")),1)]),_:1},8,["onClick"]),i(e(k),{class:"ms-3",loading:e(l).processing},{default:u(()=>[p(n(o.$t("Save")),1)]),_:1},8,["loading"])])],32))}};export{Q as default};
