import{b as V,B as $,y as R}from"./primevue-CfIk0_DY.js";import{o as N,b,c as P,j as c,H as p,d as s,v as r,a7 as S,k as B,p as F,F as G,E as L,a as l}from"./vue-core-Di3IuVqe.js";import{u as O,S as y,b as _,s as a}from"./index-BxIwIJfy.js";import{D as z}from"./DataGrid-CoMfrBJA.js";import{R as E}from"./RapportDynamique-DI8KNc5X.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";import"./useAgGridConfig-Dp3DkgaV.js";import"./ReportViewer-BNzhW7G2.js";import"./stimulsoft-B2-Y-rC1.js";import"./PDFButton-DhVJ6hNy.js";const I={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-4"},U={class:"btns flex items-center gap-2 lg:w-1/4 lg:justify-start lg:ml-0"},q={class:"p-4"},H={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},W={class:"h-2"},K={style:{height:"calc(100vh - 180px)",width:"100%"}},ue={__name:"PaieJoursTravailleesMois",setup(Q){const{showError:v,showWarn:f}=O(),o=L({lecture:!1,ajout:!1}),w=async()=>{try{const e=(await _.post(`${a.lienApi}/verifierDroit/${a.state.dbCommun6}`,{id_utilisateur:a.userId,id_page:1625,mail:a.state.userCloud.mail},{headers:{"Content-Type":"application/json"}})).data;e&&Object.keys(e).length>0&&(o.lecture=e.lecture,o.ajout=e.ajout),o.lecture||(f("Vous n'avez pas le droit, veuillez consulter l'administrateur"),y("PaieJoursTravailleesMois"))}catch(t){v("Une erreur est survenue : "+(t.response?.data?.message||t.message))}};N(async()=>{await w()});const g=l(),x=l(null),i=l([]),A=l(),h=l(),u=l(!1),d=l(1),C=[{label:"Calcul de la paie",value:1},{label:"Pointage",value:2}],k=({event:t,data:e})=>{x.value=e},J=t=>{h.value=t.api},M=async()=>{a.state.afficher_in_progress=!0;try{const t=await _.post(`${a.lienApi}/JoursTravailleAnnuelle/${a.db}`,{Annee:a.state.annee_fiscale,TypeCalcul:d.value,NbHeuresJour:a.state.enreg_option_paie.nbhj},{headers:{"Content-Type":"application/json"}});i.value=t.data}catch(t){v(`Une erreur est survenue lors du chargement des données: ${t}`)}finally{a.state.afficher_in_progress=!1}},j=()=>{if(!i.value||i.value.length===0){f("Aucune donnée à imprimer. Veuillez d'abord afficher les données.");return}u.value=!0};return(t,e)=>{const m=V,D=$,T=R;return b(),P(G,null,[c(s("div",I,[s("div",U,[r(m,{icon:"pi pi-refresh",label:"Afficher",text:"",onClick:M}),r(m,{icon:"pi pi-cog",label:"Actions",text:"",onClick:e[0]||(e[0]=n=>g.value.toggle(n))}),r(D,{ref_key:"actionsMenu",ref:g,model:[{label:"Imprimer",icon:"pi pi-print",command:()=>j()}],popup:!0},null,8,["model"]),r(m,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[1]||(e[1]=n=>S(y)("PaieJoursTravailleesMois"))})])],512),[[p,o.lecture]]),c(s("div",q,[s("div",H,[s("div",null,[e[4]||(e[4]=s("label",{class:"block text-sm font-medium text-gray-700 mb-1"},"Type de calcul",-1)),r(T,{modelValue:d.value,"onUpdate:modelValue":e[2]||(e[2]=n=>d.value=n),options:C,optionLabel:"label",optionValue:"value",placeholder:"Sélectionner le type",class:"w-full"},null,8,["modelValue"])])])],512),[[p,o.lecture]]),c(s("div",W,null,512),[[p,o.lecture]]),c(s("div",K,[r(z,{ref_key:"dataGrid",ref:A,"excel-file-name":"Paie jours travaillees mois","excel-sheet-name":"Paie jours travaillees mois","row-data":i.value,"numeric-columns":["Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre"],"date-columns":["datee"],"date-only":["datee"],"column-widths":{Matricule:140,Nom:140,Prenom:140,cin:140,cnss:140,datee: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},"grid-style":"height: calc(100vh - 240px); width: 100%",onRowClicked:k,onGridReady:J},null,8,["row-data"])],512),[[p,o.lecture]]),u.value?(b(),B(E,{key:0,show:u.value,dataList:i.value,titre:"Jours travaillés par mois",gridApi:h.value,onClose:e[3]||(e[3]=n=>u.value=!1)},null,8,["show","dataList","gridApi"])):F("",!0)],64)}}};export{ue as default};
