import{b as j,B}from"./primevue-CfIk0_DY.js";import{o as D,j as c,H as m,b as o,c as M,d as a,v as _,l as V,q as z,t as A,k as u,a7 as E,p as I,s as T,am as $,E as N,y as d,a as v,aa as R}from"./vue-core-Di3IuVqe.js";import{_ as F,u as q,S as h,b as H,s as r}from"./index-BxIwIJfy.js";import K from"./Saisieachats-DYkJAwYm.js";import O from"./Saisieventes-D6Lhub6G.js";import P from"./Saisieencaissements-C9DM9qoD.js";import U from"./SaisieReglements-C8Tkhkk_.js";import W from"./Saisiefrais-CucvkWDe.js";import G from"./SaisieStandard-BbNvvI-a.js";import"./cjs-helpers-psZwOBky.js";import"./vue-cal-DKMVGERa.js";import"./moment-BeHQNF8T.js";import"./ComboDynamique-BzWI4ISP.js";import"./SaisieAchatsLignes-BJI4n47y.js";import"./PiecesJointes-BcNdv7mw.js";import"./useLienFichier-BJZ-0upj.js";import"./usePagerDetail-BeqYPv-1.js";import"./consultationEcriture-CT7gej5D.js";import"./DataGrid-CoMfrBJA.js";import"./useAgGridConfig-Dp3DkgaV.js";import"./InfoBulle-R_p1ZfIR.js";import"./useAgenceSaisie-nJ4Jm3jq.js";import"./useTauxChange-OeHHIphk.js";import"./useAutoPiecesJointes-D0rPgWqP.js";import"./ImportFacturesAchats-BPKfD4uG.js";import"./ComboCompteCellule-B7ObiNq-.js";import"./SaisieVentesLignes-CwIEBreq.js";import"./ExcelImportDialog-C-8kz2ek.js";import"./export-files-DFMiSRgA.js";import"./SaisieencaissementsLignes-CXlDxxxI.js";import"./SaisieReglementsLignes-C4MtkrqR.js";import"./SaisiefraisLignes-Did8UXe6.js";import"./useGridContextFilter-D02dkIUR.js";const J={class:"flex flex-col h-full"},L={class:"flex items-center flex-wrap px-2 py-2",style:{gap:"8px"}},Q={style:{"font-weight":"600",flex:"1","text-align":"left"}},X={style:{width:"1px",height:"24px","background-color":"#e2e8f0"}},Y={id:"actions-saisie-comptable",class:"flex flex-wrap",style:{gap:"4px"}},Z={class:"flex-1 overflow-auto"},ee={__name:"SaisieComptable",setup(te){const{showWarn:x,showError:y}=q(),i=N({lecture:!1,ajout:!1}),S=async()=>{try{const t=(await H.post(`${r.lienApi}/verifierDroit/${r.state.dbCommun6}`,{id_utilisateur:r.userId,id_page:2101,mail:r.state.userCloud.mail},{headers:{"Content-Type":"application/json"}})).data;t&&Object.keys(t).length>0&&(i.lecture=t.lecture,i.ajout=t.ajout),i.lecture||(x("Vous n'avez pas le droit, veuillez consulter l'administrateur"),h("SaisieComptable"))}catch(e){y("Une erreur est survenue : "+(e.response?.data?.message||e.message))}};D(async()=>{await S()});const s=v(!1);R("enSaisie",s);const l=[{value:"achats",label:"Achats",icon:"pi pi-shopping-cart",component:K},{value:"ventes",label:"Ventes",icon:"pi pi-tag",component:O},{value:"encaissements",label:"Encaissements",icon:"pi pi-wallet",component:P},{value:"reglements",label:"Reglements",icon:"pi pi-credit-card",component:U},{value:"frais",label:"Frais",icon:"pi pi-receipt",component:W},{value:"divers",label:"Divers",icon:"pi pi-pencil",component:G}],n=v("achats"),p=d(()=>l.find(e=>e.value===n.value)||l[0]),C=d(()=>p.value.component),f=v(),w=d(()=>l.map(e=>({label:e.label,icon:e.icon,class:e.value===n.value?"chip-categorie-item-active":"",command:()=>{n.value=e.value}})));return(e,t)=>{const g=j,k=B;return c((o(),M("div",J,[a("div",L,[_(g,{disabled:s.value,onClick:t[0]||(t[0]=b=>f.value.toggle(b)),class:"chip-categorie-saisie"},{default:V(()=>[a("i",{class:z(p.value.icon),style:{"margin-right":"8px"}},null,2),a("span",Q,A(p.value.label),1),t[2]||(t[2]=a("i",{class:"pi pi-chevron-down",style:{"margin-left":"10px","font-size":"0.85em",opacity:"0.85"}},null,-1))]),_:1},8,["disabled"]),_(k,{ref_key:"categorieMenu",ref:f,model:w.value,popup:!0},null,8,["model"]),c(a("div",X,null,512),[[m,!s.value]]),c(a("div",Y,null,512),[[m,!s.value]]),s.value?I("",!0):(o(),u(g,{key:0,icon:"pi pi-times",label:"Fermer",text:"",onClick:t[1]||(t[1]=b=>E(h)("SaisieComptable"))}))]),a("div",Z,[(o(),u($,null,[(o(),u(T(C.value),{fermerParRetour:!0}))],1024))])],512)),[[m,i.lecture]])}}},Te=F(ee,[["__scopeId","data-v-6a1ff8a3"]]);export{Te as default};
