1import{r as h,j as e,B,G as b,F as ge,a as U,T as y,n as k,_ as $,A as fe,y as be,z as ye,I as Ce,X as Se,M as ee,J as je,af as Ee,v as Te,U as we,a0 as Pe,c as ve,l as Ie,a2 as M,W as Ae,S as J,t as Me}from"./vendor-core-1-1ujdHh.js";import{A as ae,E as ze,a as Fe}from"./ExamsCalendarView-z-gapJVD.js";import{a as O}from"./AcademyNotFound-BxiQX134.js";import{bn as Le,A as De,B as ke,p as z,bk as Ne,aP as Re,aN as R,Z as Be,f as Oe,b as Ue,b7 as Ye,u as _e,V as Ve,a4 as Ge}from"./useInstructorPractice-BBe_zbNF.js";import{e as Ke,P as qe}from"./useAcademy-Bpqf0a9F.js";import{t as We,e as He,f as Qe,g as $e,a as Je}from"./SkeletonList-BAgg_Ali.js";import{P as Xe}from"./plug-CRxQ-W8F.js";import{X as Ze,u as ea,a as aa}from"./ForgotPasswordPage-CdrhwfXe.js";import{p as ta,s as sa,d as na}from"./licenseColors-8_zq41xT.js";import{e as X,a as ia,b as oa,E as ra}from"./ExamTypeBadge-CeF2L-sp.js";import{b as la,c as ca}from"./useStudents-BC3IZ7iA.js";import{E as da,T as ma}from"./TramitacionesTabContent-B2d0AAmH.js";import{M as ua}from"./MatDashCard-aKXTHttj.js";import{M as xa}from"./formatCourseDuration-FFKBtf-G.js";import{L as pa}from"./useFeeFormData-D9gYxTgc.js";import{a as ha,B as ga}from"./main-BCwBjubz.js";import"./PowerfulSelect-C009s15F.js";import{S as fa,a as ba,t as Z,r as ya,u as Ca,M as Sa}from"./useCustomTable-Cp_aq_qK.js";import{u as ja}from"./useLegalEntities-CUiWpFXK.js";import{u as Ea}from"./DateRangeFilter-ChTI6BFs.js";import{u as Ta}from"./TeamStatusPage-Bu9laoT9.js";import{P as wa}from"./useSectionPaymentOptions-BSVxO6yC.js";import"./navigateFromEvent-DEB2Ge8X.js";import"./AnnouncementsPage-r21Q1r1e.js";import"./useStudentBalanceSummary-BKlGLd9-.js";import"./BackToLoginButton-RKOTVI4o.js";import"./actionIntent-COGs4cUm.js";import"./useTaxLabel-Mc-1dZ0q.js";import"./AskAssistantCard-7SCzT_5w.js";import"./useTenantLicenses-CfsCeMRP.js";import"./CapacityBars-CxW4pM90.js";import"./useCancelAuthorizationRequest-PimsG03V.js";import"./useAuesCredentials-CypbEZV8.js";import"./HeaderAction-B_2iXV2Z.js";import"./useLicenseFilterParam-eWribfK4.js";const D="brand";function Pa(){const{data:r}=Le(),{data:t}=Ke(),{hasPermission:p}=De(),[i,C]=h.useState(!1);if(i||!r||r.anyFeaturesEnabled)return null;const l=p(ke.SETTINGS_MANAGE),c=(t==null?void 0:t.slugs.includes(O.AUES_IN_DROVIFY))??!1,o=We(D);return e.jsxs(B,{style:{backgroundColor:$e(D),border:`1px solid ${Qe(D)}`,borderRadius:16,padding:"16px 48px 16px 20px",position:"relative"},children:[e.jsxs(b,{gap:"md",align:"center",children:[e.jsx(ge,{size:40,radius:"xl",variant:"filled",style:{backgroundColor:He(D),color:"#ffffff"},children:e.jsx(Xe,{size:20})}),e.jsxs(U,{gap:4,maw:640,style:{flex:"1 1 240px",minWidth:0},children:[e.jsx(y,{size:"md",fw:700,c:o,style:{lineHeight:1.3},children:"Conecta AUES y gestiónalo todo desde Drovify"}),e.jsx(y,{size:"sm",c:o,style:{lineHeight:1.5},children:"Presenta teóricas, destrezas y circulaciones, tramita traslados de expediente y genera tus listados de examen ODS sin cambiar de aplicación."})]}),e.jsxs(b,{gap:"sm",w:{base:"100%",sm:"auto"},style:{marginLeft:"auto"},children:[c&&e.jsx(k,{component:$,to:z.academyArticle(O.AUES_IN_DROVIFY),size:"sm",w:{base:"100%",sm:"auto"},variant:"outline",style:{borderColor:o,color:o},children:"Cómo funciona"}),l?e.jsx(k,{component:$,to:z.auesSettings(),size:"sm",w:{base:"100%",sm:"auto"},children:"Conectar con AUES"}):e.jsx(y,{size:"xs",fw:500,c:o,children:"Pide a un Manager que lo active"})]})]}),e.jsx(fe,{variant:"subtle",size:"md","aria-label":"Cerrar",onClick:()=>C(!0),style:{color:o,position:"absolute",top:12,right:12},children:e.jsx(Ze,{size:16})})]})}function va(){const r=be(),{showSuccessToast:t}=aa(),{handleError:p}=ea();return ye({mutationFn:i=>Je("/administrator/exam-presentations",{method:"POST",body:JSON.stringify(i)}),onSuccess:i=>{Ne(r,i.presentationId),t({title:"Tramitación creada"})},onError:i=>p(i)})}function Ia({opened:r,onClose:t,type:p,initialExamDate:i}){const C=Ce(),l=va(),c=Se({initialValues:{name:"",examDate:i??null},validate:{name:d=>d.trim().length===0?"Nombre requerido":null,examDate:d=>d?null:"Fecha estimada examen requerida"}}),o=c.onSubmit(async d=>
1{const S={name:d.name.trim(),examType:p,examDate:d.examDate};let m;try{m=await l.mutateAsync(S)}catch{return}t(),c.reset(),C(z.examPresentation(m.presentationId))});return e.jsx(ee,{opened:r,onClose:t,centered:!0,size:"md",title:e.jsx(y,{fw:600,children:"Nueva lista de tramitación"}),children:e.jsx("form",{onSubmit:o,children:e.jsxs(U,{children:[e.jsx(je,{label:"Nombre",placeholder:"Ej. Teórica Junio S1",...c.getInputProps("name")}),e.jsx(Ee,{label:"Fecha estimada examen",placeholder:"Introduce una fecha estimada del examen",valueFormat:"DD/MM/YYYY",locale:"es",dateParser:ta,withAsterisk:!0,...c.getInputProps("examDate")}),e.jsxs(b,{justify:"flex-end",children:[e.jsx(k,{variant:"subtle",onClick:t,children:"Cancelar"}),e.jsx(k,{type:"submit",loading:l.isPending,children:"Crear"})]})]})})})}function Aa({opened:r,onClose:t,initialDate:p,sectionId:i}){const C=[R.Teorico,R.Destreza,R.Circulacion],{data:l}=Re(i),[c,o]=h.useState(null),[d,S]=h.useState(null),[m,g]=h.useState(),T=n=>(l==null?void 0:l[n])??"disabled",j=n=>{g(p),T(n)==="full"?o(n):S(n),t()},F=n=>{g(p),S(n),t()},w=()=>{o(null),t()},P=()=>{S(null),t()};return e.jsxs(e.Fragment,{children:[e.jsx(ee,{opened:r,onClose:t,size:780,radius:"lg",title:"Nueva presentación",centered:!0,children:e.jsx(Te,{cols:{base:1,sm:3},spacing:"md",children:C.map(n=>{const v=T(n),E=ia(n),N=oa(n),I=`color-mix(in srgb, ${E.solid} 28%, transparent)`;return e.jsxs(B,{style:{display:"flex",flexDirection:"column"},children:[e.jsxs(we,{onClick:()=>j(n),style:{display:"flex",flexDirection:"column",height:132,borderRadius:16,padding:20,background:E.bg,border:`1px solid ${I}`,transition:"border-color 150ms ease"},onMouseEnter:A=>{A.currentTarget.style.borderColor=E.solid},onMouseLeave:A=>{A.currentTarget.style.borderColor=I},children:[e.jsxs(b,{justify:"space-between",align:"flex-start",wrap:"nowrap",w:"100%",children:[e.jsx(B,{style:{width:48,height:48,borderRadius:12,background:"var(--mantine-color-white)",border:`1px solid ${I}`,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(N,{size:24,color:E.solid})}),v!=="disabled"&&e.jsx(ae,{mode:v})]}),e.jsx(y,{fw:600,fz:"lg",mt:"md",style:{color:E.text},children:X(n)})]}),v==="full"&&e.jsxs(Pe,{component:"button",type:"button",onClick:()=>F(n),mt:"xs",fz:"xs",c:"dimmed",ta:"center",children:["o crear un examen de ",X(n).toLowerCase()," sin AUES"]})]},n)})})}),c&&e.jsx(Ia,{opened:!0,onClose:w,type:c,initialExamDate:m}),d&&e.jsx(la,{isOpen:!0,onClose:P,type:d,initialDate:m})]})}function Ma(r,t){return Be({endpoint:"/instructor/exams",queryKey:Oe.instructorLists(),params:r,enabled:t==null?void 0:t.enabled,splitCount:!0})}const za=[{value:"week",label:"Semana"},{value:"month",label:"Mes"},{value:"list",label:"Lista"}];function xt(){Ue("Exámenes");const{roles:r}=ha(),t=r.includes(Ye.Staff),[p,i]=h.useState(!1),[C,l]=h.useState(),{data:c=[]}=ja({enabled:t}),o=c.length>1,{data:d=[]}=_e({enabled:t}),S=t&&d.length>1,[m,g]=ve(),T=m.get("view")??"month",j=T==="list",F=m.get("tab")??"examenes",w=m.get("legalEntity"),P=m.get("section"),n=m.get("type");Ve({fullWidth:!0});const v=a=>{g(x=>{const s=new URLSearchParams(x);return a==="month"?s.delete("view"):s.set("view",a),s})},E=a=>{g(x=>{const s=new URLSearchParams(x);return!a||a==="examenes"?s.delete("tab"):s.set("tab",a),s})},N=a=>g(x=>{const s=new URLSearchParams(x);return a?s.set("legalEntity",a):s.delete("legalEntity"),s}),I=a=>g(x=>{const s=new URLSearchParams(x);return a?s.set("section",a):s.delete("section"),s}),A=a=>g(x=>{const s=new URLSearchParams(x);return a?s.set("type",a):s.delete("type"),s}),Y=m.get("date"),te=Y?sa(Y):void 0,se=a=>g(x=>{const s=new URLSearchParams(x);return s.set("date",na(a)),s},{replace:!0}),ne=a=>{l(a),i(!0)},_=h.useMemo(()=>[],[]),{columnFilters:V,setColumnFilters:ie,pagination:f,setPagination:oe,sorting:G,setSorting:re,isInitialized:K}=Ta({filterConfig:_,defaultPageSize:25}),{cleanFilterParams:q}=Ea({filters:_,columnFilters:V,sorting:G}),W=h.useMemo(()=>({...q,page:((f==null?void 0:f.pageIndex)??0)+1,limit:(f==null?void 0:f.pageSize)??25,legalEntityId:w||void 0,type:n??void 0}),[q,f,w,n]),le=ca(W,{enabled:t&&K&&j}),ce=Ma(W,{enabled:!t&&K&&j}),{data:u,isLoading:de,error:H,isDataFetching:me,isCountLoading:Q}=t?le:ce,ue=h.useMemo(()=>(u==null?void 0:u.items)||[],[u==null?void 0:u.items]),L=(u==null?void 0:u.total)??0,xe=!Q&&L!==null,pe=h.useMemo(()=>[{accessorKey:"date",header:"Fecha",...fa.date,enableColumnFilter:!1,Cell:({row:a})=>e.jsx(y,{size:"sm",children:Ge(a.original.date)})},{accessorKey:"examCenter",header:"Centro de examen",size:220,grow:!0,enableColumnFilter:!1,enableSorting:!1,Cell:({row:a})=>e.jsxs(b,{gap:6,wrap:"nowrap",style:{minWidth:0},children:[e.jsx(ga,{to:z.exam(a.original.id),size:"sm",truncate:!0,children:a.original.examCenter}),a.original.origin===ze.Aues&&e.jsx(ae,{style:{flexShrink:0}})]})},{...ba({accessorKey:"type",header:"Tipo",min:110,max:150,cell:a=>e.jsx(ra,{type:a.type})}),enableColumnFilter:!1,enableSorting:!1},{...Z({accessorKey:"examCenter",header:"Centro",value:a=>a.examCenter,min:165,max:215}),enableColumnFilter:!1,enableSorting:!1},...o?[{...Z({accessorKey:"legalEntityName",header:"Sociedad",value:a=>a.legalEntityName,min:140,max:200}),enableColumnFilter:!1,enableSorting:!1}]:[],{accessorKey:"licenseIds",header:"Permisos",enableSorting:!1,enableColumnFilter:!1,...ya({min:170,max:260}),Cell:({row:a})=>e.jsx(pa,{licenseIds:a.original.licenseIds,maxVisible:5})}],[o]),he=Ca({columns:pe,data:ue,enableTopToolbar:!1,enableRowActions:!1,enableColumnFilters:!1,enableSorting:!0,enableMultiSort:!1,enableGlobalFilter:!1,enablePagination:xe,manualFiltering:!0,onColumnFiltersChange:ie,manualPagination:!0,onPaginationChange:oe,manualSorting:!0,onSortingChange:re,rowCount:L,state:{density:"xs",isLoading:de,showAlertBanner:!!H,showLoadingOverlay:me,columnFilters:V,pagination:f,sorting:G},initialState:{pagination:{pageIndex:0,pageSize:25}},rowClickPath:a=>z.exam(a.original.id),renderBottomToolbarCustomActions:()=>e.jsx(b,{justify:"space-between",children:Q&&(u==null?void 0:u.total)===void 0?e.jsx(Me,{width:130,height:20,radius:"sm"}):e.jsxs(y,{size:"md",children:["Total: ",L," examen",L!==1?"es":""]})})});return H&&j&&F==="examenes"?e.jsx(Ie,{size:"md",children:e.jsx(U,{children:e.jsx(y,{children:"Error al cargar los exámenes"})})}):e.jsxs(qe,{helpArticle:{slug:O.EXAM_LISTS,topic:"los exámenes"}
1,title:"Exámenes",description:"Gestiona los exámenes de tu autoescuela.",actionButton:t?{label:"Nueva presentación",onClick:()=>{l(void 0),i(!0)},icon:e.jsx(wa,{size:16})}:void 0,children:[t&&e.jsx(Pa,{}),e.jsxs(xa,{value:F,onChange:E,children:[e.jsxs(M.List,{children:[e.jsx(M.Tab,{value:"examenes",children:"Exámenes"}),e.jsx(M.Tab,{value:"tramitaciones",children:"Tramitaciones"})]}),e.jsxs(M.Panel,{value:"examenes",children:[e.jsxs(b,{justify:"space-between",mb:"md",children:[e.jsx(Ae,{value:T,onChange:v,data:za,size:"sm"}),e.jsxs(b,{gap:"sm",children:[e.jsx(da,{allowAll:!0,value:n,onChange:A,variant:"filled",styles:{input:{backgroundColor:"white"}},w:190,size:"sm"}),S&&!j&&e.jsx(J,{placeholder:"Todas las secciones",data:d.map(a=>({value:a.id,label:a.name})),value:P,onChange:I,clearable:!0,variant:"filled",styles:{input:{backgroundColor:"white"}},w:200,size:"sm"}),t&&o&&e.jsx(J,{placeholder:"Todas las sociedades",data:c.map(a=>({value:a.id,label:a.companyName})),value:w,onChange:a=>N(a||null),clearable:!0,variant:"filled",styles:{input:{backgroundColor:"white"}},w:220,size:"sm"})]})]}),j?e.jsx(ua,{children:e.jsx(Sa,{table:he})}):e.jsx(Fe,{isAdmin:t,subView:T,onCreateExam:ne,legalEntityId:w||void 0,sectionId:P||void 0,type:n??void 0,date:te,onDateChange:se})]}),e.jsx(M.Panel,{value:"tramitaciones",children:e.jsx(ma,{sectionId:P||void 0})})]}),t&&e.jsx(Aa,{opened:p,onClose:()=>{i(!1),l(void 0)},initialDate:C,sectionId:P||void 0})]})}export{xt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.