import{_ as A}from"./Imprimer-DluCFs7h.js";import{C as I}from"./ComboDynamique-BzWI4ISP.js";import{b as V,B}from"./primevue-CfIk0_DY.js";import{o as T,b,c as F,j as d,H as m,d as i,v as r,a7 as q,k as L,p as U,F as z,E as O,a}from"./vue-core-Di3IuVqe.js";import{_ as H,u as W,S as w,b as x,s as o}from"./index-BxIwIJfy.js";import{D as J}from"./DataGrid-CoMfrBJA.js";import"./ReportViewer-BNzhW7G2.js";import"./stimulsoft-B2-Y-rC1.js";import"./cjs-helpers-psZwOBky.js";import"./PDFButton-DhVJ6hNy.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";import"./useAgGridConfig-Dp3DkgaV.js";const K={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-1"},P={class:"btns flex items-center gap-2 lg:w-1/4 lg:justify-start lg:ml-0 py-2"},Q={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4 mb-4"},X={class:"h-2"},Y={style:{height:"calc(100vh - 200px)",width:"100%"}},Z={__name:"EtatContributionSocialeDeSolidarite",setup(ee){const{showError:_,showWarn:p}=W(),s=O({lecture:!1,ajout:!1}),C=async()=>{try{const e=(await x.post(`${o.lienApi}/verifierDroit/${o.state.dbCommun6}`,{id_utilisateur:o.userId,id_page:1613,mail:o.state.userCloud.mail},{headers:{"Content-Type":"application/json"}})).data;e&&Object.keys(e).length>0&&(s.lecture=e.lecture,s.ajout=e.ajout),s.lecture||(p("Vous n'avez pas le droit, veuillez consulter l'administrateur"),w("EtatContributionSocialeDeSolidarite"))}catch(t){_("Une erreur est survenue : "+(t.response?.data?.message||t.message))}},g=a(),f=a(),h=a(),l=a([]),c=a(1),u=a(!1),S=a(null),y=a(null),E=({row:t})=>{S.value=t},D=t=>{h.value=t.api},k=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":"";T(async()=>{await C()});const $=async()=>{o.state.afficher_in_progress=!0;try{const t=await x.post(`${o.lienApi}/EtatContributionSocialeDeSolidarite/${o.db}`,{combo_Mois:c.value,annee_fiscale:o.state.annee_fiscale},{headers:{"Content-Type":"application/json"}});l.value=t.data}catch(t){const e=t.response?.data?.message||t.message;_(`Une erreur est survenue : ${e}`)}finally{o.state.afficher_in_progress=!1}},M=()=>{u.value=!0},R=()=>{if(!f.value){p("Grille non initialisée");return}if(l.value.length===0){p("Aucune donnée à exporter");return}const e=new Date().toISOString().slice(0,19).replace(/[-:]/g,"").replace("T","_");f.value.exportToExcel(`EtatContributionSocialeDeSolidarite_${o.state.enreg_societe.Nom}_Mois_${c.value}_${e}.xlsx`)};return(t,e)=>{const v=V,N=B,j=I,G=A;return b(),F(z,null,[d(i("div",K,[i("div",P,[r(v,{icon:"pi pi-refresh",label:"Afficher",text:"",onClick:e[0]||(e[0]=n=>$())}),r(v,{icon:"pi pi-cog",label:"Actions",text:"",onClick:e[1]||(e[1]=n=>g.value.toggle(n))}),r(N,{ref_key:"actionsMenu",ref:g,model:[{label:"Exporter vers Excel",icon:"pi pi-file-excel",command:()=>R()},{label:"Imprimer",icon:"pi pi-print",command:()=>M()}],popup:!0},null,8,["model"]),r(v,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[2]||(e[2]=n=>q(w)("EtatContributionSocialeDeSolidarite"))})])],512),[[m,s.lecture]]),d(i("div",Q,[i("div",null,[e[5]||(e[5]=i("label",{class:"block text-sm"},"Mois",-1)),r(j,{placeholder:"Mois",table:"MoisEnLettres",modelValue:c.value,"onUpdate:modelValue":e[3]||(e[3]=n=>c.value=n),class:"w-full"},null,8,["modelValue"])])],512),[[m,s.lecture]]),d(i("div",X,null,512),[[m,s.lecture]]),d(i("div",Y,[r(J,{ref_key:"dataGrid",ref:f,"excel-file-name":"Etat contribution sociale de solidarite","excel-sheet-name":"Etat contribution sociale de solidarite","row-data":l.value,"excluded-columns":["GID"],"column-widths":{Matricule:150,Nom:200,montant:150},"numeric-columns":["montant"],"enable-totals":!0,"totals-columns":["montant"],"get-row-class":k,onRowClicked:E,onGridReady:D},null,8,["row-data"])],512),[[m,s.lecture]]),u.value?(b(),L(G,{key:0,show:u.value,onClose:e[4]||(e[4]=n=>u.value=!1),Response:y.value,data:l.value,RapportName:"/classique/paie/EtatContributionSocialeDeSolidarite",nomFichier:"EtatCSS"},null,8,["show","Response","data"])):U("",!0)],64)}}},fe=H(Z,[["__scopeId","data-v-768410ba"]]);export{fe as default};
