import{f as d,o as c,c as p,b as r,a as f,q as m,z as v,ar as _}from"./vendor-BDR7yMJi.js";import{u as g,S as o,a as b,s as a}from"./index-BSaHX2oa.js";const y={class:"btns flex items-center gap-2"},k={__name:"ouvertureAnnee",setup(j){const{showError:n,showWarn:i}=g(),s=_({lecture:!1,ajout:!1,modif:!1,supp:!1,devalidation:!1,validation:!1}),l=async()=>{try{const e=(await b.post(`${a.lienApi}/verifierDroit/${a.state.dbCommun6}`,{id_utilisateur:a.userId,id_page:110,mail:a.state.userCloud.mail},{headers:{"Content-Type":"application/json"}})).data;e&&Object.keys(e).length>0&&(s.lecture=e.lecture,s.ajout=e.ajout,s.modif=e.modif,s.supp=e.supp,s.devalidation=e.devalidation,s.validation=e.validation),s.lecture||(i("Vous n'avez pas le droit, veuillez consulter l'administrateur"),o("ouvertureAnnee"))}catch(t){n("Une erreur est survenue : "+(t.response?.data?.message||t.message))}finally{a.state.afficher_in_progress=!1}};return d(async()=>{await l()}),(t,e)=>{const u=v;return c(),p("div",null,[r("div",y,[f(u,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[0]||(e[0]=x=>m(o)("ouvertureAnnee"))})]),e[1]||(e[1]=r("div",null,"Ouverture de l'année..",-1))])}}};export{k as default};
