import{_ as $}from"./Imprimer-CqTc6qE9.js";import{_ as R}from"./ComboDynamique-CzrtYPe1.js";import{f as D,o as f,c as N,b as a,a as s,z as G,av as I,q as V,i as A,d as B,F as T,r as o}from"./vendor-0kGcmQpG.js";import{_ as F,u as q,S as L,s as l,a as j}from"./index-Bn9WoKhP.js";import{_ as U}from"./DataGrid-tb6QVwpZ.js";import"./ReportViewer-1Jmo7TFF.js";import"./useAgGridConfig-DjXMc6wb.js";const z={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-1"},O={class:"btns flex items-center gap-2 lg:w-1/4 lg:justify-start lg:ml-0 py-2"},W={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-4"},H={style:{height:"calc(100vh - 200px)",width:"100%"}},J={__name:"EtatContributionSocialeDeSolidarite",setup(K){const{showError:_,showWarn:m}=q(),p=o(),u=o(),v=o(),i=o([]),r=o(1),c=o(!1),g=o(null),b=o(null),x=({row:t})=>{g.value=t},w=t=>{v.value=t.api},S=t=>t.data&&(t.data.Nom&&t.data.Nom.includes("Sous total")||t.data.Nom&&t.data.Nom.includes("Total Général"))?"row-total":"";D(()=>{});const C=async()=>{l.state.afficher_in_progress=!0;try{const t=await j.post(`${l.lienApi}/EtatContributionSocialeDeSolidarite/${l.db}`,{combo_Mois:r.value,annee_fiscale:l.state.annee_fiscale},{headers:{"Content-Type":"application/json"}});i.value=t.data}catch(t){const e=t.response?.data?.message||t.message;_(`Une erreur est survenue : ${e}`)}finally{l.state.afficher_in_progress=!1}},E=()=>{c.value=!0},h=()=>{if(!u.value){m("Grille non initialisée");return}if(i.value.length===0){m("Aucune donnée à exporter");return}const e=new Date().toISOString().slice(0,19).replace(/[-:]/g,"").replace("T","_");u.value.exportToExcel(`EtatContributionSocialeDeSolidarite_${l.state.enreg_societe.Nom}_Mois_${r.value}_${e}.xlsx`)};return(t,e)=>{const d=G,y=I,k=R,M=$;return f(),N(T,null,[a("div",z,[a("div",O,[s(d,{icon:"pi pi-refresh",label:"Afficher",text:"",onClick:e[0]||(e[0]=n=>C())}),s(d,{icon:"pi pi-cog",label:"Actions",text:"",onClick:e[1]||(e[1]=n=>p.value.toggle(n))}),s(y,{ref_key:"actionsMenu",ref:p,model:[{label:"Exporter vers Excel",icon:"pi pi-file-excel",command:()=>h()},{label:"Imprimer",icon:"pi pi-print",command:()=>E()}],popup:!0},null,8,["model"]),s(d,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[2]||(e[2]=n=>V(L)("EtatContributionSocialeDeSolidarite"))})])]),a("div",W,[a("div",null,[e[5]||(e[5]=a("label",{class:"block text-sm"},"Mois",-1)),s(k,{placeholder:"Mois",table:"MoisEnLettres",modelValue:r.value,"onUpdate:modelValue":e[3]||(e[3]=n=>r.value=n),class:"w-full"},null,8,["modelValue"])])]),e[6]||(e[6]=a("div",{class:"h-2"},null,-1)),a("div",H,[s(U,{ref_key:"dataGrid",ref:u,"excel-file-name":"Etat contribution sociale de solidarite","excel-sheet-name":"Etat contribution sociale de solidarite","row-data":i.value,"excluded-columns":["GID"],"column-widths":{Matricule:150,Nom:200,montant:150},"numeric-columns":["montant"],"enable-totals":!0,"totals-columns":["montant"],"get-row-class":S,onRowClicked:x,onGridReady:w},null,8,["row-data"])]),c.value?(f(),A(M,{key:0,show:c.value,onClose:e[4]||(e[4]=n=>c.value=!1),Response:b.value,data:i.value,RapportName:"/classique/paie/EtatContributionSocialeDeSolidarite",nomFichier:"EtatCSS"},null,8,["show","Response","data"])):B("",!0)],64)}}},oe=F(J,[["__scopeId","data-v-c554e076"]]);export{oe as default};
