import{w as Ie,f as Le,af as Me,o as c,c as x,b as l,F as oe,A as He,a as n,z as Ge,q as s,an as M,ap as H,i as _,d as p,aS as Ne,M as Oe,j as z,S as Be,G as K,E as re,B as ne,aP as de,h as q,r as u,ar as Ke,e as Q,bg as qe}from"./vendor-0kGcmQpG.js";import{_ as Qe}from"./ComboDynamique-CzrtYPe1.js";import{u as We,a as V,s as o,S as Je,g as Xe,f as Ye}from"./index-Bn9WoKhP.js";import{_ as W}from"./DataGrid-tb6QVwpZ.js";import Ze from"./PiecesJointes-Dkmk2u4H.js";import el from"./TVAdeductibleachats-D75rZGRK.js";import ll from"./Tvacollecteventes-DJvnt4UT.js";import"./useAgGridConfig-DjXMc6wb.js";const al={class:"flex flex-col h-full"},tl={class:"flex items-center bg-white px-2 py-2 gap-3"},il={class:"flex gap-1"},sl={class:"flex-1 overflow-hidden"},ol={class:"flex flex-col"},rl={class:"w-full flex flex-wrap items-start md:flex-row justify-start gap-3 p-1"},nl={style:{height:"calc(100vh - 200px)"}},dl={key:0},cl={class:"flex h-full"},ul={class:"flex-1 bg-white"},pl={class:"w-full flex flex-wrap items-start md:flex-row justify-start gap-3"},fl={class:"ml-auto mr-3"},ml={class:"w-full pb-3 flex flex-row items-center justify-start gap-3 pt-2 ml-2"},vl={class:"w-full bg-white p-3 h-[calc(100vh-180px)] overflow-auto relative"},bl={class:"flex flex-col gap-4"},gl={class:"grid grid-cols-2 lg:grid-cols-4 gap-4"},_l={class:"field"},Vl={class:"field"},yl={class:"field"},wl={class:"field"},xl={class:"grid grid-cols-2 lg:grid-cols-4 gap-4"},Al={class:"field"},Tl={class:"field"},kl={class:"field"},Cl={class:"field"},$l={class:"grid grid-cols-2 lg:grid-cols-4 gap-4"},hl={class:"field"},Dl={class:"field"},Sl={class:"field"},zl={class:"field"},Rl={key:0,class:"filigrane-texte"},Ul={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},Fl={style:{height:"250px"}},El={style:{height:"250px"}},Pl={key:0,class:"w-1/2 bg-white border-l"},jl={class:"h-full"},Il={class:"h-full"},Ll={class:"flex flex-col items-center gap-4 p-2"},Ml={class:"w-full"},Hl={class:"flex items-center gap-2 mb-2"},Gl={key:0,class:"w-full bg-gray-200 rounded-full h-1.5"},Nl={key:0,class:"w-full flex justify-center"},Ol=["src"],Bl={key:1,class:"w-full flex flex-col gap-2"},Kl={class:"flex gap-2"},ql={key:2,class:"w-full flex flex-col gap-2"},Ql={class:"flex gap-2"},Wl={key:3,class:"w-full text-center"},Jl={key:4,class:"w-full text-center"},Xl={class:"text-red-600 font-semibold"},na={__name:"DeclarationTVA",setup(Yl){const{showError:w,showWarn:g,confirmAction:E,showSuccess:$}=We(),ce=[{value:"declaration",label:"Déclaration",icon:"pi pi-file"},{value:"deductible",label:"TVA déductible",icon:"pi pi-arrow-down"},{value:"collectee",label:"TVA collectée",icon:"pi pi-arrow-up"}],D=u("declaration");let i=u({});const J=u([]);let m=u(!1),h=u(!1);const G=u(null);let v=u(!1);const R=u(!1),U=u(!1),F=u(!1),ue=u(),S=u(),pe=u([]),X=u([]),Y=u([]),Z=u(),ee=u(),le=u(null),ae=u(null),te=u(0),k=Ke({lecture:!1,ajout:!1,modif:!1,supp:!1,devalidation:!1,validation:!1}),fe=({ndoc:a,rowIndex:e})=>{G.value=e,P(a)},me=({selectedRows:a})=>{pe.value=a},ve=a=>{S.value=a.api},P=async a=>{try{const{data:e}=await V.post(`${o.lienApi}/unedeclarationTVA/${o.db}/${a}`);i.value=e,h.value=!0,i.value.periode&&await ie(i.value.periode)}catch(e){w(`Une erreur est survenue lors de l'affichage des détails
${e.message}`)}},be=async a=>{if(a)try{const{data:e}=await V.post(`${o.lienApi}/recapAchatsTVA/${o.db}`,{periode:a},{headers:{"Content-Type":"application/json"}});X.value=e}catch{}},ge=async a=>{if(a)try{const{data:e}=await V.post(`${o.lienApi}/recapVentesTVA/${o.db}`,{periode:a},{headers:{"Content-Type":"application/json"}});Y.value=e}catch{}},ie=async a=>{await Promise.all([be(a),ge(a)]),setTimeout(()=>{Z.value?.showTotals(),ee.value?.showTotals()},200)};Ie(()=>i.value?.periode,async a=>{a&&h.value&&await ie(a)}),Le(async()=>{await _e(),j()});const _e=async()=>{try{const e=(await V.post(`${o.lienApi}/verifierDroit/${o.state.dbCommun6}`,{id_utilisateur:o.userId,id_page:2206},{headers:{"Content-Type":"application/json"}})).data;e&&Object.keys(e).length>0&&(k.lecture=e.lecture,k.ajout=e.ajout,k.modif=e.modif,k.supp=e.supp,k.devalidation=e.devalidation,k.validation=e.validation),k.lecture||g("Vous n'avez pas le droit, veuillez consulter l'administrateur")}catch(a){w("Une erreur est survenue : "+(a.response?.data?.message||a.message))}finally{o.state.afficher_in_progress=!1}},j=async()=>{o.state.afficher_in_progress=!0;try{const{data:a}=await V.post(`${o.lienApi}/declarationTVA/${o.db}`,{annee_fiscale:o.state.annee_fiscale},{headers:{"Content-Type":"application/json"}});J.value=a}catch(a){w(a.message)}finally{o.state.afficher_in_progress=!1}},Ve=async()=>{o.state.afficher_in_progress=!0;try{const{data:a}=await V.post(`${o.lienApi}/ajouterDeclarationTVA/${o.db}`,{Annee:o.state.annee_fiscale,date_declaration:Ye(new Date)},{headers:{"Content-Type":"application/json"}});await P(a.id_declaration),m.value=!0,v.value=!0}catch(a){w(`Erreur lors de la création de la déclaration
${a.response?.data?.message||a.message}`)}finally{o.state.afficher_in_progress=!1}},ye=()=>{if(i.value.Verrouille){g("Impossible de modifier une déclaration verrouillée.");return}m.value=!0,v.value=!0},we=()=>{m.value=!1,v.value=!1,i.value.id_declaration||(h.value=!1)},xe=async()=>{if(!i.value.id_declaration){g("Erreur: Aucune déclaration à enregistrer");return}if(!i.value.periode){g("Veuillez sélectionner une période");return}o.state.afficher_in_progress=!0;try{const{data:a}=await V.post(`${o.lienApi}/enregistrerDeclarationTVA/${o.db}/${i.value.id_declaration}`,i.value,{headers:{"Content-Type":"application/json"}});$(a.message||"Enregistrement effectué avec succès"),m.value=!1,v.value=!1,await j(),await P(i.value.id_declaration)}catch(a){w(`Erreur lors de l'enregistrement
${a.response?.data?.message||a.message}`)}finally{o.state.afficher_in_progress=!1}},Ae=()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}if(i.value.Verrouille){g("Impossible de supprimer une déclaration verrouillée.");return}U.value=!0},Te=async()=>{F.value=!1,o.state.afficher_in_progress=!0;try{await V.post(`${o.lienApi}/supprimerDeclarationTVA/${o.db}/${i.value.id_declaration}`),$("Déclaration supprimée avec succès"),h.value=!1,await j()}catch(a){w(`Erreur lors de la suppression : ${a.response?.data?.message||a.message}`)}finally{o.state.afficher_in_progress=!1}},ke=async()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}o.state.afficher_in_progress=!0;try{const a=await V.post(`${o.lienApi}/exporterDeclarationTVAPDF/${o.db}/${i.value.id_declaration}`,{enreg_societe:o.state.enreg_societe},{responseType:"blob"}),e=new Blob([a.data],{type:"application/pdf"}),r=window.URL.createObjectURL(e),b=document.createElement("a");b.href=r,b.download=`TVA_${i.value.periode||"declaration"}.pdf`,b.click(),window.URL.revokeObjectURL(r),$("PDF généré avec succès")}catch(a){w(`Erreur lors de la génération du PDF
${a.response?.data?.message||a.message}`)}finally{o.state.afficher_in_progress=!1}},Ce=async()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}if(await E({message:"Voulez-vous générer l'écriture comptable de TVA pour cette déclaration ?"}))try{const{data:e}=await V.post(`${o.lienApi}/genererEcritureTVA/${o.db}/${i.value.id_declaration}`);$(e.message||"Écriture de TVA générée avec succès")}catch(e){w(`Erreur lors de la génération de l'écriture de TVA
${e.message}`)}},$e=async()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}if(await E({message:"Voulez-vous verrouiller cette déclaration TVA ?"}))try{await V.post(`${o.lienApi}/verrouillerDeclarationTVA/${o.db}/${i.value.id_declaration}`),i.value.Verrouille=1,$("Déclaration verrouillée avec succès")}catch(e){w(`Erreur lors du verrouillage
${e.message}`)}},he=async()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}if(await E({message:"Voulez-vous dé-verrouiller cette déclaration TVA ?"}))try{await V.post(`${o.lienApi}/deverrouillerDeclarationTVA/${o.db}/${i.value.id_declaration}`),i.value.Verrouille=0,$("Déclaration dé-verrouillée avec succès")}catch(e){w(`Erreur lors du dé-verrouillage
${e.message}`)}},De=async()=>{if(!i.value.id_declaration){g("Veuillez d'abord enregistrer la déclaration");return}o.state.afficher_in_progress=!0;try{const{data:a}=await V.post(`${o.lienApi}/calculerDeclarationTVA/${o.db}/${i.value.id_declaration}`);$(a.message||"Calcul effectué avec succès"),await P(i.value.id_declaration)}catch(a){w(`Erreur lors du calcul
${a.response?.data?.message||a.message}`)}finally{o.state.afficher_in_progress=!1}},I=u(!1),d=u("idle"),A=u(""),C=u(null),y=u("");let f=null;const Se={lancement:10,connexion:20,captcha:30,"2fa":50,authentifie:60,navigation:70,creation:75,remplissage:85,calcul:90,termine:100,erreur:0},ze=Q(()=>Se[d.value]||0),Re=Q(()=>({idle:"pi pi-spin pi-spinner",lancement:"pi pi-spin pi-spinner",connexion:"pi pi-spin pi-spinner",captcha:"pi pi-image","2fa":"pi pi-envelope",authentifie:"pi pi-check",navigation:"pi pi-spin pi-spinner",creation:"pi pi-spin pi-spinner",remplissage:"pi pi-spin pi-spinner",calcul:"pi pi-calculator",termine:"pi pi-check-circle",erreur:"pi pi-times-circle"})[d.value]||"pi pi-spin pi-spinner"),se=Q(()=>d.value==="termine"?"#10b981":d.value==="erreur"?"#ef4444":"#3b82f6"),Ue=()=>{const e=(o.lienApi||"").trim().replace(/\/api\/?$/,"");return f=qe(e,{transports:["websocket","polling"]}),f.on("connect",()=>{}),f.on("teledeclaration:progression",({etape:r,message:b,imageBase64:T})=>{d.value=r,A.value=b,T&&(C.value=T)}),f.on("teledeclaration:demande:captcha",({imageBase64:r})=>{d.value="captcha",A.value="Saisissez le CAPTCHA ci-dessous",C.value=r,y.value=""}),f.on("teledeclaration:demande:2fa",({imageBase64:r})=>{d.value="2fa",A.value="Saisissez le code d'authentification reçu par email",C.value=r,y.value=""}),f},L=a=>{!f||!y.value||(f.emit(`teledeclaration:reponse:${a}`,y.value),y.value="",d.value="connexion",A.value=a==="captcha"?"Vérification du CAPTCHA...":"Vérification du code...",C.value=null)},Fe=()=>{if(f){const a=d.value;f.emit(`teledeclaration:reponse:${a}`,"__CANCEL__")}N()},N=()=>{f&&(f.emit("teledeclaration:fermer"),f.disconnect(),f=null),I.value=!1,d.value="idle",A.value="",C.value=null,y.value=""},Ee=async()=>{if(!i.value.id_declaration){g("Aucune déclaration sélectionnée");return}if(!i.value.periode){g("Veuillez d'abord définir la période et enregistrer");return}const a=o.state.enreg_societe?.SimpLogin,e=o.state.enreg_societe?.SimpPass;if(!a||!e){g("Identifiants SIMPL non configurés. Vérifiez les paramètres de la société (SimpLogin / SimpPass).");return}if(!await E({message:`La déclaration TVA va être envoyée au portail SIMPL.

Vous devrez saisir le CAPTCHA et le code d'authentification reçu par email.

Continuer ?`}))return;I.value=!0,d.value="lancement",A.value="Initialisation de la connexion...",C.value=null;const b=Ue();b.on("connect",async()=>{try{await V.post(`${o.lienApi}/teledeclarerTVA/${o.db}/${i.value.id_declaration}`,{login:a,password:e,socketId:b.id},{headers:{"Content-Type":"application/json"},timeout:3e4})}catch(T){d.value="erreur",A.value=T.response?.data?.message||T.message}})};Me(()=>{f&&(f.disconnect(),f=null)});const Pe=()=>{h.value=!1,j(),G.value!=null&&S.value&&setTimeout(()=>{const a=S.value.getDisplayedRowCount();if(a>0){const e=Math.min(G.value,a-1),r=S.value.getDisplayedRowAtIndex(e);r&&(S.value.deselectAll(),r.setSelected(!0),S.value.ensureNodeVisible(r,"middle"))}},100)};return(a,e)=>{const r=Ge,b=Ne,T=Oe,O=Xe,je=Qe,B=Be;return c(),x(oe,null,[l("div",al,[l("div",tl,[l("div",il,[(c(),x(oe,null,He(ce,t=>n(r,{key:t.value,label:t.label,icon:t.icon,text:D.value!==t.value,severity:D.value===t.value?"primary":"secondary",size:"small",onClick:Zl=>D.value=t.value},null,8,["label","icon","text","severity","onClick"])),64))]),n(r,{icon:"pi pi-times",label:"Fermer",text:"",onClick:e[0]||(e[0]=t=>s(Je)("DeclarationTVA"))})]),l("div",sl,[M(l("div",null,[M(l("div",ol,[l("div",rl,[n(r,{text:"",icon:"pi pi-plus-circle",label:"Ajouter",onClick:e[1]||(e[1]=t=>Ve()),disabled:!k.ajout},null,8,["disabled"])]),l("div",nl,[n(W,{ref_key:"dataGrid",ref:ue,"excel-file-name":"Declaration TVA","excel-sheet-name":"Declaration TVA","row-data":J.value,showCheckbox:!1,"document-number-fields":["ndoc"],"date-only":["date_declaration"],"numeric-columns":["Credit_precedente","TVA_due","Credit à reporter"],"column-widths":{id_declaration:120,date_declaration:120,Type:100,periode:100,Credit_precedente:150,TVA_due:120,Credit_reporter:150,Utilsateur:120},onRowClicked:fe,onSelectionChanged:me,onGridReady:ve},null,8,["row-data"])])],512),[[H,!s(h)]]),s(h)?(c(),x("div",dl,[l("div",cl,[l("div",ul,[l("div",pl,[s(v)?p("",!0):(c(),_(r,{key:0,onClick:e[2]||(e[2]=t=>ye()),text:"",icon:"pi pi-pencil",label:"Modifier",disabled:s(i).Verrouille},null,8,["disabled"])),s(v)?p("",!0):(c(),_(r,{key:1,text:"",icon:"pi pi-print",label:"Imprimer",onClick:e[3]||(e[3]=t=>ke())})),s(v)?p("",!0):(c(),_(r,{key:2,text:"",icon:"pi pi-trash",label:"Supprimer",onClick:e[4]||(e[4]=t=>Ae()),disabled:s(i).Verrouille},null,8,["disabled"])),s(v)?p("",!0):(c(),_(r,{key:3,text:"",icon:"pi pi-file-excel",label:"Générer l'écriture de T.V.A",onClick:e[5]||(e[5]=t=>Ce())})),!s(v)&&!s(i).Verrouille?(c(),_(r,{key:4,text:"",icon:"pi pi-lock",label:"Verrouiller",onClick:e[6]||(e[6]=t=>$e())})):p("",!0),!s(v)&&s(i).Verrouille?(c(),_(r,{key:5,text:"",icon:"pi pi-lock-open",label:"Dé-verrouiller",onClick:e[7]||(e[7]=t=>he())})):p("",!0),s(v)?p("",!0):(c(),_(r,{key:6,text:"",icon:"pi pi-globe",label:"Télédéclarer",onClick:e[8]||(e[8]=t=>Ee()),style:{color:"#e67e22 !important"}})),s(v)?p("",!0):(c(),_(r,{key:7,text:"",icon:"pi pi-arrow-left",label:"Retour",onClick:Pe})),l("div",fl,[s(v)?p("",!0):(c(),_(r,{key:0,icon:"pi pi-paperclip",text:"",rounded:"",class:"p-button-plain",onClick:e[9]||(e[9]=t=>R.value=!R.value)}))])]),l("div",ml,[s(v)?(c(),_(r,{key:0,text:"",icon:"pi pi-save",label:"Enregistrer",severity:"primary",onClick:e[10]||(e[10]=t=>xe())})):p("",!0),s(v)?(c(),_(r,{key:1,text:"",icon:"pi pi-times",label:"Annuler",severity:"secondary",onClick:e[11]||(e[11]=t=>we())})):p("",!0),s(v)?(c(),_(r,{key:2,text:"",icon:"pi pi-calculator",label:"Calculer",onClick:e[12]||(e[12]=t=>De()),style:{color:"#3b82f6 !important"}})):p("",!0)]),l("div",vl,[l("div",bl,[l("div",gl,[l("div",_l,[e[38]||(e[38]=l("label",{for:"id_declaration",class:"block mb-2"},"N°Ordre",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).id_declaration,"onUpdate:modelValue":e[13]||(e[13]=t=>s(i).id_declaration=t),disabled:!s(m),id:"id_declaration",format:"###",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",Vl,[e[39]||(e[39]=l("label",{for:"annee",class:"block mb-2"},"Année",-1)),n(T,{size:"small",modelValue:s(i).Annee,"onUpdate:modelValue":e[14]||(e[14]=t=>s(i).Annee=t),disabled:!s(m),id:"annee",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",yl,[e[40]||(e[40]=l("label",{for:"date_declaration",class:"block mb-2"},"Date déclaration",-1)),n(O,{size:"small",modelValue:s(i).date_declaration,"onUpdate:modelValue":e[15]||(e[15]=t=>s(i).date_declaration=t),disabled:!s(m),id:"date_declaration","input-class":"w-full"},null,8,["modelValue","disabled"])]),l("div",wl,[e[41]||(e[41]=l("label",{for:"periodicite",class:"block mb-2"},"Périodicité",-1)),n(je,{modelValue:s(i).periode,"onUpdate:modelValue":e[16]||(e[16]=t=>s(i).periode=t),table:"MoisFiscalePeriode",condition1:s(o).state.annee_fiscale,disabled:!s(m),class:"w-full"},null,8,["modelValue","condition1","disabled"])])]),l("div",xl,[l("div",Al,[e[42]||(e[42]=l("label",{for:"date_du",class:"block mb-2"},"Date du",-1)),n(O,{size:"small",modelValue:le.value,"onUpdate:modelValue":e[17]||(e[17]=t=>le.value=t),disabled:!s(m),id:"date_du","input-class":"w-full"},null,8,["modelValue","disabled"])]),l("div",Tl,[e[43]||(e[43]=l("label",{for:"date_au",class:"block mb-2"},"Date au",-1)),n(O,{size:"small",modelValue:ae.value,"onUpdate:modelValue":e[18]||(e[18]=t=>ae.value=t),disabled:!s(m),id:"date_au","input-class":"w-full"},null,8,["modelValue","disabled"])]),l("div",kl,[e[44]||(e[44]=l("label",{for:"credit_precedente",class:"block mb-2"},"Credit précédente",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).Credit_precedente,"onUpdate:modelValue":e[19]||(e[19]=t=>s(i).Credit_precedente=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"credit_precedente",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",Cl,[e[45]||(e[45]=l("label",{for:"reduction",class:"block mb-2"},"Réduction de 15% de credit",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).Reduction15,"onUpdate:modelValue":e[20]||(e[20]=t=>s(i).Reduction15=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"reduction",class:"w-full"},null,8,["modelValue","disabled"])])]),l("div",$l,[l("div",hl,[e[46]||(e[46]=l("label",{for:"credit_reporter",class:"block mb-2"},"Credit à reporter (190 - 130)",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).Credit_reporter,"onUpdate:modelValue":e[21]||(e[21]=t=>s(i).Credit_reporter=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"credit_reporter",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",Dl,[e[47]||(e[47]=l("label",{for:"credit_restant",class:"block mb-2"},"Credit restant (201 - 202)",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).Credit_restant,"onUpdate:modelValue":e[22]||(e[22]=t=>s(i).Credit_restant=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"credit_restant",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",Sl,[e[48]||(e[48]=l("label",{for:"credit_accompagne",class:"block mb-2"},"Credit accompagné de paiement",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:te.value,"onUpdate:modelValue":e[23]||(e[23]=t=>te.value=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"credit_accompagne",class:"w-full"},null,8,["modelValue","disabled"])]),l("div",zl,[e[49]||(e[49]=l("label",{for:"tva_due",class:"block mb-2"},"TVA due (130 -190)",-1)),n(b,{size:"small",locale:"fr-FR",modelValue:s(i).TVA_due,"onUpdate:modelValue":e[24]||(e[24]=t=>s(i).TVA_due=t),disabled:!s(m),mode:"decimal",minFractionDigits:2,maxFractionDigits:2,id:"tva_due",class:"w-full"},null,8,["modelValue","disabled"])])]),e[52]||(e[52]=l("div",{class:"border-t border-gray-300 my-4"},null,-1)),s(i).Verrouille?(c(),x("div",Rl,"VERROUILLÉ")):p("",!0),l("div",Ul,[l("div",null,[e[50]||(e[50]=l("h3",{class:"text-lg font-semibold mb-3 text-blue-600"},"Achats",-1)),l("div",Fl,[n(W,{ref_key:"dataGridAchats",ref:Z,"excel-file-name":"Declaration TVA","excel-sheet-name":"Declaration TVA","row-data":X.value,showCheckbox:!1,"numeric-columns":["HT","TVA","TTC"],"column-widths":{taux:100,HT:120,TVA:120,TTC:120},"enable-totals":!0,"totals-columns":["HT","TVA","TTC"]},null,8,["row-data"])])]),l("div",null,[e[51]||(e[51]=l("h3",{class:"text-lg font-semibold mb-3 text-green-600"},"Ventes",-1)),l("div",El,[n(W,{ref_key:"dataGridVentes",ref:ee,"excel-file-name":"Declaration TVA","excel-sheet-name":"Declaration TVA","row-data":Y.value,showCheckbox:!1,"numeric-columns":["HT","TVA","TTC"],"column-widths":{taux:100,HT:120,TVA:120,TTC:120},"enable-totals":!0,"totals-columns":["HT","TVA","TTC"]},null,8,["row-data"])])])])])])]),R.value?(c(),x("div",Pl,[n(Ze,{ndoc:s(i).id_declaration,doc:"declarationTVA",show:R.value,onClose:e[25]||(e[25]=t=>R.value=!1)},null,8,["ndoc","show"])])):p("",!0)])])):p("",!0)],512),[[H,D.value==="declaration"]]),M(l("div",jl,[n(el)],512),[[H,D.value==="deductible"]]),M(l("div",Il,[n(ll)],512),[[H,D.value==="collectee"]])])]),n(B,{visible:U.value,"onUpdate:visible":e[28]||(e[28]=t=>U.value=t),header:"Confirmation de suppression",modal:!0,style:{width:"450px"}},{footer:z(()=>[n(r,{label:"Non",icon:"pi pi-times",onClick:e[26]||(e[26]=t=>U.value=!1),text:""}),n(r,{label:"Oui",icon:"pi pi-check",onClick:e[27]||(e[27]=t=>{U.value=!1,F.value=!0}),class:"p-button-danger",autofocus:""})]),default:z(()=>[e[53]||(e[53]=l("div",{class:"flex flex-column align-items-center p-4"},[l("i",{class:"pi pi-exclamation-triangle mb-3",style:{"font-size":"2rem",color:"var(--red-500)"}}),l("p",null,"Êtes-vous sûr de vouloir supprimer cette déclaration TVA ?")],-1))]),_:1},8,["visible"]),n(B,{visible:F.value,"onUpdate:visible":e[30]||(e[30]=t=>F.value=t),header:"Confirmation finale",modal:!0,style:{width:"450px"}},{footer:z(()=>[n(r,{label:"Annuler",icon:"pi pi-times",onClick:e[29]||(e[29]=t=>F.value=!1),text:""}),n(r,{label:"Supprimer définitivement",icon:"pi pi-trash",onClick:Te,class:"p-button-danger",autofocus:""})]),default:z(()=>[e[54]||(e[54]=l("div",{class:"flex flex-column align-items-center p-4"},[l("i",{class:"pi pi-exclamation-circle mb-3",style:{"font-size":"2rem",color:"#ef4444"}}),l("p",{class:"text-center font-bold",style:{color:"#ef4444"}},"Cette action est irréversible !"),l("p",{class:"text-center mt-2"},"Confirmez-vous la suppression définitive de cette déclaration TVA ?")],-1))]),_:1},8,["visible"]),n(B,{visible:I.value,"onUpdate:visible":e[37]||(e[37]=t=>I.value=t),header:"Télédéclaration TVA — SIMPL",modal:!0,closable:d.value==="erreur"||d.value==="termine"||d.value==="idle",style:{width:"650px"},onHide:N},{footer:z(()=>[d.value==="captcha"||d.value==="2fa"?(c(),_(r,{key:0,label:"Annuler",icon:"pi pi-times",text:"",onClick:Fe})):p("",!0),d.value==="termine"||d.value==="erreur"?(c(),_(r,{key:1,label:"Fermer",icon:"pi pi-times",onClick:N})):p("",!0)]),default:z(()=>[l("div",Ll,[l("div",Ml,[l("div",Hl,[l("i",{class:re(Re.value),style:K({color:se.value,fontSize:"1.3rem"})},null,6),l("span",{class:"font-semibold",style:K({color:se.value})},ne(A.value),5)]),d.value!=="erreur"&&d.value!=="termine"&&d.value!=="idle"?(c(),x("div",Gl,[l("div",{class:"bg-blue-500 h-1.5 rounded-full transition-all duration-500",style:K({width:ze.value+"%"})},null,4)])):p("",!0)]),C.value?(c(),x("div",Nl,[l("img",{src:"data:image/png;base64,"+C.value,class:re(["max-w-full border rounded shadow",{"max-h-48":d.value==="captcha"||d.value==="2fa","max-h-96":d.value==="termine"}]),alt:"SIMPL"},null,10,Ol)])):p("",!0),d.value==="captcha"?(c(),x("div",Bl,[e[55]||(e[55]=l("label",{class:"font-semibold"},"Saisissez le CAPTCHA affiché ci-dessus :",-1)),l("div",Kl,[n(T,{modelValue:y.value,"onUpdate:modelValue":e[31]||(e[31]=t=>y.value=t),class:"flex-1",placeholder:"Code CAPTCHA",onKeydown:e[32]||(e[32]=de(t=>L("captcha"),["enter"])),autofocus:""},null,8,["modelValue"]),n(r,{label:"Envoyer",icon:"pi pi-send",onClick:e[33]||(e[33]=t=>L("captcha")),disabled:!y.value},null,8,["disabled"])])])):p("",!0),d.value==="2fa"?(c(),x("div",ql,[e[56]||(e[56]=l("label",{class:"font-semibold"},[l("i",{class:"pi pi-envelope mr-1"}),q(" Saisissez le code d'authentification reçu par email : ")],-1)),l("div",Ql,[n(T,{modelValue:y.value,"onUpdate:modelValue":e[34]||(e[34]=t=>y.value=t),class:"flex-1",placeholder:"Code reçu par email",onKeydown:e[35]||(e[35]=de(t=>L("2fa"),["enter"])),autofocus:""},null,8,["modelValue"]),n(r,{label:"Valider",icon:"pi pi-check",onClick:e[36]||(e[36]=t=>L("2fa")),disabled:!y.value},null,8,["disabled"])])])):p("",!0),d.value==="termine"?(c(),x("div",Wl,[...e[57]||(e[57]=[l("p",{class:"text-green-600 font-semibold"},[l("i",{class:"pi pi-check-circle mr-1"}),q(" Vérifiez le résultat ci-dessus puis validez sur le portail SIMPL. ")],-1)])])):p("",!0),d.value==="erreur"?(c(),x("div",Jl,[l("p",Xl,[e[58]||(e[58]=l("i",{class:"pi pi-times-circle mr-1"},null,-1)),q(" "+ne(A.value),1)])])):p("",!0)])]),_:1},8,["visible","closable"])],64)}}};export{na as default};
