import{u as J,s as i,S as G,g as $,k as j,h as u}from"./index-Bn9WoKhP.js";import{_ as q}from"./ComboDynamique-CzrtYPe1.js";import{r as s,f as H,g as W,o as K,c as O,b as l,a,z as Q,av as X,q as Y,M as Z,e as ee}from"./vendor-0kGcmQpG.js";const le={class:"w-full flex flex-col overflow-hidden overflow-y-auto gap-2",style:{height:"calc(100vh - 108px)"}},te={class:"flex min-w-full flex-col lg:flex-row lg:items-center gap-2 p-1"},oe={class:"btns flex items-center gap-2 lg:w-1/4 lg:justify-start lg:ml-0"},se={class:"bg-white p-4 border border-gray-300 shadow-md rounded"},ae={class:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-4"},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"},pe={class:"mb-3"},ce={class:"p-float-label"},fe={class:"mb-3"},be={class:"p-float-label"},ve={class:"mb-3"},ge={class:"p-float-label"},_e={class:"mb-3"},we={class:"p-float-label"},Ce={class:"mb-3"},Ve={class:"p-float-label"},he={class:"mb-3"},De={class:"p-float-label"},xe={class:"mb-3"},Fe={class:"p-float-label"},ze={class:"mb-3"},Le={class:"p-float-label"},ye={class:"flex flex-row justify-start gap-3"},Ne={class:"w-1/2"},Re={class:"p-float-label"},Se={class:"w-1/2"},Te={class:"p-float-label"},Ie={class:"ag-theme-quartz",style:{height:"100%",width:"100%"}},Me={__name:"grandLivreReporting",setup(ke){const{showError:y,showWarn:N}=J(),f=s(),R=s(),b=s(),v=s([]),g=s(null),S=ee(()=>[{label:"Imprimer",icon:"pi pi-print",command:()=>M()}]),r=s({}),_=s(""),w=s(""),C=s(""),V=s(""),d=s(i.state.dossier.dated),m=s(i.state.dossier.datef),h=s(""),D=s(""),x=s(""),F=s(""),T=s([{field:"Date",headerName:"Date",width:100,sortable:!0,filter:"agTextColumnFilter",resizable:!0,valueFormatter:t=>t.value?j(t.value):""},{field:"Journal",headerName:"Journal",width:80,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"Let",headerName:"Let",width:60,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"Reference",headerName:"Reference",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"NPièce",headerName:"N° Pièce",width:100,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"Libellé",headerName:"Libellé",width:200,sortable:!0,filter:"agTextColumnFilter",resizable:!0},{field:"Debit",headerName:"Debit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?u(t.value):"",aggFunc:"sum"},{field:"Credit",headerName:"Credit",width:120,sortable:!0,filter:"agTextColumnFilter",resizable:!0,cellClass:"ag-currency-cell",valueFormatter:t=>t.value!=null?u(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?u(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?u(t.value):"",aggFunc:"sum"}]),I=s({width:200,minWidth:80,resizable:!0,sortable:!0,filter:"agTextColumnFilter",suppressHeaderMenuButton:!0}),k=s({mode:"singleRow",checkboxes:!1,enableClickSelection:!1}),U=t=>{b.value=t.api,t.api.sizeColumnsToFit()},A=()=>{const t=b.value?.getSelectedNodes();t&&t.length>0&&(g.value=t[0].data)},E=t=>{const e=t.api.getSelectedRows();g.value=e.length>0?e[0]:null,A()};H(async()=>{d.value=new Date(i.state.dossier.dated||new Date),m.value=new Date(i.state.dossier.datef||new Date),await z()});const z=async()=>{try{i.state.afficher_in_progress=!0,v.value=[{id:1,Date:"2025-05-15",Journal:"ACH",Let:"A",Reference:"FA123",NPièce:"P001",Libellé:"Achat fournitures",Debit:1500,Credit:0,"Solde debit":1500,"solde credit":0},{id:2,Date:"2025-05-16",Journal:"VTE",Let:"B",Reference:"FV456",NPièce:"P002",Libellé:"Vente produits",Debit:0,Credit:2e3,"Solde debit":0,"solde credit":2e3}]}catch(t){y(`Une erreur est survenue lors du chargement des données.
 ${t}`)}finally{i.state.afficher_in_progress=!1}},M=()=>{if(v.value.length===0){N("Aucune donnée à imprimer");return}};return(t,e)=>{const p=Q,B=X,n=Z,c=q,L=$,P=W("ag-grid-vue");return K(),O("div",le,[l("div",te,[l("div",oe,[a(p,{text:"",icon:"pi pi-refresh",label:"Afficher",onClick:e[0]||(e[0]=o=>z())}),a(B,{ref_key:"actionsMenu",ref:f,popup:!0,model:S.value},null,8,["model"]),a(p,{icon:"pi pi-cog",label:"Actions",text:"",onClick:e[1]||(e[1]=o=>f.value.toggle(o))}),a(p,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[2]||(e[2]=o=>Y(G)("grandLivreReporting"))})]),e[16]||(e[16]=l("div",{class:"w-full lg:w-2/4 flex justify-center px-4"},[l("h2",{class:"font-bold text-xl text-center"},"Grand livre de reporting")],-1)),e[17]||(e[17]=l("div",{class:"flex items-center gap-3 lg:w-1/4 lg:justify-end whitespace-nowrap"},null,-1))]),e[31]||(e[31]=l("div",{class:"h-2"},null,-1)),l("div",se,[l("div",ae,[l("div",null,[l("div",ne,[l("span",re,[e[18]||(e[18]=l("label",{for:"compte_de"},"Compte de",-1)),a(n,{size:"small",modelValue:_.value,"onUpdate:modelValue":e[3]||(e[3]=o=>_.value=o),inputId:"compte_de"},null,8,["modelValue"])])]),l("div",ie,[l("span",ue,[e[19]||(e[19]=l("label",{for:"compte_a"},"Compte à",-1)),a(n,{size:"small",modelValue:w.value,"onUpdate:modelValue":e[4]||(e[4]=o=>w.value=o),inputId:"compte_a"},null,8,["modelValue"])])]),l("div",de,[l("span",me,[e[20]||(e[20]=l("label",{for:"journal"},"Journal",-1)),a(c,{modelValue:r.value.Journal,"onUpdate:modelValue":e[5]||(e[5]=o=>r.value.Journal=o),inputId:"journal",placeholder:"Journal"},null,8,["modelValue"])])])]),l("div",null,[l("div",pe,[l("span",ce,[e[21]||(e[21]=l("label",{for:"libelle_compte_de"},"Libellé compte de",-1)),a(n,{size:"small",modelValue:C.value,"onUpdate:modelValue":e[6]||(e[6]=o=>C.value=o),inputId:"libelle_compte_de"},null,8,["modelValue"])])]),l("div",fe,[l("span",be,[e[22]||(e[22]=l("label",{for:"libelle_compte_a"},"Libellé compte à",-1)),a(n,{size:"small",modelValue:V.value,"onUpdate:modelValue":e[7]||(e[7]=o=>V.value=o),inputId:"libelle_compte_a"},null,8,["modelValue"])])]),l("div",ve,[l("span",ge,[e[23]||(e[23]=l("label",{for:"ecritures_lettrees"},"Ecriture Lettrées",-1)),a(c,{modelValue:r.value.EcritureLettrées,"onUpdate:modelValue":e[8]||(e[8]=o=>r.value.EcritureLettrées=o),inputId:"ecritures_lettrees",placeholder:"Ecriture Lettrées"},null,8,["modelValue"])])])]),l("div",null,[l("div",_e,[l("span",we,[e[24]||(e[24]=l("label",{for:"date_du"},"Du",-1)),a(L,{size:"small",modelValue:d.value,"onUpdate:modelValue":e[9]||(e[9]=o=>d.value=o)},null,8,["modelValue"])])]),l("div",Ce,[l("span",Ve,[e[25]||(e[25]=l("label",{for:"date_au"},"Au",-1)),a(L,{size:"small",modelValue:m.value,"onUpdate:modelValue":e[10]||(e[10]=o=>m.value=o)},null,8,["modelValue"])])]),l("div",he,[l("span",De,[e[26]||(e[26]=l("label",{for:"libelle_contient"},"Libellé d'écriture contient...",-1)),a(n,{size:"small",modelValue:h.value,"onUpdate:modelValue":e[11]||(e[11]=o=>h.value=o),inputId:"libelle_contient"},null,8,["modelValue"])])])]),l("div",null,[l("div",xe,[l("span",Fe,[e[27]||(e[27]=l("label",{for:"numero_piece"},"N° Pièce",-1)),a(n,{size:"small",modelValue:x.value,"onUpdate:modelValue":e[12]||(e[12]=o=>x.value=o),inputId:"numero_piece"},null,8,["modelValue"])])]),l("div",ze,[l("span",Le,[e[28]||(e[28]=l("label",{for:"numero_facture"},"N° Facture",-1)),a(n,{size:"small",modelValue:F.value,"onUpdate:modelValue":e[13]||(e[13]=o=>F.value=o),inputId:"numero_facture"},null,8,["modelValue"])])]),l("div",ye,[l("div",Ne,[l("span",Re,[e[29]||(e[29]=l("label",{for:"ecritures_lettrees_2"},"Ecriture Lettrées",-1)),a(c,{modelValue:r.value.EcritureLettrées,"onUpdate:modelValue":e[14]||(e[14]=o=>r.value.EcritureLettrées=o),inputId:"ecritures_lettrees_2",placeholder:"Ecriture Lettrées"},null,8,["modelValue"])])]),l("div",Se,[l("span",Te,[e[30]||(e[30]=l("label",{for:"libelle_contient_2"},"Libellé contient...",-1)),a(n,{size:"small",modelValue:D.value,"onUpdate:modelValue":e[15]||(e[15]=o=>D.value=o),inputId:"libelle_contient_2"},null,8,["modelValue"])])])])])])]),l("div",null,[l("div",Ie,[a(P,{ref_key:"agGrid",ref:R,localeText:t.$agGridLocale,rowData:t.dataListe,columnDefs:T.value,defaultColDef:I.value,theme:t.$agGridTheme,rowSelection:k.value,suppressRowClickSelection:!1,pinnedBottomRowData:t.pinnedBottomRowData,getContextMenuItems:t.getContextMenuItems,onGridReady:U,onRowClicked:t.onRowClick,onSelectionChanged:E,onFilterChanged:t.onFilterChanged,onSortChanged:t.onFilterChanged,class:"ag-theme-quartz",style:{height:"100%",width:"100%"}},null,8,["localeText","rowData","columnDefs","defaultColDef","theme","rowSelection","pinnedBottomRowData","getContextMenuItems","onRowClicked","onFilterChanged","onSortChanged"])])])])}}};export{Me as default};
