import{b as g,f as x}from"./primevue-CfIk0_DY.js";import{u as y,s as d,b as C}from"./index-BxIwIJfy.js";import{D}from"./DataGrid-CoMfrBJA.js";import{a as r,w as k,o as $,b as B,k as N,l as m,d as V,v as f}from"./vue-core-Di3IuVqe.js";const A={style:{height:"250px"}},T={__name:"consultationEcriture",props:{show:{type:Boolean,default:!1},id_ecriture:{type:[String,Number],required:!0}},emits:["close"],setup(i,{emit:p}){const{showError:h}=y(),t=i,b=p,o=r(t.show),n=r(!1),l=r([]),v=r(),c=async()=>{if(!t.id_ecriture)return;n.value=!0;const s=`${d.lienApi}/uneEcriture/${d.db}/${t.id_ecriture}`;try{const e=await C.post(s);l.value=e.data}catch(e){const a=e.response?.data?.message||e.message;h(`Une erreur est survenue : ${a}`)}finally{n.value=!1}},u=()=>{o.value=!1,b("close")};return k(()=>t.show,s=>{o.value=s,s&&c()}),$(()=>{t.show&&c()}),(s,e)=>{const a=g,_=x;return B(),N(_,{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:m(()=>[f(a,{label:"Fermer",icon:"pi pi-times",onClick:u})]),default:m(()=>[V("div",A,[f(D,{ref_key:"dataGrid",ref:v,"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{T as _};
