import{W as s}from"./WidgetChart-CQnj_aQq.js";import{b as l,k as d,y as p}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:"WidgetCAVsObjectif",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=p(()=>{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!=="annee");return{labels:t,datasets:[{type:"bar",label:"CA "+String(e[0].annee??""),data:t.map(r=>e[0][r]||0),backgroundColor:"#3b82f6",borderWidth:0},...e[1]?[{type:"line",label:"Objectif",data:t.map(r=>e[1][r]||0),borderColor:"#ef4444",backgroundColor:"#ef4444",borderWidth:3,tension:.4,pointRadius:4}]:[]]}}),n={scales:{x:{grid:{display:!1},ticks:{font:{size:10}}},y:{beginAtZero:!0,ticks:{font:{size:10}}}}};return(e,t)=>(l(),d(s,{title:"CA vs objectif",icon:"pi pi-chart-bar",type:"bar","chart-data":i.value,options:n,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{k as default};
