import{b as x}from"./primevue-CfIk0_DY.js";import{o as A,b as J,c as M,j as u,H as d,d as o,v as n,a7 as C,F as j,E as D,a as r}from"./vue-core-Di3IuVqe.js";import{u as S,S as m,b as p,s as t}from"./index-BxIwIJfy.js";import{D as k}from"./DataGrid-CoMfrBJA.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";import"./useAgGridConfig-Dp3DkgaV.js";const F={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-1"},T={class:"btns flex items-center gap-2 lg:w-1/4 lg:justify-start lg:ml-0 py-2"},$={style:{height:"calc(100vh - 220px)",width:"100%"}},W={__name:"JoursAbsencesMois",setup(G){const{showError:i,showWarn:h}=S(),a=D({lecture:!1,ajout:!1}),f=async()=>{try{const s=(await p.post(`${t.lienApi}/verifierDroit/${t.state.dbCommun6}`,{id_utilisateur:t.userId,id_page:1640,mail:t.state.userCloud.mail},{headers:{"Content-Type":"application/json"}})).data;s&&Object.keys(s).length>0&&(a.lecture=s.lecture,a.ajout=s.ajout),a.lecture||(h("Vous n'avez pas le droit, veuillez consulter l'administrateur"),m("JoursAbsencesMois"))}catch(e){i("Une erreur est survenue : "+(e.response?.data?.message||e.message))}};A(async()=>{await f()});const v=r(null),b=r(null),l=r([]),g=r({Matricule:95,nom:200,cin:90,cnss:90,Janvier:90,Fevrier:90,Mars:90,Avril:90,Mai:90,Juin:90,Juillet:90,Aout:90,Septembre:90,Octobre:90,Novembre:90,Decembre:90,Total:90}),_=e=>{e.api.sizeColumnsToFit()},w=({selectedRows:e})=>{e.length>0&&(b.value=e[0])},y=async()=>{try{const e=await p.post(`${t.lienApi}/AbsencesParMois/${t.db}`,{Annee:t.state.annee_fiscale},{headers:{"Content-Type":"application/json"}});l.value=e.data}catch(e){i(`Une erreur est survenue lors du chargement des données: ${e.message}`)}};return(e,s)=>{const c=x;return J(),M(j,null,[u(o("div",F,[o("div",T,[n(c,{icon:"pi pi-refresh",label:"Afficher",text:"",onClick:y}),n(c,{icon:"pi pi-times",label:"Fermer",text:"",onClick:s[0]||(s[0]=B=>C(m)("JoursAbsencesMois"))})])],512),[[d,a.lecture]]),u(o("div",$,[n(k,{ref_key:"dataGrid",ref:v,"excel-file-name":"Jours absences mois","excel-sheet-name":"Jours absences mois","row-data":l.value,"numeric-columns":["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre","Total"],"column-widths":g.value,"excluded-columns":["datee"],"grid-style":"height: calc(100vh - 240px); width: 100%",onSelectionChanged:w,onGridReady:_},null,8,["row-data","column-widths"])],512),[[d,a.lecture]])],64)}}};export{W as default};
