import{_ as $}from"./ComboDynamique-DbhbUtR4.js";import{f as R,w as E,o as N,c as A,b as o,a as n,z as G,av as T,j as k,h as B,q as V,r as a,e as I}from"./vendor-BDR7yMJi.js";import{u as q,s as l,a as P,S as j}from"./index-BSaHX2oa.js";import{_ as H}from"./DataGrid-DbeHIyBR.js";import"./useAgGridConfig-DxO2r97K.js";const L={class:"w-full flex flex-row items-center gap-3"},O={class:"flex gap-4 mb-4"},U={class:"p-float-label w-64"},W={style:{height:"calc(100vh - 250px)"}},Z={__name:"DetailCalculMois",setup(z){const{showError:v,showWarn:d}=q(),c=a(),r=a([]),_=a(null),p=a(null),x=["Affaire","Site","Matricule","Nom","Prenom","Rubrique","Base","Taux","Gain","Retenu","CIN","CNSS"],g={Affaire:150,Site:120,Matricule:120,Nom:150,Prenom:150,Rubrique:120,Base:120,Taux:100,Gain:120,Retenu:120,CIN:120,CNSS:120},h=["Base","Taux","Gain","Retenu"];let u=a("");const C=new Date().getMonth()+1,s=a(C),w=I(()=>[{label:"Exporter vers Excel",icon:"pi pi-file-excel",command:()=>y()}]);R(async()=>{}),E(()=>s.value,()=>{f()});const f=async()=>{l.state.afficher_in_progress=!0;try{u.value="",u.value+=` and c.Annee=${l.state.annee_fiscale} and month(c.DateAu)=${s.value}`,l.state.userCommun6.profil_RRH==0&&(u.value+=" and rc.matricule not in (select Matricule from Employe where Employe.profil_RRH=1)");const t=await P.post(`${l.lienApi}/DetailCalculMois/${l.db}`,{condition1:u.value},{headers:{"Content-Type":"application/json"}});r.value=t.data}catch(t){v(`Une erreur s'est produite lors de l'affichage des détails du calcul mensuel. ${t}`)}finally{l.state.afficher_in_progress=!1}},M=({selectedRows:t})=>{t&&t.length>0&&(_.value=t[0])},b=()=>{},y=()=>{if(!c.value){d("Grille non initialisée");return}if(!r.value||r.value.length===0){d("Aucune donnée à exporter");return}const e=new Date().toISOString().slice(0,19).replace(/[-:]/g,"").replace("T","_");c.value.exportToExcel(`DetailCalculMois_${s.value}_${e}.xlsx`)};return(t,e)=>{const m=G,D=T,S=$;return N(),A("div",null,[o("div",L,[n(m,{icon:"pi pi-refresh",label:"Afficher",text:"",onClick:e[0]||(e[0]=i=>f())}),n(D,{ref_key:"actionsMenu",ref:p,model:w.value,popup:!0},null,8,["model"]),n(m,{onClick:e[1]||(e[1]=i=>p.value.toggle(i)),text:""},{default:k(()=>[...e[4]||(e[4]=[o("i",{class:"pi pi-cog mr-2"},null,-1),B(" Actions ",-1),o("i",{class:"pi pi-chevron-down ml-2"},null,-1)])]),_:1}),n(m,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[2]||(e[2]=i=>V(j)("DetailCalculMois"))})]),o("div",null,[o("div",O,[o("span",U,[e[5]||(e[5]=o("label",{for:"mois"},"Mois",-1)),n(S,{id:"mois",modelValue:s.value,"onUpdate:modelValue":e[3]||(e[3]=i=>s.value=i),table:"MoisEnLettres",class:"w-full"},null,8,["modelValue"])])]),e[6]||(e[6]=o("div",{class:"h-2"},null,-1)),o("div",W,[n(H,{ref_key:"agGrid",ref:c,"excel-file-name":"Detail calcul mois","excel-sheet-name":"Detail calcul mois","row-data":r.value,"column-order":x,"column-widths":g,"numeric-columns":h,"enable-totals":!1,onGridReady:b,onSelectionChanged:M},null,8,["row-data"])])])])}}};export{Z as default};
