import{W as m}from"./WidgetChart-CQnj_aQq.js";import{b as p,k as f,y as c}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 B={__name:"WidgetFraisAchatsMensuel",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(a){const o=a,i=["#6366f1","#10b981","#f59e0b","#ef4444"],n=c(()=>{const e=Array.isArray(o.data)?o.data:[];if(e.length===0||!e[0])return{labels:[],datasets:[]};const t=Object.keys(e[0]).filter(r=>r!=="element");return{labels:t,datasets:e.map((r,l)=>({label:String(r.element??""),data:t.map(d=>r[d]||0),backgroundColor:i[l%i.length],borderWidth:0}))}}),s={scales:{x:{grid:{display:!1},ticks:{font:{size:10}}},y:{beginAtZero:!0,ticks:{font:{size:10}}}}};return(e,t)=>(p(),f(m,{title:"Frais d'achats mensuels",icon:"pi pi-chart-bar",type:"bar","chart-data":n.value,options:s,loading:a.loading,error:a.error,editing:a.editing,onRefresh:t[0]||(t[0]=r=>e.$emit("refresh")),onRemove:t[1]||(t[1]=r=>e.$emit("remove"))},null,8,["chart-data","loading","error","editing"]))}};export{B as default};
