var y=Object.defineProperty,_=Object.defineProperties;var k=Object.getOwnPropertyDescriptors;var u=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,G=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={}))E.call(r,a)&&x(s,a,r[a]);if(u)for(var a of u(r))G.call(r,a)&&x(s,a,r[a]);return s},h=(s,r)=>_(s,k(r));import{j as e}from"./radixui-DBNNXUn7.js";import"./router-ZPDjRWWZ.js";import{G as V,u as w,F as B,S as j,a as g,b as f,c as S,d as v}from"./select-CTEv52Fz.js";import{k as I,l as M,t as q,m as R,B as z,n as A}from"./index-C1-9bQes.js";import"./label-wWBD5Ozj.js";import"./popover-D_hLgl2z.js";import{u as Q,t as D,F as K,a as o,b as l,c,d,e as N,f as C}from"./form-ChakSTWw.js";import{S as b}from"./switch-D-xviNN8.js";import"./table-Be5yzNoc.js";import{u as L}from"./use-get-regionals-MiNNMFPG.js";import{c as O}from"./studios-services-jgdX3LyR.js";import{f as P}from"./schema-studios-CjN2zG-S.js";import{C as T,a as U}from"./card-BaxfxC-x.js";import"./vendor-C0DUGSOM.js";import"./useQuery-tXf2Qa8J.js";import"./utils-CbOYy0fT.js";import"./icons-DvPHMWAM.js";import"./settings-services-C1WB00Jx.js";function H(s){const r=I();return M({mutationFn:O,onSuccess:()=>{var a;r.invalidateQueries({queryKey:["getStudios"]}),(a=s.reset)==null||a.call(s),q({title:"Operación exitosa",description:"El estudio ha sido creado exitosamente."})},onError:a=>{V(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 he(){const s=W(),r=H(s),{users:a}=w(),{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(R,{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(B,{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(o,{control:s.control,name:"assigned_specialist_id",render:({field:t})=>{var n;return e.jsxs(l,{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(o,{control:s.control,name:"regional_id",render:({field:t})=>{var n;return e.jsxs(l,{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(o,{control:s.control,name:"is_paid",render:({field:t})=>e.jsxs(l,{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(o,{control:s.control,name:"status",render:({field:t})=>e.jsxs(l,{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(z,{variant:"primary-soft",type:"submit",className:"flex items-center gap-2",children:[e.jsx(A,{size:18}),"Guardar"]})})]})]})}))})})]})}export{he as default};
