import{W as l}from"./WidgetChart-CQnj_aQq.js";import{b as d,k as p,y as m}from"./vue-core-Di3IuVqe.js";import"./WidgetCard-CLnTgmXL.js";import"./primevue-CfIk0_DY.js";import"./index-BxIwIJfy.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";const k={__name:"WidgetNombreEcritures",props:{data:{type:[Array,Object,null],default:null},loading:{type:Boolean,default:!1},error:{type:String,default:""},editing:{type:Boolean,default:!1}},emits:["refresh","remove"],setup(t){const a=t,o={Achats:"#f59e0b",Ventes:"#10b981",Divers:"#9ca3af",Tresorerie:"#3b82f6"},i=m(()=>{const r=Array.isArray(a.data)?a.data:[];return{labels:r.map(e=>e.lib_journal||""),datasets:[{label:"Écritures",data:r.map(e=>e.nb||0),backgroundColor:r.map(e=>o[e.lib_journal]||"#6366f1"),borderWidth:0}]}}),n={plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{font:{size:10}}},y:{beginAtZero:!0,ticks:{font:{size:10}}}}};return(r,e)=>(d(),p(l,{title:"Écritures par journal",icon:"pi pi-chart-bar",type:"bar","chart-data":i.value,options:n,loading:t.loading,error:t.error,editing:t.editing,onRefresh:e[0]||(e[0]=s=>r.$emit("refresh")),onRemove:e[1]||(e[1]=s=>r.$emit("remove"))},null,8,["chart-data","loading","error","editing"]))}};export{k as default};
