import{u as G,s as n,S as P,g as q,h as r}from"./index-BSaHX2oa.js";import{_ as E}from"./ComboDynamique-DbhbUtR4.js";import{r as a,f as J,g as W,o as V,c as F,b as l,a as s,z as j,q as H,av as K,d as O,M as Q,F as X}from"./vendor-BDR7yMJi.js";const Y={class:"flex flex-row justify-start gap-2"},Z={key:0},ee={class:"mt-4 bg-white p-4 border border-gray-300 shadow-md"},le={class:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4"},te={class:"mb-3"},oe={class:"p-float-label"},ae={class:"mb-3"},se={class:"p-float-label"},ne={class:"mb-3"},re={class:"p-float-label"},ie={class:"mb-3"},ue={class:"p-float-label"},de={class:"mb-3"},me={class:"p-float-label"},ce={class:"mb-3"},pe={class:"p-float-label"},fe={class:"mb-3"},ve={class:"p-float-label"},ge={style:"height: calc(100vh - 320px)",class:"mt-3"},we={__name:"balanceReporting",setup(be){const{showError:x,showWarn:y,showInfo:f}=G(),v=a(),z=a(),d=a(),i=a([]),S=a(null),g=a(""),b=a(""),C=a(""),_=a(""),m=a(n.state.dossier.dated),c=a(n.state.dossier.datef),h=a({}),M=a(!1),T=a([{field:"Compte",headerName:"Compte",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,checkboxSelection:!0,headerCheckboxSelection:!1},{field:"Libellé",headerName:"Libellé",width:200,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"Mvt. Debit",headerName:"Mvt. Debit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?r(t.value):"",aggFunc:"sum"},{field:"Mvt. Credit",headerName:"Mvt. Credit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?r(t.value):"",aggFunc:"sum"},{field:"Solde debit",headerName:"Solde Debit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?r(t.value):"",aggFunc:"sum"},{field:"solde credit",headerName:"Solde Credit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?r(t.value):"",aggFunc:"sum"},{field:"Budget",headerName:"Budget",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?r(t.value):"",aggFunc:"sum"}]),k=a({width:200,minWidth:80,resizable:!0,sortable:!0,filter:"agTextColumnFilter",suppressHeaderMenuButton:!0}),N=a({mode:"singleRow",checkboxes:!0,enableClickSelection:!1}),A=a({statusPanels:[{statusPanel:"agTotalAndFilteredRowCountComponent",align:"left"},{statusPanel:"agAggregationComponent",align:"right"}]}),B=t=>{d.value=t.api,setTimeout(()=>{d.value&&d.value.sizeColumnsToFit()},100)},L=t=>{const e=t.api.getSelectedNodes();e&&e.length>0&&(S.value=e[0].data)};J(async()=>{m.value=new Date(n.state.dossier.dated||new Date),c.value=new Date(n.state.dossier.datef||new Date),await w()});const w=async()=>{try{n.state.afficher_in_progress=!0,i.value=[{id:1,Compte:"411000",Libellé:"Clients","Mvt. Debit":15e3,"Mvt. Credit":12e3,"Solde debit":3e3,"solde credit":0,Budget:2e4},{id:2,Compte:"601000",Libellé:"Achats de matières premières","Mvt. Debit":8e3,"Mvt. Credit":0,"Solde debit":8e3,"solde credit":0,Budget:1e4}],i.value.length===0?f("Aucune donnée trouvée pour les critères sélectionnés"):f("Les données ont été chargées avec succès")}catch(t){x(`Une erreur est survenue lors du chargement des données
 ${t}`)}finally{n.state.afficher_in_progress=!1}},I=()=>{if(i.value.length===0){y("Aucune donnée à imprimer");return}};return(t,e)=>{const p=j,R=K,u=Q,U=E,D=q,$=W("ag-grid-vue");return V(),F(X,null,[e[17]||(e[17]=l("div",{class:"btns flex items-center gap-2"},null,-1)),l("div",null,[l("div",Y,[s(p,{text:"",icon:"pi pi-refresh",label:"Afficher",onClick:e[0]||(e[0]=o=>w())}),M.value?O("",!0):(V(),F("div",Z,[s(p,{text:"",icon:"pi pi-cog",label:"Actions",onClick:e[1]||(e[1]=o=>v.value.toggle(o))}),s(p,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[2]||(e[2]=o=>H(P)("balanceReporting"))}),s(R,{ref_key:"actionsMenu",ref:v,model:[{label:"Imprimer",icon:"pi pi-print",command:()=>I()}],popup:!0},null,8,["model"])]))]),l("div",ee,[l("div",le,[l("div",null,[l("div",te,[l("span",oe,[e[10]||(e[10]=l("label",{for:"compte_de"},"Compte de",-1)),s(u,{size:"small",modelValue:g.value,"onUpdate:modelValue":e[3]||(e[3]=o=>g.value=o),inputId:"compte_de"},null,8,["modelValue"])])]),l("div",ae,[l("span",se,[e[11]||(e[11]=l("label",{for:"compte_a"},"Compte à",-1)),s(u,{size:"small",modelValue:b.value,"onUpdate:modelValue":e[4]||(e[4]=o=>b.value=o),inputId:"compte_a"},null,8,["modelValue"])])]),l("div",ne,[l("span",re,[e[12]||(e[12]=l("label",{for:"comptes"},"Comptes",-1)),s(U,{modelValue:h.value.CodeJournal,"onUpdate:modelValue":e[5]||(e[5]=o=>h.value.CodeJournal=o),inputId:"comptes",placeholder:"Comptes"},null,8,["modelValue"])])])]),l("div",null,[l("div",ie,[l("span",ue,[e[13]||(e[13]=l("label",{for:"libelle_compte_de"},"Libellé Compte de",-1)),s(u,{size:"small",modelValue:C.value,"onUpdate:modelValue":e[6]||(e[6]=o=>C.value=o),inputId:"libelle_compte_de"},null,8,["modelValue"])])]),l("div",de,[l("span",me,[e[14]||(e[14]=l("label",{for:"libelle_compte_a"},"Libellé Compte à",-1)),s(u,{size:"small",modelValue:_.value,"onUpdate:modelValue":e[7]||(e[7]=o=>_.value=o),inputId:"libelle_compte_a"},null,8,["modelValue"])])])]),l("div",null,[l("div",ce,[l("span",pe,[e[15]||(e[15]=l("label",{for:"date_du"},"Du",-1)),s(D,{size:"small",modelValue:m.value,"onUpdate:modelValue":e[8]||(e[8]=o=>m.value=o)},null,8,["modelValue"])])]),l("div",fe,[l("span",ve,[e[16]||(e[16]=l("label",{for:"date_au"},"Au",-1)),s(D,{size:"small",modelValue:c.value,"onUpdate:modelValue":e[9]||(e[9]=o=>c.value=o)},null,8,["modelValue"])])])])]),l("div",ge,[s($,{ref_key:"agGrid",ref:z,class:"ag-theme-quartz h-full",localeText:t.$agGridLocale,columnDefs:T.value,rowData:i.value,defaultColDef:k.value,theme:t.$agGridTheme,rowSelection:N.value,suppressRowClickSelection:!0,statusBar:A.value,onGridReady:B,onSelectionChanged:L},null,8,["localeText","columnDefs","rowData","defaultColDef","theme","rowSelection","statusBar"])])])])],64)}}};export{we as default};
