import{d as C,l as m,o as i,c as b,b as p,w as l,q as a,A as f,I as s,W as n,B as y,L as x,P as k,ay as B,U as _,b8 as g,aD as d,z as S,aE as w}from"./index-2e57ee69.js";import{J as A}from"./job-offer-a441ea01.js";import{V as E}from"./VFileInput-0856c4d1.js";import{V as I}from"./VSpacer-0163be53.js";const $=C({__name:"upload",props:{styleBtn:{default:"icon"}},setup(v){const c=v,t=m(!1),r=m(null),V=async()=>{if(!r.value){d("Por favor, selecciona un archivo para subir.");return}try{const{success:u,message:e,data:o}=await A.uploadCV(r.value[0]);if(!u){d("Error al subir el archivo: "+e);return}S.emit("uploadCV",o),w("Archivo subido correctamente"+e),t.value=!1}catch(u){d("Error al subir el archivo: "+u.message)}finally{r.value=null}};return(u,e)=>(i(),b("div",null,[c.styleBtn==="icon"?(i(),p(n,{key:0,icon:"",color:"primary",variant:"text",onClick:e[0]||(e[0]=o=>t.value=!0)},{default:l(()=>[a(f,null,{default:l(()=>[s("mdi-plus")]),_:1})]),_:1})):c.styleBtn==="tonal"?(i(),p(n,{key:1,color:"primary",onClick:e[1]||(e[1]=o=>t.value=!0),class:"mb-4"},{default:l(()=>[a(f,{icon:"mdi-plus",class:"mr-2"}),s(" Agregar CV ")]),_:1})):y("",!0),a(g,{modelValue:t.value,"onUpdate:modelValue":e[4]||(e[4]=o=>t.value=o),"max-width":"500"},{default:l(()=>[a(x,null,{default:l(()=>[a(k,{class:"text-h6"},{default:l(()=>[s("Subir nuevo CV")]),_:1}),a(B,null,{default:l(()=>[a(E,{modelValue:r.value,"onUpdate:modelValue":e[2]||(e[2]=o=>r.value=o),label:"Selecciona un archivo",accept:".pdf,.doc,.docx,.odt","prepend-icon":"mdi-upload","show-size":"",outlined:"",dense:""},null,8,["modelValue"])]),_:1}),a(_,null,{default:l(()=>[a(I),a(n,{text:"",onClick:e[3]||(e[3]=o=>t.value=!1)},{default:l(()=>[s("Cancelar")]),_:1}),a(n,{color:"primary",onClick:V,disabled:!r.value},{default:l(()=>[s("Subir")]),_:1},8,["disabled"])]),_:1})]),_:1})]),_:1},8,["modelValue"])]))}});export{$ as _};
