import{d as $,k as M,aC as q,l as f,G as h,ax as D,o as i,c as b,q as a,w as e,s as o,H as F,A as c,I as s,L as m,P as T,F as w,a as A,b as y,W as J,K as U,B as E,ay as j,y as G,aA as H,aD as K,aE as W}from"./index-2e57ee69.js";import{J as I}from"./applicants.service-23a5de62.js";import{V as z,a as L}from"./VTabs-837e0b88.js";import{a as d,V as g}from"./VRow-22fc34ca.js";import{V as Q}from"./VPagination-47c55cd0.js";import{V as X,a as Y}from"./VToolbar-6d94a41a.js";import{V as Z}from"./VMenu-9f22b74a.js";import{V as B,d as aa,a as k,b as P}from"./VList-0b71c0f0.js";import{b as O}from"./route-block-83d24a4e.js";import"./VDivider-29fb9868.js";const ea=$({__name:"postulations",setup(ta){const S=M(),N=q(),p=f(N.path.includes("postulations")?"postulations":"cvs"),_=f(!1),V=f([]),x=f([]),n=f({currentPage:1,lastPage:1,itemsPerPage:0,totalItems:0});h(p,l=>{S.push(`/bolsa-laboral-panel/me/${l}`)}),h(()=>n.value.currentPage,()=>{v()});const v=async()=>{try{_.value=!0;const{data:l}=await I.myApplications(n.value.currentPage);V.value=l.applications,x.value=l.lastOffers,n.value=l.pagination}catch{}finally{_.value=!1}},R=async l=>{if(await H({title:"Anular Postulación",content:"¿Estás seguro de que deseas anular esta postulación?"}))try{_.value=!0;const{success:t,message:u}=await I.cancelApplication(l);if(!t){K(u||"Error al anular la postulación");return}W(u),v()}catch(t){console.error("Error al anular la postulación:",t)}finally{_.value=!1}},C=l=>{window.open(`/bolsa-laboral/${l}`,"_blank")};return D(()=>{v()}),(l,r)=>(i(),b("div",null,[a(m,{rounded:"xl",class:"mb-4"},{default:e(()=>[a(z,{modelValue:o(p),"onUpdate:modelValue":r[0]||(r[0]=t=>F(p)?p.value=t:null),grow:"",stacked:""},{default:e(()=>[a(L,{value:"postulations"},{default:e(()=>[a(c,{icon:"mdi-briefcase",class:"mr-2"}),s(" Postulaciones ")]),_:1}),a(L,{value:"cvs"},{default:e(()=>[a(c,{icon:"mdi-file-document",class:"mr-2"}),s(" Curriculum's Vitae ")]),_:1})]),_:1},8,["modelValue"])]),_:1}),a(g,null,{default:e(()=>[a(d,{cols:"12",md:"8"},{default:e(()=>[a(g,{class:"mb-2"},{default:e(()=>[a(d,{cols:"12"},{default:e(()=>[a(m,{class:"pa-4"},{default:e(()=>[a(T,{class:"text-h5"},{default:e(()=>[a(g,null,{default:e(()=>[a(d,{cols:"12",sm:"6"},{default:e(()=>[s(" Mis Postulaciones ")]),_:1}),a(d,{cols:"12",md:"6",style:{display:"flex","justify-content":"flex-end"}},{default:e(()=>[a(Q,{length:o(n).lastPage,rounded:"circle","total-visible":3,modelValue:o(n).currentPage,"onUpdate:modelValue":[r[1]||(r[1]=t=>o(n).currentPage=t),r[2]||(r[2]=t=>o(n).currentPage=t)],density:"compact"},null,8,["length","modelValue"])]),_:1})]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),o(V).length>0?(i(!0),b(w,{key:0},A(o(V),t=>(i(),y(m,{key:t.offerId,class:"mb-4"},{default:e(()=>[a(X,{color:"surface",class:"pa-2",elevation:5},{prepend:e(()=>[a(c,{icon:"mdi-briefcase",class:"mr-2"})]),append:e(()=>[a(Z,{location:"bottom"},{activator:e(({props:u})=>[a(J,U({icon:"mdi-dots-vertical",variant:"text"},u),null,16)]),default:e(()=>[a(B,null,{default:e(()=>[a(aa,null,{default:e(()=>[s("Acciones")]),_:1}),a(k,{onClick:()=>R(t.id)},{default:e(()=>[a(P,null,{default:e(()=>[a(c,{start:""},{default:e(()=>[s(" mdi-cancel ")]),_:1}),s(" Anular Postulación ")]),_:1})]),_:2},1032,["onClick"]),a(k,{onClick:u=>C(t.offerSlug)},{default:e(()=>[a(P,null,{default:e(()=>[a(c,{start:""},{default:e(()=>[s("mdi-eye")]),_:1}),s(" Ver Oferta ")]),_:1})]),_:2},1032,["onClick"])]),_:2},1024)]),_:2},1024)]),default:e(()=>[a(Y,{class:"text-h6",text:t.offerTitle},null,8,["text"])]),_:2},1024)]),_:2},1024))),128)):E("",!0),o(V).length===0?(i(),y(m,{key:1},{default:e(()=>[a(j,{class:"text-center"},{default:e(()=>[s(" No tienes postulaciones registradas. ")]),_:1})]),_:1})):E("",!0)]),_:1}),a(d,{cols:"12",md:"4",style:{display:"none"}},{default:e(()=>[a(g,null,{default:e(()=>[a(d,{cols:"12"},{default:e(()=>[a(m,{class:"pa-4",elevation:"0",rounded:"0"},{default:e(()=>[a(T,{class:"text-h5"},{default:e(()=>[s(" Te pueden interesar "),a(c,{icon:"mdi-chevron-right",class:"ml-2"})]),_:1})]),_:1})]),_:1})]),_:1}),a(B,{nav:"",lines:!1},{default:e(()=>[(i(!0),b(w,null,A(o(x),t=>(i(),y(k,{key:t.id,variant:"plain",onClick:u=>C(t.slug)},{default:e(()=>[a(P,null,{default:e(()=>[s(G(t.title),1)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1})]),_:1})]))}});typeof O=="function"&&O(ea);export{ea as default};
