import{f as T,g as M,an as N,ap as L,q as a,o as d,c as m,b as s,a as r,z as V,av as B,d as $,r as o}from"./vendor-0kGcmQpG.js";import{u as I,s as f,S as R,h as g}from"./index-Bn9WoKhP.js";const G={class:"flex flex-row justify-start gap-2"},z={key:0},q={style:"height: calc(100vh - 200px)",class:"mt-3"},W={__name:"situationAgence",setup(E){const{showError:p,showWarn:h,showInfo:v}=I(),u=o(),C=o();let l=o([]),_=o(!1),x=o(!1);const b=o(null),y=o([{field:"Code",headerName:"Code",sortable:!0,filter:"agTextColumnFilter"},{field:"Libellé",headerName:"Libellé",sortable:!0,filter:"agTextColumnFilter"},{field:"test",headerName:"test",sortable:!0,filter:"agTextColumnFilter",type:"numericColumn",headerClass:"numeric-header-custom",cellStyle:{textAlign:"right"},valueFormatter:e=>e.value?g(e.value):"",aggFunc:"sum"},{field:"Vide",headerName:"Vide",sortable:!0,filter:"agTextColumnFilter",type:"numericColumn",headerClass:"numeric-header-custom",cellStyle:{textAlign:"right"},valueFormatter:e=>e.value?g(e.value):"",aggFunc:"sum"}]),w=o({resizable:!0,sortable:!0,filter:"agTextColumnFilter",suppressHeaderMenuButton:!0}),D=e=>{const t=e.api.getSelectedRows();b.value=t.length>0?t[0]:null},S=()=>["copy","copyWithHeaders","separator","export"];T(async()=>{await c()});const c=async()=>{try{f.state.afficher_in_progress=!0,l.value=[{id:1,Code:"101",Libellé:"Produit A",test:150.5,Vide:0},{id:2,Code:"102",Libellé:"Produit B",test:75.25,Vide:10.5}],l.value.length===0&&v({title:"Information",text:"Aucune donnée trouvée"})}catch(e){p(`Une erreur est survenue lors du chargement des données ${e}`)}finally{f.state.afficher_in_progress=!1}},F=()=>{if(l.value.length===0){h("Aucune donnée à imprimer");return}};return(e,t)=>{const n=V,k=B,A=M("ag-grid-vue");return N((d(),m("div",null,[s("div",G,[r(n,{text:"",icon:"pi pi-refresh",label:"Afficher",onClick:t[0]||(t[0]=i=>c())}),a(_)?$("",!0):(d(),m("div",z,[r(n,{text:"",icon:"pi pi-cog",label:"Actions",onClick:t[1]||(t[1]=i=>u.value.toggle(i))}),r(n,{icon:"pi pi-times",label:"Fermer",text:"",onClick:t[2]||(t[2]=i=>a(R)("situationAgence"))}),r(k,{ref_key:"actionsMenu",ref:u,model:[{label:"Imprimer",icon:"pi pi-print",command:()=>F()}],popup:!0},null,8,["model"])]))]),s("div",null,[s("div",q,[r(A,{ref_key:"agGrid",ref:C,rowData:a(l),columnDefs:y.value,defaultColDef:w.value,theme:e.$agGridTheme,localeText:e.$agGridLocale,rowSelection:"single",suppressRowClickSelection:!1,enableRangeSelection:!0,animateRows:!0,pagination:!1,domLayout:"normal",getContextMenuItems:S,onSelectionChanged:D,class:"ag-theme-quartz",style:{height:"100%",width:"100%"}},null,8,["rowData","columnDefs","defaultColDef","theme","localeText"])])])],512)),[[L,!a(x)]])}}};export{W as default};
