import{m as w,b as l,p as _}from"./primevue-CfIk0_DY.js";import{_ as y}from"./index-BxIwIJfy.js";import{D as p,a as k,b as a,c as d,d as i,q as c,p as s,t as g,j as u,k as m,a7 as r,v as h,e as C}from"./vue-core-Di3IuVqe.js";const b={class:"widget-card__header"},B={class:"widget-card__title"},S={class:"widget-card__actions"},$={class:"widget-card__body"},W={key:0,class:"widget-card__error"},x={key:1,class:"widget-card__loading"},z={key:0,class:"widget-card__drag-handle"},D={__name:"WidgetCard",props:{title:{type:String,required:!0},icon:{type:String,default:""},loading:{type:Boolean,default:!1},error:{type:String,default:""},editing:{type:Boolean,default:!1}},emits:["refresh","remove"],setup(e){const f=p("dashboardCanRemoveWidget",k(!0));return(n,t)=>{const o=w;return a(),d("div",{class:c(["widget-card",{"widget-card--editing":e.editing}])},[i("div",b,[i("div",B,[e.icon?(a(),d("i",{key:0,class:c(["widget-card__icon",e.icon])},null,2)):s("",!0),i("span",null,g(e.title),1)]),i("div",S,[e.editing?s("",!0):u((a(),m(r(l),{key:0,text:"",rounded:"",size:"small",icon:"pi pi-refresh",loading:e.loading,class:"widget-card__action-btn",onClick:t[0]||(t[0]=v=>n.$emit("refresh"))},null,8,["loading"])),[[o,"Rafraîchir",void 0,{left:!0}]]),e.editing&&r(f)?u((a(),m(r(l),{key:1,text:"",rounded:"",size:"small",icon:"pi pi-times",severity:"danger",class:"widget-card__action-btn",onClick:t[1]||(t[1]=v=>n.$emit("remove"))},null,512)),[[o,"Supprimer ce widget",void 0,{left:!0}]]):s("",!0)])]),i("div",$,[e.error?(a(),d("div",W,[t[2]||(t[2]=i("i",{class:"pi pi-exclamation-triangle"},null,-1)),i("span",null,g(e.error),1)])):e.loading?(a(),d("div",x,[h(r(_),{width:"80%",height:"2rem"})])):C(n.$slots,"default",{key:2},void 0,!0)]),e.editing?(a(),d("div",z,[...t[3]||(t[3]=[i("i",{class:"pi pi-arrows-alt"},null,-1)])])):s("",!0)],2)}}},j=y(D,[["__scopeId","data-v-4f744130"]]);export{j as W};
