import{_ as A}from"./ComboDynamique-CzrtYPe1.js";import{f as _,o as T,c as k,b as l,a as o,z as M,q as $,b9 as C,r as s}from"./vendor-0kGcmQpG.js";import{u as G,S as h,a as g,s as n}from"./index-Bn9WoKhP.js";import{_ as B}from"./DataGrid-tb6QVwpZ.js";import"./useAgGridConfig-DjXMc6wb.js";const D={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-1"},J={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-4"},N={style:{height:"calc(100vh - 240px)",width:"100%"}},P={__name:"StatistiquesMensuellesRubrique",setup(U){const{showError:p,showWarn:q}=G(),V=s(null),m=s([]),x=s(null),r=s(""),c=s([]),u=s("Gain"),i=s(""),d=s(""),y=s([{label:"Gain",value:"Gain"},{label:"Retenu",value:"Retenu"},{label:"Base",value:"Base"},{label:"Taux",value:"Taux"}]),w=a=>{x.value=a.api},R=async()=>{try{const a=await g.post(`${n.lienApi}/RubriqueCalcul/${n.db}`,{},{headers:{"Content-Type":"application/json"}});c.value=a.data||[]}catch(a){p(`Erreur lors du chargement des rubriques: ${a.response?.data?.message||a.message}`)}},S=async()=>{try{if(!r.value){q("Veuillez sélectionner une rubrique");return}const a=await g.post(`${n.lienApi}/RubriqueParMois/${n.db}`,{Annee:n.state.annee_fiscale,Rubrique:r.value,TypeValeur:u.value,IdDepartement:i.value||-1,IdSite:d.value||-1,ProfilRRH:0},{headers:{"Content-Type":"application/json"}});m.value=a.data||[]}catch(a){p(`Une erreur est survenue lors du chargement des données: ${a.response?.data?.message||a.message}`)}};return _(()=>{R()}),(a,e)=>{const b=M,v=C,f=A;return T(),k("div",null,[l("div",D,[o(b,{icon:"pi pi-eye",label:"Afficher",text:"",onClick:S,class:"p-button-primary"}),o(b,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[0]||(e[0]=t=>$(h)("StatistiquesMensuellesRubrique"))})]),l("div",J,[l("div",null,[e[5]||(e[5]=l("label",{class:"block text-sm"},"Rubrique",-1)),o(v,{modelValue:r.value,"onUpdate:modelValue":e[1]||(e[1]=t=>r.value=t),options:c.value,optionLabel:"Libelle",optionValue:"code",placeholder:"Sélectionner une rubrique",class:"w-full",filter:"",showClear:""},null,8,["modelValue","options"])]),l("div",null,[e[6]||(e[6]=l("label",{class:"block text-sm"},"Type de valeur",-1)),o(v,{modelValue:u.value,"onUpdate:modelValue":e[2]||(e[2]=t=>u.value=t),options:y.value,optionLabel:"label",optionValue:"value",placeholder:"Type de valeur",class:"w-full"},null,8,["modelValue","options"])]),l("div",null,[e[7]||(e[7]=l("label",{class:"block text-sm"},"Affaire",-1)),o(f,{modelValue:i.value,"onUpdate:modelValue":e[3]||(e[3]=t=>i.value=t),table:"affaire",class:"w-full"},null,8,["modelValue"])]),l("div",null,[e[8]||(e[8]=l("label",{class:"block text-sm"},"Site",-1)),o(f,{modelValue:d.value,"onUpdate:modelValue":e[4]||(e[4]=t=>d.value=t),table:"site",class:"w-full"},null,8,["modelValue"])])]),e[9]||(e[9]=l("div",{class:"h-2"},null,-1)),l("div",null,[l("div",N,[o(B,{ref_key:"dataGrid",ref:V,"excel-file-name":"Statistiques mensuelles rubrique","excel-sheet-name":"Statistiques mensuelles rubrique","row-data":m.value,"numeric-columns":["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre","Total"],"excluded-columns":[],"column-widths":{Matricule:120,Nom_Prenom:250,Affaire:150,Site:150,Janvier:100,Fevrier:100,Mars:100,Avril:100,Mai:100,Juin:100,Juillet:100,Aout:100,Septembre:100,Octobre:100,Novembre:100,Decembre:100,Total:120},onGridReady:w},null,8,["row-data"])])])])}}};export{P as default};
