import{b as y,s as l}from"./index-BxIwIJfy.js";import{o as w,h as C,b as g,c as x,d as t,t as r,F as B,C as M,v as k,l as S,q as b,G as $,f as A,y as n,a as c}from"./vue-core-Di3IuVqe.js";import"./primevue-CfIk0_DY.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";const D={class:"max-w-4xl mx-auto space-y-6"},F={class:"text-2xl font-bold text-gray-800"},j={class:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4"},z={class:"flex items-center gap-4"},E={class:"font-semibold text-gray-800 group-hover:text-blue-600 transition-colors"},N={class:"text-sm text-gray-500"},V={class:"grid grid-cols-1 sm:grid-cols-3 gap-4"},I={class:"rounded-xl border bg-white p-5 shadow-sm"},P={class:"text-2xl font-bold text-gray-800 mt-1"},R={class:"rounded-xl border bg-white p-5 shadow-sm"},T={class:"text-2xl font-bold text-gray-800 mt-1"},Y={class:"rounded-xl border bg-white p-5 shadow-sm"},q={class:"text-2xl font-bold text-gray-800 mt-1"},W={__name:"PortailAccueil",setup(G){const i=n(()=>l.state.portailSalarieEmploye),v=n(()=>i.value?.Prenom||""),h=n(()=>l.state.portailSalarieDb),d=c("--"),u=c("--"),p=c("--"),_=[{title:"Mes bulletins",description:"Consulter et télécharger",icon:"pi pi-file",bgColor:"bg-blue-50",iconColor:"var(--omag-500)",to:"/portail-salarie/bulletins"},{title:"Mes congés",description:"Solde et demandes",icon:"pi pi-calendar",bgColor:"bg-green-50",iconColor:"#16a34a",to:"/portail-salarie/conges"},{title:"Mes documents",description:"Attestations administratives",icon:"pi pi-folder-open",bgColor:"bg-amber-50",iconColor:"#d97706",to:"/portail-salarie/documents"},{title:"Mon profil",description:"Informations personnelles",icon:"pi pi-user",bgColor:"bg-purple-50",iconColor:"#9333ea",to:"/portail-salarie/profil"}],f=()=>{const s=i.value?.date_embauche;if(!s)return"--";const e=new Date(s),a=new Date,o=a.getFullYear()-e.getFullYear(),m=a.getMonth()-e.getMonth();return o>0?`${o} an${o>1?"s":""}`:m>0?`${m} mois`:"< 1 mois"};return w(async()=>{p.value=f();try{const s=await y.get(`${l.lienApi}/portail-salarie/resume/${h.value}/${i.value.Matricule}`,{headers:{Authorization:`Bearer ${l.state.portailSalarieToken}`}});d.value=s.data.soldeConges??"--",u.value=s.data.dernierBulletin||"--"}catch{}}),(s,e)=>{const a=C("router-link");return g(),x("div",D,[t("div",null,[t("h1",F," Bonjour "+r(v.value),1),e[0]||(e[0]=t("p",{class:"text-gray-500 mt-1"},"Bienvenue dans votre espace salarié",-1))]),t("div",j,[(g(),x(B,null,M(_,o=>k(a,{key:o.to,to:o.to,class:"block rounded-xl border bg-white p-6 shadow-sm hover:shadow-md transition-shadow group"},{default:S(()=>[t("div",z,[t("div",{class:b(["flex h-12 w-12 items-center justify-center rounded-lg transition-colors",o.bgColor])},[t("i",{class:b([o.icon,"text-xl"]),style:$({color:o.iconColor})},null,6)],2),t("div",null,[t("h3",E,r(o.title),1),t("p",N,r(o.description),1)])])]),_:2},1032,["to"])),64))]),t("div",V,[t("div",I,[e[2]||(e[2]=t("div",{class:"text-sm text-gray-500"},"Solde congés",-1)),t("div",P,[A(r(d.value)+" ",1),e[1]||(e[1]=t("span",{class:"text-sm font-normal text-gray-400"},"jours",-1))])]),t("div",R,[e[3]||(e[3]=t("div",{class:"text-sm text-gray-500"},"Dernier bulletin",-1)),t("div",T,r(u.value),1)]),t("div",Y,[e[4]||(e[4]=t("div",{class:"text-sm text-gray-500"},"Ancienneté",-1)),t("div",q,r(p.value),1)])])])}}};export{W as default};
