var y=Object.defineProperty,_=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var x=(s,r,a)=>r in s?y(s,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[r]=a,p=(s,r)=>{for(var a in r||(r={}))G.call(r,a)&&x(s,a,r[a]);if(u)for(var a of u(r))k.call(r,a)&&x(s,a,r[a]);return s},h=(s,r)=>_(s,E(r));import{m as V,n as w,t as B,j as e,o as I,B as M,p as q}from"./index-C7Y5J1TO.js";import{G as R,u as z,F as A,S as j,a as g,b as f,c as S,d as v}from"./select-BMHN8rKk.js";import"./label-CbvzEgFe.js";import"./popover-CtxAPxyq.js";import{u as Q,t as D,F as K,a as l,b as o,c,d,e as N,f as C}from"./form-DuLR_XsI.js";import{S as b}from"./switch-9CBoXrWV.js";import"./table-DmBfZH6x.js";import{u as L}from"./use-get-regionals-Ci6Jb6yr.js";import{c as O}from"./studios-services-TLqg2xMe.js";import{f as P}from"./schema-studios-COl3kta0.js";import{C as T,a as U}from"./card-DDrJ6Iia.js";import"./useQuery-DGaD2i6Y.js";import"./settings-services-CMNk-eHJ.js";function H(s){const r=V();return w({mutationFn:O,onSuccess:()=>{var a;r.invalidateQueries({queryKey:["getStudios"]}),(a=s.reset)==null||a.call(s),B({title:"Operación exitosa",description:"El estudio ha sido creado exitosamente."})},onError:a=>{R(a)}})}const J={studio_name:"",assigned_specialist_id:0,status:!0,is_paid:!0,regional_id:0};function W(){return Q({resolver:D(P),defaultValues:J})}function de(){const s=W(),r=H(s),{users:a}=z(),{regionals:m}=L(),F=t=>{r.mutate(t)};return e.jsxs("div",{className:"grid grid-cols-1 gap-6",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-primary text-3xl font-bold",children:"Crear estudio"}),e.jsx("small",{className:"text-muted-foreground",children:"Agrega los usuarios que podrán acceder a la app de camsoda."})]}),e.jsx(T,{className:"w-full pt-4",children:e.jsx(U,{children:e.jsx(K,h(p({},s),{children:e.jsxs("form",{onSubmit:s.handleSubmit(F),className:"grid grid-cols-2 gap-4",children:[e.jsx("div",{className:"flex items-center justify-center border-r-2 border-dashed",children:e.jsx(I,{size:200})}),e.jsxs("div",{className:"grid w-full grid-cols-1 items-center gap-4 p-8",children:[e.jsx("div",{className:"col-span-1",children:e.jsx(A,{control:s.control,name:"studio_name",label:"Nombre del estudio",placeholder:"Ingresa el nombre del estudio"})}),e.jsx("div",{className:"col-span-1",children:e.jsx(l,{control:s.control,name:"assigned_specialist_id",render:({field:t})=>{var n;return e.jsxs(o,{children:[e.jsx(c,{children:"Especialista asignado"}),e.jsx(d,{children:e.jsxs(j,{onValueChange:i=>t.onChange(Number(i)),value:((n=t.value)==null?void 0:n.toString())||"",children:[" ",e.jsx(g,{id:"framework",children:e.jsx(f,{placeholder:"Select"})}),e.jsx(S,{position:"popper",children:a==null?void 0:a.map(i=>e.jsx(v,{value:i.id.toString(),children:i.first_name+" "+i.last_name},i.id))})]})}),e.jsx(N,{className:"text-xs"})]})}})}),e.jsx("div",{className:"col-span-1",children:e.jsx(l,{control:s.control,name:"regional_id",render:({field:t})=>{var n;return e.jsxs(o,{children:[e.jsx(c,{children:"Regional"}),e.jsx(d,{children:e.jsxs(j,{value:((n=t.value)==null?void 0:n.toString())||"",onValueChange:i=>t.onChange(Number(i)),children:[" ",e.jsx(g,{children:e.jsx(f,{placeholder:"Select"})}),e.jsx(S,{position:"popper",children:m==null?void 0:m.map(i=>e.jsx(v,{value:i.id.toString(),children:i.name},i.id))})]})}),e.jsx(N,{className:"text-xs"})]})}})}),e.jsx("div",{className:"col-span-1",children:e.jsx(l,{control:s.control,name:"is_paid",render:({field:t})=>e.jsxs(o,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(c,{className:"text-base",children:"Se paga"}),e.jsx(C,{children:"Mencione si se paga o no este estudio"})]}),e.jsx(d,{children:e.jsx(b,{checked:t.value,onCheckedChange:t.onChange})})]})})}),e.jsx("div",{className:"col-span-1",children:e.jsx(l,{control:s.control,name:"status",render:({field:t})=>e.jsxs(o,{className:"flex flex-row items-center justify-between rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(c,{className:"text-base",children:"Estado"}),e.jsx(C,{children:"Active o desactive la master"})]}),e.jsx(d,{children:e.jsx(b,{checked:t.value,onCheckedChange:t.onChange})})]})})}),e.jsx("div",{className:"mt-4 flex w-full items-end justify-end",children:e.jsxs(M,{variant:"primary-soft",type:"submit",className:"flex items-center gap-2",children:[e.jsx(q,{size:18}),"Guardar"]})})]})]})}))})})]})}export{de as default};
