import{r as a,w as g,f as x,o as y,i as C,j as d,b as D,a as m,z as $,S as k}from"./vendor-BDR7yMJi.js";import{u as B,s as f,a as N}from"./index-BSaHX2oa.js";import{_ as V}from"./DataGrid-DbeHIyBR.js";const A={style:{height:"250px"}},M={__name:"consultationEcriture",props:{show:{type:Boolean,default:!1},id_ecriture:{type:[String,Number],required:!0}},emits:["close"],setup(i,{emit:p}){const{showError:h}=B(),t=i,_=p,o=a(t.show),n=a(!1),l=a([]),b=a(),c=async()=>{if(!t.id_ecriture)return;n.value=!0;const s=`${f.lienApi}/uneEcriture/${f.db}/${t.id_ecriture}`;try{const e=await N.post(s);l.value=e.data}catch(e){const r=e.response?.data?.message||e.message;h(`Une erreur est survenue : ${r}`)}finally{n.value=!1}},u=()=>{o.value=!1,_("close")};return g(()=>t.show,s=>{o.value=s,s&&c()}),x(()=>{t.show&&c()}),(s,e)=>{const r=$,v=k;return y(),C(v,{visible:o.value,"onUpdate:visible":e[0]||(e[0]=w=>o.value=w),modal:"",header:`Consultation écriture N° ${i.id_ecriture}`,style:{width:"70vw"},onHide:u},{footer:d(()=>[m(r,{label:"Fermer",icon:"pi pi-times",onClick:u})]),default:d(()=>[D("div",A,[m(V,{ref_key:"dataGrid",ref:b,"excel-file-name":"Consultation ecriture","excel-sheet-name":"Consultation ecriture","row-data":l.value,"numeric-columns":["Débit","Crédit","% TVA"],"totals-columns":["Débit","Crédit"],"excluded-columns":[],"column-widths":{Date:100,Compte:100,"Pièce N°":100,Référence:120,Libellé:260,"% TVA":90,Débit:100,Crédit:100},"enable-totals":!0,"date-only":["Date"],"show-checkbox":!1,"enable-filter":!1},null,8,["row-data"])])]),_:1},8,["visible","header"])}}};export{M as _};
