Plugin Directory

Changeset 3167980


Ignore:
Timestamp:
10/13/2024 01:17:40 PM (18 months ago)
Author:
melioze
Message:

fix bugs and new features 1.2.3

Location:
my-easy-compta
Files:
795 added
22 edited

Legend:

Unmodified
Added
Removed
  • my-easy-compta/trunk/assets/dist/api.min.js

    r3166746 r3167980  
    1 (function(e,a){const t=o,x=e();for(;[];)try{if(-parseInt(t(228))/1+parseInt(t(219))/2*(parseInt(t(227))/3)+-parseInt(t(240))/4+parseInt(t(241))/5*(parseInt(t(222))/6)+-parseInt(t(221))/7*(parseInt(t(226))/8)+-parseInt(t(231))/9+-parseInt(t(220))/10*(-parseInt(t(236))/11)===a)break;x.push(x.shift())}catch{x.push(x.shift())}})(f,190982);function l(e,a,t="\u20AC"){const x=o,n=parseFloat(e),c=parseFloat(a),r=n*(c/100);return(n+r)[x(239)](2)[x(237)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+t}function o(e,a){const t=f();return o=function(x,n){return x=x-219,t[x]},o(e,a)}function p(e,a="\u20AC"){const t=o;return parseFloat(e)[t(239)](2).replace(/\B(?=(\d{3})+(?!\d))/g," ")+" "+a}function _(e,a){const t=o;let x=[];if(a<=5)for(let n=1;n<=a;n++)x[t(238)](n);else if(e<=3){for(let n=1;n<=5;n++)x[t(238)](n);x[t(238)](t(229)),x[t(238)](a)}else if(e>a-3){x[t(238)](1),x[t(238)](t(229));for(let n=a-4;n<=a;n++)x[t(238)](n)}else{x[t(238)](1),x[t(238)]("...");for(let n=e-1;n<=e+1;n++)x[t(238)](n);x[t(238)](t(229)),x.push(a)}return x}function h(e,a,t){const x=o,n=parseFloat(e)[x(239)](2)[x(237)](/\B(?=(\d{3})+(?!\d))/g," ");return t===x(242)?a+" "+n:n+" "+a}function f(){const e=["900qrEXtR","before","type","7012kjTYGo","50uiHZSH","1876294gFtdtH","738wWWJfG","length","message","split","8rQcluX","189JCBtJN","159447pDkjCN","...","toString","1890819aKoTvu","indexOf","visible","YYYY","Invalid Date","1878635gzpMlq","replace","push","toFixed","1073524uNwCUM"];return f=function(){return e},f()}function b(e,a,t){const x=o;e[x(224)]=a,e[x(243)]=t,e[x(233)]=!![],setTimeout(()=>{e.visible=![]},3e3)}(function(e,a){const t=i,x=e();for(;[];)try{if(-parseInt(t(472))/1+-parseInt(t(465))/2*(parseInt(t(483))/3)+parseInt(t(480))/4*(parseInt(t(477))/5)+-parseInt(t(481))/6+-parseInt(t(487))/7*(parseInt(t(467))/8)+-parseInt(t(488))/9*(parseInt(t(476))/10)+parseInt(t(479))/11===a)break;x.push(x.shift())}catch{x.push(x.shift())}})(u,826967);function i(e,a){const t=u();return i=function(x,n){return x=x-464,t[x]},i(e,a)}function u(){const e=["Failed to fetch VAT data:","Failed to fetch currency data:","symbol","83010NNZXig","171165sUDKab","default_currency","56792043lWZJTz","44JhuMwq","3635106lwUrdG","default_vat","21HukyDf","/wp-json/my-easy-compta/v1/settings/vat/","application/json","/wp-json/my-easy-compta/v1/settings/currency/","564200ZWAEEF","1395aHPfWh","GET","message","409430Uosjlw","statusText","8jLdsHa","error","json","nonce","/wp-json/my-easy-compta/v1/settings/vats","1306398OUWSaP"];return u=function(){return e},u()}async function y(){const e=i;try{const a=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":e(485),"X-WP-Nonce":myEasyComptaAdmin[e(470)]}});if(a.ok){const t=await a[e(469)]();let x=null,n=null,c=null;if(t[e(478)]){const r=t.default_currency,s=await fetch(e(486)+r,{method:"GET",headers:{"Content-Type":e(485),"X-WP-Nonce":myEasyComptaAdmin[e(470)]}});s.ok?x=(await s[e(469)]())[e(475)]:console[e(468)](e(474),s[e(466)])}if(t.vat_active==1){const r=t[e(482)],s=await fetch(e(484)+r,{method:e(489),headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin[e(470)]}});s.ok?n=await s[e(469)]():console[e(468)](e(473),s[e(466)]);const d=await fetch(e(471),{method:e(489),headers:{"Content-Type":e(485),"X-WP-Nonce":myEasyComptaAdmin[e(470)]}});d.ok?c=await d[e(469)]():console[e(468)]("Failed to fetch VAT data:",d.statusText)}else n=0,c=0;return{settings:t,currencySymbol:x,vatData:n,listVatData:c}}else{const t=await a[e(469)]();throw new Error(t[e(464)])}}catch(a){throw console[e(468)](a),new Error(a[e(464)])}}export{p as a,h as b,l as c,y as f,_ as g,b as s};
     1(function(t,a){const x=s,e=t();for(;[];)try{if(parseInt(x(453))/1*(-parseInt(x(454))/2)+-parseInt(x(469))/3+parseInt(x(462))/4*(parseInt(x(464))/5)+-parseInt(x(459))/6+-parseInt(x(471))/7*(parseInt(x(461))/8)+parseInt(x(467))/9+parseInt(x(460))/10===a)break;e.push(e.shift())}catch{e.push(e.shift())}})(f,727667);function s(t,a){const x=f();return s=function(e,n){return e=e-453,x[e]},s(t,a)}function u(t,a,x="\u20AC"){const e=s,n=parseFloat(t),o=parseFloat(a),r=n*(o/100);return(n+r)[e(456)](2).replace(/\B(?=(\d{3})+(?!\d))/g," ")+" "+x}function l(t,a="\u20AC"){const x=s;return parseFloat(t).toFixed(2)[x(466)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+a}function f(){const t=["visible","1169uGzQMC","indexOf","before","split","...","37RzjzkO","34014NjmXit","Invalid Date","toFixed","push","type","3858120URBCzx","23965870GcqLga","22840HxqmMZ","56964aDIONg","toString","215HyUVDm","length","replace","1594188xUHIMy","YYYY","2128053HHNgLR"];return f=function(){return t},f()}function _(t,a){const x=s;let e=[];if(a<=5)for(let n=1;n<=a;n++)e.push(n);else if(t<=3){for(let n=1;n<=5;n++)e[x(457)](n);e[x(457)](x(475)),e[x(457)](a)}else if(t>a-3){e[x(457)](1),e.push(x(475));for(let n=a-4;n<=a;n++)e[x(457)](n)}else{e[x(457)](1),e[x(457)](x(475));for(let n=t-1;n<=t+1;n++)e[x(457)](n);e[x(457)](x(475)),e[x(457)](a)}return e}function h(t,a,x){const e=s,n=parseFloat(t)[e(456)](2)[e(466)](/\B(?=(\d{3})+(?!\d))/g," ");return x===e(473)?a+" "+n:n+" "+a}function m(t,a,x){const e=s;t.message=a,t[e(458)]=x,t[e(470)]=!![],setTimeout(()=>{const n=e;t[n(470)]=![]},3e3)}function d(){const t=["16248vcddLO","1lMzmvZ","6548808QdTwlJ","nonce","10166717qTCmIO","/wp-json/my-easy-compta/v1/settings/get","4638fgANRY","/wp-json/my-easy-compta/v1/settings/currency/","6335UzGXrw","3812080AtvRne","2366244YtuHXJ","statusText","GET","Failed to fetch VAT data:","application/json","10FLYypX","default_currency","165AWoXRX","vat_active","13MPYZtD","default_vat","error","message","symbol","json","Failed to fetch currency data:","541934eDQMEH","8QpiFsL"];return d=function(){return t},d()}(function(t,a){const x=p,e=t();for(;[];)try{if(parseInt(x(285))/1*(-parseInt(x(282))/2)+-parseInt(x(273))/3*(parseInt(x(284))/4)+parseInt(x(265))/5+parseInt(x(262))/6*(parseInt(x(264))/7)+-parseInt(x(283))/8*(-parseInt(x(266))/9)+parseInt(x(271))/10*(-parseInt(x(260))/11)+-parseInt(x(286))/12*(-parseInt(x(275))/13)===a)break;e.push(e.shift())}catch{e.push(e.shift())}})(d,852007);function p(t,a){const x=d();return p=function(e,n){return e=e-260,x[e]},p(t,a)}async function y(){const t=p;try{const a=await fetch(t(261),{method:t(268),headers:{"Content-Type":t(270),"X-WP-Nonce":myEasyComptaAdmin[t(287)]}});if(a.ok){const x=await a[t(280)]();let e=null,n=null,o=null;if(x[t(272)]){const r=x[t(272)],c=await fetch(t(263)+r,{method:t(268),headers:{"Content-Type":t(270),"X-WP-Nonce":myEasyComptaAdmin[t(287)]}});c.ok?e=(await c.json())[t(279)]:console[t(277)](t(281),c.statusText)}if(x[t(274)]==1){const r=x[t(276)],c=await fetch("/wp-json/my-easy-compta/v1/settings/vat/"+r,{method:t(268),headers:{"Content-Type":t(270),"X-WP-Nonce":myEasyComptaAdmin.nonce}});c.ok?n=await c[t(280)]():console[t(277)](t(269),c[t(267)]);const i=await fetch("/wp-json/my-easy-compta/v1/settings/vats",{method:t(268),headers:{"Content-Type":t(270),"X-WP-Nonce":myEasyComptaAdmin[t(287)]}});i.ok?o=await i[t(280)]():console[t(277)](t(269),i[t(267)])}else n=0,o=0;return{settings:x,currencySymbol:e,vatData:n,listVatData:o}}else{const x=await a[t(280)]();throw new Error(x[t(278)])}}catch(a){throw console[t(277)](a),new Error(a[t(278)])}}export{l as a,h as b,u as c,y as f,_ as g,m as s};
  • my-easy-compta/trunk/assets/dist/app.min.css

    r3166746 r3167980  
    36643664  margin-right: 0.5rem;
    36653665}
     3666.mx-auto{
     3667  margin-left: auto;
     3668  margin-right: auto;
     3669}
    36663670.my-1{
    36673671  margin-top: 0.25rem;
     
    37593763  height: 1.5rem;
    37603764}
     3765.h-auto{
     3766  height: auto;
     3767}
    37613768.h-full{
    37623769  height: 100%;
     
    37913798.max-w-40{
    37923799  max-width: 10rem;
     3800}
     3801.max-w-full{
     3802  max-width: 100%;
    37933803}
    37943804.max-w-md{
  • my-easy-compta/trunk/assets/dist/app.min.js

    r3166746 r3167980  
    1 import{_ as u,o as a,c as o,a as t,t as i,F as x,r as f,b as h,d as p,e as v,f as k,h as E}from"./plugin-vue_export-helper.min.js";const C={name:"Stats",data(){return{unpaidAmountsByCurrency:[],MonthExpenses:0,currentMonthEarnings:"",totalEarnings:"",symbol:"",loading:!1}},mounted(){this.calculateUnpaidAmount(),this.calculateCurrentMonthExpenses(),this.fetchCurrentMonthEarnings(),this.fetchTotalEarnings()},methods:{async calculateUnpaidAmount(){try{this.loading=!0;const n=await(await fetch("/wp-json/my-easy-compta/v1/stats/unpaid-invoices",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}})).json(),r=[];for(const c in n){const{total_amount:e,symbol:l}=n[c];r.push({currencyId:c,total_amount:e,symbol:l})}this.unpaidAmountsByCurrency=r,this.loading=!1}catch(s){console.error("Erreur lors du calcul des montants impay\xE9s :",s),this.loading=!1}},async calculateCurrentMonthExpenses(){try{this.loading=!0;const n=await(await fetch("/wp-json/my-easy-compta/v1/stats/expenses-month",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}})).json();this.MonthExpenses=n.total_expenses,this.symbol=n.default_currency,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des d\xE9penses du mois en cours :",s),this.loading=!1}},async fetchCurrentMonthEarnings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/stats/current-month-earnings",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.currentMonthEarnings=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des revenus du mois en cours :",s),this.loading=!1}},async fetchTotalEarnings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/stats/total-earnings",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.totalEarnings=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration de la totalit\xE9 des revenus :",s),this.loading=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},T={class:"mt-8"},A={class:"grid lg:grid-cols-4 mt-2 md:grid-cols-2 grid-cols-1 gap-6"},j={class:"stats shadow border"},I={class:"stat"},M=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-hand-holding-usd text-4xl"})],-1),P={class:"stat-title dark:text-slate-300"},$={class:"stat-value dark:text-slate-300 text-primary"},B={key:0},N=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),H=[N],S={key:1},W={class:"stats shadow border"},G={class:"stat"},X=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-receipt text-4xl"})],-1),F={class:"stat-title dark:text-slate-300"},D={class:"stat-value dark:text-slate-300 text-primary"},U={key:0},V=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),Y=[V],K={key:1},Z={key:0},q={key:1},J={class:"stat-desc"},O={class:"stats shadow border"},R={class:"stat"},L=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"far fa-money-bill-alt text-4xl"})],-1),Q={class:"stat-title dark:text-slate-300"},z={class:"stat-value dark:text-slate-300 text-primary"},ss={key:0},ts=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),es=[ts],ns={key:1},as={key:0},os={key:1},is={class:"stat-desc"},rs={class:"stats shadow border"},ls={class:"stat"},cs=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-file-invoice-dollar text-4xl"})],-1),ds={class:"stat-title dark:text-slate-300"},hs={class:"stat-value dark:text-slate-300 text-primary"},_s={key:0},ms=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),us=[ms],ps={key:1},vs={key:0},ys={key:1},xs=t("div",{class:"stat-desc"},null,-1);function fs(s,n,r,c,e,l){return a(),o("div",T,[t("div",A,[t("div",j,[t("div",I,[M,t("div",P,i(l.translations.unpaid),1),t("div",$,[e.loading?(a(),o("div",B,H)):(a(),o("div",S,[(a(!0),o(x,null,f(e.unpaidAmountsByCurrency,d=>(a(),o("div",{key:d.currencyId},i(d.total_amount)+i(d.symbol),1))),128))]))])])]),t("div",W,[t("div",G,[X,t("div",F,i(l.translations.expenses),1),t("div",D,[e.loading?(a(),o("div",U,Y)):(a(),o("div",K,[e.MonthExpenses?(a(),o("span",Z,i(e.MonthExpenses)+i(e.symbol),1)):(a(),o("span",q," 0"+i(e.symbol),1))]))]),t("div",J,i(l.translations.current_month),1)])]),t("div",O,[t("div",R,[L,t("div",Q,i(l.translations.earnings),1),t("div",z,[e.loading?(a(),o("div",ss,es)):(a(),o("div",ns,[e.currentMonthEarnings?(a(),o("span",as,i(e.currentMonthEarnings.total)+" "+i(e.currentMonthEarnings.default_currency_symbol),1)):(a(),o("span",os," 0"+i(e.symbol),1))]))]),t("div",is,i(l.translations.current_month),1)])]),t("div",rs,[t("div",ls,[cs,t("div",ds,i(l.translations.all_Earnings),1),t("div",hs,[e.loading?(a(),o("div",_s,us)):(a(),o("div",ps,[e.totalEarnings?(a(),o("span",vs,i(e.totalEarnings.total)+" "+i(e.totalEarnings.default_currency_symbol),1)):(a(),o("span",ys," 0"+i(e.totalEarnings.default_currency_symbol),1))]))]),xs])])])])}var gs=u(C,[["render",fs]]);const ws={name:"BarChart",data(){return{payments:[],expenses:[],months:[],loading:!0}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchMonthlyPaymentsExpenses()},methods:{async fetchMonthlyPaymentsExpenses(){try{const s=await fetch("/wp-json/my-easy-compta/v1/stats/monthly-payments-expenses",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.payments=n.payments,this.expenses=n.expenses,this.months=n.months,this.loading=!1,this.$nextTick(()=>{this.loadChart()})}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des paiements et des d\xE9penses mensuels:",s),this.loading=!1}},loadChart(){typeof Chart!="undefined"?this.createChart():console.error("Chart.js is not loaded")},createChart(){const s=this.translations,n=document.getElementById("bar-chart").getContext("2d");new Chart(n,{type:"bar",data:{labels:this.months,datasets:[{label:s.earnings,backgroundColor:"#42A5F5",data:this.payments},{label:s.expenses,backgroundColor:"#FF00AA",data:this.expenses}]},options:{responsive:!0,scales:{x:{beginAtZero:!0},y:{beginAtZero:!0}}}})}}},bs={class:"text-xl font-semibold"},ks=t("div",{class:"divider mt-2"},null,-1),Es={class:"h-full w-full pb-6"},Cs={key:0},Ts=h('<div class="flex flex-col gap-4 w-full"><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-32 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div></div>',1),As=[Ts],js={key:1,id:"bar-chart"};function Is(s,n,r,c,e,l){return a(),o("div",null,[t("div",bs,i(l.translations.annual_payments_overview),1),ks,t("div",Es,[e.loading?(a(),o("div",Cs,As)):(a(),o("canvas",js))])])}var Ms=u(ws,[["render",Is]]);const Ps={name:"InvoicesHistory",data(){return{recentPayments:[],loading:!0}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchRecentPayments()},methods:{async fetchRecentPayments(){try{const s=await fetch("/wp-json/my-easy-compta/v1/stats/recent-payments",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.recentPayments=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des paiements r\xE9cents:",s),this.loading=!1}}}},$s={class:"text-xl font-semibold"},Bs=t("div",{class:"divider mt-2"},null,-1),Ns={class:"overflow-x-auto"},Hs={key:0},Ss=h('<div class="flex flex-col gap-4 w-full"><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-32 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div></div>',1),Ws=[Ss],Gs={key:1},Xs={class:"text-gray-500"},Fs={key:2,class:"table table-xs ecwp-table-dash-invoice"},Ds={class:"badge badge-outline badge-success badge-sm"};function Us(s,n,r,c,e,l){return a(),o("div",null,[t("div",$s,i(l.translations.recently_paid_invoice),1),Bs,t("div",Ns,[e.loading?(a(),o("div",Hs,Ws)):e.recentPayments.length===0?(a(),o("div",Gs,[t("div",Xs,i(l.translations.no_data_for_moment),1)])):(a(),o("table",Fs,[t("tbody",null,[(a(!0),o(x,null,f(e.recentPayments,d=>(a(),o("tr",{key:d.invoice_number},[t("td",null,i(d.invoice_number),1),t("td",null,i(d.total_amount)+i(d.symbol),1),t("td",null,[t("span",Ds,i(d.method_name),1)])]))),128))])]))])])}var Vs=u(Ps,[["render",Us]]);const Ys={name:"Dashboard",components:{Stats:gs,BarChart:Ms,InvoicesHistory:Vs},methods:{setTheme(s){document.documentElement.setAttribute("data-theme",s),localStorage.setItem("theme",s)},toggleTheme(){document.documentElement.getAttribute("data-theme")==="dark"?this.setTheme("winter"):this.setTheme("dark")}},mounted(){const s=localStorage.getItem("theme");s?this.setTheme(s):window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&this.setTheme("dark")},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Ks={class:"relative pt-2 pr-4"},Zs={class:"ecwp-swap swap swap-rotate bg-base-100 p-2 mt-10"},qs=t("i",{class:"swap-off far fa-sun text-xl"},null,-1),Js=t("i",{class:"swap-on far fa-moon text-xl"},null,-1),Os={class:"grid lg:grid-cols-3 mt-4 grid-cols-1 gap-6"},Rs={class:"card w-full p-6 bg-base-100 shadow-xl col-span-2 mt-4"},Ls={class:"card w-full p-6 bg-base-100 shadow-xl mt-4"};function Qs(s,n,r,c,e,l){const d=p("Stats"),g=p("BarChart"),w=p("InvoicesHistory");return a(),o("div",Ks,[t("label",Zs,[t("input",{type:"checkbox",class:"theme-controller",onChange:n[0]||(n[0]=(...b)=>l.toggleTheme&&l.toggleTheme(...b))},null,32),qs,Js]),v(d),t("div",Os,[t("div",Rs,[v(g)]),t("div",Ls,[v(w)])])])}var zs=u(Ys,[["render",Qs]]);const y=_;(function(s,n){const r=_,c=s();for(;[];)try{if(parseInt(r(435))/1*(-parseInt(r(429))/2)+-parseInt(r(430))/3+parseInt(r(436))/4*(-parseInt(r(438))/5)+-parseInt(r(434))/6*(-parseInt(r(428))/7)+parseInt(r(437))/8+-parseInt(r(427))/9+parseInt(r(431))/10*(parseInt(r(426))/11)===n)break;c.push(c.shift())}catch{c.push(c.shift())}})(m,188500);function _(s,n){const r=m();return _=function(c,e){return c=c-426,r[c]},_(s,n)}const st=k({render:()=>E(zs)});function m(){const s=["55156AJwhKo","2393464qQNyKY","95MBKUHg","638PHxvOP","3056625NePiWJ","7DWnjnh","38276aCeNSu","690567ViZapY","126900OqsrjY","mount","#my-easy-compta-admin-app","140268YacfkU","2DgieMB"];return m=function(){return s},m()}st[y(432)](y(433));
     1import{_ as u,o as a,c as o,a as t,t as i,F as f,r as x,b as h,d as p,e as v,f as b,h as E}from"./plugin-vue_export-helper.min.js";const C={name:"Stats",data(){return{unpaidAmountsByCurrency:[],MonthExpenses:0,currentMonthEarnings:"",totalEarnings:"",symbol:"",loading:!1}},mounted(){this.calculateUnpaidAmount(),this.calculateCurrentMonthExpenses(),this.fetchCurrentMonthEarnings(),this.fetchTotalEarnings()},methods:{async calculateUnpaidAmount(){try{this.loading=!0;const n=await(await fetch("/wp-json/my-easy-compta/v1/stats/unpaid-invoices",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}})).json(),r=[];for(const l in n){const{total_amount:e,symbol:c}=n[l];r.push({currencyId:l,total_amount:e,symbol:c})}this.unpaidAmountsByCurrency=r,this.loading=!1}catch(s){console.error("Erreur lors du calcul des montants impay\xE9s :",s),this.loading=!1}},async calculateCurrentMonthExpenses(){try{this.loading=!0;const n=await(await fetch("/wp-json/my-easy-compta/v1/stats/expenses-month",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}})).json();this.MonthExpenses=n.total_expenses,this.symbol=n.default_currency,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des d\xE9penses du mois en cours :",s),this.loading=!1}},async fetchCurrentMonthEarnings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/stats/current-month-earnings",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.currentMonthEarnings=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des revenus du mois en cours :",s),this.loading=!1}},async fetchTotalEarnings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/stats/total-earnings",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.totalEarnings=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration de la totalit\xE9 des revenus :",s),this.loading=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},T={class:"mt-8"},A={class:"grid lg:grid-cols-4 mt-2 md:grid-cols-2 grid-cols-1 gap-6"},I={class:"stats shadow border"},M={class:"stat"},j=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-hand-holding-usd text-4xl"})],-1),P={class:"stat-title dark:text-slate-300"},$={class:"stat-value dark:text-slate-300 text-primary"},B={key:0},H=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),N=[H],S={key:1},G={class:"stats shadow border"},W={class:"stat"},X=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-receipt text-4xl"})],-1),V={class:"stat-title dark:text-slate-300"},F={class:"stat-value dark:text-slate-300 text-primary"},U={key:0},D=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),R=[D],O={key:1},Z={key:0},z={key:1},J={class:"stat-desc"},L={class:"stats shadow border"},Q={class:"stat"},Y=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"far fa-money-bill-alt text-4xl"})],-1),q={class:"stat-title dark:text-slate-300"},K={class:"stat-value dark:text-slate-300 text-primary"},ss={key:0},ts=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),es=[ts],ns={key:1},as={key:0},os={key:1},is={class:"stat-desc"},rs={class:"stats shadow border"},cs={class:"stat"},ls=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-file-invoice-dollar text-4xl"})],-1),ds={class:"stat-title dark:text-slate-300"},hs={class:"stat-value dark:text-slate-300 text-primary"},_s={key:0},ms=h('<div class="flex flex-col gap-4 w-40"><div class="flex gap-4 items-center"><div class="flex flex-col gap-4"><div class="skeleton h-4 w-40"></div><div class="skeleton h-4 w-40"></div></div></div></div>',1),us=[ms],ps={key:1},vs={key:0},ys={key:1},fs=t("div",{class:"stat-desc"},null,-1);function xs(s,n,r,l,e,c){return a(),o("div",T,[t("div",A,[t("div",I,[t("div",M,[j,t("div",P,i(c.translations.unpaid),1),t("div",$,[e.loading?(a(),o("div",B,N)):(a(),o("div",S,[(a(!0),o(f,null,x(e.unpaidAmountsByCurrency,d=>(a(),o("div",{key:d.currencyId},i(d.total_amount)+i(d.symbol),1))),128))]))])])]),t("div",G,[t("div",W,[X,t("div",V,i(c.translations.expenses),1),t("div",F,[e.loading?(a(),o("div",U,R)):(a(),o("div",O,[e.MonthExpenses?(a(),o("span",Z,i(e.MonthExpenses)+i(e.symbol),1)):(a(),o("span",z," 0"+i(e.symbol),1))]))]),t("div",J,i(c.translations.current_month),1)])]),t("div",L,[t("div",Q,[Y,t("div",q,i(c.translations.earnings),1),t("div",K,[e.loading?(a(),o("div",ss,es)):(a(),o("div",ns,[e.currentMonthEarnings?(a(),o("span",as,i(e.currentMonthEarnings.total)+" "+i(e.currentMonthEarnings.default_currency_symbol),1)):(a(),o("span",os," 0"+i(e.symbol),1))]))]),t("div",is,i(c.translations.current_month),1)])]),t("div",rs,[t("div",cs,[ls,t("div",ds,i(c.translations.all_Earnings),1),t("div",hs,[e.loading?(a(),o("div",_s,us)):(a(),o("div",ps,[e.totalEarnings?(a(),o("span",vs,i(e.totalEarnings.total)+" "+i(e.totalEarnings.default_currency_symbol),1)):(a(),o("span",ys," 0"+i(e.totalEarnings.default_currency_symbol),1))]))]),fs])])])])}var gs=u(C,[["render",xs]]);const ws={name:"BarChart",data(){return{payments:[],expenses:[],months:[],loading:!0}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchMonthlyPaymentsExpenses()},methods:{async fetchMonthlyPaymentsExpenses(){try{const s=await fetch("/wp-json/my-easy-compta/v1/stats/monthly-payments-expenses",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.payments=n.payments,this.expenses=n.expenses,this.months=n.months,this.loading=!1,this.$nextTick(()=>{this.loadChart()})}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des paiements et des d\xE9penses mensuels:",s),this.loading=!1}},loadChart(){typeof Chart!="undefined"?this.createChart():console.error("Chart.js is not loaded")},createChart(){const s=this.translations,n=document.getElementById("bar-chart").getContext("2d");new Chart(n,{type:"bar",data:{labels:this.months,datasets:[{label:s.earnings,backgroundColor:"#42A5F5",data:this.payments},{label:s.expenses,backgroundColor:"#FF00AA",data:this.expenses}]},options:{responsive:!0,scales:{x:{beginAtZero:!0},y:{beginAtZero:!0}}}})}}},ks={class:"text-xl font-semibold"},bs=t("div",{class:"divider mt-2"},null,-1),Es={class:"h-full w-full pb-6"},Cs={key:0},Ts=h('<div class="flex flex-col gap-4 w-full"><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-32 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div></div>',1),As=[Ts],Is={key:1,id:"bar-chart"};function Ms(s,n,r,l,e,c){return a(),o("div",null,[t("div",ks,i(c.translations.annual_payments_overview),1),bs,t("div",Es,[e.loading?(a(),o("div",Cs,As)):(a(),o("canvas",Is))])])}var js=u(ws,[["render",Ms]]);const Ps={name:"InvoicesHistory",data(){return{recentPayments:[],loading:!0}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchRecentPayments()},methods:{async fetchRecentPayments(){try{const s=await fetch("/wp-json/my-easy-compta/v1/stats/recent-payments",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=await s.json();this.recentPayments=n,this.loading=!1}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des paiements r\xE9cents:",s),this.loading=!1}}}},$s={class:"text-xl font-semibold"},Bs=t("div",{class:"divider mt-2"},null,-1),Hs={class:"overflow-x-auto"},Ns={key:0},Ss=h('<div class="flex flex-col gap-4 w-full"><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-32 w-full"></div><div class="skeleton h-4 w-full"></div><div class="skeleton h-4 w-full"></div></div>',1),Gs=[Ss],Ws={key:1},Xs={class:"text-gray-500"},Vs={key:2,class:"table table-xs ecwp-table-dash-invoice"},Fs={class:"badge badge-outline badge-success badge-sm"};function Us(s,n,r,l,e,c){return a(),o("div",null,[t("div",$s,i(c.translations.recently_paid_invoice),1),Bs,t("div",Hs,[e.loading?(a(),o("div",Ns,Gs)):e.recentPayments.length===0?(a(),o("div",Ws,[t("div",Xs,i(c.translations.no_data_for_moment),1)])):(a(),o("table",Vs,[t("tbody",null,[(a(!0),o(f,null,x(e.recentPayments,d=>(a(),o("tr",{key:d.invoice_number},[t("td",null,i(d.invoice_number),1),t("td",null,i(d.total_amount)+i(d.symbol),1),t("td",null,[t("span",Fs,i(d.method_name),1)])]))),128))])]))])])}var Ds=u(Ps,[["render",Us]]);const Rs={name:"Dashboard",components:{Stats:gs,BarChart:js,InvoicesHistory:Ds},methods:{setTheme(s){document.documentElement.setAttribute("data-theme",s),localStorage.setItem("theme",s)},toggleTheme(){document.documentElement.getAttribute("data-theme")==="dark"?this.setTheme("winter"):this.setTheme("dark")}},mounted(){const s=localStorage.getItem("theme");s?this.setTheme(s):window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches&&this.setTheme("dark")},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Os={class:"relative pt-2 pr-4"},Zs={class:"ecwp-swap swap swap-rotate bg-base-100 p-2 mt-10"},zs=t("i",{class:"swap-off far fa-sun text-xl"},null,-1),Js=t("i",{class:"swap-on far fa-moon text-xl"},null,-1),Ls={class:"grid lg:grid-cols-3 mt-4 grid-cols-1 gap-6"},Qs={class:"card w-full p-6 bg-base-100 shadow-xl col-span-2 mt-4"},Ys={class:"card w-full p-6 bg-base-100 shadow-xl mt-4"};function qs(s,n,r,l,e,c){const d=p("Stats"),g=p("BarChart"),w=p("InvoicesHistory");return a(),o("div",Os,[t("label",Zs,[t("input",{type:"checkbox",class:"theme-controller",onChange:n[0]||(n[0]=(...k)=>c.toggleTheme&&c.toggleTheme(...k))},null,32),zs,Js]),v(d),t("div",Ls,[t("div",Qs,[v(g)]),t("div",Ys,[v(w)])])])}var Ks=u(Rs,[["render",qs]]);function _(){const s=["5916534dDgcHt","40VWUJiy","2279528uBosRi","8950545pUfPOS","15335EYlNen","mount","3835632HMlcme","#my-easy-compta-admin-app","16wGSzwW","1525269VGQiOy","6042092pyXdVI"];return _=function(){return s},_()}const y=m;(function(s,n){const r=m,l=s();for(;[];)try{if(parseInt(r(403))/1+parseInt(r(396))/2+parseInt(r(400))/3+parseInt(r(402))/4*(parseInt(r(398))/5)+parseInt(r(394))/6+parseInt(r(393))/7+parseInt(r(395))/8*(-parseInt(r(397))/9)===n)break;l.push(l.shift())}catch{l.push(l.shift())}})(_,832565);function m(s,n){const r=_();return m=function(l,e){return l=l-393,r[l]},m(s,n)}const st=b({render:()=>E(Ks)});st[y(399)](y(401));
  • my-easy-compta/trunk/assets/dist/clients.min.js

    r3166746 r3167980  
    1 import{_ as oe,o as y,c as _,n as L,a,t as m,g as N,w as Je,i as A,v as J,F as T,r as R,j as ve,k as Ke,l as gt,m as K,d as V,e as z,p as bt,f as wt,h as xt}from"./plugin-vue_export-helper.min.js";import{C as Et,R as vt}from"./RemoveAlert.min.js";import{g as Ct,f as St,s as Tt}from"./api.min.js";import{r as Rt}from"./index.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./vue3-editor.common.min.js";function Xe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ot}=Object.prototype,{getPrototypeOf:Ce}=Object,re=(e=>t=>{const n=Ot.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>re(t)===e),ie=e=>t=>typeof t===e,{isArray:I}=Array,X=ie("undefined");function At(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=D("ArrayBuffer");function Pt(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$e(e.buffer),t}const kt=ie("string"),O=ie("function"),Ge=ie("number"),ae=e=>e!==null&&typeof e=="object",Dt=e=>e===!0||e===!1,G=e=>{if(re(e)!=="object")return!1;const t=Ce(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Nt=D("Date"),Bt=D("File"),Ft=D("Blob"),Mt=D("FileList"),Lt=e=>ae(e)&&O(e.pipe),jt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=re(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},Ut=D("URLSearchParams"),[It,qt,Ht,Vt]=["ReadableStream","Request","Response","Headers"].map(D),zt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e=="undefined")return;let s,o;if(typeof e!="object"&&(e=[e]),I(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),i=r.length;let c;for(s=0;s<i;s++)c=r[s],t.call(null,e[c],c,e)}}function Ze(e,t){t=t.toLowerCase();const n=Object.keys(e);let s=n.length,o;for(;s-- >0;)if(o=n[s],t===o.toLowerCase())return o;return null}const Qe=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Ye=e=>!X(e)&&e!==Qe;function ye(){const{caseless:e}=Ye(this)&&this||{},t={},n=(s,o)=>{const r=e&&Ze(t,o)||o;G(t[r])&&G(s)?t[r]=ye(t[r],s):G(s)?t[r]=ye({},s):I(s)?t[r]=s.slice():t[r]=s};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&$(arguments[s],n);return t}const Wt=(e,t,n,{allOwnKeys:s}={})=>($(t,(o,r)=>{n&&O(o)?e[r]=Xe(o,n):e[r]=o},{allOwnKeys:s}),e),Jt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Kt=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Xt=(e,t,n,s)=>{let o,r,i;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),r=o.length;r-- >0;)i=o[r],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&Ce(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},$t=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Gt=e=>{if(!e)return null;if(I(e))return e;let t=e.length;if(!Ge(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Zt=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&Ce(Uint8Array)),Qt=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=s.next())&&!o.done;){const r=o.value;t.call(e,r[0],r[1])}},Yt=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},en=D("HTMLFormElement"),tn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,o){return s.toUpperCase()+o}),De=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),nn=D("RegExp"),et=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};$(n,(o,r)=>{let i;(i=t(o,r,e))!==!1&&(s[r]=i||o)}),Object.defineProperties(e,s)},sn=e=>{et(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(!!O(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},on=(e,t)=>{const n={},s=o=>{o.forEach(r=>{n[r]=!0})};return I(e)?s(e):s(String(e).split(t)),n},rn=()=>{},an=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,ue="abcdefghijklmnopqrstuvwxyz",Ne="0123456789",tt={DIGIT:Ne,ALPHA:ue,ALPHA_DIGIT:ue+ue.toUpperCase()+Ne},ln=(e=16,t=tt.ALPHA_DIGIT)=>{let n="";const{length:s}=t;for(;e--;)n+=t[Math.random()*s|0];return n};function cn(e){return!!(e&&O(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const dn=e=>{const t=new Array(10),n=(s,o)=>{if(ae(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[o]=s;const r=I(s)?[]:{};return $(s,(i,c)=>{const f=n(i,o+1);!X(f)&&(r[c]=f)}),t[o]=void 0,r}}return s};return n(e,0)},un=D("AsyncFunction"),fn=e=>e&&(ae(e)||O(e))&&O(e.then)&&O(e.catch);var l={isArray:I,isArrayBuffer:$e,isBuffer:At,isFormData:jt,isArrayBufferView:Pt,isString:kt,isNumber:Ge,isBoolean:Dt,isObject:ae,isPlainObject:G,isReadableStream:It,isRequest:qt,isResponse:Ht,isHeaders:Vt,isUndefined:X,isDate:Nt,isFile:Bt,isBlob:Ft,isRegExp:nn,isFunction:O,isStream:Lt,isURLSearchParams:Ut,isTypedArray:Zt,isFileList:Mt,forEach:$,merge:ye,extend:Wt,trim:zt,stripBOM:Jt,inherits:Kt,toFlatObject:Xt,kindOf:re,kindOfTest:D,endsWith:$t,toArray:Gt,forEachEntry:Qt,matchAll:Yt,isHTMLForm:en,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:et,freezeMethods:sn,toObjectSet:on,toCamelCase:tn,noop:rn,toFiniteNumber:an,findKey:Ze,global:Qe,isContextDefined:Ye,ALPHABET:tt,generateString:ln,isSpecCompliantForm:cn,toJSONObject:dn,isAsyncFn:un,isThenable:fn};function g(e,t,n,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o)}l.inherits(g,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:l.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const nt=g.prototype,st={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{st[e]={value:e}});Object.defineProperties(g,st);Object.defineProperty(nt,"isAxiosError",{value:!0});g.from=(e,t,n,s,o,r)=>{const i=Object.create(nt);return l.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),g.call(i,e.message,t,n,s,o),i.cause=e,i.name=e.name,r&&Object.assign(i,r),i};var hn=null;function _e(e){return l.isPlainObject(e)||l.isArray(e)}function ot(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,n){return e?e.concat(t).map(function(o,r){return o=ot(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function mn(e){return l.isArray(e)&&!e.some(_e)}const pn=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function le(e,t,n){if(!l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,C){return!l.isUndefined(C[b])});const s=n.metaTokens,o=n.visitor||d,r=n.dots,i=n.indexes,f=(n.Blob||typeof Blob!="undefined"&&Blob)&&l.isSpecCompliantForm(t);if(!l.isFunction(o))throw new TypeError("visitor must be a function");function h(p){if(p===null)return"";if(l.isDate(p))return p.toISOString();if(!f&&l.isBlob(p))throw new g("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(p)||l.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function d(p,b,C){let S=p;if(p&&!C&&typeof p=="object"){if(l.endsWith(b,"{}"))b=s?b:b.slice(0,-2),p=JSON.stringify(p);else if(l.isArray(p)&&mn(p)||(l.isFileList(p)||l.endsWith(b,"[]"))&&(S=l.toArray(p)))return b=ot(b),S.forEach(function(E,H){!(l.isUndefined(E)||E===null)&&t.append(i===!0?Be([b],H,r):i===null?b:b+"[]",h(E))}),!1}return _e(p)?!0:(t.append(Be(C,b,r),h(p)),!1)}const u=[],w=Object.assign(pn,{defaultVisitor:d,convertValue:h,isVisitable:_e});function x(p,b){if(!l.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+b.join("."));u.push(p),l.forEach(p,function(S,B){(!(l.isUndefined(S)||S===null)&&o.call(t,S,l.isString(B)?B.trim():B,b,w))===!0&&x(S,b?b.concat(B):[B])}),u.pop()}}if(!l.isObject(e))throw new TypeError("data must be an object");return x(e),t}function Fe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Se(e,t){this._pairs=[],e&&le(e,this,t)}const rt=Se.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(s){return t.call(this,s,Fe)}:Fe;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function yn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function it(e,t,n){if(!t)return e;const s=n&&n.encode||yn,o=n&&n.serialize;let r;if(o?r=o(t,n):r=l.isURLSearchParams(t)?t.toString():new Se(t,n).toString(s),r){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class _n{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){l.forEach(this.handlers,function(s){s!==null&&t(s)})}}var Me=_n,at={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gn=typeof URLSearchParams!="undefined"?URLSearchParams:Se,bn=typeof FormData!="undefined"?FormData:null,wn=typeof Blob!="undefined"?Blob:null,xn={isBrowser:!0,classes:{URLSearchParams:gn,FormData:bn,Blob:wn},protocols:["http","https","file","blob","url","data"]};const Te=typeof window!="undefined"&&typeof document!="undefined",En=(e=>Te&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator!="undefined"&&navigator.product),vn=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Cn=Te&&window.location.href||"http://localhost";var Sn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserWebWorkerEnv:vn,hasStandardBrowserEnv:En,origin:Cn},Symbol.toStringTag,{value:"Module"})),P={...Sn,...xn};function Tn(e,t){return le(e,new P.classes.URLSearchParams,Object.assign({visitor:function(n,s,o,r){return P.isNode&&l.isBuffer(n)?(this.append(s,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function Rn(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function On(e){const t={},n=Object.keys(e);let s;const o=n.length;let r;for(s=0;s<o;s++)r=n[s],t[r]=e[r];return t}function lt(e){function t(n,s,o,r){let i=n[r++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=r>=n.length;return i=!i&&l.isArray(o)?o.length:i,f?(l.hasOwnProp(o,i)?o[i]=[o[i],s]:o[i]=s,!c):((!o[i]||!l.isObject(o[i]))&&(o[i]=[]),t(n,s,o[i],r)&&l.isArray(o[i])&&(o[i]=On(o[i])),!c)}if(l.isFormData(e)&&l.isFunction(e.entries)){const n={};return l.forEachEntry(e,(s,o)=>{t(Rn(s),o,n,0)}),n}return null}function An(e,t,n){if(l.isString(e))try{return(t||JSON.parse)(e),l.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Re={transitional:at,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",o=s.indexOf("application/json")>-1,r=l.isObject(t);if(r&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return o?JSON.stringify(lt(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t)||l.isReadableStream(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Tn(t,this.formSerializer).toString();if((c=l.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return le(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return r||o?(n.setContentType("application/json",!1),An(t)):t}],transformResponse:[function(t){const n=this.transitional||Re.transitional,s=n&&n.forcedJSONParsing,o=this.responseType==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(s&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],e=>{Re.headers[e]={}});var Oe=Re;const Pn=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var kn=e=>{const t={};let n,s,o;return e&&e.split(`
     1import{_ as oe,o as y,c as _,n as L,a,t as m,g as N,w as Je,i as A,v as J,F as T,r as R,j as Ce,k as Ke,l as gt,m as K,d as V,e as z,p as bt,f as wt,h as xt}from"./plugin-vue_export-helper.min.js";import{C as Et,R as Ct}from"./RemoveAlert.min.js";import{g as vt,f as St,s as Tt}from"./api.min.js";import{r as Rt}from"./index.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./vue3-editor.common.min.js";function Xe(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ot}=Object.prototype,{getPrototypeOf:ve}=Object,re=(e=>t=>{const n=Ot.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),D=e=>(e=e.toLowerCase(),t=>re(t)===e),ie=e=>t=>typeof t===e,{isArray:I}=Array,X=ie("undefined");function At(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const $e=D("ArrayBuffer");function Pt(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&$e(e.buffer),t}const kt=ie("string"),O=ie("function"),Ge=ie("number"),ae=e=>e!==null&&typeof e=="object",Dt=e=>e===!0||e===!1,G=e=>{if(re(e)!=="object")return!1;const t=ve(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},Nt=D("Date"),Bt=D("File"),Ft=D("Blob"),Mt=D("FileList"),Lt=e=>ae(e)&&O(e.pipe),jt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||O(e.append)&&((t=re(e))==="formdata"||t==="object"&&O(e.toString)&&e.toString()==="[object FormData]"))},Ut=D("URLSearchParams"),[It,qt,Ht,Vt]=["ReadableStream","Request","Response","Headers"].map(D),zt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e=="undefined")return;let s,o;if(typeof e!="object"&&(e=[e]),I(e))for(s=0,o=e.length;s<o;s++)t.call(null,e[s],s,e);else{const r=n?Object.getOwnPropertyNames(e):Object.keys(e),i=r.length;let c;for(s=0;s<i;s++)c=r[s],t.call(null,e[c],c,e)}}function Ze(e,t){t=t.toLowerCase();const n=Object.keys(e);let s=n.length,o;for(;s-- >0;)if(o=n[s],t===o.toLowerCase())return o;return null}const Qe=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Ye=e=>!X(e)&&e!==Qe;function ye(){const{caseless:e}=Ye(this)&&this||{},t={},n=(s,o)=>{const r=e&&Ze(t,o)||o;G(t[r])&&G(s)?t[r]=ye(t[r],s):G(s)?t[r]=ye({},s):I(s)?t[r]=s.slice():t[r]=s};for(let s=0,o=arguments.length;s<o;s++)arguments[s]&&$(arguments[s],n);return t}const Wt=(e,t,n,{allOwnKeys:s}={})=>($(t,(o,r)=>{n&&O(o)?e[r]=Xe(o,n):e[r]=o},{allOwnKeys:s}),e),Jt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Kt=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},Xt=(e,t,n,s)=>{let o,r,i;const c={};if(t=t||{},e==null)return t;do{for(o=Object.getOwnPropertyNames(e),r=o.length;r-- >0;)i=o[r],(!s||s(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&ve(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},$t=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Gt=e=>{if(!e)return null;if(I(e))return e;let t=e.length;if(!Ge(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Zt=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&ve(Uint8Array)),Qt=(e,t)=>{const s=(e&&e[Symbol.iterator]).call(e);let o;for(;(o=s.next())&&!o.done;){const r=o.value;t.call(e,r[0],r[1])}},Yt=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},en=D("HTMLFormElement"),tn=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,o){return s.toUpperCase()+o}),De=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),nn=D("RegExp"),et=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};$(n,(o,r)=>{let i;(i=t(o,r,e))!==!1&&(s[r]=i||o)}),Object.defineProperties(e,s)},sn=e=>{et(e,(t,n)=>{if(O(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(!!O(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},on=(e,t)=>{const n={},s=o=>{o.forEach(r=>{n[r]=!0})};return I(e)?s(e):s(String(e).split(t)),n},rn=()=>{},an=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,ue="abcdefghijklmnopqrstuvwxyz",Ne="0123456789",tt={DIGIT:Ne,ALPHA:ue,ALPHA_DIGIT:ue+ue.toUpperCase()+Ne},ln=(e=16,t=tt.ALPHA_DIGIT)=>{let n="";const{length:s}=t;for(;e--;)n+=t[Math.random()*s|0];return n};function cn(e){return!!(e&&O(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const dn=e=>{const t=new Array(10),n=(s,o)=>{if(ae(s)){if(t.indexOf(s)>=0)return;if(!("toJSON"in s)){t[o]=s;const r=I(s)?[]:{};return $(s,(i,c)=>{const f=n(i,o+1);!X(f)&&(r[c]=f)}),t[o]=void 0,r}}return s};return n(e,0)},un=D("AsyncFunction"),fn=e=>e&&(ae(e)||O(e))&&O(e.then)&&O(e.catch);var l={isArray:I,isArrayBuffer:$e,isBuffer:At,isFormData:jt,isArrayBufferView:Pt,isString:kt,isNumber:Ge,isBoolean:Dt,isObject:ae,isPlainObject:G,isReadableStream:It,isRequest:qt,isResponse:Ht,isHeaders:Vt,isUndefined:X,isDate:Nt,isFile:Bt,isBlob:Ft,isRegExp:nn,isFunction:O,isStream:Lt,isURLSearchParams:Ut,isTypedArray:Zt,isFileList:Mt,forEach:$,merge:ye,extend:Wt,trim:zt,stripBOM:Jt,inherits:Kt,toFlatObject:Xt,kindOf:re,kindOfTest:D,endsWith:$t,toArray:Gt,forEachEntry:Qt,matchAll:Yt,isHTMLForm:en,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:et,freezeMethods:sn,toObjectSet:on,toCamelCase:tn,noop:rn,toFiniteNumber:an,findKey:Ze,global:Qe,isContextDefined:Ye,ALPHABET:tt,generateString:ln,isSpecCompliantForm:cn,toJSONObject:dn,isAsyncFn:un,isThenable:fn};function g(e,t,n,s,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),o&&(this.response=o)}l.inherits(g,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:l.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const nt=g.prototype,st={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{st[e]={value:e}});Object.defineProperties(g,st);Object.defineProperty(nt,"isAxiosError",{value:!0});g.from=(e,t,n,s,o,r)=>{const i=Object.create(nt);return l.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),g.call(i,e.message,t,n,s,o),i.cause=e,i.name=e.name,r&&Object.assign(i,r),i};var hn=null;function _e(e){return l.isPlainObject(e)||l.isArray(e)}function ot(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function Be(e,t,n){return e?e.concat(t).map(function(o,r){return o=ot(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function mn(e){return l.isArray(e)&&!e.some(_e)}const pn=l.toFlatObject(l,{},null,function(t){return/^is[A-Z]/.test(t)});function le(e,t,n){if(!l.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=l.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(b,v){return!l.isUndefined(v[b])});const s=n.metaTokens,o=n.visitor||d,r=n.dots,i=n.indexes,f=(n.Blob||typeof Blob!="undefined"&&Blob)&&l.isSpecCompliantForm(t);if(!l.isFunction(o))throw new TypeError("visitor must be a function");function h(p){if(p===null)return"";if(l.isDate(p))return p.toISOString();if(!f&&l.isBlob(p))throw new g("Blob is not supported. Use a Buffer instead.");return l.isArrayBuffer(p)||l.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function d(p,b,v){let S=p;if(p&&!v&&typeof p=="object"){if(l.endsWith(b,"{}"))b=s?b:b.slice(0,-2),p=JSON.stringify(p);else if(l.isArray(p)&&mn(p)||(l.isFileList(p)||l.endsWith(b,"[]"))&&(S=l.toArray(p)))return b=ot(b),S.forEach(function(E,H){!(l.isUndefined(E)||E===null)&&t.append(i===!0?Be([b],H,r):i===null?b:b+"[]",h(E))}),!1}return _e(p)?!0:(t.append(Be(v,b,r),h(p)),!1)}const u=[],w=Object.assign(pn,{defaultVisitor:d,convertValue:h,isVisitable:_e});function x(p,b){if(!l.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+b.join("."));u.push(p),l.forEach(p,function(S,B){(!(l.isUndefined(S)||S===null)&&o.call(t,S,l.isString(B)?B.trim():B,b,w))===!0&&x(S,b?b.concat(B):[B])}),u.pop()}}if(!l.isObject(e))throw new TypeError("data must be an object");return x(e),t}function Fe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Se(e,t){this._pairs=[],e&&le(e,this,t)}const rt=Se.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(s){return t.call(this,s,Fe)}:Fe;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function yn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function it(e,t,n){if(!t)return e;const s=n&&n.encode||yn,o=n&&n.serialize;let r;if(o?r=o(t,n):r=l.isURLSearchParams(t)?t.toString():new Se(t,n).toString(s),r){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class _n{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){l.forEach(this.handlers,function(s){s!==null&&t(s)})}}var Me=_n,at={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},gn=typeof URLSearchParams!="undefined"?URLSearchParams:Se,bn=typeof FormData!="undefined"?FormData:null,wn=typeof Blob!="undefined"?Blob:null,xn={isBrowser:!0,classes:{URLSearchParams:gn,FormData:bn,Blob:wn},protocols:["http","https","file","blob","url","data"]};const Te=typeof window!="undefined"&&typeof document!="undefined",En=(e=>Te&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator!="undefined"&&navigator.product),Cn=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),vn=Te&&window.location.href||"http://localhost";var Sn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Te,hasStandardBrowserWebWorkerEnv:Cn,hasStandardBrowserEnv:En,origin:vn},Symbol.toStringTag,{value:"Module"})),P={...Sn,...xn};function Tn(e,t){return le(e,new P.classes.URLSearchParams,Object.assign({visitor:function(n,s,o,r){return P.isNode&&l.isBuffer(n)?(this.append(s,n.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},t))}function Rn(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function On(e){const t={},n=Object.keys(e);let s;const o=n.length;let r;for(s=0;s<o;s++)r=n[s],t[r]=e[r];return t}function lt(e){function t(n,s,o,r){let i=n[r++];if(i==="__proto__")return!0;const c=Number.isFinite(+i),f=r>=n.length;return i=!i&&l.isArray(o)?o.length:i,f?(l.hasOwnProp(o,i)?o[i]=[o[i],s]:o[i]=s,!c):((!o[i]||!l.isObject(o[i]))&&(o[i]=[]),t(n,s,o[i],r)&&l.isArray(o[i])&&(o[i]=On(o[i])),!c)}if(l.isFormData(e)&&l.isFunction(e.entries)){const n={};return l.forEachEntry(e,(s,o)=>{t(Rn(s),o,n,0)}),n}return null}function An(e,t,n){if(l.isString(e))try{return(t||JSON.parse)(e),l.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const Re={transitional:at,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",o=s.indexOf("application/json")>-1,r=l.isObject(t);if(r&&l.isHTMLForm(t)&&(t=new FormData(t)),l.isFormData(t))return o?JSON.stringify(lt(t)):t;if(l.isArrayBuffer(t)||l.isBuffer(t)||l.isStream(t)||l.isFile(t)||l.isBlob(t)||l.isReadableStream(t))return t;if(l.isArrayBufferView(t))return t.buffer;if(l.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(r){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Tn(t,this.formSerializer).toString();if((c=l.isFileList(t))||s.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return le(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return r||o?(n.setContentType("application/json",!1),An(t)):t}],transformResponse:[function(t){const n=this.transitional||Re.transitional,s=n&&n.forcedJSONParsing,o=this.responseType==="json";if(l.isResponse(t)||l.isReadableStream(t))return t;if(t&&l.isString(t)&&(s&&!this.responseType||o)){const i=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?g.from(c,g.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:P.classes.FormData,Blob:P.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};l.forEach(["delete","get","head","post","put","patch"],e=>{Re.headers[e]={}});var Oe=Re;const Pn=l.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var kn=e=>{const t={};let n,s,o;return e&&e.split(`
    22`).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),s=i.substring(o+1).trim(),!(!n||t[n]&&Pn[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t};const Le=Symbol("internals");function W(e){return e&&String(e).trim().toLowerCase()}function Z(e){return e===!1||e==null?e:l.isArray(e)?e.map(Z):String(e)}function Dn(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const Nn=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function fe(e,t,n,s,o){if(l.isFunction(s))return s.call(this,t,n);if(o&&(t=n),!!l.isString(t)){if(l.isString(s))return t.indexOf(s)!==-1;if(l.isRegExp(s))return s.test(t)}}function Bn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Fn(e,t){const n=l.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(o,r,i){return this[s].call(this,t,o,r,i)},configurable:!0})})}class ce{constructor(t){t&&this.set(t)}set(t,n,s){const o=this;function r(c,f,h){const d=W(f);if(!d)throw new Error("header name must be a non-empty string");const u=l.findKey(o,d);(!u||o[u]===void 0||h===!0||h===void 0&&o[u]!==!1)&&(o[u||f]=Z(c))}const i=(c,f)=>l.forEach(c,(h,d)=>r(h,d,f));if(l.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(l.isString(t)&&(t=t.trim())&&!Nn(t))i(kn(t),n);else if(l.isHeaders(t))for(const[c,f]of t.entries())r(f,c,s);else t!=null&&r(n,t,s);return this}get(t,n){if(t=W(t),t){const s=l.findKey(this,t);if(s){const o=this[s];if(!n)return o;if(n===!0)return Dn(o);if(l.isFunction(n))return n.call(this,o,s);if(l.isRegExp(n))return n.exec(o);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=W(t),t){const s=l.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||fe(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let o=!1;function r(i){if(i=W(i),i){const c=l.findKey(s,i);c&&(!n||fe(s,s[c],c,n))&&(delete s[c],o=!0)}}return l.isArray(t)?t.forEach(r):r(t),o}clear(t){const n=Object.keys(this);let s=n.length,o=!1;for(;s--;){const r=n[s];(!t||fe(this,this[r],r,t,!0))&&(delete this[r],o=!0)}return o}normalize(t){const n=this,s={};return l.forEach(this,(o,r)=>{const i=l.findKey(s,r);if(i){n[i]=Z(o),delete n[r];return}const c=t?Bn(r):String(r).trim();c!==r&&delete n[r],n[c]=Z(o),s[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return l.forEach(this,(s,o)=>{s!=null&&s!==!1&&(n[o]=t&&l.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
    3 `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Le]=this[Le]={accessors:{}}).accessors,o=this.prototype;function r(i){const c=W(i);s[c]||(Fn(o,i),s[c]=!0)}return l.isArray(t)?t.forEach(r):r(t),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);l.reduceDescriptors(ce.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});l.freezeMethods(ce);var k=ce;function he(e,t){const n=this||Oe,s=t||n,o=k.from(s.headers);let r=s.data;return l.forEach(e,function(c){r=c.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function ct(e){return!!(e&&e.__CANCEL__)}function q(e,t,n){g.call(this,e==null?"canceled":e,g.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(q,g,{__CANCEL__:!0});function dt(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new g("Request failed with status code "+n.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Mn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ln(e,t){e=e||10;const n=new Array(e),s=new Array(e);let o=0,r=0,i;return t=t!==void 0?t:1e3,function(f){const h=Date.now(),d=s[r];i||(i=h),n[o]=f,s[o]=h;let u=r,w=0;for(;u!==o;)w+=n[u++],u=u%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),h-i<t)return;const x=d&&h-d;return x?Math.round(w*1e3/x):void 0}}function jn(e,t){let n=0;const s=1e3/t;let o=null;return function(){const i=this===!0,c=Date.now();if(i||c-n>s)return o&&(clearTimeout(o),o=null),n=c,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),s-(c-n)))}}var Y=(e,t,n=3)=>{let s=0;const o=Ln(50,250);return jn(r=>{const i=r.loaded,c=r.lengthComputable?r.total:void 0,f=i-s,h=o(f),d=i<=c;s=i;const u={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:h||void 0,estimated:h&&c&&d?(c-i)/h:void 0,event:r,lengthComputable:c!=null};u[t?"download":"upload"]=!0,e(u)},n)},Un=P.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let s;function o(r){let i=r;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=o(window.location.href),function(i){const c=l.isString(i)?o(i):i;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}(),In=P.hasStandardBrowserEnv?{write(e,t,n,s,o,r){const i=[e+"="+encodeURIComponent(t)];l.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),l.isString(s)&&i.push("path="+s),l.isString(o)&&i.push("domain="+o),r===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function qn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Hn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ut(e,t){return e&&!qn(t)?Hn(e,t):t}const je=e=>e instanceof k?{...e}:e;function j(e,t){t=t||{};const n={};function s(h,d,u){return l.isPlainObject(h)&&l.isPlainObject(d)?l.merge.call({caseless:u},h,d):l.isPlainObject(d)?l.merge({},d):l.isArray(d)?d.slice():d}function o(h,d,u){if(l.isUndefined(d)){if(!l.isUndefined(h))return s(void 0,h,u)}else return s(h,d,u)}function r(h,d){if(!l.isUndefined(d))return s(void 0,d)}function i(h,d){if(l.isUndefined(d)){if(!l.isUndefined(h))return s(void 0,h)}else return s(void 0,d)}function c(h,d,u){if(u in t)return s(h,d);if(u in e)return s(void 0,h)}const f={url:r,method:r,data:r,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(h,d)=>o(je(h),je(d),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(d){const u=f[d]||o,w=u(e[d],t[d],d);l.isUndefined(w)&&u!==c||(n[d]=w)}),n}var ft=e=>{const t=j({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:r,headers:i,auth:c}=t;t.headers=i=k.from(i),t.url=it(ut(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(l.isFormData(n)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[h,...d]=f?f.split(";").map(u=>u.trim()).filter(Boolean):[];i.setContentType([h||"multipart/form-data",...d].join("; "))}}if(P.hasStandardBrowserEnv&&(s&&l.isFunction(s)&&(s=s(t)),s||s!==!1&&Un(t.url))){const h=o&&r&&In.read(r);h&&i.set(o,h)}return t};const Vn=typeof XMLHttpRequest!="undefined";var zn=Vn&&function(e){return new Promise(function(n,s){const o=ft(e);let r=o.data;const i=k.from(o.headers).normalize();let{responseType:c}=o,f;function h(){o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let d=new XMLHttpRequest;d.open(o.method.toUpperCase(),o.url,!0),d.timeout=o.timeout;function u(){if(!d)return;const x=k.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),b={data:!c||c==="text"||c==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:x,config:e,request:d};dt(function(S){n(S),h()},function(S){s(S),h()},b),d=null}"onloadend"in d?d.onloadend=u:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(u)},d.onabort=function(){!d||(s(new g("Request aborted",g.ECONNABORTED,o,d)),d=null)},d.onerror=function(){s(new g("Network Error",g.ERR_NETWORK,o,d)),d=null},d.ontimeout=function(){let p=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||at;o.timeoutErrorMessage&&(p=o.timeoutErrorMessage),s(new g(p,b.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,o,d)),d=null},r===void 0&&i.setContentType(null),"setRequestHeader"in d&&l.forEach(i.toJSON(),function(p,b){d.setRequestHeader(b,p)}),l.isUndefined(o.withCredentials)||(d.withCredentials=!!o.withCredentials),c&&c!=="json"&&(d.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&d.addEventListener("progress",Y(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Y(o.onUploadProgress)),(o.cancelToken||o.signal)&&(f=x=>{!d||(s(!x||x.type?new q(null,e,d):x),d.abort(),d=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const w=Mn(o.url);if(w&&P.protocols.indexOf(w)===-1){s(new g("Unsupported protocol "+w+":",g.ERR_BAD_REQUEST,e));return}d.send(r||null)})};const Wn=(e,t)=>{let n=new AbortController,s;const o=function(f){if(!s){s=!0,i();const h=f instanceof Error?f:this.reason;n.abort(h instanceof g?h:new q(h instanceof Error?h.message:h))}};let r=t&&setTimeout(()=>{o(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const i=()=>{e&&(r&&clearTimeout(r),r=null,e.forEach(f=>{f&&(f.removeEventListener?f.removeEventListener("abort",o):f.unsubscribe(o))}),e=null)};e.forEach(f=>f&&f.addEventListener&&f.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=i,[c,()=>{r&&clearTimeout(r),r=null}]};var Jn=Wn;const Kn=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let s=0,o;for(;s<n;)o=s+t,yield e.slice(s,o),s=o},Xn=async function*(e,t,n){for await(const s of e)yield*Kn(ArrayBuffer.isView(s)?s:await n(String(s)),t)},Ue=(e,t,n,s,o)=>{const r=Xn(e,t,o);let i=0;return new ReadableStream({type:"bytes",async pull(c){const{done:f,value:h}=await r.next();if(f){c.close(),s();return}let d=h.byteLength;n&&n(i+=d),c.enqueue(new Uint8Array(h))},cancel(c){return s(c),r.return()}},{highWaterMark:2})},Ie=(e,t)=>{const n=e!=null;return s=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:s}))},de=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ht=de&&typeof ReadableStream=="function",ge=de&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),$n=ht&&(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),qe=64*1024,be=ht&&!!(()=>{try{return l.isReadableStream(new Response("").body)}catch{}})(),ee={stream:be&&(e=>e.body)};de&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ee[t]&&(ee[t]=l.isFunction(e[t])?n=>n[t]():(n,s)=>{throw new g(`Response type '${t}' is not supported`,g.ERR_NOT_SUPPORT,s)})})})(new Response);const Gn=async e=>{if(e==null)return 0;if(l.isBlob(e))return e.size;if(l.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(l.isArrayBufferView(e))return e.byteLength;if(l.isURLSearchParams(e)&&(e=e+""),l.isString(e))return(await ge(e)).byteLength},Zn=async(e,t)=>{const n=l.toFiniteNumber(e.getContentLength());return n==null?Gn(t):n};var Qn=de&&(async e=>{let{url:t,method:n,data:s,signal:o,cancelToken:r,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:h,headers:d,withCredentials:u="same-origin",fetchOptions:w}=ft(e);h=h?(h+"").toLowerCase():"text";let[x,p]=o||r||i?Jn([o,r],i):[],b,C;const S=()=>{!b&&setTimeout(()=>{x&&x.unsubscribe()}),b=!0};let B;try{if(f&&$n&&n!=="get"&&n!=="head"&&(B=await Zn(d,s))!==0){let F=new Request(t,{method:"POST",body:s,duplex:"half"}),U;l.isFormData(s)&&(U=F.headers.get("content-type"))&&d.setContentType(U),F.body&&(s=Ue(F.body,qe,Ie(B,Y(f)),null,ge))}l.isString(u)||(u=u?"cors":"omit"),C=new Request(t,{...w,signal:x,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:s,duplex:"half",withCredentials:u});let E=await fetch(C);const H=be&&(h==="stream"||h==="response");if(be&&(c||H)){const F={};["status","statusText","headers"].forEach(ke=>{F[ke]=E[ke]});const U=l.toFiniteNumber(E.headers.get("content-length"));E=new Response(Ue(E.body,qe,c&&Ie(U,Y(c,!0)),H&&S,ge),F)}h=h||"text";let _t=await ee[l.findKey(ee,h)||"text"](E,e);return!H&&S(),p&&p(),await new Promise((F,U)=>{dt(F,U,{data:_t,headers:k.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:C})})}catch(E){throw S(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,e,C),{cause:E.cause||E}):g.from(E,E&&E.code,e,C)}});const we={http:hn,xhr:zn,fetch:Qn};l.forEach(we,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,Yn=e=>l.isFunction(e)||e===null||e===!1;var mt={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,s;const o={};for(let r=0;r<t;r++){n=e[r];let i;if(s=n,!Yn(n)&&(s=we[(i=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${i}'`);if(s)break;o[i||"#"+r]=s}if(!s){const r=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?r.length>1?`since :
     3`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(o=>s.set(o)),s}static accessor(t){const s=(this[Le]=this[Le]={accessors:{}}).accessors,o=this.prototype;function r(i){const c=W(i);s[c]||(Fn(o,i),s[c]=!0)}return l.isArray(t)?t.forEach(r):r(t),this}}ce.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);l.reduceDescriptors(ce.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});l.freezeMethods(ce);var k=ce;function he(e,t){const n=this||Oe,s=t||n,o=k.from(s.headers);let r=s.data;return l.forEach(e,function(c){r=c.call(n,r,o.normalize(),t?t.status:void 0)}),o.normalize(),r}function ct(e){return!!(e&&e.__CANCEL__)}function q(e,t,n){g.call(this,e==null?"canceled":e,g.ERR_CANCELED,t,n),this.name="CanceledError"}l.inherits(q,g,{__CANCEL__:!0});function dt(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new g("Request failed with status code "+n.status,[g.ERR_BAD_REQUEST,g.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Mn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Ln(e,t){e=e||10;const n=new Array(e),s=new Array(e);let o=0,r=0,i;return t=t!==void 0?t:1e3,function(f){const h=Date.now(),d=s[r];i||(i=h),n[o]=f,s[o]=h;let u=r,w=0;for(;u!==o;)w+=n[u++],u=u%e;if(o=(o+1)%e,o===r&&(r=(r+1)%e),h-i<t)return;const x=d&&h-d;return x?Math.round(w*1e3/x):void 0}}function jn(e,t){let n=0;const s=1e3/t;let o=null;return function(){const i=this===!0,c=Date.now();if(i||c-n>s)return o&&(clearTimeout(o),o=null),n=c,e.apply(null,arguments);o||(o=setTimeout(()=>(o=null,n=Date.now(),e.apply(null,arguments)),s-(c-n)))}}var Y=(e,t,n=3)=>{let s=0;const o=Ln(50,250);return jn(r=>{const i=r.loaded,c=r.lengthComputable?r.total:void 0,f=i-s,h=o(f),d=i<=c;s=i;const u={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:h||void 0,estimated:h&&c&&d?(c-i)/h:void 0,event:r,lengthComputable:c!=null};u[t?"download":"upload"]=!0,e(u)},n)},Un=P.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let s;function o(r){let i=r;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return s=o(window.location.href),function(i){const c=l.isString(i)?o(i):i;return c.protocol===s.protocol&&c.host===s.host}}():function(){return function(){return!0}}(),In=P.hasStandardBrowserEnv?{write(e,t,n,s,o,r){const i=[e+"="+encodeURIComponent(t)];l.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),l.isString(s)&&i.push("path="+s),l.isString(o)&&i.push("domain="+o),r===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function qn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Hn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ut(e,t){return e&&!qn(t)?Hn(e,t):t}const je=e=>e instanceof k?{...e}:e;function j(e,t){t=t||{};const n={};function s(h,d,u){return l.isPlainObject(h)&&l.isPlainObject(d)?l.merge.call({caseless:u},h,d):l.isPlainObject(d)?l.merge({},d):l.isArray(d)?d.slice():d}function o(h,d,u){if(l.isUndefined(d)){if(!l.isUndefined(h))return s(void 0,h,u)}else return s(h,d,u)}function r(h,d){if(!l.isUndefined(d))return s(void 0,d)}function i(h,d){if(l.isUndefined(d)){if(!l.isUndefined(h))return s(void 0,h)}else return s(void 0,d)}function c(h,d,u){if(u in t)return s(h,d);if(u in e)return s(void 0,h)}const f={url:r,method:r,data:r,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(h,d)=>o(je(h),je(d),!0)};return l.forEach(Object.keys(Object.assign({},e,t)),function(d){const u=f[d]||o,w=u(e[d],t[d],d);l.isUndefined(w)&&u!==c||(n[d]=w)}),n}var ft=e=>{const t=j({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:r,headers:i,auth:c}=t;t.headers=i=k.from(i),t.url=it(ut(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(l.isFormData(n)){if(P.hasStandardBrowserEnv||P.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[h,...d]=f?f.split(";").map(u=>u.trim()).filter(Boolean):[];i.setContentType([h||"multipart/form-data",...d].join("; "))}}if(P.hasStandardBrowserEnv&&(s&&l.isFunction(s)&&(s=s(t)),s||s!==!1&&Un(t.url))){const h=o&&r&&In.read(r);h&&i.set(o,h)}return t};const Vn=typeof XMLHttpRequest!="undefined";var zn=Vn&&function(e){return new Promise(function(n,s){const o=ft(e);let r=o.data;const i=k.from(o.headers).normalize();let{responseType:c}=o,f;function h(){o.cancelToken&&o.cancelToken.unsubscribe(f),o.signal&&o.signal.removeEventListener("abort",f)}let d=new XMLHttpRequest;d.open(o.method.toUpperCase(),o.url,!0),d.timeout=o.timeout;function u(){if(!d)return;const x=k.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),b={data:!c||c==="text"||c==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:x,config:e,request:d};dt(function(S){n(S),h()},function(S){s(S),h()},b),d=null}"onloadend"in d?d.onloadend=u:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(u)},d.onabort=function(){!d||(s(new g("Request aborted",g.ECONNABORTED,o,d)),d=null)},d.onerror=function(){s(new g("Network Error",g.ERR_NETWORK,o,d)),d=null},d.ontimeout=function(){let p=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";const b=o.transitional||at;o.timeoutErrorMessage&&(p=o.timeoutErrorMessage),s(new g(p,b.clarifyTimeoutError?g.ETIMEDOUT:g.ECONNABORTED,o,d)),d=null},r===void 0&&i.setContentType(null),"setRequestHeader"in d&&l.forEach(i.toJSON(),function(p,b){d.setRequestHeader(b,p)}),l.isUndefined(o.withCredentials)||(d.withCredentials=!!o.withCredentials),c&&c!=="json"&&(d.responseType=o.responseType),typeof o.onDownloadProgress=="function"&&d.addEventListener("progress",Y(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Y(o.onUploadProgress)),(o.cancelToken||o.signal)&&(f=x=>{!d||(s(!x||x.type?new q(null,e,d):x),d.abort(),d=null)},o.cancelToken&&o.cancelToken.subscribe(f),o.signal&&(o.signal.aborted?f():o.signal.addEventListener("abort",f)));const w=Mn(o.url);if(w&&P.protocols.indexOf(w)===-1){s(new g("Unsupported protocol "+w+":",g.ERR_BAD_REQUEST,e));return}d.send(r||null)})};const Wn=(e,t)=>{let n=new AbortController,s;const o=function(f){if(!s){s=!0,i();const h=f instanceof Error?f:this.reason;n.abort(h instanceof g?h:new q(h instanceof Error?h.message:h))}};let r=t&&setTimeout(()=>{o(new g(`timeout ${t} of ms exceeded`,g.ETIMEDOUT))},t);const i=()=>{e&&(r&&clearTimeout(r),r=null,e.forEach(f=>{f&&(f.removeEventListener?f.removeEventListener("abort",o):f.unsubscribe(o))}),e=null)};e.forEach(f=>f&&f.addEventListener&&f.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=i,[c,()=>{r&&clearTimeout(r),r=null}]};var Jn=Wn;const Kn=function*(e,t){let n=e.byteLength;if(!t||n<t){yield e;return}let s=0,o;for(;s<n;)o=s+t,yield e.slice(s,o),s=o},Xn=async function*(e,t,n){for await(const s of e)yield*Kn(ArrayBuffer.isView(s)?s:await n(String(s)),t)},Ue=(e,t,n,s,o)=>{const r=Xn(e,t,o);let i=0;return new ReadableStream({type:"bytes",async pull(c){const{done:f,value:h}=await r.next();if(f){c.close(),s();return}let d=h.byteLength;n&&n(i+=d),c.enqueue(new Uint8Array(h))},cancel(c){return s(c),r.return()}},{highWaterMark:2})},Ie=(e,t)=>{const n=e!=null;return s=>setTimeout(()=>t({lengthComputable:n,total:e,loaded:s}))},de=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ht=de&&typeof ReadableStream=="function",ge=de&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),$n=ht&&(()=>{let e=!1;const t=new Request(P.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})(),qe=64*1024,be=ht&&!!(()=>{try{return l.isReadableStream(new Response("").body)}catch{}})(),ee={stream:be&&(e=>e.body)};de&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!ee[t]&&(ee[t]=l.isFunction(e[t])?n=>n[t]():(n,s)=>{throw new g(`Response type '${t}' is not supported`,g.ERR_NOT_SUPPORT,s)})})})(new Response);const Gn=async e=>{if(e==null)return 0;if(l.isBlob(e))return e.size;if(l.isSpecCompliantForm(e))return(await new Request(e).arrayBuffer()).byteLength;if(l.isArrayBufferView(e))return e.byteLength;if(l.isURLSearchParams(e)&&(e=e+""),l.isString(e))return(await ge(e)).byteLength},Zn=async(e,t)=>{const n=l.toFiniteNumber(e.getContentLength());return n==null?Gn(t):n};var Qn=de&&(async e=>{let{url:t,method:n,data:s,signal:o,cancelToken:r,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:h,headers:d,withCredentials:u="same-origin",fetchOptions:w}=ft(e);h=h?(h+"").toLowerCase():"text";let[x,p]=o||r||i?Jn([o,r],i):[],b,v;const S=()=>{!b&&setTimeout(()=>{x&&x.unsubscribe()}),b=!0};let B;try{if(f&&$n&&n!=="get"&&n!=="head"&&(B=await Zn(d,s))!==0){let F=new Request(t,{method:"POST",body:s,duplex:"half"}),U;l.isFormData(s)&&(U=F.headers.get("content-type"))&&d.setContentType(U),F.body&&(s=Ue(F.body,qe,Ie(B,Y(f)),null,ge))}l.isString(u)||(u=u?"cors":"omit"),v=new Request(t,{...w,signal:x,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:s,duplex:"half",withCredentials:u});let E=await fetch(v);const H=be&&(h==="stream"||h==="response");if(be&&(c||H)){const F={};["status","statusText","headers"].forEach(ke=>{F[ke]=E[ke]});const U=l.toFiniteNumber(E.headers.get("content-length"));E=new Response(Ue(E.body,qe,c&&Ie(U,Y(c,!0)),H&&S,ge),F)}h=h||"text";let _t=await ee[l.findKey(ee,h)||"text"](E,e);return!H&&S(),p&&p(),await new Promise((F,U)=>{dt(F,U,{data:_t,headers:k.from(E.headers),status:E.status,statusText:E.statusText,config:e,request:v})})}catch(E){throw S(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new g("Network Error",g.ERR_NETWORK,e,v),{cause:E.cause||E}):g.from(E,E&&E.code,e,v)}});const we={http:hn,xhr:zn,fetch:Qn};l.forEach(we,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,Yn=e=>l.isFunction(e)||e===null||e===!1;var mt={getAdapter:e=>{e=l.isArray(e)?e:[e];const{length:t}=e;let n,s;const o={};for(let r=0;r<t;r++){n=e[r];let i;if(s=n,!Yn(n)&&(s=we[(i=String(n)).toLowerCase()],s===void 0))throw new g(`Unknown adapter '${i}'`);if(s)break;o[i||"#"+r]=s}if(!s){const r=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?r.length>1?`since :
    44`+r.map(He).join(`
    55`):" "+He(r[0]):"as no adapter specified";throw new g("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return s},adapters:we};function me(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new q(null,e)}function Ve(e){return me(e),e.headers=k.from(e.headers),e.data=he.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mt.getAdapter(e.adapter||Oe.adapter)(e).then(function(s){return me(e),s.data=he.call(e,e.transformResponse,s),s.headers=k.from(s.headers),s},function(s){return ct(s)||(me(e),s&&s.response&&(s.response.data=he.call(e,e.transformResponse,s.response),s.response.headers=k.from(s.response.headers))),Promise.reject(s)})}const pt="1.7.2",Ae={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Ae[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const ze={};Ae.transitional=function(t,n,s){function o(r,i){return"[Axios v"+pt+"] Transitional option '"+r+"'"+i+(s?". "+s:"")}return(r,i,c)=>{if(t===!1)throw new g(o(i," has been removed"+(n?" in "+n:"")),g.ERR_DEPRECATED);return n&&!ze[i]&&(ze[i]=!0,console.warn(o(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(r,i,c):!0}};function es(e,t,n){if(typeof e!="object")throw new g("options must be an object",g.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let o=s.length;for(;o-- >0;){const r=s[o],i=t[r];if(i){const c=e[r],f=c===void 0||i(c,r,e);if(f!==!0)throw new g("option "+r+" must be "+f,g.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new g("Unknown option "+r,g.ERR_BAD_OPTION)}}var xe={assertOptions:es,validators:Ae};const M=xe.validators;class te{constructor(t){this.defaults=t,this.interceptors={request:new Me,response:new Me}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let o;Error.captureStackTrace?Error.captureStackTrace(o={}):o=new Error;const r=o.stack?o.stack.replace(/^.+\n/,""):"";try{s.stack?r&&!String(s.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(s.stack+=`
    6 `+r):s.stack=r}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:r}=n;s!==void 0&&xe.assertOptions(s,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:xe.assertOptions(o,{encode:M.function,serialize:M.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=r&&l.merge(r.common,r[n.method]);r&&l.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),n.headers=k.concat(i,r);const c=[];let f=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(f=f&&b.synchronous,c.unshift(b.fulfilled,b.rejected))});const h=[];this.interceptors.response.forEach(function(b){h.push(b.fulfilled,b.rejected)});let d,u=0,w;if(!f){const p=[Ve.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,h),w=p.length,d=Promise.resolve(n);u<w;)d=d.then(p[u++],p[u++]);return d}w=c.length;let x=n;for(u=0;u<w;){const p=c[u++],b=c[u++];try{x=p(x)}catch(C){b.call(this,C);break}}try{d=Ve.call(this,x)}catch(p){return Promise.reject(p)}for(u=0,w=h.length;u<w;)d=d.then(h[u++],h[u++]);return d}getUri(t){t=j(this.defaults,t);const n=ut(t.baseURL,t.url);return it(n,t.params,t.paramsSerializer)}}l.forEach(["delete","get","head","options"],function(t){te.prototype[t]=function(n,s){return this.request(j(s||{},{method:t,url:n,data:(s||{}).data}))}});l.forEach(["post","put","patch"],function(t){function n(s){return function(r,i,c){return this.request(j(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}te.prototype[t]=n(),te.prototype[t+"Form"]=n(!0)});var Q=te;class Pe{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const s=this;this.promise.then(o=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](o);s._listeners=null}),this.promise.then=o=>{let r;const i=new Promise(c=>{s.subscribe(c),r=c}).then(o);return i.cancel=function(){s.unsubscribe(r)},i},t(function(r,i,c){s.reason||(s.reason=new q(r,i,c),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Pe(function(o){t=o}),cancel:t}}}var ts=Pe;function ns(e){return function(n){return e.apply(null,n)}}function ss(e){return l.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});var os=Ee;function yt(e){const t=new Q(e),n=Xe(Q.prototype.request,t);return l.extend(n,Q.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return yt(j(e,o))},n}const v=yt(Oe);v.Axios=Q;v.CanceledError=q;v.CancelToken=ts;v.isCancel=ct;v.VERSION=pt;v.toFormData=le;v.AxiosError=g;v.Cancel=v.CanceledError;v.all=function(t){return Promise.all(t)};v.spread=ns;v.isAxiosError=ss;v.mergeConfig=j;v.AxiosHeaders=k;v.formToJSON=e=>lt(l.isHTMLForm(e)?new FormData(e):e);v.getAdapter=mt.getAdapter;v.HttpStatusCode=os;v.default=v;var We=v;const rs={data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{formData:{siret:"",company_name:"",siren_number:"",manager_name:"",address:"",city:"",postal_code:"",country:"",phone:"",mobile_phone:"",email:"",website:"",currency_id:"",note:"",user_create:""},fields:{company_name:{label:e.company_name,type:"text",required:!0},manager_name:{label:e.manager_name,type:"text"},address:{label:e.address,type:"text",required:!0},city:{label:e.city,type:"text",required:!0},postal_code:{label:e.postal_code,type:"text"},country:{label:e.country,type:"text"},phone:{label:e.phone,type:"tel",required:!0},mobile_phone:{label:e.mobile,type:"tel"},email:{label:e.email,type:"email",required:!0},website:{label:e.website,type:"url"},currency_id:{label:e.currency,type:"text",required:!0}},options:{currency_options:[],default_currency:"",addon_user_active:!1,addon_siret_active:!1},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},loadingBtn:!1,loadingSiret:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{submitForm(){this.loadingBtn=!0,We.post("/wp-json/my-easy-compta/v1/clients/add",this.formData,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{e.data.success?(this.showToast(e.data.message,"alert-success"),this.loadingBtn=!1,this.resetForm(),this.closeModal(),this.$emit("clientAdded")):(this.showToast(e.data.message,"alert-error"),this.loadingBtn=!1)}).catch(e=>{const t=e.response&&e.response.data&&e.response.data.message?e.response.data.message:"Erreur serveur";console.error(e),this.showToast(t,"alert-error"),this.loadingBtn=!1})},closeModal(){document.getElementById("modal_clients").close()},showToast(e,t){this.toast.message=e,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},resetForm(){for(let e in this.formData)this.formData[e]=""},getOptions(e){return e==="currency_id"?this.options.currency_options:[]},fetchOptions(){We.get("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{this.options.currency_options=e.data.currency_options,this.options.default_currency=e.data.default_currency,this.options.addon_user_active=e.data.addon_user_active,this.options.addon_siret_active=e.data.addon_siret_active}).catch(e=>{console.error("Erreur lors de la r\xE9cup\xE9ration des options",e)})},fetchCompanyInfo(e){e.preventDefault(),this.loadingSiret=!0;const t=this.formData.siret;t?fetch(`/wp-json/my-easy-compta/v1/fetch-company-info/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.json()}).then(n=>{n?(this.formData.company_name=n.company_name,this.formData.manager_name=n.manager_name,this.formData.address=n.address,this.formData.postal_code=n.postal_code,this.formData.city=n.city,this.formData.siren_number=n.siren,this.showToast("Informations charg\xE9es avec succ\xE8s","alert-success"),this.loadingSiret=!1):(this.showToast("Aucune information trouv\xE9e pour ce SIRET","alert-error"),this.loadingSiret=!1)}).catch(n=>{console.error("Error fetching company info:",n),this.showToast("Erreur lors du chargement des informations","alert-error"),this.loadingSiret=!1}):(this.showToast("Veuillez saisir un num\xE9ro SIRET","alert-error"),this.loadingSiret=!1)}},mounted(){this.fetchOptions()}},is={id:"modal_clients",class:"modal"},as={class:"modal-box"},ls={class:"font-bold text-lg"},cs={key:0,class:"grid grid-cols-1 gap-4"},ds={class:"ecwp-group form-group relative join"},us={for:"siret",class:"ecwp-label form-label"},fs=["disabled"],hs={key:0,class:"loading loading-spinner loading-sm"},ms={key:1},ps={class:"grid grid-cols-1 gap-4"},ys={class:"ecwp-group form-group relative"},_s={for:"siren",class:"ecwp-label form-label"},gs={class:"grid grid-cols-1 gap-4"},bs={class:"ecwp-group form-group relative"},ws={for:"tax_number",class:"ecwp-label form-label"},xs={class:"grid grid-cols-2 gap-4"},Es=["for"],vs=["id","onUpdate:modelValue","required"],Cs=["value"],Ss=["value"],Ts=["type","id","onUpdate:modelValue","required"],Rs={class:"ecwp-group form-group mt-4 relative"},Os=["for"],As={key:1,class:"ecwp-group form-group mt-6 w-52 flex justify-between"},Ps={class:"form-group mt-4 flex justify-end"},ks=["disabled"],Ds={key:0,class:"loading loading-spinner loading-sm"};function Ns(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),a("dialog",is,[a("div",as,[a("h3",ls,m(r.translations.new_client),1),a("form",{onSubmit:t[7]||(t[7]=Je((...i)=>r.submitForm&&r.submitForm(...i),["prevent"]))},[a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),o.options.addon_siret_active?(y(),_("div",cs,[a("div",ds,[a("label",us,m(r.translations.siret),1),A(a("input",{type:"number",id:"siret","onUpdate:modelValue":t[1]||(t[1]=i=>o.formData.siret=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.siret]]),a("button",{onClick:t[2]||(t[2]=(...i)=>r.fetchCompanyInfo&&r.fetchCompanyInfo(...i)),class:"btn join-item rounded-r-full mt-5",disabled:o.loadingSiret},[o.loadingSiret?(y(),_("span",hs)):(y(),_("span",ms,m(r.translations.search),1))],8,fs)])])):N("",!0),a("div",ps,[a("div",ys,[a("label",_s,m(r.translations.siren),1),A(a("input",{type:"number",id:"siren","onUpdate:modelValue":t[3]||(t[3]=i=>o.formData.siren_number=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.siren_number]])])]),a("div",gs,[a("div",bs,[a("label",ws,m(r.translations.tax_number),1),A(a("input",{type:"text",id:"tax_number","onUpdate:modelValue":t[4]||(t[4]=i=>o.formData.tax_number=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.tax_number]])])]),a("div",xs,[(y(!0),_(T,null,R(o.fields,(i,c)=>(y(),_("div",{key:c,class:"ecwp-group form-group relative"},[a("label",{for:c,class:"ecwp-label form-label"},m(i.label),9,Es),c==="currency_id"?A((y(),_("select",{key:0,id:c,"onUpdate:modelValue":f=>o.formData[c]=f,class:"ecwp-input input input-bordered w-full peer",required:i.required},[a("option",{value:o.options.default_currency},m(r.translations.default_currency),9,Cs),(y(!0),_(T,null,R(r.getOptions(c),f=>(y(),_("option",{key:f.id,value:f.id},m(f.name)+" - "+m(f.code)+" ("+m(f.symbol)+") ",9,Ss))),128))],8,vs)),[[ve,o.formData[c]]]):A((y(),_("input",{key:1,type:i.type,id:c,"onUpdate:modelValue":f=>o.formData[c]=f,class:"ecwp-input input input-bordered w-full peer",placeholder:" ",required:i.required},null,8,Ts)),[[Ke,o.formData[c]]])]))),128))]),a("div",Rs,[a("label",{for:e.key,class:"ecwp-label form-label"},m(r.translations.note),9,Os),A(a("textarea",{id:"note","onUpdate:modelValue":t[5]||(t[5]=i=>o.formData.note=i),class:"ecwp-input textarea textarea-bordered w-full peer",rows:"4",placeholder:" "},null,512),[[J,o.formData.note]])]),o.options.addon_user_active?(y(),_("div",As,[a("label",null,m(r.translations.create_user),1),A(a("input",{class:"ecwp-switch",type:"checkbox","onUpdate:modelValue":t[6]||(t[6]=i=>o.formData.user_create=i)},null,512),[[gt,o.formData.user_create]])])):N("",!0),a("div",Ps,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(m(r.translations.add)+" ",1),o.loadingBtn?(y(),_("span",Ds)):N("",!0)],8,ks)])],32)])])])}var Bs=oe(rs,[["render",Ns]]);const Fs={props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,client:Object,currencyOptions:{type:Array,default:()=>[]}},data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{addon_siret_active:"",localCurrencyOptions:this.currencyOptions,translations:e}},computed:{skeletonItems(){return Array.from({length:7},(e,t)=>t)},fields(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{company_name:{label:e.company_name},manager_name:{label:e.manager_name},email:{label:e.email},phone:{label:e.phone},mobile_phone:{label:e.mobile},website:{label:e.website},address:{label:e.address},city:{label:e.city},postal_code:{label:e.postal_code},country:{label:e.country}}}},mounted(){this.fetchOptions()},methods:{closeModal(){const e=document.getElementById(this.modalId);e&&(e.close(),this.$emit("close"))},fetchOptions(){fetch("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e.currency_options&&(this.localCurrencyOptions=e.currency_options,this.addon_siret_active=e.addon_siret_active)}).catch(e=>{console.error("Erreur lors de la r\xE9cup\xE9ration des options",e)})},getCurrencyOption(e){const t=this.localCurrencyOptions.find(n=>n.id===e);return t?t.name:"N/A"}}},Ms=["id","open"],Ls={class:"modal-box"},js={class:"font-bold text-lg"},Us={key:0},Is={class:"grid grid-cols-2 gap-4"},qs=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Hs=a("div",{class:"skeleton h-4 w-full"},null,-1),Vs=[qs,Hs],zs={key:1},Ws={class:"grid grid-cols-2 gap-4"},Js={key:0,class:"py-2"},Ks={class:"text-sm font-medium text-gray-500"},Xs={class:"mt-1 text-sm text-gray-900"},$s=a("dl",{class:"divide-y divide-gray-200"},null,-1),Gs={key:1,class:"py-2"},Zs={class:"text-sm font-medium text-gray-500"},Qs={class:"mt-1 text-sm text-gray-900"},Ys=a("dl",{class:"divide-y divide-gray-200"},null,-1),eo={class:"grid grid-cols-1 gap-4"},to={key:0,class:"py-2"},no={class:"text-sm font-medium text-gray-500"},so={class:"mt-1 text-sm text-gray-900"},oo=a("dl",{class:"divide-y divide-gray-200"},null,-1),ro={class:"grid grid-cols-2 gap-4"},io={class:"text-sm font-medium text-gray-500"},ao={class:"mt-1 text-sm text-gray-900"},lo=a("dl",{class:"divide-y divide-gray-200"},null,-1),co={class:"grid grid-cols-2 gap-4"},uo={class:"py-2"},fo={class:"text-sm font-medium text-gray-500"},ho={class:"mt-1 text-sm text-gray-900"},mo=a("dl",{class:"divide-y divide-gray-200"},null,-1),po={class:"py-2"},yo={class:"text-sm font-medium text-gray-500"},_o={class:"mt-1 text-sm text-gray-900"},go=a("dl",{class:"divide-y divide-gray-200"},null,-1),bo={key:2},wo={class:"grid grid-cols-2 gap-4"},xo=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Eo=a("div",{class:"skeleton h-4 w-full"},null,-1),vo=[xo,Eo];function Co(e,t,n,s,o,r){return y(),_("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Ls,[a("h3",js,m(n.modalTitle),1),a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),n.loading?(y(),_("div",Us,[a("div",Is,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Vs))),128))])])):n.client?(y(),_("div",zs,[a("div",Ws,[n.client.siret_number!=0&&o.addon_siret_active?(y(),_("div",Js,[a("dt",Ks,m(o.translations.siret),1),a("dd",Xs,m(n.client.siret_number),1),$s])):N("",!0),n.client.siren_number!=0?(y(),_("div",Gs,[a("dt",Zs,m(o.translations.siren),1),a("dd",Qs,m(n.client.siren_number),1),Ys])):N("",!0)]),a("div",eo,[n.client.tax_number!=0?(y(),_("div",to,[a("dt",no,m(o.translations.tax_number),1),a("dd",so,m(n.client.tax_number),1),oo])):N("",!0)]),a("div",ro,[(y(!0),_(T,null,R(r.fields,(i,c)=>(y(),_("div",{key:c,class:"py-2"},[a("dt",io,m(i.label),1),a("dd",ao,m(n.client[c]),1),lo]))),128))]),a("div",co,[a("div",uo,[a("dt",fo,m(o.translations.currency),1),a("dd",ho,m(r.getCurrencyOption(n.client.currency_id)),1),mo])]),a("div",po,[a("dt",yo,m(o.translations.note),1),a("dd",_o,m(n.client.note),1),go])])):(y(),_("div",bo,[a("div",wo,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},vo))),128))])]))])],8,Ms)}var So=oe(Fs,[["render",Co]]);const To={props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,client:Object},data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{editedClient:{...this.client},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},currencyOptions:[],fields:{siren_number:{label:e.siren},tax_number:{label:e.tax_number},company_name:{label:e.company_name},manager_name:{label:e.manager_name},email:{label:e.email},phone:{label:e.phone,type:"tel"},mobile_phone:{label:e.mobile,type:"tel"},website:{label:e.website,type:"url"},address:{label:e.address},city:{label:e.city},postal_code:{label:e.postal_code},country:{label:e.country}},loadingBtn:!1}},mounted(){this.fetchOptions()},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},skeletonItems(){return Array.from({length:10},(e,t)=>t)},currencyOptions(){return this.currencyOptions}},methods:{closeModal(){document.getElementById("modal_client_edit").close()},async submitForm(){this.loadingBtn=!0;try{const e=await fetch(`/wp-json/my-easy-compta/v1/clients/${this.editedClient.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedClient)});if(e.ok){const t=await e.json();this.loadingBtn=!1,this.closeModal(),this.showToast(t.message,"alert-success"),this.$emit("clientEdited")}else{const t=`Error editing client: ${e.statusText}`;this.showToast(t,"alert-error"),console.error(t),this.loadingBtn=!1}}catch(e){const t=e.response&&e.response.data&&e.response.data.message?e.response.data.message:"Error editing client";this.showToast(t,"alert-error"),console.error("Error editing client:",e),this.loadingBtn=!1}},async fetchOptions(){try{const e=await fetch("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const t=await e.json();this.currencyOptions=t.currency_options}else throw new Error(`Failed to fetch options: ${e.statusText}`)}catch(e){console.error("Error fetching options:",e)}},showToast(e,t){this.toast.message=e,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{client:{handler(e){this.editedClient={...e}},immediate:!0}}},Ro=["id","open"],Oo={class:"modal-box"},Ao={class:"font-bold text-lg"},Po={key:0},ko={class:"grid grid-cols-2 gap-4"},Do=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),No=a("div",{class:"skeleton h-4 w-full"},null,-1),Bo=[Do,No],Fo={class:"grid grid-cols-2 gap-4"},Mo=["for"],Lo=["type","id","onUpdate:modelValue"],jo={class:"grid grid-cols-2 gap-4"},Uo={class:"ecwp-group form-group"},Io={for:"currencyId",class:"ecwp-label form-label"},qo=["value"],Ho={class:"ecwp-group form-group mt-4"},Vo={for:"note",class:"ecwp-label form-label"},zo={class:"form-group mt-4 flex justify-end"},Wo=["disabled"],Jo={key:0,class:"loading loading-spinner loading-sm"};function Ko(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),a("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Oo,[a("h3",Ao,m(n.modalTitle),1),a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),n.loading?(y(),_("div",Po,[a("div",ko,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Bo))),128))])])):(y(),_("form",{key:1,onSubmit:t[3]||(t[3]=Je((...i)=>r.submitForm&&r.submitForm(...i),["prevent"])),class:"form"},[a("div",Fo,[(y(!0),_(T,null,R(o.fields,(i,c)=>(y(),_("div",{key:c,class:"ecwp-group form-group"},[a("label",{for:c,class:"ecwp-label form-label"},m(i.label),9,Mo),A(a("input",{type:i.type||"text",id:c,"onUpdate:modelValue":f=>o.editedClient[c]=f,class:L(["ecwp-input input","input-bordered",i.class||"w-full"])},null,10,Lo),[[Ke,o.editedClient[c]]])]))),128))]),a("div",jo,[a("div",Uo,[a("label",Io,m(r.translations.currency),1),A(a("select",{id:"currencyId","onUpdate:modelValue":t[1]||(t[1]=i=>o.editedClient.currency_id=i),class:"ecwp-input select select-bordered w-full"},[(y(!0),_(T,null,R(r.currencyOptions,(i,c)=>(y(),_("option",{key:c,value:i.id},m(i.name)+" - "+m(i.code)+" ("+m(i.symbol)+") ",9,qo))),128))],512),[[ve,o.editedClient.currency_id]])])]),a("div",Ho,[a("label",Vo,m(r.translations.note),1),A(a("textarea",{id:"note","onUpdate:modelValue":t[2]||(t[2]=i=>o.editedClient.note=i),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[J,o.editedClient.note]])]),a("div",zo,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(m(r.translations.save)+" ",1),o.loadingBtn?(y(),_("span",Jo)):N("",!0)],8,Wo)])],32))])],8,Ro)])}var Xo=oe(To,[["render",Ko]]);const $o={name:"Clients",components:{Card:Et,AddClientModal:Bs,ClientDetailsModal:So,ClientEditModal:Xo,RemoveModal:vt},data(){return{clients:[],showClientDetailsModal:!1,editClientModal:!1,showRemoveModal:!1,selectedClient:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,settings:[],loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchClients(),this.loadSettings()},methods:{AddNew(){modal_clients.showModal()},fetchClients(e=1){this.loading=!0;const{perPage:t}=this;fetch(`/wp-json/my-easy-compta/v1/clients?page=${e}&per_page=${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>n.json()).then(n=>{this.clients=n.clients,this.totalCount=n.total_count,this.totalPages=n.total_pages,this.currentPage=n.page,this.perPage=t,this.generatePaginationButtons()}).catch(n=>{console.error("Error fetching clients:",n)}).finally(()=>{this.loading=!1})},fetchClientDetails(e){fetch(`/wp-json/my-easy-compta/v1/clients/details/${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.selectedClient=t,this.loadingModal=!1}).catch(t=>{console.error("Error fetching client details:",t),this.loadingModal=!1})},showClientDetails(e){this.loadingModal=!0,this.showClientDetailsModal=!0,modal_client_details.showModal(),this.fetchClientDetails(e.id)},editClient(e){this.loadingModal=!0,this.editClientModal=!0,modal_client_edit.showModal(),this.fetchClientDetails(e.id)},generatePaginationButtons(){this.paginationButtons=Ct(this.currentPage,this.totalPages)},goToPage(e){e!=="..."&&this.fetchClients(e)},perPageChanged(){this.fetchClients()},confirmDeleteClient(e){this.selectedClient=e,modal_remove.showModal(),this.showRemoveModal=!0},deleteClient(e){this.loading=!0;const t=e.id;fetch(`/wp-json/my-easy-compta/v1/clients/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.json()}).then(n=>{n.success?(this.fetchClients(),this.showToast(n.message,"alert-success")):(this.showToast(n.message,"alert-error"),console.error("Error deleting client:",n.statusText))}).catch(n=>{console.log(n.message);const s=n&&n.message?n.message:"Error deleting client";s==="This client cannot be deleted because it has associated data."?this.showToast(s,"alert-error"):console.error("Error deleting client:",n)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:e,currencySymbol:t,vatData:n}=await St();this.settings=e,this.default_currency_symbol=t,this.default_vat=n,this.loadingPrice=!1}catch(e){this.showToast(e.message,"alert-error"),this.loadingPrice=!1}},showToast(e,t){Tt(this.toast,e,t)}},computed:{skeletonItems(){return Array.from({length:5},(e,t)=>t)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Go={class:"pt-2 pr-4"},Zo={class:"flex justify-between items-center"},Qo={class:"card-title"},Yo=a("i",{class:"fas fa-plus-circle"},null,-1),er={key:0,class:"ms-2"},tr={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab1"},nr=a("i",{class:"fas fa-file-export"},null,-1),sr=["data-tip"],or={class:"btn btn-outline btn-accent rounded-full",disabled:""},rr=a("i",{class:"fas fa-file-export"},null,-1),ir=a("div",{class:"divider mt-2"},null,-1),ar={class:"flex items-center mb-4"},lr={for:"perPageSelect",class:"mr-2"},cr=["value"],dr={class:"overflow-x-auto"},ur={key:0,class:"table w-full"},fr={class:"flex justify-center"},hr={class:"flex items-center gap-3"},mr={class:"avatar"},pr={class:"mask mask-squircle w-12 h-12"},yr={version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 122.9 122.9",style:{"enable-background":"new 0 0 122.9 122.9"},"xml:space":"preserve"},_r=a("g",null,[a("path",{d:"M61.4,0c17,0,32.3,6.9,43.4,18c11.1,11.1,18,26.5,18,43.4c0,17-6.9,32.3-18,43.4c-11.1,11.1-26.5,18-43.4,18 s-32.3-6.9-43.4-18C6.9,93.8,0,78.4,0,61.4c0-17,6.9-32.3,18-43.4C29.1,6.9,44.5,0,61.4,0L61.4,0z M41.3,54.3c-1.1,0-2,0.3-2.5,0.7 c-0.3,0.2-0.6,0.5-0.7,0.8c-0.2,0.4-0.3,0.8-0.2,1.4c0,1.5,0.8,3.5,2.4,5.8l0,0l0,0l5,8c2,3.2,4.1,6.5,6.8,8.9 c2.5,2.3,5.6,3.9,9.6,3.9c4.4,0,7.6-1.6,10.2-4.1c2.7-2.5,4.9-6,7-9.5l5.7-9.3c1.1-2.4,1.4-4,1.2-5c-0.1-0.6-0.8-0.8-1.8-0.9 c-0.2,0-0.5,0-0.7,0c-0.3,0-0.5,0-0.8,0c-0.2,0-0.3,0-0.4,0c-0.5,0-1,0-1.6-0.1l1.9-8.6c-14.4,2.3-25.2-8.4-40.4-2.1L43,54.4 C42.4,54.4,41.8,54.4,41.3,54.3L41.3,54.3L41.3,54.3L41.3,54.3z M18.8,95.7c7.1-2.5,19.6-3.8,25.4-7.7c1-1.3,2.1-2.9,3.1-4.3 c0.6-0.9,1.1-1.7,1.6-2.3c0.1-0.1,0.2-0.2,0.3-0.3c-2.4-2.5-4.4-5.5-6.3-8.5l-5-8C36,61.8,35,59.3,35,57.3c0-1,0.1-1.9,0.5-2.6 c0.4-0.8,1-1.5,1.7-2c0.4-0.2,0.8-0.5,1.2-0.6c-0.3-4.3-0.4-9.8-0.2-14.4c0.1-1.1,0.3-2.2,0.6-3.3c1.3-4.6,4.5-8.3,8.5-10.8 c1.4-0.9,2.9-1.6,4.6-2.2c2.9-1.1,1.5-5.5,4.7-5.6c7.5-0.2,19.8,6.2,24.6,11.4c2.8,3,4.6,7,4.9,12.3l-0.3,13.1l0,0 c1.4,0.4,2.3,1.3,2.7,2.7c0.4,1.6,0,3.8-1.4,6.9l0,0c0,0.1-0.1,0.1-0.1,0.2l-5.7,9.4c-2.2,3.6-4.5,7.3-7.5,10.1L73.7,82l0,0 c0.4,0.5,0.8,1.1,1.2,1.7c0.8,1.1,1.6,2.4,2.5,3.6c5.3,4.5,19.3,5.9,26.7,8.6c7.6-9.4,12.1-21.4,12.1-34.4c0-15.1-6.1-28.8-16-38.7 c-9.9-9.9-23.6-16-38.7-16s-28.8,6.1-38.7,16c-9.9,9.9-16,23.6-16,38.7C6.7,74.4,11.2,86.3,18.8,95.7L18.8,95.7z M77,90.5 c-1.4-1.6-2.8-3.7-4.1-5.5c-0.4-0.5-0.7-1.1-1.1-1.5c-2.7,2-6,3.3-10.3,3.3c-4.5,0-8-1.6-10.9-4.1c0,0,0,0.1-0.1,0.1 c-0.5,0.7-1,1.4-1.6,2.3c-1.1,1.6-2.3,3.3-3.4,4.8C45.6,100,71.1,106,77,90.5L77,90.5z"})],-1),gr=[_r],br={class:"font-bold"},wr={class:"text-sm opacity-50"},xr={class:"badge badge-ghost badge-sm"},Er={class:"flex justify-end"},vr=["data-tip"],Cr=["onClick"],Sr=a("i",{class:"far fa-eye"},null,-1),Tr=[Sr],Rr=["data-tip"],Or=["onClick"],Ar=a("i",{class:"fas fa-pencil-alt"},null,-1),Pr=[Ar],kr=["data-tip"],Dr=["onClick"],Nr=a("i",{class:"far fa-trash-alt"},null,-1),Br=[Nr],Fr={key:1},Mr=a("div",{class:"flex gap-4 items-center"},[a("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),a("div",{class:"flex flex-col gap-4 w-full"},[a("div",{class:"skeleton h-4 w-full"}),a("div",{class:"skeleton h-4 w-full"})])],-1),Lr=a("div",{class:"divider my-1"},null,-1),jr=[Mr,Lr],Ur={class:"join ecwp_pagination mt-6 pt-4"},Ir=["onClick"];function qr(e,t,n,s,o,r){const i=V("client-details-modal"),c=V("client-edit-modal"),f=V("remove-modal"),h=V("AddClientModal"),d=V("Card");return y(),_("div",Go,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),z(i,{loading:o.loadingModal,"show-modal":o.showClientDetailsModal,"modal-id":"modal_client_details","modal-title":r.translations.client_details,client:o.selectedClient,onClose:t[0]||(t[0]=u=>o.showClientDetailsModal=!1)},null,8,["loading","show-modal","modal-title","client"]),z(c,{loading:o.loadingModal,"show-modal":o.editClientModal,"modal-id":"modal_client_edit","modal-title":r.translations.edit_client,client:o.selectedClient,onClose:t[1]||(t[1]=u=>o.editClientModal=!1),onClientEdited:r.fetchClients},null,8,["loading","show-modal","modal-title","client","onClientEdited"]),z(f,{"show-modal":o.showRemoveModal,title:r.translations.are_you_sure,message:r.translations.no_turning_back,confirmText:r.translations.yes_delete_it,cancelText:r.translations.cancel,onConfirm:t[2]||(t[2]=u=>r.deleteClient(o.selectedClient)),onCancel:t[3]||(t[3]=u=>o.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),z(d,{topMargin:"mt-8"},{default:bt(()=>[a("div",Zo,[a("h2",Qo,m(r.translations.clients),1),a("div",null,[a("button",{class:"btn btn-primary rounded-full",onClick:t[4]||(t[4]=(...u)=>r.AddNew&&r.AddNew(...u))},[K(m(r.translations.add)+" ",1),Yo]),o.settings.easy_compta_export_addon_active==1?(y(),_("span",er,[a("a",tr,[K(m(r.translations.export)+" ",1),nr])])):(y(),_("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":r.translations.active_export_addon},[a("button",or,[K(m(r.translations.export)+" ",1),rr])],8,sr))])]),ir,z(h,{onClientAdded:r.fetchClients},null,8,["onClientAdded"]),a("div",ar,[a("label",lr,m(r.translations.display_per_page),1),A(a("select",{id:"perPageSelect","onUpdate:modelValue":t[5]||(t[5]=u=>o.perPage=u),onChange:t[6]||(t[6]=(...u)=>r.perPageChanged&&r.perPageChanged(...u))},[(y(!0),_(T,null,R(o.perPageOptions,u=>(y(),_("option",{key:u,value:u},m(u),9,cr))),128))],544),[[ve,o.perPage]])]),a("div",dr,[o.loading?(y(),_("div",Fr,[(y(!0),_(T,null,R(o.skeletonRows,u=>(y(),_("div",{key:u,class:"flex flex-col gap-4 w-full"},jr))),128))])):(y(),_("table",ur,[a("thead",null,[a("tr",null,[a("th",null,m(r.translations.company_name),1),a("th",null,m(r.translations.manager_name),1),a("th",null,m(r.translations.email),1),a("th",null,m(r.translations.phone),1),a("th",fr,m(r.translations.actions),1)])]),a("tbody",null,[(y(!0),_(T,null,R(o.clients,u=>(y(),_("tr",{key:u.id},[a("td",null,[a("div",hr,[a("div",mr,[a("div",pr,[(y(),_("svg",yr,gr))])]),a("div",null,[a("div",br,m(u.company_name),1),a("div",wr,[a("span",xr,m(u.city)+" - "+m(u.country),1)])])])]),a("td",null,m(u.manager_name),1),a("td",null,m(u.email),1),a("td",null,m(u.phone),1),a("td",Er,[a("span",{class:"lg:tooltip","data-tip":r.translations.view},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.showClientDetails(u)},Tr,8,Cr)],8,vr),a("span",{class:"lg:tooltip","data-tip":r.translations.edit},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.editClient(u)},Pr,8,Or)],8,Rr),a("span",{class:"lg:tooltip","data-tip":r.translations.delete},[a("button",{onClick:w=>r.confirmDeleteClient(u),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Br,8,Dr)],8,kr)])]))),128))])])),a("div",Ur,[(y(!0),_(T,null,R(o.paginationButtons,u=>(y(),_("button",{key:u,class:L(["join-item btn",{"btn-disabled":u==="..."||u===o.currentPage}]),onClick:w=>r.goToPage(u)},m(u),11,Ir))),128))])])]),_:1})])}var Hr=oe($o,[["render",qr]]);const pe=ne;(function(e,t){const n=ne,s=e();for(;[];)try{if(parseInt(n(393))/1+-parseInt(n(391))/2*(-parseInt(n(397))/3)+parseInt(n(390))/4+parseInt(n(386))/5*(parseInt(n(395))/6)+-parseInt(n(385))/7*(-parseInt(n(396))/8)+parseInt(n(388))/9*(-parseInt(n(387))/10)+-parseInt(n(383))/11*(parseInt(n(384))/12)===t)break;s.push(s.shift())}catch{s.push(s.shift())}})(se,778509);function ne(e,t){const n=se();return ne=function(s,o){return s=s-383,n[s]},ne(e,t)}const Vr=wt({render:()=>xt(Hr)});Vr[pe(394)](Rt)[pe(392)](pe(389));function se(){const e=["35bSKWtU","8820KVilnm","1314jemjdl","#my-easy-compta-clients-app","2931428NaWVwC","2EvqyZx","mount","900256ZvYiTY","use","1112142SAhWXA","16RbvnED","2973786nZpOiQ","437063SYjSYr","1236FphxfM","3772671UBRQAE"];return se=function(){return e},se()}
     6`+r):s.stack=r}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=j(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:r}=n;s!==void 0&&xe.assertOptions(s,{silentJSONParsing:M.transitional(M.boolean),forcedJSONParsing:M.transitional(M.boolean),clarifyTimeoutError:M.transitional(M.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:xe.assertOptions(o,{encode:M.function,serialize:M.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=r&&l.merge(r.common,r[n.method]);r&&l.forEach(["delete","get","head","post","put","patch","common"],p=>{delete r[p]}),n.headers=k.concat(i,r);const c=[];let f=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(f=f&&b.synchronous,c.unshift(b.fulfilled,b.rejected))});const h=[];this.interceptors.response.forEach(function(b){h.push(b.fulfilled,b.rejected)});let d,u=0,w;if(!f){const p=[Ve.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,h),w=p.length,d=Promise.resolve(n);u<w;)d=d.then(p[u++],p[u++]);return d}w=c.length;let x=n;for(u=0;u<w;){const p=c[u++],b=c[u++];try{x=p(x)}catch(v){b.call(this,v);break}}try{d=Ve.call(this,x)}catch(p){return Promise.reject(p)}for(u=0,w=h.length;u<w;)d=d.then(h[u++],h[u++]);return d}getUri(t){t=j(this.defaults,t);const n=ut(t.baseURL,t.url);return it(n,t.params,t.paramsSerializer)}}l.forEach(["delete","get","head","options"],function(t){te.prototype[t]=function(n,s){return this.request(j(s||{},{method:t,url:n,data:(s||{}).data}))}});l.forEach(["post","put","patch"],function(t){function n(s){return function(r,i,c){return this.request(j(c||{},{method:t,headers:s?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}te.prototype[t]=n(),te.prototype[t+"Form"]=n(!0)});var Q=te;class Pe{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(r){n=r});const s=this;this.promise.then(o=>{if(!s._listeners)return;let r=s._listeners.length;for(;r-- >0;)s._listeners[r](o);s._listeners=null}),this.promise.then=o=>{let r;const i=new Promise(c=>{s.subscribe(c),r=c}).then(o);return i.cancel=function(){s.unsubscribe(r)},i},t(function(r,i,c){s.reason||(s.reason=new q(r,i,c),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Pe(function(o){t=o}),cancel:t}}}var ts=Pe;function ns(e){return function(n){return e.apply(null,n)}}function ss(e){return l.isObject(e)&&e.isAxiosError===!0}const Ee={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ee).forEach(([e,t])=>{Ee[t]=e});var os=Ee;function yt(e){const t=new Q(e),n=Xe(Q.prototype.request,t);return l.extend(n,Q.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return yt(j(e,o))},n}const C=yt(Oe);C.Axios=Q;C.CanceledError=q;C.CancelToken=ts;C.isCancel=ct;C.VERSION=pt;C.toFormData=le;C.AxiosError=g;C.Cancel=C.CanceledError;C.all=function(t){return Promise.all(t)};C.spread=ns;C.isAxiosError=ss;C.mergeConfig=j;C.AxiosHeaders=k;C.formToJSON=e=>lt(l.isHTMLForm(e)?new FormData(e):e);C.getAdapter=mt.getAdapter;C.HttpStatusCode=os;C.default=C;var We=C;const rs={data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{formData:{siret:"",company_name:"",siren_number:"",manager_name:"",address:"",city:"",postal_code:"",country:"",phone:"",mobile_phone:"",email:"",website:"",currency_id:"",note:"",user_create:""},fields:{company_name:{label:e.company_name,type:"text",required:!0},manager_name:{label:e.manager_name,type:"text"},address:{label:e.address,type:"text",required:!0},city:{label:e.city,type:"text",required:!0},postal_code:{label:e.postal_code,type:"text"},country:{label:e.country,type:"text"},phone:{label:e.phone,type:"tel",required:!0},mobile_phone:{label:e.mobile,type:"tel"},email:{label:e.email,type:"email",required:!0},website:{label:e.website,type:"url"},currency_id:{label:e.currency,type:"text",required:!0}},options:{currency_options:[],default_currency:"",addon_user_active:!1,addon_siret_active:!1},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},loadingBtn:!1,loadingSiret:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{submitForm(){this.loadingBtn=!0,We.post("/wp-json/my-easy-compta/v1/clients/add",this.formData,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{e.data.success?(this.showToast(e.data.message,"alert-success"),this.loadingBtn=!1,this.resetForm(),this.closeModal(),this.$emit("clientAdded")):(this.showToast(e.data.message,"alert-error"),this.loadingBtn=!1)}).catch(e=>{const t=e.response&&e.response.data&&e.response.data.message?e.response.data.message:"Erreur serveur";console.error(e),this.showToast(t,"alert-error"),this.loadingBtn=!1})},closeModal(){document.getElementById("modal_clients").close()},showToast(e,t){this.toast.message=e,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},resetForm(){for(let e in this.formData)this.formData[e]=""},getOptions(e){return e==="currency_id"?this.options.currency_options:[]},fetchOptions(){We.get("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{this.options.currency_options=e.data.currency_options,this.options.default_currency=e.data.default_currency,this.options.addon_user_active=e.data.addon_user_active,this.options.addon_siret_active=e.data.addon_siret_active}).catch(e=>{console.error("Erreur lors de la r\xE9cup\xE9ration des options",e)})},fetchCompanyInfo(e){e.preventDefault(),this.loadingSiret=!0;const t=this.formData.siret;t?fetch(`/wp-json/my-easy-compta/v1/fetch-company-info/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.json()}).then(n=>{n?(this.formData.company_name=n.company_name,this.formData.manager_name=n.manager_name,this.formData.address=n.address,this.formData.postal_code=n.postal_code,this.formData.city=n.city,this.formData.siren_number=n.siren,this.showToast("Informations charg\xE9es avec succ\xE8s","alert-success"),this.loadingSiret=!1):(this.showToast("Aucune information trouv\xE9e pour ce SIRET","alert-error"),this.loadingSiret=!1)}).catch(n=>{console.error("Error fetching company info:",n),this.showToast("Erreur lors du chargement des informations","alert-error"),this.loadingSiret=!1}):(this.showToast("Veuillez saisir un num\xE9ro SIRET","alert-error"),this.loadingSiret=!1)}},mounted(){this.fetchOptions()}},is={id:"modal_clients",class:"modal"},as={class:"modal-box"},ls={class:"font-bold text-lg"},cs={key:0,class:"grid grid-cols-1 gap-4"},ds={class:"ecwp-group form-group relative join"},us={for:"siret",class:"ecwp-label form-label"},fs=["disabled"],hs={key:0,class:"loading loading-spinner loading-sm"},ms={key:1},ps={class:"grid grid-cols-1 gap-4"},ys={class:"ecwp-group form-group relative"},_s={for:"siren",class:"ecwp-label form-label"},gs={class:"grid grid-cols-1 gap-4"},bs={class:"ecwp-group form-group relative"},ws={for:"tax_number",class:"ecwp-label form-label"},xs={class:"grid grid-cols-2 gap-4"},Es=["for"],Cs=["id","onUpdate:modelValue","required"],vs=["value"],Ss=["value"],Ts=["type","id","onUpdate:modelValue","required"],Rs={class:"ecwp-group form-group mt-4 relative"},Os=["for"],As={key:1,class:"ecwp-group form-group mt-6 w-52 flex justify-between"},Ps={class:"form-group mt-4 flex justify-end"},ks=["disabled"],Ds={key:0,class:"loading loading-spinner loading-sm"};function Ns(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),a("dialog",is,[a("div",as,[a("h3",ls,m(r.translations.new_client),1),a("form",{onSubmit:t[7]||(t[7]=Je((...i)=>r.submitForm&&r.submitForm(...i),["prevent"]))},[a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),o.options.addon_siret_active?(y(),_("div",cs,[a("div",ds,[a("label",us,m(r.translations.siret),1),A(a("input",{type:"number",id:"siret","onUpdate:modelValue":t[1]||(t[1]=i=>o.formData.siret=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.siret]]),a("button",{onClick:t[2]||(t[2]=(...i)=>r.fetchCompanyInfo&&r.fetchCompanyInfo(...i)),class:"btn join-item rounded-r-full mt-5",disabled:o.loadingSiret},[o.loadingSiret?(y(),_("span",hs)):(y(),_("span",ms,m(r.translations.search),1))],8,fs)])])):N("",!0),a("div",ps,[a("div",ys,[a("label",_s,m(r.translations.siren),1),A(a("input",{type:"number",id:"siren","onUpdate:modelValue":t[3]||(t[3]=i=>o.formData.siren_number=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.siren_number]])])]),a("div",gs,[a("div",bs,[a("label",ws,m(r.translations.tax_number),1),A(a("input",{type:"text",id:"tax_number","onUpdate:modelValue":t[4]||(t[4]=i=>o.formData.tax_number=i),class:"ecwp-input input input-bordered w-full"},null,512),[[J,o.formData.tax_number]])])]),a("div",xs,[(y(!0),_(T,null,R(o.fields,(i,c)=>(y(),_("div",{key:c,class:"ecwp-group form-group relative"},[a("label",{for:c,class:"ecwp-label form-label"},m(i.label),9,Es),c==="currency_id"?A((y(),_("select",{key:0,id:c,"onUpdate:modelValue":f=>o.formData[c]=f,class:"ecwp-input input input-bordered w-full peer",required:i.required},[a("option",{value:o.options.default_currency},m(r.translations.default_currency),9,vs),(y(!0),_(T,null,R(r.getOptions(c),f=>(y(),_("option",{key:f.id,value:f.id},m(f.name)+" - "+m(f.code)+" ("+m(f.symbol)+") ",9,Ss))),128))],8,Cs)),[[Ce,o.formData[c]]]):A((y(),_("input",{key:1,type:i.type,id:c,"onUpdate:modelValue":f=>o.formData[c]=f,class:"ecwp-input input input-bordered w-full peer",placeholder:" ",required:i.required},null,8,Ts)),[[Ke,o.formData[c]]])]))),128))]),a("div",Rs,[a("label",{for:e.key,class:"ecwp-label form-label"},m(r.translations.note),9,Os),A(a("textarea",{id:"note","onUpdate:modelValue":t[5]||(t[5]=i=>o.formData.note=i),class:"ecwp-input textarea textarea-bordered w-full peer",rows:"4",placeholder:" "},null,512),[[J,o.formData.note]])]),o.options.addon_user_active?(y(),_("div",As,[a("label",null,m(r.translations.create_user),1),A(a("input",{class:"ecwp-switch",type:"checkbox","onUpdate:modelValue":t[6]||(t[6]=i=>o.formData.user_create=i)},null,512),[[gt,o.formData.user_create]])])):N("",!0),a("div",Ps,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(m(r.translations.add)+" ",1),o.loadingBtn?(y(),_("span",Ds)):N("",!0)],8,ks)])],32)])])])}var Bs=oe(rs,[["render",Ns]]);const Fs={props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,client:Object,currencyOptions:{type:Array,default:()=>[]}},data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{addon_siret_active:"",localCurrencyOptions:this.currencyOptions,translations:e}},computed:{skeletonItems(){return Array.from({length:7},(e,t)=>t)},fields(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{company_name:{label:e.company_name},manager_name:{label:e.manager_name},email:{label:e.email},phone:{label:e.phone},mobile_phone:{label:e.mobile},website:{label:e.website},address:{label:e.address},city:{label:e.city},postal_code:{label:e.postal_code},country:{label:e.country}}}},mounted(){this.fetchOptions()},methods:{closeModal(){const e=document.getElementById(this.modalId);e&&(e.close(),this.$emit("close"))},fetchOptions(){fetch("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e.currency_options&&(this.localCurrencyOptions=e.currency_options,this.addon_siret_active=e.addon_siret_active)}).catch(e=>{console.error("Erreur lors de la r\xE9cup\xE9ration des options",e)})},getCurrencyOption(e){const t=this.localCurrencyOptions.find(n=>n.id===e);return t?t.name:"N/A"}}},Ms=["id","open"],Ls={class:"modal-box"},js={class:"font-bold text-lg"},Us={key:0},Is={class:"grid grid-cols-2 gap-4"},qs=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Hs=a("div",{class:"skeleton h-4 w-full"},null,-1),Vs=[qs,Hs],zs={key:1},Ws={class:"grid grid-cols-2 gap-4"},Js={key:0,class:"py-2"},Ks={class:"text-sm font-medium text-gray-500"},Xs={class:"mt-1 text-sm text-gray-900"},$s=a("dl",{class:"divide-y divide-gray-200"},null,-1),Gs={key:1,class:"py-2"},Zs={class:"text-sm font-medium text-gray-500"},Qs={class:"mt-1 text-sm text-gray-900"},Ys=a("dl",{class:"divide-y divide-gray-200"},null,-1),eo={class:"grid grid-cols-1 gap-4"},to={key:0,class:"py-2"},no={class:"text-sm font-medium text-gray-500"},so={class:"mt-1 text-sm text-gray-900"},oo=a("dl",{class:"divide-y divide-gray-200"},null,-1),ro={class:"grid grid-cols-2 gap-4"},io={class:"text-sm font-medium text-gray-500"},ao={class:"mt-1 text-sm text-gray-900"},lo=a("dl",{class:"divide-y divide-gray-200"},null,-1),co={class:"grid grid-cols-2 gap-4"},uo={class:"py-2"},fo={class:"text-sm font-medium text-gray-500"},ho={class:"mt-1 text-sm text-gray-900"},mo=a("dl",{class:"divide-y divide-gray-200"},null,-1),po={class:"py-2"},yo={class:"text-sm font-medium text-gray-500"},_o={class:"mt-1 text-sm text-gray-900"},go=a("dl",{class:"divide-y divide-gray-200"},null,-1),bo={key:2},wo={class:"grid grid-cols-2 gap-4"},xo=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Eo=a("div",{class:"skeleton h-4 w-full"},null,-1),Co=[xo,Eo];function vo(e,t,n,s,o,r){return y(),_("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Ls,[a("h3",js,m(n.modalTitle),1),a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),n.loading?(y(),_("div",Us,[a("div",Is,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Vs))),128))])])):n.client?(y(),_("div",zs,[a("div",Ws,[n.client.siret_number!=0&&o.addon_siret_active?(y(),_("div",Js,[a("dt",Ks,m(o.translations.siret),1),a("dd",Xs,m(n.client.siret_number),1),$s])):N("",!0),n.client.siren_number!=0?(y(),_("div",Gs,[a("dt",Zs,m(o.translations.siren),1),a("dd",Qs,m(n.client.siren_number),1),Ys])):N("",!0)]),a("div",eo,[n.client.tax_number!=0?(y(),_("div",to,[a("dt",no,m(o.translations.tax_number),1),a("dd",so,m(n.client.tax_number),1),oo])):N("",!0)]),a("div",ro,[(y(!0),_(T,null,R(r.fields,(i,c)=>(y(),_("div",{key:c,class:"py-2"},[a("dt",io,m(i.label),1),a("dd",ao,m(n.client[c]),1),lo]))),128))]),a("div",co,[a("div",uo,[a("dt",fo,m(o.translations.currency),1),a("dd",ho,m(r.getCurrencyOption(n.client.currency_id)),1),mo])]),a("div",po,[a("dt",yo,m(o.translations.note),1),a("dd",_o,m(n.client.note),1),go])])):(y(),_("div",bo,[a("div",wo,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Co))),128))])]))])],8,Ms)}var So=oe(Fs,[["render",vo]]);const To={props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,client:Object},data(){const e=window.myEasyComptaAdmin.easyComptaTranslations;return{editedClient:{...this.client},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},currencyOptions:[],fields:{siren_number:{label:e.siren},tax_number:{label:e.tax_number},company_name:{label:e.company_name},manager_name:{label:e.manager_name},email:{label:e.email},phone:{label:e.phone,type:"tel"},mobile_phone:{label:e.mobile,type:"tel"},website:{label:e.website,type:"url"},address:{label:e.address},city:{label:e.city},postal_code:{label:e.postal_code},country:{label:e.country}},loadingBtn:!1}},mounted(){this.fetchOptions()},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},skeletonItems(){return Array.from({length:10},(e,t)=>t)},currencyOptions(){return this.currencyOptions}},methods:{closeModal(){document.getElementById("modal_client_edit").close()},async submitForm(){this.loadingBtn=!0;try{const e=await fetch(`/wp-json/my-easy-compta/v1/clients/${this.editedClient.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedClient)});if(e.ok){const t=await e.json();this.loadingBtn=!1,this.closeModal(),this.showToast(t.message,"alert-success"),this.$emit("clientEdited")}else{const t=`Error editing client: ${e.statusText}`;this.showToast(t,"alert-error"),console.error(t),this.loadingBtn=!1}}catch(e){const t=e.response&&e.response.data&&e.response.data.message?e.response.data.message:"Error editing client";this.showToast(t,"alert-error"),console.error("Error editing client:",e),this.loadingBtn=!1}},async fetchOptions(){try{const e=await fetch("/wp-json/my-easy-compta/v1/options",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const t=await e.json();this.currencyOptions=t.currency_options}else throw new Error(`Failed to fetch options: ${e.statusText}`)}catch(e){console.error("Error fetching options:",e)}},showToast(e,t){this.toast.message=e,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{client:{handler(e){this.editedClient={...e}},immediate:!0}}},Ro=["id","open"],Oo={class:"modal-box"},Ao={class:"font-bold text-lg"},Po={key:0},ko={class:"grid grid-cols-2 gap-4"},Do=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),No=a("div",{class:"skeleton h-4 w-full"},null,-1),Bo=[Do,No],Fo={class:"grid grid-cols-2 gap-4"},Mo=["for"],Lo=["type","id","onUpdate:modelValue"],jo={class:"grid grid-cols-2 gap-4"},Uo={class:"ecwp-group form-group"},Io={for:"currencyId",class:"ecwp-label form-label"},qo=["value"],Ho={class:"ecwp-group form-group mt-4"},Vo={for:"note",class:"ecwp-label form-label"},zo={class:"form-group mt-4 flex justify-end"},Wo=["disabled"],Jo={key:0,class:"loading loading-spinner loading-sm"};function Ko(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),a("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Oo,[a("h3",Ao,m(n.modalTitle),1),a("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[0]||(t[0]=i=>r.closeModal())}," \u2715 "),n.loading?(y(),_("div",Po,[a("div",ko,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Bo))),128))])])):(y(),_("form",{key:1,onSubmit:t[3]||(t[3]=Je((...i)=>r.submitForm&&r.submitForm(...i),["prevent"])),class:"form"},[a("div",Fo,[(y(!0),_(T,null,R(o.fields,(i,c)=>(y(),_("div",{key:c,class:"ecwp-group form-group"},[a("label",{for:c,class:"ecwp-label form-label"},m(i.label),9,Mo),A(a("input",{type:i.type||"text",id:c,"onUpdate:modelValue":f=>o.editedClient[c]=f,class:L(["ecwp-input input","input-bordered",i.class||"w-full"])},null,10,Lo),[[Ke,o.editedClient[c]]])]))),128))]),a("div",jo,[a("div",Uo,[a("label",Io,m(r.translations.currency),1),A(a("select",{id:"currencyId","onUpdate:modelValue":t[1]||(t[1]=i=>o.editedClient.currency_id=i),class:"ecwp-input select select-bordered w-full"},[(y(!0),_(T,null,R(r.currencyOptions,(i,c)=>(y(),_("option",{key:c,value:i.id},m(i.name)+" - "+m(i.code)+" ("+m(i.symbol)+") ",9,qo))),128))],512),[[Ce,o.editedClient.currency_id]])])]),a("div",Ho,[a("label",Vo,m(r.translations.note),1),A(a("textarea",{id:"note","onUpdate:modelValue":t[2]||(t[2]=i=>o.editedClient.note=i),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[J,o.editedClient.note]])]),a("div",zo,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(m(r.translations.save)+" ",1),o.loadingBtn?(y(),_("span",Jo)):N("",!0)],8,Wo)])],32))])],8,Ro)])}var Xo=oe(To,[["render",Ko]]);const $o={name:"Clients",components:{Card:Et,AddClientModal:Bs,ClientDetailsModal:So,ClientEditModal:Xo,RemoveModal:Ct},data(){return{clients:[],showClientDetailsModal:!1,editClientModal:!1,showRemoveModal:!1,selectedClient:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,settings:[],loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchClients(),this.loadSettings()},methods:{AddNew(){modal_clients.showModal()},fetchClients(e=1){this.loading=!0;const{perPage:t}=this;fetch(`/wp-json/my-easy-compta/v1/clients?page=${e}&per_page=${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>n.json()).then(n=>{this.clients=n.clients,this.totalCount=n.total_count,this.totalPages=n.total_pages,this.currentPage=n.page,this.perPage=t,this.generatePaginationButtons()}).catch(n=>{console.error("Error fetching clients:",n)}).finally(()=>{this.loading=!1})},fetchClientDetails(e){fetch(`/wp-json/my-easy-compta/v1/clients/details/${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.selectedClient=t,this.loadingModal=!1}).catch(t=>{console.error("Error fetching client details:",t),this.loadingModal=!1})},showClientDetails(e){this.loadingModal=!0,this.showClientDetailsModal=!0,modal_client_details.showModal(),this.fetchClientDetails(e.id)},editClient(e){this.loadingModal=!0,this.editClientModal=!0,modal_client_edit.showModal(),this.fetchClientDetails(e.id)},generatePaginationButtons(){this.paginationButtons=vt(this.currentPage,this.totalPages)},goToPage(e){e!=="..."&&this.fetchClients(e)},perPageChanged(){this.fetchClients()},confirmDeleteClient(e){this.selectedClient=e,modal_remove.showModal(),this.showRemoveModal=!0},deleteClient(e){this.loading=!0;const t=e.id;fetch(`/wp-json/my-easy-compta/v1/clients/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>{if(!n.ok)throw new Error("Network response was not ok");return n.json()}).then(n=>{n.success?(this.fetchClients(),this.showToast(n.message,"alert-success")):(this.showToast(n.message,"alert-error"),console.error("Error deleting client:",n.statusText))}).catch(n=>{console.log(n.message);const s=n&&n.message?n.message:"Error deleting client";s==="This client cannot be deleted because it has associated data."?this.showToast(s,"alert-error"):console.error("Error deleting client:",n)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:e,currencySymbol:t,vatData:n}=await St();this.settings=e,this.default_currency_symbol=t,this.default_vat=n,this.loadingPrice=!1}catch(e){this.showToast(e.message,"alert-error"),this.loadingPrice=!1}},showToast(e,t){Tt(this.toast,e,t)}},computed:{skeletonItems(){return Array.from({length:5},(e,t)=>t)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Go={class:"pt-2 pr-4"},Zo={class:"flex justify-between items-center"},Qo={class:"card-title"},Yo=a("i",{class:"fas fa-plus-circle"},null,-1),er={key:0,class:"ms-2"},tr={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab1"},nr=a("i",{class:"fas fa-file-export"},null,-1),sr=["data-tip"],or={class:"btn btn-outline btn-accent rounded-full",disabled:""},rr=a("i",{class:"fas fa-file-export"},null,-1),ir=a("div",{class:"divider mt-2"},null,-1),ar={class:"flex items-center mb-4"},lr={for:"perPageSelect",class:"mr-2"},cr=["value"],dr={class:"overflow-x-auto"},ur={key:0,class:"table w-full"},fr={class:"flex justify-center"},hr={class:"flex items-center gap-3"},mr={class:"avatar"},pr={class:"mask mask-squircle w-12 h-12"},yr={version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 122.9 122.9",style:{"enable-background":"new 0 0 122.9 122.9"},"xml:space":"preserve"},_r=a("g",null,[a("path",{d:"M61.4,0c17,0,32.3,6.9,43.4,18c11.1,11.1,18,26.5,18,43.4c0,17-6.9,32.3-18,43.4c-11.1,11.1-26.5,18-43.4,18 s-32.3-6.9-43.4-18C6.9,93.8,0,78.4,0,61.4c0-17,6.9-32.3,18-43.4C29.1,6.9,44.5,0,61.4,0L61.4,0z M41.3,54.3c-1.1,0-2,0.3-2.5,0.7 c-0.3,0.2-0.6,0.5-0.7,0.8c-0.2,0.4-0.3,0.8-0.2,1.4c0,1.5,0.8,3.5,2.4,5.8l0,0l0,0l5,8c2,3.2,4.1,6.5,6.8,8.9 c2.5,2.3,5.6,3.9,9.6,3.9c4.4,0,7.6-1.6,10.2-4.1c2.7-2.5,4.9-6,7-9.5l5.7-9.3c1.1-2.4,1.4-4,1.2-5c-0.1-0.6-0.8-0.8-1.8-0.9 c-0.2,0-0.5,0-0.7,0c-0.3,0-0.5,0-0.8,0c-0.2,0-0.3,0-0.4,0c-0.5,0-1,0-1.6-0.1l1.9-8.6c-14.4,2.3-25.2-8.4-40.4-2.1L43,54.4 C42.4,54.4,41.8,54.4,41.3,54.3L41.3,54.3L41.3,54.3L41.3,54.3z M18.8,95.7c7.1-2.5,19.6-3.8,25.4-7.7c1-1.3,2.1-2.9,3.1-4.3 c0.6-0.9,1.1-1.7,1.6-2.3c0.1-0.1,0.2-0.2,0.3-0.3c-2.4-2.5-4.4-5.5-6.3-8.5l-5-8C36,61.8,35,59.3,35,57.3c0-1,0.1-1.9,0.5-2.6 c0.4-0.8,1-1.5,1.7-2c0.4-0.2,0.8-0.5,1.2-0.6c-0.3-4.3-0.4-9.8-0.2-14.4c0.1-1.1,0.3-2.2,0.6-3.3c1.3-4.6,4.5-8.3,8.5-10.8 c1.4-0.9,2.9-1.6,4.6-2.2c2.9-1.1,1.5-5.5,4.7-5.6c7.5-0.2,19.8,6.2,24.6,11.4c2.8,3,4.6,7,4.9,12.3l-0.3,13.1l0,0 c1.4,0.4,2.3,1.3,2.7,2.7c0.4,1.6,0,3.8-1.4,6.9l0,0c0,0.1-0.1,0.1-0.1,0.2l-5.7,9.4c-2.2,3.6-4.5,7.3-7.5,10.1L73.7,82l0,0 c0.4,0.5,0.8,1.1,1.2,1.7c0.8,1.1,1.6,2.4,2.5,3.6c5.3,4.5,19.3,5.9,26.7,8.6c7.6-9.4,12.1-21.4,12.1-34.4c0-15.1-6.1-28.8-16-38.7 c-9.9-9.9-23.6-16-38.7-16s-28.8,6.1-38.7,16c-9.9,9.9-16,23.6-16,38.7C6.7,74.4,11.2,86.3,18.8,95.7L18.8,95.7z M77,90.5 c-1.4-1.6-2.8-3.7-4.1-5.5c-0.4-0.5-0.7-1.1-1.1-1.5c-2.7,2-6,3.3-10.3,3.3c-4.5,0-8-1.6-10.9-4.1c0,0,0,0.1-0.1,0.1 c-0.5,0.7-1,1.4-1.6,2.3c-1.1,1.6-2.3,3.3-3.4,4.8C45.6,100,71.1,106,77,90.5L77,90.5z"})],-1),gr=[_r],br={class:"font-bold"},wr={class:"text-sm opacity-50"},xr={class:"badge badge-ghost badge-sm"},Er={class:"flex justify-end"},Cr=["data-tip"],vr=["onClick"],Sr=a("i",{class:"far fa-eye"},null,-1),Tr=[Sr],Rr=["data-tip"],Or=["onClick"],Ar=a("i",{class:"fas fa-pencil-alt"},null,-1),Pr=[Ar],kr=["data-tip"],Dr=["onClick"],Nr=a("i",{class:"far fa-trash-alt"},null,-1),Br=[Nr],Fr={key:1},Mr=a("div",{class:"flex gap-4 items-center"},[a("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),a("div",{class:"flex flex-col gap-4 w-full"},[a("div",{class:"skeleton h-4 w-full"}),a("div",{class:"skeleton h-4 w-full"})])],-1),Lr=a("div",{class:"divider my-1"},null,-1),jr=[Mr,Lr],Ur={class:"join ecwp_pagination mt-6 pt-4"},Ir=["onClick"];function qr(e,t,n,s,o,r){const i=V("client-details-modal"),c=V("client-edit-modal"),f=V("remove-modal"),h=V("AddClientModal"),d=V("Card");return y(),_("div",Go,[o.toast.visible?(y(),_("div",{key:0,class:L(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:L(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),z(i,{loading:o.loadingModal,"show-modal":o.showClientDetailsModal,"modal-id":"modal_client_details","modal-title":r.translations.client_details,client:o.selectedClient,onClose:t[0]||(t[0]=u=>o.showClientDetailsModal=!1)},null,8,["loading","show-modal","modal-title","client"]),z(c,{loading:o.loadingModal,"show-modal":o.editClientModal,"modal-id":"modal_client_edit","modal-title":r.translations.edit_client,client:o.selectedClient,onClose:t[1]||(t[1]=u=>o.editClientModal=!1),onClientEdited:r.fetchClients},null,8,["loading","show-modal","modal-title","client","onClientEdited"]),z(f,{"show-modal":o.showRemoveModal,title:r.translations.are_you_sure,message:r.translations.no_turning_back,confirmText:r.translations.yes_delete_it,cancelText:r.translations.cancel,onConfirm:t[2]||(t[2]=u=>r.deleteClient(o.selectedClient)),onCancel:t[3]||(t[3]=u=>o.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),z(d,{topMargin:"mt-8"},{default:bt(()=>[a("div",Zo,[a("h2",Qo,m(r.translations.clients),1),a("div",null,[a("button",{class:"btn btn-primary rounded-full",onClick:t[4]||(t[4]=(...u)=>r.AddNew&&r.AddNew(...u))},[K(m(r.translations.add)+" ",1),Yo]),o.settings.easy_compta_export_addon_active==1?(y(),_("span",er,[a("a",tr,[K(m(r.translations.export)+" ",1),nr])])):(y(),_("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":r.translations.active_export_addon},[a("button",or,[K(m(r.translations.export)+" ",1),rr])],8,sr))])]),ir,z(h,{onClientAdded:r.fetchClients},null,8,["onClientAdded"]),a("div",ar,[a("label",lr,m(r.translations.display_per_page),1),A(a("select",{id:"perPageSelect","onUpdate:modelValue":t[5]||(t[5]=u=>o.perPage=u),onChange:t[6]||(t[6]=(...u)=>r.perPageChanged&&r.perPageChanged(...u))},[(y(!0),_(T,null,R(o.perPageOptions,u=>(y(),_("option",{key:u,value:u},m(u),9,cr))),128))],544),[[Ce,o.perPage]])]),a("div",dr,[o.loading?(y(),_("div",Fr,[(y(!0),_(T,null,R(o.skeletonRows,u=>(y(),_("div",{key:u,class:"flex flex-col gap-4 w-full"},jr))),128))])):(y(),_("table",ur,[a("thead",null,[a("tr",null,[a("th",null,m(r.translations.company_name),1),a("th",null,m(r.translations.manager_name),1),a("th",null,m(r.translations.email),1),a("th",null,m(r.translations.phone),1),a("th",fr,m(r.translations.actions),1)])]),a("tbody",null,[(y(!0),_(T,null,R(o.clients,u=>(y(),_("tr",{key:u.id},[a("td",null,[a("div",hr,[a("div",mr,[a("div",pr,[(y(),_("svg",yr,gr))])]),a("div",null,[a("div",br,m(u.company_name),1),a("div",wr,[a("span",xr,m(u.city)+" - "+m(u.country),1)])])])]),a("td",null,m(u.manager_name),1),a("td",null,m(u.email),1),a("td",null,m(u.phone),1),a("td",Er,[a("span",{class:"lg:tooltip","data-tip":r.translations.view},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.showClientDetails(u)},Tr,8,vr)],8,Cr),a("span",{class:"lg:tooltip","data-tip":r.translations.edit},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.editClient(u)},Pr,8,Or)],8,Rr),a("span",{class:"lg:tooltip","data-tip":r.translations.delete},[a("button",{onClick:w=>r.confirmDeleteClient(u),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Br,8,Dr)],8,kr)])]))),128))])])),a("div",Ur,[(y(!0),_(T,null,R(o.paginationButtons,u=>(y(),_("button",{key:u,class:L(["join-item btn",{"btn-disabled":u==="..."||u===o.currentPage}]),onClick:w=>r.goToPage(u)},m(u),11,Ir))),128))])])]),_:1})])}var Hr=oe($o,[["render",qr]]);const pe=se;(function(e,t){const n=se,s=e();for(;[];)try{if(parseInt(n(210))/1*(parseInt(n(215))/2)+-parseInt(n(218))/3*(parseInt(n(217))/4)+-parseInt(n(207))/5+parseInt(n(214))/6+-parseInt(n(211))/7+-parseInt(n(206))/8+-parseInt(n(216))/9*(-parseInt(n(212))/10)===t)break;s.push(s.shift())}catch{s.push(s.shift())}})(ne,486906);function ne(){const e=["72438YFCath","3393FXjSGD","32IVtIaC","272991anFByo","3929712CjByPB","1368365crMnFV","use","mount","23dofBfg","5667739LmMOZs","28190JUicqr","#my-easy-compta-clients-app","5361876oAyYNq"];return ne=function(){return e},ne()}function se(e,t){const n=ne();return se=function(s,o){return s=s-206,n[s]},se(e,t)}const Vr=wt({render:()=>xt(Hr)});Vr[pe(208)](Rt)[pe(209)](pe(213));
  • my-easy-compta/trunk/assets/dist/credits.min.js

    r3166746 r3167980  
    1 import{_ as b,d as x,o as r,c as d,n as m,a as e,t as i,g,e as y,p as C,i as k,F as h,r as u,j as I,f as T,h as j}from"./plugin-vue_export-helper.min.js";import{C as E,R as B}from"./RemoveAlert.min.js";import{g as M,b as R,s as A,f as D}from"./api.min.js";const S={name:"Credits",components:{Card:E,RemoveModal:B},data(){return{credits:[],selectedCredit:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingPdfId:null,loadingModal:!1,showRemoveModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchCredits(),this.loadSettings()},methods:{fetchCredits(n=1){this.loading=!0;const{perPage:t}=this;fetch(`/wp-json/my-easy-compta/v1/credits?page=${n}&per_page=${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(o=>o.json()).then(o=>{this.credits=o.credits,this.totalCount=o.total_count,this.totalPages=o.total_pages,this.currentPage=o.page,this.perPage=t,this.generatePaginationButtons()}).catch(o=>{console.error("Error fetching credits:",o)}).finally(()=>{this.loading=!1})},generatePaginationButtons(){this.paginationButtons=M(this.currentPage,this.totalPages)},goToPage(n){n!=="..."&&this.fetchCredits(n)},perPageChanged(){this.fetchCredits()},formatAmount(n,t){return R(n,t,this.settings.currency_position)},showToast(n,t){A(this.toast,n,t)},confirmDeleteCredit(n){this.selectedCredit=n,modal_remove.showModal(),this.showRemoveModal=!0},deleteCredit(n){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/credits/${n}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.fetchCredits(),this.showToast(t.message,"alert-success")):(this.showToast(t.message,"alert-error"),console.error("Error deleting credit:",t.statusText))}).catch(t=>{console.error("Error deleting credit:",t)})},exportToPDF(n){this.loadingPdfId=n,fetch(`/wp-json/my-easy-compta/v1/credits/pdf/${n}`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>{if(!t.ok)throw this.loadingPdfId=null,new Error("Network response was not ok");return this.loadingPdfId=null,t.blob()}).then(t=>{const o=URL.createObjectURL(t);this.loadingPdfId=null,window.open(o)}).catch(t=>{this.loadingPdfId=null,console.error("There was a problem with the fetch operation:",t)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:n,currencySymbol:t,vatData:o}=await D();this.settings=n,this.default_currency_symbol=t,this.default_vat=o,this.loadingPrice=!1}catch(n){this.showToast(n.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},F={class:"pt-2 pr-4"},W={class:"flex justify-between items-center"},V={class:"card-title"},L=e("div",{class:"divider mt-2"},null,-1),N={class:"flex items-center mb-4"},O={for:"perPageSelect",class:"mr-2"},U=["value"],X={class:"overflow-x-auto"},G={key:0,class:"table w-full"},Q={class:"flex justify-end"},z={key:0},J={key:1},Z=e("span",{class:"loading loading-bars loading-sm"},null,-1),q=[Z],H={class:"flex justify-end"},K=["data-tip"],Y=["onClick"],$=e("i",{class:"far fa-trash-alt"},null,-1),ee=[$],te=["data-tip"],se=["onClick","disabled"],ne={key:0,class:"far fa-file-pdf","aria-hidden":"true"},oe={key:1,class:"loading loading-spinner loading-sm"},ae={key:1},le=e("div",{class:"flex gap-4 items-center"},[e("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),e("div",{class:"flex flex-col gap-4 w-full"},[e("div",{class:"skeleton h-4 w-full"}),e("div",{class:"skeleton h-4 w-full"})])],-1),ie=e("div",{class:"divider my-1"},null,-1),re=[le,ie],de={class:"join ecwp_pagination mt-6 pt-4"},ce=["onClick"];function he(n,t,o,c,a,l){const w=x("remove-modal"),P=x("Card");return r(),d("div",F,[a.toast.visible?(r(),d("div",{key:0,class:m(["toast",a.toast.position]),style:{zIndex:9999}},[e("div",{class:m(["alert",a.toast.type,"text-white"])},[e("span",null,i(a.toast.message),1)],2)],2)):g("",!0),y(w,{"show-modal":a.showRemoveModal,title:l.translations.are_you_sure,message:l.translations.no_turning_back,confirmText:l.translations.yes_delete_it,cancelText:l.translations.cancel,onConfirm:t[0]||(t[0]=s=>this.deleteCredit(a.selectedCredit)),onCancel:t[1]||(t[1]=s=>a.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),y(P,{topMargin:"mt-8"},{default:C(()=>[e("div",W,[e("h2",V,i(l.translations.credits),1)]),L,e("div",N,[e("label",O,i(l.translations.display_per_page),1),k(e("select",{id:"perPageSelect","onUpdate:modelValue":t[2]||(t[2]=s=>a.perPage=s),onChange:t[3]||(t[3]=(...s)=>l.perPageChanged&&l.perPageChanged(...s))},[(r(!0),d(h,null,u(a.perPageOptions,s=>(r(),d("option",{key:s,value:s},i(s),9,U))),128))],544),[[I,a.perPage]])]),e("div",X,[a.loading?(r(),d("div",ae,[(r(!0),d(h,null,u(a.skeletonRows,s=>(r(),d("div",{key:s,class:"flex flex-col gap-4 w-full"},re))),128))])):(r(),d("table",G,[e("thead",null,[e("tr",null,[e("th",null,i(l.translations.credit_number),1),e("th",null,i(l.translations.invoice_number),1),e("th",null,i(l.translations.client),1),e("th",null,i(l.translations.payment_date),1),e("th",null,i(l.translations.created_at),1),e("th",null,i(l.translations.amount),1),e("th",Q,i(l.translations.actions),1)])]),e("tbody",null,[(r(!0),d(h,null,u(a.credits,s=>(r(),d("tr",{key:s.id},[e("td",null,i(s.credit_number),1),e("td",null,i(s.invoice_number),1),e("td",null,i(s.client_name),1),e("td",null,i(s.due_date),1),e("td",null,i(s.created_at),1),e("td",null,[a.loadingPrice?(r(),d("div",J,q)):(r(),d("div",z,[e("span",null,i(l.formatAmount(s.total_amount,a.default_currency_symbol)),1)]))]),e("td",H,[e("span",{class:"lg:tooltip","data-tip":l.translations.delete},[e("button",{onClick:p=>l.confirmDeleteCredit(s.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},ee,8,Y)],8,K),e("span",{class:"lg:tooltip","data-tip":l.translations.export},[e("button",{onClick:p=>l.exportToPDF(s.credit_id),class:"btn btn-circle mx-1 text-green-700",disabled:a.loadingPdfId===s.credit_id},[a.loadingPdfId!==s.credit_id?(r(),d("i",ne)):g("",!0),a.loadingPdfId===s.credit_id?(r(),d("span",oe)):g("",!0)],8,se)],8,te)])]))),128))])])),e("div",de,[(r(!0),d(h,null,u(a.paginationButtons,s=>(r(),d("button",{key:s,class:m(["join-item btn",{"btn-disabled":s==="..."||s===a.currentPage}]),onClick:p=>l.goToPage(s)},i(s),11,ce))),128))])])]),_:1})])}var ue=b(S,[["render",he]]);const v=_;(function(n,t){const o=_,c=n();for(;[];)try{if(parseInt(o(255))/1*(parseInt(o(251))/2)+parseInt(o(254))/3+-parseInt(o(249))/4+parseInt(o(248))/5+-parseInt(o(247))/6+-parseInt(o(250))/7*(parseInt(o(258))/8)+parseInt(o(257))/9*(parseInt(o(252))/10)===t)break;c.push(c.shift())}catch{c.push(c.shift())}})(f,509948);const _e=T({render:()=>j(ue)});_e[v(256)](v(253));function _(n,t){const o=f();return _=function(c,a){return c=c-247,o[c]},_(n,t)}function f(){const n=["10663570fimNje","#my-easy-compta-credits-app","1084494wQGQhv","139PboBxj","mount","9bBPUMa","288VZklOk","4597572QDSnFX","2546955ynMCwW","3926204aFJWho","114142FGoCpa","13058nAWdoJ"];return f=function(){return n},f()}
     1import{_ as b,d as x,o as r,c as d,n as f,a as t,t as i,g,e as y,p as C,i as k,F as h,r as u,j as T,f as I,h as j}from"./plugin-vue_export-helper.min.js";import{C as E,R as B}from"./RemoveAlert.min.js";import{g as M,b as R,s as D,f as A}from"./api.min.js";const S={name:"Credits",components:{Card:E,RemoveModal:B},data(){return{credits:[],selectedCredit:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingPdfId:null,loadingModal:!1,showRemoveModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchCredits(),this.loadSettings()},methods:{fetchCredits(n=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/credits?page=${n}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(o=>o.json()).then(o=>{this.credits=o.credits,this.totalCount=o.total_count,this.totalPages=o.total_pages,this.currentPage=o.page,this.perPage=e,this.generatePaginationButtons()}).catch(o=>{console.error("Error fetching credits:",o)}).finally(()=>{this.loading=!1})},generatePaginationButtons(){this.paginationButtons=M(this.currentPage,this.totalPages)},goToPage(n){n!=="..."&&this.fetchCredits(n)},perPageChanged(){this.fetchCredits()},formatAmount(n,e){return R(n,e,this.settings.currency_position)},showToast(n,e){D(this.toast,n,e)},confirmDeleteCredit(n){this.selectedCredit=n,modal_remove.showModal(),this.showRemoveModal=!0},deleteCredit(n){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/credits/${n}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchCredits(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting credit:",e.statusText))}).catch(e=>{console.error("Error deleting credit:",e)})},exportToPDF(n){this.loadingPdfId=n,fetch(`/wp-json/my-easy-compta/v1/credits/pdf/${n}`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw this.loadingPdfId=null,new Error("Network response was not ok");return this.loadingPdfId=null,e.blob()}).then(e=>{const o=URL.createObjectURL(e);this.loadingPdfId=null,window.open(o)}).catch(e=>{this.loadingPdfId=null,console.error("There was a problem with the fetch operation:",e)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:n,currencySymbol:e,vatData:o}=await A();this.settings=n,this.default_currency_symbol=e,this.default_vat=o,this.loadingPrice=!1}catch(n){this.showToast(n.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},L={class:"pt-2 pr-4"},V={class:"flex justify-between items-center"},F={class:"card-title"},N=t("div",{class:"divider mt-2"},null,-1),U={class:"flex items-center mb-4"},W={for:"perPageSelect",class:"mr-2"},O=["value"],X={class:"overflow-x-auto"},z={key:0,class:"table w-full"},G={class:"flex justify-end"},q={key:0},H={key:1},J=t("span",{class:"loading loading-bars loading-sm"},null,-1),Q=[J],Z={class:"flex justify-end"},K=["data-tip"],Y=["onClick"],$=t("i",{class:"far fa-trash-alt"},null,-1),tt=[$],et=["data-tip"],st=["onClick","disabled"],nt={key:0,class:"far fa-file-pdf","aria-hidden":"true"},ot={key:1,class:"loading loading-spinner loading-sm"},at={key:1},lt=t("div",{class:"flex gap-4 items-center"},[t("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),t("div",{class:"flex flex-col gap-4 w-full"},[t("div",{class:"skeleton h-4 w-full"}),t("div",{class:"skeleton h-4 w-full"})])],-1),it=t("div",{class:"divider my-1"},null,-1),rt=[lt,it],dt={class:"join ecwp_pagination mt-6 pt-4"},ct=["onClick"];function ht(n,e,o,c,a,l){const w=x("remove-modal"),P=x("Card");return r(),d("div",L,[a.toast.visible?(r(),d("div",{key:0,class:f(["toast",a.toast.position]),style:{zIndex:9999}},[t("div",{class:f(["alert",a.toast.type,"text-white"])},[t("span",null,i(a.toast.message),1)],2)],2)):g("",!0),y(w,{"show-modal":a.showRemoveModal,title:l.translations.are_you_sure,message:l.translations.no_turning_back,confirmText:l.translations.yes_delete_it,cancelText:l.translations.cancel,onConfirm:e[0]||(e[0]=s=>this.deleteCredit(a.selectedCredit)),onCancel:e[1]||(e[1]=s=>a.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),y(P,{topMargin:"mt-8"},{default:C(()=>[t("div",V,[t("h2",F,i(l.translations.credits),1)]),N,t("div",U,[t("label",W,i(l.translations.display_per_page),1),k(t("select",{id:"perPageSelect","onUpdate:modelValue":e[2]||(e[2]=s=>a.perPage=s),onChange:e[3]||(e[3]=(...s)=>l.perPageChanged&&l.perPageChanged(...s))},[(r(!0),d(h,null,u(a.perPageOptions,s=>(r(),d("option",{key:s,value:s},i(s),9,O))),128))],544),[[T,a.perPage]])]),t("div",X,[a.loading?(r(),d("div",at,[(r(!0),d(h,null,u(a.skeletonRows,s=>(r(),d("div",{key:s,class:"flex flex-col gap-4 w-full"},rt))),128))])):(r(),d("table",z,[t("thead",null,[t("tr",null,[t("th",null,i(l.translations.credit_number),1),t("th",null,i(l.translations.invoice_number),1),t("th",null,i(l.translations.client),1),t("th",null,i(l.translations.payment_date),1),t("th",null,i(l.translations.created_at),1),t("th",null,i(l.translations.amount),1),t("th",G,i(l.translations.actions),1)])]),t("tbody",null,[(r(!0),d(h,null,u(a.credits,s=>(r(),d("tr",{key:s.id},[t("td",null,i(s.credit_number),1),t("td",null,i(s.invoice_number),1),t("td",null,i(s.client_name),1),t("td",null,i(s.due_date),1),t("td",null,i(s.created_at),1),t("td",null,[a.loadingPrice?(r(),d("div",H,Q)):(r(),d("div",q,[t("span",null,i(l.formatAmount(s.total_amount,a.default_currency_symbol)),1)]))]),t("td",Z,[t("span",{class:"lg:tooltip","data-tip":l.translations.delete},[t("button",{onClick:p=>l.confirmDeleteCredit(s.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},tt,8,Y)],8,K),t("span",{class:"lg:tooltip","data-tip":l.translations.export},[t("button",{onClick:p=>l.exportToPDF(s.credit_id),class:"btn btn-circle mx-1 text-green-700",disabled:a.loadingPdfId===s.credit_id},[a.loadingPdfId!==s.credit_id?(r(),d("i",nt)):g("",!0),a.loadingPdfId===s.credit_id?(r(),d("span",ot)):g("",!0)],8,st)],8,et)])]))),128))])])),t("div",dt,[(r(!0),d(h,null,u(a.paginationButtons,s=>(r(),d("button",{key:s,class:f(["join-item btn",{"btn-disabled":s==="..."||s===a.currentPage}]),onClick:p=>l.goToPage(s)},i(s),11,ct))),128))])])]),_:1})])}var ut=b(S,[["render",ht]]);const v=_;function _(n,e){const o=m();return _=function(c,a){return c=c-139,o[c]},_(n,e)}(function(n,e){const o=_,c=n();for(;[];)try{if(parseInt(o(148))/1+-parseInt(o(145))/2+parseInt(o(141))/3+-parseInt(o(143))/4+-parseInt(o(142))/5+-parseInt(o(144))/6+parseInt(o(146))/7*(parseInt(o(140))/8)===e)break;c.push(c.shift())}catch{c.push(c.shift())}})(m,600957);function m(){const n=["mount","3001912BgQbMe","3062337uqwMbj","3552295TpffrL","1722952DwBCZH","3095532BPVbJl","2299952ReUpdW","42kLdMtG","#my-easy-compta-credits-app","135839NCPwhj"];return m=function(){return n},m()}const _t=I({render:()=>j(ut)});_t[v(139)](v(147));
  • my-easy-compta/trunk/assets/dist/expenses.min.js

    r3166746 r3167980  
    1 import{_ as D,o as a,c as i,a as t,t as d,w as A,F as g,r as x,n as f,i as y,k as V,g as _,j as E,v as P,m as w,d as b,H as T,e as v,p as j,f as B,h as I}from"./plugin-vue_export-helper.min.js";import{C as S,R as N}from"./RemoveAlert.min.js";import{T as U}from"./VueSearchSelect.min.js";import{V as F}from"./vue-datepicker.min.js";import{f as O,g as R,b as q,s as X}from"./api.min.js";const W={data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{loadingBtn:!1,formData:{amount:"",expense_date:"",client_id:"",category_id:"",attachment:null,note:""},options:{clients:[],categories:[]},fields:{expense_date:{label:s.expense_date},client_id:{label:s.client},amount:{label:s.amount},category_id:{label:s.category}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{async fetchOptions(){try{const s=await fetch("/wp-json/my-easy-compta/v1/expenses/clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}),e=await fetch("/wp-json/my-easy-compta/v1/expenses/categories",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const r=await e.json();this.options.categories=r;const u=await s.json();this.options.clients=u}else console.error("Erreur lors de la r\xE9cup\xE9ration des cat\xE9gories")}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des options:",s)}},async submitForm(){this.loadingBtn=!0;const s=new FormData;s.append("amount",this.formData.amount),s.append("expense_date",this.formData.expense_date),s.append("client_id",this.formData.client_id),s.append("category_id",this.formData.category_id),this.$refs.attachment.files[0]&&s.append("attachment",this.$refs.attachment.files[0]),s.append("note",this.formData.note);try{const e=await fetch("/wp-json/my-easy-compta/v1/expenses",{method:"POST",body:s,headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const r=await e.json();this.loadingBtn=!1,this.$emit("expenseAdded"),this.resetForm(),this.closeModal()}else console.error("Erreur lors de l'ajout de la d\xE9pense"),this.loadingBtn=!1}catch(e){console.error("Erreur lors de l'ajout de la d\xE9pense:",e),this.loadingBtn=!1}},closeModal(){document.getElementById("modal_expenses").close()},resetForm(){this.formData={amount:"",expense_date:"",client_id:"",category_id:"",attachment:null,note:""},this.$refs.attachment.value=null}},mounted(){this.fetchOptions()}},L={id:"modal_expenses",class:"modal"},z={class:"modal-box"},Z={class:"font-bold text-lg"},H={class:"grid grid-cols-2 gap-4"},J=["for"],K=["type","id","onUpdate:modelValue"],Q=["id"],Y=["value"],G={value:""},$=["value"],ee={class:"ecwp-group form-group relative"},te={for:"attachment",class:"ecwp-label form-label"},se={type:"file",id:"attachment",ref:"attachment",class:"ecwp-input input input-bordered w-full peer"},ne={class:"ecwp-group form-group mt-4 relative"},oe={for:"note",class:"ecwp-label form-label"},ae={class:"form-group mt-4 flex justify-end"},le=["disabled"],ie={key:0,class:"loading loading-spinner loading-sm"};function re(s,e,r,u,n,o){return a(),i("div",null,[t("dialog",L,[t("div",z,[t("h3",Z,d(o.translations.add),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...h)=>o.closeModal&&o.closeModal(...h))}," \u2715 "),t("form",{onSubmit:e[5]||(e[5]=A((...h)=>o.submitForm&&o.submitForm(...h),["prevent"]))},[t("div",H,[(a(!0),i(g,null,x(n.fields,(h,p)=>(a(),i("div",{key:p,class:"ecwp-group form-group"},[t("label",{for:p,class:f(["ecwp-label form-label",p==="client_id"?"label-search":""])},d(h.label),11,J),p!=="category_id"&&p!=="client_id"&&p!=="expense_date"?y((a(),i("input",{key:0,type:h.type||"text",id:p,"onUpdate:modelValue":c=>n.formData[p]=c,class:f(["ecwp-input input","input-bordered",h.class||"w-full"])},null,10,K)),[[V,n.formData[p]]]):_("",!0),p==="category_id"?y((a(),i("select",{key:1,id:p,"onUpdate:modelValue":e[1]||(e[1]=c=>n.formData.category_id=c),class:f(["ecwp-input input","input-bordered",h.class||"w-full"])},[(a(!0),i(g,null,x(n.options.categories,c=>(a(),i("option",{key:c.id,value:c.id},d(c.name),9,Y))),128))],10,Q)),[[E,n.formData.category_id]]):_("",!0),p==="client_id"?y((a(),i("select",{key:2,id:"client_id","onUpdate:modelValue":e[2]||(e[2]=c=>n.formData.client_id=c),class:"ecwp-input input input-bordered w-full peer"},[t("option",G,d(o.translations.select_client),1),(a(!0),i(g,null,x(n.options.clients,c=>(a(),i("option",{key:c.id,value:c.id},d(c.company_name),9,$))),128))],512)),[[E,n.formData.client_id]]):_("",!0),p=="expense_date"?y((a(),i("input",{key:3,type:"date",id:"expense_date","onUpdate:modelValue":e[3]||(e[3]=c=>n.formData.expense_date=c),class:"ecwp-input input input-bordered w-full peer",placeholder:"Date de d\xE9pense",required:""},null,512)),[[P,n.formData.expense_date]]):_("",!0)]))),128))]),t("div",ee,[t("label",te,d(o.translations.attached_file),1),t("input",se,null,512)]),t("div",ne,[t("label",oe,d(o.translations.note),1),y(t("textarea",{id:"note","onUpdate:modelValue":e[4]||(e[4]=h=>n.formData.note=h),class:"ecwp-input textarea textarea-bordered w-full peer",rows:"4",placeholder:"Note"},null,512),[[P,n.formData.note]])]),t("div",ae,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(d(o.translations.add)+" ",1),n.loadingBtn?(a(),i("span",ie)):_("",!0)],8,le)])],32)])])])}var de=D(W,[["render",re]]);const ce={components:{ModelSelect:U,VueDatePicker:F},props:{loading:{type:Boolean,default:!1},showModal:{type:Boolean,default:!1},modalId:{type:String,required:!0},modalTitle:{type:String,default:""},expense:{type:Object,default:()=>({id:null,expense_date:"",client_id:"",amount:"",category_id:"",notes:""})},categories:Array,clients:Array},data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{editedExpense:{...this.expense},loadingBtn:!1,clientOptions:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{expense_date:{label:s.expense_date},client_id:{label:s.client},amount:{label:s.amount},category_id:{label:s.category}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return s=>{if(!s)return"";const e=s.getDate().toString().padStart(2,"0"),r=(s.getMonth()+1).toString().padStart(2,"0"),u=s.getFullYear();return`${e}-${r}-${u}`}},skeletonItems(){return Array.from({length:10},(s,e)=>e)},categoriesExpenses(){return this.categories},clients(){return this.clients}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const s=await fetch(`/wp-json/my-easy-compta/v1/expenses/${this.editedExpense.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedExpense)});if(s.ok){const e=await s.json();this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("expenseEdited"),this.loadingBtn=!1}else{const e=`Error editing expense: ${s.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(s){const e=s.response&&s.response.data&&s.response.data.message?s.response.data.message:"Error editing expense";this.showToast(e,"alert-error"),console.error("Error editing expense:",s),this.loadingBtn=!1}},showToast(s,e){this.toast.message=s,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{expense:{handler(s){this.editedExpense={...s}},immediate:!0}}},pe=["id","open"],ue={class:"modal-box"},me={class:"font-bold text-lg"},he={key:0},_e={class:"grid grid-cols-2 gap-4"},fe=t("div",{class:"skeleton h-4 w-full mb-2"},null,-1),ge=t("div",{class:"skeleton h-4 w-full"},null,-1),xe=[fe,ge],ye={class:"grid grid-cols-2 gap-4"},be=["for"],we=["type","id","onUpdate:modelValue"],ve=["id"],Ee=["value"],ke={class:"ecwp-group form-group mt-4"},Ce={for:"note",class:"ecwp-label form-label"},Pe={class:"form-group mt-4 flex justify-end"},De=["disabled"],Me={key:0,class:"loading loading-spinner loading-sm"};function Te(s,e,r,u,n,o){const h=b("model-select"),p=b("VueDatePicker");return a(),i("div",null,[n.toast.visible?(a(),i("div",{key:0,class:f(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:f(["alert",n.toast.type,"text-white"])},[t("span",null,d(n.toast.message),1)],2)],2)):_("",!0),t("dialog",{id:r.modalId,class:"modal",open:r.showModal},[t("div",ue,[t("h3",me,d(r.modalTitle),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...c)=>o.closeModal&&o.closeModal(...c))}," \u2715 "),r.loading?(a(),i("div",he,[t("div",_e,[(a(!0),i(g,null,x(o.skeletonItems,c=>(a(),i("div",{key:c,class:"py-2"},xe))),128))])])):(a(),i("form",{key:1,onSubmit:e[5]||(e[5]=A((...c)=>o.submitForm&&o.submitForm(...c),["prevent"])),class:"form"},[t("div",ye,[(a(!0),i(g,null,x(n.fields,(c,m)=>(a(),i("div",{key:m,class:"ecwp-group form-group"},[t("label",{for:m,class:f(["ecwp-label form-label",m==="client_id"?"label-search":""])},d(c.label),11,be),m!=="category_id"&&m!=="client_id"&&m!=="expense_date"?y((a(),i("input",{key:0,type:c.type||"text",id:m,"onUpdate:modelValue":l=>n.editedExpense[m]=l,class:f(["ecwp-input input","input-bordered",c.class||"w-full"])},null,10,we)),[[V,n.editedExpense[m]]]):_("",!0),m==="category_id"?y((a(),i("select",{key:1,id:m,"onUpdate:modelValue":e[1]||(e[1]=l=>n.editedExpense.category_id=l),class:f(["ecwp-input input","input-bordered",c.class||"w-full"])},[(a(!0),i(g,null,x(o.categoriesExpenses,l=>(a(),i("option",{key:l.id,value:l.id},d(l.name),9,Ee))),128))],10,ve)),[[E,n.editedExpense.category_id]]):_("",!0),m==="client_id"?(a(),T(h,{key:2,modelValue:n.editedExpense.client_id,"onUpdate:modelValue":e[2]||(e[2]=l=>n.editedExpense.client_id=l),options:o.clients,label:"text","track-by":"value",placeholder:o.translations.select,class:"ecwp-input input input-bordered w-full",required:""},null,8,["modelValue","options","placeholder"])):_("",!0),m=="expense_date"?(a(),T(p,{key:3,class:"ecwp-input ecwp-date input input-bordered w-full",id:"invoiceDate",modelValue:n.editedExpense.expense_date,"onUpdate:modelValue":e[3]||(e[3]=l=>n.editedExpense.expense_date=l),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,locale:"fr",required:""},null,8,["modelValue","format"])):_("",!0)]))),128))]),t("div",ke,[t("label",Ce,d(o.translations.note),1),y(t("textarea",{id:"note","onUpdate:modelValue":e[4]||(e[4]=c=>n.editedExpense.notes=c),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[P,n.editedExpense.notes]])]),t("div",Pe,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(d(o.translations.save)+" ",1),n.loadingBtn?(a(),i("span",Me)):_("",!0)],8,De)])],32))])],8,pe)])}var Ae=D(ce,[["render",Te]]);const Ve={name:"Expenses",components:{Card:S,AddExpenseModal:de,ExpenseEditModal:Ae,RemoveModal:N},data(){return{expenses:[],categoriesExpenses:[],listClients:[],clientOptions:[],currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},editExpenseModal:!1,showRemoveModal:!1,selectedExpense:null}},created(){this.fetchExpenses(),this.loadSettings()},methods:{AddNew(){modal_expenses.showModal()},isImage(s){return["jpg","jpeg","png","gif","webp"].includes(s)},fetchExpenses(s=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/expenses?page=${s}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(r=>r.json()).then(r=>{this.expenses=r.expenses,this.totalPages=r.total_pages,this.currentPage=r.page,this.totalCount=r.total_count,this.perPage=e,this.generatePaginationButtons()}).catch(r=>{console.error("Error fetching expenses:",r)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:s,currencySymbol:e,vatData:r}=await O();this.settings=s,this.default_currency_symbol=e,this.default_vat=r,this.loadingPrice=!1}catch(s){this.showToast(s.message,"alert-error"),this.loadingPrice=!1}},generatePaginationButtons(){this.paginationButtons=R(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchExpenses(s)},perPageChanged(){this.fetchExpenses()},formatAmount(s,e){return q(s,e,this.settings.currency_position)},showToast(s,e){X(this.toast,s,e)},editExpense(s){this.loadingModal=!0,this.editExpenseModal=!0,modal_expense_edit.showModal(),this.fetchExpenseDetails(s)},fetchExpenseDetails(s){fetch(`/wp-json/my-easy-compta/v1/expenses/details/${s}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedExpense=e,this.categoriesExpenses=e.categories_expenses,this.listClients=e.list_clients,this.clientOptions=this.listClients.map(r=>({value:r.id,text:`${r.company_name}`})),this.loadingModal=!1}).catch(e=>{console.error("Error fetching payment details:",e),this.loadingModal=!1})},confirmDeleteExpense(s){this.selectedExpense=s,modal_remove.showModal(),this.showRemoveModal=!0},deleteExpense(s){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/expenses/${s}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchExpenses(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting expense:",e.statusText))}).catch(e=>{console.error("Error deleting expense:",e)}),this.showRemoveModal=!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},defaultImage(){return window.myEasyComptaAdmin.pluginUrl+"/assets/img/file.svg"}}},je={class:"pt-2 pr-4"},Be={class:"flex justify-between items-center"},Ie={class:"card-title"},Se=t("i",{class:"fas fa-plus-circle"},null,-1),Ne={key:0,class:"ms-2"},Ue={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab5"},Fe=t("i",{class:"fas fa-file-export"},null,-1),Oe=["data-tip"],Re={class:"btn btn-outline btn-accent rounded-full",disabled:""},qe=t("i",{class:"fas fa-file-export"},null,-1),Xe=t("div",{class:"divider mt-2"},null,-1),We={class:"flex items-center mb-4"},Le={for:"perPageSelect",class:"mr-2"},ze=["value"],Ze={class:"overflow-x-auto"},He={key:0,class:"table w-full"},Je={class:"flex justify-center"},Ke={key:0},Qe={key:1},Ye=t("span",{class:"loading loading-bars loading-sm"},null,-1),Ge=[Ye],$e={key:0,class:"avatar"},et={key:0,class:"w-16 mask mask-squircle"},tt=["href"],st=["src"],nt={key:1,class:"w-16 mask mask-squircle"},ot=["href"],at=["src"],lt={class:"flex justify-end"},it=["data-tip"],rt=["onClick"],dt=t("i",{class:"fas fa-pencil-alt"},null,-1),ct=[dt],pt=["data-tip"],ut=["onClick"],mt=t("i",{class:"far fa-trash-alt"},null,-1),ht=[mt],_t={key:1},ft=t("div",{class:"flex gap-4 items-center"},[t("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),t("div",{class:"flex flex-col gap-4 w-full"},[t("div",{class:"skeleton h-4 w-full"}),t("div",{class:"skeleton h-4 w-full"})])],-1),gt=t("div",{class:"divider my-1"},null,-1),xt=[ft,gt],yt={class:"join ecwp_pagination mt-6 pt-4"},bt=["onClick"];function wt(s,e,r,u,n,o){const h=b("AddExpenseModal"),p=b("expense-edit-modal"),c=b("remove-modal"),m=b("Card");return a(),i("div",je,[n.toast.visible?(a(),i("div",{key:0,class:f(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:f(["alert",n.toast.type,"text-white"])},[t("span",null,d(n.toast.message),1)],2)],2)):_("",!0),v(h,{onExpenseAdded:o.fetchExpenses},null,8,["onExpenseAdded"]),v(p,{loading:n.loading,"show-modal":n.editExpenseModal,"modal-id":"modal_expense_edit","modal-title":o.translations.edit_expense,expense:n.selectedExpense,categories:n.categoriesExpenses,clients:n.clientOptions,onExpenseEdited:o.fetchExpenses},null,8,["loading","show-modal","modal-title","expense","categories","clients","onExpenseEdited"]),v(c,{"show-modal":n.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=l=>this.deleteExpense(n.selectedExpense)),onCancel:e[1]||(e[1]=l=>n.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),v(m,{topMargin:"mt-8"},{default:j(()=>[t("div",Be,[t("h2",Ie,d(o.translations.expenses),1),t("div",null,[t("button",{class:"btn btn-primary rounded-full",onClick:e[2]||(e[2]=(...l)=>o.AddNew&&o.AddNew(...l))},[w(d(o.translations.add)+" ",1),Se]),n.settings.easy_compta_export_addon_active==1?(a(),i("span",Ne,[t("a",Ue,[w(d(o.translations.export)+" ",1),Fe])])):(a(),i("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[t("button",Re,[w(d(o.translations.export)+" ",1),qe])],8,Oe))])]),Xe,t("div",We,[t("label",Le,d(o.translations.display_per_page),1),y(t("select",{id:"perPageSelect","onUpdate:modelValue":e[3]||(e[3]=l=>n.perPage=l),onChange:e[4]||(e[4]=(...l)=>o.perPageChanged&&o.perPageChanged(...l))},[(a(!0),i(g,null,x(n.perPageOptions,l=>(a(),i("option",{key:l,value:l},d(l),9,ze))),128))],544),[[E,n.perPage]])]),t("div",Ze,[n.loading?(a(),i("div",_t,[(a(!0),i(g,null,x(n.skeletonRows,l=>(a(),i("div",{key:l,class:"flex flex-col gap-4 w-full"},xt))),128))])):(a(),i("table",He,[t("thead",null,[t("tr",null,[t("th",null,d(o.translations.expense_date),1),t("th",null,d(o.translations.amount),1),t("th",null,d(o.translations.client),1),t("th",null,d(o.translations.category),1),t("th",null,d(o.translations.attachment),1),t("th",null,d(o.translations.note),1),t("th",Je,d(o.translations.actions),1)])]),t("tbody",null,[(a(!0),i(g,null,x(n.expenses,l=>(a(),i("tr",{key:l.id},[t("td",null,d(l.expense_date),1),t("td",null,[n.loadingPrice?(a(),i("div",Qe,Ge)):(a(),i("div",Ke,[t("span",null,d(o.formatAmount(l.amount,n.default_currency_symbol)),1)]))]),t("td",null,d(l.company_name),1),t("td",null,d(l.name),1),t("td",null,[l.attachment_url?(a(),i("div",$e,[o.isImage(l.type)?(a(),i("div",et,[t("a",{href:l.attachment_url,target:"_blank"},[t("img",{src:l.attachment_url},null,8,st)],8,tt)])):(a(),i("div",nt,[t("a",{href:l.attachment_url,target:"_blank"},[t("img",{src:o.defaultImage},null,8,at)],8,ot)]))])):_("",!0)]),t("td",null,d(l.notes),1),t("td",lt,[t("span",{class:"lg:tooltip","data-tip":o.translations.edit},[t("button",{onClick:M=>o.editExpense(l.id),class:"btn btn-circle mx-1"},ct,8,rt)],8,it),t("span",{class:"lg:tooltip","data-tip":o.translations.delete},[t("button",{onClick:M=>o.confirmDeleteExpense(l.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},ht,8,ut)],8,pt)])]))),128))])])),t("div",yt,[(a(!0),i(g,null,x(n.paginationButtons,l=>(a(),i("button",{key:l,class:f(["join-item btn",{"btn-disabled":l==="..."||l===n.currentPage}]),onClick:M=>o.goToPage(l)},d(l),11,bt))),128))])])]),_:1})])}var vt=D(Ve,[["render",wt]]);const Et=k;(function(s,e){const r=k,u=s();for(;[];)try{if(-parseInt(r(126))/1+-parseInt(r(132))/2*(parseInt(r(133))/3)+-parseInt(r(127))/4+parseInt(r(134))/5+-parseInt(r(125))/6*(parseInt(r(128))/7)+-parseInt(r(135))/8+-parseInt(r(131))/9*(-parseInt(r(130))/10)===e)break;u.push(u.shift())}catch{u.push(u.shift())}})(C,258481);function k(s,e){const r=C();return k=function(u,n){return u=u-125,r[u]},k(s,e)}const kt=B({render:()=>I(vt)});kt.mount(Et(129));function C(){const s=["1758820srPTLZ","2209552Wvecer","63420cCcDXq","363600LNgNqi","1557808hTZRXS","35MyxDKQ","#my-easy-compta-expenses-app","14490590qDrluh","9VVaNwo","4drpbyC","690369iVguns"];return C=function(){return s},C()}
     1import{_ as P,o as a,c as i,a as t,t as d,w as j,F as g,r as x,n as f,i as y,k as B,g as _,j as E,v as M,m as w,d as b,H as T,e as v,p as V,f as I,h as S}from"./plugin-vue_export-helper.min.js";import{C as U,R as F}from"./RemoveAlert.min.js";import{T as N}from"./VueSearchSelect.min.js";import{V as O}from"./vue-datepicker.min.js";import{f as W,g as R,b as q,s as X}from"./api.min.js";const z={data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{loadingBtn:!1,formData:{amount:"",expense_date:"",client_id:"",category_id:"",attachment:null,note:""},options:{clients:[],categories:[]},fields:{expense_date:{label:s.expense_date},client_id:{label:s.client},amount:{label:s.amount},category_id:{label:s.category}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{async fetchOptions(){try{const s=await fetch("/wp-json/my-easy-compta/v1/expenses/clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}),e=await fetch("/wp-json/my-easy-compta/v1/expenses/categories",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const r=await e.json();this.options.categories=r;const u=await s.json();this.options.clients=u}else console.error("Erreur lors de la r\xE9cup\xE9ration des cat\xE9gories")}catch(s){console.error("Erreur lors de la r\xE9cup\xE9ration des options:",s)}},async submitForm(){this.loadingBtn=!0;const s=new FormData;s.append("amount",this.formData.amount),s.append("expense_date",this.formData.expense_date),s.append("client_id",this.formData.client_id),s.append("category_id",this.formData.category_id),this.$refs.attachment.files[0]&&s.append("attachment",this.$refs.attachment.files[0]),s.append("note",this.formData.note);try{const e=await fetch("/wp-json/my-easy-compta/v1/expenses",{method:"POST",body:s,headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}});if(e.ok){const r=await e.json();this.loadingBtn=!1,this.$emit("expenseAdded"),this.resetForm(),this.closeModal()}else console.error("Erreur lors de l'ajout de la d\xE9pense"),this.loadingBtn=!1}catch(e){console.error("Erreur lors de l'ajout de la d\xE9pense:",e),this.loadingBtn=!1}},closeModal(){document.getElementById("modal_expenses").close()},resetForm(){this.formData={amount:"",expense_date:"",client_id:"",category_id:"",attachment:null,note:""},this.$refs.attachment.value=null}},mounted(){this.fetchOptions()}},H={id:"modal_expenses",class:"modal"},L={class:"modal-box"},Y={class:"font-bold text-lg"},J={class:"grid grid-cols-2 gap-4"},K=["for"],Q=["type","id","onUpdate:modelValue"],G=["id"],Z=["value"],$={value:""},ee=["value"],te={class:"ecwp-group form-group relative"},se={for:"attachment",class:"ecwp-label form-label"},ne={type:"file",id:"attachment",ref:"attachment",class:"ecwp-input input input-bordered w-full peer"},oe={class:"ecwp-group form-group mt-4 relative"},ae={for:"note",class:"ecwp-label form-label"},le={class:"form-group mt-4 flex justify-end"},ie=["disabled"],re={key:0,class:"loading loading-spinner loading-sm"};function de(s,e,r,u,n,o){return a(),i("div",null,[t("dialog",H,[t("div",L,[t("h3",Y,d(o.translations.add),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...h)=>o.closeModal&&o.closeModal(...h))}," \u2715 "),t("form",{onSubmit:e[5]||(e[5]=j((...h)=>o.submitForm&&o.submitForm(...h),["prevent"]))},[t("div",J,[(a(!0),i(g,null,x(n.fields,(h,p)=>(a(),i("div",{key:p,class:"ecwp-group form-group"},[t("label",{for:p,class:f(["ecwp-label form-label",p==="client_id"?"label-search":""])},d(h.label),11,K),p!=="category_id"&&p!=="client_id"&&p!=="expense_date"?y((a(),i("input",{key:0,type:h.type||"text",id:p,"onUpdate:modelValue":c=>n.formData[p]=c,class:f(["ecwp-input input","input-bordered",h.class||"w-full"])},null,10,Q)),[[B,n.formData[p]]]):_("",!0),p==="category_id"?y((a(),i("select",{key:1,id:p,"onUpdate:modelValue":e[1]||(e[1]=c=>n.formData.category_id=c),class:f(["ecwp-input input","input-bordered",h.class||"w-full"])},[(a(!0),i(g,null,x(n.options.categories,c=>(a(),i("option",{key:c.id,value:c.id},d(c.name),9,Z))),128))],10,G)),[[E,n.formData.category_id]]):_("",!0),p==="client_id"?y((a(),i("select",{key:2,id:"client_id","onUpdate:modelValue":e[2]||(e[2]=c=>n.formData.client_id=c),class:"ecwp-input input input-bordered w-full peer"},[t("option",$,d(o.translations.select_client),1),(a(!0),i(g,null,x(n.options.clients,c=>(a(),i("option",{key:c.id,value:c.id},d(c.company_name),9,ee))),128))],512)),[[E,n.formData.client_id]]):_("",!0),p=="expense_date"?y((a(),i("input",{key:3,type:"date",id:"expense_date","onUpdate:modelValue":e[3]||(e[3]=c=>n.formData.expense_date=c),class:"ecwp-input input input-bordered w-full peer",placeholder:"Date de d\xE9pense",required:""},null,512)),[[M,n.formData.expense_date]]):_("",!0)]))),128))]),t("div",te,[t("label",se,d(o.translations.attached_file),1),t("input",ne,null,512)]),t("div",oe,[t("label",ae,d(o.translations.note),1),y(t("textarea",{id:"note","onUpdate:modelValue":e[4]||(e[4]=h=>n.formData.note=h),class:"ecwp-input textarea textarea-bordered w-full peer",rows:"4",placeholder:"Note"},null,512),[[M,n.formData.note]])]),t("div",le,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(d(o.translations.add)+" ",1),n.loadingBtn?(a(),i("span",re)):_("",!0)],8,ie)])],32)])])])}var ce=P(z,[["render",de]]);const pe={components:{ModelSelect:N,VueDatePicker:O},props:{loading:{type:Boolean,default:!1},showModal:{type:Boolean,default:!1},modalId:{type:String,required:!0},modalTitle:{type:String,default:""},expense:{type:Object,default:()=>({id:null,expense_date:"",client_id:"",amount:"",category_id:"",notes:""})},categories:Array,clients:Array},data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{editedExpense:{...this.expense},loadingBtn:!1,clientOptions:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{expense_date:{label:s.expense_date},client_id:{label:s.client},amount:{label:s.amount},category_id:{label:s.category}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return s=>{if(!s)return"";const e=s.getDate().toString().padStart(2,"0"),r=(s.getMonth()+1).toString().padStart(2,"0"),u=s.getFullYear();return`${e}-${r}-${u}`}},skeletonItems(){return Array.from({length:10},(s,e)=>e)},categoriesExpenses(){return this.categories},clients(){return this.clients}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const s=await fetch(`/wp-json/my-easy-compta/v1/expenses/${this.editedExpense.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedExpense)});if(s.ok){const e=await s.json();this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("expenseEdited"),this.loadingBtn=!1}else{const e=`Error editing expense: ${s.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(s){const e=s.response&&s.response.data&&s.response.data.message?s.response.data.message:"Error editing expense";this.showToast(e,"alert-error"),console.error("Error editing expense:",s),this.loadingBtn=!1}},showToast(s,e){this.toast.message=s,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{expense:{handler(s){this.editedExpense={...s}},immediate:!0}}},ue=["id","open"],me={class:"modal-box"},he={class:"font-bold text-lg"},_e={key:0},fe={class:"grid grid-cols-2 gap-4"},ge=t("div",{class:"skeleton h-4 w-full mb-2"},null,-1),xe=t("div",{class:"skeleton h-4 w-full"},null,-1),ye=[ge,xe],be={class:"grid grid-cols-2 gap-4"},we=["for"],ve=["type","id","onUpdate:modelValue"],Ee=["id"],ke=["value"],Ce={class:"ecwp-group form-group mt-4"},Me={for:"note",class:"ecwp-label form-label"},Pe={class:"form-group mt-4 flex justify-end"},De=["disabled"],Te={key:0,class:"loading loading-spinner loading-sm"};function Ae(s,e,r,u,n,o){const h=b("model-select"),p=b("VueDatePicker");return a(),i("div",null,[n.toast.visible?(a(),i("div",{key:0,class:f(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:f(["alert",n.toast.type,"text-white"])},[t("span",null,d(n.toast.message),1)],2)],2)):_("",!0),t("dialog",{id:r.modalId,class:"modal",open:r.showModal},[t("div",me,[t("h3",he,d(r.modalTitle),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...c)=>o.closeModal&&o.closeModal(...c))}," \u2715 "),r.loading?(a(),i("div",_e,[t("div",fe,[(a(!0),i(g,null,x(o.skeletonItems,c=>(a(),i("div",{key:c,class:"py-2"},ye))),128))])])):(a(),i("form",{key:1,onSubmit:e[5]||(e[5]=j((...c)=>o.submitForm&&o.submitForm(...c),["prevent"])),class:"form"},[t("div",be,[(a(!0),i(g,null,x(n.fields,(c,m)=>(a(),i("div",{key:m,class:"ecwp-group form-group"},[t("label",{for:m,class:f(["ecwp-label form-label",m==="client_id"?"label-search":""])},d(c.label),11,we),m!=="category_id"&&m!=="client_id"&&m!=="expense_date"?y((a(),i("input",{key:0,type:c.type||"text",id:m,"onUpdate:modelValue":l=>n.editedExpense[m]=l,class:f(["ecwp-input input","input-bordered",c.class||"w-full"])},null,10,ve)),[[B,n.editedExpense[m]]]):_("",!0),m==="category_id"?y((a(),i("select",{key:1,id:m,"onUpdate:modelValue":e[1]||(e[1]=l=>n.editedExpense.category_id=l),class:f(["ecwp-input input","input-bordered",c.class||"w-full"])},[(a(!0),i(g,null,x(o.categoriesExpenses,l=>(a(),i("option",{key:l.id,value:l.id},d(l.name),9,ke))),128))],10,Ee)),[[E,n.editedExpense.category_id]]):_("",!0),m==="client_id"?(a(),T(h,{key:2,modelValue:n.editedExpense.client_id,"onUpdate:modelValue":e[2]||(e[2]=l=>n.editedExpense.client_id=l),options:o.clients,label:"text","track-by":"value",placeholder:o.translations.select,class:"ecwp-input input input-bordered w-full",required:""},null,8,["modelValue","options","placeholder"])):_("",!0),m=="expense_date"?(a(),T(p,{key:3,class:"ecwp-input ecwp-date input input-bordered w-full",id:"invoiceDate",modelValue:n.editedExpense.expense_date,"onUpdate:modelValue":e[3]||(e[3]=l=>n.editedExpense.expense_date=l),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,locale:"fr",required:""},null,8,["modelValue","format"])):_("",!0)]))),128))]),t("div",Ce,[t("label",Me,d(o.translations.note),1),y(t("textarea",{id:"note","onUpdate:modelValue":e[4]||(e[4]=c=>n.editedExpense.notes=c),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[M,n.editedExpense.notes]])]),t("div",Pe,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(d(o.translations.save)+" ",1),n.loadingBtn?(a(),i("span",Te)):_("",!0)],8,De)])],32))])],8,ue)])}var je=P(pe,[["render",Ae]]);const Be={name:"Expenses",components:{Card:U,AddExpenseModal:ce,ExpenseEditModal:je,RemoveModal:F},data(){return{expenses:[],categoriesExpenses:[],listClients:[],clientOptions:[],currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},editExpenseModal:!1,showRemoveModal:!1,selectedExpense:null}},created(){this.fetchExpenses(),this.loadSettings()},methods:{AddNew(){modal_expenses.showModal()},isImage(s){return["jpg","jpeg","png","gif","webp"].includes(s)},fetchExpenses(s=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/expenses?page=${s}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(r=>r.json()).then(r=>{this.expenses=r.expenses,this.totalPages=r.total_pages,this.currentPage=r.page,this.totalCount=r.total_count,this.perPage=e,this.generatePaginationButtons()}).catch(r=>{console.error("Error fetching expenses:",r)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:s,currencySymbol:e,vatData:r}=await W();this.settings=s,this.default_currency_symbol=e,this.default_vat=r,this.loadingPrice=!1}catch(s){this.showToast(s.message,"alert-error"),this.loadingPrice=!1}},generatePaginationButtons(){this.paginationButtons=R(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchExpenses(s)},perPageChanged(){this.fetchExpenses()},formatAmount(s,e){return q(s,e,this.settings.currency_position)},showToast(s,e){X(this.toast,s,e)},editExpense(s){this.loadingModal=!0,this.editExpenseModal=!0,modal_expense_edit.showModal(),this.fetchExpenseDetails(s)},fetchExpenseDetails(s){fetch(`/wp-json/my-easy-compta/v1/expenses/details/${s}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedExpense=e,this.categoriesExpenses=e.categories_expenses,this.listClients=e.list_clients,this.clientOptions=this.listClients.map(r=>({value:r.id,text:`${r.company_name}`})),this.loadingModal=!1}).catch(e=>{console.error("Error fetching payment details:",e),this.loadingModal=!1})},confirmDeleteExpense(s){this.selectedExpense=s,modal_remove.showModal(),this.showRemoveModal=!0},deleteExpense(s){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/expenses/${s}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchExpenses(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting expense:",e.statusText))}).catch(e=>{console.error("Error deleting expense:",e)}),this.showRemoveModal=!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},defaultImage(){return window.myEasyComptaAdmin.pluginUrl+"/assets/img/file.svg"}}},Ve={class:"pt-2 pr-4"},Ie={class:"flex justify-between items-center"},Se={class:"card-title"},Ue=t("i",{class:"fas fa-plus-circle"},null,-1),Fe={key:0,class:"ms-2"},Ne={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab5"},Oe=t("i",{class:"fas fa-file-export"},null,-1),We=["data-tip"],Re={class:"btn btn-outline btn-accent rounded-full",disabled:""},qe=t("i",{class:"fas fa-file-export"},null,-1),Xe=t("div",{class:"divider mt-2"},null,-1),ze={class:"flex items-center mb-4"},He={for:"perPageSelect",class:"mr-2"},Le=["value"],Ye={class:"overflow-x-auto"},Je={key:0,class:"table w-full"},Ke={class:"flex justify-center"},Qe={key:0},Ge={key:1},Ze=t("span",{class:"loading loading-bars loading-sm"},null,-1),$e=[Ze],et={key:0,class:"avatar"},tt={key:0,class:"w-16 mask mask-squircle"},st=["href"],nt=["src"],ot={key:1,class:"w-16 mask mask-squircle"},at=["href"],lt=["src"],it={class:"flex justify-end"},rt=["data-tip"],dt=["onClick"],ct=t("i",{class:"fas fa-pencil-alt"},null,-1),pt=[ct],ut=["data-tip"],mt=["onClick"],ht=t("i",{class:"far fa-trash-alt"},null,-1),_t=[ht],ft={key:1},gt=t("div",{class:"flex gap-4 items-center"},[t("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),t("div",{class:"flex flex-col gap-4 w-full"},[t("div",{class:"skeleton h-4 w-full"}),t("div",{class:"skeleton h-4 w-full"})])],-1),xt=t("div",{class:"divider my-1"},null,-1),yt=[gt,xt],bt={class:"join ecwp_pagination mt-6 pt-4"},wt=["onClick"];function vt(s,e,r,u,n,o){const h=b("AddExpenseModal"),p=b("expense-edit-modal"),c=b("remove-modal"),m=b("Card");return a(),i("div",Ve,[n.toast.visible?(a(),i("div",{key:0,class:f(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:f(["alert",n.toast.type,"text-white"])},[t("span",null,d(n.toast.message),1)],2)],2)):_("",!0),v(h,{onExpenseAdded:o.fetchExpenses},null,8,["onExpenseAdded"]),v(p,{loading:n.loading,"show-modal":n.editExpenseModal,"modal-id":"modal_expense_edit","modal-title":o.translations.edit_expense,expense:n.selectedExpense,categories:n.categoriesExpenses,clients:n.clientOptions,onExpenseEdited:o.fetchExpenses},null,8,["loading","show-modal","modal-title","expense","categories","clients","onExpenseEdited"]),v(c,{"show-modal":n.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=l=>this.deleteExpense(n.selectedExpense)),onCancel:e[1]||(e[1]=l=>n.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),v(m,{topMargin:"mt-8"},{default:V(()=>[t("div",Ie,[t("h2",Se,d(o.translations.expenses),1),t("div",null,[t("button",{class:"btn btn-primary rounded-full",onClick:e[2]||(e[2]=(...l)=>o.AddNew&&o.AddNew(...l))},[w(d(o.translations.add)+" ",1),Ue]),n.settings.easy_compta_export_addon_active==1?(a(),i("span",Fe,[t("a",Ne,[w(d(o.translations.export)+" ",1),Oe])])):(a(),i("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[t("button",Re,[w(d(o.translations.export)+" ",1),qe])],8,We))])]),Xe,t("div",ze,[t("label",He,d(o.translations.display_per_page),1),y(t("select",{id:"perPageSelect","onUpdate:modelValue":e[3]||(e[3]=l=>n.perPage=l),onChange:e[4]||(e[4]=(...l)=>o.perPageChanged&&o.perPageChanged(...l))},[(a(!0),i(g,null,x(n.perPageOptions,l=>(a(),i("option",{key:l,value:l},d(l),9,Le))),128))],544),[[E,n.perPage]])]),t("div",Ye,[n.loading?(a(),i("div",ft,[(a(!0),i(g,null,x(n.skeletonRows,l=>(a(),i("div",{key:l,class:"flex flex-col gap-4 w-full"},yt))),128))])):(a(),i("table",Je,[t("thead",null,[t("tr",null,[t("th",null,d(o.translations.expense_date),1),t("th",null,d(o.translations.amount),1),t("th",null,d(o.translations.client),1),t("th",null,d(o.translations.category),1),t("th",null,d(o.translations.attachment),1),t("th",null,d(o.translations.note),1),t("th",Ke,d(o.translations.actions),1)])]),t("tbody",null,[(a(!0),i(g,null,x(n.expenses,l=>(a(),i("tr",{key:l.id},[t("td",null,d(l.expense_date),1),t("td",null,[n.loadingPrice?(a(),i("div",Ge,$e)):(a(),i("div",Qe,[t("span",null,d(o.formatAmount(l.amount,n.default_currency_symbol)),1)]))]),t("td",null,d(l.company_name),1),t("td",null,d(l.name),1),t("td",null,[l.attachment_url?(a(),i("div",et,[o.isImage(l.type)?(a(),i("div",tt,[t("a",{href:l.attachment_url,target:"_blank"},[t("img",{src:l.attachment_url},null,8,nt)],8,st)])):(a(),i("div",ot,[t("a",{href:l.attachment_url,target:"_blank"},[t("img",{src:o.defaultImage},null,8,lt)],8,at)]))])):_("",!0)]),t("td",null,d(l.notes),1),t("td",it,[t("span",{class:"lg:tooltip","data-tip":o.translations.edit},[t("button",{onClick:D=>o.editExpense(l.id),class:"btn btn-circle mx-1"},pt,8,dt)],8,rt),t("span",{class:"lg:tooltip","data-tip":o.translations.delete},[t("button",{onClick:D=>o.confirmDeleteExpense(l.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},_t,8,mt)],8,ut)])]))),128))])])),t("div",bt,[(a(!0),i(g,null,x(n.paginationButtons,l=>(a(),i("button",{key:l,class:f(["join-item btn",{"btn-disabled":l==="..."||l===n.currentPage}]),onClick:D=>o.goToPage(l)},d(l),11,wt))),128))])])]),_:1})])}var Et=P(Be,[["render",vt]]);const A=k;(function(s,e){const r=k,u=s();for(;[];)try{if(-parseInt(r(410))/1*(-parseInt(r(411))/2)+-parseInt(r(405))/3+parseInt(r(400))/4+-parseInt(r(402))/5+-parseInt(r(409))/6*(-parseInt(r(404))/7)+parseInt(r(407))/8*(-parseInt(r(408))/9)+parseInt(r(401))/10===e)break;u.push(u.shift())}catch{u.push(u.shift())}})(C,384615);const kt=I({render:()=>S(Et)});function k(s,e){const r=C();return k=function(u,n){return u=u-400,r[u]},k(s,e)}function C(){const s=["mount","5176FFWwiM","1071gHCvBq","6xOhWKb","265067oWczlO","2wSDdUV","1803056jFyaoW","1840550AYEcLu","1420755NMmNde","#my-easy-compta-expenses-app","1044743tMCxlH","910128kMQvhp"];return C=function(){return s},C()}kt[A(406)](A(403));
  • my-easy-compta/trunk/assets/dist/index.min.js

    r3166746 r3167980  
    1 import{s as Ps,u as ut,q as Ms,x as js,y as Jn,z as qs,A as yt,B as Ce,h as Kn,C as Kt,D as Os,E as Vs,_ as oe,d as j,o as r,c,n as k,a as i,t as l,g as _,e as P,p as re,i as B,v as J,j as ye,m as w,w as K,F as W,r as U,G as Zn,H as Rs}from"./plugin-vue_export-helper.min.js";import{C as Ue,R as xt}from"./RemoveAlert.min.js";import{T as Lt}from"./VueSearchSelect.min.js";import{V as It}from"./vue-datepicker.min.js";import{f as zt,c as $n,a as es,g as ts,b as ns,s as ss}from"./api.min.js";import{v as Et}from"./vue3-editor.common.min.js";/*!
     1import{s as Ps,u as ut,q as Ms,x as js,y as Jn,z as qs,A as yt,B as Ee,h as Kn,C as Kt,D as Rs,E as Os,_ as oe,d as j,o as r,c,n as k,a as i,t as l,g as _,e as D,p as re,i as B,v as J,j as ve,m as w,w as K,F as W,r as X,G as Zn,H as Vs}from"./plugin-vue_export-helper.min.js";import{C as Xe,R as xt}from"./RemoveAlert.min.js";import{T as Lt}from"./VueSearchSelect.min.js";import{V as Ct}from"./vue-datepicker.min.js";import{f as zt,c as $n,a as es,g as ts,b as ns,s as ss}from"./api.min.js";import{v as It}from"./vue3-editor.common.min.js";/*!
    22  * vue-router v4.4.0
    33  * (c) 2024 Eduardo San Martin Morote
    44  * @license MIT
    5   */const Ke=typeof document!="undefined";function Ns(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const Q=Object.assign;function Zt(t,e){const s={};for(const a in e){const n=e[a];s[a]=Ee(n)?n.map(t):t(n)}return s}const ht=()=>{},Ee=Array.isArray,os=/#/g,Bs=/&/g,Fs=/\//g,Ws=/=/g,Xs=/\?/g,is=/\+/g,Us=/%5B/g,Qs=/%5D/g,as=/%5E/g,Ls=/%60/g,ls=/%7B/g,zs=/%7C/g,rs=/%7D/g,Hs=/%20/g;function vn(t){return encodeURI(""+t).replace(zs,"|").replace(Us,"[").replace(Qs,"]")}function Gs(t){return vn(t).replace(ls,"{").replace(rs,"}").replace(as,"^")}function un(t){return vn(t).replace(is,"%2B").replace(Hs,"+").replace(os,"%23").replace(Bs,"%26").replace(Ls,"`").replace(ls,"{").replace(rs,"}").replace(as,"^")}function Ys(t){return un(t).replace(Ws,"%3D")}function Js(t){return vn(t).replace(os,"%23").replace(Xs,"%3F")}function Ks(t){return t==null?"":Js(t).replace(Fs,"%2F")}function bt(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Zs=/\/$/,$s=t=>t.replace(Zs,"");function $t(t,e,s="/"){let a,n={},o="",m="";const h=e.indexOf("#");let f=e.indexOf("?");return h<f&&h>=0&&(f=-1),f>-1&&(a=e.slice(0,f),o=e.slice(f+1,h>-1?h:e.length),n=t(o)),h>-1&&(a=a||e.slice(0,h),m=e.slice(h,e.length)),a=so(a!=null?a:e,s),{fullPath:a+(o&&"?")+o+m,path:a,query:n,hash:bt(m)}}function eo(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function Cn(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function to(t,e,s){const a=e.matched.length-1,n=s.matched.length-1;return a>-1&&a===n&&tt(e.matched[a],s.matched[n])&&cs(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function tt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function cs(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!no(t[s],e[s]))return!1;return!0}function no(t,e){return Ee(t)?kn(t,e):Ee(e)?kn(e,t):t===e}function kn(t,e){return Ee(e)?t.length===e.length&&t.every((s,a)=>s===e[a]):t.length===1&&t[0]===e}function so(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),a=t.split("/"),n=a[a.length-1];(n===".."||n===".")&&a.push("");let o=s.length-1,m,h;for(m=0;m<a.length;m++)if(h=a[m],h!==".")if(h==="..")o>1&&o--;else break;return s.slice(0,o).join("/")+"/"+a.slice(m).join("/")}const Ne={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var wt;(function(t){t.pop="pop",t.push="push"})(wt||(wt={}));var mt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(mt||(mt={}));function oo(t){if(!t)if(Ke){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$s(t)}const io=/^[^#]+#/;function ao(t,e){return t.replace(io,"#")+e}function lo(t,e){const s=document.documentElement.getBoundingClientRect(),a=t.getBoundingClientRect();return{behavior:e.behavior,left:a.left-s.left-(e.left||0),top:a.top-s.top-(e.top||0)}}const Ht=()=>({left:window.scrollX,top:window.scrollY});function ro(t){let e;if("el"in t){const s=t.el,a=typeof s=="string"&&s.startsWith("#"),n=typeof s=="string"?a?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!n)return;e=lo(n,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Tn(t,e){return(history.state?history.state.position-e:-1)+t}const hn=new Map;function co(t,e){hn.set(t,e)}function uo(t){const e=hn.get(t);return hn.delete(t),e}let ho=()=>location.protocol+"//"+location.host;function ds(t,e){const{pathname:s,search:a,hash:n}=e,o=t.indexOf("#");if(o>-1){let h=n.includes(t.slice(o))?t.slice(o).length:1,f=n.slice(h);return f[0]!=="/"&&(f="/"+f),Cn(f,"")}return Cn(s,t)+a+n}function mo(t,e,s,a){let n=[],o=[],m=null;const h=({state:g})=>{const v=ds(t,location),I=s.value,C=e.value;let V=0;if(g){if(s.value=v,e.value=g,m&&m===I){m=null;return}V=C?g.position-C.position:0}else a(v);n.forEach(F=>{F(s.value,I,{delta:V,type:wt.pop,direction:V?V>0?mt.forward:mt.back:mt.unknown})})};function f(){m=s.value}function d(g){n.push(g);const v=()=>{const I=n.indexOf(g);I>-1&&n.splice(I,1)};return o.push(v),v}function u(){const{history:g}=window;!g.state||g.replaceState(Q({},g.state,{scroll:Ht()}),"")}function p(){for(const g of o)g();o=[],window.removeEventListener("popstate",h),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",h),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:f,listen:d,destroy:p}}function An(t,e,s,a=!1,n=!1){return{back:t,current:e,forward:s,replaced:a,position:window.history.length,scroll:n?Ht():null}}function fo(t){const{history:e,location:s}=window,a={value:ds(t,s)},n={value:e.state};n.value||o(a.value,{back:null,current:a.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(f,d,u){const p=t.indexOf("#"),g=p>-1?(s.host&&document.querySelector("base")?t:t.slice(p))+f:ho()+t+f;try{e[u?"replaceState":"pushState"](d,"",g),n.value=d}catch(v){console.error(v),s[u?"replace":"assign"](g)}}function m(f,d){const u=Q({},e.state,An(n.value.back,f,n.value.forward,!0),d,{position:n.value.position});o(f,u,!0),a.value=f}function h(f,d){const u=Q({},n.value,e.state,{forward:f,scroll:Ht()});o(u.current,u,!0);const p=Q({},An(a.value,f,null),{position:u.position+1},d);o(f,p,!1),a.value=f}return{location:a,state:n,push:h,replace:m}}function po(t){t=oo(t);const e=fo(t),s=mo(t,e.state,e.location,e.replace);function a(o,m=!0){m||s.pauseListeners(),history.go(o)}const n=Q({location:"",base:t,go:a,createHref:ao.bind(null,t)},e,s);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}function _o(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),po(t)}function go(t){return typeof t=="string"||t&&typeof t=="object"}function us(t){return typeof t=="string"||typeof t=="symbol"}const hs=Symbol("");var Sn;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Sn||(Sn={}));function nt(t,e){return Q(new Error,{type:t,[hs]:!0},e)}function Me(t,e){return t instanceof Error&&hs in t&&(e==null||!!(t.type&e))}const Dn="[^/]+?",vo={sensitive:!1,strict:!1,start:!0,end:!0},yo=/[.+*?^${}()[\]/\\]/g;function bo(t,e){const s=Q({},vo,e),a=[];let n=s.start?"^":"";const o=[];for(const d of t){const u=d.length?[]:[90];s.strict&&!d.length&&(n+="/");for(let p=0;p<d.length;p++){const g=d[p];let v=40+(s.sensitive?.25:0);if(g.type===0)p||(n+="/"),n+=g.value.replace(yo,"\\$&"),v+=40;else if(g.type===1){const{value:I,repeatable:C,optional:V,regexp:F}=g;o.push({name:I,repeatable:C,optional:V});const D=F||Dn;if(D!==Dn){v+=10;try{new RegExp(`(${D})`)}catch(z){throw new Error(`Invalid custom RegExp for param "${I}" (${D}): `+z.message)}}let q=C?`((?:${D})(?:/(?:${D}))*)`:`(${D})`;p||(q=V&&d.length<2?`(?:/${q})`:"/"+q),V&&(q+="?"),n+=q,v+=20,V&&(v+=-8),C&&(v+=-20),D===".*"&&(v+=-50)}u.push(v)}a.push(u)}if(s.strict&&s.end){const d=a.length-1;a[d][a[d].length-1]+=.7000000000000001}s.strict||(n+="/?"),s.end?n+="$":s.strict&&(n+="(?:/|$)");const m=new RegExp(n,s.sensitive?"":"i");function h(d){const u=d.match(m),p={};if(!u)return null;for(let g=1;g<u.length;g++){const v=u[g]||"",I=o[g-1];p[I.name]=v&&I.repeatable?v.split("/"):v}return p}function f(d){let u="",p=!1;for(const g of t){(!p||!u.endsWith("/"))&&(u+="/"),p=!1;for(const v of g)if(v.type===0)u+=v.value;else if(v.type===1){const{value:I,repeatable:C,optional:V}=v,F=I in d?d[I]:"";if(Ee(F)&&!C)throw new Error(`Provided param "${I}" is an array but it is not repeatable (* or + modifiers)`);const D=Ee(F)?F.join("/"):F;if(!D)if(V)g.length<2&&(u.endsWith("/")?u=u.slice(0,-1):p=!0);else throw new Error(`Missing required param "${I}"`);u+=D}}return u||"/"}return{re:m,score:a,keys:o,parse:h,stringify:f}}function wo(t,e){let s=0;for(;s<t.length&&s<e.length;){const a=e[s]-t[s];if(a)return a;s++}return t.length<e.length?t.length===1&&t[0]===40+40?-1:1:t.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function ms(t,e){let s=0;const a=t.score,n=e.score;for(;s<a.length&&s<n.length;){const o=wo(a[s],n[s]);if(o)return o;s++}if(Math.abs(n.length-a.length)===1){if(Pn(a))return 1;if(Pn(n))return-1}return n.length-a.length}function Pn(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const xo={type:0,value:""},Io=/[a-zA-Z0-9_]/;function Eo(t){if(!t)return[[]];if(t==="/")return[[xo]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(v){throw new Error(`ERR (${s})/"${d}": ${v}`)}let s=0,a=s;const n=[];let o;function m(){o&&n.push(o),o=[]}let h=0,f,d="",u="";function p(){!d||(s===0?o.push({type:0,value:d}):s===1||s===2||s===3?(o.length>1&&(f==="*"||f==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:u,repeatable:f==="*"||f==="+",optional:f==="*"||f==="?"})):e("Invalid state to consume buffer"),d="")}function g(){d+=f}for(;h<t.length;){if(f=t[h++],f==="\\"&&s!==2){a=s,s=4;continue}switch(s){case 0:f==="/"?(d&&p(),m()):f===":"?(p(),s=1):g();break;case 4:g(),s=a;break;case 1:f==="("?s=2:Io.test(f)?g():(p(),s=0,f!=="*"&&f!=="?"&&f!=="+"&&h--);break;case 2:f===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+f:s=3:u+=f;break;case 3:p(),s=0,f!=="*"&&f!=="?"&&f!=="+"&&h--,u="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${d}"`),p(),m(),n}function Co(t,e,s){const a=bo(Eo(t.path),s),n=Q(a,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function ko(t,e){const s=[],a=new Map;e=qn({strict:!1,end:!0,sensitive:!1},e);function n(p){return a.get(p)}function o(p,g,v){const I=!v,C=To(p);C.aliasOf=v&&v.record;const V=qn(e,p),F=[C];if("alias"in p){const z=typeof p.alias=="string"?[p.alias]:p.alias;for(const ce of z)F.push(Q({},C,{components:v?v.record.components:C.components,path:ce,aliasOf:v?v.record:C}))}let D,q;for(const z of F){const{path:ce}=z;if(g&&ce[0]!=="/"){const ne=g.record.path,Z=ne[ne.length-1]==="/"?"":"/";z.path=g.record.path+(ce&&Z+ce)}if(D=Co(z,g,V),v?v.alias.push(D):(q=q||D,q!==D&&q.alias.push(D),I&&p.name&&!jn(D)&&m(p.name)),fs(D)&&f(D),C.children){const ne=C.children;for(let Z=0;Z<ne.length;Z++)o(ne[Z],D,v&&v.children[Z])}v=v||D}return q?()=>{m(q)}:ht}function m(p){if(us(p)){const g=a.get(p);g&&(a.delete(p),s.splice(s.indexOf(g),1),g.children.forEach(m),g.alias.forEach(m))}else{const g=s.indexOf(p);g>-1&&(s.splice(g,1),p.record.name&&a.delete(p.record.name),p.children.forEach(m),p.alias.forEach(m))}}function h(){return s}function f(p){const g=Do(p,s);s.splice(g,0,p),p.record.name&&!jn(p)&&a.set(p.record.name,p)}function d(p,g){let v,I={},C,V;if("name"in p&&p.name){if(v=a.get(p.name),!v)throw nt(1,{location:p});V=v.record.name,I=Q(Mn(g.params,v.keys.filter(q=>!q.optional).concat(v.parent?v.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),p.params&&Mn(p.params,v.keys.map(q=>q.name))),C=v.stringify(I)}else if(p.path!=null)C=p.path,v=s.find(q=>q.re.test(C)),v&&(I=v.parse(C),V=v.record.name);else{if(v=g.name?a.get(g.name):s.find(q=>q.re.test(g.path)),!v)throw nt(1,{location:p,currentLocation:g});V=v.record.name,I=Q({},g.params,p.params),C=v.stringify(I)}const F=[];let D=v;for(;D;)F.unshift(D.record),D=D.parent;return{name:V,path:C,params:I,matched:F,meta:So(F)}}t.forEach(p=>o(p));function u(){s.length=0,a.clear()}return{addRoute:o,resolve:d,removeRoute:m,clearRoutes:u,getRoutes:h,getRecordMatcher:n}}function Mn(t,e){const s={};for(const a of e)a in t&&(s[a]=t[a]);return s}function To(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:Ao(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}}}function Ao(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const a in t.components)e[a]=typeof s=="object"?s[a]:s;return e}function jn(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function So(t){return t.reduce((e,s)=>Q(e,s.meta),{})}function qn(t,e){const s={};for(const a in t)s[a]=a in e?e[a]:t[a];return s}function Do(t,e){let s=0,a=e.length;for(;s!==a;){const o=s+a>>1;ms(t,e[o])<0?a=o:s=o+1}const n=Po(t);return n&&(a=e.lastIndexOf(n,a-1)),a}function Po(t){let e=t;for(;e=e.parent;)if(fs(e)&&ms(t,e)===0)return e}function fs({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Mo(t){const e={};if(t===""||t==="?")return e;const a=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<a.length;++n){const o=a[n].replace(is," "),m=o.indexOf("="),h=bt(m<0?o:o.slice(0,m)),f=m<0?null:bt(o.slice(m+1));if(h in e){let d=e[h];Ee(d)||(d=e[h]=[d]),d.push(f)}else e[h]=f}return e}function On(t){let e="";for(let s in t){const a=t[s];if(s=Ys(s),a==null){a!==void 0&&(e+=(e.length?"&":"")+s);continue}(Ee(a)?a.map(o=>o&&un(o)):[a&&un(a)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+s,o!=null&&(e+="="+o))})}return e}function jo(t){const e={};for(const s in t){const a=t[s];a!==void 0&&(e[s]=Ee(a)?a.map(n=>n==null?null:""+n):a==null?a:""+a)}return e}const qo=Symbol(""),Vn=Symbol(""),yn=Symbol(""),ps=Symbol(""),mn=Symbol("");function lt(){let t=[];function e(a){return t.push(a),()=>{const n=t.indexOf(a);n>-1&&t.splice(n,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function Be(t,e,s,a,n,o=m=>m()){const m=a&&(a.enterCallbacks[n]=a.enterCallbacks[n]||[]);return()=>new Promise((h,f)=>{const d=g=>{g===!1?f(nt(4,{from:s,to:e})):g instanceof Error?f(g):go(g)?f(nt(2,{from:e,to:g})):(m&&a.enterCallbacks[n]===m&&typeof g=="function"&&m.push(g),h())},u=o(()=>t.call(a&&a.instances[n],e,s,d));let p=Promise.resolve(u);t.length<3&&(p=p.then(d)),p.catch(g=>f(g))})}function en(t,e,s,a,n=o=>o()){const o=[];for(const m of t)for(const h in m.components){let f=m.components[h];if(!(e!=="beforeRouteEnter"&&!m.instances[h]))if(Oo(f)){const u=(f.__vccOpts||f)[e];u&&o.push(Be(u,s,a,m,h,n))}else{let d=f();o.push(()=>d.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${h}" at "${m.path}"`));const p=Ns(u)?u.default:u;m.components[h]=p;const v=(p.__vccOpts||p)[e];return v&&Be(v,s,a,m,h,n)()}))}}return o}function Oo(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Rn(t){const e=yt(yn),s=yt(ps),a=Ce(()=>{const f=ut(t.to);return e.resolve(f)}),n=Ce(()=>{const{matched:f}=a.value,{length:d}=f,u=f[d-1],p=s.matched;if(!u||!p.length)return-1;const g=p.findIndex(tt.bind(null,u));if(g>-1)return g;const v=Nn(f[d-2]);return d>1&&Nn(u)===v&&p[p.length-1].path!==v?p.findIndex(tt.bind(null,f[d-2])):g}),o=Ce(()=>n.value>-1&&Bo(s.params,a.value.params)),m=Ce(()=>n.value>-1&&n.value===s.matched.length-1&&cs(s.params,a.value.params));function h(f={}){return No(f)?e[ut(t.replace)?"replace":"push"](ut(t.to)).catch(ht):Promise.resolve()}return{route:a,href:Ce(()=>a.value.href),isActive:o,isExactActive:m,navigate:h}}const Vo=Jn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Rn,setup(t,{slots:e}){const s=qs(Rn(t)),{options:a}=yt(yn),n=Ce(()=>({[Bn(t.activeClass,a.linkActiveClass,"router-link-active")]:s.isActive,[Bn(t.exactActiveClass,a.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const o=e.default&&e.default(s);return t.custom?o:Kn("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},o)}}}),Ro=Vo;function No(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Bo(t,e){for(const s in e){const a=e[s],n=t[s];if(typeof a=="string"){if(a!==n)return!1}else if(!Ee(n)||n.length!==a.length||a.some((o,m)=>o!==n[m]))return!1}return!0}function Nn(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Bn=(t,e,s)=>t!=null?t:e!=null?e:s,Fo=Jn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const a=yt(mn),n=Ce(()=>t.route||a.value),o=yt(Vn,0),m=Ce(()=>{let d=ut(o);const{matched:u}=n.value;let p;for(;(p=u[d])&&!p.components;)d++;return d}),h=Ce(()=>n.value.matched[m.value]);Kt(Vn,Ce(()=>m.value+1)),Kt(qo,h),Kt(mn,n);const f=Os();return Vs(()=>[f.value,h.value,t.name],([d,u,p],[g,v,I])=>{u&&(u.instances[p]=d,v&&v!==u&&d&&d===g&&(u.leaveGuards.size||(u.leaveGuards=v.leaveGuards),u.updateGuards.size||(u.updateGuards=v.updateGuards))),d&&u&&(!v||!tt(u,v)||!g)&&(u.enterCallbacks[p]||[]).forEach(C=>C(d))},{flush:"post"}),()=>{const d=n.value,u=t.name,p=h.value,g=p&&p.components[u];if(!g)return Fn(s.default,{Component:g,route:d});const v=p.props[u],I=v?v===!0?d.params:typeof v=="function"?v(d):v:null,V=Kn(g,Q({},I,e,{onVnodeUnmounted:F=>{F.component.isUnmounted&&(p.instances[u]=null)},ref:f}));return Fn(s.default,{Component:V,route:d})||V}}});function Fn(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Wo=Fo;function Xo(t){const e=ko(t.routes,t),s=t.parseQuery||Mo,a=t.stringifyQuery||On,n=t.history,o=lt(),m=lt(),h=lt(),f=Ps(Ne);let d=Ne;Ke&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Zt.bind(null,y=>""+y),p=Zt.bind(null,Ks),g=Zt.bind(null,bt);function v(y,E){let x,T;return us(y)?(x=e.getRecordMatcher(y),T=E):T=y,e.addRoute(T,x)}function I(y){const E=e.getRecordMatcher(y);E&&e.removeRoute(E)}function C(){return e.getRoutes().map(y=>y.record)}function V(y){return!!e.getRecordMatcher(y)}function F(y,E){if(E=Q({},E||f.value),typeof y=="string"){const O=$t(s,y,E.path),se=e.resolve({path:O.path},E),at=n.createHref(O.fullPath);return Q(O,se,{params:g(se.params),hash:bt(O.hash),redirectedFrom:void 0,href:at})}let x;if(y.path!=null)x=Q({},y,{path:$t(s,y.path,E.path).path});else{const O=Q({},y.params);for(const se in O)O[se]==null&&delete O[se];x=Q({},y,{params:p(O)}),E.params=p(E.params)}const T=e.resolve(x,E),L=y.hash||"";T.params=u(g(T.params));const $=eo(a,Q({},y,{hash:Gs(L),path:T.path})),R=n.createHref($);return Q({fullPath:$,hash:L,query:a===On?jo(y.query):y.query||{}},T,{redirectedFrom:void 0,href:R})}function D(y){return typeof y=="string"?$t(s,y,f.value.path):Q({},y)}function q(y,E){if(d!==y)return nt(8,{from:E,to:y})}function z(y){return Z(y)}function ce(y){return z(Q(D(y),{replace:!0}))}function ne(y){const E=y.matched[y.matched.length-1];if(E&&E.redirect){const{redirect:x}=E;let T=typeof x=="function"?x(y):x;return typeof T=="string"&&(T=T.includes("?")||T.includes("#")?T=D(T):{path:T},T.params={}),Q({query:y.query,hash:y.hash,params:T.path!=null?{}:y.params},T)}}function Z(y,E){const x=d=F(y),T=f.value,L=y.state,$=y.force,R=y.replace===!0,O=ne(x);if(O)return Z(Q(D(O),{state:typeof O=="object"?Q({},L,O.state):L,force:$,replace:R}),E||x);const se=x;se.redirectedFrom=E;let at;return!$&&to(a,T,x)&&(at=nt(16,{to:se,from:T}),ot(T,T,!0,!1)),(at?Promise.resolve(at):Ve(se,T)).catch(he=>Me(he)?Me(he,2)?he:Tt(he):Pe(he,se,T)).then(he=>{if(he){if(Me(he,2))return Z(Q({replace:R},D(he.to),{state:typeof he.to=="object"?Q({},L,he.to.state):L,force:$}),E||se)}else he=Re(se,T,!0,R,L);return be(se,T,he),he})}function Qe(y,E){const x=q(y,E);return x?Promise.reject(x):Promise.resolve()}function ie(y){const E=At.values().next().value;return E&&typeof E.runWithContext=="function"?E.runWithContext(y):y()}function Ve(y,E){let x;const[T,L,$]=Uo(y,E);x=en(T.reverse(),"beforeRouteLeave",y,E);for(const O of T)O.leaveGuards.forEach(se=>{x.push(Be(se,y,E))});const R=Qe.bind(null,y,E);return x.push(R),Ge(x).then(()=>{x=[];for(const O of o.list())x.push(Be(O,y,E));return x.push(R),Ge(x)}).then(()=>{x=en(L,"beforeRouteUpdate",y,E);for(const O of L)O.updateGuards.forEach(se=>{x.push(Be(se,y,E))});return x.push(R),Ge(x)}).then(()=>{x=[];for(const O of $)if(O.beforeEnter)if(Ee(O.beforeEnter))for(const se of O.beforeEnter)x.push(Be(se,y,E));else x.push(Be(O.beforeEnter,y,E));return x.push(R),Ge(x)}).then(()=>(y.matched.forEach(O=>O.enterCallbacks={}),x=en($,"beforeRouteEnter",y,E,ie),x.push(R),Ge(x))).then(()=>{x=[];for(const O of m.list())x.push(Be(O,y,E));return x.push(R),Ge(x)}).catch(O=>Me(O,8)?O:Promise.reject(O))}function be(y,E,x){h.list().forEach(T=>ie(()=>T(y,E,x)))}function Re(y,E,x,T,L){const $=q(y,E);if($)return $;const R=E===Ne,O=Ke?history.state:{};x&&(T||R?n.replace(y.fullPath,Q({scroll:R&&O&&O.scroll},L)):n.push(y.fullPath,L)),f.value=y,ot(y,E,x,R),Tt()}let de;function Ae(){de||(de=n.listen((y,E,x)=>{if(!En.listening)return;const T=F(y),L=ne(T);if(L){Z(Q(L,{replace:!0}),T).catch(ht);return}d=T;const $=f.value;Ke&&co(Tn($.fullPath,x.delta),Ht()),Ve(T,$).catch(R=>Me(R,12)?R:Me(R,2)?(Z(R.to,T).then(O=>{Me(O,20)&&!x.delta&&x.type===wt.pop&&n.go(-1,!1)}).catch(ht),Promise.reject()):(x.delta&&n.go(-x.delta,!1),Pe(R,T,$))).then(R=>{R=R||Re(T,$,!1),R&&(x.delta&&!Me(R,8)?n.go(-x.delta,!1):x.type===wt.pop&&Me(R,20)&&n.go(-1,!1)),be(T,$,R)}).catch(ht)}))}let Se=lt(),we=lt(),De;function Pe(y,E,x){Tt(y);const T=we.list();return T.length?T.forEach(L=>L(y,E,x)):console.error(y),Promise.reject(y)}function Yt(){return De&&f.value!==Ne?Promise.resolve():new Promise((y,E)=>{Se.add([y,E])})}function Tt(y){return De||(De=!y,Ae(),Se.list().forEach(([E,x])=>y?x(y):E()),Se.reset()),y}function ot(y,E,x,T){const{scrollBehavior:L}=t;if(!Ke||!L)return Promise.resolve();const $=!x&&uo(Tn(y.fullPath,0))||(T||!x)&&history.state&&history.state.scroll||null;return js().then(()=>L(y,E,$)).then(R=>R&&ro(R)).catch(R=>Pe(R,y,E))}const it=y=>n.go(y);let Jt;const At=new Set,En={currentRoute:f,listening:!0,addRoute:v,removeRoute:I,clearRoutes:e.clearRoutes,hasRoute:V,getRoutes:C,resolve:F,options:t,push:z,replace:ce,go:it,back:()=>it(-1),forward:()=>it(1),beforeEach:o.add,beforeResolve:m.add,afterEach:h.add,onError:we.add,isReady:Yt,install(y){const E=this;y.component("RouterLink",Ro),y.component("RouterView",Wo),y.config.globalProperties.$router=E,Object.defineProperty(y.config.globalProperties,"$route",{enumerable:!0,get:()=>ut(f)}),Ke&&!Jt&&f.value===Ne&&(Jt=!0,z(n.location).catch(L=>{}));const x={};for(const L in Ne)Object.defineProperty(x,L,{get:()=>f.value[L],enumerable:!0});y.provide(yn,E),y.provide(ps,Ms(x)),y.provide(mn,f);const T=y.unmount;At.add(y),y.unmount=function(){At.delete(y),At.size<1&&(d=Ne,de&&de(),de=null,f.value=Ne,Jt=!1,De=!1),T()}}};function Ge(y){return y.reduce((E,x)=>E.then(()=>ie(x)),Promise.resolve())}return En}function Uo(t,e){const s=[],a=[],n=[],o=Math.max(e.matched.length,t.matched.length);for(let m=0;m<o;m++){const h=e.matched[m];h&&(t.matched.find(d=>tt(d,h))?a.push(h):s.push(h));const f=t.matched[m];f&&(e.matched.find(d=>tt(d,f))||n.push(f))}return[s,a,n]}const Qo={name:"QuoteEdit",components:{Card:Ue,ModelSelect:Lt,VueDatePicker:It},data(){return{quote:{quote_number:"",due_date:"",provisional_start_date:"",client_id:"",client:null,status:""},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}}},mounted(){this.fetchClients(),this.fetchSettings(),this.fetchQuoteDetails()},methods:{cancelAction(){this.$router.push("/quotes")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`})),this.quote.client_id&&this.setClientById(this.quote.client_id)}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e}else{const e=await t.json();console.error("Error fetching settings:",e)}}catch(t){this.loading=!1,console.error("Error fetching settings:",t)}},fetchQuoteDetails(){const t=this.$route.params.id;!t||(this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e?(this.quote=e,this.setClientById(this.quote.client_id)):(console.error("Error fetching quote details:",e.message),this.showToast(e.message,"alert-error"))}).catch(e=>{console.error("Error fetching quote details:",e),this.showToast(e,"alert-error")}).finally(()=>{this.loading=!1}))},setClientById(t){this.quote.client=this.clients.find(e=>e.id===t)||null,this.quote.client_id=t},submitQuote(){if(!this.quote.due_date||!this.quote.provisional_start_date||!this.quote.client_id||!this.quote.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.quote)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"QuoteViewDetail",params:{id:t.id}})):(console.error("Error submitting quote:",t.message),this.showToast(t.message,"alert-error"),this.loadingBtn=!1)}).catch(t=>{console.error("Error submitting quote:",t),this.showToast(t,"alert-error"),this.loadingBtn=!1})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Lo={class:"pt-2 pr-4"},zo={class:"flex justify-between items-center mb-4"},Ho={class:"card-title"},Go=i("div",{class:"divider mt-2"},null,-1),Yo={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Jo={class:"grid grid-cols-3 gap-4"},Ko={class:"ecwp-group form-group mb-4"},Zo={for:"quoteNumber",class:"ecwp-label"},$o={class:"ecwp-group form-group mb-4"},ei={for:"quoteDate",class:"ecwp-label"},ti={class:"ecwp-group form-group mb-4"},ni={for:"quoteProvisanalDate",class:"ecwp-label"},si={class:"grid grid-cols-2 gap-4"},oi={class:"ecwp-group form-group mb-4"},ii={for:"client",class:"ecwp-label"},ai={class:"ecwp-group form-group mb-4"},li={for:"status",class:"ecwp-label"},ri={value:"draft"},ci={value:"pending"},di={value:"approved"},ui={value:"rejected"},hi={class:"flex justify-between"},mi=["disabled"],fi={key:0,class:"loading loading-spinner loading-sm"};function pi(t,e,s,a,n,o){const m=j("VueDatePicker"),h=j("model-select"),f=j("Card");return r(),c("div",Lo,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(f,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",zo,[i("h2",Ho,l(o.translations.edit_quote),1)]),Go,n.loading?(r(),c("div",Yo)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitQuote&&o.submitQuote(...d),["prevent"]))},[i("div",Jo,[i("div",Ko,[i("label",Zo,l(o.translations.quote_number),1),B(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.quote.quote_number=d),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[J,n.quote.quote_number]])]),i("div",$o,[i("label",ei,l(o.translations.due_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.due_date&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.quote.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.quote.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date},null,8,["class","modelValue","format","min-date"])]),i("div",ti,[i("label",ni,l(o.translations.provisional_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.provisional_start_date&&n.showError?"input-error":""]]),id:"quoteProvisanalDate",modelValue:n.quote.provisional_start_date,"onUpdate:modelValue":e[2]||(e[2]=d=>n.quote.provisional_start_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date},null,8,["class","modelValue","format","min-date"])])]),i("div",si,[i("div",oi,[i("label",ii,l(o.translations.company_name),1),P(h,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=d=>n.quote.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.quote.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",ai,[i("label",li,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=d=>n.quote.status=d),required:"",class:k(["ecwp-input select select-bordered w-full",[!n.quote.status&&n.showError?"input-error":""]])},[i("option",ri,l(o.translations.draft),1),i("option",ci,l(o.translations.pending),1),i("option",di,l(o.translations.approved),1),i("option",ui,l(o.translations.rejected),1)],2),[[ye,n.quote.status]])])]),i("div",hi,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",fi)):_("",!0)],8,mi)])],32)]),_:1})])}var _s=oe(Qo,[["render",pi]]);const _i={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{onConfirm(){this.$emit("confirm",this.selectedPaymentMethod),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm").close()}}},gi=["open"],vi={class:"modal-box"},yi={class:"font-bold text-lg"},bi=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),wi={class:"text-lg font-semibold text-center"},xi={class:"my-4 text-center text-xl"},Ii={class:"flex justify-between space-x-4"};function Ei(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm",class:"modal",open:t.showModal},[i("div",vi,[i("h3",yi,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),bi,i("h2",wi,l(s.title),1),i("p",xi,l(s.message),1),i("div",Ii,[i("button",{onClick:e[1]||(e[1]=(...m)=>o.onCancel&&o.onCancel(...m)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[2]||(e[2]=(...m)=>o.onConfirm&&o.onConfirm(...m)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,gi)])}var bn=oe(_i,[["render",Ei]]);const Ci={name:"QuotesList",components:{Card:Ue,QuoteEditModal:_s,ConfirmModal:bn,RemoveModal:xt},data(){return{quotes:[],showQuoteDetailsModal:!1,editQuoteModal:!1,selectedQuote:null,currentPage:1,totalCount:0,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",settings:{},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchQuotes(),this.loadSettings()},methods:{fetchQuotes(t=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/quotes?page=${t}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.quotes=s.quotes,this.totalCount=s.total_count,this.totalPages=s.total_pages,this.currentPage=t,this.perPage=e,this.generatePaginationButtons()}).catch(s=>{console.error("Error fetching quotes:",s)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},calculateVAT(t){return $n(t,this.default_vat.rate)},calculateWithoutVAT(t){return es(t)},generatePaginationButtons(){this.paginationButtons=ts(this.currentPage,this.totalPages)},goToPage(t){t!=="..."&&this.fetchQuotes(t)},perPageChanged(){this.fetchQuotes()},formatAmount(t,e){return ns(t,e,this.settings.currency_position)},confirmDuplicateQuote(t){this.selectedQuote=t,modal_confirm.showModal(),this.showRemoveModal=!0},duplicateQuote(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/duplicate/${t}`,{method:"POST",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchQuotes(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error duplicate quote:",e.statusText))}).catch(e=>{console.log(e.message),this.showToast(e.message,"alert-error")})},confirmDeleteQuote(t){this.selectedQuote=t,modal_remove.showModal(),this.showRemoveModal=!0},deleteQuote(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/delete/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchQuotes(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting quote:",e.statusText))}).catch(e=>{console.log(e.message),this.showToast(e.message,"alert-error")})},showToast(t,e){ss(this.toast,t,e)}},computed:{skeletonItems(){return Array.from({length:5},(t,e)=>e)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},ki={class:"pt-2 pr-4"},Ti={class:"flex justify-between items-center"},Ai={class:"card-title"},Si={class:"btn btn-primary rounded-full"},Di=i("i",{class:"fas fa-plus-circle"},null,-1),Pi={key:0,class:"ms-2"},Mi={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab2"},ji=i("i",{class:"fas fa-file-export"},null,-1),qi=["data-tip"],Oi={class:"btn btn-outline btn-accent rounded-full",disabled:""},Vi=i("i",{class:"fas fa-file-export"},null,-1),Ri=i("div",{class:"divider mt-2"},null,-1),Ni={class:"flex items-center mb-4"},Bi={for:"perPageSelect",class:"mr-2"},Fi=["value"],Wi={class:"overflow-x-auto"},Xi={key:0,class:"table w-full"},Ui={class:"flex justify-center"},Qi={key:0,class:"badge badge-warning badge-outline badge-sm"},Li={key:1,class:"badge badge-secondary badge-outline badge-sm"},zi={key:2,class:"badge badge-success badge-outline badge-sm"},Hi={key:3,class:"badge badge-error badge-outline badge-sm"},Gi={key:0},Yi={key:0},Ji={key:0},Ki={key:1},Zi={key:1},$i={key:0},ea={key:1},ta={key:1},na=i("span",{class:"loading loading-bars loading-sm"},null,-1),sa=[na],oa={key:0},ia={key:1},aa=i("span",{class:"loading loading-bars loading-sm"},null,-1),la=[aa],ra={key:0},ca={key:1},da=i("span",{class:"loading loading-bars loading-sm"},null,-1),ua=[da],ha={class:"flex justify-end"},ma=["data-tip"],fa=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"far fa-eye"})],-1),pa=["data-tip"],_a=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"fas fa-pencil-alt"})],-1),ga=["data-tip"],va=["onClick"],ya=i("i",{class:"far fa-copy"},null,-1),ba=[ya],wa=["data-tip"],xa=["onClick"],Ia=i("i",{class:"far fa-trash-alt"},null,-1),Ea=[Ia],Ca={key:1},ka=i("div",{class:"flex gap-4 items-center"},[i("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),i("div",{class:"flex flex-col gap-4 w-full"},[i("div",{class:"skeleton h-4 w-full"}),i("div",{class:"skeleton h-4 w-full"})])],-1),Ta=i("div",{class:"divider my-1"},null,-1),Aa=[ka,Ta],Sa={class:"join ecwp_pagination mt-6 pt-4"},Da=["onClick"];function Pa(t,e,s,a,n,o){const m=j("confirm-modal"),h=j("remove-modal"),f=j("router-link"),d=j("Card");return r(),c("div",ki,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(m,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=u=>this.duplicateQuote(n.selectedQuote)),onCancel:e[1]||(e[1]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),P(h,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[2]||(e[2]=u=>this.deleteQuote(n.selectedQuote)),onCancel:e[3]||(e[3]=u=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),P(d,{topMargin:"mt-8"},{default:re(()=>[i("div",Ti,[i("h2",Ai,l(o.translations.quotes),1),i("div",null,[P(f,{to:{name:"QuoteNew"}},{default:re(()=>[i("button",Si,[w(l(o.translations.add)+" ",1),Di])]),_:1}),n.settings.easy_compta_export_addon_active==1?(r(),c("span",Pi,[i("a",Mi,[w(l(o.translations.export)+" ",1),ji])])):(r(),c("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",Oi,[w(l(o.translations.export)+" ",1),Vi])],8,qi))])]),Ri,i("div",Ni,[i("label",Bi,l(o.translations.display_per_page),1),B(i("select",{id:"perPageSelect","onUpdate:modelValue":e[4]||(e[4]=u=>n.perPage=u),onChange:e[5]||(e[5]=(...u)=>o.perPageChanged&&o.perPageChanged(...u))},[(r(!0),c(W,null,U(n.perPageOptions,u=>(r(),c("option",{key:u,value:u},l(u),9,Fi))),128))],544),[[ye,n.perPage]])]),i("div",Wi,[n.loading?(r(),c("div",Ca,[(r(!0),c(W,null,U(n.skeletonRows,u=>(r(),c("div",{key:u,class:"flex flex-col gap-4 w-full"},Aa))),128))])):(r(),c("table",Xi,[i("thead",null,[i("tr",null,[i("th",null,l(o.translations.quote_number),1),i("th",null,l(o.translations.client),1),i("th",null,l(o.translations.status),1),i("th",null,l(o.translations.total),1),i("th",null,l(o.translations.due_date),1),i("th",null,l(o.translations.created_at),1),i("th",Ui,l(o.translations.actions),1)])]),i("tbody",null,[(r(!0),c(W,null,U(n.quotes,u=>(r(),c("tr",{key:u.id},[i("td",null,l(u.quote_number),1),i("td",null,l(u.client_name),1),i("td",null,[u.status=="draft"?(r(),c("span",Qi,l(o.translations.draft),1)):_("",!0),u.status=="pending"?(r(),c("span",Li,l(o.translations.pending),1)):_("",!0),u.status=="approved"?(r(),c("span",zi,l(o.translations.approved),1)):_("",!0),u.status=="rejected"?(r(),c("span",Hi,l(o.translations.rejected),1)):_("",!0)]),i("td",null,[n.loadingPrice?(r(),c("div",ta,sa)):(r(),c("div",Gi,[n.settings.vat_active==1?(r(),c("div",Yi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(r(),c("span",Ji,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Ki,l(o.formatAmount(u.total_amount,u.client_currency)),1))])):(r(),c("div",Zi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(r(),c("span",$i,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(r(),c("span",ea,l(o.formatAmount(u.total_amount,u.client_currency)),1))]))]))]),i("td",null,[n.loadingPrice?(r(),c("div",ia,la)):(r(),c("div",oa,l(u.due_date),1))]),i("td",null,[n.loadingPrice?(r(),c("div",ca,ua)):(r(),c("div",ra,l(u.created),1))]),i("td",ha,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[P(f,{to:{name:"QuoteViewDetail",params:{id:u.id}}},{default:re(()=>[fa]),_:2},1032,["to"])],8,ma),i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[P(f,{to:{name:"QuoteEdit",params:{id:u.id}}},{default:re(()=>[_a]),_:2},1032,["to"])],8,pa),i("span",{class:"lg:tooltip","data-tip":o.translations.duplicate},[i("button",{onClick:p=>o.confirmDuplicateQuote(u.id),class:"btn btn-circle text-purple-600 hover:text-purple-900 mx-1"},ba,8,va)],8,ga),i("span",{class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:p=>o.confirmDeleteQuote(u.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Ea,8,xa)],8,wa)])]))),128))])]))]),i("div",Sa,[(r(!0),c(W,null,U(n.paginationButtons,u=>(r(),c("button",{key:u,class:k(["join-item btn",{"btn-disabled":u==="..."||u===n.currentPage}]),onClick:p=>o.goToPage(u)},l(u),11,Da))),128))])]),_:1})])}var Ma=oe(Ci,[["render",Pa]]);const ja={name:"sendQuote",components:{VueEditor:Et.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,quoteId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"quote",id:this.quoteId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},qa=["id","open"],Oa={class:"modal-box"},Va={class:"font-bold text-lg"},Ra={key:0},Na={class:"grid grid-cols-1 gap-4"},Ba=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Fa=i("div",{class:"skeleton h-4 w-full"},null,-1),Wa=[Ba,Fa],Xa={class:"grid grid-cols-1 gap-4"},Ua=["type"],Qa=["for"],La=["id","value","disabled","onInput"],za={key:1},Ha=["for"],Ga={class:"form-group mt-4 flex justify-end"},Ya=["disabled"],Ja={key:0,class:"loading loading-spinner loading-sm"};function Ka(t,e,s,a,n,o){const m=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Oa,[i("h3",Va,l(o.translations.send_quote),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=h=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",Ra,[i("div",Na,[(r(!0),c(W,null,U(o.skeletonItems,h=>(r(),c("div",{key:h,class:"py-2"},Wa))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Xa,[(r(!0),c(W,null,U(n.fields,(h,f)=>(r(),c("div",{key:f,class:"ecwp-group form-group"},[h.type!=="textarea"?(r(),c("div",{key:0,type:h.type||"text"},[i("label",{for:f,class:"ecwp-label form-label"},l(h.label),9,Qa),i("input",{id:f,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:d=>o.updateFieldValue(f,d.target.value)},null,42,La)],8,Ua)):(r(),c("div",za,[i("label",{for:f,class:"form-label"},l(h.label),9,Ha),P(m,{modelValue:h.value,"onUpdate:modelValue":d=>h.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Ga,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",Ja)):_("",!0)],8,Ya)])],32))])],8,qa)])}var Za=oe(ja,[["render",Ka]]);const $a={components:{VueDatePicker:It},props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},totalAmount:{type:String,required:!0},currency:{type:String,required:!0},advanceSold:{type:String,required:!0},quoteId:{type:Number,required:!0}},data(){return{showError:!1,selectedType:"",inputValue:0,due_date:"",invoiceSolded:!1,establishedAdvances:[],loading:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},remainingAmount(){this.loading=!0;const t=this.establishedAdvances.reduce((e,s)=>{const a=parseFloat(s.advance_amount);return isNaN(a)?(console.error("Erreur: advance_amount n'est pas un nombre valide",s.advance_amount),e):e+a},0);return this.totalAmount-t},inputValueExceeds(){return this.remainingAmount==0?!0:this.selectedType==="percentage"?this.calculatedAmount>this.remainingAmount:this.selectedType==="fixed"?this.inputValue>this.remainingAmount:!1},calculatedAmount(){return this.selectedType==="percentage"?this.inputValue/100*this.remainingAmount:this.inputValue}},created(){this.fetchEstablishedAdvances(this.quoteId)},methods:{fetchEstablishedAdvances(t){const e=`/wp-json/my-easy-compta/v1/advance/${t}`;fetch(e,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.establishedAdvances=s}).catch(s=>{console.error("Error fetching advances:",s)})},onConfirm(){if(!this.inputValueExceeds){if(this.advanceSold=="no_sold"){if(!this.inputValue||!this.due_date||this.advanceSold=="no_sold"&&!this.selectedType){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.$emit("confirm",{type:this.selectedType,value:this.inputValue,date:this.due_date})}else{if(!this.due_date){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.$emit("confirm",{type:"fixed",value:this.remainingAmount,date:this.due_date})}this.closeModal()}},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_advance").close()},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},el=["open"],tl={class:"modal-box overflow-visible"},nl={class:"font-bold text-lg"},sl={class:"text-lg font-semibold text-center"},ol={class:"my-4 text-center text-xl"},il={key:0,class:"text-red-500 text-sm"},al={class:"grid grid-cols-2 gap-4"},ll={key:0},rl={class:"flex ecwp-group form-group mb-4"},cl=i("label",{for:"advance-type",class:"ecwp-label"},"Type",-1),dl=i("option",{value:"percentage"},"Pourcentage",-1),ul=i("option",{value:"fixed"},"Montant fixe",-1),hl=[dl,ul],ml={key:1},fl={class:"flex ecwp-group form-group mb-4"},pl=i("label",{for:"advance-type",class:"ecwp-label"},"Valeur",-1),_l={class:"absolute items-center border rounded-md right-0 top-6"},gl={class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"},vl={key:0},yl={key:1},bl={key:1,class:"mt-2"},wl={class:"text-sm"},xl={key:2,class:"flex ecwp-group form-group mb-4"},Il={for:"quoteDate",class:"ecwp-label"},El={key:3},Cl={class:"flex justify-between space-x-4 mt-4"},kl=["disabled"];function Tl(t,e,s,a,n,o){const m=j("VueDatePicker");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:"modal_advance",class:"modal",open:s.isVisible},[i("div",tl,[i("h3",nl,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...h)=>o.closeModal&&o.closeModal(...h))}," \u2715 "),i("h2",sl,l(s.title),1),i("p",ol," Montant total restant : "+l(o.remainingAmount)+" "+l(s.currency),1),o.inputValueExceeds&&!n.invoiceSolded?(r(),c("p",il," Le montant s\xE9lectionn\xE9 d\xE9passe le montant total du devis. ")):_("",!0),i("div",al,[s.advanceSold=="no_sold"&&!n.invoiceSolded?(r(),c("div",ll,[i("div",rl,[cl,B(i("select",{"onUpdate:modelValue":e[1]||(e[1]=h=>n.selectedType=h),id:"advance-type",class:k(["ecwp-select ecwp-input input input-bordered w-full",{"input-error":!n.selectedType&&n.showError}])},hl,2),[[ye,n.selectedType]])])])):_("",!0),n.selectedType&&s.advanceSold=="no_sold"&&!n.invoiceSolded?(r(),c("div",ml,[i("div",fl,[pl,B(i("input",{"onUpdate:modelValue":e[2]||(e[2]=h=>n.inputValue=h),type:"text",id:"advance-value",class:k([{"input-error":!n.inputValue&&n.showError},"ecwp-input input input-bordered w-full"])},null,2),[[J,n.inputValue]]),i("div",_l,[i("div",gl,[n.selectedType==="percentage"?(r(),c("span",vl,"%")):(r(),c("span",yl,l(s.currency),1))])])])])):_("",!0)]),n.selectedType==="percentage"&&!o.inputValueExceeds&!n.invoiceSolded?(r(),c("div",bl,[i("p",wl," Montant bas\xE9 sur le pourcentage: "+l(o.calculatedAmount)+" "+l(s.currency),1)])):_("",!0),n.invoiceSolded?_("",!0):(r(),c("div",xl,[i("label",Il,l(o.translations.due_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.inputValue&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.due_date,"onUpdate:modelValue":e[3]||(e[3]=h=>n.due_date=h),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr",required:""},null,8,["modelValue","format","min-date","class"])])),n.invoiceSolded?(r(),c("div",El,"Facture d\xE9j\xE0 sold\xE9")):_("",!0),i("div",Cl,[i("button",{onClick:e[4]||(e[4]=(...h)=>o.onCancel&&o.onCancel(...h)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[5]||(e[5]=(...h)=>o.onConfirm&&o.onConfirm(...h)),disabled:o.inputValueExceeds,class:"btn rounded-full btn-error text-white"},l(s.confirmText),9,kl)])])],8,el)])}var Al=oe($a,[["render",Tl]]);const Sl={name:"QuoteNavBar",components:{SendQuoteModal:Za,ConfirmModal:bn,AdvanceModal:Al},props:{quoteInfo:Object,emailActive:Number,advanceActive:Number,currency:String,noItems:Boolean},data(){return{selectedQuote:null,advanceSold:!1,sendQuoteModal:!1,loadingModal:!1,loadingPdf:!1,loading:!1,client_detail:null,subject:"",content:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{async changeQuoteStatus(t){try{const s=await(await fetch("/wp-json/my-easy-compta/v1/quotes/update-status",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.quoteInfo.id,status:t})})).json();s.success?(this.quoteInfo.status=t,this.quoteInfo.total_amount=s.total_amount,this.showToast(s.message,"alert-success")):(console.error("Failed to update quote status:",s.message),this.showToast(s.message,"alert-error"))}catch(e){console.error("An error occurred while updating quote status:",e),this.showToast(e,"alert-error")}},convertToInvoice(t){fetch(`/wp-json/my-easy-compta/v1/quotes/convert-quote/${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e.success?(this.showToast(e.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:e.id}})):this.showToast(e.message,"alert-error")}).catch(e=>{console.error("Error converting quote:",e),this.showToast(e.message,"alert-error")})},handleAdvanceInvoiceConfirm(t){const{type:e,value:s,date:a}=t;this.convertAdvanceInvoice(this.selectedQuote,e,s,a)},convertAdvanceInvoice(t,e,s,a){fetch(`/wp-json/my-easy-compta/v1/quotes/convert-advance/${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({advance_type:e,advance_value:s,advance_date:a})}).then(n=>n.json()).then(n=>{n.success?(this.showToast(n.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:n.id}})):this.showToast(n.message,"alert-error")}).catch(n=>{console.error("Error converting quote:",n),this.showToast(n.message,"alert-error")})},confirmConvertQuote(t){this.selectedQuote=t,modal_confirm.showModal(),this.showRemoveModal=!0},ConvertAdvanceQuote(t,e){this.selectedQuote=t,this.advanceSold=e,modal_advance.showModal(),this.showRemoveModal=!0},exportToPDF(){this.loadingPdf=!0;const t=this.quoteInfo.id;fetch(`/wp-json/my-easy-compta/v1/quotes/pdf/${t}`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw this.loadingPdf=!1,new Error("Network response was not ok");return this.loadingPdf=!1,e.blob()}).then(e=>{const s=URL.createObjectURL(e);window.open(s),this.loadingPdf=!1}).catch(e=>{console.error("There was a problem with the fetch operation:",e),this.loadingPdf=!1})},sendQuote(t){this.loadingModal=!0,this.sendQuoteModal=!0,modal_send_quote.showModal(),this.fetchClient(t),this.fetchSettings()},fetchClient(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.loading=!1}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok){const e=await t.json();this.subject=e.email_quote_subject,this.content=e.email_quote_content,this.loading=!1}else{const e=await t.json();this.showToast(e.message,"alert-error"),this.loading=!1}}catch(t){this.loading=!1,this.showToast(t.message,"alert-error")}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Dl={key:0},Pl={key:1},Ml={key:3,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},jl=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),ql=[jl],Ol={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Vl=i("div",{class:"dropdown"},[i("div",{tabindex:"0",role:"button",class:"btn btn-ghost lg:hidden"},[i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h8m-8 6h16"})])]),i("ul",{tabindex:"0",class:"menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"},[i("li",null,[i("a",null,"Item 1")]),i("li",null,[i("a",null,"Parent"),i("ul",{class:"p-2"},[i("li",null,[i("a",null,"Submenu 1")]),i("li",null,[i("a",null,"Submenu 2")])])]),i("li",null,[i("a",null,"Item 3")])])],-1),Rl={class:"hidden lg:flex gap-2"},Nl={class:"btn btn-sm"},Bl=i("i",{class:"far fa-edit"},null,-1),Fl=i("i",{class:"fa fa-check"},null,-1),Wl=["data-tip"],Xl={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Ul=i("i",{class:"fas fa-check"},null,-1),Ql=i("i",{class:"fa fa-check"},null,-1),Ll=i("i",{class:"fa fa-times"},null,-1),zl={key:4},Hl={class:"dropdown"},Gl={tabindex:"0",role:"button",class:"btn btn-sm"},Yl=i("i",{class:"fas fa-exchange-alt"},null,-1),Jl={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},Kl={key:0},Zl={key:5},$l=i("i",{class:"fas fa-exchange-alt"},null,-1),er={class:"flex gap-2"},tr=i("i",{class:"fas fa-paper-plane"},null,-1),nr={key:0,class:"far fa-envelope"},sr=["data-tip"],or={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},ir=i("i",{class:"fas fa-paper-plane"},null,-1),ar=["data-tip"],lr={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},rr=i("i",{class:"fas fa-paper-plane"},null,-1),cr=["disabled"],dr=i("i",{class:"far fa-file-pdf"},null,-1),ur={key:0,class:"loading loading-spinner loading-sm"};function hr(t,e,s,a,n,o){const m=j("send-quote-modal"),h=j("confirm-modal"),f=j("advance-modal"),d=j("router-link");return r(),c("div",null,[s.emailActive==1?(r(),c("div",Dl,[P(m,{loading:n.loadingModal,"show-modal":n.sendQuoteModal,"modal-id":"modal_send_quote",client:n.client_detail,"quote-id":s.quoteInfo.id,subject:n.subject,content:n.content,onClose:e[0]||(e[0]=u=>n.sendQuoteModal=!1)},null,8,["loading","show-modal","client","quote-id","subject","content"])])):_("",!0),P(h,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[1]||(e[1]=u=>this.convertToInvoice(n.selectedQuote)),onCancel:e[2]||(e[2]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),s.advanceActive==1?(r(),c("div",Pl,[P(f,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,"total-amount":s.quoteInfo.total_amount,currency:s.currency,quoteId:s.quoteInfo.id,"advance-sold":n.advanceSold,onConfirm:o.handleAdvanceInvoiceConfirm,onCancel:e[3]||(e[3]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","total-amount","currency","quoteId","advance-sold","onConfirm"])])):_("",!0),n.toast.visible?(r(),c("div",{key:2,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),n.loading?(r(),c("div",Ml,ql)):_("",!0),i("div",Ol,[i("div",null,[Vl,i("div",Rl,[P(d,{to:{name:"QuoteEdit",params:{id:s.quoteInfo.id}}},{default:re(()=>[i("button",Nl,[Bl,w(l(o.translations.edit_quote),1)])]),_:1},8,["to"]),s.quoteInfo.status=="draft"&&!s.noItems?(r(),c("button",{key:0,class:"btn btn-outline btn-success btn-sm",onClick:e[4]||(e[4]=u=>o.changeQuoteStatus("pending"))},[Fl,w(" "+l(o.translations.validate_quote),1)])):_("",!0),s.quoteInfo.status=="draft"&&s.noItems?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",Xl,[Ul,w(" "+l(o.translations.validate_quote),1)])],8,Wl)):_("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="rejected")&&!s.noItems?(r(),c("button",{key:2,class:"btn btn-outline btn-success btn-sm",onClick:e[5]||(e[5]=u=>o.changeQuoteStatus("approved"))},[Ql,w(" "+l(o.translations.mark_as_accepted),1)])):_("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="approved")&&!s.noItems?(r(),c("button",{key:3,class:"btn btn-outline btn-error btn-sm",onClick:e[6]||(e[6]=u=>o.changeQuoteStatus("rejected"))},[Ll,w(" "+l(o.translations.mark_as_rejected),1)])):_("",!0),s.advanceActive==1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(r(),c("div",zl,[i("div",Hl,[i("div",Gl,[Yl,w(" "+l(o.translations.convertToInvoice),1)]),i("ul",Jl,[s.quoteInfo.advance!=1?(r(),c("li",Kl,[i("a",{href:"#",onClick:e[7]||(e[7]=K(u=>o.confirmConvertQuote(s.quoteInfo.id),["prevent"]))}," Facture global ")])):_("",!0),i("li",null,[i("a",{href:"#",onClick:e[8]||(e[8]=K(u=>o.ConvertAdvanceQuote(s.quoteInfo.id,"no_sold"),["prevent"]))}," Facture d'acompte "),s.quoteInfo.advance!=0?(r(),c("a",{key:0,href:"#",onClick:e[9]||(e[9]=K(u=>o.ConvertAdvanceQuote(s.quoteInfo.id,"sold"),["prevent"]))}," Facture du solde ")):_("",!0)])])])])):_("",!0),s.advanceActive!=1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(r(),c("div",Zl,[i("button",{onClick:e[10]||(e[10]=u=>o.confirmConvertQuote(s.quoteInfo.id)),class:"btn btn-sm"},[$l,w(" "+l(o.translations.convertToInvoice),1)])])):_("",!0)])]),i("div",er,[s.emailActive==1&&!s.noItems?(r(),c("button",{key:0,onClick:e[11]||(e[11]=K(u=>o.sendQuote(s.quoteInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[tr,w(" "+l(o.translations.send_quote)+" ",1),s.quoteInfo.sent==1?(r(),c("i",nr)):_("",!0)])):s.emailActive==0?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",or,[ir,w(" "+l(o.translations.send_quote),1)])],8,sr)):s.emailActive==1&&s.noItems?(r(),c("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",lr,[rr,w(" "+l(o.translations.send_quote),1)])],8,ar)):_("",!0),i("button",{onClick:e[12]||(e[12]=(...u)=>o.exportToPDF&&o.exportToPDF(...u)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[dr,w(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(r(),c("span",ur)):_("",!0)],8,cr)])])])}var mr=oe(Sl,[["render",hr]]);const fr={components:{VueEditor:Et.exports.VueEditor},props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,item:Object},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{editedItem:{...this.item},loading:this.loading,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{item_name:{label:t.item_name},item_description:{label:t.description,type:"textarea"},quantity:{label:t.quantity,type:"number"},vat_rate:{label:"Taux de TVA",type:"number"},unit_price:{label:t.unit_price,type:"number"},discount:{label:t.discount,type:"number"}}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch(`/wp-json/my-easy-compta/v1/quotes/edit-item/${this.editedItem.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedItem)});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("itemEdited")}else{const e=`Error editing item: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error editing item";this.showToast(e,"alert-error"),console.error("Error editing item:",t),this.loadingBtn=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--}},watch:{item:{handler(t){this.editedItem={...t}},immediate:!0}}},pr=["id","open"],_r={class:"modal-box"},gr={class:"font-bold text-lg"},vr={key:0},yr={class:"grid grid-cols-1 gap-4"},br=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),wr=i("div",{class:"skeleton h-4 w-full"},null,-1),xr=[br,wr],Ir={class:"grid grid-cols-1 gap-4"},Er=["type"],Cr=["for"],kr=["id","onUpdate:modelValue"],Tr={key:1},Ar=["for"],Sr={class:"form-group mt-4 flex justify-end"},Dr=["disabled"],Pr={key:0,class:"loading loading-spinner loading-sm"};function Mr(t,e,s,a,n,o){const m=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",_r,[i("h3",gr,l(s.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=h=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",vr,[i("div",yr,[(r(!0),c(W,null,U(o.skeletonItems,h=>(r(),c("div",{key:h,class:"py-2"},xr))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Ir,[(r(!0),c(W,null,U(n.fields,(h,f)=>(r(),c("div",{key:f,class:"ecwp-group form-group"},[h.type!=="textarea"?(r(),c("div",{key:0,type:h.type||"text"},[i("label",{for:f,class:"ecwp-label form-label"},l(h.label),9,Cr),B(i("input",{id:f,"onUpdate:modelValue":d=>n.editedItem[f]=d,class:k(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,kr),[[J,n.editedItem[f]]])],8,Er)):(r(),c("div",Tr,[i("label",{for:f,class:"form-label"},l(h.label),9,Ar),P(m,{id:f,modelValue:n.editedItem[f],"onUpdate:modelValue":d=>n.editedItem[f]=d,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Sr,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",Pr)):_("",!0)],8,Dr)])],32))])],8,pr)])}var jr=oe(fr,[["render",Mr]]);/**!
     5  */const Ke=typeof document!="undefined";function Ns(t){return t.__esModule||t[Symbol.toStringTag]==="Module"}const U=Object.assign;function Zt(t,e){const s={};for(const a in e){const n=e[a];s[a]=Ie(n)?n.map(t):t(n)}return s}const ht=()=>{},Ie=Array.isArray,os=/#/g,Bs=/&/g,Fs=/\//g,Ws=/=/g,Qs=/\?/g,is=/\+/g,Xs=/%5B/g,Us=/%5D/g,as=/%5E/g,Ls=/%60/g,ls=/%7B/g,zs=/%7C/g,rs=/%7D/g,Hs=/%20/g;function vn(t){return encodeURI(""+t).replace(zs,"|").replace(Xs,"[").replace(Us,"]")}function Gs(t){return vn(t).replace(ls,"{").replace(rs,"}").replace(as,"^")}function un(t){return vn(t).replace(is,"%2B").replace(Hs,"+").replace(os,"%23").replace(Bs,"%26").replace(Ls,"`").replace(ls,"{").replace(rs,"}").replace(as,"^")}function Ys(t){return un(t).replace(Ws,"%3D")}function Js(t){return vn(t).replace(os,"%23").replace(Qs,"%3F")}function Ks(t){return t==null?"":Js(t).replace(Fs,"%2F")}function bt(t){try{return decodeURIComponent(""+t)}catch{}return""+t}const Zs=/\/$/,$s=t=>t.replace(Zs,"");function $t(t,e,s="/"){let a,n={},o="",f="";const m=e.indexOf("#");let p=e.indexOf("?");return m<p&&m>=0&&(p=-1),p>-1&&(a=e.slice(0,p),o=e.slice(p+1,m>-1?m:e.length),n=t(o)),m>-1&&(a=a||e.slice(0,m),f=e.slice(m,e.length)),a=so(a!=null?a:e,s),{fullPath:a+(o&&"?")+o+f,path:a,query:n,hash:bt(f)}}function eo(t,e){const s=e.query?t(e.query):"";return e.path+(s&&"?")+s+(e.hash||"")}function En(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function to(t,e,s){const a=e.matched.length-1,n=s.matched.length-1;return a>-1&&a===n&&tt(e.matched[a],s.matched[n])&&cs(e.params,s.params)&&t(e.query)===t(s.query)&&e.hash===s.hash}function tt(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function cs(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(const s in t)if(!no(t[s],e[s]))return!1;return!0}function no(t,e){return Ie(t)?kn(t,e):Ie(e)?kn(e,t):t===e}function kn(t,e){return Ie(e)?t.length===e.length&&t.every((s,a)=>s===e[a]):t.length===1&&t[0]===e}function so(t,e){if(t.startsWith("/"))return t;if(!t)return e;const s=e.split("/"),a=t.split("/"),n=a[a.length-1];(n===".."||n===".")&&a.push("");let o=s.length-1,f,m;for(f=0;f<a.length;f++)if(m=a[f],m!==".")if(m==="..")o>1&&o--;else break;return s.slice(0,o).join("/")+"/"+a.slice(f).join("/")}const Ne={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};var wt;(function(t){t.pop="pop",t.push="push"})(wt||(wt={}));var mt;(function(t){t.back="back",t.forward="forward",t.unknown=""})(mt||(mt={}));function oo(t){if(!t)if(Ke){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),$s(t)}const io=/^[^#]+#/;function ao(t,e){return t.replace(io,"#")+e}function lo(t,e){const s=document.documentElement.getBoundingClientRect(),a=t.getBoundingClientRect();return{behavior:e.behavior,left:a.left-s.left-(e.left||0),top:a.top-s.top-(e.top||0)}}const Ht=()=>({left:window.scrollX,top:window.scrollY});function ro(t){let e;if("el"in t){const s=t.el,a=typeof s=="string"&&s.startsWith("#"),n=typeof s=="string"?a?document.getElementById(s.slice(1)):document.querySelector(s):s;if(!n)return;e=lo(n,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Tn(t,e){return(history.state?history.state.position-e:-1)+t}const hn=new Map;function co(t,e){hn.set(t,e)}function uo(t){const e=hn.get(t);return hn.delete(t),e}let ho=()=>location.protocol+"//"+location.host;function ds(t,e){const{pathname:s,search:a,hash:n}=e,o=t.indexOf("#");if(o>-1){let m=n.includes(t.slice(o))?t.slice(o).length:1,p=n.slice(m);return p[0]!=="/"&&(p="/"+p),En(p,"")}return En(s,t)+a+n}function mo(t,e,s,a){let n=[],o=[],f=null;const m=({state:g})=>{const v=ds(t,location),C=s.value,E=e.value;let O=0;if(g){if(s.value=v,e.value=g,f&&f===C){f=null;return}O=E?g.position-E.position:0}else a(v);n.forEach(F=>{F(s.value,C,{delta:O,type:wt.pop,direction:O?O>0?mt.forward:mt.back:mt.unknown})})};function p(){f=s.value}function d(g){n.push(g);const v=()=>{const C=n.indexOf(g);C>-1&&n.splice(C,1)};return o.push(v),v}function u(){const{history:g}=window;!g.state||g.replaceState(U({},g.state,{scroll:Ht()}),"")}function h(){for(const g of o)g();o=[],window.removeEventListener("popstate",m),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",m),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:p,listen:d,destroy:h}}function An(t,e,s,a=!1,n=!1){return{back:t,current:e,forward:s,replaced:a,position:window.history.length,scroll:n?Ht():null}}function fo(t){const{history:e,location:s}=window,a={value:ds(t,s)},n={value:e.state};n.value||o(a.value,{back:null,current:a.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function o(p,d,u){const h=t.indexOf("#"),g=h>-1?(s.host&&document.querySelector("base")?t:t.slice(h))+p:ho()+t+p;try{e[u?"replaceState":"pushState"](d,"",g),n.value=d}catch(v){console.error(v),s[u?"replace":"assign"](g)}}function f(p,d){const u=U({},e.state,An(n.value.back,p,n.value.forward,!0),d,{position:n.value.position});o(p,u,!0),a.value=p}function m(p,d){const u=U({},n.value,e.state,{forward:p,scroll:Ht()});o(u.current,u,!0);const h=U({},An(a.value,p,null),{position:u.position+1},d);o(p,h,!1),a.value=p}return{location:a,state:n,push:m,replace:f}}function po(t){t=oo(t);const e=fo(t),s=mo(t,e.state,e.location,e.replace);function a(o,f=!0){f||s.pauseListeners(),history.go(o)}const n=U({location:"",base:t,go:a,createHref:ao.bind(null,t)},e,s);return Object.defineProperty(n,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(n,"state",{enumerable:!0,get:()=>e.state.value}),n}function _o(t){return t=location.host?t||location.pathname+location.search:"",t.includes("#")||(t+="#"),po(t)}function go(t){return typeof t=="string"||t&&typeof t=="object"}function us(t){return typeof t=="string"||typeof t=="symbol"}const hs=Symbol("");var Sn;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(Sn||(Sn={}));function nt(t,e){return U(new Error,{type:t,[hs]:!0},e)}function Me(t,e){return t instanceof Error&&hs in t&&(e==null||!!(t.type&e))}const Dn="[^/]+?",vo={sensitive:!1,strict:!1,start:!0,end:!0},yo=/[.+*?^${}()[\]/\\]/g;function bo(t,e){const s=U({},vo,e),a=[];let n=s.start?"^":"";const o=[];for(const d of t){const u=d.length?[]:[90];s.strict&&!d.length&&(n+="/");for(let h=0;h<d.length;h++){const g=d[h];let v=40+(s.sensitive?.25:0);if(g.type===0)h||(n+="/"),n+=g.value.replace(yo,"\\$&"),v+=40;else if(g.type===1){const{value:C,repeatable:E,optional:O,regexp:F}=g;o.push({name:C,repeatable:E,optional:O});const P=F||Dn;if(P!==Dn){v+=10;try{new RegExp(`(${P})`)}catch(z){throw new Error(`Invalid custom RegExp for param "${C}" (${P}): `+z.message)}}let q=E?`((?:${P})(?:/(?:${P}))*)`:`(${P})`;h||(q=O&&d.length<2?`(?:/${q})`:"/"+q),O&&(q+="?"),n+=q,v+=20,O&&(v+=-8),E&&(v+=-20),P===".*"&&(v+=-50)}u.push(v)}a.push(u)}if(s.strict&&s.end){const d=a.length-1;a[d][a[d].length-1]+=.7000000000000001}s.strict||(n+="/?"),s.end?n+="$":s.strict&&(n+="(?:/|$)");const f=new RegExp(n,s.sensitive?"":"i");function m(d){const u=d.match(f),h={};if(!u)return null;for(let g=1;g<u.length;g++){const v=u[g]||"",C=o[g-1];h[C.name]=v&&C.repeatable?v.split("/"):v}return h}function p(d){let u="",h=!1;for(const g of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const v of g)if(v.type===0)u+=v.value;else if(v.type===1){const{value:C,repeatable:E,optional:O}=v,F=C in d?d[C]:"";if(Ie(F)&&!E)throw new Error(`Provided param "${C}" is an array but it is not repeatable (* or + modifiers)`);const P=Ie(F)?F.join("/"):F;if(!P)if(O)g.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${C}"`);u+=P}}return u||"/"}return{re:f,score:a,keys:o,parse:m,stringify:p}}function wo(t,e){let s=0;for(;s<t.length&&s<e.length;){const a=e[s]-t[s];if(a)return a;s++}return t.length<e.length?t.length===1&&t[0]===40+40?-1:1:t.length>e.length?e.length===1&&e[0]===40+40?1:-1:0}function ms(t,e){let s=0;const a=t.score,n=e.score;for(;s<a.length&&s<n.length;){const o=wo(a[s],n[s]);if(o)return o;s++}if(Math.abs(n.length-a.length)===1){if(Pn(a))return 1;if(Pn(n))return-1}return n.length-a.length}function Pn(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const xo={type:0,value:""},Co=/[a-zA-Z0-9_]/;function Io(t){if(!t)return[[]];if(t==="/")return[[xo]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(v){throw new Error(`ERR (${s})/"${d}": ${v}`)}let s=0,a=s;const n=[];let o;function f(){o&&n.push(o),o=[]}let m=0,p,d="",u="";function h(){!d||(s===0?o.push({type:0,value:d}):s===1||s===2||s===3?(o.length>1&&(p==="*"||p==="+")&&e(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:d,regexp:u,repeatable:p==="*"||p==="+",optional:p==="*"||p==="?"})):e("Invalid state to consume buffer"),d="")}function g(){d+=p}for(;m<t.length;){if(p=t[m++],p==="\\"&&s!==2){a=s,s=4;continue}switch(s){case 0:p==="/"?(d&&h(),f()):p===":"?(h(),s=1):g();break;case 4:g(),s=a;break;case 1:p==="("?s=2:Co.test(p)?g():(h(),s=0,p!=="*"&&p!=="?"&&p!=="+"&&m--);break;case 2:p===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+p:s=3:u+=p;break;case 3:h(),s=0,p!=="*"&&p!=="?"&&p!=="+"&&m--,u="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${d}"`),h(),f(),n}function Eo(t,e,s){const a=bo(Io(t.path),s),n=U(a,{record:t,parent:e,children:[],alias:[]});return e&&!n.record.aliasOf==!e.record.aliasOf&&e.children.push(n),n}function ko(t,e){const s=[],a=new Map;e=qn({strict:!1,end:!0,sensitive:!1},e);function n(h){return a.get(h)}function o(h,g,v){const C=!v,E=To(h);E.aliasOf=v&&v.record;const O=qn(e,h),F=[E];if("alias"in h){const z=typeof h.alias=="string"?[h.alias]:h.alias;for(const ce of z)F.push(U({},E,{components:v?v.record.components:E.components,path:ce,aliasOf:v?v.record:E}))}let P,q;for(const z of F){const{path:ce}=z;if(g&&ce[0]!=="/"){const ne=g.record.path,Z=ne[ne.length-1]==="/"?"":"/";z.path=g.record.path+(ce&&Z+ce)}if(P=Eo(z,g,O),v?v.alias.push(P):(q=q||P,q!==P&&q.alias.push(P),C&&h.name&&!jn(P)&&f(h.name)),fs(P)&&p(P),E.children){const ne=E.children;for(let Z=0;Z<ne.length;Z++)o(ne[Z],P,v&&v.children[Z])}v=v||P}return q?()=>{f(q)}:ht}function f(h){if(us(h)){const g=a.get(h);g&&(a.delete(h),s.splice(s.indexOf(g),1),g.children.forEach(f),g.alias.forEach(f))}else{const g=s.indexOf(h);g>-1&&(s.splice(g,1),h.record.name&&a.delete(h.record.name),h.children.forEach(f),h.alias.forEach(f))}}function m(){return s}function p(h){const g=Do(h,s);s.splice(g,0,h),h.record.name&&!jn(h)&&a.set(h.record.name,h)}function d(h,g){let v,C={},E,O;if("name"in h&&h.name){if(v=a.get(h.name),!v)throw nt(1,{location:h});O=v.record.name,C=U(Mn(g.params,v.keys.filter(q=>!q.optional).concat(v.parent?v.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),h.params&&Mn(h.params,v.keys.map(q=>q.name))),E=v.stringify(C)}else if(h.path!=null)E=h.path,v=s.find(q=>q.re.test(E)),v&&(C=v.parse(E),O=v.record.name);else{if(v=g.name?a.get(g.name):s.find(q=>q.re.test(g.path)),!v)throw nt(1,{location:h,currentLocation:g});O=v.record.name,C=U({},g.params,h.params),E=v.stringify(C)}const F=[];let P=v;for(;P;)F.unshift(P.record),P=P.parent;return{name:O,path:E,params:C,matched:F,meta:So(F)}}t.forEach(h=>o(h));function u(){s.length=0,a.clear()}return{addRoute:o,resolve:d,removeRoute:f,clearRoutes:u,getRoutes:m,getRecordMatcher:n}}function Mn(t,e){const s={};for(const a of e)a in t&&(s[a]=t[a]);return s}function To(t){return{path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:void 0,beforeEnter:t.beforeEnter,props:Ao(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}}}function Ao(t){const e={},s=t.props||!1;if("component"in t)e.default=s;else for(const a in t.components)e[a]=typeof s=="object"?s[a]:s;return e}function jn(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function So(t){return t.reduce((e,s)=>U(e,s.meta),{})}function qn(t,e){const s={};for(const a in t)s[a]=a in e?e[a]:t[a];return s}function Do(t,e){let s=0,a=e.length;for(;s!==a;){const o=s+a>>1;ms(t,e[o])<0?a=o:s=o+1}const n=Po(t);return n&&(a=e.lastIndexOf(n,a-1)),a}function Po(t){let e=t;for(;e=e.parent;)if(fs(e)&&ms(t,e)===0)return e}function fs({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Mo(t){const e={};if(t===""||t==="?")return e;const a=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<a.length;++n){const o=a[n].replace(is," "),f=o.indexOf("="),m=bt(f<0?o:o.slice(0,f)),p=f<0?null:bt(o.slice(f+1));if(m in e){let d=e[m];Ie(d)||(d=e[m]=[d]),d.push(p)}else e[m]=p}return e}function Rn(t){let e="";for(let s in t){const a=t[s];if(s=Ys(s),a==null){a!==void 0&&(e+=(e.length?"&":"")+s);continue}(Ie(a)?a.map(o=>o&&un(o)):[a&&un(a)]).forEach(o=>{o!==void 0&&(e+=(e.length?"&":"")+s,o!=null&&(e+="="+o))})}return e}function jo(t){const e={};for(const s in t){const a=t[s];a!==void 0&&(e[s]=Ie(a)?a.map(n=>n==null?null:""+n):a==null?a:""+a)}return e}const qo=Symbol(""),On=Symbol(""),yn=Symbol(""),ps=Symbol(""),mn=Symbol("");function lt(){let t=[];function e(a){return t.push(a),()=>{const n=t.indexOf(a);n>-1&&t.splice(n,1)}}function s(){t=[]}return{add:e,list:()=>t.slice(),reset:s}}function Be(t,e,s,a,n,o=f=>f()){const f=a&&(a.enterCallbacks[n]=a.enterCallbacks[n]||[]);return()=>new Promise((m,p)=>{const d=g=>{g===!1?p(nt(4,{from:s,to:e})):g instanceof Error?p(g):go(g)?p(nt(2,{from:e,to:g})):(f&&a.enterCallbacks[n]===f&&typeof g=="function"&&f.push(g),m())},u=o(()=>t.call(a&&a.instances[n],e,s,d));let h=Promise.resolve(u);t.length<3&&(h=h.then(d)),h.catch(g=>p(g))})}function en(t,e,s,a,n=o=>o()){const o=[];for(const f of t)for(const m in f.components){let p=f.components[m];if(!(e!=="beforeRouteEnter"&&!f.instances[m]))if(Ro(p)){const u=(p.__vccOpts||p)[e];u&&o.push(Be(u,s,a,f,m,n))}else{let d=p();o.push(()=>d.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${m}" at "${f.path}"`));const h=Ns(u)?u.default:u;f.components[m]=h;const v=(h.__vccOpts||h)[e];return v&&Be(v,s,a,f,m,n)()}))}}return o}function Ro(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function Vn(t){const e=yt(yn),s=yt(ps),a=Ee(()=>{const p=ut(t.to);return e.resolve(p)}),n=Ee(()=>{const{matched:p}=a.value,{length:d}=p,u=p[d-1],h=s.matched;if(!u||!h.length)return-1;const g=h.findIndex(tt.bind(null,u));if(g>-1)return g;const v=Nn(p[d-2]);return d>1&&Nn(u)===v&&h[h.length-1].path!==v?h.findIndex(tt.bind(null,p[d-2])):g}),o=Ee(()=>n.value>-1&&Bo(s.params,a.value.params)),f=Ee(()=>n.value>-1&&n.value===s.matched.length-1&&cs(s.params,a.value.params));function m(p={}){return No(p)?e[ut(t.replace)?"replace":"push"](ut(t.to)).catch(ht):Promise.resolve()}return{route:a,href:Ee(()=>a.value.href),isActive:o,isExactActive:f,navigate:m}}const Oo=Jn({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"}},useLink:Vn,setup(t,{slots:e}){const s=qs(Vn(t)),{options:a}=yt(yn),n=Ee(()=>({[Bn(t.activeClass,a.linkActiveClass,"router-link-active")]:s.isActive,[Bn(t.exactActiveClass,a.linkExactActiveClass,"router-link-exact-active")]:s.isExactActive}));return()=>{const o=e.default&&e.default(s);return t.custom?o:Kn("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},o)}}}),Vo=Oo;function No(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function Bo(t,e){for(const s in e){const a=e[s],n=t[s];if(typeof a=="string"){if(a!==n)return!1}else if(!Ie(n)||n.length!==a.length||a.some((o,f)=>o!==n[f]))return!1}return!0}function Nn(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const Bn=(t,e,s)=>t!=null?t:e!=null?e:s,Fo=Jn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:s}){const a=yt(mn),n=Ee(()=>t.route||a.value),o=yt(On,0),f=Ee(()=>{let d=ut(o);const{matched:u}=n.value;let h;for(;(h=u[d])&&!h.components;)d++;return d}),m=Ee(()=>n.value.matched[f.value]);Kt(On,Ee(()=>f.value+1)),Kt(qo,m),Kt(mn,n);const p=Rs();return Os(()=>[p.value,m.value,t.name],([d,u,h],[g,v,C])=>{u&&(u.instances[h]=d,v&&v!==u&&d&&d===g&&(u.leaveGuards.size||(u.leaveGuards=v.leaveGuards),u.updateGuards.size||(u.updateGuards=v.updateGuards))),d&&u&&(!v||!tt(u,v)||!g)&&(u.enterCallbacks[h]||[]).forEach(E=>E(d))},{flush:"post"}),()=>{const d=n.value,u=t.name,h=m.value,g=h&&h.components[u];if(!g)return Fn(s.default,{Component:g,route:d});const v=h.props[u],C=v?v===!0?d.params:typeof v=="function"?v(d):v:null,O=Kn(g,U({},C,e,{onVnodeUnmounted:F=>{F.component.isUnmounted&&(h.instances[u]=null)},ref:p}));return Fn(s.default,{Component:O,route:d})||O}}});function Fn(t,e){if(!t)return null;const s=t(e);return s.length===1?s[0]:s}const Wo=Fo;function Qo(t){const e=ko(t.routes,t),s=t.parseQuery||Mo,a=t.stringifyQuery||Rn,n=t.history,o=lt(),f=lt(),m=lt(),p=Ps(Ne);let d=Ne;Ke&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Zt.bind(null,y=>""+y),h=Zt.bind(null,Ks),g=Zt.bind(null,bt);function v(y,I){let x,T;return us(y)?(x=e.getRecordMatcher(y),T=I):T=y,e.addRoute(T,x)}function C(y){const I=e.getRecordMatcher(y);I&&e.removeRoute(I)}function E(){return e.getRoutes().map(y=>y.record)}function O(y){return!!e.getRecordMatcher(y)}function F(y,I){if(I=U({},I||p.value),typeof y=="string"){const R=$t(s,y,I.path),se=e.resolve({path:R.path},I),at=n.createHref(R.fullPath);return U(R,se,{params:g(se.params),hash:bt(R.hash),redirectedFrom:void 0,href:at})}let x;if(y.path!=null)x=U({},y,{path:$t(s,y.path,I.path).path});else{const R=U({},y.params);for(const se in R)R[se]==null&&delete R[se];x=U({},y,{params:h(R)}),I.params=h(I.params)}const T=e.resolve(x,I),L=y.hash||"";T.params=u(g(T.params));const $=eo(a,U({},y,{hash:Gs(L),path:T.path})),V=n.createHref($);return U({fullPath:$,hash:L,query:a===Rn?jo(y.query):y.query||{}},T,{redirectedFrom:void 0,href:V})}function P(y){return typeof y=="string"?$t(s,y,p.value.path):U({},y)}function q(y,I){if(d!==y)return nt(8,{from:I,to:y})}function z(y){return Z(y)}function ce(y){return z(U(P(y),{replace:!0}))}function ne(y){const I=y.matched[y.matched.length-1];if(I&&I.redirect){const{redirect:x}=I;let T=typeof x=="function"?x(y):x;return typeof T=="string"&&(T=T.includes("?")||T.includes("#")?T=P(T):{path:T},T.params={}),U({query:y.query,hash:y.hash,params:T.path!=null?{}:y.params},T)}}function Z(y,I){const x=d=F(y),T=p.value,L=y.state,$=y.force,V=y.replace===!0,R=ne(x);if(R)return Z(U(P(R),{state:typeof R=="object"?U({},L,R.state):L,force:$,replace:V}),I||x);const se=x;se.redirectedFrom=I;let at;return!$&&to(a,T,x)&&(at=nt(16,{to:se,from:T}),ot(T,T,!0,!1)),(at?Promise.resolve(at):Oe(se,T)).catch(he=>Me(he)?Me(he,2)?he:Tt(he):Pe(he,se,T)).then(he=>{if(he){if(Me(he,2))return Z(U({replace:V},P(he.to),{state:typeof he.to=="object"?U({},L,he.to.state):L,force:$}),I||se)}else he=Ve(se,T,!0,V,L);return ye(se,T,he),he})}function Ue(y,I){const x=q(y,I);return x?Promise.reject(x):Promise.resolve()}function ie(y){const I=At.values().next().value;return I&&typeof I.runWithContext=="function"?I.runWithContext(y):y()}function Oe(y,I){let x;const[T,L,$]=Xo(y,I);x=en(T.reverse(),"beforeRouteLeave",y,I);for(const R of T)R.leaveGuards.forEach(se=>{x.push(Be(se,y,I))});const V=Ue.bind(null,y,I);return x.push(V),Ge(x).then(()=>{x=[];for(const R of o.list())x.push(Be(R,y,I));return x.push(V),Ge(x)}).then(()=>{x=en(L,"beforeRouteUpdate",y,I);for(const R of L)R.updateGuards.forEach(se=>{x.push(Be(se,y,I))});return x.push(V),Ge(x)}).then(()=>{x=[];for(const R of $)if(R.beforeEnter)if(Ie(R.beforeEnter))for(const se of R.beforeEnter)x.push(Be(se,y,I));else x.push(Be(R.beforeEnter,y,I));return x.push(V),Ge(x)}).then(()=>(y.matched.forEach(R=>R.enterCallbacks={}),x=en($,"beforeRouteEnter",y,I,ie),x.push(V),Ge(x))).then(()=>{x=[];for(const R of f.list())x.push(Be(R,y,I));return x.push(V),Ge(x)}).catch(R=>Me(R,8)?R:Promise.reject(R))}function ye(y,I,x){m.list().forEach(T=>ie(()=>T(y,I,x)))}function Ve(y,I,x,T,L){const $=q(y,I);if($)return $;const V=I===Ne,R=Ke?history.state:{};x&&(T||V?n.replace(y.fullPath,U({scroll:V&&R&&R.scroll},L)):n.push(y.fullPath,L)),p.value=y,ot(y,I,x,V),Tt()}let de;function Ae(){de||(de=n.listen((y,I,x)=>{if(!In.listening)return;const T=F(y),L=ne(T);if(L){Z(U(L,{replace:!0}),T).catch(ht);return}d=T;const $=p.value;Ke&&co(Tn($.fullPath,x.delta),Ht()),Oe(T,$).catch(V=>Me(V,12)?V:Me(V,2)?(Z(V.to,T).then(R=>{Me(R,20)&&!x.delta&&x.type===wt.pop&&n.go(-1,!1)}).catch(ht),Promise.reject()):(x.delta&&n.go(-x.delta,!1),Pe(V,T,$))).then(V=>{V=V||Ve(T,$,!1),V&&(x.delta&&!Me(V,8)?n.go(-x.delta,!1):x.type===wt.pop&&Me(V,20)&&n.go(-1,!1)),ye(T,$,V)}).catch(ht)}))}let Se=lt(),be=lt(),De;function Pe(y,I,x){Tt(y);const T=be.list();return T.length?T.forEach(L=>L(y,I,x)):console.error(y),Promise.reject(y)}function Yt(){return De&&p.value!==Ne?Promise.resolve():new Promise((y,I)=>{Se.add([y,I])})}function Tt(y){return De||(De=!y,Ae(),Se.list().forEach(([I,x])=>y?x(y):I()),Se.reset()),y}function ot(y,I,x,T){const{scrollBehavior:L}=t;if(!Ke||!L)return Promise.resolve();const $=!x&&uo(Tn(y.fullPath,0))||(T||!x)&&history.state&&history.state.scroll||null;return js().then(()=>L(y,I,$)).then(V=>V&&ro(V)).catch(V=>Pe(V,y,I))}const it=y=>n.go(y);let Jt;const At=new Set,In={currentRoute:p,listening:!0,addRoute:v,removeRoute:C,clearRoutes:e.clearRoutes,hasRoute:O,getRoutes:E,resolve:F,options:t,push:z,replace:ce,go:it,back:()=>it(-1),forward:()=>it(1),beforeEach:o.add,beforeResolve:f.add,afterEach:m.add,onError:be.add,isReady:Yt,install(y){const I=this;y.component("RouterLink",Vo),y.component("RouterView",Wo),y.config.globalProperties.$router=I,Object.defineProperty(y.config.globalProperties,"$route",{enumerable:!0,get:()=>ut(p)}),Ke&&!Jt&&p.value===Ne&&(Jt=!0,z(n.location).catch(L=>{}));const x={};for(const L in Ne)Object.defineProperty(x,L,{get:()=>p.value[L],enumerable:!0});y.provide(yn,I),y.provide(ps,Ms(x)),y.provide(mn,p);const T=y.unmount;At.add(y),y.unmount=function(){At.delete(y),At.size<1&&(d=Ne,de&&de(),de=null,p.value=Ne,Jt=!1,De=!1),T()}}};function Ge(y){return y.reduce((I,x)=>I.then(()=>ie(x)),Promise.resolve())}return In}function Xo(t,e){const s=[],a=[],n=[],o=Math.max(e.matched.length,t.matched.length);for(let f=0;f<o;f++){const m=e.matched[f];m&&(t.matched.find(d=>tt(d,m))?a.push(m):s.push(m));const p=t.matched[f];p&&(e.matched.find(d=>tt(d,p))||n.push(p))}return[s,a,n]}const Uo={name:"QuoteEdit",components:{Card:Xe,ModelSelect:Lt,VueDatePicker:Ct},data(){return{quote:{quote_number:"",due_date:"",provisional_start_date:"",client_id:"",client:null,status:""},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}}},mounted(){this.fetchClients(),this.fetchSettings(),this.fetchQuoteDetails()},methods:{cancelAction(){this.$router.push("/quotes")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`})),this.quote.client_id&&this.setClientById(this.quote.client_id)}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e}else{const e=await t.json();console.error("Error fetching settings:",e)}}catch(t){this.loading=!1,console.error("Error fetching settings:",t)}},fetchQuoteDetails(){const t=this.$route.params.id;!t||(this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e?(this.quote=e,this.setClientById(this.quote.client_id)):(console.error("Error fetching quote details:",e.message),this.showToast(e.message,"alert-error"))}).catch(e=>{console.error("Error fetching quote details:",e),this.showToast(e,"alert-error")}).finally(()=>{this.loading=!1}))},setClientById(t){this.quote.client=this.clients.find(e=>e.id===t)||null,this.quote.client_id=t},submitQuote(){if(!this.quote.due_date||!this.quote.provisional_start_date||!this.quote.client_id||!this.quote.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.quote)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"QuoteViewDetail",params:{id:t.id}})):(console.error("Error submitting quote:",t.message),this.showToast(t.message,"alert-error"),this.loadingBtn=!1)}).catch(t=>{console.error("Error submitting quote:",t),this.showToast(t,"alert-error"),this.loadingBtn=!1})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Lo={class:"pt-2 pr-4"},zo={class:"flex justify-between items-center mb-4"},Ho={class:"card-title"},Go=i("div",{class:"divider mt-2"},null,-1),Yo={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Jo={class:"grid grid-cols-3 gap-4"},Ko={class:"ecwp-group form-group mb-4"},Zo={for:"quoteNumber",class:"ecwp-label"},$o={class:"ecwp-group form-group mb-4"},ei={for:"quoteDate",class:"ecwp-label"},ti={class:"ecwp-group form-group mb-4"},ni={for:"quoteProvisanalDate",class:"ecwp-label"},si={class:"grid grid-cols-2 gap-4"},oi={class:"ecwp-group form-group mb-4"},ii={for:"client",class:"ecwp-label"},ai={class:"ecwp-group form-group mb-4"},li={for:"status",class:"ecwp-label"},ri={value:"draft"},ci={value:"pending"},di={value:"approved"},ui={value:"rejected"},hi={class:"flex justify-between"},mi=["disabled"],fi={key:0,class:"loading loading-spinner loading-sm"};function pi(t,e,s,a,n,o){const f=j("VueDatePicker"),m=j("model-select"),p=j("Card");return r(),c("div",Lo,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(p,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",zo,[i("h2",Ho,l(o.translations.edit_quote),1)]),Go,n.loading?(r(),c("div",Yo)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitQuote&&o.submitQuote(...d),["prevent"]))},[i("div",Jo,[i("div",Ko,[i("label",Zo,l(o.translations.quote_number),1),B(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.quote.quote_number=d),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[J,n.quote.quote_number]])]),i("div",$o,[i("label",ei,l(o.translations.due_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.due_date&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.quote.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.quote.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date},null,8,["class","modelValue","format","min-date"])]),i("div",ti,[i("label",ni,l(o.translations.provisional_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.provisional_start_date&&n.showError?"input-error":""]]),id:"quoteProvisanalDate",modelValue:n.quote.provisional_start_date,"onUpdate:modelValue":e[2]||(e[2]=d=>n.quote.provisional_start_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date},null,8,["class","modelValue","format","min-date"])])]),i("div",si,[i("div",oi,[i("label",ii,l(o.translations.company_name),1),D(m,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=d=>n.quote.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.quote.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",ai,[i("label",li,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=d=>n.quote.status=d),required:"",class:k(["ecwp-input select select-bordered w-full",[!n.quote.status&&n.showError?"input-error":""]])},[i("option",ri,l(o.translations.draft),1),i("option",ci,l(o.translations.pending),1),i("option",di,l(o.translations.approved),1),i("option",ui,l(o.translations.rejected),1)],2),[[ve,n.quote.status]])])]),i("div",hi,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",fi)):_("",!0)],8,mi)])],32)]),_:1})])}var _s=oe(Uo,[["render",pi]]);const _i={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{onConfirm(){this.$emit("confirm"),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm").close()}}},gi=["open"],vi={class:"modal-box"},yi={class:"font-bold text-lg"},bi=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),wi={class:"text-lg font-semibold text-center"},xi={class:"my-4 text-center text-xl"},Ci={class:"flex justify-between space-x-4"};function Ii(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm",class:"modal",open:t.showModal},[i("div",vi,[i("h3",yi,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...f)=>o.closeModal&&o.closeModal(...f))}," \u2715 "),bi,i("h2",wi,l(s.title),1),i("p",xi,l(s.message),1),i("div",Ci,[i("button",{onClick:e[1]||(e[1]=(...f)=>o.onCancel&&o.onCancel(...f)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[2]||(e[2]=(...f)=>o.onConfirm&&o.onConfirm(...f)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,gi)])}var bn=oe(_i,[["render",Ii]]);const Ei={name:"QuotesList",components:{Card:Xe,QuoteEditModal:_s,ConfirmModal:bn,RemoveModal:xt},data(){return{quotes:[],showQuoteDetailsModal:!1,editQuoteModal:!1,selectedQuote:null,currentPage:1,totalCount:0,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",settings:{},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchQuotes(),this.loadSettings()},methods:{fetchQuotes(t=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/quotes?page=${t}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.quotes=s.quotes,this.totalCount=s.total_count,this.totalPages=s.total_pages,this.currentPage=t,this.perPage=e,this.generatePaginationButtons()}).catch(s=>{console.error("Error fetching quotes:",s)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},calculateVAT(t){return $n(t,this.default_vat.rate)},calculateWithoutVAT(t){return es(t)},generatePaginationButtons(){this.paginationButtons=ts(this.currentPage,this.totalPages)},goToPage(t){t!=="..."&&this.fetchQuotes(t)},perPageChanged(){this.fetchQuotes()},formatAmount(t,e){return ns(t,e,this.settings.currency_position)},confirmDuplicateQuote(t){this.selectedQuote=t,modal_confirm.showModal(),this.showRemoveModal=!0},duplicateQuote(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/duplicate/${t}`,{method:"POST",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchQuotes(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error duplicate quote:",e.statusText))}).catch(e=>{console.log(e.message),this.showToast(e.message,"alert-error")})},confirmDeleteQuote(t){this.selectedQuote=t,modal_remove.showModal(),this.showRemoveModal=!0},deleteQuote(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/delete/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchQuotes(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting quote:",e.statusText))}).catch(e=>{console.log(e.message),this.showToast(e.message,"alert-error")})},showToast(t,e){ss(this.toast,t,e)}},computed:{skeletonItems(){return Array.from({length:5},(t,e)=>e)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},ki={class:"pt-2 pr-4"},Ti={class:"flex justify-between items-center"},Ai={class:"card-title"},Si={class:"btn btn-primary rounded-full"},Di=i("i",{class:"fas fa-plus-circle"},null,-1),Pi={key:0,class:"ms-2"},Mi={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab2"},ji=i("i",{class:"fas fa-file-export"},null,-1),qi=["data-tip"],Ri={class:"btn btn-outline btn-accent rounded-full",disabled:""},Oi=i("i",{class:"fas fa-file-export"},null,-1),Vi=i("div",{class:"divider mt-2"},null,-1),Ni={class:"flex items-center mb-4"},Bi={for:"perPageSelect",class:"mr-2"},Fi=["value"],Wi={class:"overflow-x-auto"},Qi={key:0,class:"table w-full"},Xi={class:"flex justify-center"},Ui={key:0,class:"badge badge-warning badge-outline badge-sm"},Li={key:1,class:"badge badge-secondary badge-outline badge-sm"},zi={key:2,class:"badge badge-success badge-outline badge-sm"},Hi={key:3,class:"badge badge-error badge-outline badge-sm"},Gi={key:0},Yi={key:0},Ji={key:0},Ki={key:1},Zi={key:1},$i={key:0},ea={key:1},ta={key:1},na=i("span",{class:"loading loading-bars loading-sm"},null,-1),sa=[na],oa={key:0},ia={key:1},aa=i("span",{class:"loading loading-bars loading-sm"},null,-1),la=[aa],ra={key:0},ca={key:1},da=i("span",{class:"loading loading-bars loading-sm"},null,-1),ua=[da],ha={class:"flex justify-end"},ma=["data-tip"],fa=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"far fa-eye"})],-1),pa=["data-tip"],_a=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"fas fa-pencil-alt"})],-1),ga=["data-tip"],va=["onClick"],ya=i("i",{class:"far fa-copy"},null,-1),ba=[ya],wa=["data-tip"],xa=["onClick"],Ca=i("i",{class:"far fa-trash-alt"},null,-1),Ia=[Ca],Ea={key:1},ka=i("div",{class:"flex gap-4 items-center"},[i("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),i("div",{class:"flex flex-col gap-4 w-full"},[i("div",{class:"skeleton h-4 w-full"}),i("div",{class:"skeleton h-4 w-full"})])],-1),Ta=i("div",{class:"divider my-1"},null,-1),Aa=[ka,Ta],Sa={class:"join ecwp_pagination mt-6 pt-4"},Da=["onClick"];function Pa(t,e,s,a,n,o){const f=j("confirm-modal"),m=j("remove-modal"),p=j("router-link"),d=j("Card");return r(),c("div",ki,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(f,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=u=>this.duplicateQuote(n.selectedQuote)),onCancel:e[1]||(e[1]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(m,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[2]||(e[2]=u=>this.deleteQuote(n.selectedQuote)),onCancel:e[3]||(e[3]=u=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(d,{topMargin:"mt-8"},{default:re(()=>[i("div",Ti,[i("h2",Ai,l(o.translations.quotes),1),i("div",null,[D(p,{to:{name:"QuoteNew"}},{default:re(()=>[i("button",Si,[w(l(o.translations.add)+" ",1),Di])]),_:1}),n.settings.easy_compta_export_addon_active==1?(r(),c("span",Pi,[i("a",Mi,[w(l(o.translations.export)+" ",1),ji])])):(r(),c("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",Ri,[w(l(o.translations.export)+" ",1),Oi])],8,qi))])]),Vi,i("div",Ni,[i("label",Bi,l(o.translations.display_per_page),1),B(i("select",{id:"perPageSelect","onUpdate:modelValue":e[4]||(e[4]=u=>n.perPage=u),onChange:e[5]||(e[5]=(...u)=>o.perPageChanged&&o.perPageChanged(...u))},[(r(!0),c(W,null,X(n.perPageOptions,u=>(r(),c("option",{key:u,value:u},l(u),9,Fi))),128))],544),[[ve,n.perPage]])]),i("div",Wi,[n.loading?(r(),c("div",Ea,[(r(!0),c(W,null,X(n.skeletonRows,u=>(r(),c("div",{key:u,class:"flex flex-col gap-4 w-full"},Aa))),128))])):(r(),c("table",Qi,[i("thead",null,[i("tr",null,[i("th",null,l(o.translations.quote_number),1),i("th",null,l(o.translations.client),1),i("th",null,l(o.translations.status),1),i("th",null,l(o.translations.total),1),i("th",null,l(o.translations.due_date),1),i("th",null,l(o.translations.created_at),1),i("th",Xi,l(o.translations.actions),1)])]),i("tbody",null,[(r(!0),c(W,null,X(n.quotes,u=>(r(),c("tr",{key:u.id},[i("td",null,l(u.quote_number),1),i("td",null,l(u.client_name),1),i("td",null,[u.status=="draft"?(r(),c("span",Ui,l(o.translations.draft),1)):_("",!0),u.status=="pending"?(r(),c("span",Li,l(o.translations.pending),1)):_("",!0),u.status=="approved"?(r(),c("span",zi,l(o.translations.approved),1)):_("",!0),u.status=="rejected"?(r(),c("span",Hi,l(o.translations.rejected),1)):_("",!0)]),i("td",null,[n.loadingPrice?(r(),c("div",ta,sa)):(r(),c("div",Gi,[n.settings.vat_active==1?(r(),c("div",Yi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(r(),c("span",Ji,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Ki,l(o.formatAmount(u.total_amount,u.client_currency)),1))])):(r(),c("div",Zi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(r(),c("span",$i,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(r(),c("span",ea,l(o.formatAmount(u.total_amount,u.client_currency)),1))]))]))]),i("td",null,[n.loadingPrice?(r(),c("div",ia,la)):(r(),c("div",oa,l(u.due_date),1))]),i("td",null,[n.loadingPrice?(r(),c("div",ca,ua)):(r(),c("div",ra,l(u.created),1))]),i("td",ha,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[D(p,{to:{name:"QuoteViewDetail",params:{id:u.id}}},{default:re(()=>[fa]),_:2},1032,["to"])],8,ma),i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[D(p,{to:{name:"QuoteEdit",params:{id:u.id}}},{default:re(()=>[_a]),_:2},1032,["to"])],8,pa),i("span",{class:"lg:tooltip","data-tip":o.translations.duplicate},[i("button",{onClick:h=>o.confirmDuplicateQuote(u.id),class:"btn btn-circle text-purple-600 hover:text-purple-900 mx-1"},ba,8,va)],8,ga),i("span",{class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:h=>o.confirmDeleteQuote(u.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Ia,8,xa)],8,wa)])]))),128))])]))]),i("div",Sa,[(r(!0),c(W,null,X(n.paginationButtons,u=>(r(),c("button",{key:u,class:k(["join-item btn",{"btn-disabled":u==="..."||u===n.currentPage}]),onClick:h=>o.goToPage(u)},l(u),11,Da))),128))])]),_:1})])}var Ma=oe(Ei,[["render",Pa]]);const ja={name:"sendQuote",components:{VueEditor:It.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,quoteId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"quote",id:this.quoteId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},qa=["id","open"],Ra={class:"modal-box"},Oa={class:"font-bold text-lg"},Va={key:0},Na={class:"grid grid-cols-1 gap-4"},Ba=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Fa=i("div",{class:"skeleton h-4 w-full"},null,-1),Wa=[Ba,Fa],Qa={class:"grid grid-cols-1 gap-4"},Xa=["type"],Ua=["for"],La=["id","value","disabled","onInput"],za={key:1},Ha=["for"],Ga={class:"form-group mt-4 flex justify-end"},Ya=["disabled"],Ja={key:0,class:"loading loading-spinner loading-sm"};function Ka(t,e,s,a,n,o){const f=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Ra,[i("h3",Oa,l(o.translations.send_quote),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=m=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",Va,[i("div",Na,[(r(!0),c(W,null,X(o.skeletonItems,m=>(r(),c("div",{key:m,class:"py-2"},Wa))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[i("div",Qa,[(r(!0),c(W,null,X(n.fields,(m,p)=>(r(),c("div",{key:p,class:"ecwp-group form-group"},[m.type!=="textarea"?(r(),c("div",{key:0,type:m.type||"text"},[i("label",{for:p,class:"ecwp-label form-label"},l(m.label),9,Ua),i("input",{id:p,class:k(["ecwp-input input input-bordered",m.class||"w-full"]),value:m.value,disabled:m.disabled,onInput:d=>o.updateFieldValue(p,d.target.value)},null,42,La)],8,Xa)):(r(),c("div",za,[i("label",{for:p,class:"form-label"},l(m.label),9,Ha),D(f,{modelValue:m.value,"onUpdate:modelValue":d=>m.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Ga,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",Ja)):_("",!0)],8,Ya)])],32))])],8,qa)])}var Za=oe(ja,[["render",Ka]]);const $a={components:{VueDatePicker:Ct},props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},totalAmount:{type:String,required:!0},currency:{type:String,required:!0},advanceSold:{type:String,required:!0},quoteId:{type:Number,required:!0}},data(){return{showError:!1,selectedType:"",inputValue:0,due_date:"",invoiceSolded:!1,establishedAdvances:[],loading:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},remainingAmount(){this.loading=!0;const t=this.establishedAdvances.reduce((e,s)=>{const a=parseFloat(s.advance_amount);return isNaN(a)?(console.error("Erreur: advance_amount n'est pas un nombre valide",s.advance_amount),e):e+a},0);return this.totalAmount-t},inputValueExceeds(){return this.remainingAmount==0?!0:this.selectedType==="percentage"?this.calculatedAmount>this.remainingAmount:this.selectedType==="fixed"?this.inputValue>this.remainingAmount:!1},calculatedAmount(){return this.selectedType==="percentage"?this.inputValue/100*this.remainingAmount:this.inputValue}},created(){this.fetchEstablishedAdvances(this.quoteId)},methods:{fetchEstablishedAdvances(t){const e=`/wp-json/my-easy-compta/v1/advance/${t}`;fetch(e,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.establishedAdvances=s}).catch(s=>{console.error("Error fetching advances:",s)})},onConfirm(){if(!this.inputValueExceeds){if(this.advanceSold=="no_sold"){if(!this.inputValue||!this.due_date||this.advanceSold=="no_sold"&&!this.selectedType){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.$emit("confirm",{type:this.selectedType,value:this.inputValue,date:this.due_date})}else{if(!this.due_date){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.$emit("confirm",{type:"fixed",value:this.remainingAmount,date:this.due_date})}this.closeModal()}},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_advance").close()},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},el=["open"],tl={class:"modal-box overflow-visible"},nl={class:"font-bold text-lg"},sl={class:"text-lg font-semibold text-center"},ol={class:"my-4 text-center text-xl"},il={key:0,class:"text-red-500 text-sm"},al={class:"grid grid-cols-2 gap-4"},ll={key:0},rl={class:"flex ecwp-group form-group mb-4"},cl=i("label",{for:"advance-type",class:"ecwp-label"},"Type",-1),dl=i("option",{value:"percentage"},"Pourcentage",-1),ul=i("option",{value:"fixed"},"Montant fixe",-1),hl=[dl,ul],ml={key:1},fl={class:"flex ecwp-group form-group mb-4"},pl=i("label",{for:"advance-type",class:"ecwp-label"},"Valeur",-1),_l={class:"absolute items-center border rounded-md right-0 top-6"},gl={class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"},vl={key:0},yl={key:1},bl={key:1,class:"mt-2"},wl={class:"text-sm"},xl={key:2,class:"flex ecwp-group form-group mb-4"},Cl={for:"quoteDate",class:"ecwp-label"},Il={key:3},El={class:"flex justify-between space-x-4 mt-4"},kl=["disabled"];function Tl(t,e,s,a,n,o){const f=j("VueDatePicker");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:"modal_advance",class:"modal",open:s.isVisible},[i("div",tl,[i("h3",nl,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),i("h2",sl,l(s.title),1),i("p",ol," Montant total restant : "+l(o.remainingAmount)+" "+l(s.currency),1),o.inputValueExceeds&&!n.invoiceSolded?(r(),c("p",il," Le montant s\xE9lectionn\xE9 d\xE9passe le montant total du devis. ")):_("",!0),i("div",al,[s.advanceSold=="no_sold"&&!n.invoiceSolded?(r(),c("div",ll,[i("div",rl,[cl,B(i("select",{"onUpdate:modelValue":e[1]||(e[1]=m=>n.selectedType=m),id:"advance-type",class:k(["ecwp-select ecwp-input input input-bordered w-full",{"input-error":!n.selectedType&&n.showError}])},hl,2),[[ve,n.selectedType]])])])):_("",!0),n.selectedType&&s.advanceSold=="no_sold"&&!n.invoiceSolded?(r(),c("div",ml,[i("div",fl,[pl,B(i("input",{"onUpdate:modelValue":e[2]||(e[2]=m=>n.inputValue=m),type:"text",id:"advance-value",class:k([{"input-error":!n.inputValue&&n.showError},"ecwp-input input input-bordered w-full"])},null,2),[[J,n.inputValue]]),i("div",_l,[i("div",gl,[n.selectedType==="percentage"?(r(),c("span",vl,"%")):(r(),c("span",yl,l(s.currency),1))])])])])):_("",!0)]),n.selectedType==="percentage"&&!o.inputValueExceeds&!n.invoiceSolded?(r(),c("div",bl,[i("p",wl," Montant bas\xE9 sur le pourcentage: "+l(o.calculatedAmount)+" "+l(s.currency),1)])):_("",!0),n.invoiceSolded?_("",!0):(r(),c("div",xl,[i("label",Cl,l(o.translations.due_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.inputValue&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.due_date,"onUpdate:modelValue":e[3]||(e[3]=m=>n.due_date=m),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr",required:""},null,8,["modelValue","format","min-date","class"])])),n.invoiceSolded?(r(),c("div",Il,"Facture d\xE9j\xE0 sold\xE9")):_("",!0),i("div",El,[i("button",{onClick:e[4]||(e[4]=(...m)=>o.onCancel&&o.onCancel(...m)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[5]||(e[5]=(...m)=>o.onConfirm&&o.onConfirm(...m)),disabled:o.inputValueExceeds,class:"btn rounded-full btn-error text-white"},l(s.confirmText),9,kl)])])],8,el)])}var Al=oe($a,[["render",Tl]]);const Sl={name:"QuoteNavBar",components:{SendQuoteModal:Za,ConfirmModal:bn,AdvanceModal:Al},props:{quoteInfo:Object,emailActive:Number,advanceActive:Number,currency:String,noItems:Boolean},data(){return{selectedQuote:null,advanceSold:!1,sendQuoteModal:!1,loadingModal:!1,loadingPdf:!1,loading:!1,client_detail:null,subject:"",content:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{async changeQuoteStatus(t){try{const s=await(await fetch("/wp-json/my-easy-compta/v1/quotes/update-status",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.quoteInfo.id,status:t})})).json();s.success?(this.quoteInfo.status=t,this.quoteInfo.total_amount=s.total_amount,this.showToast(s.message,"alert-success")):(console.error("Failed to update quote status:",s.message),this.showToast(s.message,"alert-error"))}catch(e){console.error("An error occurred while updating quote status:",e),this.showToast(e,"alert-error")}},convertToInvoice(t){fetch(`/wp-json/my-easy-compta/v1/quotes/convert-quote/${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e.success?(this.showToast(e.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:e.id}})):this.showToast(e.message,"alert-error")}).catch(e=>{console.error("Error converting quote:",e),this.showToast(e.message,"alert-error")})},handleAdvanceInvoiceConfirm(t){const{type:e,value:s,date:a}=t;this.convertAdvanceInvoice(this.selectedQuote,e,s,a)},convertAdvanceInvoice(t,e,s,a){fetch(`/wp-json/my-easy-compta/v1/quotes/convert-advance/${t}`,{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({advance_type:e,advance_value:s,advance_date:a})}).then(n=>n.json()).then(n=>{n.success?(this.showToast(n.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:n.id}})):this.showToast(n.message,"alert-error")}).catch(n=>{console.error("Error converting quote:",n),this.showToast(n.message,"alert-error")})},confirmConvertQuote(t){this.selectedQuote=t,modal_confirm.showModal(),this.showRemoveModal=!0},ConvertAdvanceQuote(t,e){this.selectedQuote=t,this.advanceSold=e,modal_advance.showModal(),this.showRemoveModal=!0},exportToPDF(){this.loadingPdf=!0;const t=this.quoteInfo.id;fetch(`/wp-json/my-easy-compta/v1/quotes/pdf/${t}`,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw this.loadingPdf=!1,new Error("Network response was not ok");return this.loadingPdf=!1,e.blob()}).then(e=>{const s=URL.createObjectURL(e);window.open(s),this.loadingPdf=!1}).catch(e=>{console.error("There was a problem with the fetch operation:",e),this.loadingPdf=!1})},sendQuote(t){this.loadingModal=!0,this.sendQuoteModal=!0,modal_send_quote.showModal(),this.fetchClient(t),this.fetchSettings()},fetchClient(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.loading=!1}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok){const e=await t.json();this.subject=e.email_quote_subject,this.content=e.email_quote_content,this.loading=!1}else{const e=await t.json();this.showToast(e.message,"alert-error"),this.loading=!1}}catch(t){this.loading=!1,this.showToast(t.message,"alert-error")}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Dl={key:0},Pl={key:1},Ml={key:3,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},jl=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),ql=[jl],Rl={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Ol=i("div",{class:"dropdown"},[i("div",{tabindex:"0",role:"button",class:"btn btn-ghost lg:hidden"},[i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h8m-8 6h16"})])]),i("ul",{tabindex:"0",class:"menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"},[i("li",null,[i("a",null,"Item 1")]),i("li",null,[i("a",null,"Parent"),i("ul",{class:"p-2"},[i("li",null,[i("a",null,"Submenu 1")]),i("li",null,[i("a",null,"Submenu 2")])])]),i("li",null,[i("a",null,"Item 3")])])],-1),Vl={class:"hidden lg:flex gap-2"},Nl={class:"btn btn-sm"},Bl=i("i",{class:"far fa-edit"},null,-1),Fl=i("i",{class:"fa fa-check"},null,-1),Wl=["data-tip"],Ql={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Xl=i("i",{class:"fas fa-check"},null,-1),Ul=i("i",{class:"fa fa-check"},null,-1),Ll=i("i",{class:"fa fa-times"},null,-1),zl={key:4},Hl={class:"dropdown"},Gl={tabindex:"0",role:"button",class:"btn btn-sm"},Yl=i("i",{class:"fas fa-exchange-alt"},null,-1),Jl={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},Kl={key:0},Zl={key:5},$l=i("i",{class:"fas fa-exchange-alt"},null,-1),er={class:"flex gap-2"},tr=i("i",{class:"fas fa-paper-plane"},null,-1),nr={key:0,class:"far fa-envelope"},sr=["data-tip"],or={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},ir=i("i",{class:"fas fa-paper-plane"},null,-1),ar=["data-tip"],lr={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},rr=i("i",{class:"fas fa-paper-plane"},null,-1),cr=["disabled"],dr=i("i",{class:"far fa-file-pdf"},null,-1),ur={key:0,class:"loading loading-spinner loading-sm"};function hr(t,e,s,a,n,o){const f=j("send-quote-modal"),m=j("confirm-modal"),p=j("advance-modal"),d=j("router-link");return r(),c("div",null,[s.emailActive==1?(r(),c("div",Dl,[D(f,{loading:n.loadingModal,"show-modal":n.sendQuoteModal,"modal-id":"modal_send_quote",client:n.client_detail,"quote-id":s.quoteInfo.id,subject:n.subject,content:n.content,onClose:e[0]||(e[0]=u=>n.sendQuoteModal=!1)},null,8,["loading","show-modal","client","quote-id","subject","content"])])):_("",!0),D(m,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[1]||(e[1]=u=>this.convertToInvoice(n.selectedQuote)),onCancel:e[2]||(e[2]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),s.advanceActive==1?(r(),c("div",Pl,[D(p,{"show-modal":t.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,"total-amount":s.quoteInfo.total_amount,currency:s.currency,quoteId:s.quoteInfo.id,"advance-sold":n.advanceSold,onConfirm:o.handleAdvanceInvoiceConfirm,onCancel:e[3]||(e[3]=u=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","total-amount","currency","quoteId","advance-sold","onConfirm"])])):_("",!0),n.toast.visible?(r(),c("div",{key:2,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),n.loading?(r(),c("div",Ml,ql)):_("",!0),i("div",Rl,[i("div",null,[Ol,i("div",Vl,[D(d,{to:{name:"QuoteEdit",params:{id:s.quoteInfo.id}}},{default:re(()=>[i("button",Nl,[Bl,w(l(o.translations.edit_quote),1)])]),_:1},8,["to"]),s.quoteInfo.status=="draft"&&!s.noItems?(r(),c("button",{key:0,class:"btn btn-outline btn-success btn-sm",onClick:e[4]||(e[4]=u=>o.changeQuoteStatus("pending"))},[Fl,w(" "+l(o.translations.validate_quote),1)])):_("",!0),s.quoteInfo.status=="draft"&&s.noItems?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",Ql,[Xl,w(" "+l(o.translations.validate_quote),1)])],8,Wl)):_("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="rejected")&&!s.noItems?(r(),c("button",{key:2,class:"btn btn-outline btn-success btn-sm",onClick:e[5]||(e[5]=u=>o.changeQuoteStatus("approved"))},[Ul,w(" "+l(o.translations.mark_as_accepted),1)])):_("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="approved")&&!s.noItems?(r(),c("button",{key:3,class:"btn btn-outline btn-error btn-sm",onClick:e[6]||(e[6]=u=>o.changeQuoteStatus("rejected"))},[Ll,w(" "+l(o.translations.mark_as_rejected),1)])):_("",!0),s.advanceActive==1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(r(),c("div",zl,[i("div",Hl,[i("div",Gl,[Yl,w(" "+l(o.translations.convertToInvoice),1)]),i("ul",Jl,[s.quoteInfo.advance!=1?(r(),c("li",Kl,[i("a",{href:"#",onClick:e[7]||(e[7]=K(u=>o.confirmConvertQuote(s.quoteInfo.id),["prevent"]))}," Facture global ")])):_("",!0),i("li",null,[i("a",{href:"#",onClick:e[8]||(e[8]=K(u=>o.ConvertAdvanceQuote(s.quoteInfo.id,"no_sold"),["prevent"]))}," Facture d'acompte "),s.quoteInfo.advance!=0?(r(),c("a",{key:0,href:"#",onClick:e[9]||(e[9]=K(u=>o.ConvertAdvanceQuote(s.quoteInfo.id,"sold"),["prevent"]))}," Facture du solde ")):_("",!0)])])])])):_("",!0),s.advanceActive!=1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(r(),c("div",Zl,[i("button",{onClick:e[10]||(e[10]=u=>o.confirmConvertQuote(s.quoteInfo.id)),class:"btn btn-sm"},[$l,w(" "+l(o.translations.convertToInvoice),1)])])):_("",!0)])]),i("div",er,[s.emailActive==1&&!s.noItems?(r(),c("button",{key:0,onClick:e[11]||(e[11]=K(u=>o.sendQuote(s.quoteInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[tr,w(" "+l(o.translations.send_quote)+" ",1),s.quoteInfo.sent==1?(r(),c("i",nr)):_("",!0)])):s.emailActive==0?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",or,[ir,w(" "+l(o.translations.send_quote),1)])],8,sr)):s.emailActive==1&&s.noItems?(r(),c("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",lr,[rr,w(" "+l(o.translations.send_quote),1)])],8,ar)):_("",!0),i("button",{onClick:e[12]||(e[12]=(...u)=>o.exportToPDF&&o.exportToPDF(...u)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[dr,w(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(r(),c("span",ur)):_("",!0)],8,cr)])])])}var mr=oe(Sl,[["render",hr]]);const fr={components:{VueEditor:It.exports.VueEditor},props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,item:Object},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{editedItem:{...this.item},loading:this.loading,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{item_name:{label:t.item_name},item_description:{label:t.description,type:"textarea"},quantity:{label:t.quantity,type:"number"},vat_rate:{label:"Taux de TVA",type:"number"},unit_price:{label:t.unit_price,type:"number"},discount:{label:t.discount,type:"number"}}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch(`/wp-json/my-easy-compta/v1/quotes/edit-item/${this.editedItem.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedItem)});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("itemEdited")}else{const e=`Error editing item: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error editing item";this.showToast(e,"alert-error"),console.error("Error editing item:",t),this.loadingBtn=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--}},watch:{item:{handler(t){this.editedItem={...t}},immediate:!0}}},pr=["id","open"],_r={class:"modal-box"},gr={class:"font-bold text-lg"},vr={key:0},yr={class:"grid grid-cols-1 gap-4"},br=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),wr=i("div",{class:"skeleton h-4 w-full"},null,-1),xr=[br,wr],Cr={class:"grid grid-cols-1 gap-4"},Ir=["type"],Er=["for"],kr=["id","onUpdate:modelValue"],Tr={key:1},Ar=["for"],Sr={class:"form-group mt-4 flex justify-end"},Dr=["disabled"],Pr={key:0,class:"loading loading-spinner loading-sm"};function Mr(t,e,s,a,n,o){const f=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",_r,[i("h3",gr,l(s.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=m=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",vr,[i("div",yr,[(r(!0),c(W,null,X(o.skeletonItems,m=>(r(),c("div",{key:m,class:"py-2"},xr))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[i("div",Cr,[(r(!0),c(W,null,X(n.fields,(m,p)=>(r(),c("div",{key:p,class:"ecwp-group form-group"},[m.type!=="textarea"?(r(),c("div",{key:0,type:m.type||"text"},[i("label",{for:p,class:"ecwp-label form-label"},l(m.label),9,Er),B(i("input",{id:p,"onUpdate:modelValue":d=>n.editedItem[p]=d,class:k(["ecwp-input input input-bordered",m.class||"w-full"])},null,10,kr),[[J,n.editedItem[p]]])],8,Ir)):(r(),c("div",Tr,[i("label",{for:p,class:"form-label"},l(m.label),9,Ar),D(f,{id:p,modelValue:n.editedItem[p],"onUpdate:modelValue":d=>n.editedItem[p]=d,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Sr,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",Pr)):_("",!0)],8,Dr)])],32))])],8,pr)])}var jr=oe(fr,[["render",Mr]]);/**!
    66 * Sortable 1.15.2
    77 * @author  RubaXa   <trash@rubaxa.org>
    88 * @author  owenm    <owen23355@gmail.com>
    99 * @license MIT
    10  */function Wn(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,a)}return s}function Te(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Wn(Object(s),!0).forEach(function(a){qr(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Wn(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function jt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jt=function(e){return typeof e}:jt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(t)}function qr(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function qe(){return qe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},qe.apply(this,arguments)}function Or(t,e){if(t==null)return{};var s={},a=Object.keys(t),n,o;for(o=0;o<a.length;o++)n=a[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Vr(t,e){if(t==null)return{};var s=Or(t,e),a,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)a=o[n],!(e.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,a)||(s[a]=t[a]))}return s}var Rr="1.15.2";function je(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var Oe=je(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ct=je(/Edge/i),Xn=je(/firefox/i),ft=je(/safari/i)&&!je(/chrome/i)&&!je(/android/i),gs=je(/iP(ad|od|hone)/i),vs=je(/chrome/i)&&je(/android/i),ys={capture:!1,passive:!1};function X(t,e,s){t.addEventListener(e,s,!Oe&&ys)}function N(t,e,s){t.removeEventListener(e,s,!Oe&&ys)}function Nt(t,e){if(!!e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Nr(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ie(t,e,s,a){if(t){s=s||document;do{if(e!=null&&(e[0]===">"?t.parentNode===s&&Nt(t,e):Nt(t,e))||a&&t===s)return t;if(t===s)break}while(t=Nr(t))}return null}var Un=/\s+/g;function fe(t,e,s){if(t&&e)if(t.classList)t.classList[s?"add":"remove"](e);else{var a=(" "+t.className+" ").replace(Un," ").replace(" "+e+" "," ");t.className=(a+(s?" "+e:"")).replace(Un," ")}}function S(t,e,s){var a=t&&t.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(s=t.currentStyle),e===void 0?s:s[e];!(e in a)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),a[e]=s+(typeof s=="string"?"":"px")}}function et(t,e){var s="";if(typeof t=="string")s=t;else do{var a=S(t,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!e&&(t=t.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(s)}function bs(t,e,s){if(t){var a=t.getElementsByTagName(e),n=0,o=a.length;if(s)for(;n<o;n++)s(a[n],n);return a}return[]}function ke(){var t=document.scrollingElement;return t||document.documentElement}function te(t,e,s,a,n){if(!(!t.getBoundingClientRect&&t!==window)){var o,m,h,f,d,u,p;if(t!==window&&t.parentNode&&t!==ke()?(o=t.getBoundingClientRect(),m=o.top,h=o.left,f=o.bottom,d=o.right,u=o.height,p=o.width):(m=0,h=0,f=window.innerHeight,d=window.innerWidth,u=window.innerHeight,p=window.innerWidth),(e||s)&&t!==window&&(n=n||t.parentNode,!Oe))do if(n&&n.getBoundingClientRect&&(S(n,"transform")!=="none"||s&&S(n,"position")!=="static")){var g=n.getBoundingClientRect();m-=g.top+parseInt(S(n,"border-top-width")),h-=g.left+parseInt(S(n,"border-left-width")),f=m+o.height,d=h+o.width;break}while(n=n.parentNode);if(a&&t!==window){var v=et(n||t),I=v&&v.a,C=v&&v.d;v&&(m/=C,h/=I,p/=I,u/=C,f=m+u,d=h+p)}return{top:m,left:h,bottom:f,right:d,width:p,height:u}}}function Qn(t,e,s){for(var a=Xe(t,!0),n=te(t)[e];a;){var o=te(a)[s],m=void 0;if(s==="top"||s==="left"?m=n>=o:m=n<=o,!m)return a;if(a===ke())break;a=Xe(a,!1)}return!1}function st(t,e,s,a){for(var n=0,o=0,m=t.children;o<m.length;){if(m[o].style.display!=="none"&&m[o]!==A.ghost&&(a||m[o]!==A.dragged)&&Ie(m[o],s.draggable,t,!1)){if(n===e)return m[o];n++}o++}return null}function wn(t,e){for(var s=t.lastElementChild;s&&(s===A.ghost||S(s,"display")==="none"||e&&!Nt(s,e));)s=s.previousElementSibling;return s||null}function ve(t,e){var s=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==A.clone&&(!e||Nt(t,e))&&s++;return s}function Ln(t){var e=0,s=0,a=ke();if(t)do{var n=et(t),o=n.a,m=n.d;e+=t.scrollLeft*o,s+=t.scrollTop*m}while(t!==a&&(t=t.parentNode));return[e,s]}function Br(t,e){for(var s in t)if(!!t.hasOwnProperty(s)){for(var a in e)if(e.hasOwnProperty(a)&&e[a]===t[s][a])return Number(s)}return-1}function Xe(t,e){if(!t||!t.getBoundingClientRect)return ke();var s=t,a=!1;do if(s.clientWidth<s.scrollWidth||s.clientHeight<s.scrollHeight){var n=S(s);if(s.clientWidth<s.scrollWidth&&(n.overflowX=="auto"||n.overflowX=="scroll")||s.clientHeight<s.scrollHeight&&(n.overflowY=="auto"||n.overflowY=="scroll")){if(!s.getBoundingClientRect||s===document.body)return ke();if(a||e)return s;a=!0}}while(s=s.parentNode);return ke()}function Fr(t,e){if(t&&e)for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function tn(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var pt;function ws(t,e){return function(){if(!pt){var s=arguments,a=this;s.length===1?t.call(a,s[0]):t.apply(a,s),pt=setTimeout(function(){pt=void 0},e)}}}function Wr(){clearTimeout(pt),pt=void 0}function xs(t,e,s){t.scrollLeft+=e,t.scrollTop+=s}function Is(t){var e=window.Polymer,s=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):s?s(t).clone(!0)[0]:t.cloneNode(!0)}function Es(t,e,s){var a={};return Array.from(t.children).forEach(function(n){var o,m,h,f;if(!(!Ie(n,e.draggable,t,!1)||n.animated||n===s)){var d=te(n);a.left=Math.min((o=a.left)!==null&&o!==void 0?o:1/0,d.left),a.top=Math.min((m=a.top)!==null&&m!==void 0?m:1/0,d.top),a.right=Math.max((h=a.right)!==null&&h!==void 0?h:-1/0,d.right),a.bottom=Math.max((f=a.bottom)!==null&&f!==void 0?f:-1/0,d.bottom)}}),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var _e="Sortable"+new Date().getTime();function Xr(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var a=[].slice.call(this.el.children);a.forEach(function(n){if(!(S(n,"display")==="none"||n===A.ghost)){t.push({target:n,rect:te(n)});var o=Te({},t[t.length-1].rect);if(n.thisAnimationDuration){var m=et(n,!0);m&&(o.top-=m.f,o.left-=m.e)}n.fromRect=o}})}},addAnimationState:function(a){t.push(a)},removeAnimationState:function(a){t.splice(Br(t,{target:a}),1)},animateAll:function(a){var n=this;if(!this.options.animation){clearTimeout(e),typeof a=="function"&&a();return}var o=!1,m=0;t.forEach(function(h){var f=0,d=h.target,u=d.fromRect,p=te(d),g=d.prevFromRect,v=d.prevToRect,I=h.rect,C=et(d,!0);C&&(p.top-=C.f,p.left-=C.e),d.toRect=p,d.thisAnimationDuration&&tn(g,p)&&!tn(u,p)&&(I.top-p.top)/(I.left-p.left)===(u.top-p.top)/(u.left-p.left)&&(f=Qr(I,g,v,n.options)),tn(p,u)||(d.prevFromRect=u,d.prevToRect=p,f||(f=n.options.animation),n.animate(d,I,p,f)),f&&(o=!0,m=Math.max(m,f),clearTimeout(d.animationResetTimer),d.animationResetTimer=setTimeout(function(){d.animationTime=0,d.prevFromRect=null,d.fromRect=null,d.prevToRect=null,d.thisAnimationDuration=null},f),d.thisAnimationDuration=f)}),clearTimeout(e),o?e=setTimeout(function(){typeof a=="function"&&a()},m):typeof a=="function"&&a(),t=[]},animate:function(a,n,o,m){if(m){S(a,"transition",""),S(a,"transform","");var h=et(this.el),f=h&&h.a,d=h&&h.d,u=(n.left-o.left)/(f||1),p=(n.top-o.top)/(d||1);a.animatingX=!!u,a.animatingY=!!p,S(a,"transform","translate3d("+u+"px,"+p+"px,0)"),this.forRepaintDummy=Ur(a),S(a,"transition","transform "+m+"ms"+(this.options.easing?" "+this.options.easing:"")),S(a,"transform","translate3d(0,0,0)"),typeof a.animated=="number"&&clearTimeout(a.animated),a.animated=setTimeout(function(){S(a,"transition",""),S(a,"transform",""),a.animated=!1,a.animatingX=!1,a.animatingY=!1},m)}}}}function Ur(t){return t.offsetWidth}function Qr(t,e,s,a){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-s.top,2)+Math.pow(e.left-s.left,2))*a.animation}var Ye=[],nn={initializeByDefault:!0},kt={mount:function(e){for(var s in nn)nn.hasOwnProperty(s)&&!(s in e)&&(e[s]=nn[s]);Ye.forEach(function(a){if(a.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Ye.push(e)},pluginEvent:function(e,s,a){var n=this;this.eventCanceled=!1,a.cancel=function(){n.eventCanceled=!0};var o=e+"Global";Ye.forEach(function(m){!s[m.pluginName]||(s[m.pluginName][o]&&s[m.pluginName][o](Te({sortable:s},a)),s.options[m.pluginName]&&s[m.pluginName][e]&&s[m.pluginName][e](Te({sortable:s},a)))})},initializePlugins:function(e,s,a,n){Ye.forEach(function(h){var f=h.pluginName;if(!(!e.options[f]&&!h.initializeByDefault)){var d=new h(e,s,e.options);d.sortable=e,d.options=e.options,e[f]=d,qe(a,d.defaults)}});for(var o in e.options)if(!!e.options.hasOwnProperty(o)){var m=this.modifyOption(e,o,e.options[o]);typeof m!="undefined"&&(e.options[o]=m)}},getEventProperties:function(e,s){var a={};return Ye.forEach(function(n){typeof n.eventProperties=="function"&&qe(a,n.eventProperties.call(s[n.pluginName],e))}),a},modifyOption:function(e,s,a){var n;return Ye.forEach(function(o){!e[o.pluginName]||o.optionListeners&&typeof o.optionListeners[s]=="function"&&(n=o.optionListeners[s].call(e[o.pluginName],a))}),n}};function Lr(t){var e=t.sortable,s=t.rootEl,a=t.name,n=t.targetEl,o=t.cloneEl,m=t.toEl,h=t.fromEl,f=t.oldIndex,d=t.newIndex,u=t.oldDraggableIndex,p=t.newDraggableIndex,g=t.originalEvent,v=t.putSortable,I=t.extraEventProperties;if(e=e||s&&s[_e],!!e){var C,V=e.options,F="on"+a.charAt(0).toUpperCase()+a.substr(1);window.CustomEvent&&!Oe&&!Ct?C=new CustomEvent(a,{bubbles:!0,cancelable:!0}):(C=document.createEvent("Event"),C.initEvent(a,!0,!0)),C.to=m||s,C.from=h||s,C.item=n||s,C.clone=o,C.oldIndex=f,C.newIndex=d,C.oldDraggableIndex=u,C.newDraggableIndex=p,C.originalEvent=g,C.pullMode=v?v.lastPutMode:void 0;var D=Te(Te({},I),kt.getEventProperties(a,e));for(var q in D)C[q]=D[q];s&&s.dispatchEvent(C),V[F]&&V[F].call(e,C)}}var zr=["evt"],me=function(e,s){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=a.evt,o=Vr(a,zr);kt.pluginEvent.bind(A)(e,s,Te({dragEl:b,parentEl:Y,ghostEl:M,rootEl:H,nextEl:He,lastDownEl:qt,cloneEl:G,cloneHidden:We,dragStarted:rt,putSortable:ae,activeSortable:A.active,originalEvent:n,oldIndex:$e,oldDraggableIndex:_t,newIndex:pe,newDraggableIndex:Fe,hideGhostForTarget:As,unhideGhostForTarget:Ss,cloneNowHidden:function(){We=!0},cloneNowShown:function(){We=!1},dispatchSortableEvent:function(h){ue({sortable:s,name:h,originalEvent:n})}},o))};function ue(t){Lr(Te({putSortable:ae,cloneEl:G,targetEl:b,rootEl:H,oldIndex:$e,oldDraggableIndex:_t,newIndex:pe,newDraggableIndex:Fe},t))}var b,Y,M,H,He,qt,G,We,$e,pe,_t,Fe,St,ae,Ze=!1,Bt=!1,Ft=[],Le,xe,sn,on,zn,Hn,rt,Je,gt,vt=!1,Dt=!1,Ot,le,an=[],fn=!1,Wt=[],Gt=typeof document!="undefined",Pt=gs,Gn=Ct||Oe?"cssFloat":"float",Hr=Gt&&!vs&&!gs&&"draggable"in document.createElement("div"),Cs=function(){if(!!Gt){if(Oe)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),ks=function(e,s){var a=S(e),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=st(e,0,s),m=st(e,1,s),h=o&&S(o),f=m&&S(m),d=h&&parseInt(h.marginLeft)+parseInt(h.marginRight)+te(o).width,u=f&&parseInt(f.marginLeft)+parseInt(f.marginRight)+te(m).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&h.float&&h.float!=="none"){var p=h.float==="left"?"left":"right";return m&&(f.clear==="both"||f.clear===p)?"vertical":"horizontal"}return o&&(h.display==="block"||h.display==="flex"||h.display==="table"||h.display==="grid"||d>=n&&a[Gn]==="none"||m&&a[Gn]==="none"&&d+u>n)?"vertical":"horizontal"},Gr=function(e,s,a){var n=a?e.left:e.top,o=a?e.right:e.bottom,m=a?e.width:e.height,h=a?s.left:s.top,f=a?s.right:s.bottom,d=a?s.width:s.height;return n===h||o===f||n+m/2===h+d/2},Yr=function(e,s){var a;return Ft.some(function(n){var o=n[_e].options.emptyInsertThreshold;if(!(!o||wn(n))){var m=te(n),h=e>=m.left-o&&e<=m.right+o,f=s>=m.top-o&&s<=m.bottom+o;if(h&&f)return a=n}}),a},Ts=function(e){function s(o,m){return function(h,f,d,u){var p=h.options.group.name&&f.options.group.name&&h.options.group.name===f.options.group.name;if(o==null&&(m||p))return!0;if(o==null||o===!1)return!1;if(m&&o==="clone")return o;if(typeof o=="function")return s(o(h,f,d,u),m)(h,f,d,u);var g=(m?h:f).options.group.name;return o===!0||typeof o=="string"&&o===g||o.join&&o.indexOf(g)>-1}}var a={},n=e.group;(!n||jt(n)!="object")&&(n={name:n}),a.name=n.name,a.checkPull=s(n.pull,!0),a.checkPut=s(n.put),a.revertClone=n.revertClone,e.group=a},As=function(){!Cs&&M&&S(M,"display","none")},Ss=function(){!Cs&&M&&S(M,"display","")};Gt&&!vs&&document.addEventListener("click",function(t){if(Bt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Bt=!1,!1},!0);var ze=function(e){if(b){e=e.touches?e.touches[0]:e;var s=Yr(e.clientX,e.clientY);if(s){var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=e[n]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[_e]._onDragOver(a)}}},Jr=function(e){b&&b.parentNode[_e]._isOutsideThisEl(e.target)};function A(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=qe({},e),t[_e]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ks(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(m,h){m.setData("Text",h.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:A.supportPointer!==!1&&"PointerEvent"in window&&!ft,emptyInsertThreshold:5};kt.initializePlugins(this,t,s);for(var a in s)!(a in e)&&(e[a]=s[a]);Ts(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:Hr,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?X(t,"pointerdown",this._onTapStart):(X(t,"mousedown",this._onTapStart),X(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(X(t,"dragover",this),X(t,"dragenter",this)),Ft.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),qe(this,Xr())}A.prototype={constructor:A,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Je=null)},_getDirection:function(e,s){return typeof this.options.direction=="function"?this.options.direction.call(this,e,s,b):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var s=this,a=this.el,n=this.options,o=n.preventOnFilter,m=e.type,h=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,f=(h||e).target,d=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||f,u=n.filter;if(oc(a),!b&&!(/mousedown|pointerdown/.test(m)&&e.button!==0||n.disabled)&&!d.isContentEditable&&!(!this.nativeDraggable&&ft&&f&&f.tagName.toUpperCase()==="SELECT")&&(f=Ie(f,n.draggable,a,!1),!(f&&f.animated)&&qt!==f)){if($e=ve(f),_t=ve(f,n.draggable),typeof u=="function"){if(u.call(this,e,f,this)){ue({sortable:s,rootEl:d,name:"filter",targetEl:f,toEl:a,fromEl:a}),me("filter",s,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(u&&(u=u.split(",").some(function(p){if(p=Ie(d,p.trim(),a,!1),p)return ue({sortable:s,rootEl:p,name:"filter",targetEl:f,fromEl:a,toEl:a}),me("filter",s,{evt:e}),!0}),u)){o&&e.cancelable&&e.preventDefault();return}n.handle&&!Ie(d,n.handle,a,!1)||this._prepareDragStart(e,h,f)}}},_prepareDragStart:function(e,s,a){var n=this,o=n.el,m=n.options,h=o.ownerDocument,f;if(a&&!b&&a.parentNode===o){var d=te(a);if(H=o,b=a,Y=b.parentNode,He=b.nextSibling,qt=a,St=m.group,A.dragged=b,Le={target:b,clientX:(s||e).clientX,clientY:(s||e).clientY},zn=Le.clientX-d.left,Hn=Le.clientY-d.top,this._lastX=(s||e).clientX,this._lastY=(s||e).clientY,b.style["will-change"]="all",f=function(){if(me("delayEnded",n,{evt:e}),A.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!Xn&&n.nativeDraggable&&(b.draggable=!0),n._triggerDragStart(e,s),ue({sortable:n,name:"choose",originalEvent:e}),fe(b,m.chosenClass,!0)},m.ignore.split(",").forEach(function(u){bs(b,u.trim(),ln)}),X(h,"dragover",ze),X(h,"mousemove",ze),X(h,"touchmove",ze),X(h,"mouseup",n._onDrop),X(h,"touchend",n._onDrop),X(h,"touchcancel",n._onDrop),Xn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,b.draggable=!0),me("delayStart",this,{evt:e}),m.delay&&(!m.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(Ct||Oe))){if(A.eventCanceled){this._onDrop();return}X(h,"mouseup",n._disableDelayedDrag),X(h,"touchend",n._disableDelayedDrag),X(h,"touchcancel",n._disableDelayedDrag),X(h,"mousemove",n._delayedDragTouchMoveHandler),X(h,"touchmove",n._delayedDragTouchMoveHandler),m.supportPointer&&X(h,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(f,m.delay)}else f()}},_delayedDragTouchMoveHandler:function(e){var s=e.touches?e.touches[0]:e;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){b&&ln(b),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;N(e,"mouseup",this._disableDelayedDrag),N(e,"touchend",this._disableDelayedDrag),N(e,"touchcancel",this._disableDelayedDrag),N(e,"mousemove",this._delayedDragTouchMoveHandler),N(e,"touchmove",this._delayedDragTouchMoveHandler),N(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,s){s=s||e.pointerType=="touch"&&e,!this.nativeDraggable||s?this.options.supportPointer?X(document,"pointermove",this._onTouchMove):s?X(document,"touchmove",this._onTouchMove):X(document,"mousemove",this._onTouchMove):(X(b,"dragend",this),X(H,"dragstart",this._onDragStart));try{document.selection?Vt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,s){if(Ze=!1,H&&b){me("dragStarted",this,{evt:s}),this.nativeDraggable&&X(document,"dragover",Jr);var a=this.options;!e&&fe(b,a.dragClass,!1),fe(b,a.ghostClass,!0),A.active=this,e&&this._appendGhost(),ue({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(xe){this._lastX=xe.clientX,this._lastY=xe.clientY,As();for(var e=document.elementFromPoint(xe.clientX,xe.clientY),s=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(xe.clientX,xe.clientY),e!==s);)s=e;if(b.parentNode[_e]._isOutsideThisEl(e),s)do{if(s[_e]){var a=void 0;if(a=s[_e]._onDragOver({clientX:xe.clientX,clientY:xe.clientY,target:e,rootEl:s}),a&&!this.options.dragoverBubble)break}e=s}while(s=s.parentNode);Ss()}},_onTouchMove:function(e){if(Le){var s=this.options,a=s.fallbackTolerance,n=s.fallbackOffset,o=e.touches?e.touches[0]:e,m=M&&et(M,!0),h=M&&m&&m.a,f=M&&m&&m.d,d=Pt&&le&&Ln(le),u=(o.clientX-Le.clientX+n.x)/(h||1)+(d?d[0]-an[0]:0)/(h||1),p=(o.clientY-Le.clientY+n.y)/(f||1)+(d?d[1]-an[1]:0)/(f||1);if(!A.active&&!Ze){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<a)return;this._onDragStart(e,!0)}if(M){m?(m.e+=u-(sn||0),m.f+=p-(on||0)):m={a:1,b:0,c:0,d:1,e:u,f:p};var g="matrix(".concat(m.a,",").concat(m.b,",").concat(m.c,",").concat(m.d,",").concat(m.e,",").concat(m.f,")");S(M,"webkitTransform",g),S(M,"mozTransform",g),S(M,"msTransform",g),S(M,"transform",g),sn=u,on=p,xe=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!M){var e=this.options.fallbackOnBody?document.body:H,s=te(b,!0,Pt,!0,e),a=this.options;if(Pt){for(le=e;S(le,"position")==="static"&&S(le,"transform")==="none"&&le!==document;)le=le.parentNode;le!==document.body&&le!==document.documentElement?(le===document&&(le=ke()),s.top+=le.scrollTop,s.left+=le.scrollLeft):le=ke(),an=Ln(le)}M=b.cloneNode(!0),fe(M,a.ghostClass,!1),fe(M,a.fallbackClass,!0),fe(M,a.dragClass,!0),S(M,"transition",""),S(M,"transform",""),S(M,"box-sizing","border-box"),S(M,"margin",0),S(M,"top",s.top),S(M,"left",s.left),S(M,"width",s.width),S(M,"height",s.height),S(M,"opacity","0.8"),S(M,"position",Pt?"absolute":"fixed"),S(M,"zIndex","100000"),S(M,"pointerEvents","none"),A.ghost=M,e.appendChild(M),S(M,"transform-origin",zn/parseInt(M.style.width)*100+"% "+Hn/parseInt(M.style.height)*100+"%")}},_onDragStart:function(e,s){var a=this,n=e.dataTransfer,o=a.options;if(me("dragStart",this,{evt:e}),A.eventCanceled){this._onDrop();return}me("setupClone",this),A.eventCanceled||(G=Is(b),G.removeAttribute("id"),G.draggable=!1,G.style["will-change"]="",this._hideClone(),fe(G,this.options.chosenClass,!1),A.clone=G),a.cloneId=Vt(function(){me("clone",a),!A.eventCanceled&&(a.options.removeCloneOnHide||H.insertBefore(G,b),a._hideClone(),ue({sortable:a,name:"clone"}))}),!s&&fe(b,o.dragClass,!0),s?(Bt=!0,a._loopId=setInterval(a._emulateDragOver,50)):(N(document,"mouseup",a._onDrop),N(document,"touchend",a._onDrop),N(document,"touchcancel",a._onDrop),n&&(n.effectAllowed="move",o.setData&&o.setData.call(a,n,b)),X(document,"drop",a),S(b,"transform","translateZ(0)")),Ze=!0,a._dragStartId=Vt(a._dragStarted.bind(a,s,e)),X(document,"selectstart",a),rt=!0,ft&&S(document.body,"user-select","none")},_onDragOver:function(e){var s=this.el,a=e.target,n,o,m,h=this.options,f=h.group,d=A.active,u=St===f,p=h.sort,g=ae||d,v,I=this,C=!1;if(fn)return;function V(Pe,Yt){me(Pe,I,Te({evt:e,isOwner:u,axis:v?"vertical":"horizontal",revert:m,dragRect:n,targetRect:o,canSort:p,fromSortable:g,target:a,completed:D,onMove:function(ot,it){return Mt(H,s,b,n,ot,te(ot),e,it)},changed:q},Yt))}function F(){V("dragOverAnimationCapture"),I.captureAnimationState(),I!==g&&g.captureAnimationState()}function D(Pe){return V("dragOverCompleted",{insertion:Pe}),Pe&&(u?d._hideClone():d._showClone(I),I!==g&&(fe(b,ae?ae.options.ghostClass:d.options.ghostClass,!1),fe(b,h.ghostClass,!0)),ae!==I&&I!==A.active?ae=I:I===A.active&&ae&&(ae=null),g===I&&(I._ignoreWhileAnimating=a),I.animateAll(function(){V("dragOverAnimationComplete"),I._ignoreWhileAnimating=null}),I!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(a===b&&!b.animated||a===s&&!a.animated)&&(Je=null),!h.dragoverBubble&&!e.rootEl&&a!==document&&(b.parentNode[_e]._isOutsideThisEl(e.target),!Pe&&ze(e)),!h.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),C=!0}function q(){pe=ve(b),Fe=ve(b,h.draggable),ue({sortable:I,name:"change",toEl:s,newIndex:pe,newDraggableIndex:Fe,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),a=Ie(a,h.draggable,s,!0),V("dragOver"),A.eventCanceled)return C;if(b.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||I._ignoreWhileAnimating===a)return D(!1);if(Bt=!1,d&&!h.disabled&&(u?p||(m=Y!==H):ae===this||(this.lastPutMode=St.checkPull(this,d,b,e))&&f.checkPut(this,d,b,e))){if(v=this._getDirection(e,a)==="vertical",n=te(b),V("dragOverValid"),A.eventCanceled)return C;if(m)return Y=H,F(),this._hideClone(),V("revert"),A.eventCanceled||(He?H.insertBefore(b,He):H.appendChild(b)),D(!0);var z=wn(s,h.draggable);if(!z||ec(e,v,this)&&!z.animated){if(z===b)return D(!1);if(z&&s===e.target&&(a=z),a&&(o=te(a)),Mt(H,s,b,n,a,o,e,!!a)!==!1)return F(),z&&z.nextSibling?s.insertBefore(b,z.nextSibling):s.appendChild(b),Y=s,q(),D(!0)}else if(z&&$r(e,v,this)){var ce=st(s,0,h,!0);if(ce===b)return D(!1);if(a=ce,o=te(a),Mt(H,s,b,n,a,o,e,!1)!==!1)return F(),s.insertBefore(b,ce),Y=s,q(),D(!0)}else if(a.parentNode===s){o=te(a);var ne=0,Z,Qe=b.parentNode!==s,ie=!Gr(b.animated&&b.toRect||n,a.animated&&a.toRect||o,v),Ve=v?"top":"left",be=Qn(a,"top","top")||Qn(b,"top","top"),Re=be?be.scrollTop:void 0;Je!==a&&(Z=o[Ve],vt=!1,Dt=!ie&&h.invertSwap||Qe),ne=tc(e,a,o,v,ie?1:h.swapThreshold,h.invertedSwapThreshold==null?h.swapThreshold:h.invertedSwapThreshold,Dt,Je===a);var de;if(ne!==0){var Ae=ve(b);do Ae-=ne,de=Y.children[Ae];while(de&&(S(de,"display")==="none"||de===M))}if(ne===0||de===a)return D(!1);Je=a,gt=ne;var Se=a.nextElementSibling,we=!1;we=ne===1;var De=Mt(H,s,b,n,a,o,e,we);if(De!==!1)return(De===1||De===-1)&&(we=De===1),fn=!0,setTimeout(Zr,30),F(),we&&!Se?s.appendChild(b):a.parentNode.insertBefore(b,we?Se:a),be&&xs(be,0,Re-be.scrollTop),Y=b.parentNode,Z!==void 0&&!Dt&&(Ot=Math.abs(Z-te(a)[Ve])),q(),D(!0)}if(s.contains(b))return D(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){N(document,"mousemove",this._onTouchMove),N(document,"touchmove",this._onTouchMove),N(document,"pointermove",this._onTouchMove),N(document,"dragover",ze),N(document,"mousemove",ze),N(document,"touchmove",ze)},_offUpEvents:function(){var e=this.el.ownerDocument;N(e,"mouseup",this._onDrop),N(e,"touchend",this._onDrop),N(e,"pointerup",this._onDrop),N(e,"touchcancel",this._onDrop),N(document,"selectstart",this)},_onDrop:function(e){var s=this.el,a=this.options;if(pe=ve(b),Fe=ve(b,a.draggable),me("drop",this,{evt:e}),Y=b&&b.parentNode,pe=ve(b),Fe=ve(b,a.draggable),A.eventCanceled){this._nulling();return}Ze=!1,Dt=!1,vt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),pn(this.cloneId),pn(this._dragStartId),this.nativeDraggable&&(N(document,"drop",this),N(s,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ft&&S(document.body,"user-select",""),S(b,"transform",""),e&&(rt&&(e.cancelable&&e.preventDefault(),!a.dropBubble&&e.stopPropagation()),M&&M.parentNode&&M.parentNode.removeChild(M),(H===Y||ae&&ae.lastPutMode!=="clone")&&G&&G.parentNode&&G.parentNode.removeChild(G),b&&(this.nativeDraggable&&N(b,"dragend",this),ln(b),b.style["will-change"]="",rt&&!Ze&&fe(b,ae?ae.options.ghostClass:this.options.ghostClass,!1),fe(b,this.options.chosenClass,!1),ue({sortable:this,name:"unchoose",toEl:Y,newIndex:null,newDraggableIndex:null,originalEvent:e}),H!==Y?(pe>=0&&(ue({rootEl:Y,name:"add",toEl:Y,fromEl:H,originalEvent:e}),ue({sortable:this,name:"remove",toEl:Y,originalEvent:e}),ue({rootEl:Y,name:"sort",toEl:Y,fromEl:H,originalEvent:e}),ue({sortable:this,name:"sort",toEl:Y,originalEvent:e})),ae&&ae.save()):pe!==$e&&pe>=0&&(ue({sortable:this,name:"update",toEl:Y,originalEvent:e}),ue({sortable:this,name:"sort",toEl:Y,originalEvent:e})),A.active&&((pe==null||pe===-1)&&(pe=$e,Fe=_t),ue({sortable:this,name:"end",toEl:Y,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){me("nulling",this),H=b=Y=M=He=G=qt=We=Le=xe=rt=pe=Fe=$e=_t=Je=gt=ae=St=A.dragged=A.ghost=A.clone=A.active=null,Wt.forEach(function(e){e.checked=!0}),Wt.length=sn=on=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":b&&(this._onDragOver(e),Kr(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],s,a=this.el.children,n=0,o=a.length,m=this.options;n<o;n++)s=a[n],Ie(s,m.draggable,this.el,!1)&&e.push(s.getAttribute(m.dataIdAttr)||sc(s));return e},sort:function(e,s){var a={},n=this.el;this.toArray().forEach(function(o,m){var h=n.children[m];Ie(h,this.options.draggable,n,!1)&&(a[o]=h)},this),s&&this.captureAnimationState(),e.forEach(function(o){a[o]&&(n.removeChild(a[o]),n.appendChild(a[o]))}),s&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,s){return Ie(e,s||this.options.draggable,this.el,!1)},option:function(e,s){var a=this.options;if(s===void 0)return a[e];var n=kt.modifyOption(this,e,s);typeof n!="undefined"?a[e]=n:a[e]=s,e==="group"&&Ts(a)},destroy:function(){me("destroy",this);var e=this.el;e[_e]=null,N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart),N(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(s){s.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ft.splice(Ft.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!We){if(me("hideClone",this),A.eventCanceled)return;S(G,"display","none"),this.options.removeCloneOnHide&&G.parentNode&&G.parentNode.removeChild(G),We=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(We){if(me("showClone",this),A.eventCanceled)return;b.parentNode==H&&!this.options.group.revertClone?H.insertBefore(G,b):He?H.insertBefore(G,He):H.appendChild(G),this.options.group.revertClone&&this.animate(b,G),S(G,"display",""),We=!1}}};function Kr(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function Mt(t,e,s,a,n,o,m,h){var f,d=t[_e],u=d.options.onMove,p;return window.CustomEvent&&!Oe&&!Ct?f=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(f=document.createEvent("Event"),f.initEvent("move",!0,!0)),f.to=e,f.from=t,f.dragged=s,f.draggedRect=a,f.related=n||e,f.relatedRect=o||te(e),f.willInsertAfter=h,f.originalEvent=m,t.dispatchEvent(f),u&&(p=u.call(d,f,m)),p}function ln(t){t.draggable=!1}function Zr(){fn=!1}function $r(t,e,s){var a=te(st(s.el,0,s.options,!0)),n=Es(s.el,s.options,M),o=10;return e?t.clientX<n.left-o||t.clientY<a.top&&t.clientX<a.right:t.clientY<n.top-o||t.clientY<a.bottom&&t.clientX<a.left}function ec(t,e,s){var a=te(wn(s.el,s.options.draggable)),n=Es(s.el,s.options,M),o=10;return e?t.clientX>n.right+o||t.clientY>a.bottom&&t.clientX>a.left:t.clientY>n.bottom+o||t.clientX>a.right&&t.clientY>a.top}function tc(t,e,s,a,n,o,m,h){var f=a?t.clientY:t.clientX,d=a?s.height:s.width,u=a?s.top:s.left,p=a?s.bottom:s.right,g=!1;if(!m){if(h&&Ot<d*n){if(!vt&&(gt===1?f>u+d*o/2:f<p-d*o/2)&&(vt=!0),vt)g=!0;else if(gt===1?f<u+Ot:f>p-Ot)return-gt}else if(f>u+d*(1-n)/2&&f<p-d*(1-n)/2)return nc(e)}return g=g||m,g&&(f<u+d*o/2||f>p-d*o/2)?f>u+d/2?1:-1:0}function nc(t){return ve(b)<ve(t)?1:-1}function sc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,s=e.length,a=0;s--;)a+=e.charCodeAt(s);return a.toString(36)}function oc(t){Wt.length=0;for(var e=t.getElementsByTagName("input"),s=e.length;s--;){var a=e[s];a.checked&&Wt.push(a)}}function Vt(t){return setTimeout(t,0)}function pn(t){return clearTimeout(t)}Gt&&X(document,"touchmove",function(t){(A.active||Ze)&&t.cancelable&&t.preventDefault()});A.utils={on:X,off:N,css:S,find:bs,is:function(e,s){return!!Ie(e,s,e,!1)},extend:Fr,throttle:ws,closest:Ie,toggleClass:fe,clone:Is,index:ve,nextTick:Vt,cancelNextTick:pn,detectDirection:ks,getChild:st};A.get=function(t){return t[_e]};A.mount=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e[0].constructor===Array&&(e=e[0]),e.forEach(function(a){if(!a.prototype||!a.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(a));a.utils&&(A.utils=Te(Te({},A.utils),a.utils)),kt.mount(a)})};A.create=function(t,e){return new A(t,e)};A.version=Rr;var ee=[],ct,_n,gn=!1,rn,cn,Xt,dt;function ic(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(s){var a=s.originalEvent;this.sortable.nativeDraggable?X(document,"dragover",this._handleAutoScroll):this.options.supportPointer?X(document,"pointermove",this._handleFallbackAutoScroll):a.touches?X(document,"touchmove",this._handleFallbackAutoScroll):X(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(s){var a=s.originalEvent;!this.options.dragOverBubble&&!a.rootEl&&this._handleAutoScroll(a)},drop:function(){this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):(N(document,"pointermove",this._handleFallbackAutoScroll),N(document,"touchmove",this._handleFallbackAutoScroll),N(document,"mousemove",this._handleFallbackAutoScroll)),Yn(),Rt(),Wr()},nulling:function(){Xt=_n=ct=gn=dt=rn=cn=null,ee.length=0},_handleFallbackAutoScroll:function(s){this._handleAutoScroll(s,!0)},_handleAutoScroll:function(s,a){var n=this,o=(s.touches?s.touches[0]:s).clientX,m=(s.touches?s.touches[0]:s).clientY,h=document.elementFromPoint(o,m);if(Xt=s,a||this.options.forceAutoScrollFallback||Ct||Oe||ft){dn(s,this.options,h,a);var f=Xe(h,!0);gn&&(!dt||o!==rn||m!==cn)&&(dt&&Yn(),dt=setInterval(function(){var d=Xe(document.elementFromPoint(o,m),!0);d!==f&&(f=d,Rt()),dn(s,n.options,d,a)},10),rn=o,cn=m)}else{if(!this.options.bubbleScroll||Xe(h,!0)===ke()){Rt();return}dn(s,this.options,Xe(h,!1),!1)}}},qe(t,{pluginName:"scroll",initializeByDefault:!0})}function Rt(){ee.forEach(function(t){clearInterval(t.pid)}),ee=[]}function Yn(){clearInterval(dt)}var dn=ws(function(t,e,s,a){if(!!e.scroll){var n=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,m=e.scrollSensitivity,h=e.scrollSpeed,f=ke(),d=!1,u;_n!==s&&(_n=s,Rt(),ct=e.scroll,u=e.scrollFn,ct===!0&&(ct=Xe(s,!0)));var p=0,g=ct;do{var v=g,I=te(v),C=I.top,V=I.bottom,F=I.left,D=I.right,q=I.width,z=I.height,ce=void 0,ne=void 0,Z=v.scrollWidth,Qe=v.scrollHeight,ie=S(v),Ve=v.scrollLeft,be=v.scrollTop;v===f?(ce=q<Z&&(ie.overflowX==="auto"||ie.overflowX==="scroll"||ie.overflowX==="visible"),ne=z<Qe&&(ie.overflowY==="auto"||ie.overflowY==="scroll"||ie.overflowY==="visible")):(ce=q<Z&&(ie.overflowX==="auto"||ie.overflowX==="scroll"),ne=z<Qe&&(ie.overflowY==="auto"||ie.overflowY==="scroll"));var Re=ce&&(Math.abs(D-n)<=m&&Ve+q<Z)-(Math.abs(F-n)<=m&&!!Ve),de=ne&&(Math.abs(V-o)<=m&&be+z<Qe)-(Math.abs(C-o)<=m&&!!be);if(!ee[p])for(var Ae=0;Ae<=p;Ae++)ee[Ae]||(ee[Ae]={});(ee[p].vx!=Re||ee[p].vy!=de||ee[p].el!==v)&&(ee[p].el=v,ee[p].vx=Re,ee[p].vy=de,clearInterval(ee[p].pid),(Re!=0||de!=0)&&(d=!0,ee[p].pid=setInterval(function(){a&&this.layer===0&&A.active._onTouchMove(Xt);var Se=ee[this.layer].vy?ee[this.layer].vy*h:0,we=ee[this.layer].vx?ee[this.layer].vx*h:0;typeof u=="function"&&u.call(A.dragged.parentNode[_e],we,Se,t,Xt,ee[this.layer].el)!=="continue"||xs(ee[this.layer].el,we,Se)}.bind({layer:p}),24))),p++}while(e.bubbleScroll&&g!==f&&(g=Xe(g,!1)));gn=d}},30),Ds=function(e){var s=e.originalEvent,a=e.putSortable,n=e.dragEl,o=e.activeSortable,m=e.dispatchSortableEvent,h=e.hideGhostForTarget,f=e.unhideGhostForTarget;if(!!s){var d=a||o;h();var u=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,p=document.elementFromPoint(u.clientX,u.clientY);f(),d&&!d.el.contains(p)&&(m("spill"),this.onSpill({dragEl:n,putSortable:a}))}};function xn(){}xn.prototype={startIndex:null,dragStart:function(e){var s=e.oldDraggableIndex;this.startIndex=s},onSpill:function(e){var s=e.dragEl,a=e.putSortable;this.sortable.captureAnimationState(),a&&a.captureAnimationState();var n=st(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(s,n):this.sortable.el.appendChild(s),this.sortable.animateAll(),a&&a.animateAll()},drop:Ds};qe(xn,{pluginName:"revertOnSpill"});function In(){}In.prototype={onSpill:function(e){var s=e.dragEl,a=e.putSortable,n=a||this.sortable;n.captureAnimationState(),s.parentNode&&s.parentNode.removeChild(s),n.animateAll()},drop:Ds};qe(In,{pluginName:"removeOnSpill"});A.mount(new ic);A.mount(In,xn);const ac={name:"QuoteViewDetail",components:{Card:Ue,QuoteNavBar:mr,EditItemModal:jr,RemoveModal:xt},data(){return{selectedItem:null,selectedInvoiceId:null,editItemsModal:!1,no_items:!0,loading:!0,loading_add:!1,quote:[],quoteItems:[],newItem:{loading_del:!1,item_ref:"",item_name:"",item_category:"Type",item_description:"",quantity:1,vat_rate:0,unit_price:0,discount:0,total_price:0,total_amount:0},vatRate:0,settings:[],list_vats:[],client_detail:[],client_email:null,client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},articles:[],categories:[],showDropdown:!1,refs:[],showDropdownRef:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},isQuoteExpired(){const t=new Date().getTime(),e=this.quote.due_date?new Date(this.quote.due_date).getTime():null;return e&&e<t},totalAmountWithoutDiscount(){const t=this.quoteItems.reduce((e,s)=>{const a=s.quantity*s.unit_price;return e+a},0);return this.formatCurrency(t)},totalAmount(){const t=this.quoteItems.reduce((e,s)=>e+parseFloat(s.total_price),0);return this.formatCurrency(t)},totalAmountDefaultCurrency(){return(this.quoteItems.reduce((a,n)=>a+parseFloat(n.total_amount),0)*this.quote.exchange_rate).toFixed(2)},totalAmountWithVAT(){const t=parseFloat(this.totalAmount);if(this.settings.vat_active==1){const e=parseFloat(this.calculateVAT());return this.formatCurrency(t+e)}else return this.formatCurrency(t)},signatureImageUrl(){const t="/wp-json/my-easy-compta/v1/signature-image/",e=myEasyComptaAdmin.nonce;return`${t}${this.quote.file_sign}?_wpnonce=${e}`}},methods:{getUniqueVATRates(){const t=new Set;return this.quoteItems.forEach(e=>{e.vat_rate&&t.add(e.vat_rate)}),Array.from(t)},calculateVATForRate(t){let e=0;return this.quoteItems.forEach(s=>{if(s.vat_rate===t){const a=s.quantity*s.unit_price,n=a*s.discount/100;e+=(a-n)*t/100}}),this.formatCurrency(e)},calculateTotalAmountWithVAT(){let t=this.quoteItems.reduce((e,s)=>e+parseFloat(s.total_amount),0);return this.formatCurrency(t)},fetchQuote(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t?(this.quote=t,this.fetchClientInfo(t.client_id)):console.error("Quote not found")}).catch(t=>{console.error("Error fetching quote:",t),this.loading=!1})},fetchClientInfo(t){fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.client_email=e.email;const s=e.currency_id;s&&this.fetchCurrencyDetails(s)}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},fetchItems(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}/items`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t.code=="no_items_found"?(console.error("No items found"),this.quoteItems=[],this.loading=!1,this.no_items=!0):(this.quoteItems=t,this.loading=!1,this.no_items=!1)}).catch(t=>{console.error("Error fetching items:",t),this.loading=!1})},fetchCurrencyDetails(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/settings/currency/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Currency details not found");return this.loading=!1,e.json()}).then(e=>{this.client_currency=e.symbol,this.loading=!1}).catch(e=>{this.loading=!1,console.error("Error fetching currency details:",e)})},updateTotal(){const t=this.newItem.quantity*this.newItem.unit_price,e=t*this.newItem.discount/100,s=t-e;var a=0;if(this.settings.vat_active==1){const n=s*this.newItem.vat_rate/100;a=s+n}else a=s;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(a)},calculateTotalWithVat(t,e,s,a){const n=t*e,o=n*a/100,m=n-o,h=m*s/100,f=m+h;return this.formatCurrency(f)},calculateTotal(t,e,s){const a=t*e,n=a*s/100,m=a-n;return this.formatCurrency(m)},submitItems(){this.updateTotal();const t={...this.newItem,quote_id:this.$route.params.id};this.loading_add=!0,fetch("/wp-json/my-easy-compta/v1/quotes/element-add",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(t)}).then(e=>e.json()).then(e=>{e.success?(this.loading_add=!1,this.fetchItems(),this.newItem={item_name:"",item_ref:"",item_category:"",item_description:"",quantity:1,vat_rate:this.default_vat.rate,unit_price:0,discount:0,total_price:0,total_amount:0}):(this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e.message),this.loading_add=!1)}).catch(e=>{this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e),this.loading_add=!1})},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--},confirmremoveItem(t,e){this.selectedItem=t,this.selectedInvoiceId=e,modal_remove.showModal(),this.showRemoveModal=!0},removeItem(t,e){const s=this.quoteItems.find(a=>a.id===t);s.loading_del=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/element-delete/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({quote_id:e})}).then(a=>a.json()).then(a=>{a.success?(s.loading_del=!1,this.fetchItems()):(this.showToast(a.message,"alert-error"),console.error("Error removing item:",a.message),s.loading_del=!1)}).catch(a=>{this.showToast(a.message,"alert-error"),console.error("Error removing item:",a),s.loading_del=!1})},editItem(t){this.loadingModal=!0,this.editItemsModal=!0,modal_edit_item.showModal(),this.fetchItemDetails(t)},fetchItemDetails(t){fetch(`/wp-json/my-easy-compta/v1/quotes/item-details/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedItem=e,this.loading=!1}).catch(e=>{console.error("Error fetching item details:",e),this.loading=!1})},formatCurrency(t){const e=t.toFixed(2),s=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${e}${s}`},calculateDiscountAmountWithVAT(t,e,s,a){const o=t*e*a/100,m=o*s/100,h=o+m;return this.formatCurrency(h)},calculateDiscountAmount(t,e,s){const o=t*e*s/100;return this.formatCurrency(o)},calculateVAT(){const t=parseFloat(this.totalAmount),e=parseFloat(this.default_vat.rate),s=t*(e/100);return this.formatCurrency(s)},onDragEnd(t){const e=this.quoteItems[t.oldIndex];this.quoteItems.splice(t.oldIndex,1),this.quoteItems.splice(t.newIndex,0,e);const s=this.quoteItems.map(a=>a.id);this.saveOrderToDatabase(s)},nl2br(t){return t?t.replace(/\n/g,"<br>"):""},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},saveOrderToDatabase(t){fetch("/wp-json/my-easy-compta/v1/quotes/update-quote-items-order",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({order:t})}).then(e=>{e.ok?console.log("Order saved successfully."):console.error("Failed to save order:",e.statusText)}).catch(e=>{console.error("Error saving order:",e)})},fetchCategoriesArticles(){fetch("/wp-json/my-easy-compta/v1/categories-articles",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.categories=t}).catch(t=>console.error("Error fetching categories:",t))},fetchArticles(){if(this.newItem.item_name.length<1){this.articles=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_name}&method=name`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.articles=t}).catch(t=>console.error("Error fetching articles:",t))},selectItem(t){this.newItem.item_ref=t.ref,this.newItem.item_name=t.name,this.newItem.item_description=t.description,this.newItem.unit_price=t.unit_price,this.showDropdown=!1,this.showDropdownRef=!1},fetchRefs(){if(this.newItem.item_ref.length<1){this.refs=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_ref}&method=ref`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.refs=t}).catch(t=>console.error("Error fetching refrences:",t))},async loadSettings(){try{this.loading=!0,this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s,listVatData:a}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.list_vats=a,this.newItem.vat_rate=this.default_vat.rate,this.loadingPrice=!1,this.loading=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1,this.loading=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},highlightMatch(t){if(!this.newItem.item_name)return t;const e=new RegExp(`(${this.escapeRegExp(this.newItem.item_name)})`,"gi");return t.replace(e,"<b>$1</b>")},escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},handleClickOutside(t){this.$el.contains(t.target)||(this.showDropdown=!1,this.showDropdownRef=!1)}},beforeDestroy(){document.removeEventListener("click",this.handleClickOutside)},mounted(){this.fetchQuote(),this.fetchItems(),this.loadSettings(),this.fetchCategoriesArticles(),document.addEventListener("click",this.handleClickOutside);const t=document.querySelector("tbody");A.create(t,{animation:150,handle:".drag-handle",onEnd:this.onDragEnd})}},lc={class:"pt-2 pr-4"},rc={key:1,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},cc=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),dc=[cc],uc={key:2},hc={role:"alert",class:"alert alert-warning"},mc=i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),fc={key:0,class:"relative"},pc={class:"ecwp-watermark"},_c={class:"grid grid-cols-2"},gc={class:"md:col-span-1"},vc=["src"],yc={class:"md:col-span-1 text-right"},bc={class:"text-lg font-semibold"},wc={key:0,class:"badge badge-warning text-white"},xc={key:1,class:"badge badge-secondary text-white"},Ic={key:2,class:"badge badge-success text-white"},Ec={key:3,class:"badge badge-error text-white"},Cc={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},kc=i("br",null,null,-1),Tc=i("br",null,null,-1),Ac=i("br",null,null,-1),Sc=["href"],Dc=i("br",null,null,-1),Pc=i("br",null,null,-1),Mc=i("br",null,null,-1),jc=["href"],qc=i("br",null,null,-1),Oc=["href"],Vc={class:"table mt-8"},Rc=i("th",null,null,-1),Nc={width:"5%"},Bc={width:"19%"},Fc={width:"21%"},Wc={width:"10%",class:"text-center"},Xc={width:"8%",class:"text-center"},Uc={key:0,width:"5%",class:"text-center"},Qc={key:1,width:"5%"},Lc={width:"10%",class:"text-center"},zc={width:"10%",class:"text-right"},Hc=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),Gc=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),Yc={key:0,class:"badge badge-ghost badge-xs"},Jc=["innerHTML"],Kc={class:"text-center"},Zc={class:"text-center"},$c={key:0},ed={key:1},td={key:0,class:"text-center"},nd={key:1},sd={key:2,class:"text-center"},od=i("br",null,null,-1),id={key:3,class:"text-center"},ad=i("br",null,null,-1),ld={class:"text-right"},rd={key:0},cd={key:1},dd=["data-tip"],ud=["onClick"],hd=i("i",{class:"far fa-edit"},null,-1),md=[hd],fd=["data-tip"],pd=["onClick"],_d={key:0,class:"far fa-trash-alt"},gd={key:1,class:"loading loading-spinner loading-xs"},vd={key:0},yd=i("td",{class:"px-2"},null,-1),bd={class:"align-top px-2"},wd={class:"flex items-center border rounded-md relative"},xd=["placeholder"],Id={key:0,class:"autocomplete-dropdown bg-base-300"},Ed=["onClick","innerHTML"],Cd={class:"align-top px-2"},kd=i("option",{disabled:"",selected:""},"Type",-1),Td=["value"],Ad={class:"flex items-center border rounded-md relative"},Sd=["placeholder"],Dd={key:0,class:"autocomplete-dropdown bg-base-300"},Pd=["onClick","innerHTML"],Md={class:"align-top"},jd={class:"flex items-center rounded-md"},qd=["placeholder"],Od={class:"align-top"},Vd={class:"flex items-center border rounded-lg"},Rd={class:"inline-flex"},Nd=["placeholder"],Bd={class:"align-top"},Fd={class:"flex items-center border rounded-md"},Wd=["placeholder"],Xd={key:0,class:"align-top"},Ud=["value"],Qd={key:1,class:"align-top"},Ld={class:"align-top"},zd={class:"flex items-center border rounded-md"},Hd=["placeholder"],Gd=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),Yd={key:2,class:"text-right"},Jd={key:3,class:"text-right"},Kd=["data-tip"],Zd={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},$d={key:0,class:"fa fa-plus"},eu={key:1,class:"loading loading-spinner loading-xs"},tu={colspan:"8",class:"text-right no-border"},nu={class:"text-right"},su={key:0,class:"line-through"},ou=i("td",null,null,-1),iu={colspan:"8",class:"text-right no-border"},au={class:"text-right"},lu=i("td",null,null,-1),ru={colspan:"8",class:"text-right no-border font-bold text-xl"},cu={class:"text-right no-border font-bold text-xl"},du=i("td",null,null,-1),uu={key:2},hu={colspan:"8",class:"text-right no-border"},mu={class:"text-right no-border"},fu={key:3},pu={colspan:"8",class:"text-right no-border"},_u={class:"text-right no-border font-bold text-xl"},gu={key:1,class:"relative"},vu={class:"flex justify-end mt-4"},yu={class:"border-2 border-slate-300 max-w-md"},bu=["src"];function wu(t,e,s,a,n,o){const m=j("QuoteNavBar"),h=j("remove-modal"),f=j("edit-item-modal"),d=j("Card");return r(),c("div",lc,[P(m,{quoteInfo:n.quote,emailActive:n.settings.easy_compta_email_addon_active,advanceActive:n.settings.easy_compta_advance_addon_active,currency:n.default_currency_symbol,noItems:n.no_items},null,8,["quoteInfo","emailActive","advanceActive","currency","noItems"]),n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(h,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=u=>this.removeItem(n.selectedItem,n.selectedInvoiceId)),onCancel:e[1]||(e[1]=u=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(r(),c("div",rc,dc)):_("",!0),o.isQuoteExpired&&n.quote.status=="pending"?(r(),c("div",uc,[i("div",hc,[mc,i("span",null,l(o.translations.quote_expired),1)])])):_("",!0),P(d,{topMargin:"mt-8",id:"quote-content"},{default:re(()=>[n.settings.easy_compta_signature_addon_active&&n.quote.signed==1?(r(),c("div",fc,[i("span",pc,l(o.translations.signed),1)])):_("",!0),i("div",_c,[i("div",gc,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,vc)])]),i("div",yc,[i("p",bc,l(n.quote.quote_number),1),i("div",null,[w(l(o.translations.created_at)+": ",1),i("strong",null,l(n.quote.created_at),1)]),i("div",null,[w(l(o.translations.due_date)+": ",1),i("strong",null,l(n.quote.due_date),1)]),i("div",null,[w(l(o.translations.provisional_date)+": ",1),i("strong",null,l(n.quote.provisional_start_date),1)]),i("div",null,[w(l(o.translations.status)+": ",1),n.quote.status=="draft"?(r(),c("span",wc,l(o.translations.draft),1)):_("",!0),n.quote.status=="pending"?(r(),c("span",xc,l(o.translations.pending),1)):_("",!0),n.quote.status=="approved"?(r(),c("span",Ic,l(o.translations.approved),1)):_("",!0),n.quote.status=="rejected"?(r(),c("span",Ec,l(o.translations.rejected),1)):_("",!0)])])]),i("div",Cc,[i("div",null,[i("strong",null,l(o.translations.bill_to)+":",1),i("h4",null,[i("strong",null,l(n.client_detail.company_name),1)]),i("p",null,[w(l(n.client_detail.address),1),kc,w(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),Tc,w(" "+l(n.client_detail.country),1),Ac,n.client_detail.phone?(r(),c("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Sc)):_("",!0)])]),i("div",null,[i("strong",null,l(o.translations.received_from)+":",1),i("h4",null,[i("strong",null,l(n.settings.company_name),1)]),i("p",null,[w(l(n.settings.company_address),1),Dc,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Pc,w(" "+l(n.settings.country),1),Mc,n.settings.company_phone?(r(),c("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,jc)):_("",!0),qc,n.settings.mobile_phone?(r(),c("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Oc)):_("",!0)])])]),P(f,{loading:t.loadingModal,"show-modal":n.editItemsModal,"modal-id":"modal_edit_item","modal-title":o.translations.edit_item,item:n.selectedItem,onClose:e[2]||(e[2]=u=>n.editItemsModal=!1),onItemEdited:o.fetchItems},null,8,["loading","show-modal","modal-title","item","onItemEdited"]),i("form",{onSubmit:e[22]||(e[22]=K((...u)=>o.submitItems&&o.submitItems(...u),["prevent"]))},[i("table",Vc,[i("thead",null,[i("tr",null,[Rc,i("th",Nc,l(o.translations.item_ref),1),i("th",Bc,l(o.translations.item_name),1),i("th",Fc,l(o.translations.description),1),i("th",Wc,l(o.translations.quantity),1),i("th",Xc,l(o.translations.unit_price),1),n.settings.vat_active==1?(r(),c("th",Uc,l(o.translations.vat),1)):(r(),c("th",Qc)),i("th",Lc,l(o.translations.discount),1),i("th",zc,l(o.translations.total),1),Hc])]),i("tbody",null,[(r(!0),c(W,null,U(n.quoteItems,(u,p)=>(r(),c("tr",{key:u.id||p},[Gc,i("td",null,l(u.item_ref),1),i("td",null,[u.category_name?(r(),c("div",Yc,l(u.category_name),1)):_("",!0),i("div",null,l(u.item_name),1)]),i("td",{innerHTML:o.nl2br(u.item_description)},null,8,Jc),i("td",Kc,l(u.quantity),1),i("td",Zc,[w(l(u.unit_price),1),n.default_currency_symbol==n.client_currency?(r(),c("span",$c,l(n.default_currency_symbol),1)):(r(),c("span",ed,l(n.client_currency),1))]),n.settings.vat_active==1?(r(),c("td",td,l(u.vat_rate)+"% ",1)):(r(),c("td",nd)),n.settings.vat_active==1?(r(),c("td",sd,[w(l(u.discount)+"% ",1),od,w(" "+l(o.calculateDiscountAmountWithVAT(u.quantity,u.unit_price,u.vat_rate,u.discount)),1)])):(r(),c("td",id,[w(l(u.discount)+"% ",1),ad,w(" "+l(o.calculateDiscountAmount(u.quantity,u.unit_price,u.discount)),1)])),i("td",ld,[w(l(u.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(r(),c("span",rd,l(n.default_currency_symbol),1)):(r(),c("span",cd,l(n.client_currency),1))]),i("td",null,[n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:K(g=>o.editItem(u.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},md,8,ud)],8,dd)):_("",!0),n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:K(g=>o.confirmremoveItem(u.id,n.quote.id),["prevent"]),class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 mx-2 rounded"},[u.loading_del?_("",!0):(r(),c("i",_d)),u.loading_del?(r(),c("span",gd)):_("",!0)],8,pd)],8,fd)):_("",!0)])]))),128)),n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("tr",vd,[yd,i("td",bd,[i("div",wd,[B(i("input",{type:"text","onUpdate:modelValue":e[3]||(e[3]=u=>n.newItem.item_ref=u),onInput:e[4]||(e[4]=(...u)=>o.fetchRefs&&o.fetchRefs(...u)),onFocus:e[5]||(e[5]=u=>n.showDropdownRef=!0),placeholder:o.translations.item_ref,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,xd),[[J,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(r(),c("ul",Id,[(r(!0),c(W,null,U(n.refs,u=>(r(),c("li",{key:u.ref,onClick:p=>o.selectItem(u),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(u.ref)},null,8,Ed))),128))])):_("",!0)])]),i("td",Cd,[B(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[6]||(e[6]=u=>n.newItem.item_category=u)},[kd,(r(!0),c(W,null,U(n.categories,u=>(r(),c("option",{key:u.id,value:u.id},l(u.name),9,Td))),128))],512),[[ye,n.newItem.item_category]]),i("div",Ad,[B(i("input",{type:"text","onUpdate:modelValue":e[7]||(e[7]=u=>n.newItem.item_name=u),onInput:e[8]||(e[8]=(...u)=>o.fetchArticles&&o.fetchArticles(...u)),onFocus:e[9]||(e[9]=u=>n.showDropdown=!0),placeholder:o.translations.item_name,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,Sd),[[J,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(r(),c("ul",Dd,[(r(!0),c(W,null,U(n.articles,u=>(r(),c("li",{key:u.name,onClick:p=>o.selectItem(u),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(u.name)},null,8,Pd))),128))])):_("",!0)])]),i("td",Md,[i("div",jd,[B(i("textarea",{"onUpdate:modelValue":e[10]||(e[10]=u=>n.newItem.item_description=u),placeholder:o.translations.item_description,class:"textarea textarea-bordered input-xs w-full",onInput:e[11]||(e[11]=u=>o.resize()),ref:"textarea"},null,40,qd),[[J,n.newItem.item_description]])])]),i("td",Od,[i("div",Vd,[i("div",Rd,[i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-l",onClick:e[12]||(e[12]=(...u)=>o.decrease&&o.decrease(...u))}," - "),B(i("input",{type:"number",min:"1","onUpdate:modelValue":e[13]||(e[13]=u=>n.newItem.quantity=u),placeholder:o.translations.quantity,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[14]||(e[14]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Nd),[[J,n.newItem.quantity]]),i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-r",onClick:e[15]||(e[15]=(...u)=>o.increase&&o.increase(...u))}," + ")])])]),i("td",Bd,[i("div",Fd,[B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[16]||(e[16]=u=>n.newItem.unit_price=u),placeholder:o.translations.unit_price,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[17]||(e[17]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Wd),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(r(),c("td",Xd,[B(i("select",{"onUpdate:modelValue":e[18]||(e[18]=u=>n.newItem.vat_rate=u),onChange:e[19]||(e[19]=(...u)=>o.updateTotal&&o.updateTotal(...u)),class:"select select-md w-full mb-1 ecwp-select min-w-20"},[(r(!0),c(W,null,U(n.list_vats,u=>(r(),c("option",{key:u,value:u.rate},l(u.rate)+"% ",9,Ud))),128))],544),[[ye,n.newItem.vat_rate]])])):(r(),c("td",Qd)),i("td",Ld,[i("div",zd,[B(i("input",{type:"number",min:"0",max:"100","onUpdate:modelValue":e[20]||(e[20]=u=>n.newItem.discount=u),placeholder:o.translations.discount,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[21]||(e[21]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Hd),[[J,n.newItem.discount]]),Gd])]),n.settings.vat_active==1?(r(),c("td",Yd,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(r(),c("td",Jd,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.discount)),1)),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",Zd,[n.loading_add?_("",!0):(r(),c("i",$d)),n.loading_add?(r(),c("span",eu)):_("",!0)])],8,Kd)])])):_("",!0),i("tr",null,[i("td",tu,[i("strong",null,l(o.translations.subtotal),1)]),i("td",nu,[o.totalAmount!==o.totalAmountWithoutDiscount?(r(),c("span",su,l(o.totalAmountWithoutDiscount),1)):_("",!0),w(" "+l(o.totalAmount),1)]),ou]),n.settings.vat_active==1?(r(!0),c(W,{key:1},U(o.getUniqueVATRates(),(u,p)=>(r(),c("tr",{key:p},[i("td",iu,[i("strong",null,l(o.translations.tax)+" ("+l(u)+"%) ",1)]),i("td",au,l(o.calculateVATForRate(u)),1),lu]))),128)):_("",!0),i("tr",null,[i("td",ru,[i("strong",null,l(o.translations.total),1)]),i("td",cu,l(o.calculateTotalAmountWithVAT()),1),du]),n.client_currency!=n.default_currency_symbol?(r(),c("tr",uu,[i("td",hu,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",mu,l(n.quote.exchange_rate),1)])):_("",!0),n.client_currency!=n.default_currency_symbol?(r(),c("tr",fu,[i("td",pu,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",_u,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):_("",!0)])])],32),n.settings.easy_compta_signature_addon_active&&n.quote.signed==1&&n.quote.file_sign?(r(),c("div",gu,[i("div",vu,[i("span",yu,[i("img",{src:o.signatureImageUrl,alt:"Signature"},null,8,bu)])])])):_("",!0)]),_:1})])}var xu=oe(ac,[["render",wu]]);const Iu={name:"QuoteNew",components:{Card:Ue,ModelSelect:Lt,VueDatePicker:It},data(){return{clientOptions:[],clients:[],quote:{number:"",due_date:"",provisional_start_date:"",client_id:"",status:""},showError:!1,loading:!1,loadingBtn:!1,settings:[],last_quote_number:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}}},mounted(){this.fetchClients(),this.fetchSettings()},methods:{cancelAction(){this.$router.push("/quotes")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`}))}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},customLabel(t){return t.text},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e;const s=`${this.settings.quote_prefix}_${String(this.settings.last_quote_id).padStart(4,"0")}`;this.quote.number=s}else{const e=await t.json()}}catch{this.loading=!1}},submitQuote(){if(!this.quote.due_date||!this.quote.provisional_start_date||!this.quote.client_id||!this.quote.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch("/wp-json/my-easy-compta/v1/quotes",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.quote)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"QuoteViewDetail",params:{id:t.id}})):(this.loadingBtn=!1,console.error("Error submitting quote:",t.message),this.showToast(t.message,"alert-error"))}).catch(t=>{this.loadingBtn=!1,console.error("Error submitting quote:",t),this.showToast(t,"alert-error")})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Eu={class:"pt-2 pr-4"},Cu={class:"flex justify-between items-center mb-4"},ku={class:"card-title"},Tu=i("div",{class:"divider mt-2"},null,-1),Au={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Su={class:"grid grid-cols-3 gap-4"},Du={class:"ecwp-group form-group mb-4"},Pu={for:"quoteNumber",class:"ecwp-label"},Mu={class:"ecwp-group form-group mb-4"},ju={for:"quoteDate",class:"ecwp-label"},qu={class:"ecwp-group form-group mb-4"},Ou={for:"quoteDatePr",class:"ecwp-label"},Vu={class:"grid grid-cols-2 gap-4"},Ru={class:"ecwp-group form-group mb-4"},Nu={for:"client",class:"ecwp-label"},Bu={class:"ecwp-group form-group mb-4"},Fu={for:"status",class:"ecwp-label"},Wu={value:"draft",selected:""},Xu={value:"pending"},Uu={value:"approved"},Qu={value:"rejected"},Lu={class:"flex justify-between"},zu=["disabled"],Hu={key:0,class:"loading loading-spinner loading-sm"};function Gu(t,e,s,a,n,o){const m=j("VueDatePicker"),h=j("model-select"),f=j("Card");return r(),c("div",Eu,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(f,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",Cu,[i("h2",ku,l(o.translations.new_quote),1)]),Tu,n.loading?(r(),c("div",Au)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitQuote&&o.submitQuote(...d),["prevent"]))},[i("div",Su,[i("div",Du,[i("label",Pu,l(o.translations.quote_number),1),B(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.quote.number=d),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.quote.number]])]),i("div",Mu,[i("label",ju,l(o.translations.due_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.due_date&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.quote.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.quote.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",qu,[i("label",Ou,l(o.translations.provisional_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.provisional_start_date&&n.showError?"input-error":""]]),id:"quoteDatePr",modelValue:n.quote.provisional_start_date,"onUpdate:modelValue":e[2]||(e[2]=d=>n.quote.provisional_start_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])])]),i("div",Vu,[i("div",Ru,[i("label",Nu,l(o.translations.company_name),1),P(h,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=d=>n.quote.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.quote.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Bu,[i("label",Fu,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=d=>n.quote.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.quote.status&&n.showError?"input-error":""]])},[i("option",Wu,l(o.translations.draft),1),i("option",Xu,l(o.translations.pending),1),i("option",Uu,l(o.translations.approved),1),i("option",Qu,l(o.translations.rejected),1)],2),[[ye,n.quote.status]])])]),i("div",Lu,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.submit)+" ",1),n.loadingBtn?(r(),c("span",Hu)):_("",!0)],8,zu)])],32)]),_:1})])}var Yu=oe(Iu,[["render",Gu]]);const Ju={name:"InvoicesList",components:{Card:Ue,RemoveModal:xt},data(){return{invoices:[],showInvoiceDetailsModal:!1,editInvoiceModal:!1,selectedInvoice:null,currentPage:1,totalCount:0,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",settings:{},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchInvoices(),this.loadSettings()},methods:{fetchInvoices(t=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/invoices?page=${t}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.invoices=s.invoices,this.totalCount=s.total_count,this.totalPages=s.total_pages,this.currentPage=t,this.perPage=e,this.generatePaginationButtons()}).catch(s=>{console.error("Error fetching invoices:",s)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},calculateVAT(t){return $n(t,this.default_vat.rate)},calculateWithoutVAT(t){return es(t)},generatePaginationButtons(){this.paginationButtons=ts(this.currentPage,this.totalPages)},goToPage(t){t!=="..."&&this.fetchInvoices(t)},perPageChanged(){this.fetchInvoices()},formatAmount(t,e){return ns(t,e,this.settings.currency_position)},showToast(t,e){ss(this.toast,t,e)},confirmDeleteInvoice(t){this.selectedInvoice=t,modal_remove.showModal(),this.showRemoveModal=!0},deleteInvoice(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/delete/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchInvoices(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting invoice:",e.statusText))}).catch(e=>{console.log(e.message);const s=e&&e.message?e.message:"Error deleting client";s==="This client cannot be deleted because it has associated data."?this.showToast(s,"alert-error"):console.error("Error deleting client:",e)})}},computed:{skeletonItems(){return Array.from({length:5},(t,e)=>e)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Ku={class:"pt-2 pr-4"},Zu={class:"flex justify-between items-center"},$u={class:"card-title"},eh={class:"btn btn-primary rounded-full"},th=i("i",{class:"fas fa-plus-circle"},null,-1),nh={key:0,class:"ms-2"},sh={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab3"},oh=i("i",{class:"fas fa-file-export"},null,-1),ih=["data-tip"],ah={class:"btn btn-outline btn-accent rounded-full",disabled:""},lh=i("i",{class:"fas fa-file-export"},null,-1),rh=i("div",{class:"divider mt-2"},null,-1),ch={class:"flex items-center mb-4"},dh={for:"perPageSelect",class:"mr-2"},uh=["value"],hh={class:"overflow-x-auto"},mh={key:0,class:"table w-full"},fh={class:"flex justify-center"},ph={key:0,class:"badge badge-primary badge-outline badge-sm mr-2"},_h={key:0,class:"badge badge-scondary badge-outline badge-sm"},gh={key:1,class:"badge badge-warning badge-outline badge-sm"},vh={key:2,class:"badge badge-success badge-outline badge-sm"},yh={key:3,class:"badge badge-error badge-outline badge-sm ms-2"},bh={key:0},wh={key:0},xh={key:0},Ih={key:1},Eh={key:0},Ch={key:1},kh={key:1},Th=i("span",{class:"loading loading-bars loading-sm"},null,-1),Ah=[Th],Sh={key:0},Dh={key:1},Ph=i("span",{class:"loading loading-bars loading-sm"},null,-1),Mh=[Ph],jh={key:0},qh={key:1},Oh=i("span",{class:"loading loading-bars loading-sm"},null,-1),Vh=[Oh],Rh={class:"flex justify-end"},Nh=["data-tip"],Bh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"far fa-eye"})],-1),Fh=["data-tip"],Wh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"fas fa-pencil-alt"})],-1),Xh=["data-tip"],Uh=["onClick"],Qh=i("i",{class:"far fa-trash-alt"},null,-1),Lh=[Qh],zh={key:1},Hh=i("div",{class:"flex gap-4 items-center"},[i("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),i("div",{class:"flex flex-col gap-4 w-full"},[i("div",{class:"skeleton h-4 w-full"}),i("div",{class:"skeleton h-4 w-full"})])],-1),Gh=i("div",{class:"divider my-1"},null,-1),Yh=[Hh,Gh],Jh={class:"join ecwp_pagination mt-6 pt-4"},Kh=["onClick"];function Zh(t,e,s,a,n,o){const m=j("remove-modal"),h=j("router-link"),f=j("Card");return r(),c("div",Ku,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(m,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=d=>this.deleteInvoice(n.selectedInvoice)),onCancel:e[1]||(e[1]=d=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),P(f,{topMargin:"mt-8"},{default:re(()=>[i("div",Zu,[i("h2",$u,l(o.translations.invoices),1),i("div",null,[P(h,{to:{name:"InvoiceNew"}},{default:re(()=>[i("button",eh,[w(l(o.translations.add)+" ",1),th])]),_:1}),n.settings.easy_compta_export_addon_active==1?(r(),c("span",nh,[i("a",sh,[w(l(o.translations.export)+" ",1),oh])])):(r(),c("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",ah,[w(l(o.translations.export)+" ",1),lh])],8,ih))])]),rh,i("div",ch,[i("label",dh,l(o.translations.display_per_page),1),B(i("select",{id:"perPageSelect","onUpdate:modelValue":e[2]||(e[2]=d=>n.perPage=d),onChange:e[3]||(e[3]=(...d)=>o.perPageChanged&&o.perPageChanged(...d))},[(r(!0),c(W,null,U(n.perPageOptions,d=>(r(),c("option",{key:d,value:d},l(d),9,uh))),128))],544),[[ye,n.perPage]])]),i("div",hh,[n.loading?(r(),c("div",zh,[(r(!0),c(W,null,U(n.skeletonRows,d=>(r(),c("div",{key:d,class:"flex flex-col gap-4 w-full"},Yh))),128))])):(r(),c("table",mh,[i("thead",null,[i("tr",null,[i("th",null,l(o.translations.invoice_number),1),i("th",null,l(o.translations.client),1),i("th",null,l(o.translations.status),1),i("th",null,l(o.translations.total),1),i("th",null,l(o.translations.due_date),1),i("th",null,l(o.translations.created_at),1),i("th",fh,l(o.translations.actions),1)])]),i("tbody",null,[(r(!0),c(W,null,U(n.invoices,d=>(r(),c("tr",{key:d.id},[i("td",null,[d.advance==1?(r(),c("span",ph,l(o.translations.advance),1)):_("",!0),w(l(d.invoice_number),1)]),i("td",null,l(d.client_name),1),i("td",null,[d.status=="draft"?(r(),c("span",_h,l(o.translations.draft),1)):_("",!0),d.status=="unpaid"?(r(),c("span",gh,l(o.translations.unpaid),1)):_("",!0),d.status=="paid"?(r(),c("span",vh,l(o.translations.paid),1)):_("",!0),d.credit=="1"?(r(),c("span",yh,l(o.translations.credit),1)):_("",!0)]),i("td",null,[n.loadingPrice?(r(),c("div",kh,Ah)):(r(),c("div",bh,[n.settings.easy_compta_advance_addon_active&&d.advance==1?(r(),c("div",wh,l(o.formatAmount(d.advance_amount,d.client_currency||n.default_currency_symbol)),1)):_("",!0),n.settings.vat_active==1?(r(),c("div",{key:1,class:k({"text-xs":d.advance==1})},[n.default_currency_symbol==d.client_currency||d.client_currency==null?(r(),c("span",xh,l(o.formatAmount(d.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Ih,l(o.formatAmount(d.total_amount,d.client_currency)),1))],2)):(r(),c("div",{key:2,class:k({"text-xs":d.advance==1})},[n.default_currency_symbol==d.client_currency||d.client_currency==null?(r(),c("span",Eh,l(o.formatAmount(d.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Ch,l(o.formatAmount(d.total_amount,d.client_currency)),1))],2))]))]),i("td",null,[n.loadingPrice?(r(),c("div",Dh,Mh)):(r(),c("div",Sh,l(d.due_date),1))]),i("td",null,[n.loadingPrice?(r(),c("div",qh,Vh)):(r(),c("div",jh,l(d.created),1))]),i("td",Rh,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[P(h,{to:{name:"InvoiceViewDetail",params:{id:d.id}}},{default:re(()=>[Bh]),_:2},1032,["to"])],8,Nh),d.status=="draft"?(r(),c("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[P(h,{to:{name:"InvoiceEdit",params:{id:d.id}}},{default:re(()=>[Wh]),_:2},1032,["to"])],8,Fh)):_("",!0),d.status=="draft"?(r(),c("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:u=>o.confirmDeleteInvoice(d.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Lh,8,Uh)],8,Xh)):_("",!0)])]))),128))])]))]),i("div",Jh,[(r(!0),c(W,null,U(n.paginationButtons,d=>(r(),c("button",{key:d,class:k(["join-item btn",{"btn-disabled":d==="..."||d===n.currentPage}]),onClick:u=>o.goToPage(d)},l(d),11,Kh))),128))])]),_:1})])}var $h=oe(Ju,[["render",Zh]]);const em={name:"sendInvoice",components:{VueEditor:Et.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,invoiceId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"invoice",id:this.invoiceId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},tm=["id","open"],nm={class:"modal-box"},sm={class:"font-bold text-lg"},om={key:0},im={class:"grid grid-cols-1 gap-4"},am=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),lm=i("div",{class:"skeleton h-4 w-full"},null,-1),rm=[am,lm],cm={class:"grid grid-cols-1 gap-4"},dm=["type"],um=["for"],hm=["id","value","disabled","onInput"],mm={key:1},fm=["for"],pm={class:"form-group mt-4 flex justify-end"},_m=["disabled"],gm={key:0,class:"loading loading-spinner loading-sm"};function vm(t,e,s,a,n,o){const m=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",nm,[i("h3",sm,l(o.translations.send_invoice),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=h=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",om,[i("div",im,[(r(!0),c(W,null,U(o.skeletonItems,h=>(r(),c("div",{key:h,class:"py-2"},rm))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",cm,[(r(!0),c(W,null,U(n.fields,(h,f)=>(r(),c("div",{key:f,class:"ecwp-group form-group"},[h.type!=="textarea"?(r(),c("div",{key:0,type:h.type||"text"},[i("label",{for:f,class:"ecwp-label form-label"},l(h.label),9,um),i("input",{id:f,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:d=>o.updateFieldValue(f,d.target.value)},null,42,hm)],8,dm)):(r(),c("div",mm,[i("label",{for:f,class:"form-label"},l(h.label),9,fm),P(m,{modelValue:h.value,"onUpdate:modelValue":d=>h.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",pm,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",gm)):_("",!0)],8,_m)])],32))])],8,tm)])}var ym=oe(em,[["render",vm]]);const bm={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:"",paymentMethods:[],hasPaymentMethodError:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchPaymentMethods()},methods:{async fetchPaymentMethods(){try{const t=await fetch("/wp-json/my-easy-compta/v1/payments/methods",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!t.ok)throw new Error(`Erreur : ${t.status}`);const e=await t.json();this.paymentMethods=e}catch(t){console.error("Erreur lors de la r\xE9cup\xE9ration des m\xE9thodes de paiement :",t)}},onConfirm(){if(!this.selectedPaymentMethod){this.hasPaymentMethodError=!0;return}this.hasPaymentMethodError=!1,this.$emit("confirm",this.selectedPaymentMethod),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm_paid").close()}}},wm=["open"],xm={class:"modal-box"},Im={class:"font-bold text-lg"},Em=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),Cm={class:"text-lg font-semibold text-center"},km={class:"my-4 text-center text-xl"},Tm={key:0,class:"mt-4 mb-4"},Am={class:"ecwp-group form-group"},Sm={for:"payment_method",class:"ecwp-label form-label"},Dm={value:""},Pm=["value"],Mm={class:"flex justify-between space-x-4"};function jm(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm_paid",class:"modal",open:t.showModal},[i("div",xm,[i("h3",Im,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),Em,i("h2",Cm,l(s.title),1),i("p",km,l(s.message),1),s.status==="paid"?(r(),c("div",Tm,[i("div",Am,[i("label",Sm,l(o.translations.payment_method),1),B(i("select",{id:"payment_method","onUpdate:modelValue":e[1]||(e[1]=m=>n.selectedPaymentMethod=m),class:k([{"input-error":n.hasPaymentMethodError},"ecwp-input input input-bordered w-full"])},[i("option",Dm,l(o.translations.select),1),(r(!0),c(W,null,U(n.paymentMethods,m=>(r(),c("option",{key:m.id,value:m.id},l(m.method_name),9,Pm))),128))],2),[[ye,n.selectedPaymentMethod]])])])):_("",!0),i("div",Mm,[i("button",{onClick:e[2]||(e[2]=(...m)=>o.onCancel&&o.onCancel(...m)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[3]||(e[3]=(...m)=>o.onConfirm&&o.onConfirm(...m)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,wm)])}var qm=oe(bm,[["render",jm]]);const Om={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{onConfirm(){this.$emit("confirm",this.selectedPaymentMethod),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm_credit").close()}}},Vm=["open"],Rm={class:"modal-box"},Nm={class:"font-bold text-lg"},Bm=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),Fm={class:"text-lg font-semibold text-center"},Wm={class:"my-4 text-center text-xl"},Xm={class:"flex justify-between space-x-4"};function Um(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm_credit",class:"modal",open:t.showModal},[i("div",Rm,[i("h3",Nm,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),Bm,i("h2",Fm,l(s.title),1),i("p",Wm,l(s.message),1),i("div",Xm,[i("button",{onClick:e[1]||(e[1]=(...m)=>o.onCancel&&o.onCancel(...m)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[2]||(e[2]=(...m)=>o.onConfirm&&o.onConfirm(...m)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,Vm)])}var Qm=oe(Om,[["render",Um]]);const Lm={name:"InvoiceNavBar",components:{SendInvoiceModal:ym,RemoveModal:xt,ConfirmModal:bn,ConfirmModalPaid:qm,ConfirmModalCredit:Qm},props:{invoiceInfo:Object,currencyDefault:Object,currencyClient:Object,emailActive:String,noItems:Boolean},data(){return{showConfirmModal:!1,showConfirmCreditModal:!1,loading:!1,sendInvoiceModal:!1,loadingModal:!1,loadingPdf:!1,client_detail:null,selectedStatus:null,subject:"",content:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{changeInvoiceStatusWithPaymentMethod(t){const e=this.selectedStatus;this.changeInvoiceStatus(e,t),this.showConfirmModal=!1},async changeInvoiceStatus(t,e){this.loading=!0;try{const a=await(await fetch("/wp-json/my-easy-compta/v1/invoices/update-status",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.invoiceInfo.id,status:t,method:e})})).json();a.success?(this.invoiceInfo.status=t,this.loading=!1):(console.error("Failed to update invoice status:",a.message),this.loading=!1)}catch(s){console.error("An error occurred while updating invoice status:",s)}},async addCreditInvoice(){this.loading=!0;try{const e=await(await fetch("/wp-json/my-easy-compta/v1/invoices/credit",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.invoiceInfo.id})})).json();e.success?(this.invoiceInfo.credit=1,this.loading=!1):(console.error("Failed to update invoice status:",e.message),this.loading=!1)}catch(t){console.error("An error occurred while updating invoice status:",t)}},exportToPDF(t){this.loadingPdf=!0;let s=`/wp-json/my-easy-compta/v1/invoices/pdf/${this.invoiceInfo.id}?currency_id=${t}`;fetch(s,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(a=>{if(!a.ok)throw this.loadingPdf=!1,new Error("Network response was not ok");return a.blob()}).then(a=>{const n=URL.createObjectURL(a);window.open(n),this.loadingPdf=!1}).catch(a=>{console.error("There was a problem with the fetch operation:",a),this.loadingPdf=!1})},sendInvoice(t){this.loadingModal=!0,this.sendInvoiceModal=!0,modal_send_invoice.showModal(),this.fetchClient(t),this.fetchSettings()},fetchClient(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.loading=!1}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.subject=e.email_invoice_subject,this.content=e.email_invoice_content}else{const e=await t.json();this.showToast(e.message,"alert-error")}}catch(t){this.loading=!1,this.showToast(t.message,"alert-error")}},confirmValidateInvoice(t){this.selectedStatus=t,modal_confirm_paid.showModal(),this.showConfirmModal=!0},confirmCreditInvoice(){modal_confirm_credit.showModal(),this.showConfirmCreditModal=!0}}},zm={key:0},Hm={key:1,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Gm=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Ym=[Gm],Jm={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Km=i("div",{class:"dropdown"},[i("div",{tabindex:"0",role:"button",class:"btn btn-ghost lg:hidden"},[i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h8m-8 6h16"})])]),i("ul",{tabindex:"0",class:"menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"},[i("li",null,[i("a",null,"Item")]),i("li",null,[i("a",null,"Parent"),i("ul",{class:"p-2"},[i("li",null,[i("a",null,"Submenu")]),i("li",null,[i("a",null,"Submenu")])])]),i("li",null,[i("a",null,"Item")])])],-1),Zm={class:"hidden lg:flex gap-2"},$m={class:"btn btn-sm"},ef=i("i",{class:"far fa-edit"},null,-1),tf={key:1},nf={class:"btn btn-sm",disabled:""},sf=i("i",{class:"far fa-edit"},null,-1),of={key:2},af=i("i",{class:"fa fa-check"},null,-1),lf={class:"btn btn-outline btn-success btn-sm hover:text-white",disabled:""},rf=i("i",{class:"fa fa-check"},null,-1),cf={key:0},df={class:"btn btn-sm ms-2",disabled:""},uf=i("i",{class:"fas fa-undo"},null,-1),hf={key:1},mf=i("i",{class:"fas fa-undo"},null,-1),ff=["disabled"],pf=i("i",{class:"far fa-file-pdf"},null,-1),_f={key:0,class:"loading loading-spinner loading-sm"},gf={class:"flex gap-2"},vf=i("i",{class:"fas fa-paper-plane"},null,-1),yf={key:0},bf={key:1},wf={key:2,class:"far fa-envelope"},xf=["data-tip"],If={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Ef=i("i",{class:"fas fa-paper-plane"},null,-1),Cf=["data-tip"],kf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Tf=i("i",{class:"fas fa-paper-plane"},null,-1),Af={key:3},Sf={key:0,class:"dropdown dropdown-end"},Df={tabindex:"0",role:"button",class:"btn btn-outline btn-success btn-sm"},Pf=i("i",{class:"far fa-file-pdf"},null,-1),Mf={key:0,class:"loading loading-spinner loading-sm"},jf={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},qf=["disabled"],Of=["disabled"],Vf={key:4},Rf=["disabled"],Nf=i("i",{class:"far fa-file-pdf"},null,-1),Bf={key:0},Ff={key:1},Wf={key:2,class:"loading loading-spinner loading-sm"},Xf=i("i",{class:"fas fa-check"},null,-1),Uf=["data-tip"],Qf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Lf=i("i",{class:"fas fa-check"},null,-1);function zf(t,e,s,a,n,o){const m=j("send-invoice-modal"),h=j("confirm-modal-paid"),f=j("confirm-modal-credit"),d=j("router-link");return r(),c("div",null,[s.emailActive==1?(r(),c("div",zm,[P(m,{loading:n.loadingModal,"show-modal":n.sendInvoiceModal,"modal-id":"modal_send_invoice",client:n.client_detail,"invoice-id":s.invoiceInfo.id,subject:n.subject,content:n.content,onClose:e[0]||(e[0]=u=>n.sendInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):_("",!0),P(h,{"show-modal":n.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,status:n.selectedStatus,onConfirm:o.changeInvoiceStatusWithPaymentMethod,onCancel:e[1]||(e[1]=u=>n.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","status","onConfirm"]),P(f,{"show-modal":n.showConfirmCreditModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[2]||(e[2]=u=>this.addCreditInvoice()),onCancel:e[3]||(e[3]=u=>n.showConfirmCreditModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(r(),c("div",Hm,Ym)):_("",!0),i("div",Jm,[i("div",null,[Km,i("div",Zm,[s.invoiceInfo.status=="draft"?(r(),Rs(d,{key:0,to:{name:"InvoiceEdit",params:{id:s.invoiceInfo.id}}},{default:re(()=>[i("button",$m,[ef,w(" "+l(o.translations.edit_invoice),1)])]),_:1},8,["to"])):(r(),c("div",tf,[i("button",nf,[sf,w(" "+l(o.translations.edit_invoice),1)])])),s.invoiceInfo.status=="unpaid"&&!s.noItems?(r(),c("div",of,[i("button",{class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[4]||(e[4]=u=>o.confirmValidateInvoice("paid"))},[af,w(" "+l(o.translations.mark_as_paid),1)])])):(r(),c(W,{key:3},[i("div",null,[i("button",lf,[rf,w(" "+l(o.translations.mark_as_paid),1)])]),s.invoiceInfo.credit!=0&&s.invoiceInfo.status=="paid"&&!s.noItems?(r(),c("div",cf,[i("button",df,[uf,w(" "+l(o.translations.credit_invoice),1)])])):_("",!0),s.invoiceInfo.credit==0&&s.invoiceInfo.status=="paid"&&!s.noItems?(r(),c("div",hf,[i("button",{class:"btn btn-sm ms-2",onClick:e[5]||(e[5]=u=>o.confirmCreditInvoice())},[mf,w(" "+l(o.translations.credit_invoice),1)])])):_("",!0)],64))])]),s.invoiceInfo.status=="draft"?(r(),c("button",{key:0,onClick:e[6]||(e[6]=u=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-secondary btn-sm",disabled:n.loadingPdf},[pf,i("span",null,l(o.translations.previewPDF),1),n.loadingPdf?(r(),c("span",_f)):_("",!0)],8,ff)):_("",!0),i("div",gf,[s.emailActive==1&&s.invoiceInfo.status!="draft"?(r(),c("button",{key:0,onClick:e[7]||(e[7]=K(u=>o.sendInvoice(s.invoiceInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[vf,s.invoiceInfo.sent==1?(r(),c("span",yf,l(o.translations.resend_invoice),1)):(r(),c("span",bf,l(o.translations.send_invoice),1)),s.invoiceInfo.sent==1?(r(),c("i",wf)):_("",!0)])):s.emailActive==1&&s.invoiceInfo.status=="draft"?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.draft_cannot_send},[i("button",If,[Ef,w(" "+l(o.translations.send_invoice),1)])],8,xf)):(r(),c("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",kf,[Tf,w(" "+l(o.translations.send_invoice),1)])],8,Cf)),s.currencyDefault.currency_id!==s.currencyClient.currency_id?(r(),c("div",Af,[s.invoiceInfo.status!="draft"?(r(),c("div",Sf,[i("div",Df,[Pf,w(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(r(),c("span",Mf)):_("",!0)]),i("ul",jf,[i("li",null,[i("a",{onClick:e[8]||(e[8]=u=>o.exportToPDF(s.currencyDefault.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyDefault.currency_symbol),9,qf)]),i("li",null,[i("a",{onClick:e[9]||(e[9]=u=>o.exportToPDF(s.currencyClient.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyClient.currency_symbol),9,Of)])])])):_("",!0)])):(r(),c("div",Vf,[s.invoiceInfo.status!="draft"?(r(),c("button",{key:0,onClick:e[10]||(e[10]=u=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[Nf,s.invoiceInfo.status!="draft"?(r(),c("span",Bf,l(o.translations.exportToPDF),1)):(r(),c("span",Ff,l(o.translations.previewPDF),1)),n.loadingPdf?(r(),c("span",Wf)):_("",!0)],8,Rf)):_("",!0)])),s.invoiceInfo.status=="draft"&&!s.noItems?(r(),c("button",{key:5,class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[11]||(e[11]=u=>o.confirmValidateInvoice("unpaid"))},[Xf,w(" "+l(o.translations.validateInvoice),1)])):_("",!0),s.invoiceInfo.status=="draft"&&s.noItems?(r(),c("div",{key:6,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.min_article},[i("button",Qf,[Lf,w(" "+l(o.translations.validateInvoice),1)])],8,Uf)):_("",!0)])])])}var Hf=oe(Lm,[["render",zf]]);const Gf={components:{VueEditor:Et.exports.VueEditor},props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,item:Object},data(){return{editedItem:{...this.item},loading:this.loading,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{item_name:{label:"Nom de l'item"},item_description:{label:"Description de l'item",type:"textarea"},quantity:{label:"Quantit\xE9",type:"number"},vat_rate:{label:"Taux de TVA",type:"number"},unit_price:{label:"Prix unitaire",type:"number"},discount:{label:"Remise",type:"number"}}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch(`/wp-json/my-easy-compta/v1/invoices/edit-item/${this.editedItem.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedItem)});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("itemEdited")}else{const e=`Error editing item: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error editing item";this.showToast(e,"alert-error"),console.error("Error editing item:",t),this.loadingBtn=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--}},watch:{item:{handler(t){this.editedItem={...t}},immediate:!0}}},Yf=["id","open"],Jf={class:"modal-box"},Kf={class:"font-bold text-lg"},Zf={key:0},$f={class:"grid grid-cols-1 gap-4"},ep=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),tp=i("div",{class:"skeleton h-4 w-full"},null,-1),np=[ep,tp],sp={class:"grid grid-cols-1 gap-4"},op=["type"],ip=["for"],ap=["id","onUpdate:modelValue"],lp={key:1},rp=["for"],cp={class:"form-group mt-4 flex justify-end"},dp=["disabled"],up={key:0,class:"loading loading-spinner loading-sm"};function hp(t,e,s,a,n,o){const m=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Jf,[i("h3",Kf,l(s.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=h=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",Zf,[i("div",$f,[(r(!0),c(W,null,U(o.skeletonItems,h=>(r(),c("div",{key:h,class:"py-2"},np))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",sp,[(r(!0),c(W,null,U(n.fields,(h,f)=>(r(),c("div",{key:f,class:"ecwp-group form-group"},[h.type!=="textarea"?(r(),c("div",{key:0,type:h.type||"text"},[i("label",{for:f,class:"ecwp-label form-label"},l(h.label),9,ip),B(i("input",{id:f,"onUpdate:modelValue":d=>n.editedItem[f]=d,class:k(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,ap),[[J,n.editedItem[f]]])],8,op)):(r(),c("div",lp,[i("label",{for:f,class:"form-label"},l(h.label),9,rp),P(m,{id:f,modelValue:n.editedItem[f],"onUpdate:modelValue":d=>n.editedItem[f]=d,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",cp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",up)):_("",!0)],8,dp)])],32))])],8,Yf)])}var mp=oe(Gf,[["render",hp]]);const fp={name:"sendRemind",components:{VueEditor:Et.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,invoiceId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"remind",id:this.invoiceId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},pp=["id","open"],_p={class:"modal-box"},gp={class:"font-bold text-lg"},vp={key:0},yp={class:"grid grid-cols-1 gap-4"},bp=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),wp=i("div",{class:"skeleton h-4 w-full"},null,-1),xp=[bp,wp],Ip={class:"grid grid-cols-1 gap-4"},Ep=["type"],Cp=["for"],kp=["id","value","disabled","onInput"],Tp={key:1},Ap=["for"],Sp={class:"form-group mt-4 flex justify-end"},Dp=["disabled"],Pp={key:0,class:"loading loading-spinner loading-sm"};function Mp(t,e,s,a,n,o){const m=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",_p,[i("h3",gp,l(o.translations.remind_invoice),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=h=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",vp,[i("div",yp,[(r(!0),c(W,null,U(o.skeletonItems,h=>(r(),c("div",{key:h,class:"py-2"},xp))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Ip,[(r(!0),c(W,null,U(n.fields,(h,f)=>(r(),c("div",{key:f,class:"ecwp-group form-group"},[h.type!=="textarea"?(r(),c("div",{key:0,type:h.type||"text"},[i("label",{for:f,class:"ecwp-label form-label"},l(h.label),9,Cp),i("input",{id:f,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:d=>o.updateFieldValue(f,d.target.value)},null,42,kp)],8,Ep)):(r(),c("div",Tp,[i("label",{for:f,class:"form-label"},l(h.label),9,Ap),P(m,{modelValue:h.value,"onUpdate:modelValue":d=>h.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Sp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",Pp)):_("",!0)],8,Dp)])],32))])],8,pp)])}var jp=oe(fp,[["render",Mp]]);const qp={name:"InvoiceViewDetail",components:{Card:Ue,InvoiceNavBar:Hf,EditItemModal:mp,RemoveModal:xt,RemindInvoiceModal:jp},data(){return{selectedItem:null,SelectedInvoiceId:null,editItemsModal:!1,RemindInvoiceModal:!1,no_items:!0,loading:!1,loading_add:!1,invoice:[],invoiceItems:[],newItem:{loading_del:!1,item_name:"",item_ref:"",item_category:"Type",item_description:"",quantity:1,vat_rate:0,unit_price:0,discount:0,total_price:0,total_amount:0},settings:[],client_detail:[],list_vats:[],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",articles:[],categories:[],refs:[],showDropdown:!1,showDropdownRef:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},isInvoiceOverdue(){const t=new Date().getTime(),e=this.invoice.due_date?new Date(this.invoice.due_date).getTime():null;return e&&e<t},defaultCurrency(){return{currency_id:this.settings.default_currency,currency_symbol:this.default_currency_symbol}},clientCurrency(){return{currency_id:this.client_detail.currency_id,currency_symbol:this.client_currency}},totalAmountWithoutDiscount(){const t=this.invoiceItems.reduce((e,s)=>{const a=s.quantity*s.unit_price;return e+a},0);return this.formatCurrency(t)},totalAmount(){const t=this.invoiceItems.reduce((e,s)=>e+parseFloat(s.total_price),0);return this.formatCurrency(t)},totalAmountDefaultCurrency(){return(this.invoiceItems.reduce((a,n)=>a+parseFloat(n.total_amount),0)*this.invoice.exchange_rate).toFixed(2)},totalAmountWithVAT(){const t=parseFloat(this.totalAmount);if(this.settings.vat_active==1){const e=parseFloat(this.calculateVAT());return this.formatCurrency(t+e)}else return this.formatCurrency(t)}},methods:{getUniqueVATRates(){const t=new Set;return this.invoiceItems.forEach(e=>{e.vat_rate&&t.add(e.vat_rate)}),Array.from(t)},calculateVATForRate(t){let e=0;return this.invoiceItems.forEach(s=>{if(s.vat_rate===t){const a=s.quantity*s.unit_price,n=a*s.discount/100;e+=(a-n)*t/100}}),this.formatCurrency(e)},calculateTotalAmountWithVAT(){let t=this.invoiceItems.reduce((e,s)=>e+parseFloat(s.total_amount),0);return this.settings.easy_compta_woo_addon_active==1&&(t+=parseFloat(this.invoice.shipping_amount||0)),this.formatCurrency(t)},formatShippingAmout(t){return this.formatShippingCurrency(t)},formatShippingCurrency(t){const s=(parseFloat(t)||0).toFixed(2),a=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${s}${a}`},fetchInvoice(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t?(this.invoice=t,this.fetchClientInfo(t.client_id)):console.error("Invoice not found")}).catch(t=>{console.error("Error fetching invoice:",t),this.loading=!1})},fetchClientInfo(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e;const s=e.currency_id;s&&this.fetchCurrencyDetails(s)}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},fetchItems(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}/items`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t.code=="no_items_found"?(console.error("No items found"),this.invoiceItems=[],this.loading=!1,this.no_items=!0):(this.invoiceItems=t,this.loading=!1,this.no_items=!1)}).catch(t=>{console.error("Error fetching items:",t),this.loading=!1})},fetchCurrencyDetails(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/settings/currency/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw this.loading=!1,new Error("Currency details not found");return this.loading=!1,e.json()}).then(e=>{this.client_currency=e.symbol,this.loading=!1}).catch(e=>{this.loading=!1,console.error("Error fetching currency details:",e)})},updateTotal(){const t=this.newItem.quantity*this.newItem.unit_price,e=t*this.newItem.discount/100,s=t-e;var a=0;if(this.settings.vat_active==1){const n=s*this.newItem.vat_rate/100;a=s+n}else a=s;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(a)},calculateTotalWithVat(t,e,s,a){const n=t*e,o=n*a/100,m=n-o,h=m*s/100,f=m+h;return this.formatCurrency(f)},calculateTotal(t,e,s){const a=t*e,n=a*s/100,m=a-n;return this.formatCurrency(m)},submitItems(){this.updateTotal();const t={...this.newItem,invoice_id:this.$route.params.id};this.loading_add=!0,fetch("/wp-json/my-easy-compta/v1/invoices/element-add",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(t)}).then(e=>e.json()).then(e=>{e.success?(this.loading_add=!1,this.fetchItems(),this.newItem={item_name:"",item_ref:"",item_category:"Type",item_description:"",quantity:1,vat_rate:this.default_vat.rate,unit_price:0,discount:0,total_price:0,total_amount:0}):(this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e.message),this.loading_add=!1)}).catch(e=>{this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e),this.loading_add=!1})},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--},confirmremoveItem(t,e){this.selectedItem=t,this.SelectedInvoiceId=e,modal_remove.showModal(),this.showRemoveModal=!0},removeItem(t,e){const s=this.invoiceItems.find(a=>a.id===t);s.loading_del=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/element-delete/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({invoice_id:e})}).then(a=>a.json()).then(a=>{a.success?(s.loading_del=!1,this.fetchItems()):(this.showToast(a.message,"alert-error"),console.error("Error removing item:",a.message),s.loading_del=!1)}).catch(a=>{this.showToast(a.message,"alert-error"),console.error("Error removing item:",a),s.loading_del=!1})},editItem(t){this.loadingModal=!0,this.editItemsModal=!0,modal_edit_item.showModal(),this.fetchItemDetails(t)},fetchItemDetails(t){fetch(`/wp-json/my-easy-compta/v1/invoices/item-details/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedItem=e,this.loading=!1}).catch(e=>{console.error("Error fetching item details:",e),this.loading=!1})},formatCurrency(t){const e=t.toFixed(2),s=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${e}${s}`},calculateDiscountAmountWithVAT(t,e,s,a){const o=t*e*a/100,m=o*s/100,h=o+m;return this.formatCurrency(h)},calculateDiscountAmount(t,e,s){const o=t*e*s/100;return this.formatCurrency(o)},calculateVAT(){const t=parseFloat(this.totalAmount),e=parseFloat(this.default_vat.rate),s=t*(e/100);return this.formatCurrency(s)},onDragEnd(t){const e=this.invoiceItems[t.oldIndex];this.invoiceItems.splice(t.oldIndex,1),this.invoiceItems.splice(t.newIndex,0,e);const s=this.invoiceItems.map(a=>a.id);this.saveOrderToDatabase(s)},nl2br(t){return t?t.replace(/\n/g,"<br>"):""},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},saveOrderToDatabase(t){fetch("/wp-json/my-easy-compta/v1/invoices/update-invoice-items-order",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({order:t})}).then(e=>{e.ok?console.log("Order saved successfully."):console.error("Failed to save order:",e.statusText)}).catch(e=>{console.error("Error saving order:",e)})},fetchCategoriesArticles(){fetch("/wp-json/my-easy-compta/v1/categories-articles",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.categories=t}).catch(t=>console.error("Error fetching categories:",t))},fetchArticles(){if(this.newItem.item_name.length<1){this.articles=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_name}&method=name`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.articles=t}).catch(t=>console.error("Error fetching articles:",t))},selectItem(t){this.newItem.item_ref=t.ref,this.newItem.item_name=t.name,this.newItem.item_description=t.description,this.newItem.unit_price=t.unit_price,this.showDropdown=!1,this.showDropdownRef=!1},fetchRefs(){if(this.newItem.item_ref.length<1){this.refs=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_ref}&method=ref`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.refs=t}).catch(t=>console.error("Error fetching refrences:",t))},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s,listVatData:a}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.list_vats=a,this.newItem.vat_rate=this.default_vat.rate,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},highlightMatch(t){if(!this.newItem.item_name)return t;const e=new RegExp(`(${this.escapeRegExp(this.newItem.item_name)})`,"gi");return t.replace(e,"<b>$1</b>")},escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},handleClickOutside(t){this.$el.contains(t.target)||(this.showDropdown=!1,this.showDropdownRef=!1)},sendRemind(t){this.loadingModal=!0,this.RemindInvoiceModal=!0,modal_send_remind.showModal(),this.fetchClientInfo(t),this.loadSettings()},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},beforeDestroy(){document.removeEventListener("click",this.handleClickOutside)},mounted(){this.fetchInvoice(),this.fetchItems(),this.loadSettings(),this.fetchCategoriesArticles(),document.addEventListener("click",this.handleClickOutside);const t=document.querySelector("tbody");A.create(t,{animation:150,handle:".drag-handle",onEnd:this.onDragEnd})}},Op={class:"pt-2 pr-4"},Vp={key:0},Rp={key:2,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Np=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Bp=[Np],Fp={key:3},Wp={role:"alert",class:"alert alert-warning"},Xp=i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),Up={key:0},Qp=["data-tip"],Lp={class:"btn btn-sm btn-primary",disabled:""},zp={class:"grid grid-cols-2"},Hp={class:"md:col-span-1"},Gp=["src"],Yp={class:"md:col-span-1 text-right"},Jp={class:"text-lg font-semibold"},Kp={key:0,class:"badge badge-error text-white"},Zp={key:1,class:"badge badge-error text-white"},$p={key:2,class:"badge badge-success text-white"},e_={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},t_=i("br",null,null,-1),n_=i("br",null,null,-1),s_=i("br",null,null,-1),o_=["href"],i_=i("br",null,null,-1),a_=i("br",null,null,-1),l_=i("br",null,null,-1),r_=["href"],c_=i("br",null,null,-1),d_=["href"],u_={class:"table mt-8"},h_=i("th",null,null,-1),m_={width:"5%"},f_={width:"19%"},p_={width:"21%"},__={width:"10%",class:"text-center"},g_={width:"8%",class:"text-center"},v_={key:0,width:"5%",class:"text-center"},y_={key:1,width:"5%"},b_={width:"10%",class:"text-center"},w_={width:"10%",class:"text-right"},x_=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),I_=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),E_={key:0,class:"badge badge-ghost badge-xs"},C_=["innerHTML"],k_={class:"text-center"},T_={class:"text-center"},A_={key:0},S_={key:1},D_={key:0,class:"text-center"},P_={key:1},M_={key:2,class:"text-center"},j_=i("br",null,null,-1),q_={key:3,class:"text-center"},O_=i("br",null,null,-1),V_={class:"text-right"},R_={key:0},N_={key:1},B_={key:0},F_=["data-tip"],W_=["onClick"],X_=i("i",{class:"far fa-edit"},null,-1),U_=[X_],Q_=["data-tip"],L_=["onClick"],z_={key:0,class:"far fa-trash-alt"},H_={key:1,class:"loading loading-spinner loading-xs"},G_={key:0},Y_=i("td",{class:"px-2"},null,-1),J_={class:"align-top px-2"},K_={class:"flex items-center border rounded-md relative"},Z_=["placeholder"],$_={key:0,class:"autocomplete-dropdown bg-base-100"},eg=["onClick","innerHTML"],tg={class:"align-top px-2"},ng=i("option",{disabled:"",selected:""},"Type",-1),sg=["value"],og={class:"flex items-center border rounded-md relative"},ig=["placeholder"],ag={key:0,class:"autocomplete-dropdown bg-base-100"},lg=["onClick","innerHTML"],rg={class:"align-top"},cg={class:"flex items-center rounded-md"},dg=["placeholder"],ug={class:"align-top"},hg={class:"flex items-center border rounded-lg"},mg={class:"inline-flex"},fg=["placeholder"],pg={class:"align-top"},_g={class:"flex items-center border rounded-md"},gg=["placeholder"],vg={key:0,class:"align-top"},yg=["value"],bg={key:1,class:"align-top"},wg={class:"align-top"},xg={class:"flex items-center border rounded-md"},Ig=["placeholder"],Eg=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),Cg={key:2,class:"text-right"},kg={key:3,class:"text-right"},Tg=["data-tip"],Ag={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},Sg={key:0,class:"fa fa-plus"},Dg={key:1,class:"loading loading-spinner loading-xs"},Pg={colspan:"8",class:"text-right no-border"},Mg={class:"text-right"},jg={key:0,class:"line-through"},qg=i("td",null,null,-1),Og={colspan:"8",class:"text-right no-border"},Vg={class:"text-right"},Rg=i("td",null,null,-1),Ng={key:2},Bg={colspan:"8",class:"text-right no-border"},Fg={class:"text-right no-border"},Wg={colspan:"8",class:"text-right no-border font-bold text-xl"},Xg={class:"text-right no-border font-bold text-xl"},Ug=i("td",null,null,-1),Qg={key:3},Lg={colspan:"8",class:"text-right no-border"},zg={class:"text-right no-border"},Hg={key:4},Gg={colspan:"8",class:"text-right no-border"},Yg={class:"text-right no-border font-bold text-xl"};function Jg(t,e,s,a,n,o){const m=j("InvoiceNavBar"),h=j("remove-modal"),f=j("remind-invoice-modal"),d=j("edit-item-modal"),u=j("Card");return r(),c("div",Op,[P(m,{invoiceInfo:n.invoice,currencyDefault:o.defaultCurrency,currencyClient:o.clientCurrency,emailActive:n.settings.easy_compta_email_addon_active,noItems:n.no_items},null,8,["invoiceInfo","currencyDefault","currencyClient","emailActive","noItems"]),P(h,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=p=>this.removeItem(n.selectedItem,n.SelectedInvoiceId)),onCancel:e[1]||(e[1]=p=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.settings.easy_compta_email_addon_active==1?(r(),c("div",Vp,[P(f,{loading:t.loadingModal,"show-modal":n.RemindInvoiceModal,"modal-id":"modal_send_remind",client:n.client_detail,"invoice-id":n.invoice.id,subject:n.settings.remind_invoice_subject,content:n.settings.remind_invoice_content,onClose:e[2]||(e[2]=p=>n.RemindInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):_("",!0),n.toast.visible?(r(),c("div",{key:1,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),n.loading?(r(),c("div",Rp,Bp)):_("",!0),o.isInvoiceOverdue&&n.invoice.status=="unpaid"?(r(),c("div",Fp,[i("div",Wp,[Xp,i("span",null,l(o.translations.invoice_overdue),1),n.settings.easy_compta_email_addon_active==1?(r(),c("div",Up,[i("button",{onClick:e[3]||(e[3]=K(p=>o.sendRemind(n.invoice.client_id),["prevent"])),class:"btn btn-sm btn-primary"},l(o.translations.remind_invoice),1)])):(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",Lp,l(o.translations.remind_invoice),1)],8,Qp))])])):_("",!0),P(u,{topMargin:"mt-8",id:"invoice-content"},{default:re(()=>[i("div",zp,[i("div",Hp,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,Gp)])]),i("div",Yp,[i("p",Jp,l(n.invoice.invoice_number),1),i("div",null,[w(l(o.translations.created_at)+": ",1),i("strong",null,l(n.invoice.created_at),1)]),i("div",null,[w(l(o.translations.due_date)+": ",1),i("strong",null,l(n.invoice.due_date),1)]),i("div",null,[w(l(o.translations.status)+": ",1),n.invoice.status=="draft"?(r(),c("span",Kp,l(o.translations.draft),1)):_("",!0),n.invoice.status=="unpaid"?(r(),c("span",Zp,l(o.translations.unpaid),1)):_("",!0),n.invoice.status=="paid"?(r(),c("span",$p,l(o.translations.paid),1)):_("",!0)])])]),i("div",e_,[i("div",null,[i("strong",null,l(o.translations.bill_to)+":",1),i("h4",null,[i("strong",null,l(n.client_detail.company_name),1)]),i("p",null,[w(l(n.client_detail.address),1),t_,w(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),n_,w(" "+l(n.client_detail.country),1),s_,n.client_detail.phone?(r(),c("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,o_)):_("",!0)])]),i("div",null,[i("strong",null,l(o.translations.received_from)+":",1),i("h4",null,[i("strong",null,l(n.settings.company_name),1)]),i("p",null,[w(l(n.settings.company_address),1),i_,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),a_,w(" "+l(n.settings.country),1),l_,n.settings.company_phone?(r(),c("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,r_)):_("",!0),c_,n.settings.mobile_phone?(r(),c("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,d_)):_("",!0)])])]),P(d,{loading:t.loadingModal,"show-modal":n.editItemsModal,"modal-id":"modal_edit_item","modal-title":o.translations.edit_item,item:n.selectedItem,onClose:e[4]||(e[4]=p=>n.editItemsModal=!1),onItemEdited:o.fetchItems},null,8,["loading","show-modal","modal-title","item","onItemEdited"]),i("form",{onSubmit:e[24]||(e[24]=K((...p)=>o.submitItems&&o.submitItems(...p),["prevent"]))},[i("table",u_,[i("thead",null,[i("tr",null,[h_,i("th",m_,l(o.translations.item_ref),1),i("th",f_,l(o.translations.item_name),1),i("th",p_,l(o.translations.description),1),i("th",__,l(o.translations.quantity),1),i("th",g_,l(o.translations.unit_price),1),n.settings.vat_active==1?(r(),c("th",v_,l(o.translations.vat),1)):(r(),c("th",y_)),i("th",b_,l(o.translations.discount),1),i("th",w_,l(o.translations.total),1),x_])]),i("tbody",null,[(r(!0),c(W,null,U(n.invoiceItems,(p,g)=>(r(),c("tr",{key:p.id||g},[I_,i("td",null,l(p.item_ref),1),i("td",null,[p.category_name?(r(),c("div",E_,l(p.category_name),1)):_("",!0),i("div",null,l(p.item_name),1)]),i("td",{innerHTML:o.nl2br(p.item_description)},null,8,C_),i("td",k_,l(p.quantity),1),i("td",T_,[w(l(p.unit_price),1),n.default_currency_symbol==n.client_currency?(r(),c("span",A_,l(n.default_currency_symbol),1)):(r(),c("span",S_,l(n.client_currency),1))]),n.settings.vat_active==1?(r(),c("td",D_,l(p.vat_rate)+"% ",1)):(r(),c("td",P_)),n.settings.vat_active==1?(r(),c("td",M_,[w(l(p.discount)+"% ",1),j_,w(" "+l(o.calculateDiscountAmountWithVAT(p.quantity,p.unit_price,p.vat_rate,p.discount)),1)])):(r(),c("td",q_,[w(l(p.discount)+"% ",1),O_,w(" "+l(o.calculateDiscountAmount(p.quantity,p.unit_price,p.discount)),1)])),i("td",V_,[w(l(p.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(r(),c("span",R_,l(n.default_currency_symbol),1)):(r(),c("span",N_,l(n.client_currency),1))]),i("td",null,[n.invoice.status=="draft"?(r(),c("div",B_,[i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:K(v=>o.editItem(p.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},U_,8,W_)],8,F_),i("span",{class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:K(v=>o.confirmremoveItem(p.id,n.invoice.id),["prevent"]),class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 mx-2 rounded"},[p.loading_del?_("",!0):(r(),c("i",z_)),p.loading_del?(r(),c("span",H_)):_("",!0)],8,L_)],8,Q_)])):_("",!0)])]))),128)),n.invoice.status=="draft"?(r(),c("tr",G_,[Y_,i("td",J_,[i("div",K_,[B(i("input",{type:"text","onUpdate:modelValue":e[5]||(e[5]=p=>n.newItem.item_ref=p),onInput:e[6]||(e[6]=(...p)=>o.fetchRefs&&o.fetchRefs(...p)),onFocus:e[7]||(e[7]=p=>n.showDropdownRef=!0),placeholder:o.translations.item_ref,class:"w-full p-2.5 input-xs outline-none"},null,40,Z_),[[J,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(r(),c("ul",$_,[(r(!0),c(W,null,U(n.refs,p=>(r(),c("li",{key:p.ref,onClick:g=>o.selectItem(p),class:"autocomplete-item",innerHTML:o.highlightMatch(p.ref)},null,8,eg))),128))])):_("",!0)])]),i("td",tg,[B(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[8]||(e[8]=p=>n.newItem.item_category=p)},[ng,(r(!0),c(W,null,U(n.categories,p=>(r(),c("option",{key:p.id,value:p.id},l(p.name),9,sg))),128))],512),[[ye,n.newItem.item_category]]),i("div",og,[B(i("input",{type:"text","onUpdate:modelValue":e[9]||(e[9]=p=>n.newItem.item_name=p),onInput:e[10]||(e[10]=(...p)=>o.fetchArticles&&o.fetchArticles(...p)),onFocus:e[11]||(e[11]=p=>n.showDropdown=!0),placeholder:o.translations.item_name,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,ig),[[J,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(r(),c("ul",ag,[(r(!0),c(W,null,U(n.articles,p=>(r(),c("li",{key:p.name,onClick:g=>o.selectItem(p),class:"autocomplete-item bt-primary",innerHTML:o.highlightMatch(p.name)},null,8,lg))),128))])):_("",!0)])]),i("td",rg,[i("div",cg,[B(i("textarea",{"onUpdate:modelValue":e[12]||(e[12]=p=>n.newItem.item_description=p),placeholder:o.translations.item_description,class:"textarea textarea-bordered input-xs w-full",onInput:e[13]||(e[13]=p=>o.resize()),ref:"textarea"},null,40,dg),[[J,n.newItem.item_description]])])]),i("td",ug,[i("div",hg,[i("div",mg,[i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-l",onClick:e[14]||(e[14]=(...p)=>o.decrease&&o.decrease(...p))}," - "),B(i("input",{type:"number",min:"1","onUpdate:modelValue":e[15]||(e[15]=p=>n.newItem.quantity=p),placeholder:o.translations.quantity,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[16]||(e[16]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,fg),[[J,n.newItem.quantity]]),i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-r",onClick:e[17]||(e[17]=(...p)=>o.increase&&o.increase(...p))}," + ")])])]),i("td",pg,[i("div",_g,[B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[18]||(e[18]=p=>n.newItem.unit_price=p),placeholder:o.translations.unit_price,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[19]||(e[19]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,gg),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(r(),c("td",vg,[B(i("select",{"onUpdate:modelValue":e[20]||(e[20]=p=>n.newItem.vat_rate=p),onChange:e[21]||(e[21]=(...p)=>o.updateTotal&&o.updateTotal(...p)),class:"select select-md w-full mb-1 ecwp-select min-w-20"},[(r(!0),c(W,null,U(n.list_vats,p=>(r(),c("option",{key:p,value:p.rate},l(p.rate)+"% ",9,yg))),128))],544),[[ye,n.newItem.vat_rate]])])):(r(),c("td",bg)),i("td",wg,[i("div",xg,[B(i("input",{type:"number","onUpdate:modelValue":e[22]||(e[22]=p=>n.newItem.discount=p),min:"0",max:"100",placeholder:o.translations.discount,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[23]||(e[23]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,Ig),[[J,n.newItem.discount]]),Eg])]),n.settings.vat_active==1?(r(),c("td",Cg,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(r(),c("td",kg,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.discount)),1)),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",Ag,[n.loading_add?_("",!0):(r(),c("i",Sg)),n.loading_add?(r(),c("span",Dg)):_("",!0)])],8,Tg)])])):_("",!0),i("tr",null,[i("td",Pg,[i("strong",null,l(o.translations.subtotal),1)]),i("td",Mg,[o.totalAmount!==o.totalAmountWithoutDiscount?(r(),c("span",jg,l(o.totalAmountWithoutDiscount),1)):_("",!0),w(" "+l(o.totalAmount),1)]),qg]),n.settings.vat_active==1?(r(!0),c(W,{key:1},U(o.getUniqueVATRates(),(p,g)=>(r(),c("tr",{key:g},[i("td",Og,[i("strong",null,l(o.translations.tax)+" ("+l(p)+"%) ",1)]),i("td",Vg,l(o.calculateVATForRate(p)),1),Rg]))),128)):_("",!0),n.invoice.shipping_amount?(r(),c("tr",Ng,[i("td",Bg,[i("strong",null,l(o.translations.shipping_fees),1)]),i("td",Fg,l(o.formatShippingAmout(n.invoice.shipping_amount)),1)])):_("",!0),i("tr",null,[i("td",Wg,[i("strong",null,l(o.translations.total),1)]),i("td",Xg,l(o.calculateTotalAmountWithVAT()),1),Ug]),n.client_currency!=n.default_currency_symbol?(r(),c("tr",Qg,[i("td",Lg,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",zg,l(n.invoice.exchange_rate),1)])):_("",!0),n.client_currency!=n.default_currency_symbol?(r(),c("tr",Hg,[i("td",Gg,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",Yg,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):_("",!0)])])],32)]),_:1})])}var Kg=oe(qp,[["render",Jg]]);const Zg={name:"InvoiceNew",components:{Card:Ue,ModelSelect:Lt,VueDatePicker:It},data(){return{invoice:{invoice_number:"",due_date:"",client_id:"",client:null,status:"",exchange_rate:0},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],last_invoice_number:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},currencyMismatch(){const t=this.clients.find(e=>e.id===this.invoice.client_id);return t&&this.settings.default_currency!==t.currency_id}},mounted(){this.fetchClients(),this.fetchSettings()},methods:{cancelAction(){this.$router.push("/invoices")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`}))}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e;const s=`${this.settings.invoice_prefix}_${String(this.settings.last_invoice_id).padStart(4,"0")}`;this.invoice.number=s}else{const e=await t.json()}}catch{this.loading=!1}},handleClientChange(){const t=this.clients.find(e=>e.id===this.invoice.client_id);t&&this.settings.default_currency!==t.currency_id?this.invoice.exchange_rate=1:this.invoice.exchange_rate=0},submitInvoice(){if(!this.invoice.due_date||!this.invoice.client_id||!this.invoice.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch("/wp-json/my-easy-compta/v1/invoices",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.invoice)}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:t.id}})):(console.error("Error submitting invoice:",t.message),this.showToast(t.message,"alert-error"),this.loadingBtn=!1)}).catch(t=>{console.error("Error submitting invoice:",t),this.showToast(t,"alert-error"),this.loadingBtn=!1})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},$g={class:"pt-2 pr-4"},ev={class:"flex justify-between items-center mb-4"},tv={class:"card-title"},nv=i("div",{class:"divider mt-2"},null,-1),sv={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},ov={class:"grid grid-cols-2 gap-4"},iv={class:"ecwp-group form-group mb-4"},av={for:"invoiceNumber",class:"ecwp-label"},lv={class:"ecwp-group form-group mb-4"},rv={for:"invoiceDate",class:"ecwp-label"},cv={class:"ecwp-group form-group mb-4"},dv={for:"client",class:"ecwp-label"},uv={class:"ecwp-group form-group mb-4"},hv={for:"status",class:"ecwp-label"},mv={value:"draft"},fv={key:0,class:"ecwp-group form-group mb-4"},pv={for:"exchangeRate",class:"ecwp-label"},_v={class:"flex justify-between"},gv=["disabled"],vv={key:0,class:"loading loading-spinner loading-sm"};function yv(t,e,s,a,n,o){const m=j("VueDatePicker"),h=j("model-select"),f=j("Card");return r(),c("div",$g,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(f,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",ev,[i("h2",tv,l(o.translations.new_invoice),1)]),nv,n.loading?(r(),c("div",sv)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitInvoice&&o.submitInvoice(...d),["prevent"]))},[i("div",ov,[i("div",iv,[i("label",av,l(o.translations.invoice_number),1),B(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.invoice.number=d),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.invoice.number]])]),i("div",lv,[i("label",rv,l(o.translations.due_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.invoice.due_date&&n.showError?"input-error":""]]),id:"invoiceDate",modelValue:n.invoice.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.invoice.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",cv,[i("label",dv,l(o.translations.company_name),1),P(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=d=>n.invoice.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",uv,[i("label",hv,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=d=>n.invoice.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",mv,l(o.translations.draft),1)],2),[[ye,n.invoice.status]])]),o.currencyMismatch?(r(),c("div",fv,[i("label",pv,l(o.translations.exchange_rate),1),B(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=d=>n.invoice.exchange_rate=d),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):_("",!0)]),i("div",_v,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.submit)+" ",1),n.loadingBtn?(r(),c("span",vv)):_("",!0)],8,gv)])],32)]),_:1})])}var bv=oe(Zg,[["render",yv]]);const wv={name:"invoiceEdit",components:{Card:Ue,ModelSelect:Lt,VueDatePicker:It},data(){return{invoice:{invoice_number:"",due_date:"",client_id:"",client:null,status:"paid",exchange_rate:0},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},currencyMismatch(){const t=this.clients.find(e=>e.id===this.invoice.client_id);return t&&this.settings.default_currency!==t.currency_id}},mounted(){this.fetchClients(),this.fetchSettings(),this.fetchInvoiceDetails()},methods:{cancelAction(){this.$router.push("/invoices")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`})),this.invoice.client_id&&this.setClientById(this.invoice.client_id)}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e}else{const e=await t.json();console.error("Error fetching settings:",e)}}catch(t){this.loading=!1,console.error("Error fetching settings:",t)}},fetchInvoiceDetails(){const t=this.$route.params.id;!t||(this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e?this.invoice=e:(console.error("Error fetching invoice details:",e.message),this.showToast(e.message,"alert-error"))}).catch(e=>{console.error("Error fetching invoice details:",e),this.showToast(e,"alert-error")}).finally(()=>{this.loading=!1}))},setClientById(t){this.invoice.client=this.clients.find(e=>e.id===t)||null},handleClientChange(){const t=this.clients.find(e=>e.id===this.invoice.client_id);t&&this.settings.default_currency!==t.currency_id?this.invoice.exchange_rate=1:this.invoice.exchange_rate=0},submitInvoice(){if(!this.invoice.due_date||!this.invoice.client_id||!this.invoice.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.invoice)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:t.id}})):(this.loadingBtn=!1,console.error("Error submitting invoice:",t.message),this.showToast(t.message,"alert-error"))}).catch(t=>{this.loadingBtn=!1,console.error("Error submitting invoice:",t),this.showToast(t,"alert-error")})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},xv={class:"pt-2 pr-4"},Iv={class:"flex justify-between items-center mb-4"},Ev={class:"card-title"},Cv=i("div",{class:"divider mt-2"},null,-1),kv={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Tv={class:"grid grid-cols-2 gap-4"},Av={class:"ecwp-group form-group mb-4"},Sv={for:"invoiceNumber",class:"ecwp-label"},Dv={class:"ecwp-group form-group mb-4"},Pv={for:"invoiceDate",class:"ecwp-label"},Mv={class:"ecwp-group form-group mb-4"},jv={for:"client",class:"ecwp-label"},qv={class:"ecwp-group form-group mb-4"},Ov={for:"status",class:"ecwp-label"},Vv={value:"draft",selected:""},Rv={value:"unpaid"},Nv={value:"paid"},Bv={key:0,class:"ecwp-group form-group mb-4"},Fv={for:"exchangeRate",class:"ecwp-label"},Wv={class:"flex justify-between"},Xv=["disabled"],Uv={key:0,class:"loading loading-spinner loading-sm"};function Qv(t,e,s,a,n,o){const m=j("VueDatePicker"),h=j("model-select"),f=j("Card");return r(),c("div",xv,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),P(f,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",Iv,[i("h2",Ev,l(o.translations.edit_invoice),1)]),Cv,n.loading?(r(),c("div",kv)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitInvoice&&o.submitInvoice(...d),["prevent"]))},[i("div",Tv,[i("div",Av,[i("label",Sv,l(o.translations.invoice_number),1),B(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.invoice.invoice_number=d),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[J,n.invoice.invoice_number]])]),i("div",Dv,[i("label",Pv,l(o.translations.due_date),1),P(m,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.invoice.due_date&&n.showError?"input-error":""]]),id:"invoiceDate",modelValue:n.invoice.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.invoice.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",Mv,[i("label",jv,l(o.translations.company_name),1),P(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=d=>n.invoice.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",qv,[i("label",Ov,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=d=>n.invoice.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",Vv,l(o.translations.draft),1),i("option",Rv,l(o.translations.unpaid),1),i("option",Nv,l(o.translations.paid),1)],2),[[ye,n.invoice.status]])]),o.currencyMismatch?(r(),c("div",Bv,[i("label",Fv,l(o.translations.exchange_rate),1),B(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=d=>n.invoice.exchange_rate=d),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):_("",!0)]),i("div",Wv,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",Uv)):_("",!0)],8,Xv)])],32)]),_:1})])}var Lv=oe(wv,[["render",Qv]]);const ge=Ut;(function(t,e){const s=Ut,a=t();for(;[];)try{if(parseInt(s(442))/1*(-parseInt(s(434))/2)+-parseInt(s(435))/3+-parseInt(s(441))/4+-parseInt(s(440))/5+-parseInt(s(445))/6+-parseInt(s(433))/7+parseInt(s(452))/8*(parseInt(s(448))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Qt,855651);function Ut(t,e){const s=Qt();return Ut=function(a,n){return a=a-433,s[a]},Ut(t,e)}function Qt(){const t=["QuoteViewDetail","InvoiceEdit","/invoice/edit/:id","/quotes","7695155GzyGwK","4083608blPmlk","706sidXKo","/quote/edit/:id","QuoteNew","7281912AVmpWY","InvoiceNew","/invoice/new","4425417aAXdmI","/invoices","Invoice","Quote","80iDcwZZ","InvoiceViewDetail","179228uXWoWn","274JMOdrc","496704cvlEpj"];return Qt=function(){return t},Qt()}const zv=[{path:ge(439),name:ge(451),component:Ma},{path:"/quote/detail/:id",name:ge(436),component:xu},{path:"/quote/new",name:ge(444),component:Yu},{path:ge(443),name:"QuoteEdit",component:_s},{path:ge(449),name:ge(450),component:$h},{path:"/invoice/detail/:id",name:ge(453),component:Kg},{path:ge(438),name:ge(437),component:Lv},{path:ge(447),name:ge(446),component:bv}],$v=Xo({history:_o(),routes:zv});export{$v as r};
     10 */function Wn(t,e){var s=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),s.push.apply(s,a)}return s}function Te(t){for(var e=1;e<arguments.length;e++){var s=arguments[e]!=null?arguments[e]:{};e%2?Wn(Object(s),!0).forEach(function(a){qr(t,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(s)):Wn(Object(s)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(s,a))})}return t}function jt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?jt=function(e){return typeof e}:jt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jt(t)}function qr(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function qe(){return qe=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(t[a]=s[a])}return t},qe.apply(this,arguments)}function Rr(t,e){if(t==null)return{};var s={},a=Object.keys(t),n,o;for(o=0;o<a.length;o++)n=a[o],!(e.indexOf(n)>=0)&&(s[n]=t[n]);return s}function Or(t,e){if(t==null)return{};var s=Rr(t,e),a,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)a=o[n],!(e.indexOf(a)>=0)&&(!Object.prototype.propertyIsEnumerable.call(t,a)||(s[a]=t[a]))}return s}var Vr="1.15.2";function je(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var Re=je(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Et=je(/Edge/i),Qn=je(/firefox/i),ft=je(/safari/i)&&!je(/chrome/i)&&!je(/android/i),gs=je(/iP(ad|od|hone)/i),vs=je(/chrome/i)&&je(/android/i),ys={capture:!1,passive:!1};function Q(t,e,s){t.addEventListener(e,s,!Re&&ys)}function N(t,e,s){t.removeEventListener(e,s,!Re&&ys)}function Nt(t,e){if(!!e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function Nr(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function Ce(t,e,s,a){if(t){s=s||document;do{if(e!=null&&(e[0]===">"?t.parentNode===s&&Nt(t,e):Nt(t,e))||a&&t===s)return t;if(t===s)break}while(t=Nr(t))}return null}var Xn=/\s+/g;function fe(t,e,s){if(t&&e)if(t.classList)t.classList[s?"add":"remove"](e);else{var a=(" "+t.className+" ").replace(Xn," ").replace(" "+e+" "," ");t.className=(a+(s?" "+e:"")).replace(Xn," ")}}function S(t,e,s){var a=t&&t.style;if(a){if(s===void 0)return document.defaultView&&document.defaultView.getComputedStyle?s=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(s=t.currentStyle),e===void 0?s:s[e];!(e in a)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),a[e]=s+(typeof s=="string"?"":"px")}}function et(t,e){var s="";if(typeof t=="string")s=t;else do{var a=S(t,"transform");a&&a!=="none"&&(s=a+" "+s)}while(!e&&(t=t.parentNode));var n=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return n&&new n(s)}function bs(t,e,s){if(t){var a=t.getElementsByTagName(e),n=0,o=a.length;if(s)for(;n<o;n++)s(a[n],n);return a}return[]}function ke(){var t=document.scrollingElement;return t||document.documentElement}function te(t,e,s,a,n){if(!(!t.getBoundingClientRect&&t!==window)){var o,f,m,p,d,u,h;if(t!==window&&t.parentNode&&t!==ke()?(o=t.getBoundingClientRect(),f=o.top,m=o.left,p=o.bottom,d=o.right,u=o.height,h=o.width):(f=0,m=0,p=window.innerHeight,d=window.innerWidth,u=window.innerHeight,h=window.innerWidth),(e||s)&&t!==window&&(n=n||t.parentNode,!Re))do if(n&&n.getBoundingClientRect&&(S(n,"transform")!=="none"||s&&S(n,"position")!=="static")){var g=n.getBoundingClientRect();f-=g.top+parseInt(S(n,"border-top-width")),m-=g.left+parseInt(S(n,"border-left-width")),p=f+o.height,d=m+o.width;break}while(n=n.parentNode);if(a&&t!==window){var v=et(n||t),C=v&&v.a,E=v&&v.d;v&&(f/=E,m/=C,h/=C,u/=E,p=f+u,d=m+h)}return{top:f,left:m,bottom:p,right:d,width:h,height:u}}}function Un(t,e,s){for(var a=Qe(t,!0),n=te(t)[e];a;){var o=te(a)[s],f=void 0;if(s==="top"||s==="left"?f=n>=o:f=n<=o,!f)return a;if(a===ke())break;a=Qe(a,!1)}return!1}function st(t,e,s,a){for(var n=0,o=0,f=t.children;o<f.length;){if(f[o].style.display!=="none"&&f[o]!==A.ghost&&(a||f[o]!==A.dragged)&&Ce(f[o],s.draggable,t,!1)){if(n===e)return f[o];n++}o++}return null}function wn(t,e){for(var s=t.lastElementChild;s&&(s===A.ghost||S(s,"display")==="none"||e&&!Nt(s,e));)s=s.previousElementSibling;return s||null}function ge(t,e){var s=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==A.clone&&(!e||Nt(t,e))&&s++;return s}function Ln(t){var e=0,s=0,a=ke();if(t)do{var n=et(t),o=n.a,f=n.d;e+=t.scrollLeft*o,s+=t.scrollTop*f}while(t!==a&&(t=t.parentNode));return[e,s]}function Br(t,e){for(var s in t)if(!!t.hasOwnProperty(s)){for(var a in e)if(e.hasOwnProperty(a)&&e[a]===t[s][a])return Number(s)}return-1}function Qe(t,e){if(!t||!t.getBoundingClientRect)return ke();var s=t,a=!1;do if(s.clientWidth<s.scrollWidth||s.clientHeight<s.scrollHeight){var n=S(s);if(s.clientWidth<s.scrollWidth&&(n.overflowX=="auto"||n.overflowX=="scroll")||s.clientHeight<s.scrollHeight&&(n.overflowY=="auto"||n.overflowY=="scroll")){if(!s.getBoundingClientRect||s===document.body)return ke();if(a||e)return s;a=!0}}while(s=s.parentNode);return ke()}function Fr(t,e){if(t&&e)for(var s in e)e.hasOwnProperty(s)&&(t[s]=e[s]);return t}function tn(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var pt;function ws(t,e){return function(){if(!pt){var s=arguments,a=this;s.length===1?t.call(a,s[0]):t.apply(a,s),pt=setTimeout(function(){pt=void 0},e)}}}function Wr(){clearTimeout(pt),pt=void 0}function xs(t,e,s){t.scrollLeft+=e,t.scrollTop+=s}function Cs(t){var e=window.Polymer,s=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):s?s(t).clone(!0)[0]:t.cloneNode(!0)}function Is(t,e,s){var a={};return Array.from(t.children).forEach(function(n){var o,f,m,p;if(!(!Ce(n,e.draggable,t,!1)||n.animated||n===s)){var d=te(n);a.left=Math.min((o=a.left)!==null&&o!==void 0?o:1/0,d.left),a.top=Math.min((f=a.top)!==null&&f!==void 0?f:1/0,d.top),a.right=Math.max((m=a.right)!==null&&m!==void 0?m:-1/0,d.right),a.bottom=Math.max((p=a.bottom)!==null&&p!==void 0?p:-1/0,d.bottom)}}),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var _e="Sortable"+new Date().getTime();function Qr(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var a=[].slice.call(this.el.children);a.forEach(function(n){if(!(S(n,"display")==="none"||n===A.ghost)){t.push({target:n,rect:te(n)});var o=Te({},t[t.length-1].rect);if(n.thisAnimationDuration){var f=et(n,!0);f&&(o.top-=f.f,o.left-=f.e)}n.fromRect=o}})}},addAnimationState:function(a){t.push(a)},removeAnimationState:function(a){t.splice(Br(t,{target:a}),1)},animateAll:function(a){var n=this;if(!this.options.animation){clearTimeout(e),typeof a=="function"&&a();return}var o=!1,f=0;t.forEach(function(m){var p=0,d=m.target,u=d.fromRect,h=te(d),g=d.prevFromRect,v=d.prevToRect,C=m.rect,E=et(d,!0);E&&(h.top-=E.f,h.left-=E.e),d.toRect=h,d.thisAnimationDuration&&tn(g,h)&&!tn(u,h)&&(C.top-h.top)/(C.left-h.left)===(u.top-h.top)/(u.left-h.left)&&(p=Ur(C,g,v,n.options)),tn(h,u)||(d.prevFromRect=u,d.prevToRect=h,p||(p=n.options.animation),n.animate(d,C,h,p)),p&&(o=!0,f=Math.max(f,p),clearTimeout(d.animationResetTimer),d.animationResetTimer=setTimeout(function(){d.animationTime=0,d.prevFromRect=null,d.fromRect=null,d.prevToRect=null,d.thisAnimationDuration=null},p),d.thisAnimationDuration=p)}),clearTimeout(e),o?e=setTimeout(function(){typeof a=="function"&&a()},f):typeof a=="function"&&a(),t=[]},animate:function(a,n,o,f){if(f){S(a,"transition",""),S(a,"transform","");var m=et(this.el),p=m&&m.a,d=m&&m.d,u=(n.left-o.left)/(p||1),h=(n.top-o.top)/(d||1);a.animatingX=!!u,a.animatingY=!!h,S(a,"transform","translate3d("+u+"px,"+h+"px,0)"),this.forRepaintDummy=Xr(a),S(a,"transition","transform "+f+"ms"+(this.options.easing?" "+this.options.easing:"")),S(a,"transform","translate3d(0,0,0)"),typeof a.animated=="number"&&clearTimeout(a.animated),a.animated=setTimeout(function(){S(a,"transition",""),S(a,"transform",""),a.animated=!1,a.animatingX=!1,a.animatingY=!1},f)}}}}function Xr(t){return t.offsetWidth}function Ur(t,e,s,a){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-s.top,2)+Math.pow(e.left-s.left,2))*a.animation}var Ye=[],nn={initializeByDefault:!0},kt={mount:function(e){for(var s in nn)nn.hasOwnProperty(s)&&!(s in e)&&(e[s]=nn[s]);Ye.forEach(function(a){if(a.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")}),Ye.push(e)},pluginEvent:function(e,s,a){var n=this;this.eventCanceled=!1,a.cancel=function(){n.eventCanceled=!0};var o=e+"Global";Ye.forEach(function(f){!s[f.pluginName]||(s[f.pluginName][o]&&s[f.pluginName][o](Te({sortable:s},a)),s.options[f.pluginName]&&s[f.pluginName][e]&&s[f.pluginName][e](Te({sortable:s},a)))})},initializePlugins:function(e,s,a,n){Ye.forEach(function(m){var p=m.pluginName;if(!(!e.options[p]&&!m.initializeByDefault)){var d=new m(e,s,e.options);d.sortable=e,d.options=e.options,e[p]=d,qe(a,d.defaults)}});for(var o in e.options)if(!!e.options.hasOwnProperty(o)){var f=this.modifyOption(e,o,e.options[o]);typeof f!="undefined"&&(e.options[o]=f)}},getEventProperties:function(e,s){var a={};return Ye.forEach(function(n){typeof n.eventProperties=="function"&&qe(a,n.eventProperties.call(s[n.pluginName],e))}),a},modifyOption:function(e,s,a){var n;return Ye.forEach(function(o){!e[o.pluginName]||o.optionListeners&&typeof o.optionListeners[s]=="function"&&(n=o.optionListeners[s].call(e[o.pluginName],a))}),n}};function Lr(t){var e=t.sortable,s=t.rootEl,a=t.name,n=t.targetEl,o=t.cloneEl,f=t.toEl,m=t.fromEl,p=t.oldIndex,d=t.newIndex,u=t.oldDraggableIndex,h=t.newDraggableIndex,g=t.originalEvent,v=t.putSortable,C=t.extraEventProperties;if(e=e||s&&s[_e],!!e){var E,O=e.options,F="on"+a.charAt(0).toUpperCase()+a.substr(1);window.CustomEvent&&!Re&&!Et?E=new CustomEvent(a,{bubbles:!0,cancelable:!0}):(E=document.createEvent("Event"),E.initEvent(a,!0,!0)),E.to=f||s,E.from=m||s,E.item=n||s,E.clone=o,E.oldIndex=p,E.newIndex=d,E.oldDraggableIndex=u,E.newDraggableIndex=h,E.originalEvent=g,E.pullMode=v?v.lastPutMode:void 0;var P=Te(Te({},C),kt.getEventProperties(a,e));for(var q in P)E[q]=P[q];s&&s.dispatchEvent(E),O[F]&&O[F].call(e,E)}}var zr=["evt"],me=function(e,s){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=a.evt,o=Or(a,zr);kt.pluginEvent.bind(A)(e,s,Te({dragEl:b,parentEl:Y,ghostEl:M,rootEl:H,nextEl:He,lastDownEl:qt,cloneEl:G,cloneHidden:We,dragStarted:rt,putSortable:ae,activeSortable:A.active,originalEvent:n,oldIndex:$e,oldDraggableIndex:_t,newIndex:pe,newDraggableIndex:Fe,hideGhostForTarget:As,unhideGhostForTarget:Ss,cloneNowHidden:function(){We=!0},cloneNowShown:function(){We=!1},dispatchSortableEvent:function(m){ue({sortable:s,name:m,originalEvent:n})}},o))};function ue(t){Lr(Te({putSortable:ae,cloneEl:G,targetEl:b,rootEl:H,oldIndex:$e,oldDraggableIndex:_t,newIndex:pe,newDraggableIndex:Fe},t))}var b,Y,M,H,He,qt,G,We,$e,pe,_t,Fe,St,ae,Ze=!1,Bt=!1,Ft=[],Le,we,sn,on,zn,Hn,rt,Je,gt,vt=!1,Dt=!1,Rt,le,an=[],fn=!1,Wt=[],Gt=typeof document!="undefined",Pt=gs,Gn=Et||Re?"cssFloat":"float",Hr=Gt&&!vs&&!gs&&"draggable"in document.createElement("div"),Es=function(){if(!!Gt){if(Re)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),ks=function(e,s){var a=S(e),n=parseInt(a.width)-parseInt(a.paddingLeft)-parseInt(a.paddingRight)-parseInt(a.borderLeftWidth)-parseInt(a.borderRightWidth),o=st(e,0,s),f=st(e,1,s),m=o&&S(o),p=f&&S(f),d=m&&parseInt(m.marginLeft)+parseInt(m.marginRight)+te(o).width,u=p&&parseInt(p.marginLeft)+parseInt(p.marginRight)+te(f).width;if(a.display==="flex")return a.flexDirection==="column"||a.flexDirection==="column-reverse"?"vertical":"horizontal";if(a.display==="grid")return a.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&m.float&&m.float!=="none"){var h=m.float==="left"?"left":"right";return f&&(p.clear==="both"||p.clear===h)?"vertical":"horizontal"}return o&&(m.display==="block"||m.display==="flex"||m.display==="table"||m.display==="grid"||d>=n&&a[Gn]==="none"||f&&a[Gn]==="none"&&d+u>n)?"vertical":"horizontal"},Gr=function(e,s,a){var n=a?e.left:e.top,o=a?e.right:e.bottom,f=a?e.width:e.height,m=a?s.left:s.top,p=a?s.right:s.bottom,d=a?s.width:s.height;return n===m||o===p||n+f/2===m+d/2},Yr=function(e,s){var a;return Ft.some(function(n){var o=n[_e].options.emptyInsertThreshold;if(!(!o||wn(n))){var f=te(n),m=e>=f.left-o&&e<=f.right+o,p=s>=f.top-o&&s<=f.bottom+o;if(m&&p)return a=n}}),a},Ts=function(e){function s(o,f){return function(m,p,d,u){var h=m.options.group.name&&p.options.group.name&&m.options.group.name===p.options.group.name;if(o==null&&(f||h))return!0;if(o==null||o===!1)return!1;if(f&&o==="clone")return o;if(typeof o=="function")return s(o(m,p,d,u),f)(m,p,d,u);var g=(f?m:p).options.group.name;return o===!0||typeof o=="string"&&o===g||o.join&&o.indexOf(g)>-1}}var a={},n=e.group;(!n||jt(n)!="object")&&(n={name:n}),a.name=n.name,a.checkPull=s(n.pull,!0),a.checkPut=s(n.put),a.revertClone=n.revertClone,e.group=a},As=function(){!Es&&M&&S(M,"display","none")},Ss=function(){!Es&&M&&S(M,"display","")};Gt&&!vs&&document.addEventListener("click",function(t){if(Bt)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Bt=!1,!1},!0);var ze=function(e){if(b){e=e.touches?e.touches[0]:e;var s=Yr(e.clientX,e.clientY);if(s){var a={};for(var n in e)e.hasOwnProperty(n)&&(a[n]=e[n]);a.target=a.rootEl=s,a.preventDefault=void 0,a.stopPropagation=void 0,s[_e]._onDragOver(a)}}},Jr=function(e){b&&b.parentNode[_e]._isOutsideThisEl(e.target)};function A(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=qe({},e),t[_e]=this;var s={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return ks(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(f,m){f.setData("Text",m.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:A.supportPointer!==!1&&"PointerEvent"in window&&!ft,emptyInsertThreshold:5};kt.initializePlugins(this,t,s);for(var a in s)!(a in e)&&(e[a]=s[a]);Ts(e);for(var n in this)n.charAt(0)==="_"&&typeof this[n]=="function"&&(this[n]=this[n].bind(this));this.nativeDraggable=e.forceFallback?!1:Hr,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?Q(t,"pointerdown",this._onTapStart):(Q(t,"mousedown",this._onTapStart),Q(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(Q(t,"dragover",this),Q(t,"dragenter",this)),Ft.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),qe(this,Qr())}A.prototype={constructor:A,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&(Je=null)},_getDirection:function(e,s){return typeof this.options.direction=="function"?this.options.direction.call(this,e,s,b):this.options.direction},_onTapStart:function(e){if(!!e.cancelable){var s=this,a=this.el,n=this.options,o=n.preventOnFilter,f=e.type,m=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,p=(m||e).target,d=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||p,u=n.filter;if(oc(a),!b&&!(/mousedown|pointerdown/.test(f)&&e.button!==0||n.disabled)&&!d.isContentEditable&&!(!this.nativeDraggable&&ft&&p&&p.tagName.toUpperCase()==="SELECT")&&(p=Ce(p,n.draggable,a,!1),!(p&&p.animated)&&qt!==p)){if($e=ge(p),_t=ge(p,n.draggable),typeof u=="function"){if(u.call(this,e,p,this)){ue({sortable:s,rootEl:d,name:"filter",targetEl:p,toEl:a,fromEl:a}),me("filter",s,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(u&&(u=u.split(",").some(function(h){if(h=Ce(d,h.trim(),a,!1),h)return ue({sortable:s,rootEl:h,name:"filter",targetEl:p,fromEl:a,toEl:a}),me("filter",s,{evt:e}),!0}),u)){o&&e.cancelable&&e.preventDefault();return}n.handle&&!Ce(d,n.handle,a,!1)||this._prepareDragStart(e,m,p)}}},_prepareDragStart:function(e,s,a){var n=this,o=n.el,f=n.options,m=o.ownerDocument,p;if(a&&!b&&a.parentNode===o){var d=te(a);if(H=o,b=a,Y=b.parentNode,He=b.nextSibling,qt=a,St=f.group,A.dragged=b,Le={target:b,clientX:(s||e).clientX,clientY:(s||e).clientY},zn=Le.clientX-d.left,Hn=Le.clientY-d.top,this._lastX=(s||e).clientX,this._lastY=(s||e).clientY,b.style["will-change"]="all",p=function(){if(me("delayEnded",n,{evt:e}),A.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!Qn&&n.nativeDraggable&&(b.draggable=!0),n._triggerDragStart(e,s),ue({sortable:n,name:"choose",originalEvent:e}),fe(b,f.chosenClass,!0)},f.ignore.split(",").forEach(function(u){bs(b,u.trim(),ln)}),Q(m,"dragover",ze),Q(m,"mousemove",ze),Q(m,"touchmove",ze),Q(m,"mouseup",n._onDrop),Q(m,"touchend",n._onDrop),Q(m,"touchcancel",n._onDrop),Qn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,b.draggable=!0),me("delayStart",this,{evt:e}),f.delay&&(!f.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(Et||Re))){if(A.eventCanceled){this._onDrop();return}Q(m,"mouseup",n._disableDelayedDrag),Q(m,"touchend",n._disableDelayedDrag),Q(m,"touchcancel",n._disableDelayedDrag),Q(m,"mousemove",n._delayedDragTouchMoveHandler),Q(m,"touchmove",n._delayedDragTouchMoveHandler),f.supportPointer&&Q(m,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(p,f.delay)}else p()}},_delayedDragTouchMoveHandler:function(e){var s=e.touches?e.touches[0]:e;Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){b&&ln(b),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;N(e,"mouseup",this._disableDelayedDrag),N(e,"touchend",this._disableDelayedDrag),N(e,"touchcancel",this._disableDelayedDrag),N(e,"mousemove",this._delayedDragTouchMoveHandler),N(e,"touchmove",this._delayedDragTouchMoveHandler),N(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,s){s=s||e.pointerType=="touch"&&e,!this.nativeDraggable||s?this.options.supportPointer?Q(document,"pointermove",this._onTouchMove):s?Q(document,"touchmove",this._onTouchMove):Q(document,"mousemove",this._onTouchMove):(Q(b,"dragend",this),Q(H,"dragstart",this._onDragStart));try{document.selection?Ot(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,s){if(Ze=!1,H&&b){me("dragStarted",this,{evt:s}),this.nativeDraggable&&Q(document,"dragover",Jr);var a=this.options;!e&&fe(b,a.dragClass,!1),fe(b,a.ghostClass,!0),A.active=this,e&&this._appendGhost(),ue({sortable:this,name:"start",originalEvent:s})}else this._nulling()},_emulateDragOver:function(){if(we){this._lastX=we.clientX,this._lastY=we.clientY,As();for(var e=document.elementFromPoint(we.clientX,we.clientY),s=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(we.clientX,we.clientY),e!==s);)s=e;if(b.parentNode[_e]._isOutsideThisEl(e),s)do{if(s[_e]){var a=void 0;if(a=s[_e]._onDragOver({clientX:we.clientX,clientY:we.clientY,target:e,rootEl:s}),a&&!this.options.dragoverBubble)break}e=s}while(s=s.parentNode);Ss()}},_onTouchMove:function(e){if(Le){var s=this.options,a=s.fallbackTolerance,n=s.fallbackOffset,o=e.touches?e.touches[0]:e,f=M&&et(M,!0),m=M&&f&&f.a,p=M&&f&&f.d,d=Pt&&le&&Ln(le),u=(o.clientX-Le.clientX+n.x)/(m||1)+(d?d[0]-an[0]:0)/(m||1),h=(o.clientY-Le.clientY+n.y)/(p||1)+(d?d[1]-an[1]:0)/(p||1);if(!A.active&&!Ze){if(a&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<a)return;this._onDragStart(e,!0)}if(M){f?(f.e+=u-(sn||0),f.f+=h-(on||0)):f={a:1,b:0,c:0,d:1,e:u,f:h};var g="matrix(".concat(f.a,",").concat(f.b,",").concat(f.c,",").concat(f.d,",").concat(f.e,",").concat(f.f,")");S(M,"webkitTransform",g),S(M,"mozTransform",g),S(M,"msTransform",g),S(M,"transform",g),sn=u,on=h,we=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!M){var e=this.options.fallbackOnBody?document.body:H,s=te(b,!0,Pt,!0,e),a=this.options;if(Pt){for(le=e;S(le,"position")==="static"&&S(le,"transform")==="none"&&le!==document;)le=le.parentNode;le!==document.body&&le!==document.documentElement?(le===document&&(le=ke()),s.top+=le.scrollTop,s.left+=le.scrollLeft):le=ke(),an=Ln(le)}M=b.cloneNode(!0),fe(M,a.ghostClass,!1),fe(M,a.fallbackClass,!0),fe(M,a.dragClass,!0),S(M,"transition",""),S(M,"transform",""),S(M,"box-sizing","border-box"),S(M,"margin",0),S(M,"top",s.top),S(M,"left",s.left),S(M,"width",s.width),S(M,"height",s.height),S(M,"opacity","0.8"),S(M,"position",Pt?"absolute":"fixed"),S(M,"zIndex","100000"),S(M,"pointerEvents","none"),A.ghost=M,e.appendChild(M),S(M,"transform-origin",zn/parseInt(M.style.width)*100+"% "+Hn/parseInt(M.style.height)*100+"%")}},_onDragStart:function(e,s){var a=this,n=e.dataTransfer,o=a.options;if(me("dragStart",this,{evt:e}),A.eventCanceled){this._onDrop();return}me("setupClone",this),A.eventCanceled||(G=Cs(b),G.removeAttribute("id"),G.draggable=!1,G.style["will-change"]="",this._hideClone(),fe(G,this.options.chosenClass,!1),A.clone=G),a.cloneId=Ot(function(){me("clone",a),!A.eventCanceled&&(a.options.removeCloneOnHide||H.insertBefore(G,b),a._hideClone(),ue({sortable:a,name:"clone"}))}),!s&&fe(b,o.dragClass,!0),s?(Bt=!0,a._loopId=setInterval(a._emulateDragOver,50)):(N(document,"mouseup",a._onDrop),N(document,"touchend",a._onDrop),N(document,"touchcancel",a._onDrop),n&&(n.effectAllowed="move",o.setData&&o.setData.call(a,n,b)),Q(document,"drop",a),S(b,"transform","translateZ(0)")),Ze=!0,a._dragStartId=Ot(a._dragStarted.bind(a,s,e)),Q(document,"selectstart",a),rt=!0,ft&&S(document.body,"user-select","none")},_onDragOver:function(e){var s=this.el,a=e.target,n,o,f,m=this.options,p=m.group,d=A.active,u=St===p,h=m.sort,g=ae||d,v,C=this,E=!1;if(fn)return;function O(Pe,Yt){me(Pe,C,Te({evt:e,isOwner:u,axis:v?"vertical":"horizontal",revert:f,dragRect:n,targetRect:o,canSort:h,fromSortable:g,target:a,completed:P,onMove:function(ot,it){return Mt(H,s,b,n,ot,te(ot),e,it)},changed:q},Yt))}function F(){O("dragOverAnimationCapture"),C.captureAnimationState(),C!==g&&g.captureAnimationState()}function P(Pe){return O("dragOverCompleted",{insertion:Pe}),Pe&&(u?d._hideClone():d._showClone(C),C!==g&&(fe(b,ae?ae.options.ghostClass:d.options.ghostClass,!1),fe(b,m.ghostClass,!0)),ae!==C&&C!==A.active?ae=C:C===A.active&&ae&&(ae=null),g===C&&(C._ignoreWhileAnimating=a),C.animateAll(function(){O("dragOverAnimationComplete"),C._ignoreWhileAnimating=null}),C!==g&&(g.animateAll(),g._ignoreWhileAnimating=null)),(a===b&&!b.animated||a===s&&!a.animated)&&(Je=null),!m.dragoverBubble&&!e.rootEl&&a!==document&&(b.parentNode[_e]._isOutsideThisEl(e.target),!Pe&&ze(e)),!m.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),E=!0}function q(){pe=ge(b),Fe=ge(b,m.draggable),ue({sortable:C,name:"change",toEl:s,newIndex:pe,newDraggableIndex:Fe,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),a=Ce(a,m.draggable,s,!0),O("dragOver"),A.eventCanceled)return E;if(b.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||C._ignoreWhileAnimating===a)return P(!1);if(Bt=!1,d&&!m.disabled&&(u?h||(f=Y!==H):ae===this||(this.lastPutMode=St.checkPull(this,d,b,e))&&p.checkPut(this,d,b,e))){if(v=this._getDirection(e,a)==="vertical",n=te(b),O("dragOverValid"),A.eventCanceled)return E;if(f)return Y=H,F(),this._hideClone(),O("revert"),A.eventCanceled||(He?H.insertBefore(b,He):H.appendChild(b)),P(!0);var z=wn(s,m.draggable);if(!z||ec(e,v,this)&&!z.animated){if(z===b)return P(!1);if(z&&s===e.target&&(a=z),a&&(o=te(a)),Mt(H,s,b,n,a,o,e,!!a)!==!1)return F(),z&&z.nextSibling?s.insertBefore(b,z.nextSibling):s.appendChild(b),Y=s,q(),P(!0)}else if(z&&$r(e,v,this)){var ce=st(s,0,m,!0);if(ce===b)return P(!1);if(a=ce,o=te(a),Mt(H,s,b,n,a,o,e,!1)!==!1)return F(),s.insertBefore(b,ce),Y=s,q(),P(!0)}else if(a.parentNode===s){o=te(a);var ne=0,Z,Ue=b.parentNode!==s,ie=!Gr(b.animated&&b.toRect||n,a.animated&&a.toRect||o,v),Oe=v?"top":"left",ye=Un(a,"top","top")||Un(b,"top","top"),Ve=ye?ye.scrollTop:void 0;Je!==a&&(Z=o[Oe],vt=!1,Dt=!ie&&m.invertSwap||Ue),ne=tc(e,a,o,v,ie?1:m.swapThreshold,m.invertedSwapThreshold==null?m.swapThreshold:m.invertedSwapThreshold,Dt,Je===a);var de;if(ne!==0){var Ae=ge(b);do Ae-=ne,de=Y.children[Ae];while(de&&(S(de,"display")==="none"||de===M))}if(ne===0||de===a)return P(!1);Je=a,gt=ne;var Se=a.nextElementSibling,be=!1;be=ne===1;var De=Mt(H,s,b,n,a,o,e,be);if(De!==!1)return(De===1||De===-1)&&(be=De===1),fn=!0,setTimeout(Zr,30),F(),be&&!Se?s.appendChild(b):a.parentNode.insertBefore(b,be?Se:a),ye&&xs(ye,0,Ve-ye.scrollTop),Y=b.parentNode,Z!==void 0&&!Dt&&(Rt=Math.abs(Z-te(a)[Oe])),q(),P(!0)}if(s.contains(b))return P(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){N(document,"mousemove",this._onTouchMove),N(document,"touchmove",this._onTouchMove),N(document,"pointermove",this._onTouchMove),N(document,"dragover",ze),N(document,"mousemove",ze),N(document,"touchmove",ze)},_offUpEvents:function(){var e=this.el.ownerDocument;N(e,"mouseup",this._onDrop),N(e,"touchend",this._onDrop),N(e,"pointerup",this._onDrop),N(e,"touchcancel",this._onDrop),N(document,"selectstart",this)},_onDrop:function(e){var s=this.el,a=this.options;if(pe=ge(b),Fe=ge(b,a.draggable),me("drop",this,{evt:e}),Y=b&&b.parentNode,pe=ge(b),Fe=ge(b,a.draggable),A.eventCanceled){this._nulling();return}Ze=!1,Dt=!1,vt=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),pn(this.cloneId),pn(this._dragStartId),this.nativeDraggable&&(N(document,"drop",this),N(s,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),ft&&S(document.body,"user-select",""),S(b,"transform",""),e&&(rt&&(e.cancelable&&e.preventDefault(),!a.dropBubble&&e.stopPropagation()),M&&M.parentNode&&M.parentNode.removeChild(M),(H===Y||ae&&ae.lastPutMode!=="clone")&&G&&G.parentNode&&G.parentNode.removeChild(G),b&&(this.nativeDraggable&&N(b,"dragend",this),ln(b),b.style["will-change"]="",rt&&!Ze&&fe(b,ae?ae.options.ghostClass:this.options.ghostClass,!1),fe(b,this.options.chosenClass,!1),ue({sortable:this,name:"unchoose",toEl:Y,newIndex:null,newDraggableIndex:null,originalEvent:e}),H!==Y?(pe>=0&&(ue({rootEl:Y,name:"add",toEl:Y,fromEl:H,originalEvent:e}),ue({sortable:this,name:"remove",toEl:Y,originalEvent:e}),ue({rootEl:Y,name:"sort",toEl:Y,fromEl:H,originalEvent:e}),ue({sortable:this,name:"sort",toEl:Y,originalEvent:e})),ae&&ae.save()):pe!==$e&&pe>=0&&(ue({sortable:this,name:"update",toEl:Y,originalEvent:e}),ue({sortable:this,name:"sort",toEl:Y,originalEvent:e})),A.active&&((pe==null||pe===-1)&&(pe=$e,Fe=_t),ue({sortable:this,name:"end",toEl:Y,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){me("nulling",this),H=b=Y=M=He=G=qt=We=Le=we=rt=pe=Fe=$e=_t=Je=gt=ae=St=A.dragged=A.ghost=A.clone=A.active=null,Wt.forEach(function(e){e.checked=!0}),Wt.length=sn=on=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":b&&(this._onDragOver(e),Kr(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],s,a=this.el.children,n=0,o=a.length,f=this.options;n<o;n++)s=a[n],Ce(s,f.draggable,this.el,!1)&&e.push(s.getAttribute(f.dataIdAttr)||sc(s));return e},sort:function(e,s){var a={},n=this.el;this.toArray().forEach(function(o,f){var m=n.children[f];Ce(m,this.options.draggable,n,!1)&&(a[o]=m)},this),s&&this.captureAnimationState(),e.forEach(function(o){a[o]&&(n.removeChild(a[o]),n.appendChild(a[o]))}),s&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,s){return Ce(e,s||this.options.draggable,this.el,!1)},option:function(e,s){var a=this.options;if(s===void 0)return a[e];var n=kt.modifyOption(this,e,s);typeof n!="undefined"?a[e]=n:a[e]=s,e==="group"&&Ts(a)},destroy:function(){me("destroy",this);var e=this.el;e[_e]=null,N(e,"mousedown",this._onTapStart),N(e,"touchstart",this._onTapStart),N(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(N(e,"dragover",this),N(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),function(s){s.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Ft.splice(Ft.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!We){if(me("hideClone",this),A.eventCanceled)return;S(G,"display","none"),this.options.removeCloneOnHide&&G.parentNode&&G.parentNode.removeChild(G),We=!0}},_showClone:function(e){if(e.lastPutMode!=="clone"){this._hideClone();return}if(We){if(me("showClone",this),A.eventCanceled)return;b.parentNode==H&&!this.options.group.revertClone?H.insertBefore(G,b):He?H.insertBefore(G,He):H.appendChild(G),this.options.group.revertClone&&this.animate(b,G),S(G,"display",""),We=!1}}};function Kr(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function Mt(t,e,s,a,n,o,f,m){var p,d=t[_e],u=d.options.onMove,h;return window.CustomEvent&&!Re&&!Et?p=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent("move",!0,!0)),p.to=e,p.from=t,p.dragged=s,p.draggedRect=a,p.related=n||e,p.relatedRect=o||te(e),p.willInsertAfter=m,p.originalEvent=f,t.dispatchEvent(p),u&&(h=u.call(d,p,f)),h}function ln(t){t.draggable=!1}function Zr(){fn=!1}function $r(t,e,s){var a=te(st(s.el,0,s.options,!0)),n=Is(s.el,s.options,M),o=10;return e?t.clientX<n.left-o||t.clientY<a.top&&t.clientX<a.right:t.clientY<n.top-o||t.clientY<a.bottom&&t.clientX<a.left}function ec(t,e,s){var a=te(wn(s.el,s.options.draggable)),n=Is(s.el,s.options,M),o=10;return e?t.clientX>n.right+o||t.clientY>a.bottom&&t.clientX>a.left:t.clientY>n.bottom+o||t.clientX>a.right&&t.clientY>a.top}function tc(t,e,s,a,n,o,f,m){var p=a?t.clientY:t.clientX,d=a?s.height:s.width,u=a?s.top:s.left,h=a?s.bottom:s.right,g=!1;if(!f){if(m&&Rt<d*n){if(!vt&&(gt===1?p>u+d*o/2:p<h-d*o/2)&&(vt=!0),vt)g=!0;else if(gt===1?p<u+Rt:p>h-Rt)return-gt}else if(p>u+d*(1-n)/2&&p<h-d*(1-n)/2)return nc(e)}return g=g||f,g&&(p<u+d*o/2||p>h-d*o/2)?p>u+d/2?1:-1:0}function nc(t){return ge(b)<ge(t)?1:-1}function sc(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,s=e.length,a=0;s--;)a+=e.charCodeAt(s);return a.toString(36)}function oc(t){Wt.length=0;for(var e=t.getElementsByTagName("input"),s=e.length;s--;){var a=e[s];a.checked&&Wt.push(a)}}function Ot(t){return setTimeout(t,0)}function pn(t){return clearTimeout(t)}Gt&&Q(document,"touchmove",function(t){(A.active||Ze)&&t.cancelable&&t.preventDefault()});A.utils={on:Q,off:N,css:S,find:bs,is:function(e,s){return!!Ce(e,s,e,!1)},extend:Fr,throttle:ws,closest:Ce,toggleClass:fe,clone:Cs,index:ge,nextTick:Ot,cancelNextTick:pn,detectDirection:ks,getChild:st};A.get=function(t){return t[_e]};A.mount=function(){for(var t=arguments.length,e=new Array(t),s=0;s<t;s++)e[s]=arguments[s];e[0].constructor===Array&&(e=e[0]),e.forEach(function(a){if(!a.prototype||!a.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(a));a.utils&&(A.utils=Te(Te({},A.utils),a.utils)),kt.mount(a)})};A.create=function(t,e){return new A(t,e)};A.version=Vr;var ee=[],ct,_n,gn=!1,rn,cn,Qt,dt;function ic(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(s){var a=s.originalEvent;this.sortable.nativeDraggable?Q(document,"dragover",this._handleAutoScroll):this.options.supportPointer?Q(document,"pointermove",this._handleFallbackAutoScroll):a.touches?Q(document,"touchmove",this._handleFallbackAutoScroll):Q(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(s){var a=s.originalEvent;!this.options.dragOverBubble&&!a.rootEl&&this._handleAutoScroll(a)},drop:function(){this.sortable.nativeDraggable?N(document,"dragover",this._handleAutoScroll):(N(document,"pointermove",this._handleFallbackAutoScroll),N(document,"touchmove",this._handleFallbackAutoScroll),N(document,"mousemove",this._handleFallbackAutoScroll)),Yn(),Vt(),Wr()},nulling:function(){Qt=_n=ct=gn=dt=rn=cn=null,ee.length=0},_handleFallbackAutoScroll:function(s){this._handleAutoScroll(s,!0)},_handleAutoScroll:function(s,a){var n=this,o=(s.touches?s.touches[0]:s).clientX,f=(s.touches?s.touches[0]:s).clientY,m=document.elementFromPoint(o,f);if(Qt=s,a||this.options.forceAutoScrollFallback||Et||Re||ft){dn(s,this.options,m,a);var p=Qe(m,!0);gn&&(!dt||o!==rn||f!==cn)&&(dt&&Yn(),dt=setInterval(function(){var d=Qe(document.elementFromPoint(o,f),!0);d!==p&&(p=d,Vt()),dn(s,n.options,d,a)},10),rn=o,cn=f)}else{if(!this.options.bubbleScroll||Qe(m,!0)===ke()){Vt();return}dn(s,this.options,Qe(m,!1),!1)}}},qe(t,{pluginName:"scroll",initializeByDefault:!0})}function Vt(){ee.forEach(function(t){clearInterval(t.pid)}),ee=[]}function Yn(){clearInterval(dt)}var dn=ws(function(t,e,s,a){if(!!e.scroll){var n=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,f=e.scrollSensitivity,m=e.scrollSpeed,p=ke(),d=!1,u;_n!==s&&(_n=s,Vt(),ct=e.scroll,u=e.scrollFn,ct===!0&&(ct=Qe(s,!0)));var h=0,g=ct;do{var v=g,C=te(v),E=C.top,O=C.bottom,F=C.left,P=C.right,q=C.width,z=C.height,ce=void 0,ne=void 0,Z=v.scrollWidth,Ue=v.scrollHeight,ie=S(v),Oe=v.scrollLeft,ye=v.scrollTop;v===p?(ce=q<Z&&(ie.overflowX==="auto"||ie.overflowX==="scroll"||ie.overflowX==="visible"),ne=z<Ue&&(ie.overflowY==="auto"||ie.overflowY==="scroll"||ie.overflowY==="visible")):(ce=q<Z&&(ie.overflowX==="auto"||ie.overflowX==="scroll"),ne=z<Ue&&(ie.overflowY==="auto"||ie.overflowY==="scroll"));var Ve=ce&&(Math.abs(P-n)<=f&&Oe+q<Z)-(Math.abs(F-n)<=f&&!!Oe),de=ne&&(Math.abs(O-o)<=f&&ye+z<Ue)-(Math.abs(E-o)<=f&&!!ye);if(!ee[h])for(var Ae=0;Ae<=h;Ae++)ee[Ae]||(ee[Ae]={});(ee[h].vx!=Ve||ee[h].vy!=de||ee[h].el!==v)&&(ee[h].el=v,ee[h].vx=Ve,ee[h].vy=de,clearInterval(ee[h].pid),(Ve!=0||de!=0)&&(d=!0,ee[h].pid=setInterval(function(){a&&this.layer===0&&A.active._onTouchMove(Qt);var Se=ee[this.layer].vy?ee[this.layer].vy*m:0,be=ee[this.layer].vx?ee[this.layer].vx*m:0;typeof u=="function"&&u.call(A.dragged.parentNode[_e],be,Se,t,Qt,ee[this.layer].el)!=="continue"||xs(ee[this.layer].el,be,Se)}.bind({layer:h}),24))),h++}while(e.bubbleScroll&&g!==p&&(g=Qe(g,!1)));gn=d}},30),Ds=function(e){var s=e.originalEvent,a=e.putSortable,n=e.dragEl,o=e.activeSortable,f=e.dispatchSortableEvent,m=e.hideGhostForTarget,p=e.unhideGhostForTarget;if(!!s){var d=a||o;m();var u=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,h=document.elementFromPoint(u.clientX,u.clientY);p(),d&&!d.el.contains(h)&&(f("spill"),this.onSpill({dragEl:n,putSortable:a}))}};function xn(){}xn.prototype={startIndex:null,dragStart:function(e){var s=e.oldDraggableIndex;this.startIndex=s},onSpill:function(e){var s=e.dragEl,a=e.putSortable;this.sortable.captureAnimationState(),a&&a.captureAnimationState();var n=st(this.sortable.el,this.startIndex,this.options);n?this.sortable.el.insertBefore(s,n):this.sortable.el.appendChild(s),this.sortable.animateAll(),a&&a.animateAll()},drop:Ds};qe(xn,{pluginName:"revertOnSpill"});function Cn(){}Cn.prototype={onSpill:function(e){var s=e.dragEl,a=e.putSortable,n=a||this.sortable;n.captureAnimationState(),s.parentNode&&s.parentNode.removeChild(s),n.animateAll()},drop:Ds};qe(Cn,{pluginName:"removeOnSpill"});A.mount(new ic);A.mount(Cn,xn);const ac={name:"QuoteViewDetail",components:{Card:Xe,QuoteNavBar:mr,EditItemModal:jr,RemoveModal:xt},data(){return{selectedItem:null,selectedInvoiceId:null,editItemsModal:!1,no_items:!0,loading:!0,loading_add:!1,quote:[],quoteItems:[],newItem:{loading_del:!1,item_ref:"",item_name:"",item_category:"Type",item_description:"",quantity:1,vat_rate:0,unit_price:0,discount:0,total_price:0,total_amount:0},vatRate:0,settings:[],list_vats:[],client_detail:[],client_email:null,client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},articles:[],categories:[],showDropdown:!1,refs:[],showDropdownRef:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},isQuoteExpired(){const t=new Date().getTime(),e=this.quote.due_date?new Date(this.quote.due_date).getTime():null;return e&&e<t},totalAmountWithoutDiscount(){const t=this.quoteItems.reduce((e,s)=>{const a=s.quantity*s.unit_price;return e+a},0);return this.formatCurrency(t)},totalAmount(){const t=this.quoteItems.reduce((e,s)=>e+parseFloat(s.total_price),0);return this.formatCurrency(t)},totalAmountDefaultCurrency(){return(this.quoteItems.reduce((a,n)=>a+parseFloat(n.total_amount),0)*this.quote.exchange_rate).toFixed(2)},totalAmountWithVAT(){const t=parseFloat(this.totalAmount);if(this.settings.vat_active==1){const e=parseFloat(this.calculateVAT());return this.formatCurrency(t+e)}else return this.formatCurrency(t)},signatureImageUrl(){const t="/wp-json/my-easy-compta/v1/signature-image/",e=myEasyComptaAdmin.nonce;return`${t}${this.quote.file_sign}?_wpnonce=${e}`}},methods:{getUniqueVATRates(){const t=new Set;return this.quoteItems.forEach(e=>{e.vat_rate&&t.add(e.vat_rate)}),Array.from(t)},calculateVATForRate(t){let e=0;return this.quoteItems.forEach(s=>{if(s.vat_rate===t){const a=s.quantity*s.unit_price,n=a*s.discount/100;e+=(a-n)*t/100}}),this.formatCurrency(e)},calculateTotalAmountWithVAT(){let t=this.quoteItems.reduce((e,s)=>e+parseFloat(s.total_amount),0);return this.formatCurrency(t)},fetchQuote(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t?(this.quote=t,this.fetchClientInfo(t.client_id)):console.error("Quote not found")}).catch(t=>{console.error("Error fetching quote:",t),this.loading=!1})},fetchClientInfo(t){fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.client_email=e.email;const s=e.currency_id;s&&this.fetchCurrencyDetails(s)}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},fetchItems(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/${this.$route.params.id}/items`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t.code=="no_items_found"?(console.error("No items found"),this.quoteItems=[],this.loading=!1,this.no_items=!0):(this.quoteItems=t,this.loading=!1,this.no_items=!1)}).catch(t=>{console.error("Error fetching items:",t),this.loading=!1})},fetchCurrencyDetails(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/settings/currency/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Currency details not found");return this.loading=!1,e.json()}).then(e=>{this.client_currency=e.symbol,this.loading=!1}).catch(e=>{this.loading=!1,console.error("Error fetching currency details:",e)})},updateTotal(){const t=this.newItem.quantity*this.newItem.unit_price,e=t*this.newItem.discount/100,s=t-e;var a=0;if(this.settings.vat_active==1){const n=s*this.newItem.vat_rate/100;a=s+n}else a=s;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(a)},calculateTotalWithVat(t,e,s,a){const n=t*e,o=n*a/100,f=n-o,m=f*s/100,p=f+m;return this.formatCurrency(p)},calculateTotal(t,e,s){const a=t*e,n=a*s/100,f=a-n;return this.formatCurrency(f)},submitItems(){this.updateTotal();const t={...this.newItem,quote_id:this.$route.params.id};this.loading_add=!0,fetch("/wp-json/my-easy-compta/v1/quotes/element-add",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(t)}).then(e=>e.json()).then(e=>{e.success?(this.loading_add=!1,this.fetchItems(),this.newItem={item_name:"",item_ref:"",item_category:"",item_description:"",quantity:1,vat_rate:this.default_vat.rate,unit_price:0,discount:0,total_price:0,total_amount:0}):(this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e.message),this.loading_add=!1)}).catch(e=>{this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e),this.loading_add=!1})},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--},confirmremoveItem(t,e){this.selectedItem=t,this.selectedInvoiceId=e,modal_remove.showModal(),this.showRemoveModal=!0},removeItem(t,e){const s=this.quoteItems.find(a=>a.id===t);s.loading_del=!0,fetch(`/wp-json/my-easy-compta/v1/quotes/element-delete/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({quote_id:e})}).then(a=>a.json()).then(a=>{a.success?(s.loading_del=!1,this.fetchItems()):(this.showToast(a.message,"alert-error"),console.error("Error removing item:",a.message),s.loading_del=!1)}).catch(a=>{this.showToast(a.message,"alert-error"),console.error("Error removing item:",a),s.loading_del=!1})},editItem(t){this.loadingModal=!0,this.editItemsModal=!0,modal_edit_item.showModal(),this.fetchItemDetails(t)},fetchItemDetails(t){fetch(`/wp-json/my-easy-compta/v1/quotes/item-details/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedItem=e,this.loading=!1}).catch(e=>{console.error("Error fetching item details:",e),this.loading=!1})},formatCurrency(t){const e=t.toFixed(2),s=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${e}${s}`},calculateDiscountAmountWithVAT(t,e,s,a){const o=t*e*a/100,f=o*s/100,m=o+f;return this.formatCurrency(m)},calculateDiscountAmount(t,e,s){const o=t*e*s/100;return this.formatCurrency(o)},calculateVAT(){const t=parseFloat(this.totalAmount),e=parseFloat(this.default_vat.rate),s=t*(e/100);return this.formatCurrency(s)},onDragEnd(t){const e=this.quoteItems[t.oldIndex];this.quoteItems.splice(t.oldIndex,1),this.quoteItems.splice(t.newIndex,0,e);const s=this.quoteItems.map(a=>a.id);this.saveOrderToDatabase(s)},nl2br(t){return t?t.replace(/\n/g,"<br>"):""},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},saveOrderToDatabase(t){fetch("/wp-json/my-easy-compta/v1/quotes/update-quote-items-order",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({order:t})}).then(e=>{e.ok?console.log("Order saved successfully."):console.error("Failed to save order:",e.statusText)}).catch(e=>{console.error("Error saving order:",e)})},fetchCategoriesArticles(){fetch("/wp-json/my-easy-compta/v1/categories-articles",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.categories=t}).catch(t=>console.error("Error fetching categories:",t))},fetchArticles(){if(this.newItem.item_name.length<1){this.articles=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_name}&method=name`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.articles=t}).catch(t=>console.error("Error fetching articles:",t))},selectItem(t){this.newItem.item_ref=t.ref,this.newItem.item_name=t.name,this.newItem.item_description=t.description,this.newItem.unit_price=t.unit_price,this.showDropdown=!1,this.showDropdownRef=!1},fetchRefs(){if(this.newItem.item_ref.length<1){this.refs=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_ref}&method=ref`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.refs=t}).catch(t=>console.error("Error fetching refrences:",t))},async loadSettings(){try{this.loading=!0,this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s,listVatData:a}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.list_vats=a,this.newItem.vat_rate=this.default_vat.rate,this.loadingPrice=!1,this.loading=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1,this.loading=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},highlightMatch(t){if(!this.newItem.item_name)return t;const e=new RegExp(`(${this.escapeRegExp(this.newItem.item_name)})`,"gi");return t.replace(e,"<b>$1</b>")},escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},handleClickOutside(t){this.$el.contains(t.target)||(this.showDropdown=!1,this.showDropdownRef=!1)}},beforeDestroy(){document.removeEventListener("click",this.handleClickOutside)},mounted(){this.fetchQuote(),this.fetchItems(),this.loadSettings(),this.fetchCategoriesArticles(),document.addEventListener("click",this.handleClickOutside);const t=document.querySelector("tbody");A.create(t,{animation:150,handle:".drag-handle",onEnd:this.onDragEnd})}},lc={class:"pt-2 pr-4"},rc={key:1,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},cc=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),dc=[cc],uc={key:2},hc={role:"alert",class:"alert alert-warning"},mc=i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),fc={key:0,class:"relative"},pc={class:"ecwp-watermark"},_c={class:"grid grid-cols-2"},gc={class:"md:col-span-1"},vc=["src"],yc={class:"md:col-span-1 text-right"},bc={class:"text-lg font-semibold"},wc={key:0,class:"badge badge-warning text-white"},xc={key:1,class:"badge badge-secondary text-white"},Cc={key:2,class:"badge badge-success text-white"},Ic={key:3,class:"badge badge-error text-white"},Ec={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},kc=i("br",null,null,-1),Tc=i("br",null,null,-1),Ac=i("br",null,null,-1),Sc=["href"],Dc=i("br",null,null,-1),Pc=i("br",null,null,-1),Mc=i("br",null,null,-1),jc=["href"],qc=i("br",null,null,-1),Rc=["href"],Oc={class:"table mt-8"},Vc=i("th",null,null,-1),Nc={width:"5%"},Bc={width:"19%"},Fc={width:"21%"},Wc={width:"10%",class:"text-center"},Qc={width:"8%",class:"text-center"},Xc={key:0,width:"5%",class:"text-center"},Uc={key:1,width:"5%"},Lc={width:"10%",class:"text-center"},zc={width:"10%",class:"text-right"},Hc=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),Gc=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),Yc={key:0,class:"badge badge-ghost badge-xs"},Jc=["innerHTML"],Kc={class:"text-center"},Zc={class:"text-center"},$c={key:0},ed={key:1},td={key:0,class:"text-center"},nd={key:1},sd={key:2,class:"text-center"},od=i("br",null,null,-1),id={key:3,class:"text-center"},ad=i("br",null,null,-1),ld={class:"text-right"},rd={key:0},cd={key:1},dd=["data-tip"],ud=["onClick"],hd=i("i",{class:"far fa-edit"},null,-1),md=[hd],fd=["data-tip"],pd=["onClick"],_d={key:0,class:"far fa-trash-alt"},gd={key:1,class:"loading loading-spinner loading-xs"},vd={key:0},yd=i("td",{class:"px-2"},null,-1),bd={class:"align-top px-2"},wd={class:"flex items-center border rounded-md relative"},xd=["placeholder"],Cd={key:0,class:"autocomplete-dropdown bg-base-300"},Id=["onClick","innerHTML"],Ed={class:"align-top px-2"},kd=i("option",{disabled:"",selected:""},"Type",-1),Td=["value"],Ad={class:"flex items-center border rounded-md relative"},Sd=["placeholder"],Dd={key:0,class:"autocomplete-dropdown bg-base-300"},Pd=["onClick","innerHTML"],Md={class:"align-top"},jd={class:"flex items-center rounded-md"},qd=["placeholder"],Rd={class:"align-top"},Od={class:"flex items-center border rounded-lg"},Vd={class:"inline-flex"},Nd=["placeholder"],Bd={class:"align-top"},Fd={class:"flex items-center border rounded-md"},Wd=["placeholder"],Qd={key:0,class:"align-top"},Xd=["value"],Ud={key:1,class:"align-top"},Ld={class:"align-top"},zd={class:"flex items-center border rounded-md"},Hd=["placeholder"],Gd=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),Yd={key:2,class:"text-right"},Jd={key:3,class:"text-right"},Kd=["data-tip"],Zd={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},$d={key:0,class:"fa fa-plus"},eu={key:1,class:"loading loading-spinner loading-xs"},tu={colspan:"8",class:"text-right no-border"},nu={class:"text-right"},su={key:0,class:"line-through"},ou=i("td",null,null,-1),iu={colspan:"8",class:"text-right no-border"},au={class:"text-right"},lu=i("td",null,null,-1),ru={colspan:"8",class:"text-right no-border font-bold text-xl"},cu={class:"text-right no-border font-bold text-xl"},du=i("td",null,null,-1),uu={key:2},hu={colspan:"8",class:"text-right no-border"},mu={class:"text-right no-border"},fu={key:3},pu={colspan:"8",class:"text-right no-border"},_u={class:"text-right no-border font-bold text-xl"},gu={key:1,class:"relative"},vu={class:"flex justify-end mt-4"},yu={class:"border-2 border-slate-300 max-w-md"},bu=["src"];function wu(t,e,s,a,n,o){const f=j("QuoteNavBar"),m=j("remove-modal"),p=j("edit-item-modal"),d=j("Card");return r(),c("div",lc,[D(f,{quoteInfo:n.quote,emailActive:n.settings.easy_compta_email_addon_active,advanceActive:n.settings.easy_compta_advance_addon_active,currency:n.default_currency_symbol,noItems:n.no_items},null,8,["quoteInfo","emailActive","advanceActive","currency","noItems"]),n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(m,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=u=>this.removeItem(n.selectedItem,n.selectedInvoiceId)),onCancel:e[1]||(e[1]=u=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(r(),c("div",rc,dc)):_("",!0),o.isQuoteExpired&&n.quote.status=="pending"?(r(),c("div",uc,[i("div",hc,[mc,i("span",null,l(o.translations.quote_expired),1)])])):_("",!0),D(d,{topMargin:"mt-8",id:"quote-content"},{default:re(()=>[n.settings.easy_compta_signature_addon_active&&n.quote.signed==1?(r(),c("div",fc,[i("span",pc,l(o.translations.signed),1)])):_("",!0),i("div",_c,[i("div",gc,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,vc)])]),i("div",yc,[i("p",bc,l(n.quote.quote_number),1),i("div",null,[w(l(o.translations.created_at)+": ",1),i("strong",null,l(n.quote.created_at),1)]),i("div",null,[w(l(o.translations.due_date)+": ",1),i("strong",null,l(n.quote.due_date),1)]),i("div",null,[w(l(o.translations.provisional_date)+": ",1),i("strong",null,l(n.quote.provisional_start_date),1)]),i("div",null,[w(l(o.translations.status)+": ",1),n.quote.status=="draft"?(r(),c("span",wc,l(o.translations.draft),1)):_("",!0),n.quote.status=="pending"?(r(),c("span",xc,l(o.translations.pending),1)):_("",!0),n.quote.status=="approved"?(r(),c("span",Cc,l(o.translations.approved),1)):_("",!0),n.quote.status=="rejected"?(r(),c("span",Ic,l(o.translations.rejected),1)):_("",!0)])])]),i("div",Ec,[i("div",null,[i("strong",null,l(o.translations.bill_to)+":",1),i("h4",null,[i("strong",null,l(n.client_detail.company_name),1)]),i("p",null,[w(l(n.client_detail.address),1),kc,w(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),Tc,w(" "+l(n.client_detail.country),1),Ac,n.client_detail.phone?(r(),c("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Sc)):_("",!0)])]),i("div",null,[i("strong",null,l(o.translations.received_from)+":",1),i("h4",null,[i("strong",null,l(n.settings.company_name),1)]),i("p",null,[w(l(n.settings.company_address),1),Dc,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Pc,w(" "+l(n.settings.country),1),Mc,n.settings.company_phone?(r(),c("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,jc)):_("",!0),qc,n.settings.mobile_phone?(r(),c("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Rc)):_("",!0)])])]),D(p,{loading:t.loadingModal,"show-modal":n.editItemsModal,"modal-id":"modal_edit_item","modal-title":o.translations.edit_item,item:n.selectedItem,onClose:e[2]||(e[2]=u=>n.editItemsModal=!1),onItemEdited:o.fetchItems},null,8,["loading","show-modal","modal-title","item","onItemEdited"]),i("form",{onSubmit:e[22]||(e[22]=K((...u)=>o.submitItems&&o.submitItems(...u),["prevent"]))},[i("table",Oc,[i("thead",null,[i("tr",null,[Vc,i("th",Nc,l(o.translations.item_ref),1),i("th",Bc,l(o.translations.item_name),1),i("th",Fc,l(o.translations.description),1),i("th",Wc,l(o.translations.quantity),1),i("th",Qc,l(o.translations.unit_price),1),n.settings.vat_active==1?(r(),c("th",Xc,l(o.translations.vat),1)):(r(),c("th",Uc)),i("th",Lc,l(o.translations.discount),1),i("th",zc,l(o.translations.total),1),Hc])]),i("tbody",null,[(r(!0),c(W,null,X(n.quoteItems,(u,h)=>(r(),c("tr",{key:u.id||h},[Gc,i("td",null,l(u.item_ref),1),i("td",null,[u.category_name?(r(),c("div",Yc,l(u.category_name),1)):_("",!0),i("div",null,l(u.item_name),1)]),i("td",{innerHTML:o.nl2br(u.item_description)},null,8,Jc),i("td",Kc,l(u.quantity),1),i("td",Zc,[w(l(u.unit_price),1),n.default_currency_symbol==n.client_currency?(r(),c("span",$c,l(n.default_currency_symbol),1)):(r(),c("span",ed,l(n.client_currency),1))]),n.settings.vat_active==1?(r(),c("td",td,l(u.vat_rate)+"% ",1)):(r(),c("td",nd)),n.settings.vat_active==1?(r(),c("td",sd,[w(l(u.discount)+"% ",1),od,w(" "+l(o.calculateDiscountAmountWithVAT(u.quantity,u.unit_price,u.vat_rate,u.discount)),1)])):(r(),c("td",id,[w(l(u.discount)+"% ",1),ad,w(" "+l(o.calculateDiscountAmount(u.quantity,u.unit_price,u.discount)),1)])),i("td",ld,[w(l(u.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(r(),c("span",rd,l(n.default_currency_symbol),1)):(r(),c("span",cd,l(n.client_currency),1))]),i("td",null,[n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:K(g=>o.editItem(u.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},md,8,ud)],8,dd)):_("",!0),n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:K(g=>o.confirmremoveItem(u.id,n.quote.id),["prevent"]),class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 mx-2 rounded"},[u.loading_del?_("",!0):(r(),c("i",_d)),u.loading_del?(r(),c("span",gd)):_("",!0)],8,pd)],8,fd)):_("",!0)])]))),128)),n.quote.status=="draft"||n.quote.status=="pending"?(r(),c("tr",vd,[yd,i("td",bd,[i("div",wd,[B(i("input",{type:"text","onUpdate:modelValue":e[3]||(e[3]=u=>n.newItem.item_ref=u),onInput:e[4]||(e[4]=(...u)=>o.fetchRefs&&o.fetchRefs(...u)),onFocus:e[5]||(e[5]=u=>n.showDropdownRef=!0),placeholder:o.translations.item_ref,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,xd),[[J,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(r(),c("ul",Cd,[(r(!0),c(W,null,X(n.refs,u=>(r(),c("li",{key:u.ref,onClick:h=>o.selectItem(u),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(u.ref)},null,8,Id))),128))])):_("",!0)])]),i("td",Ed,[B(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[6]||(e[6]=u=>n.newItem.item_category=u)},[kd,(r(!0),c(W,null,X(n.categories,u=>(r(),c("option",{key:u.id,value:u.id},l(u.name),9,Td))),128))],512),[[ve,n.newItem.item_category]]),i("div",Ad,[B(i("input",{type:"text","onUpdate:modelValue":e[7]||(e[7]=u=>n.newItem.item_name=u),onInput:e[8]||(e[8]=(...u)=>o.fetchArticles&&o.fetchArticles(...u)),onFocus:e[9]||(e[9]=u=>n.showDropdown=!0),placeholder:o.translations.item_name,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,Sd),[[J,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(r(),c("ul",Dd,[(r(!0),c(W,null,X(n.articles,u=>(r(),c("li",{key:u.name,onClick:h=>o.selectItem(u),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(u.name)},null,8,Pd))),128))])):_("",!0)])]),i("td",Md,[i("div",jd,[B(i("textarea",{"onUpdate:modelValue":e[10]||(e[10]=u=>n.newItem.item_description=u),placeholder:o.translations.item_description,class:"textarea textarea-bordered input-xs w-full",onInput:e[11]||(e[11]=u=>o.resize()),ref:"textarea"},null,40,qd),[[J,n.newItem.item_description]])])]),i("td",Rd,[i("div",Od,[i("div",Vd,[i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-l",onClick:e[12]||(e[12]=(...u)=>o.decrease&&o.decrease(...u))}," - "),B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[13]||(e[13]=u=>n.newItem.quantity=u),placeholder:o.translations.quantity,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[14]||(e[14]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Nd),[[J,n.newItem.quantity]]),i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-r",onClick:e[15]||(e[15]=(...u)=>o.increase&&o.increase(...u))}," + ")])])]),i("td",Bd,[i("div",Fd,[B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[16]||(e[16]=u=>n.newItem.unit_price=u),placeholder:o.translations.unit_price,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[17]||(e[17]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Wd),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(r(),c("td",Qd,[B(i("select",{"onUpdate:modelValue":e[18]||(e[18]=u=>n.newItem.vat_rate=u),onChange:e[19]||(e[19]=(...u)=>o.updateTotal&&o.updateTotal(...u)),class:"select select-md w-full mb-1 ecwp-select min-w-20"},[(r(!0),c(W,null,X(n.list_vats,u=>(r(),c("option",{key:u,value:u.rate},l(u.rate)+"% ",9,Xd))),128))],544),[[ve,n.newItem.vat_rate]])])):(r(),c("td",Ud)),i("td",Ld,[i("div",zd,[B(i("input",{type:"number",min:"0",max:"100","onUpdate:modelValue":e[20]||(e[20]=u=>n.newItem.discount=u),placeholder:o.translations.discount,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[21]||(e[21]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Hd),[[J,n.newItem.discount]]),Gd])]),n.settings.vat_active==1?(r(),c("td",Yd,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(r(),c("td",Jd,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.discount)),1)),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",Zd,[n.loading_add?_("",!0):(r(),c("i",$d)),n.loading_add?(r(),c("span",eu)):_("",!0)])],8,Kd)])])):_("",!0),i("tr",null,[i("td",tu,[i("strong",null,l(o.translations.subtotal),1)]),i("td",nu,[o.totalAmount!==o.totalAmountWithoutDiscount?(r(),c("span",su,l(o.totalAmountWithoutDiscount),1)):_("",!0),w(" "+l(o.totalAmount),1)]),ou]),n.settings.vat_active==1?(r(!0),c(W,{key:1},X(o.getUniqueVATRates(),(u,h)=>(r(),c("tr",{key:h},[i("td",iu,[i("strong",null,l(o.translations.tax)+" ("+l(u)+"%) ",1)]),i("td",au,l(o.calculateVATForRate(u)),1),lu]))),128)):_("",!0),i("tr",null,[i("td",ru,[i("strong",null,l(o.translations.total),1)]),i("td",cu,l(o.calculateTotalAmountWithVAT()),1),du]),n.client_currency!=n.default_currency_symbol?(r(),c("tr",uu,[i("td",hu,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",mu,l(n.quote.exchange_rate),1)])):_("",!0),n.client_currency!=n.default_currency_symbol?(r(),c("tr",fu,[i("td",pu,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",_u,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):_("",!0)])])],32),n.settings.easy_compta_signature_addon_active&&n.quote.signed==1&&n.quote.file_sign?(r(),c("div",gu,[i("div",vu,[i("span",yu,[i("img",{src:o.signatureImageUrl,alt:"Signature"},null,8,bu)])])])):_("",!0)]),_:1})])}var xu=oe(ac,[["render",wu]]);const Cu={name:"QuoteNew",components:{Card:Xe,ModelSelect:Lt,VueDatePicker:Ct},data(){return{clientOptions:[],clients:[],quote:{number:"",due_date:"",provisional_start_date:"",client_id:"",status:""},showError:!1,loading:!1,loadingBtn:!1,settings:[],last_quote_number:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}}},mounted(){this.fetchClients(),this.fetchSettings()},methods:{cancelAction(){this.$router.push("/quotes")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`}))}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},customLabel(t){return t.text},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e;const s=`${this.settings.quote_prefix}_${String(this.settings.last_quote_id).padStart(4,"0")}`;this.quote.number=s}else{const e=await t.json()}}catch{this.loading=!1}},submitQuote(){if(!this.quote.due_date||!this.quote.provisional_start_date||!this.quote.client_id||!this.quote.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch("/wp-json/my-easy-compta/v1/quotes",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.quote)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"QuoteViewDetail",params:{id:t.id}})):(this.loadingBtn=!1,console.error("Error submitting quote:",t.message),this.showToast(t.message,"alert-error"))}).catch(t=>{this.loadingBtn=!1,console.error("Error submitting quote:",t),this.showToast(t,"alert-error")})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Iu={class:"pt-2 pr-4"},Eu={class:"flex justify-between items-center mb-4"},ku={class:"card-title"},Tu=i("div",{class:"divider mt-2"},null,-1),Au={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Su={class:"grid grid-cols-3 gap-4"},Du={class:"ecwp-group form-group mb-4"},Pu={for:"quoteNumber",class:"ecwp-label"},Mu={class:"ecwp-group form-group mb-4"},ju={for:"quoteDate",class:"ecwp-label"},qu={class:"ecwp-group form-group mb-4"},Ru={for:"quoteDatePr",class:"ecwp-label"},Ou={class:"grid grid-cols-2 gap-4"},Vu={class:"ecwp-group form-group mb-4"},Nu={for:"client",class:"ecwp-label"},Bu={class:"ecwp-group form-group mb-4"},Fu={for:"status",class:"ecwp-label"},Wu={value:"draft",selected:""},Qu={value:"pending"},Xu={value:"approved"},Uu={value:"rejected"},Lu={class:"flex justify-between"},zu=["disabled"],Hu={key:0,class:"loading loading-spinner loading-sm"};function Gu(t,e,s,a,n,o){const f=j("VueDatePicker"),m=j("model-select"),p=j("Card");return r(),c("div",Iu,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(p,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",Eu,[i("h2",ku,l(o.translations.new_quote),1)]),Tu,n.loading?(r(),c("div",Au)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitQuote&&o.submitQuote(...d),["prevent"]))},[i("div",Su,[i("div",Du,[i("label",Pu,l(o.translations.quote_number),1),B(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.quote.number=d),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.quote.number]])]),i("div",Mu,[i("label",ju,l(o.translations.due_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.due_date&&n.showError?"input-error":""]]),id:"quoteDate",modelValue:n.quote.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.quote.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",qu,[i("label",Ru,l(o.translations.provisional_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.quote.provisional_start_date&&n.showError?"input-error":""]]),id:"quoteDatePr",modelValue:n.quote.provisional_start_date,"onUpdate:modelValue":e[2]||(e[2]=d=>n.quote.provisional_start_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])])]),i("div",Ou,[i("div",Vu,[i("label",Nu,l(o.translations.company_name),1),D(m,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=d=>n.quote.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.quote.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Bu,[i("label",Fu,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=d=>n.quote.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.quote.status&&n.showError?"input-error":""]])},[i("option",Wu,l(o.translations.draft),1),i("option",Qu,l(o.translations.pending),1),i("option",Xu,l(o.translations.approved),1),i("option",Uu,l(o.translations.rejected),1)],2),[[ve,n.quote.status]])])]),i("div",Lu,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.submit)+" ",1),n.loadingBtn?(r(),c("span",Hu)):_("",!0)],8,zu)])],32)]),_:1})])}var Yu=oe(Cu,[["render",Gu]]);const Ju={name:"InvoicesList",components:{Card:Xe,RemoveModal:xt},data(){return{invoices:[],showInvoiceDetailsModal:!1,editInvoiceModal:!1,selectedInvoice:null,currentPage:1,totalCount:0,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",settings:{},toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchInvoices(),this.loadSettings()},methods:{fetchInvoices(t=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/invoices?page=${t}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(s=>s.json()).then(s=>{this.invoices=s.invoices,this.totalCount=s.total_count,this.totalPages=s.total_pages,this.currentPage=t,this.perPage=e,this.generatePaginationButtons()}).catch(s=>{console.error("Error fetching invoices:",s)}).finally(()=>{this.loading=!1})},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},calculateVAT(t){return $n(t,this.default_vat.rate)},calculateWithoutVAT(t){return es(t)},generatePaginationButtons(){this.paginationButtons=ts(this.currentPage,this.totalPages)},goToPage(t){t!=="..."&&this.fetchInvoices(t)},perPageChanged(){this.fetchInvoices()},formatAmount(t,e){return ns(t,e,this.settings.currency_position)},showToast(t,e){ss(this.toast,t,e)},confirmDeleteInvoice(t){this.selectedInvoice=t,modal_remove.showModal(),this.showRemoveModal=!0},deleteInvoice(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/delete/${t}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchInvoices(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting invoice:",e.statusText))}).catch(e=>{console.log(e.message);const s=e&&e.message?e.message:"Error deleting client";s==="This client cannot be deleted because it has associated data."?this.showToast(s,"alert-error"):console.error("Error deleting client:",e)})}},computed:{skeletonItems(){return Array.from({length:5},(t,e)=>e)},totalPages(){return Math.ceil(this.totalCount/this.perPage)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},Ku={class:"pt-2 pr-4"},Zu={class:"flex justify-between items-center"},$u={class:"card-title"},eh={class:"btn btn-primary rounded-full"},th=i("i",{class:"fas fa-plus-circle"},null,-1),nh={key:0,class:"ms-2"},sh={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab3"},oh=i("i",{class:"fas fa-file-export"},null,-1),ih=["data-tip"],ah={class:"btn btn-outline btn-accent rounded-full",disabled:""},lh=i("i",{class:"fas fa-file-export"},null,-1),rh=i("div",{class:"divider mt-2"},null,-1),ch={class:"flex items-center mb-4"},dh={for:"perPageSelect",class:"mr-2"},uh=["value"],hh={class:"overflow-x-auto"},mh={key:0,class:"table w-full"},fh={class:"flex justify-center"},ph={key:0,class:"badge badge-primary badge-outline badge-sm mr-2"},_h={key:0,class:"badge badge-scondary badge-outline badge-sm"},gh={key:1,class:"badge badge-warning badge-outline badge-sm"},vh={key:2,class:"badge badge-success badge-outline badge-sm"},yh={key:3,class:"badge badge-error badge-outline badge-sm ms-2"},bh={key:0},wh={key:0},xh={key:0},Ch={key:1},Ih={key:0},Eh={key:1},kh={key:1},Th=i("span",{class:"loading loading-bars loading-sm"},null,-1),Ah=[Th],Sh={key:0},Dh={key:1},Ph=i("span",{class:"loading loading-bars loading-sm"},null,-1),Mh=[Ph],jh={key:0},qh={key:1},Rh=i("span",{class:"loading loading-bars loading-sm"},null,-1),Oh=[Rh],Vh={class:"flex justify-end"},Nh=["data-tip"],Bh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"far fa-eye"})],-1),Fh=["data-tip"],Wh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"fas fa-pencil-alt"})],-1),Qh=["data-tip"],Xh=["onClick"],Uh=i("i",{class:"far fa-trash-alt"},null,-1),Lh=[Uh],zh={key:1},Hh=i("div",{class:"flex gap-4 items-center"},[i("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),i("div",{class:"flex flex-col gap-4 w-full"},[i("div",{class:"skeleton h-4 w-full"}),i("div",{class:"skeleton h-4 w-full"})])],-1),Gh=i("div",{class:"divider my-1"},null,-1),Yh=[Hh,Gh],Jh={class:"join ecwp_pagination mt-6 pt-4"},Kh=["onClick"];function Zh(t,e,s,a,n,o){const f=j("remove-modal"),m=j("router-link"),p=j("Card");return r(),c("div",Ku,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(f,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=d=>this.deleteInvoice(n.selectedInvoice)),onCancel:e[1]||(e[1]=d=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(p,{topMargin:"mt-8"},{default:re(()=>[i("div",Zu,[i("h2",$u,l(o.translations.invoices),1),i("div",null,[D(m,{to:{name:"InvoiceNew"}},{default:re(()=>[i("button",eh,[w(l(o.translations.add)+" ",1),th])]),_:1}),n.settings.easy_compta_export_addon_active==1?(r(),c("span",nh,[i("a",sh,[w(l(o.translations.export)+" ",1),oh])])):(r(),c("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",ah,[w(l(o.translations.export)+" ",1),lh])],8,ih))])]),rh,i("div",ch,[i("label",dh,l(o.translations.display_per_page),1),B(i("select",{id:"perPageSelect","onUpdate:modelValue":e[2]||(e[2]=d=>n.perPage=d),onChange:e[3]||(e[3]=(...d)=>o.perPageChanged&&o.perPageChanged(...d))},[(r(!0),c(W,null,X(n.perPageOptions,d=>(r(),c("option",{key:d,value:d},l(d),9,uh))),128))],544),[[ve,n.perPage]])]),i("div",hh,[n.loading?(r(),c("div",zh,[(r(!0),c(W,null,X(n.skeletonRows,d=>(r(),c("div",{key:d,class:"flex flex-col gap-4 w-full"},Yh))),128))])):(r(),c("table",mh,[i("thead",null,[i("tr",null,[i("th",null,l(o.translations.invoice_number),1),i("th",null,l(o.translations.client),1),i("th",null,l(o.translations.status),1),i("th",null,l(o.translations.total),1),i("th",null,l(o.translations.due_date),1),i("th",null,l(o.translations.created_at),1),i("th",fh,l(o.translations.actions),1)])]),i("tbody",null,[(r(!0),c(W,null,X(n.invoices,d=>(r(),c("tr",{key:d.id},[i("td",null,[d.advance==1?(r(),c("span",ph,l(o.translations.advance),1)):_("",!0),w(l(d.invoice_number),1)]),i("td",null,l(d.client_name),1),i("td",null,[d.status=="draft"?(r(),c("span",_h,l(o.translations.draft),1)):_("",!0),d.status=="unpaid"?(r(),c("span",gh,l(o.translations.unpaid),1)):_("",!0),d.status=="paid"?(r(),c("span",vh,l(o.translations.paid),1)):_("",!0),d.credit=="1"?(r(),c("span",yh,l(o.translations.credit),1)):_("",!0)]),i("td",null,[n.loadingPrice?(r(),c("div",kh,Ah)):(r(),c("div",bh,[n.settings.easy_compta_advance_addon_active&&d.advance==1?(r(),c("div",wh,l(o.formatAmount(d.advance_amount,d.client_currency||n.default_currency_symbol)),1)):_("",!0),n.settings.vat_active==1?(r(),c("div",{key:1,class:k({"text-xs":d.advance==1})},[n.default_currency_symbol==d.client_currency||d.client_currency==null?(r(),c("span",xh,l(o.formatAmount(d.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Ch,l(o.formatAmount(d.total_amount,d.client_currency)),1))],2)):(r(),c("div",{key:2,class:k({"text-xs":d.advance==1})},[n.default_currency_symbol==d.client_currency||d.client_currency==null?(r(),c("span",Ih,l(o.formatAmount(d.total_amount,n.default_currency_symbol)),1)):(r(),c("span",Eh,l(o.formatAmount(d.total_amount,d.client_currency)),1))],2))]))]),i("td",null,[n.loadingPrice?(r(),c("div",Dh,Mh)):(r(),c("div",Sh,l(d.due_date),1))]),i("td",null,[n.loadingPrice?(r(),c("div",qh,Oh)):(r(),c("div",jh,l(d.created),1))]),i("td",Vh,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[D(m,{to:{name:"InvoiceViewDetail",params:{id:d.id}}},{default:re(()=>[Bh]),_:2},1032,["to"])],8,Nh),d.status=="draft"?(r(),c("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[D(m,{to:{name:"InvoiceEdit",params:{id:d.id}}},{default:re(()=>[Wh]),_:2},1032,["to"])],8,Fh)):_("",!0),d.status=="draft"?(r(),c("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:u=>o.confirmDeleteInvoice(d.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Lh,8,Xh)],8,Qh)):_("",!0)])]))),128))])]))]),i("div",Jh,[(r(!0),c(W,null,X(n.paginationButtons,d=>(r(),c("button",{key:d,class:k(["join-item btn",{"btn-disabled":d==="..."||d===n.currentPage}]),onClick:u=>o.goToPage(d)},l(d),11,Kh))),128))])]),_:1})])}var $h=oe(Ju,[["render",Zh]]);const em={name:"sendInvoice",components:{VueEditor:It.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,invoiceId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"invoice",id:this.invoiceId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},tm=["id","open"],nm={class:"modal-box"},sm={class:"font-bold text-lg"},om={key:0},im={class:"grid grid-cols-1 gap-4"},am=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),lm=i("div",{class:"skeleton h-4 w-full"},null,-1),rm=[am,lm],cm={class:"grid grid-cols-1 gap-4"},dm=["type"],um=["for"],hm=["id","value","disabled","onInput"],mm={key:1},fm=["for"],pm={class:"form-group mt-4 flex justify-end"},_m=["disabled"],gm={key:0,class:"loading loading-spinner loading-sm"};function vm(t,e,s,a,n,o){const f=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",nm,[i("h3",sm,l(o.translations.send_invoice),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=m=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",om,[i("div",im,[(r(!0),c(W,null,X(o.skeletonItems,m=>(r(),c("div",{key:m,class:"py-2"},rm))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[i("div",cm,[(r(!0),c(W,null,X(n.fields,(m,p)=>(r(),c("div",{key:p,class:"ecwp-group form-group"},[m.type!=="textarea"?(r(),c("div",{key:0,type:m.type||"text"},[i("label",{for:p,class:"ecwp-label form-label"},l(m.label),9,um),i("input",{id:p,class:k(["ecwp-input input input-bordered",m.class||"w-full"]),value:m.value,disabled:m.disabled,onInput:d=>o.updateFieldValue(p,d.target.value)},null,42,hm)],8,dm)):(r(),c("div",mm,[i("label",{for:p,class:"form-label"},l(m.label),9,fm),D(f,{modelValue:m.value,"onUpdate:modelValue":d=>m.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",pm,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",gm)):_("",!0)],8,_m)])],32))])],8,tm)])}var ym=oe(em,[["render",vm]]);const bm={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:"",paymentMethods:[],hasPaymentMethodError:!1}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},mounted(){this.fetchPaymentMethods()},methods:{async fetchPaymentMethods(){try{const t=await fetch("/wp-json/my-easy-compta/v1/payments/methods",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(!t.ok)throw new Error(`Erreur : ${t.status}`);const e=await t.json();this.paymentMethods=e}catch(t){console.error("Erreur lors de la r\xE9cup\xE9ration des m\xE9thodes de paiement :",t)}},onConfirm(){if(!this.selectedPaymentMethod){this.hasPaymentMethodError=!0;return}this.hasPaymentMethodError=!1,this.$emit("confirm",this.selectedPaymentMethod),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm_paid").close()}}},wm=["open"],xm={class:"modal-box"},Cm={class:"font-bold text-lg"},Im=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),Em={class:"text-lg font-semibold text-center"},km={class:"my-4 text-center text-xl"},Tm={key:0,class:"mt-4 mb-4"},Am={class:"ecwp-group form-group"},Sm={for:"payment_method",class:"ecwp-label form-label"},Dm={value:""},Pm=["value"],Mm={class:"flex justify-between space-x-4"};function jm(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm_paid",class:"modal",open:t.showModal},[i("div",xm,[i("h3",Cm,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...f)=>o.closeModal&&o.closeModal(...f))}," \u2715 "),Im,i("h2",Em,l(s.title),1),i("p",km,l(s.message),1),s.status==="paid"?(r(),c("div",Tm,[i("div",Am,[i("label",Sm,l(o.translations.payment_method),1),B(i("select",{id:"payment_method","onUpdate:modelValue":e[1]||(e[1]=f=>n.selectedPaymentMethod=f),class:k([{"input-error":n.hasPaymentMethodError},"ecwp-input input input-bordered w-full"])},[i("option",Dm,l(o.translations.select),1),(r(!0),c(W,null,X(n.paymentMethods,f=>(r(),c("option",{key:f.id,value:f.id},l(f.method_name),9,Pm))),128))],2),[[ve,n.selectedPaymentMethod]])])])):_("",!0),i("div",Mm,[i("button",{onClick:e[2]||(e[2]=(...f)=>o.onCancel&&o.onCancel(...f)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[3]||(e[3]=(...f)=>o.onConfirm&&o.onConfirm(...f)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,wm)])}var qm=oe(bm,[["render",jm]]);const Rm={props:{isVisible:{type:Boolean,default:!1},title:{type:String,default:"Confirmation"},message:{type:String,default:"Are you sure?"},confirmText:{type:String,default:"Confirm"},cancelText:{type:String,default:"Cancel"},status:{type:String}},data(){return{selectedPaymentMethod:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{onConfirm(){this.$emit("confirm",this.selectedPaymentMethod),this.closeModal()},onCancel(){this.$emit("cancel"),this.closeModal()},closeModal(){document.getElementById("modal_confirm_credit").close()}}},Om=["open"],Vm={class:"modal-box"},Nm={class:"font-bold text-lg"},Bm=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),Fm={class:"text-lg font-semibold text-center"},Wm={class:"my-4 text-center text-xl"},Qm={class:"flex justify-between space-x-4"};function Xm(t,e,s,a,n,o){return r(),c("div",null,[i("dialog",{id:"modal_confirm_credit",class:"modal",open:t.showModal},[i("div",Vm,[i("h3",Nm,l(t.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...f)=>o.closeModal&&o.closeModal(...f))}," \u2715 "),Bm,i("h2",Fm,l(s.title),1),i("p",Wm,l(s.message),1),i("div",Qm,[i("button",{onClick:e[1]||(e[1]=(...f)=>o.onCancel&&o.onCancel(...f)),class:"btn btn-secondary rounded-full"},l(s.cancelText),1),i("button",{onClick:e[2]||(e[2]=(...f)=>o.onConfirm&&o.onConfirm(...f)),class:"btn rounded-full btn-error text-white"},l(s.confirmText),1)])])],8,Om)])}var Um=oe(Rm,[["render",Xm]]);const Lm={name:"InvoiceNavBar",components:{SendInvoiceModal:ym,RemoveModal:xt,ConfirmModal:bn,ConfirmModalPaid:qm,ConfirmModalCredit:Um},props:{invoiceInfo:Object,currencyDefault:Object,currencyClient:Object,emailActive:String,qrCodeActive:String,totalAmount:String,noItems:Boolean},data(){return{showConfirmModal:!1,showConfirmCreditModal:!1,loading:!1,sendInvoiceModal:!1,loadingModal:!1,loadingPdf:!1,client_detail:null,selectedStatus:null,subject:"",content:"",showQrCodeModal:!1,qrCodeSrc:""}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{changeInvoiceStatusWithPaymentMethod(t){const e=this.selectedStatus;this.changeInvoiceStatus(e,t),this.showConfirmModal=!1},async changeInvoiceStatus(t,e){this.loading=!0;try{const a=await(await fetch("/wp-json/my-easy-compta/v1/invoices/update-status",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.invoiceInfo.id,status:t,method:e})})).json();a.success?(this.invoiceInfo.status=t,this.loading=!1):(console.error("Failed to update invoice status:",a.message),this.loading=!1)}catch(s){console.error("An error occurred while updating invoice status:",s)}},async addCreditInvoice(){this.loading=!0;try{const e=await(await fetch("/wp-json/my-easy-compta/v1/invoices/credit",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({id:this.invoiceInfo.id})})).json();e.success?(this.invoiceInfo.credit=1,this.loading=!1):(console.error("Failed to update invoice status:",e.message),this.loading=!1)}catch(t){console.error("An error occurred while updating invoice status:",t)}},exportToPDF(t){this.loadingPdf=!0;let s=`/wp-json/my-easy-compta/v1/invoices/pdf/${this.invoiceInfo.id}?currency_id=${t}`;fetch(s,{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(a=>{if(!a.ok)throw this.loadingPdf=!1,new Error("Network response was not ok");return a.blob()}).then(a=>{const n=URL.createObjectURL(a);window.open(n),this.loadingPdf=!1}).catch(a=>{console.error("There was a problem with the fetch operation:",a),this.loadingPdf=!1})},sendInvoice(t){this.loadingModal=!0,this.sendInvoiceModal=!0,modal_send_invoice.showModal(),this.fetchClient(t),this.fetchSettings()},fetchClient(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e,this.loading=!1}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.subject=e.email_invoice_subject,this.content=e.email_invoice_content}else{const e=await t.json();this.showToast(e.message,"alert-error")}}catch(t){this.loading=!1,this.showToast(t.message,"alert-error")}},confirmValidateInvoice(t){this.selectedStatus=t,t=="unpaid"?modal_confirm.showModal():t=="paid"&&modal_confirm_paid.showModal(),this.showConfirmModal=!0},confirmCreditInvoice(){modal_confirm_credit.showModal(),this.showConfirmCreditModal=!0},async generateQRCode(){this.loading=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/generate-qrcode",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({invoice_ref:this.invoiceInfo.invoice_number||`Facture #${this.invoiceInfo.number}`,price:parseFloat(this.invoiceInfo.total_amount)})}),e=await t.json();t.ok&&e.qr_code?(this.qrCodeSrc=e.qr_code,this.showQrCodeModal=!0):console.error("Erreur lors de la g\xE9n\xE9ration du QR Code :",e.message)}catch(t){console.error("Erreur lors de l'appel \xE0 l'API pour g\xE9n\xE9rer le QR code :",t)}finally{this.loading=!1}},closeQrCodeModal(){this.showQrCodeModal=!1},downloadQRCode(){const t=document.createElement("a");t.href=this.qrCodeSrc,t.download=`qr_code_${this.invoiceInfo.invoice_number||this.invoiceInfo.number}.png`,t.click()}}},zm={key:0},Hm={key:1,class:"modal modal-open"},Gm={class:"modal-box"},Ym={class:"font-bold text-lg"},Jm={class:"mb-4"},Km=["src"],Zm={class:"flex justify-end space-x-4"},$m={key:2,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},ef=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),tf=[ef],nf={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},sf=i("div",{class:"dropdown"},[i("div",{tabindex:"0",role:"button",class:"btn btn-ghost lg:hidden"},[i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h8m-8 6h16"})])]),i("ul",{tabindex:"0",class:"menu menu-sm dropdown-content mt-3 z-[1] p-2 shadow bg-base-100 rounded-box w-52"},[i("li",null,[i("a",null,"Item")]),i("li",null,[i("a",null,"Parent"),i("ul",{class:"p-2"},[i("li",null,[i("a",null,"Submenu")]),i("li",null,[i("a",null,"Submenu")])])]),i("li",null,[i("a",null,"Item")])])],-1),of={class:"hidden lg:flex gap-2"},af={class:"btn btn-sm"},lf=i("i",{class:"far fa-edit"},null,-1),rf={key:1},cf={class:"btn btn-sm",disabled:""},df=i("i",{class:"far fa-edit"},null,-1),uf={key:2},hf=i("i",{class:"fa fa-check"},null,-1),mf={class:"btn btn-outline btn-success btn-sm hover:text-white",disabled:""},ff=i("i",{class:"fa fa-check"},null,-1),pf={key:0},_f={class:"btn btn-sm ms-2",disabled:""},gf=i("i",{class:"fas fa-undo"},null,-1),vf={key:1},yf=i("i",{class:"fas fa-undo"},null,-1),bf=["disabled"],wf=i("i",{class:"far fa-file-pdf"},null,-1),xf={key:0,class:"loading loading-spinner loading-sm"},Cf={class:"flex gap-2"},If=i("i",{class:"fas fa-paper-plane"},null,-1),Ef={key:0},kf={key:1},Tf={key:2,class:"far fa-envelope"},Af=["data-tip"],Sf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Df=i("i",{class:"fas fa-paper-plane"},null,-1),Pf=["data-tip"],Mf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},jf=i("i",{class:"fas fa-paper-plane"},null,-1),qf={key:3},Rf=i("i",{class:"fas fa-qrcode"},null,-1),Of={key:1,click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Vf=i("i",{class:"fas fa-qrcode"},null,-1),Nf=["data-tip"],Bf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Ff=i("i",{class:"fas fa-qrcode"},null,-1),Wf={key:5},Qf={key:0,class:"dropdown dropdown-end"},Xf={tabindex:"0",role:"button",class:"btn btn-outline btn-success btn-sm"},Uf=i("i",{class:"far fa-file-pdf"},null,-1),Lf={key:0,class:"loading loading-spinner loading-sm"},zf={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},Hf=["disabled"],Gf=["disabled"],Yf={key:6},Jf=["disabled"],Kf=i("i",{class:"far fa-file-pdf"},null,-1),Zf={key:0},$f={key:1},ep={key:2,class:"loading loading-spinner loading-sm"},tp=i("i",{class:"fas fa-check"},null,-1),np=["data-tip"],sp={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},op=i("i",{class:"fas fa-check"},null,-1);function ip(t,e,s,a,n,o){const f=j("send-invoice-modal"),m=j("confirm-modal"),p=j("confirm-modal-paid"),d=j("confirm-modal-credit"),u=j("router-link");return r(),c("div",null,[s.emailActive==1?(r(),c("div",zm,[D(f,{loading:n.loadingModal,"show-modal":n.sendInvoiceModal,"modal-id":"modal_send_invoice",client:n.client_detail,"invoice-id":s.invoiceInfo.id,subject:n.subject,content:n.content,onClose:e[0]||(e[0]=h=>n.sendInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):_("",!0),D(m,{"show-modal":n.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,status:n.selectedStatus,onConfirm:e[1]||(e[1]=h=>o.changeInvoiceStatus("unpaid")),onCancel:e[2]||(e[2]=h=>n.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","status"]),D(p,{"show-modal":n.showConfirmModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,status:n.selectedStatus,onConfirm:o.changeInvoiceStatusWithPaymentMethod,onCancel:e[3]||(e[3]=h=>n.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","status","onConfirm"]),D(d,{"show-modal":n.showConfirmCreditModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_confirm_it,cancelText:o.translations.cancel,onConfirm:e[4]||(e[4]=h=>this.addCreditInvoice()),onCancel:e[5]||(e[5]=h=>n.showConfirmCreditModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),s.qrCodeActive==1&&n.showQrCodeModal?(r(),c("div",Hm,[i("div",Gm,[i("h3",Ym,l(o.translations.download_qr_code),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[6]||(e[6]=h=>o.closeQrCodeModal())}," \u2715 "),i("div",Jm,[i("img",{src:n.qrCodeSrc,alt:"QR Code",class:"max-w-full h-auto mx-auto"},null,8,Km)]),i("div",Zm,[i("button",{onClick:e[7]||(e[7]=(...h)=>o.downloadQRCode&&o.downloadQRCode(...h)),class:"btn btn-primary"},l(o.translations.download_qr_code),1)])])])):_("",!0),n.loading?(r(),c("div",$m,tf)):_("",!0),i("div",nf,[i("div",null,[sf,i("div",of,[s.invoiceInfo.status=="draft"?(r(),Vs(u,{key:0,to:{name:"InvoiceEdit",params:{id:s.invoiceInfo.id}}},{default:re(()=>[i("button",af,[lf,w(" "+l(o.translations.edit_invoice),1)])]),_:1},8,["to"])):(r(),c("div",rf,[i("button",cf,[df,w(" "+l(o.translations.edit_invoice),1)])])),s.invoiceInfo.status=="unpaid"&&!s.noItems?(r(),c("div",uf,[i("button",{class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[8]||(e[8]=h=>o.confirmValidateInvoice("paid"))},[hf,w(" "+l(o.translations.mark_as_paid),1)])])):(r(),c(W,{key:3},[i("div",null,[i("button",mf,[ff,w(" "+l(o.translations.mark_as_paid),1)])]),s.invoiceInfo.credit!=0&&s.invoiceInfo.status=="paid"&&!s.noItems?(r(),c("div",pf,[i("button",_f,[gf,w(" "+l(o.translations.credit_invoice),1)])])):_("",!0),s.invoiceInfo.credit==0&&s.invoiceInfo.status=="paid"&&!s.noItems?(r(),c("div",vf,[i("button",{class:"btn btn-sm ms-2",onClick:e[9]||(e[9]=h=>o.confirmCreditInvoice())},[yf,w(" "+l(o.translations.credit_invoice),1)])])):_("",!0)],64))])]),s.invoiceInfo.status=="draft"?(r(),c("button",{key:0,onClick:e[10]||(e[10]=h=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-secondary btn-sm",disabled:n.loadingPdf},[wf,i("span",null,l(o.translations.previewPDF),1),n.loadingPdf?(r(),c("span",xf)):_("",!0)],8,bf)):_("",!0),i("div",Cf,[s.emailActive==1&&s.invoiceInfo.status!="draft"?(r(),c("button",{key:0,onClick:e[11]||(e[11]=K(h=>o.sendInvoice(s.invoiceInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[If,s.invoiceInfo.sent==1?(r(),c("span",Ef,l(o.translations.resend_invoice),1)):(r(),c("span",kf,l(o.translations.send_invoice),1)),s.invoiceInfo.sent==1?(r(),c("i",Tf)):_("",!0)])):s.emailActive==1&&s.invoiceInfo.status=="draft"?(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.draft_cannot_send},[i("button",Sf,[Df,w(" "+l(o.translations.send_invoice),1)])],8,Af)):(r(),c("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",Mf,[jf,w(" "+l(o.translations.send_invoice),1)])],8,Pf)),s.qrCodeActive==1?(r(),c("div",qf,[s.invoiceInfo.status=="unpaid"?(r(),c("button",{key:0,class:"btn btn-outline btn-accent btn-sm",onClick:e[12]||(e[12]=(...h)=>o.generateQRCode&&o.generateQRCode(...h))},[Rf,w(" "+l(o.translations.generate_qrcode),1)])):(r(),c("button",Of,[Vf,w(" "+l(o.translations.generate_qrcode),1)]))])):(r(),c("div",{key:4,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_qrcode_addon},[i("button",Bf,[Ff,w(" "+l(o.translations.generate_qrcode),1)])],8,Nf)),s.currencyDefault.currency_id!==s.currencyClient.currency_id?(r(),c("div",Wf,[s.invoiceInfo.status!="draft"?(r(),c("div",Qf,[i("div",Xf,[Uf,w(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(r(),c("span",Lf)):_("",!0)]),i("ul",zf,[i("li",null,[i("a",{onClick:e[13]||(e[13]=h=>o.exportToPDF(s.currencyDefault.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyDefault.currency_symbol),9,Hf)]),i("li",null,[i("a",{onClick:e[14]||(e[14]=h=>o.exportToPDF(s.currencyClient.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyClient.currency_symbol),9,Gf)])])])):_("",!0)])):(r(),c("div",Yf,[s.invoiceInfo.status!="draft"?(r(),c("button",{key:0,onClick:e[15]||(e[15]=h=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[Kf,s.invoiceInfo.status!="draft"?(r(),c("span",Zf,l(o.translations.exportToPDF),1)):(r(),c("span",$f,l(o.translations.previewPDF),1)),n.loadingPdf?(r(),c("span",ep)):_("",!0)],8,Jf)):_("",!0)])),s.invoiceInfo.status=="draft"&&!s.noItems?(r(),c("button",{key:7,class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[16]||(e[16]=h=>o.confirmValidateInvoice("unpaid"))},[tp,w(" "+l(o.translations.validateInvoice),1)])):_("",!0),s.invoiceInfo.status=="draft"&&s.noItems?(r(),c("div",{key:8,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.min_article},[i("button",sp,[op,w(" "+l(o.translations.validateInvoice),1)])],8,np)):_("",!0)])])])}var ap=oe(Lm,[["render",ip]]);const lp={components:{VueEditor:It.exports.VueEditor},props:{loading:Boolean,showModal:Boolean,modalId:String,modalTitle:String,item:Object},data(){return{editedItem:{...this.item},loading:this.loading,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{item_name:{label:"Nom de l'item"},item_description:{label:"Description de l'item",type:"textarea"},quantity:{label:"Quantit\xE9",type:"number"},vat_rate:{label:"Taux de TVA",type:"number"},unit_price:{label:"Prix unitaire",type:"number"},discount:{label:"Remise",type:"number"}}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch(`/wp-json/my-easy-compta/v1/invoices/edit-item/${this.editedItem.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedItem)});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success"),this.$emit("itemEdited")}else{const e=`Error editing item: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error editing item";this.showToast(e,"alert-error"),console.error("Error editing item:",t),this.loadingBtn=!1}},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--}},watch:{item:{handler(t){this.editedItem={...t}},immediate:!0}}},rp=["id","open"],cp={class:"modal-box"},dp={class:"font-bold text-lg"},up={key:0},hp={class:"grid grid-cols-1 gap-4"},mp=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),fp=i("div",{class:"skeleton h-4 w-full"},null,-1),pp=[mp,fp],_p={class:"grid grid-cols-1 gap-4"},gp=["type"],vp=["for"],yp=["id","onUpdate:modelValue"],bp={key:1},wp=["for"],xp={class:"form-group mt-4 flex justify-end"},Cp=["disabled"],Ip={key:0,class:"loading loading-spinner loading-sm"};function Ep(t,e,s,a,n,o){const f=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",cp,[i("h3",dp,l(s.modalTitle),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=m=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",up,[i("div",hp,[(r(!0),c(W,null,X(o.skeletonItems,m=>(r(),c("div",{key:m,class:"py-2"},pp))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[i("div",_p,[(r(!0),c(W,null,X(n.fields,(m,p)=>(r(),c("div",{key:p,class:"ecwp-group form-group"},[m.type!=="textarea"?(r(),c("div",{key:0,type:m.type||"text"},[i("label",{for:p,class:"ecwp-label form-label"},l(m.label),9,vp),B(i("input",{id:p,"onUpdate:modelValue":d=>n.editedItem[p]=d,class:k(["ecwp-input input input-bordered",m.class||"w-full"])},null,10,yp),[[J,n.editedItem[p]]])],8,gp)):(r(),c("div",bp,[i("label",{for:p,class:"form-label"},l(m.label),9,wp),D(f,{id:p,modelValue:n.editedItem[p],"onUpdate:modelValue":d=>n.editedItem[p]=d,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",xp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",Ip)):_("",!0)],8,Cp)])],32))])],8,rp)])}var kp=oe(lp,[["render",Ep]]);const Tp={name:"sendRemind",components:{VueEditor:It.exports.VueEditor},props:{showModal:Boolean,modalId:String,client:Object,invoiceId:Number,loading:Boolean,subject:String,content:String},data(){const t=window.myEasyComptaAdmin.easyComptaTranslations;return{loading:!1,loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"]],fields:{client_email:{label:t.client,value:"",disabled:!0},email_subject:{label:t.email_subject,value:""},email_message:{label:t.email_content,value:"",type:"textarea"}}}},watch:{client:{immediate:!0,handler(t){this.fields.client_email.value=(t==null?void 0:t.email)||""}},subject:{immediate:!0,handler(t){this.fields.email_subject.value=t||""}},content:{immediate:!0,handler(t){this.fields.email_message.value=t||""}}},computed:{skeletonItems(){return Array.from({length:10},(t,e)=>e)},translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},methods:{closeModal(){document.getElementById(this.modalId).close()},async submitForm(){this.loadingBtn=!0;try{const t=await fetch("/wp-json/my-easy-compta/v1/emails/send-email",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({type:"remind",id:this.invoiceId,client_email:this.client.email,email_subject:this.fields.email_subject.value,email_message:this.fields.email_message.value})});if(t.ok){const e=await t.json();this.loadingBtn=!1,this.closeModal(),this.showToast(e.message,"alert-success")}else{const e=`Error sending email: ${t.statusText}`;this.showToast(e,"alert-error"),console.error(e),this.loadingBtn=!1}}catch(t){const e=t.response&&t.response.data&&t.response.data.message?t.response.data.message:"Error sending email";this.showToast(e,"alert-error"),console.error("Error sending email:",t),this.loadingBtn=!1}},updateFieldValue(t,e){this.fields[t].value=e},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Ap=["id","open"],Sp={class:"modal-box"},Dp={class:"font-bold text-lg"},Pp={key:0},Mp={class:"grid grid-cols-1 gap-4"},jp=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),qp=i("div",{class:"skeleton h-4 w-full"},null,-1),Rp=[jp,qp],Op={class:"grid grid-cols-1 gap-4"},Vp=["type"],Np=["for"],Bp=["id","value","disabled","onInput"],Fp={key:1},Wp=["for"],Qp={class:"form-group mt-4 flex justify-end"},Xp=["disabled"],Up={key:0,class:"loading loading-spinner loading-sm"};function Lp(t,e,s,a,n,o){const f=j("vue-editor");return r(),c("div",null,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Sp,[i("h3",Dp,l(o.translations.remind_invoice),1),i("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=m=>o.closeModal())}," \u2715 "),n.loading?(r(),c("div",Pp,[i("div",Mp,[(r(!0),c(W,null,X(o.skeletonItems,m=>(r(),c("div",{key:m,class:"py-2"},Rp))),128))])])):(r(),c("form",{key:1,onSubmit:e[1]||(e[1]=K((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[i("div",Op,[(r(!0),c(W,null,X(n.fields,(m,p)=>(r(),c("div",{key:p,class:"ecwp-group form-group"},[m.type!=="textarea"?(r(),c("div",{key:0,type:m.type||"text"},[i("label",{for:p,class:"ecwp-label form-label"},l(m.label),9,Np),i("input",{id:p,class:k(["ecwp-input input input-bordered",m.class||"w-full"]),value:m.value,disabled:m.disabled,onInput:d=>o.updateFieldValue(p,d.target.value)},null,42,Bp)],8,Vp)):(r(),c("div",Fp,[i("label",{for:p,class:"form-label"},l(m.label),9,Wp),D(f,{modelValue:m.value,"onUpdate:modelValue":d=>m.value=d,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Qp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(r(),c("span",Up)):_("",!0)],8,Xp)])],32))])],8,Ap)])}var zp=oe(Tp,[["render",Lp]]);const Hp={name:"InvoiceViewDetail",components:{Card:Xe,InvoiceNavBar:ap,EditItemModal:kp,RemoveModal:xt,RemindInvoiceModal:zp},data(){return{selectedItem:null,SelectedInvoiceId:null,editItemsModal:!1,RemindInvoiceModal:!1,no_items:!0,loading:!1,loading_add:!1,invoice:[],invoiceItems:[],newItem:{loading_del:!1,item_name:"",item_ref:"",item_category:"Type",item_description:"",quantity:1,vat_rate:0,unit_price:0,discount:0,total_price:0,total_amount:0},settings:[],client_detail:[],list_vats:[],client_currency:"",default_vat:"",default_currency:"",default_currency_symbol:"",articles:[],categories:[],refs:[],showDropdown:!1,showDropdownRef:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},isInvoiceOverdue(){const t=new Date().getTime(),e=this.invoice.due_date?new Date(this.invoice.due_date).getTime():null;return e&&e<t},defaultCurrency(){return{currency_id:this.settings.default_currency,currency_symbol:this.default_currency_symbol}},clientCurrency(){return{currency_id:this.client_detail.currency_id,currency_symbol:this.client_currency}},totalAmountWithoutDiscount(){const t=this.invoiceItems.reduce((e,s)=>{const a=s.quantity*s.unit_price;return e+a},0);return this.formatCurrency(t)},totalAmount(){const t=this.invoiceItems.reduce((e,s)=>e+parseFloat(s.total_price),0);return this.formatCurrency(t)},totalAmountDefaultCurrency(){return(this.invoiceItems.reduce((a,n)=>a+parseFloat(n.total_amount),0)*this.invoice.exchange_rate).toFixed(2)},totalAmountWithVAT(){const t=parseFloat(this.totalAmount);if(this.settings.vat_active==1){const e=parseFloat(this.calculateVAT());return this.formatCurrency(t+e)}else return this.formatCurrency(t)}},methods:{getUniqueVATRates(){const t=new Set;return this.invoiceItems.forEach(e=>{e.vat_rate&&t.add(e.vat_rate)}),Array.from(t)},calculateVATForRate(t){let e=0;return this.invoiceItems.forEach(s=>{if(s.vat_rate===t){const a=s.quantity*s.unit_price,n=a*s.discount/100;e+=(a-n)*t/100}}),this.formatCurrency(e)},calculateTotalAmountWithVAT(){let t=this.invoiceItems.reduce((e,s)=>e+parseFloat(s.total_amount),0);return this.settings.easy_compta_woo_addon_active==1&&(t+=parseFloat(this.invoice.shipping_amount||0)),this.formatCurrency(t)},formatShippingAmout(t){return this.formatShippingCurrency(t)},formatShippingCurrency(t){const s=(parseFloat(t)||0).toFixed(2),a=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${s}${a}`},fetchInvoice(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t?(this.invoice=t,this.fetchClientInfo(t.client_id)):console.error("Invoice not found")}).catch(t=>{console.error("Error fetching invoice:",t),this.loading=!1})},fetchClientInfo(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/clients/details/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Client not found");return e.json()}).then(e=>{this.client_detail=e;const s=e.currency_id;s&&this.fetchCurrencyDetails(s)}).catch(e=>{console.error("Error fetching client info:",e),this.loading=!1})},fetchItems(){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}/items`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{t.code=="no_items_found"?(console.error("No items found"),this.invoiceItems=[],this.loading=!1,this.no_items=!0):(this.invoiceItems=t,this.loading=!1,this.no_items=!1)}).catch(t=>{console.error("Error fetching items:",t),this.loading=!1})},fetchCurrencyDetails(t){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/settings/currency/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw this.loading=!1,new Error("Currency details not found");return this.loading=!1,e.json()}).then(e=>{this.client_currency=e.symbol,this.loading=!1}).catch(e=>{this.loading=!1,console.error("Error fetching currency details:",e)})},updateTotal(){const t=this.newItem.quantity*this.newItem.unit_price,e=t*this.newItem.discount/100,s=t-e;var a=0;if(this.settings.vat_active==1){const n=s*this.newItem.vat_rate/100;a=s+n}else a=s;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(a)},calculateTotalWithVat(t,e,s,a){const n=t*e,o=n*a/100,f=n-o,m=f*s/100,p=f+m;return this.formatCurrency(p)},calculateTotal(t,e,s){const a=t*e,n=a*s/100,f=a-n;return this.formatCurrency(f)},submitItems(){this.updateTotal();const t={...this.newItem,invoice_id:this.$route.params.id};this.loading_add=!0,fetch("/wp-json/my-easy-compta/v1/invoices/element-add",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(t)}).then(e=>e.json()).then(e=>{e.success?(this.loading_add=!1,this.fetchItems(),this.newItem={item_name:"",item_ref:"",item_category:"Type",item_description:"",quantity:1,vat_rate:this.default_vat.rate,unit_price:0,discount:0,total_price:0,total_amount:0}):(this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e.message),this.loading_add=!1)}).catch(e=>{this.showToast(e.message,"alert-error"),console.error("Error submitting item:",e),this.loading_add=!1})},increase(){this.newItem.quantity++},decrease(){this.newItem.quantity>1&&this.newItem.quantity--},confirmremoveItem(t,e){this.selectedItem=t,this.SelectedInvoiceId=e,modal_remove.showModal(),this.showRemoveModal=!0},removeItem(t,e){const s=this.invoiceItems.find(a=>a.id===t);s.loading_del=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/element-delete/${t}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({invoice_id:e})}).then(a=>a.json()).then(a=>{a.success?(s.loading_del=!1,this.fetchItems()):(this.showToast(a.message,"alert-error"),console.error("Error removing item:",a.message),s.loading_del=!1)}).catch(a=>{this.showToast(a.message,"alert-error"),console.error("Error removing item:",a),s.loading_del=!1})},editItem(t){this.loadingModal=!0,this.editItemsModal=!0,modal_edit_item.showModal(),this.fetchItemDetails(t)},fetchItemDetails(t){fetch(`/wp-json/my-easy-compta/v1/invoices/item-details/${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedItem=e,this.loading=!1}).catch(e=>{console.error("Error fetching item details:",e),this.loading=!1})},formatCurrency(t){const e=t.toFixed(2),s=this.client_currency!==this.default_currency_symbol?this.client_currency:this.default_currency_symbol;return`${e}${s}`},calculateDiscountAmountWithVAT(t,e,s,a){const o=t*e*a/100,f=o*s/100,m=o+f;return this.formatCurrency(m)},calculateDiscountAmount(t,e,s){const o=t*e*s/100;return this.formatCurrency(o)},calculateVAT(){const t=parseFloat(this.totalAmount),e=parseFloat(this.default_vat.rate),s=t*(e/100);return this.formatCurrency(s)},onDragEnd(t){const e=this.invoiceItems[t.oldIndex];this.invoiceItems.splice(t.oldIndex,1),this.invoiceItems.splice(t.newIndex,0,e);const s=this.invoiceItems.map(a=>a.id);this.saveOrderToDatabase(s)},nl2br(t){return t?t.replace(/\n/g,"<br>"):""},resize(){let t=this.$refs.textarea;t.style.height="auto",t.style.height=t.scrollHeight+"px"},saveOrderToDatabase(t){fetch("/wp-json/my-easy-compta/v1/invoices/update-invoice-items-order",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({order:t})}).then(e=>{e.ok?console.log("Order saved successfully."):console.error("Failed to save order:",e.statusText)}).catch(e=>{console.error("Error saving order:",e)})},fetchCategoriesArticles(){fetch("/wp-json/my-easy-compta/v1/categories-articles",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.categories=t}).catch(t=>console.error("Error fetching categories:",t))},fetchArticles(){if(this.newItem.item_name.length<1){this.articles=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_name}&method=name`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.articles=t}).catch(t=>console.error("Error fetching articles:",t))},selectItem(t){this.newItem.item_ref=t.ref,this.newItem.item_name=t.name,this.newItem.item_description=t.description,this.newItem.unit_price=t.unit_price,this.showDropdown=!1,this.showDropdownRef=!1},fetchRefs(){if(this.newItem.item_ref.length<1){this.refs=[];return}fetch(`/wp-json/my-easy-compta/v1/articles?search=${this.newItem.item_ref}&method=ref`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.refs=t}).catch(t=>console.error("Error fetching refrences:",t))},async loadSettings(){try{this.loadingPrice=!0;const{settings:t,currencySymbol:e,vatData:s,listVatData:a}=await zt();this.settings=t,this.default_currency_symbol=e,this.default_vat=s,this.list_vats=a,this.newItem.vat_rate=this.default_vat.rate,this.loadingPrice=!1}catch(t){this.showToast(t.message,"alert-error"),this.loadingPrice=!1}},highlightMatch(t){if(!this.newItem.item_name)return t;const e=new RegExp(`(${this.escapeRegExp(this.newItem.item_name)})`,"gi");return t.replace(e,"<b>$1</b>")},escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")},handleClickOutside(t){this.$el.contains(t.target)||(this.showDropdown=!1,this.showDropdownRef=!1)},sendRemind(t){this.loadingModal=!0,this.RemindInvoiceModal=!0,modal_send_remind.showModal(),this.fetchClientInfo(t),this.loadSettings()},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},beforeDestroy(){document.removeEventListener("click",this.handleClickOutside)},mounted(){this.fetchInvoice(),this.fetchItems(),this.loadSettings(),this.fetchCategoriesArticles(),document.addEventListener("click",this.handleClickOutside);const t=document.querySelector("tbody");A.create(t,{animation:150,handle:".drag-handle",onEnd:this.onDragEnd})}},Gp={class:"pt-2 pr-4"},Yp={key:0},Jp={key:2,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Kp=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Zp=[Kp],$p={key:3},e_={role:"alert",class:"alert alert-warning"},t_=i("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-6 w-6 shrink-0 stroke-current",fill:"none",viewBox:"0 0 24 24"},[i("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1),n_={key:0},s_=["data-tip"],o_={class:"btn btn-sm btn-primary",disabled:""},i_={class:"grid grid-cols-2"},a_={class:"md:col-span-1"},l_=["src"],r_={class:"md:col-span-1 text-right"},c_={class:"text-lg font-semibold"},d_={key:0,class:"badge badge-error text-white"},u_={key:1,class:"badge badge-error text-white"},h_={key:2,class:"badge badge-success text-white"},m_={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},f_=i("br",null,null,-1),p_=i("br",null,null,-1),__=i("br",null,null,-1),g_=["href"],v_=i("br",null,null,-1),y_=i("br",null,null,-1),b_=i("br",null,null,-1),w_=["href"],x_=i("br",null,null,-1),C_=["href"],I_={class:"table mt-8"},E_=i("th",null,null,-1),k_={width:"5%"},T_={width:"19%"},A_={width:"21%"},S_={width:"10%",class:"text-center"},D_={width:"8%",class:"text-center"},P_={key:0,width:"5%",class:"text-center"},M_={key:1,width:"5%"},j_={width:"10%",class:"text-center"},q_={width:"10%",class:"text-right"},R_=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),O_=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),V_={key:0,class:"badge badge-ghost badge-xs"},N_=["innerHTML"],B_={class:"text-center"},F_={class:"text-center"},W_={key:0},Q_={key:1},X_={key:0,class:"text-center"},U_={key:1},L_={key:2,class:"text-center"},z_=i("br",null,null,-1),H_={key:3,class:"text-center"},G_=i("br",null,null,-1),Y_={class:"text-right"},J_={key:0},K_={key:1},Z_={key:0},$_=["data-tip"],eg=["onClick"],tg=i("i",{class:"far fa-edit"},null,-1),ng=[tg],sg=["data-tip"],og=["onClick"],ig={key:0,class:"far fa-trash-alt"},ag={key:1,class:"loading loading-spinner loading-xs"},lg={key:0},rg=i("td",{class:"px-2"},null,-1),cg={class:"align-top px-2"},dg={class:"flex items-center border rounded-md relative"},ug=["placeholder"],hg={key:0,class:"autocomplete-dropdown bg-base-100"},mg=["onClick","innerHTML"],fg={class:"align-top px-2"},pg=i("option",{disabled:"",selected:""},"Type",-1),_g=["value"],gg={class:"flex items-center border rounded-md relative"},vg=["placeholder"],yg={key:0,class:"autocomplete-dropdown bg-base-100"},bg=["onClick","innerHTML"],wg={class:"align-top"},xg={class:"flex items-center rounded-md"},Cg=["placeholder"],Ig={class:"align-top"},Eg={class:"flex items-center border rounded-lg"},kg={class:"inline-flex"},Tg=["placeholder"],Ag={class:"align-top"},Sg={class:"flex items-center border rounded-md"},Dg=["placeholder"],Pg={key:0,class:"align-top"},Mg=["value"],jg={key:1,class:"align-top"},qg={class:"align-top"},Rg={class:"flex items-center border rounded-md"},Og=["placeholder"],Vg=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),Ng={key:2,class:"text-right"},Bg={key:3,class:"text-right"},Fg=["data-tip"],Wg={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},Qg={key:0,class:"fa fa-plus"},Xg={key:1,class:"loading loading-spinner loading-xs"},Ug={colspan:"8",class:"text-right no-border"},Lg={class:"text-right"},zg={key:0,class:"line-through"},Hg=i("td",null,null,-1),Gg={colspan:"8",class:"text-right no-border"},Yg={class:"text-right"},Jg=i("td",null,null,-1),Kg={key:2},Zg={colspan:"8",class:"text-right no-border"},$g={class:"text-right no-border"},ev={colspan:"8",class:"text-right no-border font-bold text-xl"},tv={class:"text-right no-border font-bold text-xl"},nv=i("td",null,null,-1),sv={key:3},ov={colspan:"8",class:"text-right no-border"},iv={class:"text-right no-border"},av={key:4},lv={colspan:"8",class:"text-right no-border"},rv={class:"text-right no-border font-bold text-xl"};function cv(t,e,s,a,n,o){const f=j("InvoiceNavBar"),m=j("remove-modal"),p=j("remind-invoice-modal"),d=j("edit-item-modal"),u=j("Card");return r(),c("div",Gp,[D(f,{invoiceInfo:n.invoice,currencyDefault:o.defaultCurrency,currencyClient:o.clientCurrency,emailActive:n.settings.easy_compta_email_addon_active,qrCodeActive:n.settings.easy_compta_qrcode_addon_active,noItems:n.no_items},null,8,["invoiceInfo","currencyDefault","currencyClient","emailActive","qrCodeActive","noItems"]),D(m,{"show-modal":t.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[0]||(e[0]=h=>this.removeItem(n.selectedItem,n.SelectedInvoiceId)),onCancel:e[1]||(e[1]=h=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.settings.easy_compta_email_addon_active==1?(r(),c("div",Yp,[D(p,{loading:t.loadingModal,"show-modal":n.RemindInvoiceModal,"modal-id":"modal_send_remind",client:n.client_detail,"invoice-id":n.invoice.id,subject:n.settings.remind_invoice_subject,content:n.settings.remind_invoice_content,onClose:e[2]||(e[2]=h=>n.RemindInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):_("",!0),n.toast.visible?(r(),c("div",{key:1,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),n.loading?(r(),c("div",Jp,Zp)):_("",!0),o.isInvoiceOverdue&&n.invoice.status=="unpaid"?(r(),c("div",$p,[i("div",e_,[t_,i("span",null,l(o.translations.invoice_overdue),1),n.settings.easy_compta_email_addon_active==1?(r(),c("div",n_,[i("button",{onClick:e[3]||(e[3]=K(h=>o.sendRemind(n.invoice.client_id),["prevent"])),class:"btn btn-sm btn-primary"},l(o.translations.remind_invoice),1)])):(r(),c("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",o_,l(o.translations.remind_invoice),1)],8,s_))])])):_("",!0),D(u,{topMargin:"mt-8",id:"invoice-content"},{default:re(()=>[i("div",i_,[i("div",a_,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,l_)])]),i("div",r_,[i("p",c_,l(n.invoice.invoice_number),1),i("div",null,[w(l(o.translations.created_at)+": ",1),i("strong",null,l(n.invoice.created_at),1)]),i("div",null,[w(l(o.translations.due_date)+": ",1),i("strong",null,l(n.invoice.due_date),1)]),i("div",null,[w(l(o.translations.status)+": ",1),n.invoice.status=="draft"?(r(),c("span",d_,l(o.translations.draft),1)):_("",!0),n.invoice.status=="unpaid"?(r(),c("span",u_,l(o.translations.unpaid),1)):_("",!0),n.invoice.status=="paid"?(r(),c("span",h_,l(o.translations.paid),1)):_("",!0)])])]),i("div",m_,[i("div",null,[i("strong",null,l(o.translations.bill_to)+":",1),i("h4",null,[i("strong",null,l(n.client_detail.company_name),1)]),i("p",null,[w(l(n.client_detail.address),1),f_,w(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),p_,w(" "+l(n.client_detail.country),1),__,n.client_detail.phone?(r(),c("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,g_)):_("",!0)])]),i("div",null,[i("strong",null,l(o.translations.received_from)+":",1),i("h4",null,[i("strong",null,l(n.settings.company_name),1)]),i("p",null,[w(l(n.settings.company_address),1),v_,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),y_,w(" "+l(n.settings.country),1),b_,n.settings.company_phone?(r(),c("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,w_)):_("",!0),x_,n.settings.mobile_phone?(r(),c("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,C_)):_("",!0)])])]),D(d,{loading:t.loadingModal,"show-modal":n.editItemsModal,"modal-id":"modal_edit_item","modal-title":o.translations.edit_item,item:n.selectedItem,onClose:e[4]||(e[4]=h=>n.editItemsModal=!1),onItemEdited:o.fetchItems},null,8,["loading","show-modal","modal-title","item","onItemEdited"]),i("form",{onSubmit:e[24]||(e[24]=K((...h)=>o.submitItems&&o.submitItems(...h),["prevent"]))},[i("table",I_,[i("thead",null,[i("tr",null,[E_,i("th",k_,l(o.translations.item_ref),1),i("th",T_,l(o.translations.item_name),1),i("th",A_,l(o.translations.description),1),i("th",S_,l(o.translations.quantity),1),i("th",D_,l(o.translations.unit_price),1),n.settings.vat_active==1?(r(),c("th",P_,l(o.translations.vat),1)):(r(),c("th",M_)),i("th",j_,l(o.translations.discount),1),i("th",q_,l(o.translations.total),1),R_])]),i("tbody",null,[(r(!0),c(W,null,X(n.invoiceItems,(h,g)=>(r(),c("tr",{key:h.id||g},[O_,i("td",null,l(h.item_ref),1),i("td",null,[h.category_name?(r(),c("div",V_,l(h.category_name),1)):_("",!0),i("div",null,l(h.item_name),1)]),i("td",{innerHTML:o.nl2br(h.item_description)},null,8,N_),i("td",B_,l(h.quantity),1),i("td",F_,[w(l(h.unit_price),1),n.default_currency_symbol==n.client_currency?(r(),c("span",W_,l(n.default_currency_symbol),1)):(r(),c("span",Q_,l(n.client_currency),1))]),n.settings.vat_active==1?(r(),c("td",X_,l(h.vat_rate)+"% ",1)):(r(),c("td",U_)),n.settings.vat_active==1?(r(),c("td",L_,[w(l(h.discount)+"% ",1),z_,w(" "+l(o.calculateDiscountAmountWithVAT(h.quantity,h.unit_price,h.vat_rate,h.discount)),1)])):(r(),c("td",H_,[w(l(h.discount)+"% ",1),G_,w(" "+l(o.calculateDiscountAmount(h.quantity,h.unit_price,h.discount)),1)])),i("td",Y_,[w(l(h.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(r(),c("span",J_,l(n.default_currency_symbol),1)):(r(),c("span",K_,l(n.client_currency),1))]),i("td",null,[n.invoice.status=="draft"?(r(),c("div",Z_,[i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:K(v=>o.editItem(h.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},ng,8,eg)],8,$_),i("span",{class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:K(v=>o.confirmremoveItem(h.id,n.invoice.id),["prevent"]),class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 mx-2 rounded"},[h.loading_del?_("",!0):(r(),c("i",ig)),h.loading_del?(r(),c("span",ag)):_("",!0)],8,og)],8,sg)])):_("",!0)])]))),128)),n.invoice.status=="draft"?(r(),c("tr",lg,[rg,i("td",cg,[i("div",dg,[B(i("input",{type:"text","onUpdate:modelValue":e[5]||(e[5]=h=>n.newItem.item_ref=h),onInput:e[6]||(e[6]=(...h)=>o.fetchRefs&&o.fetchRefs(...h)),onFocus:e[7]||(e[7]=h=>n.showDropdownRef=!0),placeholder:o.translations.item_ref,class:"w-full p-2.5 input-xs outline-none"},null,40,ug),[[J,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(r(),c("ul",hg,[(r(!0),c(W,null,X(n.refs,h=>(r(),c("li",{key:h.ref,onClick:g=>o.selectItem(h),class:"autocomplete-item",innerHTML:o.highlightMatch(h.ref)},null,8,mg))),128))])):_("",!0)])]),i("td",fg,[B(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[8]||(e[8]=h=>n.newItem.item_category=h)},[pg,(r(!0),c(W,null,X(n.categories,h=>(r(),c("option",{key:h.id,value:h.id},l(h.name),9,_g))),128))],512),[[ve,n.newItem.item_category]]),i("div",gg,[B(i("input",{type:"text","onUpdate:modelValue":e[9]||(e[9]=h=>n.newItem.item_name=h),onInput:e[10]||(e[10]=(...h)=>o.fetchArticles&&o.fetchArticles(...h)),onFocus:e[11]||(e[11]=h=>n.showDropdown=!0),placeholder:o.translations.item_name,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,vg),[[J,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(r(),c("ul",yg,[(r(!0),c(W,null,X(n.articles,h=>(r(),c("li",{key:h.name,onClick:g=>o.selectItem(h),class:"autocomplete-item bt-primary",innerHTML:o.highlightMatch(h.name)},null,8,bg))),128))])):_("",!0)])]),i("td",wg,[i("div",xg,[B(i("textarea",{"onUpdate:modelValue":e[12]||(e[12]=h=>n.newItem.item_description=h),placeholder:o.translations.item_description,class:"textarea textarea-bordered input-xs w-full",onInput:e[13]||(e[13]=h=>o.resize()),ref:"textarea"},null,40,Cg),[[J,n.newItem.item_description]])])]),i("td",Ig,[i("div",Eg,[i("div",kg,[i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-l",onClick:e[14]||(e[14]=(...h)=>o.decrease&&o.decrease(...h))}," - "),B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[15]||(e[15]=h=>n.newItem.quantity=h),placeholder:o.translations.quantity,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[16]||(e[16]=(...h)=>o.updateTotal&&o.updateTotal(...h))},null,40,Tg),[[J,n.newItem.quantity]]),i("div",{class:"select-none border py-3 px-2 cursor-pointer bg-base-300 hover:bg-gray-200 rounded-r",onClick:e[17]||(e[17]=(...h)=>o.increase&&o.increase(...h))}," + ")])])]),i("td",Ag,[i("div",Sg,[B(i("input",{type:"text",pattern:"([0-9]+.{0,1}[0-9]*,{0,1})*[0-9]","onUpdate:modelValue":e[18]||(e[18]=h=>n.newItem.unit_price=h),placeholder:o.translations.unit_price,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[19]||(e[19]=(...h)=>o.updateTotal&&o.updateTotal(...h))},null,40,Dg),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(r(),c("td",Pg,[B(i("select",{"onUpdate:modelValue":e[20]||(e[20]=h=>n.newItem.vat_rate=h),onChange:e[21]||(e[21]=(...h)=>o.updateTotal&&o.updateTotal(...h)),class:"select select-md w-full mb-1 ecwp-select min-w-20"},[(r(!0),c(W,null,X(n.list_vats,h=>(r(),c("option",{key:h,value:h.rate},l(h.rate)+"% ",9,Mg))),128))],544),[[ve,n.newItem.vat_rate]])])):(r(),c("td",jg)),i("td",qg,[i("div",Rg,[B(i("input",{type:"number","onUpdate:modelValue":e[22]||(e[22]=h=>n.newItem.discount=h),min:"0",max:"100",placeholder:o.translations.discount,class:"w-full p-2.5 bg-transparent outline-none max-w-40 min-w-10",onInput:e[23]||(e[23]=(...h)=>o.updateTotal&&o.updateTotal(...h))},null,40,Og),[[J,n.newItem.discount]]),Vg])]),n.settings.vat_active==1?(r(),c("td",Ng,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(r(),c("td",Bg,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.discount)),1)),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",Wg,[n.loading_add?_("",!0):(r(),c("i",Qg)),n.loading_add?(r(),c("span",Xg)):_("",!0)])],8,Fg)])])):_("",!0),i("tr",null,[i("td",Ug,[i("strong",null,l(o.translations.subtotal),1)]),i("td",Lg,[o.totalAmount!==o.totalAmountWithoutDiscount?(r(),c("span",zg,l(o.totalAmountWithoutDiscount),1)):_("",!0),w(" "+l(o.totalAmount),1)]),Hg]),n.settings.vat_active==1?(r(!0),c(W,{key:1},X(o.getUniqueVATRates(),(h,g)=>(r(),c("tr",{key:g},[i("td",Gg,[i("strong",null,l(o.translations.tax)+" ("+l(h)+"%) ",1)]),i("td",Yg,l(o.calculateVATForRate(h)),1),Jg]))),128)):_("",!0),n.invoice.shipping_amount?(r(),c("tr",Kg,[i("td",Zg,[i("strong",null,l(o.translations.shipping_fees),1)]),i("td",$g,l(o.formatShippingAmout(n.invoice.shipping_amount)),1)])):_("",!0),i("tr",null,[i("td",ev,[i("strong",null,l(o.translations.total),1)]),i("td",tv,l(o.calculateTotalAmountWithVAT()),1),nv]),n.client_currency!=n.default_currency_symbol?(r(),c("tr",sv,[i("td",ov,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",iv,l(n.invoice.exchange_rate),1)])):_("",!0),n.client_currency!=n.default_currency_symbol?(r(),c("tr",av,[i("td",lv,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",rv,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):_("",!0)])])],32)]),_:1})])}var dv=oe(Hp,[["render",cv]]);const uv={name:"InvoiceNew",components:{Card:Xe,ModelSelect:Lt,VueDatePicker:Ct},data(){return{invoice:{invoice_number:"",due_date:"",client_id:"",client:null,status:"",exchange_rate:0},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],last_invoice_number:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},currencyMismatch(){const t=this.clients.find(e=>e.id===this.invoice.client_id);return t&&this.settings.default_currency!==t.currency_id}},mounted(){this.fetchClients(),this.fetchSettings()},methods:{cancelAction(){this.$router.push("/invoices")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`}))}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e;const s=`${this.settings.invoice_prefix}_${String(this.settings.last_invoice_id).padStart(4,"0")}`;this.invoice.number=s}else{const e=await t.json()}}catch{this.loading=!1}},handleClientChange(){const t=this.clients.find(e=>e.id===this.invoice.client_id);t&&this.settings.default_currency!==t.currency_id?this.invoice.exchange_rate=1:this.invoice.exchange_rate=0},submitInvoice(){if(!this.invoice.due_date||!this.invoice.client_id||!this.invoice.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch("/wp-json/my-easy-compta/v1/invoices",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.invoice)}).then(t=>{if(!t.ok)throw new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:t.id}})):(console.error("Error submitting invoice:",t.message),this.showToast(t.message,"alert-error"),this.loadingBtn=!1)}).catch(t=>{console.error("Error submitting invoice:",t),this.showToast(t,"alert-error"),this.loadingBtn=!1})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},hv={class:"pt-2 pr-4"},mv={class:"flex justify-between items-center mb-4"},fv={class:"card-title"},pv=i("div",{class:"divider mt-2"},null,-1),_v={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},gv={class:"grid grid-cols-2 gap-4"},vv={class:"ecwp-group form-group mb-4"},yv={for:"invoiceNumber",class:"ecwp-label"},bv={class:"ecwp-group form-group mb-4"},wv={for:"invoiceDate",class:"ecwp-label"},xv={class:"ecwp-group form-group mb-4"},Cv={for:"client",class:"ecwp-label"},Iv={class:"ecwp-group form-group mb-4"},Ev={for:"status",class:"ecwp-label"},kv={value:"draft"},Tv={key:0,class:"ecwp-group form-group mb-4"},Av={for:"exchangeRate",class:"ecwp-label"},Sv={class:"flex justify-between"},Dv=["disabled"],Pv={key:0,class:"loading loading-spinner loading-sm"};function Mv(t,e,s,a,n,o){const f=j("VueDatePicker"),m=j("model-select"),p=j("Card");return r(),c("div",hv,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(p,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",mv,[i("h2",fv,l(o.translations.new_invoice),1)]),pv,n.loading?(r(),c("div",_v)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitInvoice&&o.submitInvoice(...d),["prevent"]))},[i("div",gv,[i("div",vv,[i("label",yv,l(o.translations.invoice_number),1),B(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.invoice.number=d),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.invoice.number]])]),i("div",bv,[i("label",wv,l(o.translations.due_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.invoice.due_date&&n.showError?"input-error":""]]),id:"invoiceDate",modelValue:n.invoice.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.invoice.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",xv,[i("label",Cv,l(o.translations.company_name),1),D(m,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=d=>n.invoice.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Iv,[i("label",Ev,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=d=>n.invoice.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",kv,l(o.translations.draft),1)],2),[[ve,n.invoice.status]])]),o.currencyMismatch?(r(),c("div",Tv,[i("label",Av,l(o.translations.exchange_rate),1),B(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=d=>n.invoice.exchange_rate=d),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):_("",!0)]),i("div",Sv,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.submit)+" ",1),n.loadingBtn?(r(),c("span",Pv)):_("",!0)],8,Dv)])],32)]),_:1})])}var jv=oe(uv,[["render",Mv]]);const qv={name:"invoiceEdit",components:{Card:Xe,ModelSelect:Lt,VueDatePicker:Ct},data(){return{invoice:{invoice_number:"",due_date:"",client_id:"",client:null,status:"paid",exchange_rate:0},showError:!1,loading:!1,loadingBtn:!1,clients:[],clientOptions:[],settings:[],toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return t=>{if(!t)return"";const e=t.getDate().toString().padStart(2,"0"),s=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear();return`${e}-${s}-${a}`}},currencyMismatch(){const t=this.clients.find(e=>e.id===this.invoice.client_id);return t&&this.settings.default_currency!==t.currency_id}},mounted(){this.fetchClients(),this.fetchSettings(),this.fetchInvoiceDetails()},methods:{cancelAction(){this.$router.push("/invoices")},fetchClients(){this.loading=!0,fetch("/wp-json/my-easy-compta/v1/list-clients",{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(t=>t.json()).then(t=>{this.clients=t.clients,this.clientOptions=this.clients.map(e=>({value:e.id,text:`${e.company_name} - ${e.email} (${e.currency_symbol})`})),this.invoice.client_id&&this.setClientById(this.invoice.client_id)}).catch(t=>{console.error("Error fetching clients:",t)}).finally(()=>{this.loading=!1})},async fetchSettings(){try{this.loading=!0;const t=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,t.ok){const e=await t.json();this.settings=e}else{const e=await t.json();console.error("Error fetching settings:",e)}}catch(t){this.loading=!1,console.error("Error fetching settings:",t)}},fetchInvoiceDetails(){const t=this.$route.params.id;!t||(this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${t}`,{headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{e?this.invoice=e:(console.error("Error fetching invoice details:",e.message),this.showToast(e.message,"alert-error"))}).catch(e=>{console.error("Error fetching invoice details:",e),this.showToast(e,"alert-error")}).finally(()=>{this.loading=!1}))},setClientById(t){this.invoice.client=this.clients.find(e=>e.id===t)||null},handleClientChange(){const t=this.clients.find(e=>e.id===this.invoice.client_id);t&&this.settings.default_currency!==t.currency_id?this.invoice.exchange_rate=1:this.invoice.exchange_rate=0},submitInvoice(){if(!this.invoice.due_date||!this.invoice.client_id||!this.invoice.status){this.showError=!0,this.showToast("Veuillez remplir tous les champs obligatoires.","alert-error");return}this.loadingBtn=!0,fetch(`/wp-json/my-easy-compta/v1/invoices/${this.$route.params.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.invoice)}).then(t=>{if(!t.ok)throw this.loadingBtn=!1,new Error("Network response was not ok");return t.json()}).then(t=>{t.success?(this.loadingBtn=!1,this.showToast(t.message,"alert-success"),this.$router.push({name:"InvoiceViewDetail",params:{id:t.id}})):(this.loadingBtn=!1,console.error("Error submitting invoice:",t.message),this.showToast(t.message,"alert-error"))}).catch(t=>{this.loadingBtn=!1,console.error("Error submitting invoice:",t),this.showToast(t,"alert-error")})},showToast(t,e){this.toast.message=t,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}}},Rv={class:"pt-2 pr-4"},Ov={class:"flex justify-between items-center mb-4"},Vv={class:"card-title"},Nv=i("div",{class:"divider mt-2"},null,-1),Bv={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Fv={class:"grid grid-cols-2 gap-4"},Wv={class:"ecwp-group form-group mb-4"},Qv={for:"invoiceNumber",class:"ecwp-label"},Xv={class:"ecwp-group form-group mb-4"},Uv={for:"invoiceDate",class:"ecwp-label"},Lv={class:"ecwp-group form-group mb-4"},zv={for:"client",class:"ecwp-label"},Hv={class:"ecwp-group form-group mb-4"},Gv={for:"status",class:"ecwp-label"},Yv={value:"draft",selected:""},Jv={value:"unpaid"},Kv={value:"paid"},Zv={key:0,class:"ecwp-group form-group mb-4"},$v={for:"exchangeRate",class:"ecwp-label"},ey={class:"flex justify-between"},ty=["disabled"],ny={key:0,class:"loading loading-spinner loading-sm"};function sy(t,e,s,a,n,o){const f=j("VueDatePicker"),m=j("model-select"),p=j("Card");return r(),c("div",Rv,[n.toast.visible?(r(),c("div",{key:0,class:k(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:k(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):_("",!0),D(p,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",Ov,[i("h2",Vv,l(o.translations.edit_invoice),1)]),Nv,n.loading?(r(),c("div",Bv)):_("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...d)=>o.submitInvoice&&o.submitInvoice(...d),["prevent"]))},[i("div",Fv,[i("div",Wv,[i("label",Qv,l(o.translations.invoice_number),1),B(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=d=>n.invoice.invoice_number=d),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[J,n.invoice.invoice_number]])]),i("div",Xv,[i("label",Uv,l(o.translations.due_date),1),D(f,{class:k(["ecwp-input ecwp-date input input-bordered w-full",[!n.invoice.due_date&&n.showError?"input-error":""]]),id:"invoiceDate",modelValue:n.invoice.due_date,"onUpdate:modelValue":e[1]||(e[1]=d=>n.invoice.due_date=d),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",Lv,[i("label",zv,l(o.translations.company_name),1),D(m,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=d=>n.invoice.client_id=d),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:k(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Hv,[i("label",Gv,l(o.translations.status),1),B(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=d=>n.invoice.status=d),class:k(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",Yv,l(o.translations.draft),1),i("option",Jv,l(o.translations.unpaid),1),i("option",Kv,l(o.translations.paid),1)],2),[[ve,n.invoice.status]])]),o.currencyMismatch?(r(),c("div",Zv,[i("label",$v,l(o.translations.exchange_rate),1),B(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=d=>n.invoice.exchange_rate=d),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):_("",!0)]),i("div",ey,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...d)=>o.cancelAction&&o.cancelAction(...d))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(r(),c("span",ny)):_("",!0)],8,ty)])],32)]),_:1})])}var oy=oe(qv,[["render",sy]]);const xe=Ut;function Xt(){const t=["318785CkdQQr","1041045FVWfIn","QuoteEdit","496GGcwdh","703200xKLHVo","InvoiceEdit","QuoteViewDetail","/quote/detail/:id","6MJOZVf","QuoteNew","InvoiceViewDetail","17973NSFnHp","/invoice/new","/quote/new","1093784drjkwq","355120CzaQEu","Invoice","Quote","457401RmjiUo","/invoice/edit/:id"];return Xt=function(){return t},Xt()}(function(t,e){const s=Ut,a=t();for(;[];)try{if(-parseInt(s(238))/1+-parseInt(s(242))/2+parseInt(s(239))/3+parseInt(s(232))/4+parseInt(s(233))/5*(parseInt(s(246))/6)+parseInt(s(236))/7+-parseInt(s(241))/8*(-parseInt(s(229))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Xt,210257);function Ut(t,e){const s=Xt();return Ut=function(a,n){return a=a-227,s[a]},Ut(t,e)}const iy=[{path:"/quotes",name:xe(235),component:Ma},{path:xe(245),name:xe(244),component:xu},{path:xe(231),name:xe(227),component:Yu},{path:"/quote/edit/:id",name:xe(240),component:_s},{path:"/invoices",name:xe(234),component:$h},{path:"/invoice/detail/:id",name:xe(228),component:dv},{path:xe(237),name:xe(243),component:oy},{path:xe(230),name:"InvoiceNew",component:jv}],hy=Qo({history:_o(),routes:iy});export{hy as r};
  • my-easy-compta/trunk/assets/dist/invoices.min.js

    r3166746 r3167980  
    1 import{_ as p,d as f,o as i,H as u,f as _,h as m}from"./plugin-vue_export-helper.min.js";import{r as I}from"./index.min.js";import"./RemoveAlert.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./api.min.js";import"./vue3-editor.common.min.js";const h={name:"Invoices",mounted(){this.$router.push("/invoices")}};function d(n,r,e,t,a,c){const x=f("router-view");return i(),u(x)}var l=p(h,[["render",d]]);const v=o;function o(n,r){const e=s();return o=function(t,a){return t=t-236,e[t]},o(n,r)}(function(n,r){const e=o,t=n();for(;[];)try{if(parseInt(e(240))/1*(-parseInt(e(246))/2)+parseInt(e(241))/3*(parseInt(e(236))/4)+parseInt(e(244))/5+-parseInt(e(237))/6+parseInt(e(238))/7+-parseInt(e(242))/8+-parseInt(e(245))/9*(-parseInt(e(239))/10)===r)break;t.push(t.shift())}catch{t.push(t.shift())}})(s,586024);function s(){const n=["15ExUQRu","5326776lrRcsk","use","898345clMXzf","2109069hkDIcY","12156TyCoTa","3764gkBEmL","6829128HRXvgI","1777776BAunmY","110stYnPb","103cOFZfh"];return s=function(){return n},s()}const b=_({render:()=>m(l)});b[v(243)](I).mount("#my-easy-compta-invoices-app");
     1import{_ as i,d as u,o as _,H as d,f as m,h as f}from"./plugin-vue_export-helper.min.js";import{r as b}from"./index.min.js";import"./RemoveAlert.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./api.min.js";import"./vue3-editor.common.min.js";const I={name:"Invoices",mounted(){this.$router.push("/invoices")}};function h(n,r,e,t,x,p){const c=u("router-view");return _(),d(c)}var v=i(I,[["render",h]]);const a=o;function o(n,r){const e=s();return o=function(t,x){return t=t-265,e[t]},o(n,r)}(function(n,r){const e=o,t=n();for(;[];)try{if(parseInt(e(275))/1+-parseInt(e(269))/2+parseInt(e(276))/3*(parseInt(e(270))/4)+-parseInt(e(271))/5*(parseInt(e(266))/6)+-parseInt(e(265))/7+parseInt(e(274))/8*(-parseInt(e(268))/9)+parseInt(e(272))/10===r)break;t.push(t.shift())}catch{t.push(t.shift())}})(s,871380);function s(){const n=["use","542088cBGGnv","360602VFLuTB","617096vyGBZQ","10bbpeKC","25224040Emkugl","mount","144aEjeuO","677218NQsckJ","24zNyYnN","9690205bQLTNO","2740926HWBjyW"];return s=function(){return n},s()}const l=m({render:()=>f(v)});l[a(267)](b)[a(273)]("#my-easy-compta-invoices-app");
  • my-easy-compta/trunk/assets/dist/payments.min.js

    r3166746 r3167980  
    1 import{_ as M,d as y,o as i,c as d,n as h,a as t,t as r,g as f,F as p,r as _,w as T,i as g,k as E,j as C,H as B,v as S,m as w,e as x,p as V,f as j,h as D}from"./plugin-vue_export-helper.min.js";import{C as I,R as A}from"./RemoveAlert.min.js";import{V as R}from"./vue-datepicker.min.js";import{g as U,b as F,s as N,f as W}from"./api.min.js";const z={components:{VueDatePicker:R},props:{loading:{type:Boolean,default:!1},showModal:{type:Boolean,default:!1},modalId:{type:String,required:!0},modalTitle:{type:String,default:""},payment:{type:Object,default:()=>({id:null,invoice_number:"",company_name:"",amount:"",payment_method_id:"",payment_date:"",note:"",payment_methods:[]})},disabled:{type:Boolean,default:!0},methods:Array},data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{editedPayment:{...this.payment},loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{invoice_number:{label:s.invoice_number,disabled:this.disabled},company_name:{label:s.client,disabled:this.disabled},amount:{label:s.amount,disabled:!1},payment_method:{label:s.payment_method},payment_date:{label:s.payment_date}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return s=>{if(!s)return"";const e=s.getDate().toString().padStart(2,"0"),l=(s.getMonth()+1).toString().padStart(2,"0"),c=s.getFullYear();return`${e}-${l}-${c}`}},paymentMethods(){return this.methods},skeletonItems(){return Array.from({length:10},(s,e)=>e)}},methods:{closeModal(){document.getElementById("modal_payment_edit").close()},async submitForm(){this.loadingBtn=!0;try{const s=await fetch(`/wp-json/my-easy-compta/v1/payments/${this.editedPayment.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedPayment)});if(s.ok){const e=await s.json();this.closeModal(),this.loadingBtn=!1,this.showToast(e.message,"alert-success"),this.$emit("paymentEdited")}else{this.loadingBtn=!1;const e=`Error editing payment: ${s.statusText}`;this.showToast(e,"alert-error"),console.error(e)}}catch(s){const e=s.response&&s.response.data&&s.response.data.message?s.response.data.message:"Error editing payment";this.showToast(e,"alert-error"),console.error("Error editing payment:",s),this.loadingBtn=!1}},showToast(s,e){this.toast.message=s,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{payment:{handler(s){this.editedPayment={...s}},immediate:!0}}},O=["id","open"],X={class:"modal-box"},q={class:"font-bold text-lg"},L={key:0},J={class:"grid grid-cols-2 gap-4"},Y=t("div",{class:"skeleton h-4 w-full mb-2"},null,-1),H=t("div",{class:"skeleton h-4 w-full"},null,-1),Q=[Y,H],Z={class:"grid grid-cols-2 gap-4"},G=["for"],K=["type","id","onUpdate:modelValue","disabled"],$=["id"],ee=["value"],te={class:"ecwp-group form-group mt-4"},se={for:"note",class:"ecwp-label form-label"},ne={class:"form-group mt-4 flex justify-end"},ae=["disabled"],oe={key:0,class:"loading loading-spinner loading-sm"};function le(s,e,l,c,n,o){const P=y("VueDatePicker");return i(),d("div",null,[n.toast.visible?(i(),d("div",{key:0,class:h(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:h(["alert",n.toast.type,"text-white"])},[t("span",null,r(n.toast.message),1)],2)],2)):f("",!0),t("dialog",{id:l.modalId,class:"modal",open:l.showModal},[t("div",X,[t("h3",q,r(l.modalTitle),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),l.loading?(i(),d("div",L,[t("div",J,[(i(!0),d(p,null,_(o.skeletonItems,m=>(i(),d("div",{key:m,class:"py-2"},Q))),128))])])):(i(),d("form",{key:1,onSubmit:e[4]||(e[4]=T((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[t("div",Z,[(i(!0),d(p,null,_(n.fields,(m,u)=>(i(),d("div",{key:u,class:"ecwp-group form-group"},[t("label",{for:u,class:"ecwp-label form-label"},r(m.label),9,G),u!=="payment_method"&&u!=="payment_date"?g((i(),d("input",{key:0,type:m.type||"text",id:u,"onUpdate:modelValue":a=>n.editedPayment[u]=a,class:h(["ecwp-input input","input-bordered",m.class||"w-full"]),disabled:m.disabled},null,10,K)),[[E,n.editedPayment[u]]]):u=="payment_method"?g((i(),d("select",{key:1,id:u,"onUpdate:modelValue":e[1]||(e[1]=a=>n.editedPayment.payment_method_id=a),class:h(["ecwp-input input","input-bordered",m.class||"w-full"])},[(i(!0),d(p,null,_(o.paymentMethods,a=>(i(),d("option",{key:a.id,value:a.id},r(a.method_name),9,ee))),128))],10,$)),[[C,n.editedPayment.payment_method_id]]):u=="payment_date"?(i(),B(P,{key:2,class:"ecwp-input ecwp-date input input-bordered w-full",id:"invoiceDate",modelValue:n.editedPayment.payment_date,"onUpdate:modelValue":e[2]||(e[2]=a=>n.editedPayment.payment_date=a),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr",required:""},null,8,["modelValue","format","min-date"])):f("",!0)]))),128))]),t("div",te,[t("label",se,r(o.translations.note),1),g(t("textarea",{id:"note","onUpdate:modelValue":e[3]||(e[3]=m=>n.editedPayment.notes=m),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[S,n.editedPayment.notes]])]),t("div",ne,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(r(o.translations.save)+" ",1),n.loadingBtn?(i(),d("span",oe)):f("",!0)],8,ae)])],32))])],8,O)])}var ie=M(z,[["render",le]]);const de={name:"Payments",components:{Card:I,PaymentEditModal:ie,RemoveModal:A},data(){return{payments:[],paymentMethods:[],paymentForm:{invoice_id:"",client_id:"",amount:"",payment_method_id:"",payment_date:""},editPaymentModal:!1,selectedPayment:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,showRemoveModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchPayments(),this.loadSettings()},methods:{fetchPayments(s=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/payments?page=${s}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(l=>l.json()).then(l=>{this.payments=l.payments,this.totalCount=l.total_count,this.totalPages=l.total_pages,this.currentPage=l.page,this.perPage=e,this.generatePaginationButtons()}).catch(l=>{console.error("Error fetching payments:",l)}).finally(()=>{this.loading=!1})},editPayment(s){this.loadingModal=!0,this.editPaymentModal=!0,modal_payment_edit.showModal(),this.fetchPaymentDetails(s)},fetchPaymentDetails(s){fetch(`/wp-json/my-easy-compta/v1/payments/details/${s}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedPayment=e,this.paymentMethods=e.payment_methods,console.log(this.paymentMethods),this.loadingModal=!1}).catch(e=>{console.error("Error fetching payment details:",e),this.loadingModal=!1})},generatePaginationButtons(){this.paginationButtons=U(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchPayments(s)},perPageChanged(){this.fetchPayments()},formatAmount(s,e){return F(s,e,this.settings.currency_position)},showToast(s,e){N(this.toast,s,e)},closePaymentModal(){this.showPaymentModal=!1},confirmDeletePayment(s){this.selectedPayment=s,modal_remove.showModal(),this.showRemoveModal=!0},deletePayment(s){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/payments/${s}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchPayments(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting payment:",e.statusText))}).catch(e=>{console.error("Error deleting payment:",e)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:s,currencySymbol:e,vatData:l}=await W();this.settings=s,this.default_currency_symbol=e,this.default_vat=l,this.loadingPrice=!1}catch(s){this.showToast(s.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},re={class:"pt-2 pr-4"},me={class:"flex justify-between items-center"},ce={class:"card-title"},ue={key:0},he={class:"btn btn-outline btn-accent rounded-full",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab4"},pe=t("i",{class:"fas fa-file-export"},null,-1),_e=["data-tip"],ye={class:"btn btn-outline btn-accent rounded-full",disabled:""},fe=t("i",{class:"fas fa-file-export"},null,-1),ge=t("div",{class:"divider mt-2"},null,-1),be={class:"flex items-center mb-4"},ve={for:"perPageSelect",class:"mr-2"},Pe=["value"],xe={class:"overflow-x-auto"},we={key:0,class:"table w-full"},ke={class:"flex justify-center"},Me={key:0},Ce={key:1},Te=t("span",{class:"loading loading-bars loading-sm"},null,-1),Ee=[Te],Be={class:"flex justify-end"},Se=["data-tip"],Ve=["onClick"],je=t("i",{class:"fas fa-pencil-alt"},null,-1),De=[je],Ie=["data-tip"],Ae=["onClick"],Re=t("i",{class:"far fa-trash-alt"},null,-1),Ue=[Re],Fe={key:1},Ne=t("div",{class:"flex gap-4 items-center"},[t("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),t("div",{class:"flex flex-col gap-4 w-full"},[t("div",{class:"skeleton h-4 w-full"}),t("div",{class:"skeleton h-4 w-full"})])],-1),We=t("div",{class:"divider my-1"},null,-1),ze=[Ne,We],Oe={class:"join ecwp_pagination mt-6 pt-4"},Xe=["onClick"];function qe(s,e,l,c,n,o){const P=y("payment-edit-modal"),m=y("remove-modal"),u=y("Card");return i(),d("div",re,[n.toast.visible?(i(),d("div",{key:0,class:h(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:h(["alert",n.toast.type,"text-white"])},[t("span",null,r(n.toast.message),1)],2)],2)):f("",!0),x(P,{loading:n.loadingModal,"show-modal":n.editPaymentModal,"modal-id":"modal_payment_edit","modal-title":o.translations.edit_payment,payment:n.selectedPayment,methods:n.paymentMethods,onClose:e[0]||(e[0]=a=>n.editPaymentModal=!1),onPaymentEdited:o.fetchPayments},null,8,["loading","show-modal","modal-title","payment","methods","onPaymentEdited"]),x(m,{"show-modal":n.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[1]||(e[1]=a=>this.deletePayment(n.selectedPayment)),onCancel:e[2]||(e[2]=a=>n.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),x(u,{topMargin:"mt-8"},{default:V(()=>[t("div",me,[t("h2",ce,r(o.translations.payments),1),n.settings.easy_compta_export_addon_active==1?(i(),d("div",ue,[t("a",he,[w(r(o.translations.export)+" ",1),pe])])):(i(),d("div",{key:1,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.active_export_addon},[t("button",ye,[w(r(o.translations.export)+" ",1),fe])],8,_e))]),ge,t("div",be,[t("label",ve,r(o.translations.display_per_page),1),g(t("select",{id:"perPageSelect","onUpdate:modelValue":e[3]||(e[3]=a=>n.perPage=a),onChange:e[4]||(e[4]=(...a)=>o.perPageChanged&&o.perPageChanged(...a))},[(i(!0),d(p,null,_(n.perPageOptions,a=>(i(),d("option",{key:a,value:a},r(a),9,Pe))),128))],544),[[C,n.perPage]])]),t("div",xe,[n.loading?(i(),d("div",Fe,[(i(!0),d(p,null,_(n.skeletonRows,a=>(i(),d("div",{key:a,class:"flex flex-col gap-4 w-full"},ze))),128))])):(i(),d("table",we,[t("thead",null,[t("tr",null,[t("th",null,r(o.translations.invoice_number),1),t("th",null,r(o.translations.client),1),t("th",null,r(o.translations.payment_date),1),t("th",null,r(o.translations.amount),1),t("th",null,r(o.translations.payment_method),1),t("th",null,r(o.translations.note),1),t("th",ke,r(o.translations.actions),1)])]),t("tbody",null,[(i(!0),d(p,null,_(n.payments,a=>(i(),d("tr",{key:a.id},[t("td",null,r(a.invoice_number),1),t("td",null,r(a.company_name),1),t("td",null,r(a.payment_date),1),t("td",null,[n.loadingPrice?(i(),d("div",Ce,Ee)):(i(),d("div",Me,[t("span",null,r(o.formatAmount(a.amount,n.default_currency_symbol)),1)]))]),t("td",null,r(a.method_name),1),t("td",null,r(a.notes),1),t("td",Be,[t("span",{class:"lg:tooltip","data-tip":o.translations.edit},[t("button",{class:"btn btn-circle mx-1",onClick:k=>o.editPayment(a.id)},De,8,Ve)],8,Se),t("span",{class:"lg:tooltip","data-tip":o.translations.delete},[t("button",{onClick:k=>o.confirmDeletePayment(a.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Ue,8,Ae)],8,Ie)])]))),128))])])),t("div",Oe,[(i(!0),d(p,null,_(n.paginationButtons,a=>(i(),d("button",{key:a,class:h(["join-item btn",{"btn-disabled":a==="..."||a===n.currentPage}]),onClick:k=>o.goToPage(a)},r(a),11,Xe))),128))])])]),_:1})])}var Le=M(de,[["render",qe]]);function b(s,e){const l=v();return b=function(c,n){return c=c-290,l[c]},b(s,e)}const Je=b;(function(s,e){const l=b,c=s();for(;[];)try{if(-parseInt(l(291))/1+parseInt(l(292))/2*(-parseInt(l(293))/3)+parseInt(l(297))/4+-parseInt(l(298))/5+parseInt(l(290))/6+parseInt(l(294))/7+-parseInt(l(296))/8*(-parseInt(l(299))/9)===e)break;c.push(c.shift())}catch{c.push(c.shift())}})(v,315751);function v(){const s=["2073728ctOWVm","930060ndJyzp","108ANlRub","387834ZULfPY","237519ysSqvc","2WpCsnx","1356813XmNFMS","1842610PsQABU","mount","230168ChWzdI"];return v=function(){return s},v()}const Ye=j({render:()=>D(Le)});Ye[Je(295)]("#my-easy-compta-payments-app");
     1import{_ as C,d as y,o as i,c as d,n as h,a as t,t as r,g as f,F as p,r as _,w as E,i as g,k as D,j as T,H as I,v as B,m as w,e as P,p as j,f as V,h as S}from"./plugin-vue_export-helper.min.js";import{C as A,R as U}from"./RemoveAlert.min.js";import{V as R}from"./vue-datepicker.min.js";import{g as F,b as X,s as N,f as W}from"./api.min.js";const z={components:{VueDatePicker:R},props:{loading:{type:Boolean,default:!1},showModal:{type:Boolean,default:!1},modalId:{type:String,required:!0},modalTitle:{type:String,default:""},payment:{type:Object,default:()=>({id:null,invoice_number:"",company_name:"",amount:"",payment_method_id:"",payment_date:"",note:"",payment_methods:[]})},disabled:{type:Boolean,default:!0},methods:Array},data(){const s=window.myEasyComptaAdmin.easyComptaTranslations;return{editedPayment:{...this.payment},loadingBtn:!1,toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},fields:{invoice_number:{label:s.invoice_number,disabled:this.disabled},company_name:{label:s.client,disabled:this.disabled},amount:{label:s.amount,disabled:!1},payment_method:{label:s.payment_method},payment_date:{label:s.payment_date}}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations},formattedDate(){return s=>{if(!s)return"";const e=s.getDate().toString().padStart(2,"0"),l=(s.getMonth()+1).toString().padStart(2,"0"),c=s.getFullYear();return`${e}-${l}-${c}`}},paymentMethods(){return this.methods},skeletonItems(){return Array.from({length:10},(s,e)=>e)}},methods:{closeModal(){document.getElementById("modal_payment_edit").close()},async submitForm(){this.loadingBtn=!0;try{const s=await fetch(`/wp-json/my-easy-compta/v1/payments/${this.editedPayment.id}`,{method:"PUT",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.editedPayment)});if(s.ok){const e=await s.json();this.closeModal(),this.loadingBtn=!1,this.showToast(e.message,"alert-success"),this.$emit("paymentEdited")}else{this.loadingBtn=!1;const e=`Error editing payment: ${s.statusText}`;this.showToast(e,"alert-error"),console.error(e)}}catch(s){const e=s.response&&s.response.data&&s.response.data.message?s.response.data.message:"Error editing payment";this.showToast(e,"alert-error"),console.error("Error editing payment:",s),this.loadingBtn=!1}},showToast(s,e){this.toast.message=s,this.toast.type=e,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)}},watch:{payment:{handler(s){this.editedPayment={...s}},immediate:!0}}},O=["id","open"],L={class:"modal-box"},q={class:"font-bold text-lg"},J={key:0},K={class:"grid grid-cols-2 gap-4"},Y=t("div",{class:"skeleton h-4 w-full mb-2"},null,-1),G=t("div",{class:"skeleton h-4 w-full"},null,-1),H=[Y,G],Q={class:"grid grid-cols-2 gap-4"},Z=["for"],$=["type","id","onUpdate:modelValue","disabled"],ee=["id"],te=["value"],se={class:"ecwp-group form-group mt-4"},ne={for:"note",class:"ecwp-label form-label"},ae={class:"form-group mt-4 flex justify-end"},oe=["disabled"],le={key:0,class:"loading loading-spinner loading-sm"};function ie(s,e,l,c,n,o){const x=y("VueDatePicker");return i(),d("div",null,[n.toast.visible?(i(),d("div",{key:0,class:h(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:h(["alert",n.toast.type,"text-white"])},[t("span",null,r(n.toast.message),1)],2)],2)):f("",!0),t("dialog",{id:l.modalId,class:"modal",open:l.showModal},[t("div",L,[t("h3",q,r(l.modalTitle),1),t("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:e[0]||(e[0]=(...m)=>o.closeModal&&o.closeModal(...m))}," \u2715 "),l.loading?(i(),d("div",J,[t("div",K,[(i(!0),d(p,null,_(o.skeletonItems,m=>(i(),d("div",{key:m,class:"py-2"},H))),128))])])):(i(),d("form",{key:1,onSubmit:e[4]||(e[4]=E((...m)=>o.submitForm&&o.submitForm(...m),["prevent"])),class:"form"},[t("div",Q,[(i(!0),d(p,null,_(n.fields,(m,u)=>(i(),d("div",{key:u,class:"ecwp-group form-group"},[t("label",{for:u,class:"ecwp-label form-label"},r(m.label),9,Z),u!=="payment_method"&&u!=="payment_date"?g((i(),d("input",{key:0,type:m.type||"text",id:u,"onUpdate:modelValue":a=>n.editedPayment[u]=a,class:h(["ecwp-input input","input-bordered",m.class||"w-full"]),disabled:m.disabled},null,10,$)),[[D,n.editedPayment[u]]]):u=="payment_method"?g((i(),d("select",{key:1,id:u,"onUpdate:modelValue":e[1]||(e[1]=a=>n.editedPayment.payment_method_id=a),class:h(["ecwp-input input","input-bordered",m.class||"w-full"])},[(i(!0),d(p,null,_(o.paymentMethods,a=>(i(),d("option",{key:a.id,value:a.id},r(a.method_name),9,te))),128))],10,ee)),[[T,n.editedPayment.payment_method_id]]):u=="payment_date"?(i(),I(x,{key:2,class:"ecwp-input ecwp-date input input-bordered w-full",id:"invoiceDate",modelValue:n.editedPayment.payment_date,"onUpdate:modelValue":e[2]||(e[2]=a=>n.editedPayment.payment_date=a),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr",required:""},null,8,["modelValue","format","min-date"])):f("",!0)]))),128))]),t("div",se,[t("label",ne,r(o.translations.note),1),g(t("textarea",{id:"note","onUpdate:modelValue":e[3]||(e[3]=m=>n.editedPayment.notes=m),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[B,n.editedPayment.notes]])]),t("div",ae,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(r(o.translations.save)+" ",1),n.loadingBtn?(i(),d("span",le)):f("",!0)],8,oe)])],32))])],8,O)])}var de=C(z,[["render",ie]]);const re={name:"Payments",components:{Card:A,PaymentEditModal:de,RemoveModal:U},data(){return{payments:[],paymentMethods:[],paymentForm:{invoice_id:"",client_id:"",amount:"",payment_method_id:"",payment_date:""},editPaymentModal:!1,selectedPayment:null,currentPage:1,totalPages:1,paginationButtons:[],loading:!0,loadingPrice:!0,loadingModal:!1,showRemoveModal:!1,skeletonRows:5,perPage:10,perPageOptions:[5,10,20,50],settings:[],default_currency_symbol:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"}}},created(){this.fetchPayments(),this.loadSettings()},methods:{fetchPayments(s=1){this.loading=!0;const{perPage:e}=this;fetch(`/wp-json/my-easy-compta/v1/payments?page=${s}&per_page=${e}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(l=>l.json()).then(l=>{this.payments=l.payments,this.totalCount=l.total_count,this.totalPages=l.total_pages,this.currentPage=l.page,this.perPage=e,this.generatePaginationButtons()}).catch(l=>{console.error("Error fetching payments:",l)}).finally(()=>{this.loading=!1})},editPayment(s){this.loadingModal=!0,this.editPaymentModal=!0,modal_payment_edit.showModal(),this.fetchPaymentDetails(s)},fetchPaymentDetails(s){fetch(`/wp-json/my-easy-compta/v1/payments/details/${s}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>e.json()).then(e=>{this.selectedPayment=e,this.paymentMethods=e.payment_methods,console.log(this.paymentMethods),this.loadingModal=!1}).catch(e=>{console.error("Error fetching payment details:",e),this.loadingModal=!1})},generatePaginationButtons(){this.paginationButtons=F(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchPayments(s)},perPageChanged(){this.fetchPayments()},formatAmount(s,e){return X(s,e,this.settings.currency_position)},showToast(s,e){N(this.toast,s,e)},closePaymentModal(){this.showPaymentModal=!1},confirmDeletePayment(s){this.selectedPayment=s,modal_remove.showModal(),this.showRemoveModal=!0},deletePayment(s){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/payments/${s}`,{method:"DELETE",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(e=>{if(!e.ok)throw new Error("Network response was not ok");return e.json()}).then(e=>{e.success?(this.fetchPayments(),this.showToast(e.message,"alert-success")):(this.showToast(e.message,"alert-error"),console.error("Error deleting payment:",e.statusText))}).catch(e=>{console.error("Error deleting payment:",e)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:s,currencySymbol:e,vatData:l}=await W();this.settings=s,this.default_currency_symbol=e,this.default_vat=l,this.loadingPrice=!1}catch(s){this.showToast(s.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},me={class:"pt-2 pr-4"},ce={class:"flex justify-between items-center"},ue={class:"card-title"},he={key:0},pe={class:"btn btn-outline btn-accent rounded-full",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab4"},_e=t("i",{class:"fas fa-file-export"},null,-1),ye=["data-tip"],fe={class:"btn btn-outline btn-accent rounded-full",disabled:""},ge=t("i",{class:"fas fa-file-export"},null,-1),be=t("div",{class:"divider mt-2"},null,-1),ve={class:"flex items-center mb-4"},xe={for:"perPageSelect",class:"mr-2"},Pe=["value"],we={class:"overflow-x-auto"},ke={key:0,class:"table w-full"},Me={class:"flex justify-center"},Ce={key:0},Te={key:1},Ee=t("span",{class:"loading loading-bars loading-sm"},null,-1),De=[Ee],Ie={class:"flex justify-end"},Be=["data-tip"],je=["onClick"],Ve=t("i",{class:"fas fa-pencil-alt"},null,-1),Se=[Ve],Ae=["data-tip"],Ue=["onClick"],Re=t("i",{class:"far fa-trash-alt"},null,-1),Fe=[Re],Xe={key:1},Ne=t("div",{class:"flex gap-4 items-center"},[t("div",{class:"skeleton w-16 h-16 rounded-full shrink-0"}),t("div",{class:"flex flex-col gap-4 w-full"},[t("div",{class:"skeleton h-4 w-full"}),t("div",{class:"skeleton h-4 w-full"})])],-1),We=t("div",{class:"divider my-1"},null,-1),ze=[Ne,We],Oe={class:"join ecwp_pagination mt-6 pt-4"},Le=["onClick"];function qe(s,e,l,c,n,o){const x=y("payment-edit-modal"),m=y("remove-modal"),u=y("Card");return i(),d("div",me,[n.toast.visible?(i(),d("div",{key:0,class:h(["toast",n.toast.position]),style:{zIndex:9999}},[t("div",{class:h(["alert",n.toast.type,"text-white"])},[t("span",null,r(n.toast.message),1)],2)],2)):f("",!0),P(x,{loading:n.loadingModal,"show-modal":n.editPaymentModal,"modal-id":"modal_payment_edit","modal-title":o.translations.edit_payment,payment:n.selectedPayment,methods:n.paymentMethods,onClose:e[0]||(e[0]=a=>n.editPaymentModal=!1),onPaymentEdited:o.fetchPayments},null,8,["loading","show-modal","modal-title","payment","methods","onPaymentEdited"]),P(m,{"show-modal":n.showRemoveModal,title:o.translations.are_you_sure,message:o.translations.no_turning_back,confirmText:o.translations.yes_delete_it,cancelText:o.translations.cancel,onConfirm:e[1]||(e[1]=a=>this.deletePayment(n.selectedPayment)),onCancel:e[2]||(e[2]=a=>n.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),P(u,{topMargin:"mt-8"},{default:j(()=>[t("div",ce,[t("h2",ue,r(o.translations.payments),1),n.settings.easy_compta_export_addon_active==1?(i(),d("div",he,[t("a",pe,[w(r(o.translations.export)+" ",1),_e])])):(i(),d("div",{key:1,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.active_export_addon},[t("button",fe,[w(r(o.translations.export)+" ",1),ge])],8,ye))]),be,t("div",ve,[t("label",xe,r(o.translations.display_per_page),1),g(t("select",{id:"perPageSelect","onUpdate:modelValue":e[3]||(e[3]=a=>n.perPage=a),onChange:e[4]||(e[4]=(...a)=>o.perPageChanged&&o.perPageChanged(...a))},[(i(!0),d(p,null,_(n.perPageOptions,a=>(i(),d("option",{key:a,value:a},r(a),9,Pe))),128))],544),[[T,n.perPage]])]),t("div",we,[n.loading?(i(),d("div",Xe,[(i(!0),d(p,null,_(n.skeletonRows,a=>(i(),d("div",{key:a,class:"flex flex-col gap-4 w-full"},ze))),128))])):(i(),d("table",ke,[t("thead",null,[t("tr",null,[t("th",null,r(o.translations.invoice_number),1),t("th",null,r(o.translations.client),1),t("th",null,r(o.translations.payment_date),1),t("th",null,r(o.translations.amount),1),t("th",null,r(o.translations.payment_method),1),t("th",null,r(o.translations.note),1),t("th",Me,r(o.translations.actions),1)])]),t("tbody",null,[(i(!0),d(p,null,_(n.payments,a=>(i(),d("tr",{key:a.id},[t("td",null,r(a.invoice_number),1),t("td",null,r(a.company_name),1),t("td",null,r(a.payment_date),1),t("td",null,[n.loadingPrice?(i(),d("div",Te,De)):(i(),d("div",Ce,[t("span",null,r(o.formatAmount(a.amount,n.default_currency_symbol)),1)]))]),t("td",null,r(a.method_name),1),t("td",null,r(a.notes),1),t("td",Ie,[t("span",{class:"lg:tooltip","data-tip":o.translations.edit},[t("button",{class:"btn btn-circle mx-1",onClick:k=>o.editPayment(a.id)},Se,8,je)],8,Be),t("span",{class:"lg:tooltip","data-tip":o.translations.delete},[t("button",{onClick:k=>o.confirmDeletePayment(a.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Fe,8,Ue)],8,Ae)])]))),128))])])),t("div",Oe,[(i(!0),d(p,null,_(n.paginationButtons,a=>(i(),d("button",{key:a,class:h(["join-item btn",{"btn-disabled":a==="..."||a===n.currentPage}]),onClick:k=>o.goToPage(a)},r(a),11,Le))),128))])])]),_:1})])}var Je=C(re,[["render",qe]]);function b(s,e){const l=v();return b=function(c,n){return c=c-128,l[c]},b(s,e)}function v(){const s=["22856ofIyzg","#my-easy-compta-payments-app","1506dDrrum","mount","7464WhPcke","2255025XEdZUX","5797wfoXAK","510NDggQI","6678xDEfiu","402WYbJVg","2943jKbvdr","620piUhzC","8090fcDvDI","5227884mLbhkG"];return v=function(){return s},v()}const M=b;(function(s,e){const l=b,c=s();for(;[];)try{if(parseInt(l(139))/1*(-parseInt(l(130))/2)+parseInt(l(135))/3*(parseInt(l(128))/4)+parseInt(l(133))/5+-parseInt(l(137))/6*(parseInt(l(136))/7)+-parseInt(l(132))/8*(parseInt(l(138))/9)+parseInt(l(140))/10*(parseInt(l(134))/11)+-parseInt(l(141))/12===e)break;c.push(c.shift())}catch{c.push(c.shift())}})(v,577202);const Ke=V({render:()=>S(Je)});Ke[M(131)](M(129));
  • my-easy-compta/trunk/assets/dist/quotes.min.js

    r3166746 r3167980  
    1 import{_ as c,d as u,o as i,H as _,f,h as m}from"./plugin-vue_export-helper.min.js";import{r as d}from"./index.min.js";import"./RemoveAlert.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./api.min.js";import"./vue3-editor.common.min.js";const I={name:"Quotes",mounted(){this.$router.push("/quotes")}};function h(r,n,t,e,s,a){const p=u("router-view");return i(),_(p)}var l=c(I,[["render",h]]);(function(r,n){const t=x,e=r();for(;[];)try{if(-parseInt(t(338))/1*(-parseInt(t(343))/2)+-parseInt(t(341))/3*(parseInt(t(342))/4)+-parseInt(t(340))/5*(parseInt(t(336))/6)+-parseInt(t(344))/7+parseInt(t(346))/8*(-parseInt(t(345))/9)+parseInt(t(337))/10*(-parseInt(t(348))/11)+parseInt(t(347))/12*(parseInt(t(339))/13)===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(o,300651);function x(r,n){const t=o();return x=function(e,s){return e=e-336,t[e]},x(r,n)}function o(){const r=["4YntvxT","90KLMUPB","1805496zqdZEG","10341VqMZEn","4040CTAOsz","68268ZQeDWC","11PVFehH","6VmPXPj","3518550mUQtol","5851XOzzXC","3770VcVjVm","1235915PkiXUr","525729ySaiNT"];return o=function(){return r},o()}const b=f({render:()=>m(l)});b.use(d).mount("#my-easy-compta-quotes-app");
     1import{_ as c,d as u,o as i,H as _,f,h as m}from"./plugin-vue_export-helper.min.js";import{r as d}from"./index.min.js";import"./RemoveAlert.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./api.min.js";import"./vue3-editor.common.min.js";const I={name:"Quotes",mounted(){this.$router.push("/quotes")}};function h(r,n,t,e,x,a){const p=u("router-view");return i(),_(p)}var b=c(I,[["render",h]]);const l=s;function o(){const r=["73310qqWBql","5860332EZLQoQ","928081pNBPtI","6204HNNCey","415RHLORY","8LlupuK","662908jGWAri","3796974UxYMov","3KOAiwd","721820xOvNmB","957xynehN","use"];return o=function(){return r},o()}(function(r,n){const t=s,e=r();for(;[];)try{if(-parseInt(t(314))/1+parseInt(t(317))/2*(parseInt(t(316))/3)+parseInt(t(311))/4*(-parseInt(t(312))/5)+parseInt(t(315))/6+parseInt(t(310))/7+parseInt(t(313))/8*(parseInt(t(309))/9)+parseInt(t(320))/10*(-parseInt(t(318))/11)===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(o,348032);function s(r,n){const t=o();return s=function(e,x){return e=e-309,t[e]},s(r,n)}const v=f({render:()=>m(b)});v[l(319)](d).mount("#my-easy-compta-quotes-app");
  • my-easy-compta/trunk/assets/dist/settings.min.js

    r3166746 r3167980  
    1 import{_ as $,d as I,o as c,c as d,n as y,a as e,t as l,g as b,e as x,p as z,m as g,w as k,i as p,v as f,G as C,F as T,r as S,j as V,y as tt,T as et,Z as st,J as nt,f as it,h as ot}from"./plugin-vue_export-helper.min.js";import{C as at,R as lt}from"./RemoveAlert.min.js";import{v as rt}from"./vue3-editor.common.min.js";const ct={name:"Settings",components:{Card:at,VueEditor:rt.exports.VueEditor,RemoveModal:lt},data(){return{loading:!1,selectedTab:1,form:{company_name:"",company_address:"",postal_code:"",city:"",country:"",company_email:"",company_phone:"",mobile_phone:"",fax:"",logo_mentions_active:"",logo_url:"",logo_path:"",default_currency:"",currency_position:"",vat_active:"",default_vat:"",date_format:"",logo_width:"",logo_mentions:"",invoice_color:"",invoice_prefix:"",show_phone:"",show_email:"",show_siren:"",show_tax_number:"",show_watermark:"",show_watermark_only_paid:"",invoice_footer:"",invoice_terms:"",credit_color:"",credit_prefix:"",credit_footer:"",credit_terms:"",quote_color:"",quote_prefix:"",quote_footer:"",quote_terms:"",easy_compta_planning_addon_active:"",easy_compta_email_addon_active:"",easy_compta_payment_addon_active:"",easy_compta_signature_addon_active:"",easy_compta_stats_addon_active:"",email_quote_subject:"",email_invoice_subject:"",remind_invoice_subject:"",remind_invoice_content:"",email_quote_content:"",email_invoice_content:"",email_create_account_subject:"",email_create_account_content:"",easycompta_siret_token_api:""},articles:[],categories:[],currencies:[],vats:[],expenses:[],planning:[],payments:[],logoPreviewUrl:"",previewWidth:"",showArticleModal:!1,showCurrencyModal:!1,showVATModal:!1,showPaymentModal:!1,showExpenseModal:!1,showPlanningModal:!1,currencyForm:{id:null,name:"",symbol:""},articleForm:{id:null,ref:"",name:"",description:"",unit_price:""},vatForm:{id:null,description:"",rate:""},paymentForm:{id:null,method_name:""},expenseForm:{id:null,name:""},planningForm:{id:null,name:"",background:"",color:""},showRemoveModal:!1,deleteType:null,selectedId:null,editingArticle:!1,editingCurrency:!1,editingVAT:!1,editingExpense:!1,editingPayment:!1,editingPlanning:!1,activeTabEmail:"tab1",activeTabUsers:"user1",license_key:"",loadingLicense:!1,licenseData:null,installed_versions:{},updatesAvailable:{},errorMessage:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"],["html"]]}},methods:{setActiveTab(s){this.activeTabEmail=s},setActiveTabUsers(s){this.activeTabUsers=s},selectTab(s){this.selectedTab=s,window.location.hash=`tab${s}`},checkHash(){const s=window.location.hash;if(s){const t=parseInt(s.replace("#tab",""));isNaN(t)||(this.selectedTab=t)}},tabClass(s){return this.selectedTab===s?"tab tab-active":"tab"},async fetchSettings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,s.ok){const t=await s.json();this.form={...this.form,...t},this.logoPreviewUrl=t.logo_url||"",this.form.easy_compta_planning_addon_active==1&&this.fetchPlanningCat()}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.loading=!1,this.showToast(s.message,"alert-error")}},async handleSubmit(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/settings/save",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.form)});if(this.loading=!1,s.ok){const t=await s.json();this.showToast(t,"alert-success")}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.loading=!1,this.showToast(s.message,"alert-error")}},async fetchArticles(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/articles",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();this.articles=t.articles,this.categories=t.categories}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchCurrencies(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/currencies",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.currencies=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchVATs(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/vats",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.vats=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchPaymentsMethods(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/payments-methods",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.payments=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchExpensesCat(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/expenses-cat",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.expenses=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchPlanningCat(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/planning-cat",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.planning=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async handleLogoUpload(s){const t=s.target.files[0];if(t){const o=new FormData;o.append("logo",t);try{const r=await fetch("/wp-json/my-easy-compta/v1/settings/upload-logo",{method:"POST",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce},body:o});if(r.ok){const i=await r.json();this.form.logo_url=i.url,this.form.logo_path=i.path,this.logoPreviewUrl=i.url,this.showToast("Logo uploaded successfully","alert-success")}else{const i=await r.json();this.showToast(i.message,"alert-error")}}catch(r){this.showToast(r.message,"alert-error")}}},async addArticle(){this.articleForm={id:null,ref:"",name:"",description:"",price:""},this.editingArticle=!1,this.showArticleModal=!0,this.$nextTick(()=>{document.getElementById("modal_article").showModal()})},async addCurrency(){this.currencyForm={id:null,name:"",symbol:""},this.editingCurrency=!1,this.showCurrencyModal=!0,this.$nextTick(()=>{document.getElementById("modal_currency").showModal()})},async deleteArticle(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/articles/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.articles=this.articles.filter(o=>o.id!==s),this.showToast(this.translations.deleted_successfully,"alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async deleteCategory(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/category/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.categories=this.categories.filter(o=>o.id!==s),this.showToast(this.translations.deleted_successfully,"alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async editArticle(s){const t=this.articles.find(o=>o.id===s);this.articleForm={...t},this.editingArticle=!0,this.showArticleModal=!0,this.$nextTick(()=>{document.getElementById("modal_article").showModal()})},async editCurrency(s){const t=this.currencies.find(o=>o.id===s);this.currencyForm={...t},this.editingCurrency=!0,this.showCurrencyModal=!0,this.$nextTick(()=>{document.getElementById("modal_currency").showModal()})},async deleteCurrency(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/currencies/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.currencies=this.currencies.filter(o=>o.id!==s),this.showToast("Currency deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveArticle(){const s=this.editingArticle?"PUT":"POST",t=this.editingArticle?`/wp-json/my-easy-compta/v1/settings/articles/${this.articleForm.id}`:"/wp-json/my-easy-compta/v1/settings/articles";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.articleForm)});if(o.ok){const r=await o.json();if(this.editingArticle){const i=this.articles.findIndex(n=>n.id===r.id);this.articles[i]=r}else this.articles.push(r);this.showToast(`Article ${this.editingArticle?"updated":"added"} successfully`,"alert-success"),this.closeArticleModal(),this.fetchArticles()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async saveCurrency(){const s=this.editingCurrency?"PUT":"POST",t=this.editingCurrency?`/wp-json/my-easy-compta/v1/settings/currencies/${this.currencyForm.id}`:"/wp-json/my-easy-compta/v1/settings/currencies";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.currencyForm)});if(o.ok){const r=await o.json();if(this.editingCurrency){const i=this.currencies.findIndex(n=>n.id===r.id);this.currencies[i]=r}else this.currencies.push(r);this.showToast(`Currency ${this.editingCurrency?"updated":"added"} successfully`,"alert-success"),this.closeCurrencyModal(),this.fetchCurrencies()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addVAT(){this.vatForm={id:null,description:"",rate:""},this.editingVAT=!1,this.showVATModal=!0,this.$nextTick(()=>{document.getElementById("modal_vat").showModal()})},async editVAT(s){const t=this.vats.find(o=>o.id===s);this.vatForm={...t},this.editingVAT=!0,this.showVATModal=!0,this.$nextTick(()=>{document.getElementById("modal_vat").showModal()})},async deleteVAT(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/vats/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.vats=this.vats.filter(o=>o.id!==s),this.showToast("VAT deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveVAT(){const s=this.editingVAT?"PUT":"POST",t=this.editingVAT?`/wp-json/my-easy-compta/v1/settings/vats/${this.vatForm.id}`:"/wp-json/my-easy-compta/v1/settings/vats";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.vatForm)});if(o.ok){const r=await o.json();if(this.editingVAT){const i=this.vats.findIndex(n=>n.id===r.id);this.vats[i]=r}else this.vats.push(r);this.showToast(`VAT ${this.editingVAT?"updated":"added"} successfully`,"alert-success"),this.closeVATModal(),this.fetchVATs()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addPayment(){this.paymentForm={id:null,method_name:""},this.editingPayment=!1,this.showPaymentModal=!0,this.$nextTick(()=>{document.getElementById("modal_payments").showModal()})},async editPayment(s){const t=this.payments.find(o=>o.id===s);this.paymentForm={...t},this.editingPayment=!0,this.showPaymentModal=!0,this.$nextTick(()=>{document.getElementById("modal_payments").showModal()})},async deletePayment(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/payments-methods/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.payments=this.payments.filter(o=>o.id!==s),this.showToast("Payment method deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async savePayment(){const s=this.editingPayment?"PUT":"POST",t=this.editingPayment?`/wp-json/my-easy-compta/v1/settings/payments-methods/${this.paymentForm.id}`:"/wp-json/my-easy-compta/v1/settings/payments-methods";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.paymentForm)});if(o.ok){const r=await o.json();if(this.editingPayment){const i=this.payments.findIndex(n=>n.id===r.id);this.payments[i]=r}else this.payments.push(r);this.showToast(`Payment method ${this.editingPayment?"updated":"added"} successfully`,"alert-success"),this.closePaymentModal(),this.fetchPaymentsMethods()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addExpCat(){this.expenseForm={id:null,name:""},this.editingExpense=!1,this.showExpenseModal=!0,this.$nextTick(()=>{document.getElementById("modal_expenses").showModal()})},async editExpCat(s){const t=this.expenses.find(o=>o.id===s);this.expenseForm={...t},this.editingExpense=!0,this.showExpenseModal=!0,this.$nextTick(()=>{document.getElementById("modal_expenses").showModal()})},async deleteExpCat(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/expenses-categories/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.expenses=this.expenses.filter(o=>o.id!==s),this.showToast("Expense category deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveExpCat(){const s=this.editingExpense?"PUT":"POST",t=this.editingExpense?`/wp-json/my-easy-compta/v1/settings/expenses-categories/${this.expenseForm.id}`:"/wp-json/my-easy-compta/v1/settings/expenses-categories";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.expenseForm)});if(o.ok){const r=await o.json();if(this.editingExpense){const i=this.expenses.findIndex(n=>n.id===r.id);this.expenses[i]=r}else this.expenses.push(r);this.showToast(`Expense category ${this.editingExpense?"updated":"added"} successfully`,"alert-success"),this.closeExpenseModal(),this.fetchExpensesCat()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addPlanningCat(){this.planningForm={id:null,name:""},this.editingPlanning=!1,this.showPlanningModal=!0,this.$nextTick(()=>{document.getElementById("modal_planning").showModal()})},async editPlanningCat(s){const t=this.planning.find(o=>o.id===s);this.planningForm={...t},this.editingPlanning=!0,this.showPlanningModal=!0,this.$nextTick(()=>{document.getElementById("modal_planning").showModal()})},async deletePlanningCat(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/planning-categories/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.planning=this.planning.filter(o=>o.id!==s),this.showToast("Planning category deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async savePlanningCat(){this.loading=!0;const s=this.editingPlanning?"PUT":"POST",t=this.editingPlanning?`/wp-json/my-easy-compta/v1/settings/planning-categories/${this.planningForm.id}`:"/wp-json/my-easy-compta/v1/settings/planning-categories";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.planningForm)});if(o.ok){const r=await o.json();if(this.editingPlanning){const i=this.planning.findIndex(n=>n.id===r.id);this.planning[i]=r,this.loading=!1}else this.planning.push(r),this.loading=!1;this.showToast(`Planning category ${this.editingPlanning?"updated":"added"} successfully`,"alert-success"),this.closePlanningModal(),this.fetchPlanningCat()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},closeCurrencyModal(){this.showCurrencyModal=!1},closeArticleModal(){this.showArticleModal=!1},closeVATModal(){this.showVATModal=!1},closePaymentModal(){this.showPaymentModal=!1},closeExpenseModal(){this.showExpenseModal=!1},closePlanningModal(){this.showPlanningModal=!1},updatePreviewWidth(){this.previewWidth=this.form.logo_width+"px"},updateVatActive(s){this.form.vat_active=s.target.checked?1:0},updateLogoMentionsActive(s){this.form.logo_mentions_active=s.target.checked?1:0},updateEmailLogsActive(s){this.form.email_log_active=s.target.checked?1:0},updateFormField(s,t){this.form[t]=s.target.checked?1:0},showToast(s,t){this.toast.message=s,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},handleDeletion(s,t){const o=this.getDeletionFunction(s);o?o(t):this.showToast("error","alert-error")},delete_item(s,t){this.deleteType=s,this.selectedId=t,modal_remove.showModal(),this.showRemoveModal=!0},getDeletionFunction(s){switch(s){case"licence":return this.confirmLicense;case"vat":return this.deleteVAT;case"currency":return this.deleteCurrency;case"expense":return this.deleteExpCat;case"payment":return this.deletePayment;case"planning":return this.deletePlanningCat;case"article":return this.deleteArticle;case"category_article":return this.deleteCategory;default:return null}},async checkLicense(){this.loadingLicense=!0,this.errorMessage="",this.licenseData=null;try{const t=await(await fetch("/wp-json/my-easy-compta/v1/license/validate-license",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({license_key:this.license_key})})).json();t.valid?(this.licenseData=t,await this.storeLicense(t)):this.errorMessage=t.message}catch{this.errorMessage="An error occurred while validating the license."}finally{this.loadingLicense=!1}},async storeLicense(s){try{await fetch("/wp-json/my-easy-compta/v1/license/store-license",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({license_key:this.license_key,license_data:s})})}catch{this.errorMessage="An error occurred while storing the license.",this.loading=!1}},async loadLicenseDetails(){this.loading=!0;try{const s=await fetch("/wp-json/my-easy-compta/v1/license/check-license",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();t.valid&&(this.licenseData=t.license_data,this.installed_versions=t.installed_versions,this.license_key="****-****-****-****-****"+this.license_key.substr(this.license_key.length-4),this.loading=!1)}else console.error("Failed to load license details"),this.loading=!1}catch(s){console.error("Error loading license details",s),this.loading=!1}},async confirmLicense(){try{const s=await fetch("/wp-json/my-easy-compta/v1/license/delete-license",{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();this.showToast(t.message,"alert-success"),this.licenseData="",this.license_key=""}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async checkUpdatePlugin(s,t){try{const r=await(await fetch("/wp-json/my-easy-compta/v1/license/check-update",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({plugin_slug:s,current_version:t})})).json();r.success?r.update_available?(this.showToast(this.translations.update_available+" "+r.new_version,"alert-success"),this.updatesAvailable[s]=r.update_available):this.showToast(this.translations.no_update_available,"alert-error"):this.showToast(this.translations.failed_update_available,"alert-error")}catch(o){console.error("Error checking for plugin update:",o),this.showToast(this.translations.failed_update_available,"alert-error")}},async installUpdatePlugin(s){try{const o=await(await fetch("/wp-json/my-easy-compta/v1/license/download-update",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({plugin_slug:s})})).json();if(o.success){this.showToast(this.translations.success,"alert-success");const r=document.createElement("a");r.href=o.download_url,r.setAttribute("download",""),document.body.appendChild(r),r.click(),document.body.removeChild(r)}else this.showToast(this.translations.error,"alert-error")}catch(t){console.error("Error checking for plugin update:",t),this.showToast(this.translations.error,"alert-error")}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},beforeUnmount(){window.removeEventListener("hashchange",this.checkHash)},mounted(){this.checkHash(),window.addEventListener("hashchange",this.checkHash),this.fetchSettings(),this.fetchArticles(),this.fetchCurrencies(),this.fetchVATs(),this.fetchPaymentsMethods(),this.fetchExpensesCat(),this.loadLicenseDetails()}},dt={class:"pt-2 pr-4"},ut={class:"flex justify-between items-center"},ht={class:"card-title"},pt=e("div",{class:"divider mt-2"},null,-1),mt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},ft={class:"tabs tabs-vertical tabs-boxed col-span-1"},bt=e("i",{class:"fas fa-home mr-2"},null,-1),_t=e("i",{class:"fas fa-tools mr-2"},null,-1),gt=e("i",{class:"fas fa-newspaper mr-2"},null,-1),vt=e("i",{class:"fas fa-file-invoice-dollar mr-2"},null,-1),yt=e("i",{class:"fas fa-undo mr-2"},null,-1),wt=e("i",{class:"far fa-question-circle mr-2"},null,-1),xt=e("i",{class:"fas fa-dollar-sign mr-2"},null,-1),kt=e("i",{class:"fas fa-money-check-alt mr-2"},null,-1),Ct=e("i",{class:"fas fa-shopping-basket mr-2"},null,-1),Tt=e("i",{class:"fas fa-calendar-alt mr-2"},null,-1),Mt=e("i",{class:"far fa-envelope mr-2"},null,-1),At=e("i",{class:"fas fa-user mr-2"},null,-1),St=e("i",{class:"far fa-credit-card mr-2"},null,-1),Pt=e("i",{class:"far fa-chart-bar mr-2"},null,-1),Et=e("i",{class:"far fa-id-badge mr-2"},null,-1),jt={class:"col-span-3 p-4 bg-base-300 rounded-lg shadow-md content-tabs"},Vt={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},It=e("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Ft=[It],Rt={key:1},Ut={class:"text-xl font-semibold mb-4"},Dt={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Ht={class:"ecwp-group form-control"},Yt={class:"ecwp-label label",for:"company-code"},Nt={class:"ecwp-group form-control"},qt={class:"ecwp-label label",for:"tax-number"},Lt={class:"ecwp-group form-control"},Ot={class:"ecwp-label label",for:"company-name"},Wt={class:"ecwp-group form-control"},Xt={class:"ecwp-label label",for:"company-address"},Bt={class:"ecwp-group form-control"},zt={class:"ecwp-label label",for:"postal-code"},Gt={class:"ecwp-group form-control"},Jt={class:"ecwp-label label",for:"city"},Zt={class:"ecwp-group form-control"},Qt={class:"ecwp-label label",for:"country"},Kt={class:"ecwp-group form-control"},$t={class:"ecwp-label label",for:"company-email"},te={class:"ecwp-group form-control"},ee={class:"ecwp-label label",for:"company-phone"},se={class:"ecwp-group form-control"},ne={class:"ecwp-label label",for:"mobile-phone"},ie={class:"ecwp-group form-control"},oe={class:"ecwp-label label",for:"fax"},ae=e("div",{class:"divider my-4"},null,-1),le={key:0},re={class:"grid grid-cols-2 gap-4"},ce={class:"ecwp-group form-control indicator"},de={class:"ecwp-label label",for:"company-code"},ue=e("span",{class:"indicator-item badge mt-5 border-blue-700"},[e("a",{href:"https://api.gouv.fr/les-api/sirene_v3",target:"_blank"},"?")],-1),he={class:"mt-6 flex justify-end"},pe={type:"submit",class:"btn btn-primary rounded-full"},me=e("i",{class:"far fa-save"},null,-1),fe={key:2},be={class:"text-xl font-semibold mb-4"},_e={class:"form-control mt-4 mb-1"},ge={class:"cursor-pointer"},ve={class:"label-text mr-2 font-bold"},ye=["checked"],we={key:0,class:"ecwp-group form-control"},xe={class:"ecwp-label label",for:"logo-mentions"},ke={class:"ecwp-group form-control"},Ce={class:"label"},Te={class:"ecwp-file"},Me={for:"file_logo"},Ae=e("i",{class:"fas fa-cloud-upload-alt mr-2"},null,-1),Se={key:0,class:"max-w-md"},Pe={class:"py-2 font-bold"},Ee={key:0},je=["src"],Ve={class:"ecwp-group form-control"},Ie={class:"ecwp-label label"},Fe=["value"],Re={class:"ecwp-group form-control"},Ue={class:"ecwp-label label"},De={value:"before"},He={value:"after"},Ye={class:"form-control mt-4 mb-1"},Ne={class:"cursor-pointer"},qe={class:"label-text mr-2 font-bold"},Le=["checked"],Oe={key:1,class:"ecwp-group form-control"},We={class:"ecwp-label label"},Xe=e("option",{value:"0"},null,-1),Be=["value"],ze={class:"ecwp-group form-control mt-2"},Ge={class:"ecwp-label label"},Je=e("option",{value:"DD-MM-YYYY",selected:"selected"}," DD-MM-YYYY ",-1),Ze=e("option",{value:"MM-DD-YYYY"},"MM-DD-YYYY",-1),Qe=e("option",{value:"YYYY-MM-DD"},"YYYY-MM-DD",-1),Ke=e("option",{value:"YYYY/MM/DD"},"YYYY/MM/DD",-1),$e=e("option",{value:"DD/MM/YYYY"},"DD/MM/YYYY",-1),ts=e("option",{value:"MM/DD/YYYY"},"MM/DD/YYYY",-1),es=e("option",{value:"YYYY.MM.DD"},"YYYY.MM.DD",-1),ss=e("option",{value:"DD.MM.YYYY"},"DD.MM.YYYY",-1),ns=e("option",{value:"MM.DD.YYYY"},"MM.DD.YYYY",-1),is=[Je,Ze,Qe,Ke,$e,ts,es,ss,ns],os={class:"mt-6 flex justify-end"},as={type:"submit",class:"btn btn-primary rounded-full"},ls=e("i",{class:"far fa-save"},null,-1),rs={key:3},cs={key:0,id:"modal_article",class:"modal"},ds={class:"modal-box"},us={class:"ecwp-group form-control"},hs={class:"ecwp-label label",for:"name_ref"},ps={class:"ecwp-group form-control"},ms={class:"ecwp-label label",for:"name_article"},fs={class:"ecwp-group form-control"},bs={class:"ecwp-label label",for:"desc_article"},_s={class:"ecwp-group form-control"},gs={class:"ecwp-label label",for:"price_article"},vs={class:"form-group mt-4 flex justify-end"},ys={type:"submit",class:"btn btn-primary rounded-full mx-2"},ws={class:"flex justify-between items-center mb-4"},xs={class:"text-lg font-semibold"},ks=e("i",{class:"fas fa-plus mr-2"},null,-1),Cs={class:"table-container"},Ts={class:"table w-full"},Ms=["onClick"],As=e("i",{class:"fas fa-edit"},null,-1),Ss=[As],Ps=["onClick"],Es=e("i",{class:"fas fa-trash"},null,-1),js=[Es],Vs=e("div",{class:"divider mt-2 mb-4"},null,-1),Is={class:"text-xl font-semibold mb-4"},Fs={class:"table-container"},Rs={class:"table w-full"},Us=["onClick"],Ds=e("i",{class:"fas fa-trash"},null,-1),Hs=[Ds],Ys={key:4},Ns={class:"text-xl font-semibold mb-4"},qs={class:"grid grid-cols-2 gap-4"},Ls={class:"ecwp-group form-control"},Os={class:"ecwp-label label",for:"invoice-color"},Ws={class:"ecwp-group form-control"},Xs={class:"ecwp-label label",for:"invoice-prefix"},Bs=e("div",{class:"divider my-4"},null,-1),zs={class:"grid grid-cols-2 gap-4"},Gs={class:"form-control mt-4 mb-1"},Js={class:"cursor-pointer"},Zs=["checked"],Qs={class:"label-text mr-2 font-bold"},Ks={class:"form-control mt-4 mb-1"},$s={class:"cursor-pointer"},tn=["checked"],en={class:"label-text mr-2 font-bold"},sn={class:"form-control mt-4 mb-1"},nn={class:"cursor-pointer"},on=["checked"],an={class:"label-text mr-2 font-bold"},ln={class:"form-control mt-4 mb-1"},rn={class:"cursor-pointer"},cn=["checked"],dn={class:"label-text mr-2 font-bold"},un={class:"form-control mt-4 mb-1"},hn={class:"cursor-pointer"},pn=["checked"],mn={class:"label-text mr-2 font-bold"},fn={key:0,class:"form-control mt-4 mb-1"},bn={class:"cursor-pointer"},_n=["checked"],gn={class:"label-text mr-2 font-bold"},vn=e("div",{class:"divider my-4"},null,-1),yn={class:"grid grid-cols-2 gap-4"},wn={class:"ecwp-group form-control"},xn={class:"ecwp-label label",for:"conditions-payment"},kn={class:"ecwp-group form-control"},Cn={class:"ecwp-label label",for:"mode-payment"},Tn={class:"grid grid-cols-1 gap-4"},Mn={class:"form-control"},An={class:"ecwp-label label",for:"invoice-prefix"},Sn={class:"grid grid-cols-2 gap-4"},Pn={class:"ecwp-group form-control"},En={class:"ecwp-label label",for:"invoice-iban"},jn={class:"ecwp-group form-control"},Vn={class:"ecwp-label label",for:"invoice-bic"},In={class:"form-control"},Fn={class:"ecwp-label label",for:"invoice-prefix"},Rn={class:"mt-6 flex justify-end"},Un={type:"submit",class:"btn btn-primary rounded-full"},Dn=e("i",{class:"far fa-save"},null,-1),Hn={key:5},Yn={class:"text-xl font-semibold mb-4"},Nn={class:"grid grid-cols-2 gap-4"},qn={class:"ecwp-group form-control"},Ln={class:"ecwp-label label",for:"credit-color"},On={class:"ecwp-group form-control"},Wn={class:"ecwp-label label",for:"credit-prefix"},Xn={class:"grid grid-cols-1 gap-4"},Bn={class:"form-control"},zn={class:"ecwp-label label",for:"credit-prefix"},Gn={class:"form-control"},Jn={class:"ecwp-label label",for:"credit-prefix"},Zn={class:"mt-6 flex justify-end"},Qn={type:"submit",class:"btn btn-primary rounded-full"},Kn=e("i",{class:"far fa-save"},null,-1),$n={key:6},ti={class:"text-xl font-semibold mb-4"},ei={class:"grid grid-cols-2 gap-4"},si={class:"ecwp-group form-control"},ni={class:"ecwp-label label",for:"quote-color"},ii={class:"ecwp-group form-control"},oi={class:"ecwp-label label",for:"quote-prefix"},ai={class:"grid grid-cols-1 gap-4"},li={class:"form-control"},ri={class:"ecwp-label label",for:"quote-prefix"},ci={class:"form-control"},di={class:"ecwp-label label",for:"quote-prefix"},ui={class:"mt-6 flex justify-end"},hi={type:"submit",class:"btn btn-primary rounded-full"},pi=e("i",{class:"far fa-save"},null,-1),mi={key:7},fi={class:"text-xl font-semibold mb-4"},bi={key:0,id:"modal_currency",class:"modal"},_i={class:"modal-box"},gi={class:"ecwp-group form-control"},vi={class:"ecwp-label label",for:"name_currency"},yi={class:"ecwp-group form-control"},wi={class:"ecwp-label label",for:"symbol_currency"},xi={class:"ecwp-group form-control"},ki={class:"ecwp-label label",for:"code_currency"},Ci={class:"form-group mt-4 flex justify-end"},Ti={type:"submit",class:"btn btn-primary rounded-full mx-2"},Mi={class:"mb-8"},Ai={class:"flex justify-between items-center mb-4"},Si={class:"text-lg font-semibold"},Pi=e("i",{class:"fas fa-plus mr-2"},null,-1),Ei={class:"table-container"},ji={class:"table w-full"},Vi=["onClick"],Ii=e("i",{class:"fas fa-edit"},null,-1),Fi=[Ii],Ri=["onClick"],Ui=e("i",{class:"fas fa-trash"},null,-1),Di=[Ui],Hi={key:0,id:"modal_vat",class:"modal"},Yi={class:"modal-box"},Ni={class:"ecwp-group form-control"},qi={class:"ecwp-label label",for:"vat-description"},Li={class:"ecwp-group form-control"},Oi={class:"ecwp-label label",for:"vat-rate"},Wi={class:"form-group mt-4 flex justify-end"},Xi={type:"submit",class:"btn btn-primary rounded-full mx-2"},Bi={class:"flex justify-between items-center mb-4"},zi={class:"text-lg font-semibold"},Gi=e("i",{class:"fas fa-plus mr-2"},null,-1),Ji={class:"table-container"},Zi={class:"table w-full"},Qi=["onClick"],Ki=e("i",{class:"fas fa-edit"},null,-1),$i=[Ki],to=["onClick"],eo=e("i",{class:"fas fa-trash"},null,-1),so=[eo],no={key:8},io={class:"text-xl font-semibold mb-4"},oo={key:0,id:"modal_payments",class:"modal"},ao={class:"modal-box"},lo={class:"ecwp-group form-control"},ro={class:"ecwp-label label",for:"name_payment"},co={class:"form-group mt-4 flex justify-end"},uo={type:"submit",class:"btn btn-primary rounded-full mx-2"},ho={class:"mb-8"},po={class:"flex justify-between items-center mb-4"},mo={class:"text-lg font-semibold"},fo=e("i",{class:"fas fa-plus mr-2"},null,-1),bo={class:"table-container"},_o={class:"table w-full"},go=["onClick"],vo=e("i",{class:"fas fa-edit"},null,-1),yo=[vo],wo=["onClick"],xo=e("i",{class:"fas fa-trash"},null,-1),ko=[xo],Co={key:9},To={class:"text-xl font-semibold mb-4"},Mo={key:0,id:"modal_expenses",class:"modal"},Ao={class:"modal-box"},So={class:"ecwp-group form-control"},Po={class:"ecwp-label label",for:"name_expense"},Eo={class:"form-group mt-4 flex justify-end"},jo={type:"submit",class:"btn btn-primary rounded-full mx-2"},Vo={class:"mb-8"},Io={class:"flex justify-between items-center mb-4"},Fo={class:"text-lg font-semibold"},Ro=e("i",{class:"fas fa-plus mr-2"},null,-1),Uo={class:"table-container"},Do={class:"table w-full"},Ho=["onClick"],Yo=e("i",{class:"fas fa-edit"},null,-1),No=[Yo],qo=["onClick"],Lo=e("i",{class:"fas fa-trash"},null,-1),Oo=[Lo],Wo={key:10},Xo={class:"text-xl font-semibold mb-4"},Bo={key:0,id:"modal_planning",class:"modal"},zo={class:"modal-box"},Go={class:"ecwp-group form-control"},Jo={class:"ecwp-label label",for:"name_planning"},Zo={class:"ecwp-group form-control"},Qo={class:"ecwp-label label",for:"background_planning"},Ko={class:"ecwp-group form-control"},$o={class:"ecwp-label label",for:"color_planning"},ta={class:"form-group mt-4 flex justify-end"},ea=["disabled"],sa={key:0,class:"loading loading-spinner loading-sm"},na={class:"mb-8"},ia={class:"flex justify-between items-center mb-4"},oa={class:"text-lg font-semibold"},aa=e("i",{class:"fas fa-plus mr-2"},null,-1),la={class:"table-container"},ra={class:"table w-full"},ca=["onClick"],da=e("i",{class:"fas fa-edit"},null,-1),ua=[da],ha=["onClick"],pa=e("i",{class:"fas fa-trash"},null,-1),ma=[pa],fa={key:11},ba={class:"text-xl font-semibold mb-4"},_a={class:"form-control mt-4 mb-4"},ga={class:"cursor-pointer"},va={class:"label-text mr-2 font-bold"},ya=["checked"],wa=e("div",{class:"divider mt-2 mb-4"},null,-1),xa={role:"tablist",class:"tabs tabs-boxed"},ka={key:0,class:"p-4"},Ca={class:"grid grid-cols-1 gap-4"},Ta={class:"ecwp-group form-control"},Ma={class:"ecwp-label label",for:"email_invoice_subject"},Aa={class:"form-control"},Sa={class:"ecwp-label label"},Pa=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{DUE_DATE}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")])],-1),Ea={key:1,class:"p-4"},ja={class:"grid grid-cols-1 gap-4"},Va={class:"ecwp-group form-control"},Ia={class:"ecwp-label label",for:"email_quote_subject"},Fa={class:"form-control"},Ra={class:"ecwp-label label"},Ua=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")]),e("pre",null,[e("b",null,"{CREATED_DATE}")]),e("pre",null,[e("b",null,"{DUE_DATE}")])],-1),Da={key:2,class:"p-4"},Ha={class:"grid grid-cols-1 gap-4"},Ya={class:"ecwp-group form-control"},Na={class:"ecwp-label label",for:"remind_invoice_subject"},qa={class:"form-control"},La={class:"ecwp-label label"},Oa=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{DUE_DATE}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")])],-1),Wa={key:3,class:"p-4"},Xa={role:"alert",class:"alert shadow"},Ba=e("i",{class:"fas fa-exclamation-circle"},null,-1),za={class:"text-xl text-center my-4"},Ga={class:"mt-6 flex justify-end"},Ja={type:"submit",class:"btn btn-primary rounded-full"},Za=e("i",{class:"far fa-save"},null,-1),Qa={key:12},Ka={class:"text-xl font-semibold mb-4"},$a={role:"tablist",class:"tabs tabs-boxed"},tl={key:0,class:"p-4"},el={class:"grid grid-cols-1 gap-4"},sl={class:"ecwp-group form-control"},nl={class:"ecwp-label label",for:"email_create_account_subject"},il={class:"form-control"},ol={class:"ecwp-label label"},al=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{USERNAME}")]),e("pre",null,[e("b",null,"{PASSWORD}")])],-1),ll={class:"mt-6 flex justify-end"},rl={type:"submit",class:"btn btn-primary rounded-full"},cl=e("i",{class:"far fa-save"},null,-1),dl={key:1,class:"p-4"},ul={role:"alert",class:"alert shadow"},hl=e("i",{class:"fas fa-exclamation-circle"},null,-1),pl={class:"text-xl text-center my-4"},ml={key:13},fl={class:"text-xl font-semibold mb-4"},bl={class:"grid grid-cols-1 gap-4"},_l={class:"ecwp-group form-control"},gl={class:"ecwp-label label",for:"stripe-mode"},vl={value:"test"},yl={value:"live"},wl={key:0},xl={class:"ecwp-group form-control"},kl={class:"ecwp-label label",for:"stripe-public-key-test"},Cl={class:"ecwp-group form-control"},Tl={class:"ecwp-label label",for:"stripe-secret-key-test"},Ml={key:1},Al={class:"ecwp-group form-control"},Sl={class:"ecwp-label label",for:"stripe-public-key-live"},Pl={class:"ecwp-group form-control"},El={class:"ecwp-label label",for:"stripe-secret-key-live"},jl={class:"mt-6 flex justify-end"},Vl={type:"submit",class:"btn btn-primary rounded-full"},Il=e("i",{class:"far fa-save"},null,-1),Fl={key:14},Rl={class:"text-xl font-semibold mb-4"},Ul={class:"grid grid-cols-1 gap-4"},Dl={class:"ecwp-group form-control mt-2"},Hl={class:"ecwp-label label",for:"limit-declaration"},Yl={class:"ecwp-group form-control mt-2"},Nl={class:"ecwp-label label",for:"limit-tva"},ql={class:"mt-6 flex justify-end"},Ll={type:"submit",class:"btn btn-primary rounded-full"},Ol=e("i",{class:"far fa-save"},null,-1),Wl={key:15},Xl={class:"text-xl font-semibold mb-4"},Bl={class:"grid grid-cols-2 gap-4"},zl={class:"ecwp-group form-group relative join"},Gl={class:"ecwp-label label",for:"license-code"},Jl=["disabled"],Zl=["disabled"],Ql={key:0,class:"loading loading-spinner loading-sm"},Kl={key:1},$l={class:"grid grid-cols-1 gap-4"},tr={key:0,class:"error-message"},er={key:1,class:"overflow-x-auto my-4"},sr={class:"table table-xs table-pin-rows table-pin-cols"},nr=e("i",{class:"far fa-trash-alt"},null,-1),ir=[nr],or={class:"table table-xs table-pin-rows table-pin-cols mt-6"},ar=["onClick"],lr=["onClick"],rr=["onClick"];function cr(s,t,o,r,i,n){const m=I("remove-modal"),u=I("color-input"),_=I("vue-editor"),M=I("Card");return c(),d("div",dt,[i.toast.visible?(c(),d("div",{key:0,class:y(["toast",i.toast.position]),style:{zIndex:9999}},[e("div",{class:y(["alert",i.toast.type,"text-white"])},[e("span",null,l(i.toast.message),1)],2)],2)):b("",!0),x(m,{"show-modal":i.showRemoveModal,title:n.translations.are_you_sure,message:n.translations.no_turning_back,confirmText:n.translations.yes_delete_it,cancelText:n.translations.cancel,onConfirm:t[0]||(t[0]=a=>n.handleDeletion(i.deleteType,i.selectedId)),onCancel:t[1]||(t[1]=a=>i.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),x(M,{topMargin:"mt-8"},{default:z(()=>[e("div",ut,[e("h2",ht,l(n.translations.settings),1)]),pt,e("div",mt,[e("div",ft,[e("a",{class:y([n.tabClass(1),"justify-start w-full"]),onClick:t[2]||(t[2]=a=>n.selectTab(1))},[bt,g(" "+l(n.translations.general_settings),1)],2),e("a",{class:y([n.tabClass(2),"justify-start w-full"]),onClick:t[3]||(t[3]=a=>n.selectTab(2))},[_t,g(" "+l(n.translations.system_settings),1)],2),e("a",{class:y([n.tabClass(3),"justify-start w-full"]),onClick:t[4]||(t[4]=a=>n.selectTab(3))},[gt,g(" "+l(n.translations.articles_settings),1)],2),e("a",{class:y([n.tabClass(4),"justify-start w-full"]),onClick:t[5]||(t[5]=a=>n.selectTab(4))},[vt,g(" "+l(n.translations.invoices_settings),1)],2),e("a",{class:y([n.tabClass(5),"justify-start w-full"]),onClick:t[6]||(t[6]=a=>n.selectTab(5))},[yt,g(" "+l(n.translations.credits_settings),1)],2),e("a",{class:y([n.tabClass(6),"justify-start w-full"]),onClick:t[7]||(t[7]=a=>n.selectTab(6))},[wt,g(" "+l(n.translations.quotes_settings),1)],2),e("a",{class:y([n.tabClass(7),"justify-start w-full"]),onClick:t[8]||(t[8]=a=>n.selectTab(7))},[xt,g(" "+l(n.translations.currency_vat_settings),1)],2),e("a",{class:y([n.tabClass(8),"justify-start w-full"]),onClick:t[9]||(t[9]=a=>n.selectTab(8))},[kt,g(" "+l(n.translations.payments_settings),1)],2),e("a",{class:y([n.tabClass(9),"justify-start w-full"]),onClick:t[10]||(t[10]=a=>n.selectTab(9))},[Ct,g(" "+l(n.translations.expenses_settings),1)],2),i.form.easy_compta_planning_addon_active==1?(c(),d("a",{key:0,class:y([n.tabClass(10),"justify-start w-full"]),onClick:t[11]||(t[11]=a=>n.selectTab(10))},[Tt,g(" "+l(n.translations.planning_settings),1)],2)):b("",!0),i.form.easy_compta_email_addon_active==1?(c(),d("a",{key:1,class:y([n.tabClass(11),"justify-start w-full"]),onClick:t[12]||(t[12]=a=>n.selectTab(11))},[Mt,g(" "+l(n.translations.email_settings),1)],2)):b("",!0),i.form.easy_compta_user_addon_active==1?(c(),d("a",{key:2,class:y([n.tabClass(12),"justify-start w-full"]),onClick:t[13]||(t[13]=a=>n.selectTab(12))},[At,g(" "+l(n.translations.users_settings),1)],2)):b("",!0),i.form.easy_compta_payment_addon_active==1?(c(),d("a",{key:3,class:y([n.tabClass(13),"justify-start w-full"]),onClick:t[14]||(t[14]=a=>n.selectTab(13))},[St,g(" "+l(n.translations.stripe_settings),1)],2)):b("",!0),i.form.easy_compta_stats_addon_active==1?(c(),d("a",{key:4,class:y([n.tabClass(14),"justify-start w-full"]),onClick:t[15]||(t[15]=a=>n.selectTab(14))},[Pt,g(" "+l(n.translations.stats_settings),1)],2)):b("",!0),e("a",{class:y([n.tabClass(15),"justify-start w-full"]),onClick:t[16]||(t[16]=a=>n.selectTab(15))},[Et,g(" "+l(n.translations.validation_license),1)],2)]),e("div",jt,[i.loading?(c(),d("div",Vt,Ft)):b("",!0),i.selectedTab===1?(c(),d("div",Rt,[e("h2",Ut,l(n.translations.general_settings),1),e("form",{onSubmit:t[29]||(t[29]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Dt,[e("div",Ht,[e("label",Yt,l(n.translations.company_code),1),p(e("input",{type:"text",id:"company-code","onUpdate:modelValue":t[17]||(t[17]=a=>i.form.company_code=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_code]])]),e("div",Nt,[e("label",qt,l(n.translations.tax_number),1),p(e("input",{type:"text",id:"tax-number","onUpdate:modelValue":t[18]||(t[18]=a=>i.form.tax_number=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.tax_number]])]),e("div",Lt,[e("label",Ot,l(n.translations.company_name),1),p(e("input",{type:"text",id:"company-name","onUpdate:modelValue":t[19]||(t[19]=a=>i.form.company_name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.company_name]])]),e("div",Wt,[e("label",Xt,l(n.translations.address),1),p(e("input",{type:"text",id:"company-address","onUpdate:modelValue":t[20]||(t[20]=a=>i.form.company_address=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.company_address]])]),e("div",Bt,[e("label",zt,l(n.translations.postal_code),1),p(e("input",{type:"text",id:"postal-code","onUpdate:modelValue":t[21]||(t[21]=a=>i.form.postal_code=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.postal_code]])]),e("div",Gt,[e("label",Jt,l(n.translations.city),1),p(e("input",{type:"text",id:"city","onUpdate:modelValue":t[22]||(t[22]=a=>i.form.city=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.city]])]),e("div",Zt,[e("label",Qt,l(n.translations.country),1),p(e("input",{type:"text",id:"country","onUpdate:modelValue":t[23]||(t[23]=a=>i.form.country=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.country]])]),e("div",Kt,[e("label",$t,l(n.translations.email),1),p(e("input",{type:"email",id:"company-email","onUpdate:modelValue":t[24]||(t[24]=a=>i.form.company_email=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_email]])]),e("div",te,[e("label",ee,l(n.translations.phone),1),p(e("input",{type:"tel",id:"company-phone","onUpdate:modelValue":t[25]||(t[25]=a=>i.form.company_phone=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_phone]])]),e("div",se,[e("label",ne,l(n.translations.mobile),1),p(e("input",{type:"tel",id:"mobile-phone","onUpdate:modelValue":t[26]||(t[26]=a=>i.form.mobile_phone=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.mobile_phone]])]),e("div",ie,[e("label",oe,l(n.translations.fax),1),p(e("input",{type:"tel",id:"fax","onUpdate:modelValue":t[27]||(t[27]=a=>i.form.fax=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.fax]])])]),ae,i.form.easy_compta_siret_addon_active==1?(c(),d("div",le,[e("div",re,[e("div",ce,[e("label",de,l(n.translations.siret_api_token),1),ue,p(e("input",{type:"text",id:"company-code","onUpdate:modelValue":t[28]||(t[28]=a=>i.form.easycompta_siret_token_api=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.easycompta_siret_token_api]])])])])):b("",!0),e("div",he,[e("button",pe,[me,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===2?(c(),d("div",fe,[e("h2",be,l(n.translations.system_settings),1),e("form",{onSubmit:t[40]||(t[40]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",_e,[e("label",ge,[e("span",ve,l(n.translations.activate_logo_mentions),1),e("input",{type:"checkbox",checked:i.form.logo_mentions_active==1,onChange:t[30]||(t[30]=(...a)=>n.updateLogoMentionsActive&&n.updateLogoMentionsActive(...a)),class:"wcpa-ui-toggle"},null,40,ye)])]),i.form.logo_mentions_active==1?(c(),d("div",we,[e("label",xe,l(n.translations.logo_mentions),1),p(e("input",{type:"text",id:"logo-mentions","onUpdate:modelValue":t[31]||(t[31]=a=>i.form.logo_mentions=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.logo_mentions]])])):b("",!0),e("div",ke,[e("label",Ce,l(n.translations.company_logo),1),e("div",Te,[e("input",{id:"file_logo",type:"file",onChange:t[32]||(t[32]=(...a)=>n.handleLogoUpload&&n.handleLogoUpload(...a)),accept:"image/*",class:"ecwp-file-input file-input file-input-bordered file-input-info w-full max-w-xs"},null,32),e("label",Me,[e("span",null,[Ae,g(l(n.translations.select),1)])])]),i.logoPreviewUrl?(c(),d("div",Se,[p(e("input",{type:"range",min:"0",max:"400","onUpdate:modelValue":t[33]||(t[33]=a=>i.form.logo_width=a),class:"range mt-4",onChange:t[34]||(t[34]=(...a)=>n.updatePreviewWidth&&n.updatePreviewWidth(...a))},null,544),[[f,i.form.logo_width]]),e("div",Pe,l(i.form.logo_width)+" px",1),i.form.logo_width!==null?(c(),d("div",Ee,[e("img",{src:i.logoPreviewUrl,alt:"Logo Preview",class:"mb-6",style:C({width:i.form.logo_width+"px"})},null,12,je)])):b("",!0)])):b("",!0)]),e("div",Ve,[e("label",Ie,l(n.translations.default_currency),1),p(e("select",{"onUpdate:modelValue":t[35]||(t[35]=a=>i.form.default_currency=a),class:"ecwp-input input input-bordered"},[(c(!0),d(T,null,S(i.currencies,a=>(c(),d("option",{value:a.id,key:a.id},l(a.name)+" ("+l(a.symbol)+") ",9,Fe))),128))],512),[[V,i.form.default_currency]])]),e("div",Re,[e("label",Ue,l(n.translations.currency_position),1),p(e("select",{"onUpdate:modelValue":t[36]||(t[36]=a=>i.form.currency_position=a),class:"ecwp-input input input-bordered"},[e("option",De,l(n.translations.before_amount),1),e("option",He,l(n.translations.after_amount),1)],512),[[V,i.form.currency_position]])]),e("div",Ye,[e("label",Ne,[e("span",qe,l(n.translations.activate_vat),1),e("input",{type:"checkbox",checked:i.form.vat_active==1,onChange:t[37]||(t[37]=(...a)=>n.updateVatActive&&n.updateVatActive(...a)),class:"wcpa-ui-toggle"},null,40,Le)])]),i.form.vat_active==1?(c(),d("div",Oe,[e("label",We,l(n.translations.default_vat),1),p(e("select",{"onUpdate:modelValue":t[38]||(t[38]=a=>i.form.default_vat=a),class:"ecwp-input input input-bordered"},[Xe,(c(!0),d(T,null,S(i.vats,a=>(c(),d("option",{value:a.id,key:a.id},l(a.description)+" - "+l(a.rate)+"% ",9,Be))),128))],512),[[V,i.form.default_vat]])])):b("",!0),e("div",ze,[e("label",Ge,l(n.translations.format_date),1),p(e("select",{"onUpdate:modelValue":t[39]||(t[39]=a=>i.form.date_format=a),class:"ecwp-input input input-bordered"},is,512),[[V,i.form.date_format]])]),e("div",os,[e("button",as,[ls,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===3?(c(),d("div",rs,[i.showArticleModal?(c(),d("dialog",cs,[e("div",ds,[e("h3",null,l(i.editingArticle?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[47]||(t[47]=k((...a)=>n.saveArticle&&n.saveArticle(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[41]||(t[41]=(...a)=>n.closeArticleModal&&n.closeArticleModal(...a))}," \u2715 "),e("div",us,[e("label",hs,l(n.translations.item_ref),1),p(e("input",{type:"text",id:"name_ref","onUpdate:modelValue":t[42]||(t[42]=a=>i.articleForm.ref=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.ref]])]),e("div",ps,[e("label",ms,l(n.translations.item_name),1),p(e("input",{type:"text",id:"name_article","onUpdate:modelValue":t[43]||(t[43]=a=>i.articleForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.name]])]),e("div",fs,[e("label",bs,l(n.translations.description),1),p(e("textarea",{id:"desc_article","onUpdate:modelValue":t[44]||(t[44]=a=>i.articleForm.description=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.description]])]),e("div",_s,[e("label",gs,l(n.translations.unit_price),1),p(e("input",{type:"text",id:"price_article","onUpdate:modelValue":t[45]||(t[45]=a=>i.articleForm.unit_price=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.unit_price]])]),e("div",vs,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[46]||(t[46]=(...a)=>n.closeArticleModal&&n.closeArticleModal(...a))},l(n.translations.cancel),1),e("button",ys,l(i.editingArticle?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",ws,[e("h3",xs,l(n.translations.articles_settings),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[48]||(t[48]=(...a)=>n.addArticle&&n.addArticle(...a))},[ks,g(" "+l(n.translations.add),1)])]),e("div",Cs,[e("table",Ts,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.item_ref),1),e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.description),1),e("th",null,l(n.translations.unit_price),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.articles,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.ref),1),e("td",null,l(a.name),1),e("td",null,l(a.description),1),e("td",null,l(a.unit_price),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editArticle(a.id)},Ss,8,Ms),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("article",a.id)},js,8,Ps)])]))),128))])])]),Vs,e("h2",Is,l(n.translations.categories),1),e("div",Fs,[e("table",Rs,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.categories,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.name),1),e("td",null,[e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("category_article",a.id)},Hs,8,Us)])]))),128))])])])])):b("",!0),i.selectedTab===4?(c(),d("div",Ys,[e("h2",Ns,l(n.translations.invoices_settings),1),e("form",{onSubmit:t[64]||(t[64]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",qs,[e("div",Ls,[e("label",Os,l(n.translations.invoice_color),1),p(e("input",{type:"text",id:"invoice-color","onUpdate:modelValue":t[49]||(t[49]=a=>i.form.invoice_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.invoice_color]]),x(u,{modelValue:i.form.invoice_color,"onUpdate:modelValue":t[50]||(t[50]=a=>i.form.invoice_color=a)},null,8,["modelValue"])]),e("div",Ws,[e("label",Xs,l(n.translations.invoice_prefix),1),p(e("input",{type:"text",id:"invoice-prefix","onUpdate:modelValue":t[51]||(t[51]=a=>i.form.invoice_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.invoice_prefix]])])]),Bs,e("div",zs,[e("div",Gs,[e("label",Js,[e("input",{type:"checkbox",checked:i.form.show_phone==1,onChange:t[52]||(t[52]=a=>n.updateFormField(a,"show_phone")),class:"wcpa-ui-toggle"},null,40,Zs),e("span",Qs,l(n.translations.show_phone),1)])]),e("div",Ks,[e("label",$s,[e("input",{type:"checkbox",checked:i.form.show_email==1,onChange:t[53]||(t[53]=a=>n.updateFormField(a,"show_email")),class:"wcpa-ui-toggle"},null,40,tn),e("span",en,l(n.translations.show_email),1)])]),e("div",sn,[e("label",nn,[e("input",{type:"checkbox",checked:i.form.show_siren==1,onChange:t[54]||(t[54]=a=>n.updateFormField(a,"show_siren")),class:"wcpa-ui-toggle"},null,40,on),e("span",an,l(n.translations.show_siren),1)])]),e("div",ln,[e("label",rn,[e("input",{type:"checkbox",checked:i.form.show_tax_number==1,onChange:t[55]||(t[55]=a=>n.updateFormField(a,"show_tax_number")),class:"wcpa-ui-toggle"},null,40,cn),e("span",dn,l(n.translations.show_tax_number),1)])]),e("div",un,[e("label",hn,[e("input",{type:"checkbox",checked:i.form.show_watermark==1,onChange:t[56]||(t[56]=a=>n.updateFormField(a,"show_watermark")),class:"wcpa-ui-toggle"},null,40,pn),e("span",mn,l(n.translations.show_watermark),1)])]),i.form.show_watermark==1?(c(),d("div",fn,[e("label",bn,[e("input",{type:"checkbox",checked:i.form.show_watermark_only_paid==1,onChange:t[57]||(t[57]=a=>n.updateFormField(a,"show_watermark_only_paid")),class:"wcpa-ui-toggle"},null,40,_n),e("span",gn,l(n.translations.show_watermark_only_paid),1)])])):b("",!0)]),vn,e("div",yn,[e("div",wn,[e("label",xn,l(n.translations.payment_conditions),1),p(e("input",{type:"text",id:"conditions-payment","onUpdate:modelValue":t[58]||(t[58]=a=>i.form.payment_conditions=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_conditions]])]),e("div",kn,[e("label",Cn,l(n.translations.payment_mode),1),p(e("input",{type:"text",id:"mode-payment","onUpdate:modelValue":t[59]||(t[59]=a=>i.form.payment_mode=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_mode]])])]),e("div",Tn,[e("div",Mn,[e("label",An,l(n.translations.invoice_terms),1),e("div",null,[x(_,{modelValue:i.form.invoice_terms,"onUpdate:modelValue":t[60]||(t[60]=a=>i.form.invoice_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",Sn,[e("div",Pn,[e("label",En,l(n.translations.invoice_iban),1),p(e("input",{type:"text",id:"invoice-iban","onUpdate:modelValue":t[61]||(t[61]=a=>i.form.invoice_iban=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_iban]])]),e("div",jn,[e("label",Vn,l(n.translations.invoice_bic),1),p(e("input",{type:"text",id:"invoice-bic","onUpdate:modelValue":t[62]||(t[62]=a=>i.form.invoice_bic=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_bic]])])]),e("div",In,[e("label",Fn,l(n.translations.invoice_footer),1),e("div",null,[x(_,{modelValue:i.form.invoice_footer,"onUpdate:modelValue":t[63]||(t[63]=a=>i.form.invoice_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",Rn,[e("button",Un,[Dn,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===5?(c(),d("div",Hn,[e("h2",Yn,l(n.translations.credits_settings),1),e("form",{onSubmit:t[70]||(t[70]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Nn,[e("div",qn,[e("label",Ln,l(n.translations.credit_color),1),p(e("input",{type:"text",id:"credit-color","onUpdate:modelValue":t[65]||(t[65]=a=>i.form.credit_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.credit_color]]),x(u,{modelValue:i.form.credit_color,"onUpdate:modelValue":t[66]||(t[66]=a=>i.form.credit_color=a)},null,8,["modelValue"])]),e("div",On,[e("label",Wn,l(n.translations.credit_prefix),1),p(e("input",{type:"text",id:"credit-prefix","onUpdate:modelValue":t[67]||(t[67]=a=>i.form.credit_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.credit_prefix]])])]),e("div",Xn,[e("div",Bn,[e("label",zn,l(n.translations.credit_footer),1),e("div",null,[x(_,{modelValue:i.form.credit_footer,"onUpdate:modelValue":t[68]||(t[68]=a=>i.form.credit_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",Gn,[e("label",Jn,l(n.translations.credit_terms),1),e("div",null,[x(_,{modelValue:i.form.credit_terms,"onUpdate:modelValue":t[69]||(t[69]=a=>i.form.credit_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",Zn,[e("button",Qn,[Kn,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===6?(c(),d("div",$n,[e("h2",ti,l(n.translations.quotes_settings),1),e("form",{onSubmit:t[76]||(t[76]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ei,[e("div",si,[e("label",ni,l(n.translations.quote_color),1),p(e("input",{type:"text",id:"quote-color","onUpdate:modelValue":t[71]||(t[71]=a=>i.form.quote_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.quote_color]]),x(u,{modelValue:i.form.quote_color,"onUpdate:modelValue":t[72]||(t[72]=a=>i.form.quote_color=a)},null,8,["modelValue"])]),e("div",ii,[e("label",oi,l(n.translations.quote_prefix),1),p(e("input",{type:"text",id:"quote-prefix","onUpdate:modelValue":t[73]||(t[73]=a=>i.form.quote_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.quote_prefix]])])]),e("div",ai,[e("div",li,[e("label",ri,l(n.translations.quote_footer),1),e("div",null,[x(_,{modelValue:i.form.quote_footer,"onUpdate:modelValue":t[74]||(t[74]=a=>i.form.quote_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",ci,[e("label",di,l(n.translations.quote_terms),1),e("div",null,[x(_,{modelValue:i.form.quote_terms,"onUpdate:modelValue":t[75]||(t[75]=a=>i.form.quote_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",ui,[e("button",hi,[pi,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===7?(c(),d("div",mi,[e("h2",fi,l(n.translations.currency_vat_settings),1),i.showCurrencyModal?(c(),d("dialog",bi,[e("div",_i,[e("h3",null,l(i.editingCurrency?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[82]||(t[82]=k((...a)=>n.saveCurrency&&n.saveCurrency(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[77]||(t[77]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))}," \u2715 "),e("div",gi,[e("label",vi,l(n.translations.name),1),p(e("input",{type:"text",id:"name_currency","onUpdate:modelValue":t[78]||(t[78]=a=>i.currencyForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.name]])]),e("div",yi,[e("label",wi,l(n.translations.symbol),1),p(e("input",{type:"text",id:"symbol_currency","onUpdate:modelValue":t[79]||(t[79]=a=>i.currencyForm.symbol=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.symbol]])]),e("div",xi,[e("label",ki,l(n.translations.code),1),p(e("input",{type:"text",id:"code_currency","onUpdate:modelValue":t[80]||(t[80]=a=>i.currencyForm.code=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.code]])]),e("div",Ci,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[81]||(t[81]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))},l(n.translations.cancel),1),e("button",Ti,l(i.editingCurrency?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Mi,[e("div",Ai,[e("h3",Si,l(n.translations.currencies),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[83]||(t[83]=(...a)=>n.addCurrency&&n.addCurrency(...a))},[Pi,g(" "+l(n.translations.add_currency),1)])]),e("div",Ei,[e("table",ji,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.symbol),1),e("th",null,l(n.translations.code),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.currencies,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.name),1),e("td",null,l(a.symbol),1),e("td",null,l(a.code),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editCurrency(a.id)},Fi,8,Vi),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("currency",a.id)},Di,8,Ri)])]))),128))])])])]),e("div",null,[i.showVATModal?(c(),d("dialog",Hi,[e("div",Yi,[e("h3",null,l(i.editingVAT?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[88]||(t[88]=k((...a)=>n.saveVAT&&n.saveVAT(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[84]||(t[84]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))}," \u2715 "),e("div",Ni,[e("label",qi,l(n.translations.description),1),p(e("input",{type:"text",id:"vat-description","onUpdate:modelValue":t[85]||(t[85]=a=>i.vatForm.description=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.description]])]),e("div",Li,[e("label",Oi,l(n.translations.rate)+" (%)",1),p(e("input",{type:"text",id:"vat-rate","onUpdate:modelValue":t[86]||(t[86]=a=>i.vatForm.rate=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.rate]])]),e("div",Wi,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[87]||(t[87]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))},l(n.translations.cancel),1),e("button",Xi,l(i.editingVAT?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Bi,[e("h3",zi,l(n.translations.vat_rates),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[89]||(t[89]=(...a)=>n.addVAT&&n.addVAT(...a))},[Gi,g(" "+l(n.translations.add_vat),1)])]),e("div",Ji,[e("table",Zi,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.description),1),e("th",null,l(n.translations.rate)+" (%)",1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.vats,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.description),1),e("td",null,l(a.rate),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editVAT(a.id)},$i,8,Qi),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("vat",a.id)},so,8,to)])]))),128))])])])])])):b("",!0),i.selectedTab===8?(c(),d("div",no,[e("h2",io,l(n.translations.payments_settings),1),i.showPaymentModal?(c(),d("dialog",oo,[e("div",ao,[e("h3",null,l(i.editingPayment?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[93]||(t[93]=k((...a)=>n.savePayment&&n.savePayment(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[90]||(t[90]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))}," \u2715 "),e("div",lo,[e("label",ro,l(n.translations.name),1),p(e("input",{type:"text",id:"name_payment","onUpdate:modelValue":t[91]||(t[91]=a=>i.paymentForm.method_name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.paymentForm.method_name]])]),e("div",co,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[92]||(t[92]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))},l(n.translations.cancel),1),e("button",uo,l(i.editingPayment?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",ho,[e("div",po,[e("h3",mo,l(n.translations.payments_methods),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[94]||(t[94]=(...a)=>n.addPayment&&n.addPayment(...a))},[fo,g(l(n.translations.add_method),1)])]),e("div",bo,[e("table",_o,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.payments,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.method_name),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editPayment(a.id)},yo,8,go),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("payment",a.id)},ko,8,wo)])]))),128))])])])])])):b("",!0),i.selectedTab===9?(c(),d("div",Co,[e("h2",To,l(n.translations.expenses_settings),1),i.showExpenseModal?(c(),d("dialog",Mo,[e("div",Ao,[e("h3",null,l(i.editingExpense?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[98]||(t[98]=k((...a)=>n.saveExpCat&&n.saveExpCat(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[95]||(t[95]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))}," \u2715 "),e("div",So,[e("label",Po,l(n.translations.name),1),p(e("input",{type:"text",id:"name_expense","onUpdate:modelValue":t[96]||(t[96]=a=>i.expenseForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.expenseForm.name]])]),e("div",Eo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[97]||(t[97]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))},l(n.translations.cancel),1),e("button",jo,l(i.editingExpense?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Vo,[e("div",Io,[e("h3",Fo,l(n.translations.expenses_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[99]||(t[99]=(...a)=>n.addExpCat&&n.addExpCat(...a))},[Ro,g(" "+l(n.translations.add_category),1)])]),e("div",Uo,[e("table",Do,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.expenses,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.name),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editExpCat(a.id)},No,8,Ho),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("expense",a.id)},Oo,8,qo)])]))),128))])])])])])):b("",!0),i.selectedTab===10?(c(),d("div",Wo,[e("h2",Xo,l(n.translations.planning_settings),1),i.showPlanningModal?(c(),d("dialog",Bo,[e("div",zo,[e("h3",null,l(i.editingPlanning?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[107]||(t[107]=k((...a)=>n.savePlanningCat&&n.savePlanningCat(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[100]||(t[100]=(...a)=>n.closePlanningModal&&n.closePlanningModal(...a))}," \u2715 "),e("div",Go,[e("label",Jo,l(n.translations.name),1),p(e("input",{type:"text",id:"name_planning","onUpdate:modelValue":t[101]||(t[101]=a=>i.planningForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.name]])]),e("div",Zo,[e("label",Qo,l(n.translations.background),1),p(e("input",{type:"text",id:"background_planning","onUpdate:modelValue":t[102]||(t[102]=a=>i.planningForm.background=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.background]]),x(u,{modelValue:i.planningForm.background,"onUpdate:modelValue":t[103]||(t[103]=a=>i.planningForm.background=a)},null,8,["modelValue"])]),e("div",Ko,[e("label",$o,l(n.translations.text_color),1),p(e("input",{type:"text",id:"color_planning","onUpdate:modelValue":t[104]||(t[104]=a=>i.planningForm.color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.color]]),x(u,{modelValue:i.planningForm.color,"onUpdate:modelValue":t[105]||(t[105]=a=>i.planningForm.color=a)},null,8,["modelValue"])]),e("div",ta,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[106]||(t[106]=(...a)=>n.closePlanningModal&&n.closePlanningModal(...a))},l(n.translations.cancel),1),e("button",{type:"submit",class:"btn btn-primary rounded-full mx-2",disabled:i.loading},[g(l(i.editingPlanning?n.translations.save:n.translations.add)+" ",1),i.loading?(c(),d("span",sa)):b("",!0)],8,ea)])],32)])])):b("",!0),e("div",na,[e("div",ia,[e("h3",oa,l(n.translations.planning_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[108]||(t[108]=(...a)=>n.addPlanningCat&&n.addPlanningCat(...a))},[aa,g(" "+l(n.translations.add_category),1)])]),e("div",la,[e("table",ra,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.background),1),e("th",null,l(n.translations.color),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.planning,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.name),1),e("td",null,[e("span",{class:"ecwp-color-preview",style:C({backgroundColor:a.background})},null,4)]),e("td",null,[e("span",{class:"ecwp-color-preview",style:C({backgroundColor:a.color})},null,4)]),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:v=>n.editPlanningCat(a.id)},ua,8,ca),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("planning",a.id)},ma,8,ha)])]))),128))])])])])])):b("",!0),i.selectedTab===11?(c(),d("div",fa,[e("h2",ba,l(n.translations.email_settings),1),e("form",{onSubmit:t[120]||(t[120]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",_a,[e("label",ga,[e("span",va,l(n.translations.email_log_active),1),e("input",{type:"checkbox",checked:i.form.email_log_active==1,onChange:t[109]||(t[109]=(...a)=>n.updateEmailLogsActive&&n.updateEmailLogsActive(...a)),class:"wcpa-ui-toggle"},null,40,ya)])]),wa,e("div",xa,[e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab1"}]),onClick:t[110]||(t[110]=a=>n.setActiveTab("tab1"))},l(n.translations.email_invoice),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab2"}]),onClick:t[111]||(t[111]=a=>n.setActiveTab("tab2"))},l(n.translations.email_quote),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab3"}]),onClick:t[112]||(t[112]=a=>n.setActiveTab("tab3"))},l(n.translations.invoice_reminder),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab4"}]),onClick:t[113]||(t[113]=a=>n.setActiveTab("tab4"))},l(n.translations.payment_received),3)]),i.activeTabEmail==="tab1"?(c(),d("div",ka,[e("div",Ca,[e("div",Ta,[e("label",Ma,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_invoice_subject","onUpdate:modelValue":t[114]||(t[114]=a=>i.form.email_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_invoice_subject]])]),e("div",Aa,[e("label",Sa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_invoice_content,"onUpdate:modelValue":t[115]||(t[115]=a=>i.form.email_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Pa])])])):b("",!0),i.activeTabEmail==="tab2"?(c(),d("div",Ea,[e("div",ja,[e("div",Va,[e("label",Ia,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_quote_subject","onUpdate:modelValue":t[116]||(t[116]=a=>i.form.email_quote_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_quote_subject]])]),e("div",Fa,[e("label",Ra,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_quote_content,"onUpdate:modelValue":t[117]||(t[117]=a=>i.form.email_quote_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Ua])])])):b("",!0),i.activeTabEmail==="tab3"?(c(),d("div",Da,[e("div",Ha,[e("div",Ya,[e("label",Na,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"remind_invoice_subject","onUpdate:modelValue":t[118]||(t[118]=a=>i.form.remind_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.remind_invoice_subject]])]),e("div",qa,[e("label",La,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.remind_invoice_content,"onUpdate:modelValue":t[119]||(t[119]=a=>i.form.remind_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Oa])])])):b("",!0),i.activeTabEmail==="tab4"?(c(),d("div",Wa,[e("div",Xa,[Ba,e("div",null,[e("h2",za,l(n.translations.coming_soon),1)])])])):b("",!0),e("div",Ga,[e("button",Ja,[Za,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===12?(c(),d("div",Qa,[e("h2",Ka,l(n.translations.users_settings),1),e("div",$a,[e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabUsers==="user1"}]),onClick:t[121]||(t[121]=a=>n.setActiveTabUsers("user1"))}," Automatic create account ",2),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabUsers==="user2"}]),onClick:t[122]||(t[122]=a=>n.setActiveTabUsers("user2"))}," Lost password ",2)]),i.activeTabUsers==="user1"?(c(),d("div",tl,[e("form",{onSubmit:t[125]||(t[125]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",el,[e("div",sl,[e("label",nl,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_create_account_subject","onUpdate:modelValue":t[123]||(t[123]=a=>i.form.email_create_account_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_create_account_subject]])]),e("div",il,[e("label",ol,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_create_account_content,"onUpdate:modelValue":t[124]||(t[124]=a=>i.form.email_create_account_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),al])]),e("div",ll,[e("button",rl,[cl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.activeTabUsers==="user2"?(c(),d("div",dl,[e("div",ul,[hl,e("div",null,[e("h2",pl,l(n.translations.coming_soon),1)])])])):b("",!0)])):b("",!0),i.selectedTab===13?(c(),d("div",ml,[e("h2",fl,l(n.translations.stripe_settings),1),e("form",{onSubmit:t[131]||(t[131]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",bl,[e("div",_l,[e("label",gl,l(n.translations.stripe_mode),1),p(e("select",{id:"stripe-mode","onUpdate:modelValue":t[126]||(t[126]=a=>i.form.stripe_mode=a),class:"ecwp-input input input-bordered",required:""},[e("option",vl,l(n.translations.test_mode),1),e("option",yl,l(n.translations.live_mode),1)],512),[[V,i.form.stripe_mode]])]),i.form.stripe_mode==="test"?(c(),d("div",wl,[e("div",xl,[e("label",kl,l(n.translations.stripe_public_key_test),1),p(e("input",{type:"text",id:"stripe-public-key-test","onUpdate:modelValue":t[127]||(t[127]=a=>i.form.stripe_public_key_test=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_public_key_test]])]),e("div",Cl,[e("label",Tl,l(n.translations.stripe_secret_key_test),1),p(e("input",{type:"text",id:"stripe-secret-key-test","onUpdate:modelValue":t[128]||(t[128]=a=>i.form.stripe_secret_key_test=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_secret_key_test]])])])):b("",!0),i.form.stripe_mode==="live"?(c(),d("div",Ml,[e("div",Al,[e("label",Sl,l(n.translations.stripe_public_key_live),1),p(e("input",{type:"text",id:"stripe-public-key-live","onUpdate:modelValue":t[129]||(t[129]=a=>i.form.stripe_public_key_live=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_public_key_live]])]),e("div",Pl,[e("label",El,l(n.translations.stripe_secret_key_live),1),p(e("input",{type:"text",id:"stripe-secret-key-live","onUpdate:modelValue":t[130]||(t[130]=a=>i.form.stripe_secret_key_live=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_secret_key_live]])])])):b("",!0)]),e("div",jl,[e("button",Vl,[Il,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===14?(c(),d("div",Fl,[e("h2",Rl,l(n.translations.stats_settings),1),e("form",{onSubmit:t[134]||(t[134]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Ul,[e("div",Dl,[e("label",Hl,l(n.translations.limit_declaration),1),p(e("input",{type:"number",id:"limit-declaration","onUpdate:modelValue":t[132]||(t[132]=a=>i.form.limit_declaration=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_declaration]])]),e("div",Yl,[e("label",Nl,l(n.translations.limit_tva),1),p(e("input",{type:"number",id:"limit-tva","onUpdate:modelValue":t[133]||(t[133]=a=>i.form.limit_tva=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_tva]])])]),e("div",ql,[e("button",Ll,[Ol,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===15?(c(),d("div",Wl,[e("h2",Xl,l(n.translations.validation_license),1),e("div",Bl,[e("div",zl,[e("label",Gl,l(n.translations.license_key),1),p(e("input",{type:"text",id:"license-code","onUpdate:modelValue":t[135]||(t[135]=a=>i.license_key=a),class:"ecwp-input input input-bordered w-full",disabled:i.licenseData&&i.licenseData.valid,required:""},null,8,Jl),[[f,i.license_key]]),e("button",{onClick:t[136]||(t[136]=(...a)=>n.checkLicense&&n.checkLicense(...a)),class:"btn btn-primary join-item rounded-r-full mt-5 -me-1",disabled:i.loadingLicense||i.licenseData&&i.licenseData.valid},[i.loadingLicense?(c(),d("span",Ql)):(c(),d("span",Kl,l(n.translations.validate),1))],8,Zl)])]),e("div",$l,[i.errorMessage?(c(),d("div",tr,l(i.errorMessage),1)):b("",!0),i.licenseData?(c(),d("div",er,[e("table",sr,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.domain),1),e("th",null,l(n.translations.addon_name),1),e("th",null,l(n.translations.activation_date),1),e("th",null,l(n.translations.expiry_date),1),e("th",null,l(n.translations.status),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[e("tr",null,[e("td",null,l(i.licenseData.domain),1),e("td",null,[(c(!0),d(T,null,S(i.licenseData.plugins,(a,v)=>(c(),d("div",{key:v},l(v),1))),128))]),e("td",null,l(i.licenseData.start_date),1),e("td",null,l(i.licenseData.end_date),1),e("td",null,l(i.licenseData.valid?"Valid":"Invalid"),1),e("td",null,[e("button",{onClick:t[137]||(t[137]=a=>n.delete_item("licence","")),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},ir)])])])]),e("table",or,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.addon_name),1),e("th",null,l(n.translations.slug),1),e("th",null,l(n.translations.installed),1),e("th",null,l(n.translations.version),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.licenseData.plugins,a=>(c(),d("tr",{key:a},[e("td",null,l(a.product_name),1),e("td",null,l(a.product_slug),1),e("td",null,[i.installed_versions[a.product_slug]?(c(),d(T,{key:0},[g(l(n.translations.installed),1)],64)):(c(),d(T,{key:1},[g(l(n.translations.not_installed),1)],64))]),e("td",null,l(i.installed_versions[a.product_slug]),1),e("td",null,[i.installed_versions[a.product_slug]?(c(),d(T,{key:0},[e("button",{onClick:v=>n.checkUpdatePlugin(a.product_slug,i.installed_versions[a.product_slug]),class:"btn btn-sm text-red-500 hover:text-red-700 mx-1"},l(n.translations.check_update),9,ar),i.updatesAvailable[a.product_slug]?(c(),d("button",{key:0,onClick:v=>n.installUpdatePlugin(a.product_slug,i.updatesAvailable[a.product_slug]),class:"btn btn-sm text-blue-500 hover:text-blue-700 mx-1"},l(n.translations.download),9,lr)):b("",!0)],64)):(c(),d("button",{key:1,onClick:v=>n.installUpdatePlugin(a.product_slug,i.updatesAvailable[a.product_slug]),class:"btn btn-sm text-green-500 hover:green-red-700 mx-1"},l(n.translations.download),9,rr))])]))),128))])])])):b("",!0)])])):b("",!0)])])]),_:1})])}var dr=$(ct,[["render",cr]]);function R(s){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(s)}var ur=/^\s+/,hr=/\s+$/;function h(s,t){if(s=s||"",t=t||{},s instanceof h)return s;if(!(this instanceof h))return new h(s,t);var o=pr(s);this._originalInput=s,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||o.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),o,r,i,n,m,u;return o=t.r/255,r=t.g/255,i=t.b/255,o<=.03928?n=o/12.92:n=Math.pow((o+.055)/1.055,2.4),r<=.03928?m=r/12.92:m=Math.pow((r+.055)/1.055,2.4),i<=.03928?u=i/12.92:u=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*m+.0722*u},setAlpha:function(t){return this._a=G(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=q(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=q(this._r,this._g,this._b),o=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+o+", "+r+"%, "+i+"%)":"hsva("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=N(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=N(this._r,this._g,this._b),o=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+o+", "+r+"%, "+i+"%)":"hsla("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return L(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return _r(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(w(this._r,255)*100)+"%",g:Math.round(w(this._g,255)*100)+"%",b:Math.round(w(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%)":"rgba("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Pr[L(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var o="#"+O(this._r,this._g,this._b,this._a),r=o,i=this._gradientType?"GradientType = 1, ":"";if(t){var n=h(t);r="#"+O(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+o+",endColorstr="+r+")"},toString:function(t){var o=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0,n=!o&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return n?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return h(this.toString())},_applyModification:function(t,o){var r=t.apply(null,[this].concat([].slice.call(o)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(wr,arguments)},brighten:function(){return this._applyModification(xr,arguments)},darken:function(){return this._applyModification(kr,arguments)},desaturate:function(){return this._applyModification(gr,arguments)},saturate:function(){return this._applyModification(vr,arguments)},greyscale:function(){return this._applyModification(yr,arguments)},spin:function(){return this._applyModification(Cr,arguments)},_applyCombination:function(t,o){return t.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination(Ar,arguments)},complement:function(){return this._applyCombination(Tr,arguments)},monochromatic:function(){return this._applyCombination(Sr,arguments)},splitcomplement:function(){return this._applyCombination(Mr,arguments)},triad:function(){return this._applyCombination(W,[3])},tetrad:function(){return this._applyCombination(W,[4])}};h.fromRatio=function(s,t){if(R(s)=="object"){var o={};for(var r in s)s.hasOwnProperty(r)&&(r==="a"?o[r]=s[r]:o[r]=F(s[r]));s=o}return h(s,t)};function pr(s){var t={r:0,g:0,b:0},o=1,r=null,i=null,n=null,m=!1,u=!1;return typeof s=="string"&&(s=Ir(s)),R(s)=="object"&&(j(s.r)&&j(s.g)&&j(s.b)?(t=mr(s.r,s.g,s.b),m=!0,u=String(s.r).substr(-1)==="%"?"prgb":"rgb"):j(s.h)&&j(s.s)&&j(s.v)?(r=F(s.s),i=F(s.v),t=br(s.h,r,i),m=!0,u="hsv"):j(s.h)&&j(s.s)&&j(s.l)&&(r=F(s.s),n=F(s.l),t=fr(s.h,r,n),m=!0,u="hsl"),s.hasOwnProperty("a")&&(o=s.a)),o=G(o),{ok:m,format:s.format||u,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:o}}function mr(s,t,o){return{r:w(s,255)*255,g:w(t,255)*255,b:w(o,255)*255}}function N(s,t,o){s=w(s,255),t=w(t,255),o=w(o,255);var r=Math.max(s,t,o),i=Math.min(s,t,o),n,m,u=(r+i)/2;if(r==i)n=m=0;else{var _=r-i;switch(m=u>.5?_/(2-r-i):_/(r+i),r){case s:n=(t-o)/_+(t<o?6:0);break;case t:n=(o-s)/_+2;break;case o:n=(s-t)/_+4;break}n/=6}return{h:n,s:m,l:u}}function fr(s,t,o){var r,i,n;s=w(s,360),t=w(t,100),o=w(o,100);function m(M,a,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?M+(a-M)*6*v:v<1/2?a:v<2/3?M+(a-M)*(2/3-v)*6:M}if(t===0)r=i=n=o;else{var u=o<.5?o*(1+t):o+t-o*t,_=2*o-u;r=m(_,u,s+1/3),i=m(_,u,s),n=m(_,u,s-1/3)}return{r:r*255,g:i*255,b:n*255}}function q(s,t,o){s=w(s,255),t=w(t,255),o=w(o,255);var r=Math.max(s,t,o),i=Math.min(s,t,o),n,m,u=r,_=r-i;if(m=r===0?0:_/r,r==i)n=0;else{switch(r){case s:n=(t-o)/_+(t<o?6:0);break;case t:n=(o-s)/_+2;break;case o:n=(s-t)/_+4;break}n/=6}return{h:n,s:m,v:u}}function br(s,t,o){s=w(s,360)*6,t=w(t,100),o=w(o,100);var r=Math.floor(s),i=s-r,n=o*(1-t),m=o*(1-i*t),u=o*(1-(1-i)*t),_=r%6,M=[o,m,n,n,u,o][_],a=[u,o,o,m,n,n][_],v=[n,n,u,o,o,m][_];return{r:M*255,g:a*255,b:v*255}}function L(s,t,o,r){var i=[E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function _r(s,t,o,r,i){var n=[E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16)),E(J(r))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)&&n[3].charAt(0)==n[3].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}function O(s,t,o,r){var i=[E(J(r)),E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))];return i.join("")}h.equals=function(s,t){return!s||!t?!1:h(s).toRgbString()==h(t).toRgbString()};h.random=function(){return h.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function gr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.s-=t/100,o.s=H(o.s),h(o)}function vr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.s+=t/100,o.s=H(o.s),h(o)}function yr(s){return h(s).desaturate(100)}function wr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.l+=t/100,o.l=H(o.l),h(o)}function xr(s,t){t=t===0?0:t||10;var o=h(s).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(255*-(t/100)))),o.g=Math.max(0,Math.min(255,o.g-Math.round(255*-(t/100)))),o.b=Math.max(0,Math.min(255,o.b-Math.round(255*-(t/100)))),h(o)}function kr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.l-=t/100,o.l=H(o.l),h(o)}function Cr(s,t){var o=h(s).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,h(o)}function Tr(s){var t=h(s).toHsl();return t.h=(t.h+180)%360,h(t)}function W(s,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var o=h(s).toHsl(),r=[h(s)],i=360/t,n=1;n<t;n++)r.push(h({h:(o.h+n*i)%360,s:o.s,l:o.l}));return r}function Mr(s){var t=h(s).toHsl(),o=t.h;return[h(s),h({h:(o+72)%360,s:t.s,l:t.l}),h({h:(o+216)%360,s:t.s,l:t.l})]}function Ar(s,t,o){t=t||6,o=o||30;var r=h(s).toHsl(),i=360/o,n=[h(s)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,n.push(h(r));return n}function Sr(s,t){t=t||6;for(var o=h(s).toHsv(),r=o.h,i=o.s,n=o.v,m=[],u=1/t;t--;)m.push(h({h:r,s:i,v:n})),n=(n+u)%1;return m}h.mix=function(s,t,o){o=o===0?0:o||50;var r=h(s).toRgb(),i=h(t).toRgb(),n=o/100,m={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(i.a-r.a)*n+r.a};return h(m)};h.readability=function(s,t){var o=h(s),r=h(t);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)};h.isReadable=function(s,t,o){var r=h.readability(s,t),i,n;switch(n=!1,i=Fr(o),i.level+i.size){case"AAsmall":case"AAAlarge":n=r>=4.5;break;case"AAlarge":n=r>=3;break;case"AAAsmall":n=r>=7;break}return n};h.mostReadable=function(s,t,o){var r=null,i=0,n,m,u,_;o=o||{},m=o.includeFallbackColors,u=o.level,_=o.size;for(var M=0;M<t.length;M++)n=h.readability(s,t[M]),n>i&&(i=n,r=h(t[M]));return h.isReadable(s,r,{level:u,size:_})||!m?r:(o.includeFallbackColors=!1,h.mostReadable(s,["#fff","#000"],o))};var Y=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Pr=h.hexNames=Er(Y);function Er(s){var t={};for(var o in s)s.hasOwnProperty(o)&&(t[s[o]]=o);return t}function G(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function w(s,t){jr(s)&&(s="100%");var o=Vr(s);return s=Math.min(t,Math.max(0,parseFloat(s))),o&&(s=parseInt(s*t,10)/100),Math.abs(s-t)<1e-6?1:s%t/parseFloat(t)}function H(s){return Math.min(1,Math.max(0,s))}function A(s){return parseInt(s,16)}function jr(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function Vr(s){return typeof s=="string"&&s.indexOf("%")!=-1}function E(s){return s.length==1?"0"+s:""+s}function F(s){return s<=1&&(s=s*100+"%"),s}function J(s){return Math.round(parseFloat(s)*255).toString(16)}function X(s){return A(s)/255}var P=function(){var s="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",o="(?:"+t+")|(?:"+s+")",r="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?",i="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?";return{CSS_UNIT:new RegExp(o),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function j(s){return!!P.CSS_UNIT.exec(s)}function Ir(s){s=s.replace(ur,"").replace(hr,"").toLowerCase();var t=!1;if(Y[s])s=Y[s],t=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var o;return(o=P.rgb.exec(s))?{r:o[1],g:o[2],b:o[3]}:(o=P.rgba.exec(s))?{r:o[1],g:o[2],b:o[3],a:o[4]}:(o=P.hsl.exec(s))?{h:o[1],s:o[2],l:o[3]}:(o=P.hsla.exec(s))?{h:o[1],s:o[2],l:o[3],a:o[4]}:(o=P.hsv.exec(s))?{h:o[1],s:o[2],v:o[3]}:(o=P.hsva.exec(s))?{h:o[1],s:o[2],v:o[3],a:o[4]}:(o=P.hex8.exec(s))?{r:A(o[1]),g:A(o[2]),b:A(o[3]),a:X(o[4]),format:t?"name":"hex8"}:(o=P.hex6.exec(s))?{r:A(o[1]),g:A(o[2]),b:A(o[3]),format:t?"name":"hex"}:(o=P.hex4.exec(s))?{r:A(o[1]+""+o[1]),g:A(o[2]+""+o[2]),b:A(o[3]+""+o[3]),a:X(o[4]+""+o[4]),format:t?"name":"hex8"}:(o=P.hex3.exec(s))?{r:A(o[1]+""+o[1]),g:A(o[2]+""+o[2]),b:A(o[3]+""+o[3]),format:t?"name":"hex"}:!1}function Fr(s){var t,o;return s=s||{level:"AA",size:"small"},t=(s.level||"AA").toUpperCase(),o=(s.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),o!=="small"&&o!=="large"&&(o="small"),{level:t,size:o}}var Z={name:"ColorPicker",props:["color","position","boxRect","disableAlpha","disableTextInputs"],emits:["updateColor","hueInputStart","hueInputEnd","hueInput","alphaInputStart","alphaInputEnd","alphaInput","saturationInputStart","saturationInputEnd","saturationInput","ready","change"],inject:["tinycolor"],data(){return{h:void 0,s:void 0,v:void 0,a:void 0,hueTranslateX:0,alphaTranslateX:0,saturationTranslateX:0,saturationTranslateY:0,sliderPointerWidth:0,saturationPointerWidth:0,saturationPointerHeight:0,pickerPositionA:{anchor:"top",offset:0},pickerPositionB:{anchor:"left",offset:0},pickerWidth:0,pickerHeight:0,textInputsFormat:"rgb",textInputActive:null,textInputsFreeze:{},arrowColor:"#0f0f0f",sliderWidth:0}},computed:{pureHueBackground(){return{background:"hsl("+this.h+", 100%, 50%)"}},hexString(){return this.color.toHexString()},huePointerStyles(){return{transform:"translate("+(this.hueTranslateX-this.sliderPointerWidth*.5)+"px)"}},alphaPointerStyles(){return{transform:"translate("+(this.alphaTranslateX-this.sliderPointerWidth*.5)+"px)"}},alphaPointerTransparentStyles(){return{backgroundPosition:-this.alphaTranslateX+"px"}},alphaPointerColorStyles(){return{opacity:this.a}},alphaCanvasStyles(){return{background:"linear-gradient(90deg, transparent 0%, "+this.color.toHexString()+" 100%)"}},saturationPointerStyles(){const s=this.saturationTranslateX-this.saturationPointerWidth*.5,t=this.saturationTranslateY+this.saturationPointerHeight*.5;return{transform:"translate("+s+"px, "+t+"px)"}},arrowsStyles(){return{"--arrow-color":this.arrowColor}},pickerPosition(){const s={},t={top:"bottom",bottom:"top",left:"right",right:"left"};let o;["top","bottom"].includes(this.position[0])?(s.marginLeft=0,s.marginRight=0,o=this.boxRect.height):(s.marginTop=0,s.marginBottom=0,o=this.boxRect.width);let r=t[this.position[0]];return s[r]=o+"px",this.position[1]==="center"?(["left","right"].includes(r)?(r="top",o=this.pickerHeight-this.boxRect.height):(r="left",o=this.pickerWidth-this.boxRect.width),o*=.5):(r=t[this.position[1]],o=0),s[r]=-o+"px",s},textInputs(){const s=this.textInputsFormat,t={};if(["name","hex"].includes(s))t.hex=this.color.toString("hex");else{const o=this.color.toString(s).split("(")[1].slice(0,-1).split(", ");s.split("").forEach((r,i)=>t[r]=o[i])}if(this.disableAlpha||(t.a=Number(this.color.getAlpha().toFixed(2))),t.hasOwnProperty("h")&&(t.h=Math.round(this.h),t.hasOwnProperty("l"))){let o=this.s;const r=this.v||.001,i=(2-o)*r/2;i<.5&&(o*=r/(i*2),t.s=Math.round(o*100)+"%")}return t}},methods:{saturationPickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.saturationPickEnd),document.addEventListener("pointermove",this.saturationPickMove),this.saturationPickMove(s),this.emitHook("saturationInputStart",{s:this.s,v:this.v}),this.colorSnapshot=this.color.toRgbString()},saturationPickEnd(s){document.removeEventListener("pointerup",this.saturationPickEnd),document.removeEventListener("pointermove",this.saturationPickMove),this.emitHook("saturationInputEnd",{s:this.s,v:this.v}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},saturationPickMove(s){s.clientX>=this.saturationCanvasRect.x&&s.clientX<=this.saturationCanvasRect.right?this.s=(s.clientX-this.saturationCanvasRect.x)/this.saturationCanvasRect.width:s.clientX<this.saturationCanvasRect.x?this.s=0:this.s=1,s.clientY>=this.saturationCanvasRect.y&&s.clientY<=this.saturationCanvasRect.bottom?this.v=1-(s.clientY-this.saturationCanvasRect.y)/this.saturationCanvasRect.height:s.clientY<this.saturationCanvasRect.y?this.v=1:this.v=0},huePickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.huePickEnd),document.addEventListener("pointermove",this.huePickMove),this.huePickMove(s),this.emitHook("hueInputStart",{h:this.h}),this.colorSnapshot=this.color.toRgbString()},huePickEnd(s){document.removeEventListener("pointerup",this.huePickEnd),document.removeEventListener("pointermove",this.huePickMove),this.emitHook("hueInputEnd",{h:this.h}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},huePickMove(s){s.clientX>=this.hueCanvasRect.x&&s.clientX<=this.hueCanvasRect.right?this.h=(s.clientX-this.hueCanvasRect.x)*360/this.hueCanvasRect.width:s.clientX<this.hueCanvasRect.x?this.h=0:this.h=360},alphaPickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.alphaPickEnd),document.addEventListener("pointermove",this.alphaPickMove),this.alphaPickMove(s),this.emitHook("alphaInputStart",{a:this.a}),this.colorSnapshot=this.color.toRgbString()},alphaPickEnd(s){document.removeEventListener("pointerup",this.alphaPickEnd),document.removeEventListener("pointermove",this.alphaPickMove),this.emitHook("alphaInputEnd",{a:this.a}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},alphaPickMove(s){s.clientX>=this.alphaCanvasRect.x&&s.clientX<=this.alphaCanvasRect.right?this.a=(s.clientX-this.alphaCanvasRect.x)/this.alphaCanvasRect.width:s.clientX<this.alphaCanvasRect.x?this.a=0:this.a=1},emitUpdate(s){s=s||{h:this.h,s:this.s,v:this.v,a:this.a},this.$emit("updateColor",s)},emitHook(s,t){if(typeof t=="object")for(let[o,r]of Object.entries(t))t[o]=Number(r.toFixed(3));else t=Number(t.toFixed(3));this.$emit(s,t)},textInputInputHandler(s){const t=s.target.dataset.component;this.textInputsFreeze[t]=s.target.value;let o={...this.textInputsFreeze};if(o.hasOwnProperty("hex")){const n=o.a;o=this.tinycolor(o.hex),o.getFormat()!=="hex8"&&o.setAlpha(n)}else o=this.tinycolor(o);const r=o.toHsv();if(this.textInputsFormat==="hsl"&&(r.h===0&&(r.h=parseInt(this.textInputsFreeze.h)),r.v===0)){let n=this.textInputsFreeze.s;const m=n.indexOf("%")!==-1;n=parseFloat(n),!n||n<0?n=0:(m||n>1)&&(n=Math.min(n*.01,1));const u=.001,_=n*u+u;n=2-2*u/_,r.s=n}const i={h:.5,s:.001,v:.001};t!=="a"?(Object.keys(r).filter(n=>n!=="a").forEach(n=>{const m=this[n],u=r[n];Math.abs(m-u)>i[n]&&(this[n]=u)}),o.getFormat()==="hex8"&&o.getOriginalInput().length>7&&(this.disableAlpha?Object.assign(this.$data,{h:0,s:0,v:0}):(this.a=r.a,this.textInputsFreeze.a=Number(this.a.toFixed(2))))):this.a=r.a},textInputFocusHandler(s){this.textInputActive||(this.textInputsFreeze={...this.textInputs},this.colorSnapshot=this.color.toRgbString()),this.textInputActive=s.target.dataset.component},textInputBlurHandler(s){setTimeout(()=>{this.textInputActive===s.target.dataset.component&&(this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a}),this.textInputsFreeze={},this.textInputActive=null)},0)},textInputFormatChange(s){const t=["rgb","name","hsl"];this.textInputsFormat;let o=t.indexOf(this.textInputsFormat)+s;o<0?o=t.length-1:o===t.length&&(o=0),this.textInputsFormat=t[o]},getCanvasRects(){this.saturationCanvasRect=this.$refs.saturationCanvas.getBoundingClientRect(),this.hueCanvasRect=this.$refs.hueCanvas.getBoundingClientRect(),this.alphaCanvasRect=this.disableAlpha?{}:this.$refs.alphaCanvas.getBoundingClientRect()},init(){const s=this.$refs.pickerRoot,t=window.getComputedStyle(s);Object.assign(this.$data,this.color.toHsv()),window.requestAnimationFrame(()=>{const{width:r,height:i}=s.getBoundingClientRect();this.pickerHeight=i,this.pickerWidth=r,this.getCanvasRects(),this.hueTranslateX=this.h*this.hueCanvasRect.width/360,this.alphaTranslateX=this.a*this.alphaCanvasRect.width,this.saturationTranslateX=this.s*this.saturationCanvasRect.width,this.saturationTranslateY=-this.v*this.saturationCanvasRect.height,this.sliderPointerWidth=this.$refs.huePointer.offsetWidth,this.saturationPointerWidth=this.$refs.saturationPointer.offsetWidth,this.saturationPointerHeight=this.$refs.saturationPointer.offsetHeight,window.requestAnimationFrame(()=>{this.$emit("ready")})});const o=t.getPropertyValue("background-color");this.tinycolor(o).isDark()&&(this.arrowColor="#fbfbfb")},fillCanvas(){let s=this.$refs.hueCanvas,t=s.getContext("2d"),o=t.createLinearGradient(s.width,0,0,0);o.addColorStop(0,"hsl(0,100%,50%)"),o.addColorStop(.17,"hsl(298.8, 100%, 50%)"),o.addColorStop(.33,"hsl(241.2, 100%, 50%)"),o.addColorStop(.5,"hsl(180, 100%, 50%)"),o.addColorStop(.67,"hsl(118.8, 100%, 50%)"),o.addColorStop(.83,"hsl(61.2,100%,50%)"),o.addColorStop(1,"hsl(360,100%,50%)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height),s=this.$refs.saturationCanvas,t=s.getContext("2d"),o=t.createLinearGradient(0,0,s.width,0),o.addColorStop(0,"rgba(250,250,250,1)"),o.addColorStop(1,"rgba(250,250,250,0)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height),o=t.createLinearGradient(0,s.height,0,0),o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height)}},watch:{h(s,t){this.hueTranslateX=this.h*this.hueCanvasRect.width/360,t!==void 0&&(this.emitUpdate(),this.emitHook("hueInput",{h:this.h}))},s(s,t){this.saturationTranslateX=this.s*this.saturationCanvasRect.width,t!==void 0&&(this.emitUpdate(),this.emitHook("saturationInput",{s:this.s,v:this.v}))},v(s,t){this.saturationTranslateY=-this.v*this.saturationCanvasRect.height,t!==void 0&&(this.emitUpdate(),this.emitHook("saturationInput",{s:this.s,v:this.v}))},a(s,t){this.alphaTranslateX=this.a*this.alphaCanvasRect.width,t!==void 0&&(this.emitUpdate(),this.emitHook("alphaInput",{a:this.a}))}},mounted(){this.getCanvasRects(),this.fillCanvas()},beforeUnmount(){}};const Rr={class:"slider-canvas",ref:"saturationCanvas"},Ur={class:"slider-container"},Dr={class:"slider-canvas",ref:"hueCanvas"},Hr={class:"slider-active-area"},Yr={class:"slider-container transparency-pattern"},Nr={class:"slider-active-area"},qr={class:"text-inputs-wrapper"},Lr=["for"],Or=["value","id","data-component"];function Wr(s,t,o,r,i,n){return c(),d("div",{ref:"pickerRoot",style:C([n.pickerPosition])},[e("div",{class:"saturation-area",style:C(n.pureHueBackground),onPointerdown:t[0]||(t[0]=(...m)=>n.saturationPickStart&&n.saturationPickStart(...m))},[e("canvas",Rr,null,512),e("div",{class:"saturation-pointer",ref:"saturationPointer",style:C([n.saturationPointerStyles,{background:n.hexString}])},null,4)],36),e("div",{class:"slider",onPointerdown:t[1]||(t[1]=(...m)=>n.huePickStart&&n.huePickStart(...m))},[e("div",Ur,[e("canvas",Dr,null,512)]),e("div",Hr,[e("div",{class:"slider-pointer",ref:"huePointer",style:C([n.huePointerStyles,n.pureHueBackground])},null,4)])],32),o.disableAlpha?b("",!0):(c(),d("div",{key:0,class:"slider",onPointerdown:t[2]||(t[2]=(...m)=>n.alphaPickStart&&n.alphaPickStart(...m))},[e("div",Yr,[e("div",{class:"slider-canvas",ref:"alphaCanvas",style:C(n.alphaCanvasStyles)},null,4)]),e("div",Nr,[e("div",{class:"slider-pointer",ref:"alphaPointer",style:C(n.alphaPointerStyles)},[e("div",{class:"pointer-transparent",style:C(n.alphaPointerTransparentStyles)},[e("div",{class:"pointer-color",style:C([n.alphaPointerColorStyles,{background:n.hexString}])},null,4)],4)],4)])],32)),o.disableTextInputs?b("",!0):(c(),d("div",{key:1,class:"text-inputs-area",style:C({"--outline-color":n.hexString})},[e("div",qr,[(c(!0),d(T,null,S(i.textInputActive?i.textInputsFreeze:n.textInputs,(m,u)=>(c(),d("div",{key:"text-input-"+u,class:"text-input-container"},[e("label",{for:"text-input-"+u},l(u),9,Lr),e("input",{value:m,class:"text-input",autocomplete:"off",spellcheck:"false",id:"text-input-"+u,"data-component":u,onInput:t[3]||(t[3]=k((..._)=>n.textInputInputHandler&&n.textInputInputHandler(..._),["prevent"])),onFocus:t[4]||(t[4]=(..._)=>n.textInputFocusHandler&&n.textInputFocusHandler(..._)),onBlur:t[5]||(t[5]=(..._)=>n.textInputBlurHandler&&n.textInputBlurHandler(..._)),onKeypress:t[6]||(t[6]=nt(_=>_.target.blur(),["enter"]))},null,40,Or)]))),128))]),e("div",{class:"text-format-arrows",style:C(n.arrowsStyles)},[e("div",{class:"arrow up",onClick:t[7]||(t[7]=m=>n.textInputFormatChange(-1))}),e("div",{class:"arrow down",onClick:t[8]||(t[8]=m=>n.textInputFormatChange(1))})],4)],4))],4)}function Q(s,t){t===void 0&&(t={});var o=t.insertAt;if(!(!s||typeof document=="undefined")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",o==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var Xr=`.color-input .pointer-transparent, .color-input .pointer-color, .color-input .slider-canvas, .color-input .slider-container {
     1import{_ as $,d as I,o as c,c as d,n as v,a as e,t as l,g as b,e as x,p as z,m as g,w as k,i as p,v as f,G as C,F as T,r as S,j as V,y as tt,T as et,Z as st,J as nt,f as it,h as ot}from"./plugin-vue_export-helper.min.js";import{C as at,R as lt}from"./RemoveAlert.min.js";import{v as rt}from"./vue3-editor.common.min.js";const ct={name:"Settings",components:{Card:at,VueEditor:rt.exports.VueEditor,RemoveModal:lt},data(){return{loading:!1,selectedTab:1,form:{company_name:"",company_address:"",postal_code:"",city:"",country:"",company_email:"",company_phone:"",mobile_phone:"",fax:"",logo_mentions_active:"",logo_url:"",logo_path:"",default_currency:"",currency_position:"",vat_active:"",default_vat:"",date_format:"",logo_width:"",logo_mentions:"",invoice_color:"",invoice_prefix:"",show_phone:"",show_email:"",show_siren:"",show_tax_number:"",show_watermark:"",show_watermark_only_paid:"",invoice_footer:"",invoice_terms:"",credit_color:"",credit_prefix:"",credit_footer:"",credit_terms:"",quote_color:"",quote_prefix:"",quote_footer:"",quote_terms:"",easy_compta_planning_addon_active:"",easy_compta_email_addon_active:"",easy_compta_payment_addon_active:"",easy_compta_signature_addon_active:"",easy_compta_stats_addon_active:"",easy_compta_qrcode_addon_active:"",easy_compta_stripe_secret_api:"",email_quote_subject:"",email_invoice_subject:"",remind_invoice_subject:"",remind_invoice_content:"",email_quote_content:"",email_invoice_content:"",email_create_account_subject:"",email_create_account_content:"",easycompta_siret_token_api:""},articles:[],categories:[],currencies:[],vats:[],expenses:[],planning:[],payments:[],logoPreviewUrl:"",previewWidth:"",showArticleModal:!1,showCurrencyModal:!1,showVATModal:!1,showPaymentModal:!1,showExpenseModal:!1,showPlanningModal:!1,currencyForm:{id:null,name:"",symbol:""},articleForm:{id:null,ref:"",name:"",description:"",unit_price:""},vatForm:{id:null,description:"",rate:""},paymentForm:{id:null,method_name:""},expenseForm:{id:null,name:""},planningForm:{id:null,name:"",background:"",color:""},showRemoveModal:!1,deleteType:null,selectedId:null,editingArticle:!1,editingCurrency:!1,editingVAT:!1,editingExpense:!1,editingPayment:!1,editingPlanning:!1,activeTabEmail:"tab1",activeTabUsers:"user1",license_key:"",loadingLicense:!1,licenseData:null,installed_versions:{},updatesAvailable:{},errorMessage:"",toast:{visible:!1,message:"",type:"alert-success",position:"toast-bottom toast-end"},toolbarOptions:[["bold","italic","underline","strike"],["link"],[{list:"ordered"},{list:"bullet"}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{align:[]}],[{align:"right"},{align:"center"},{align:"justify"}],["clean"],["html"]]}},methods:{setActiveTab(s){this.activeTabEmail=s},setActiveTabUsers(s){this.activeTabUsers=s},selectTab(s){this.selectedTab=s,window.location.hash=`tab${s}`},checkHash(){const s=window.location.hash;if(s){const t=parseInt(s.replace("#tab",""));isNaN(t)||(this.selectedTab=t)}},tabClass(s){return this.selectedTab===s?"tab tab-active":"tab"},async fetchSettings(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(this.loading=!1,s.ok){const t=await s.json();this.form={...this.form,...t},this.logoPreviewUrl=t.logo_url||"",this.form.easy_compta_planning_addon_active==1&&this.fetchPlanningCat()}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.loading=!1,this.showToast(s.message,"alert-error")}},async handleSubmit(){try{this.loading=!0;const s=await fetch("/wp-json/my-easy-compta/v1/settings/save",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.form)});if(this.loading=!1,s.ok){const t=await s.json();this.showToast(t,"alert-success")}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.loading=!1,this.showToast(s.message,"alert-error")}},async fetchArticles(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/articles",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();this.articles=t.articles,this.categories=t.categories}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchCurrencies(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/currencies",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.currencies=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchVATs(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/vats",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.vats=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchPaymentsMethods(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/payments-methods",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.payments=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchExpensesCat(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/expenses-cat",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.expenses=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async fetchPlanningCat(){try{const s=await fetch("/wp-json/my-easy-compta/v1/settings/planning-cat",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok)this.planning=await s.json();else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async handleLogoUpload(s){const t=s.target.files[0];if(t){const o=new FormData;o.append("logo",t);try{const r=await fetch("/wp-json/my-easy-compta/v1/settings/upload-logo",{method:"POST",headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce},body:o});if(r.ok){const i=await r.json();this.form.logo_url=i.url,this.form.logo_path=i.path,this.logoPreviewUrl=i.url,this.showToast("Logo uploaded successfully","alert-success")}else{const i=await r.json();this.showToast(i.message,"alert-error")}}catch(r){this.showToast(r.message,"alert-error")}}},async addArticle(){this.articleForm={id:null,ref:"",name:"",description:"",price:""},this.editingArticle=!1,this.showArticleModal=!0,this.$nextTick(()=>{document.getElementById("modal_article").showModal()})},async addCurrency(){this.currencyForm={id:null,name:"",symbol:""},this.editingCurrency=!1,this.showCurrencyModal=!0,this.$nextTick(()=>{document.getElementById("modal_currency").showModal()})},async deleteArticle(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/articles/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.articles=this.articles.filter(o=>o.id!==s),this.showToast(this.translations.deleted_successfully,"alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async deleteCategory(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/category/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.categories=this.categories.filter(o=>o.id!==s),this.showToast(this.translations.deleted_successfully,"alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async editArticle(s){const t=this.articles.find(o=>o.id===s);this.articleForm={...t},this.editingArticle=!0,this.showArticleModal=!0,this.$nextTick(()=>{document.getElementById("modal_article").showModal()})},async editCurrency(s){const t=this.currencies.find(o=>o.id===s);this.currencyForm={...t},this.editingCurrency=!0,this.showCurrencyModal=!0,this.$nextTick(()=>{document.getElementById("modal_currency").showModal()})},async deleteCurrency(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/currencies/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.currencies=this.currencies.filter(o=>o.id!==s),this.showToast("Currency deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveArticle(){const s=this.editingArticle?"PUT":"POST",t=this.editingArticle?`/wp-json/my-easy-compta/v1/settings/articles/${this.articleForm.id}`:"/wp-json/my-easy-compta/v1/settings/articles";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.articleForm)});if(o.ok){const r=await o.json();if(this.editingArticle){const i=this.articles.findIndex(n=>n.id===r.id);this.articles[i]=r}else this.articles.push(r);this.showToast(`Article ${this.editingArticle?"updated":"added"} successfully`,"alert-success"),this.closeArticleModal(),this.fetchArticles()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async saveCurrency(){const s=this.editingCurrency?"PUT":"POST",t=this.editingCurrency?`/wp-json/my-easy-compta/v1/settings/currencies/${this.currencyForm.id}`:"/wp-json/my-easy-compta/v1/settings/currencies";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.currencyForm)});if(o.ok){const r=await o.json();if(this.editingCurrency){const i=this.currencies.findIndex(n=>n.id===r.id);this.currencies[i]=r}else this.currencies.push(r);this.showToast(`Currency ${this.editingCurrency?"updated":"added"} successfully`,"alert-success"),this.closeCurrencyModal(),this.fetchCurrencies()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addVAT(){this.vatForm={id:null,description:"",rate:""},this.editingVAT=!1,this.showVATModal=!0,this.$nextTick(()=>{document.getElementById("modal_vat").showModal()})},async editVAT(s){const t=this.vats.find(o=>o.id===s);this.vatForm={...t},this.editingVAT=!0,this.showVATModal=!0,this.$nextTick(()=>{document.getElementById("modal_vat").showModal()})},async deleteVAT(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/vats/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.vats=this.vats.filter(o=>o.id!==s),this.showToast("VAT deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveVAT(){const s=this.editingVAT?"PUT":"POST",t=this.editingVAT?`/wp-json/my-easy-compta/v1/settings/vats/${this.vatForm.id}`:"/wp-json/my-easy-compta/v1/settings/vats";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.vatForm)});if(o.ok){const r=await o.json();if(this.editingVAT){const i=this.vats.findIndex(n=>n.id===r.id);this.vats[i]=r}else this.vats.push(r);this.showToast(`VAT ${this.editingVAT?"updated":"added"} successfully`,"alert-success"),this.closeVATModal(),this.fetchVATs()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addPayment(){this.paymentForm={id:null,method_name:""},this.editingPayment=!1,this.showPaymentModal=!0,this.$nextTick(()=>{document.getElementById("modal_payments").showModal()})},async editPayment(s){const t=this.payments.find(o=>o.id===s);this.paymentForm={...t},this.editingPayment=!0,this.showPaymentModal=!0,this.$nextTick(()=>{document.getElementById("modal_payments").showModal()})},async deletePayment(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/payments-methods/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.payments=this.payments.filter(o=>o.id!==s),this.showToast("Payment method deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async savePayment(){const s=this.editingPayment?"PUT":"POST",t=this.editingPayment?`/wp-json/my-easy-compta/v1/settings/payments-methods/${this.paymentForm.id}`:"/wp-json/my-easy-compta/v1/settings/payments-methods";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.paymentForm)});if(o.ok){const r=await o.json();if(this.editingPayment){const i=this.payments.findIndex(n=>n.id===r.id);this.payments[i]=r}else this.payments.push(r);this.showToast(`Payment method ${this.editingPayment?"updated":"added"} successfully`,"alert-success"),this.closePaymentModal(),this.fetchPaymentsMethods()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addExpCat(){this.expenseForm={id:null,name:""},this.editingExpense=!1,this.showExpenseModal=!0,this.$nextTick(()=>{document.getElementById("modal_expenses").showModal()})},async editExpCat(s){const t=this.expenses.find(o=>o.id===s);this.expenseForm={...t},this.editingExpense=!0,this.showExpenseModal=!0,this.$nextTick(()=>{document.getElementById("modal_expenses").showModal()})},async deleteExpCat(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/expenses-categories/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.expenses=this.expenses.filter(o=>o.id!==s),this.showToast("Expense category deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async saveExpCat(){const s=this.editingExpense?"PUT":"POST",t=this.editingExpense?`/wp-json/my-easy-compta/v1/settings/expenses-categories/${this.expenseForm.id}`:"/wp-json/my-easy-compta/v1/settings/expenses-categories";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.expenseForm)});if(o.ok){const r=await o.json();if(this.editingExpense){const i=this.expenses.findIndex(n=>n.id===r.id);this.expenses[i]=r}else this.expenses.push(r);this.showToast(`Expense category ${this.editingExpense?"updated":"added"} successfully`,"alert-success"),this.closeExpenseModal(),this.fetchExpensesCat()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},async addPlanningCat(){this.planningForm={id:null,name:""},this.editingPlanning=!1,this.showPlanningModal=!0,this.$nextTick(()=>{document.getElementById("modal_planning").showModal()})},async editPlanningCat(s){const t=this.planning.find(o=>o.id===s);this.planningForm={...t},this.editingPlanning=!0,this.showPlanningModal=!0,this.$nextTick(()=>{document.getElementById("modal_planning").showModal()})},async deletePlanningCat(s){try{const t=await fetch(`/wp-json/my-easy-compta/v1/settings/planning-categories/${s}`,{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(t.ok)this.planning=this.planning.filter(o=>o.id!==s),this.showToast("Planning category deleted successfully","alert-success");else{const o=await t.json();this.showToast(o.message,"alert-error")}}catch(t){this.showToast(t.message,"alert-error")}},async savePlanningCat(){this.loading=!0;const s=this.editingPlanning?"PUT":"POST",t=this.editingPlanning?`/wp-json/my-easy-compta/v1/settings/planning-categories/${this.planningForm.id}`:"/wp-json/my-easy-compta/v1/settings/planning-categories";try{const o=await fetch(t,{method:s,headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify(this.planningForm)});if(o.ok){const r=await o.json();if(this.editingPlanning){const i=this.planning.findIndex(n=>n.id===r.id);this.planning[i]=r,this.loading=!1}else this.planning.push(r),this.loading=!1;this.showToast(`Planning category ${this.editingPlanning?"updated":"added"} successfully`,"alert-success"),this.closePlanningModal(),this.fetchPlanningCat()}else{const r=await o.json();this.showToast(r.message,"alert-error")}}catch(o){this.showToast(o.message,"alert-error")}},closeCurrencyModal(){this.showCurrencyModal=!1},closeArticleModal(){this.showArticleModal=!1},closeVATModal(){this.showVATModal=!1},closePaymentModal(){this.showPaymentModal=!1},closeExpenseModal(){this.showExpenseModal=!1},closePlanningModal(){this.showPlanningModal=!1},updatePreviewWidth(){this.previewWidth=this.form.logo_width+"px"},updateVatActive(s){this.form.vat_active=s.target.checked?1:0},updateLogoMentionsActive(s){this.form.logo_mentions_active=s.target.checked?1:0},updateEmailLogsActive(s){this.form.email_log_active=s.target.checked?1:0},updateFormField(s,t){this.form[t]=s.target.checked?1:0},showToast(s,t){this.toast.message=s,this.toast.type=t,this.toast.visible=!0,setTimeout(()=>{this.toast.visible=!1},3e3)},handleDeletion(s,t){const o=this.getDeletionFunction(s);o?o(t):this.showToast("error","alert-error")},delete_item(s,t){this.deleteType=s,this.selectedId=t,modal_remove.showModal(),this.showRemoveModal=!0},getDeletionFunction(s){switch(s){case"licence":return this.confirmLicense;case"vat":return this.deleteVAT;case"currency":return this.deleteCurrency;case"expense":return this.deleteExpCat;case"payment":return this.deletePayment;case"planning":return this.deletePlanningCat;case"article":return this.deleteArticle;case"category_article":return this.deleteCategory;default:return null}},async checkLicense(){this.loading=!0,this.loadingLicense=!0,this.errorMessage="",this.licenseData=null;try{const t=await(await fetch("/wp-json/my-easy-compta/v1/license/validate-license",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({license_key:this.license_key})})).json();t.valid?(this.licenseData=t,await this.storeLicense(t),location.reload()):this.errorMessage=t.message}catch{this.errorMessage="An error occurred while validating the license."}finally{this.loadingLicense=!1}},async refresh_licence(){this.loading=!0;try{const t=await(await fetch("/wp-json/my-easy-compta/v1/license/refresh-license",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}})).json();t.valid?location.reload():this.errorMessage=t.message}catch{this.errorMessage="An error occurred while refreshing the license."}},async storeLicense(s){try{await fetch("/wp-json/my-easy-compta/v1/license/store-license",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({license_key:this.license_key,license_data:s})})}catch{this.errorMessage="An error occurred while storing the license.",this.loading=!1}},async loadLicenseDetails(){this.loading=!0;try{const s=await fetch("/wp-json/my-easy-compta/v1/license/check-license",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();t.valid&&(this.licenseData=t.license_data,this.installed_versions=t.installed_versions,this.license_key="****-****-****-****-****"+this.license_key.substr(this.license_key.length-4),this.loading=!1)}else console.error("Failed to load license details"),this.loading=!1}catch(s){console.error("Error loading license details",s),this.loading=!1}},async confirmLicense(){this.loading=!0;try{const s=await fetch("/wp-json/my-easy-compta/v1/license/delete-license",{method:"DELETE",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});if(s.ok){const t=await s.json();this.showToast(t.message,"alert-success"),this.licenseData="",this.license_key="",location.reload()}else{const t=await s.json();this.showToast(t.message,"alert-error")}}catch(s){this.showToast(s.message,"alert-error")}},async checkUpdatePlugin(s,t){try{const r=await(await fetch("/wp-json/my-easy-compta/v1/license/check-update",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({plugin_slug:s,current_version:t})})).json();r.success?r.update_available?(this.showToast(this.translations.update_available+" "+r.new_version,"alert-success"),this.updatesAvailable[s]=r.update_available):this.showToast(this.translations.no_update_available,"alert-error"):this.showToast(this.translations.failed_update_available,"alert-error")}catch(o){console.error("Error checking for plugin update:",o),this.showToast(this.translations.failed_update_available,"alert-error")}},async installUpdatePlugin(s){try{const o=await(await fetch("/wp-json/my-easy-compta/v1/license/download-update",{method:"POST",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce},body:JSON.stringify({plugin_slug:s})})).json();if(o.success){this.showToast(this.translations.success,"alert-success");const r=document.createElement("a");r.href=o.download_url,r.setAttribute("download",""),document.body.appendChild(r),r.click(),document.body.removeChild(r)}else this.showToast(this.translations.error,"alert-error")}catch(t){console.error("Error checking for plugin update:",t),this.showToast(this.translations.error,"alert-error")}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}},beforeUnmount(){window.removeEventListener("hashchange",this.checkHash)},mounted(){this.checkHash(),window.addEventListener("hashchange",this.checkHash),this.fetchSettings(),this.fetchArticles(),this.fetchCurrencies(),this.fetchVATs(),this.fetchPaymentsMethods(),this.fetchExpensesCat(),this.loadLicenseDetails()}},dt={class:"pt-2 pr-4"},ut={class:"flex justify-between items-center"},ht={class:"card-title"},pt=e("div",{class:"divider mt-2"},null,-1),mt={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},ft={class:"tabs tabs-vertical tabs-boxed col-span-1"},bt=e("i",{class:"fas fa-home mr-2"},null,-1),_t=e("i",{class:"fas fa-tools mr-2"},null,-1),gt=e("i",{class:"fas fa-newspaper mr-2"},null,-1),yt=e("i",{class:"fas fa-file-invoice-dollar mr-2"},null,-1),vt=e("i",{class:"fas fa-undo mr-2"},null,-1),wt=e("i",{class:"far fa-question-circle mr-2"},null,-1),xt=e("i",{class:"fas fa-dollar-sign mr-2"},null,-1),kt=e("i",{class:"fas fa-money-check-alt mr-2"},null,-1),Ct=e("i",{class:"fas fa-shopping-basket mr-2"},null,-1),Tt=e("i",{class:"fas fa-calendar-alt mr-2"},null,-1),Mt=e("i",{class:"far fa-envelope mr-2"},null,-1),At=e("i",{class:"fas fa-user mr-2"},null,-1),St=e("i",{class:"far fa-credit-card mr-2"},null,-1),Pt=e("i",{class:"far fa-chart-bar mr-2"},null,-1),Et=e("i",{class:"fas fa-qrcode mr-2"},null,-1),jt=e("i",{class:"far fa-id-badge mr-2"},null,-1),Vt={class:"col-span-3 p-4 bg-base-300 rounded-lg shadow-md content-tabs"},It={key:0,class:"fixed top-0 left-0 w-full h-full flex items-center justify-center bg-gray-900 bg-opacity-50 z-50"},Ft=e("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Rt=[Ft],Ut={key:1},Dt={class:"text-xl font-semibold mb-4"},Ht={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Yt={class:"ecwp-group form-control"},Nt={class:"ecwp-label label",for:"company-code"},qt={class:"ecwp-group form-control"},Lt={class:"ecwp-label label",for:"tax-number"},Ot={class:"ecwp-group form-control"},Xt={class:"ecwp-label label",for:"company-name"},Wt={class:"ecwp-group form-control"},Bt={class:"ecwp-label label",for:"company-address"},zt={class:"ecwp-group form-control"},Gt={class:"ecwp-label label",for:"postal-code"},Jt={class:"ecwp-group form-control"},Zt={class:"ecwp-label label",for:"city"},Qt={class:"ecwp-group form-control"},Kt={class:"ecwp-label label",for:"country"},$t={class:"ecwp-group form-control"},te={class:"ecwp-label label",for:"company-email"},ee={class:"ecwp-group form-control"},se={class:"ecwp-label label",for:"company-phone"},ne={class:"ecwp-group form-control"},ie={class:"ecwp-label label",for:"mobile-phone"},oe={class:"ecwp-group form-control"},ae={class:"ecwp-label label",for:"fax"},le=e("div",{class:"divider my-4"},null,-1),re={key:0},ce={class:"grid grid-cols-2 gap-4"},de={class:"ecwp-group form-control indicator"},ue={class:"ecwp-label label",for:"company-code"},he=e("span",{class:"indicator-item badge mt-5 border-blue-700"},[e("a",{href:"https://api.gouv.fr/les-api/sirene_v3",target:"_blank"},"?")],-1),pe={class:"mt-6 flex justify-end"},me={type:"submit",class:"btn btn-primary rounded-full"},fe=e("i",{class:"far fa-save"},null,-1),be={key:2},_e={class:"text-xl font-semibold mb-4"},ge={class:"form-control mt-4 mb-1"},ye={class:"cursor-pointer"},ve={class:"label-text mr-2 font-bold"},we=["checked"],xe={key:0,class:"ecwp-group form-control"},ke={class:"ecwp-label label",for:"logo-mentions"},Ce={class:"ecwp-group form-control"},Te={class:"label"},Me={class:"ecwp-file"},Ae={for:"file_logo"},Se=e("i",{class:"fas fa-cloud-upload-alt mr-2"},null,-1),Pe={key:0,class:"max-w-md"},Ee={class:"py-2 font-bold"},je={key:0},Ve=["src"],Ie={class:"ecwp-group form-control"},Fe={class:"ecwp-label label"},Re=["value"],Ue={class:"ecwp-group form-control"},De={class:"ecwp-label label"},He={value:"before"},Ye={value:"after"},Ne={class:"form-control mt-4 mb-1"},qe={class:"cursor-pointer"},Le={class:"label-text mr-2 font-bold"},Oe=["checked"],Xe={key:1,class:"ecwp-group form-control"},We={class:"ecwp-label label"},Be=e("option",{value:"0"},null,-1),ze=["value"],Ge={class:"ecwp-group form-control mt-2"},Je={class:"ecwp-label label"},Ze=e("option",{value:"DD-MM-YYYY",selected:"selected"}," DD-MM-YYYY ",-1),Qe=e("option",{value:"MM-DD-YYYY"},"MM-DD-YYYY",-1),Ke=e("option",{value:"YYYY-MM-DD"},"YYYY-MM-DD",-1),$e=e("option",{value:"YYYY/MM/DD"},"YYYY/MM/DD",-1),ts=e("option",{value:"DD/MM/YYYY"},"DD/MM/YYYY",-1),es=e("option",{value:"MM/DD/YYYY"},"MM/DD/YYYY",-1),ss=e("option",{value:"YYYY.MM.DD"},"YYYY.MM.DD",-1),ns=e("option",{value:"DD.MM.YYYY"},"DD.MM.YYYY",-1),is=e("option",{value:"MM.DD.YYYY"},"MM.DD.YYYY",-1),os=[Ze,Qe,Ke,$e,ts,es,ss,ns,is],as={class:"mt-6 flex justify-end"},ls={type:"submit",class:"btn btn-primary rounded-full"},rs=e("i",{class:"far fa-save"},null,-1),cs={key:3},ds={key:0,id:"modal_article",class:"modal"},us={class:"modal-box"},hs={class:"ecwp-group form-control"},ps={class:"ecwp-label label",for:"name_ref"},ms={class:"ecwp-group form-control"},fs={class:"ecwp-label label",for:"name_article"},bs={class:"ecwp-group form-control"},_s={class:"ecwp-label label",for:"desc_article"},gs={class:"ecwp-group form-control"},ys={class:"ecwp-label label",for:"price_article"},vs={class:"form-group mt-4 flex justify-end"},ws={type:"submit",class:"btn btn-primary rounded-full mx-2"},xs={class:"flex justify-between items-center mb-4"},ks={class:"text-lg font-semibold"},Cs=e("i",{class:"fas fa-plus mr-2"},null,-1),Ts={class:"table-container"},Ms={class:"table w-full"},As=["onClick"],Ss=e("i",{class:"fas fa-edit"},null,-1),Ps=[Ss],Es=["onClick"],js=e("i",{class:"fas fa-trash"},null,-1),Vs=[js],Is=e("div",{class:"divider mt-2 mb-4"},null,-1),Fs={class:"text-xl font-semibold mb-4"},Rs={class:"table-container"},Us={class:"table w-full"},Ds=["onClick"],Hs=e("i",{class:"fas fa-trash"},null,-1),Ys=[Hs],Ns={key:4},qs={class:"text-xl font-semibold mb-4"},Ls={class:"grid grid-cols-2 gap-4"},Os={class:"ecwp-group form-control"},Xs={class:"ecwp-label label",for:"invoice-color"},Ws={class:"ecwp-group form-control"},Bs={class:"ecwp-label label",for:"invoice-prefix"},zs=e("div",{class:"divider my-4"},null,-1),Gs={class:"grid grid-cols-2 gap-4"},Js={class:"form-control mt-4 mb-1"},Zs={class:"cursor-pointer"},Qs=["checked"],Ks={class:"label-text mr-2 font-bold"},$s={class:"form-control mt-4 mb-1"},tn={class:"cursor-pointer"},en=["checked"],sn={class:"label-text mr-2 font-bold"},nn={class:"form-control mt-4 mb-1"},on={class:"cursor-pointer"},an=["checked"],ln={class:"label-text mr-2 font-bold"},rn={class:"form-control mt-4 mb-1"},cn={class:"cursor-pointer"},dn=["checked"],un={class:"label-text mr-2 font-bold"},hn={class:"form-control mt-4 mb-1"},pn={class:"cursor-pointer"},mn=["checked"],fn={class:"label-text mr-2 font-bold"},bn={key:0,class:"form-control mt-4 mb-1"},_n={class:"cursor-pointer"},gn=["checked"],yn={class:"label-text mr-2 font-bold"},vn=e("div",{class:"divider my-4"},null,-1),wn={class:"grid grid-cols-2 gap-4"},xn={class:"ecwp-group form-control"},kn={class:"ecwp-label label",for:"conditions-payment"},Cn={class:"ecwp-group form-control"},Tn={class:"ecwp-label label",for:"mode-payment"},Mn={class:"grid grid-cols-1 gap-4"},An={class:"form-control"},Sn={class:"ecwp-label label",for:"invoice-prefix"},Pn={class:"grid grid-cols-2 gap-4"},En={class:"ecwp-group form-control"},jn={class:"ecwp-label label",for:"invoice-iban"},Vn={class:"ecwp-group form-control"},In={class:"ecwp-label label",for:"invoice-bic"},Fn={class:"form-control"},Rn={class:"ecwp-label label",for:"invoice-prefix"},Un={class:"mt-6 flex justify-end"},Dn={type:"submit",class:"btn btn-primary rounded-full"},Hn=e("i",{class:"far fa-save"},null,-1),Yn={key:5},Nn={class:"text-xl font-semibold mb-4"},qn={class:"grid grid-cols-2 gap-4"},Ln={class:"ecwp-group form-control"},On={class:"ecwp-label label",for:"credit-color"},Xn={class:"ecwp-group form-control"},Wn={class:"ecwp-label label",for:"credit-prefix"},Bn={class:"grid grid-cols-1 gap-4"},zn={class:"form-control"},Gn={class:"ecwp-label label",for:"credit-prefix"},Jn={class:"form-control"},Zn={class:"ecwp-label label",for:"credit-prefix"},Qn={class:"mt-6 flex justify-end"},Kn={type:"submit",class:"btn btn-primary rounded-full"},$n=e("i",{class:"far fa-save"},null,-1),ti={key:6},ei={class:"text-xl font-semibold mb-4"},si={class:"grid grid-cols-2 gap-4"},ni={class:"ecwp-group form-control"},ii={class:"ecwp-label label",for:"quote-color"},oi={class:"ecwp-group form-control"},ai={class:"ecwp-label label",for:"quote-prefix"},li={class:"grid grid-cols-1 gap-4"},ri={class:"form-control"},ci={class:"ecwp-label label",for:"quote-prefix"},di={class:"form-control"},ui={class:"ecwp-label label",for:"quote-prefix"},hi={class:"mt-6 flex justify-end"},pi={type:"submit",class:"btn btn-primary rounded-full"},mi=e("i",{class:"far fa-save"},null,-1),fi={key:7},bi={class:"text-xl font-semibold mb-4"},_i={key:0,id:"modal_currency",class:"modal"},gi={class:"modal-box"},yi={class:"ecwp-group form-control"},vi={class:"ecwp-label label",for:"name_currency"},wi={class:"ecwp-group form-control"},xi={class:"ecwp-label label",for:"symbol_currency"},ki={class:"ecwp-group form-control"},Ci={class:"ecwp-label label",for:"code_currency"},Ti={class:"form-group mt-4 flex justify-end"},Mi={type:"submit",class:"btn btn-primary rounded-full mx-2"},Ai={class:"mb-8"},Si={class:"flex justify-between items-center mb-4"},Pi={class:"text-lg font-semibold"},Ei=e("i",{class:"fas fa-plus mr-2"},null,-1),ji={class:"table-container"},Vi={class:"table w-full"},Ii=["onClick"],Fi=e("i",{class:"fas fa-edit"},null,-1),Ri=[Fi],Ui=["onClick"],Di=e("i",{class:"fas fa-trash"},null,-1),Hi=[Di],Yi={key:0,id:"modal_vat",class:"modal"},Ni={class:"modal-box"},qi={class:"ecwp-group form-control"},Li={class:"ecwp-label label",for:"vat-description"},Oi={class:"ecwp-group form-control"},Xi={class:"ecwp-label label",for:"vat-rate"},Wi={class:"form-group mt-4 flex justify-end"},Bi={type:"submit",class:"btn btn-primary rounded-full mx-2"},zi={class:"flex justify-between items-center mb-4"},Gi={class:"text-lg font-semibold"},Ji=e("i",{class:"fas fa-plus mr-2"},null,-1),Zi={class:"table-container"},Qi={class:"table w-full"},Ki=["onClick"],$i=e("i",{class:"fas fa-edit"},null,-1),to=[$i],eo=["onClick"],so=e("i",{class:"fas fa-trash"},null,-1),no=[so],io={key:8},oo={class:"text-xl font-semibold mb-4"},ao={key:0,id:"modal_payments",class:"modal"},lo={class:"modal-box"},ro={class:"ecwp-group form-control"},co={class:"ecwp-label label",for:"name_payment"},uo={class:"form-group mt-4 flex justify-end"},ho={type:"submit",class:"btn btn-primary rounded-full mx-2"},po={class:"mb-8"},mo={class:"flex justify-between items-center mb-4"},fo={class:"text-lg font-semibold"},bo=e("i",{class:"fas fa-plus mr-2"},null,-1),_o={class:"table-container"},go={class:"table w-full"},yo=["onClick"],vo=e("i",{class:"fas fa-edit"},null,-1),wo=[vo],xo=["onClick"],ko=e("i",{class:"fas fa-trash"},null,-1),Co=[ko],To={key:9},Mo={class:"text-xl font-semibold mb-4"},Ao={key:0,id:"modal_expenses",class:"modal"},So={class:"modal-box"},Po={class:"ecwp-group form-control"},Eo={class:"ecwp-label label",for:"name_expense"},jo={class:"form-group mt-4 flex justify-end"},Vo={type:"submit",class:"btn btn-primary rounded-full mx-2"},Io={class:"mb-8"},Fo={class:"flex justify-between items-center mb-4"},Ro={class:"text-lg font-semibold"},Uo=e("i",{class:"fas fa-plus mr-2"},null,-1),Do={class:"table-container"},Ho={class:"table w-full"},Yo=["onClick"],No=e("i",{class:"fas fa-edit"},null,-1),qo=[No],Lo=["onClick"],Oo=e("i",{class:"fas fa-trash"},null,-1),Xo=[Oo],Wo={key:10},Bo={class:"text-xl font-semibold mb-4"},zo={key:0,id:"modal_planning",class:"modal"},Go={class:"modal-box"},Jo={class:"ecwp-group form-control"},Zo={class:"ecwp-label label",for:"name_planning"},Qo={class:"ecwp-group form-control"},Ko={class:"ecwp-label label",for:"background_planning"},$o={class:"ecwp-group form-control"},ta={class:"ecwp-label label",for:"color_planning"},ea={class:"form-group mt-4 flex justify-end"},sa=["disabled"],na={key:0,class:"loading loading-spinner loading-sm"},ia={class:"mb-8"},oa={class:"flex justify-between items-center mb-4"},aa={class:"text-lg font-semibold"},la=e("i",{class:"fas fa-plus mr-2"},null,-1),ra={class:"table-container"},ca={class:"table w-full"},da=["onClick"],ua=e("i",{class:"fas fa-edit"},null,-1),ha=[ua],pa=["onClick"],ma=e("i",{class:"fas fa-trash"},null,-1),fa=[ma],ba={key:11},_a={class:"text-xl font-semibold mb-4"},ga={class:"form-control mt-4 mb-4"},ya={class:"cursor-pointer"},va={class:"label-text mr-2 font-bold"},wa=["checked"],xa=e("div",{class:"divider mt-2 mb-4"},null,-1),ka={role:"tablist",class:"tabs tabs-boxed"},Ca={key:0,class:"p-4"},Ta={class:"grid grid-cols-1 gap-4"},Ma={class:"ecwp-group form-control"},Aa={class:"ecwp-label label",for:"email_invoice_subject"},Sa={class:"form-control"},Pa={class:"ecwp-label label"},Ea=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{DUE_DATE}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")])],-1),ja={key:1,class:"p-4"},Va={class:"grid grid-cols-1 gap-4"},Ia={class:"ecwp-group form-control"},Fa={class:"ecwp-label label",for:"email_quote_subject"},Ra={class:"form-control"},Ua={class:"ecwp-label label"},Da=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")]),e("pre",null,[e("b",null,"{CREATED_DATE}")]),e("pre",null,[e("b",null,"{DUE_DATE}")])],-1),Ha={key:2,class:"p-4"},Ya={class:"grid grid-cols-1 gap-4"},Na={class:"ecwp-group form-control"},qa={class:"ecwp-label label",for:"remind_invoice_subject"},La={class:"form-control"},Oa={class:"ecwp-label label"},Xa=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{REF}")]),e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{DUE_DATE}")]),e("pre",null,[e("b",null,"{AMOUNT}")]),e("pre",null,[e("b",null,"{CURRENCY}")])],-1),Wa={key:3,class:"p-4"},Ba={role:"alert",class:"alert shadow"},za=e("i",{class:"fas fa-exclamation-circle"},null,-1),Ga={class:"text-xl text-center my-4"},Ja={class:"mt-6 flex justify-end"},Za={type:"submit",class:"btn btn-primary rounded-full"},Qa=e("i",{class:"far fa-save"},null,-1),Ka={key:12},$a={class:"text-xl font-semibold mb-4"},tl={role:"tablist",class:"tabs tabs-boxed"},el={key:0,class:"p-4"},sl={class:"grid grid-cols-1 gap-4"},nl={class:"ecwp-group form-control"},il={class:"ecwp-label label",for:"email_create_account_subject"},ol={class:"form-control"},al={class:"ecwp-label label"},ll=e("div",{class:"mockup-code bg-base-900 mt-4"},[e("pre",null,[e("b",null,"{CLIENT}")]),e("pre",null,[e("b",null,"{USERNAME}")]),e("pre",null,[e("b",null,"{PASSWORD}")])],-1),rl={class:"mt-6 flex justify-end"},cl={type:"submit",class:"btn btn-primary rounded-full"},dl=e("i",{class:"far fa-save"},null,-1),ul={key:1,class:"p-4"},hl={role:"alert",class:"alert shadow"},pl=e("i",{class:"fas fa-exclamation-circle"},null,-1),ml={class:"text-xl text-center my-4"},fl={key:13},bl={class:"text-xl font-semibold mb-4"},_l={class:"grid grid-cols-1 gap-4"},gl={class:"ecwp-group form-control"},yl={class:"ecwp-label label",for:"stripe-mode"},vl={value:"test"},wl={value:"live"},xl={key:0},kl={class:"ecwp-group form-control"},Cl={class:"ecwp-label label",for:"stripe-public-key-test"},Tl={class:"ecwp-group form-control"},Ml={class:"ecwp-label label",for:"stripe-secret-key-test"},Al={key:1},Sl={class:"ecwp-group form-control"},Pl={class:"ecwp-label label",for:"stripe-public-key-live"},El={class:"ecwp-group form-control"},jl={class:"ecwp-label label",for:"stripe-secret-key-live"},Vl={class:"mt-6 flex justify-end"},Il={type:"submit",class:"btn btn-primary rounded-full"},Fl=e("i",{class:"far fa-save"},null,-1),Rl={key:14},Ul={class:"text-xl font-semibold mb-4"},Dl={class:"grid grid-cols-1 gap-4"},Hl={class:"ecwp-group form-control mt-2"},Yl={class:"ecwp-label label",for:"limit-declaration"},Nl={class:"ecwp-group form-control mt-2"},ql={class:"ecwp-label label",for:"limit-tva"},Ll={class:"mt-6 flex justify-end"},Ol={type:"submit",class:"btn btn-primary rounded-full"},Xl=e("i",{class:"far fa-save"},null,-1),Wl={key:15},Bl={class:"text-xl font-semibold mb-4"},zl={class:"grid grid-cols-1 gap-4"},Gl={class:"ecwp-group form-control mt-2"},Jl={class:"ecwp-label label",for:"stripe-api"},Zl={class:"mt-6 flex justify-end"},Ql={type:"submit",class:"btn btn-primary rounded-full"},Kl=e("i",{class:"far fa-save"},null,-1),$l={key:16},tr={class:"text-xl font-semibold mb-4"},er={class:"grid grid-cols-2 gap-4"},sr={class:"ecwp-group form-group relative join"},nr={class:"ecwp-label label",for:"license-code"},ir=["disabled"],or=["disabled"],ar={key:0,class:"loading loading-spinner loading-sm"},lr={key:1},rr={class:"grid grid-cols-1 gap-4"},cr={key:0,class:"error-message"},dr={key:1,class:"overflow-x-auto my-4"},ur={class:"table table-xs table-pin-rows table-pin-cols"},hr=e("i",{class:"fas fa-sync"},null,-1),pr=[hr],mr=e("i",{class:"far fa-trash-alt"},null,-1),fr=[mr],br={class:"table table-xs table-pin-rows table-pin-cols mt-6"},_r=["onClick"],gr=["onClick"],yr=["onClick"];function vr(s,t,o,r,i,n){const m=I("remove-modal"),u=I("color-input"),_=I("vue-editor"),M=I("Card");return c(),d("div",dt,[i.toast.visible?(c(),d("div",{key:0,class:v(["toast",i.toast.position]),style:{zIndex:9999}},[e("div",{class:v(["alert",i.toast.type,"text-white"])},[e("span",null,l(i.toast.message),1)],2)],2)):b("",!0),x(m,{"show-modal":i.showRemoveModal,title:n.translations.are_you_sure,message:n.translations.no_turning_back,confirmText:n.translations.yes_delete_it,cancelText:n.translations.cancel,onConfirm:t[0]||(t[0]=a=>n.handleDeletion(i.deleteType,i.selectedId)),onCancel:t[1]||(t[1]=a=>i.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),x(M,{topMargin:"mt-8"},{default:z(()=>[e("div",ut,[e("h2",ht,l(n.translations.settings),1)]),pt,e("div",mt,[e("div",ft,[e("a",{class:v([n.tabClass(1),"justify-start w-full"]),onClick:t[2]||(t[2]=a=>n.selectTab(1))},[bt,g(" "+l(n.translations.general_settings),1)],2),e("a",{class:v([n.tabClass(2),"justify-start w-full"]),onClick:t[3]||(t[3]=a=>n.selectTab(2))},[_t,g(" "+l(n.translations.system_settings),1)],2),e("a",{class:v([n.tabClass(3),"justify-start w-full"]),onClick:t[4]||(t[4]=a=>n.selectTab(3))},[gt,g(" "+l(n.translations.articles_settings),1)],2),e("a",{class:v([n.tabClass(4),"justify-start w-full"]),onClick:t[5]||(t[5]=a=>n.selectTab(4))},[yt,g(" "+l(n.translations.invoices_settings),1)],2),e("a",{class:v([n.tabClass(5),"justify-start w-full"]),onClick:t[6]||(t[6]=a=>n.selectTab(5))},[vt,g(" "+l(n.translations.credits_settings),1)],2),e("a",{class:v([n.tabClass(6),"justify-start w-full"]),onClick:t[7]||(t[7]=a=>n.selectTab(6))},[wt,g(" "+l(n.translations.quotes_settings),1)],2),e("a",{class:v([n.tabClass(7),"justify-start w-full"]),onClick:t[8]||(t[8]=a=>n.selectTab(7))},[xt,g(" "+l(n.translations.currency_vat_settings),1)],2),e("a",{class:v([n.tabClass(8),"justify-start w-full"]),onClick:t[9]||(t[9]=a=>n.selectTab(8))},[kt,g(" "+l(n.translations.payments_settings),1)],2),e("a",{class:v([n.tabClass(9),"justify-start w-full"]),onClick:t[10]||(t[10]=a=>n.selectTab(9))},[Ct,g(" "+l(n.translations.expenses_settings),1)],2),i.form.easy_compta_planning_addon_active==1?(c(),d("a",{key:0,class:v([n.tabClass(10),"justify-start w-full"]),onClick:t[11]||(t[11]=a=>n.selectTab(10))},[Tt,g(" "+l(n.translations.planning_settings),1)],2)):b("",!0),i.form.easy_compta_email_addon_active==1?(c(),d("a",{key:1,class:v([n.tabClass(11),"justify-start w-full"]),onClick:t[12]||(t[12]=a=>n.selectTab(11))},[Mt,g(" "+l(n.translations.email_settings),1)],2)):b("",!0),i.form.easy_compta_user_addon_active==1?(c(),d("a",{key:2,class:v([n.tabClass(12),"justify-start w-full"]),onClick:t[13]||(t[13]=a=>n.selectTab(12))},[At,g(" "+l(n.translations.users_settings),1)],2)):b("",!0),i.form.easy_compta_payment_addon_active==1?(c(),d("a",{key:3,class:v([n.tabClass(13),"justify-start w-full"]),onClick:t[14]||(t[14]=a=>n.selectTab(13))},[St,g(" "+l(n.translations.stripe_settings),1)],2)):b("",!0),i.form.easy_compta_stats_addon_active==1?(c(),d("a",{key:4,class:v([n.tabClass(14),"justify-start w-full"]),onClick:t[15]||(t[15]=a=>n.selectTab(14))},[Pt,g(" "+l(n.translations.stats_settings),1)],2)):b("",!0),i.form.easy_compta_qrcode_addon_active==1?(c(),d("a",{key:5,class:v([n.tabClass(15),"justify-start w-full"]),onClick:t[16]||(t[16]=a=>n.selectTab(15))},[Et,g(" "+l(n.translations.qrcode_settings),1)],2)):b("",!0),e("a",{class:v([n.tabClass(16),"justify-start w-full"]),onClick:t[17]||(t[17]=a=>n.selectTab(16))},[jt,g(" "+l(n.translations.validation_license),1)],2)]),e("div",Vt,[i.loading?(c(),d("div",It,Rt)):b("",!0),i.selectedTab===1?(c(),d("div",Ut,[e("h2",Dt,l(n.translations.general_settings),1),e("form",{onSubmit:t[30]||(t[30]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Ht,[e("div",Yt,[e("label",Nt,l(n.translations.company_code),1),p(e("input",{type:"text",id:"company-code","onUpdate:modelValue":t[18]||(t[18]=a=>i.form.company_code=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_code]])]),e("div",qt,[e("label",Lt,l(n.translations.tax_number),1),p(e("input",{type:"text",id:"tax-number","onUpdate:modelValue":t[19]||(t[19]=a=>i.form.tax_number=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.tax_number]])]),e("div",Ot,[e("label",Xt,l(n.translations.company_name),1),p(e("input",{type:"text",id:"company-name","onUpdate:modelValue":t[20]||(t[20]=a=>i.form.company_name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.company_name]])]),e("div",Wt,[e("label",Bt,l(n.translations.address),1),p(e("input",{type:"text",id:"company-address","onUpdate:modelValue":t[21]||(t[21]=a=>i.form.company_address=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.company_address]])]),e("div",zt,[e("label",Gt,l(n.translations.postal_code),1),p(e("input",{type:"text",id:"postal-code","onUpdate:modelValue":t[22]||(t[22]=a=>i.form.postal_code=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.postal_code]])]),e("div",Jt,[e("label",Zt,l(n.translations.city),1),p(e("input",{type:"text",id:"city","onUpdate:modelValue":t[23]||(t[23]=a=>i.form.city=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.city]])]),e("div",Qt,[e("label",Kt,l(n.translations.country),1),p(e("input",{type:"text",id:"country","onUpdate:modelValue":t[24]||(t[24]=a=>i.form.country=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.country]])]),e("div",$t,[e("label",te,l(n.translations.email),1),p(e("input",{type:"email",id:"company-email","onUpdate:modelValue":t[25]||(t[25]=a=>i.form.company_email=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_email]])]),e("div",ee,[e("label",se,l(n.translations.phone),1),p(e("input",{type:"tel",id:"company-phone","onUpdate:modelValue":t[26]||(t[26]=a=>i.form.company_phone=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.company_phone]])]),e("div",ne,[e("label",ie,l(n.translations.mobile),1),p(e("input",{type:"tel",id:"mobile-phone","onUpdate:modelValue":t[27]||(t[27]=a=>i.form.mobile_phone=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.mobile_phone]])]),e("div",oe,[e("label",ae,l(n.translations.fax),1),p(e("input",{type:"tel",id:"fax","onUpdate:modelValue":t[28]||(t[28]=a=>i.form.fax=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.fax]])])]),le,i.form.easy_compta_siret_addon_active==1?(c(),d("div",re,[e("div",ce,[e("div",de,[e("label",ue,l(n.translations.siret_api_token),1),he,p(e("input",{type:"text",id:"company-code","onUpdate:modelValue":t[29]||(t[29]=a=>i.form.easycompta_siret_token_api=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.easycompta_siret_token_api]])])])])):b("",!0),e("div",pe,[e("button",me,[fe,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===2?(c(),d("div",be,[e("h2",_e,l(n.translations.system_settings),1),e("form",{onSubmit:t[41]||(t[41]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ge,[e("label",ye,[e("span",ve,l(n.translations.activate_logo_mentions),1),e("input",{type:"checkbox",checked:i.form.logo_mentions_active==1,onChange:t[31]||(t[31]=(...a)=>n.updateLogoMentionsActive&&n.updateLogoMentionsActive(...a)),class:"wcpa-ui-toggle"},null,40,we)])]),i.form.logo_mentions_active==1?(c(),d("div",xe,[e("label",ke,l(n.translations.logo_mentions),1),p(e("input",{type:"text",id:"logo-mentions","onUpdate:modelValue":t[32]||(t[32]=a=>i.form.logo_mentions=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.logo_mentions]])])):b("",!0),e("div",Ce,[e("label",Te,l(n.translations.company_logo),1),e("div",Me,[e("input",{id:"file_logo",type:"file",onChange:t[33]||(t[33]=(...a)=>n.handleLogoUpload&&n.handleLogoUpload(...a)),accept:"image/*",class:"ecwp-file-input file-input file-input-bordered file-input-info w-full max-w-xs"},null,32),e("label",Ae,[e("span",null,[Se,g(l(n.translations.select),1)])])]),i.logoPreviewUrl?(c(),d("div",Pe,[p(e("input",{type:"range",min:"0",max:"400","onUpdate:modelValue":t[34]||(t[34]=a=>i.form.logo_width=a),class:"range mt-4",onChange:t[35]||(t[35]=(...a)=>n.updatePreviewWidth&&n.updatePreviewWidth(...a))},null,544),[[f,i.form.logo_width]]),e("div",Ee,l(i.form.logo_width)+" px",1),i.form.logo_width!==null?(c(),d("div",je,[e("img",{src:i.logoPreviewUrl,alt:"Logo Preview",class:"mb-6",style:C({width:i.form.logo_width+"px"})},null,12,Ve)])):b("",!0)])):b("",!0)]),e("div",Ie,[e("label",Fe,l(n.translations.default_currency),1),p(e("select",{"onUpdate:modelValue":t[36]||(t[36]=a=>i.form.default_currency=a),class:"ecwp-input input input-bordered"},[(c(!0),d(T,null,S(i.currencies,a=>(c(),d("option",{value:a.id,key:a.id},l(a.name)+" ("+l(a.symbol)+") ",9,Re))),128))],512),[[V,i.form.default_currency]])]),e("div",Ue,[e("label",De,l(n.translations.currency_position),1),p(e("select",{"onUpdate:modelValue":t[37]||(t[37]=a=>i.form.currency_position=a),class:"ecwp-input input input-bordered"},[e("option",He,l(n.translations.before_amount),1),e("option",Ye,l(n.translations.after_amount),1)],512),[[V,i.form.currency_position]])]),e("div",Ne,[e("label",qe,[e("span",Le,l(n.translations.activate_vat),1),e("input",{type:"checkbox",checked:i.form.vat_active==1,onChange:t[38]||(t[38]=(...a)=>n.updateVatActive&&n.updateVatActive(...a)),class:"wcpa-ui-toggle"},null,40,Oe)])]),i.form.vat_active==1?(c(),d("div",Xe,[e("label",We,l(n.translations.default_vat),1),p(e("select",{"onUpdate:modelValue":t[39]||(t[39]=a=>i.form.default_vat=a),class:"ecwp-input input input-bordered"},[Be,(c(!0),d(T,null,S(i.vats,a=>(c(),d("option",{value:a.id,key:a.id},l(a.description)+" - "+l(a.rate)+"% ",9,ze))),128))],512),[[V,i.form.default_vat]])])):b("",!0),e("div",Ge,[e("label",Je,l(n.translations.format_date),1),p(e("select",{"onUpdate:modelValue":t[40]||(t[40]=a=>i.form.date_format=a),class:"ecwp-input input input-bordered"},os,512),[[V,i.form.date_format]])]),e("div",as,[e("button",ls,[rs,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===3?(c(),d("div",cs,[i.showArticleModal?(c(),d("dialog",ds,[e("div",us,[e("h3",null,l(i.editingArticle?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[48]||(t[48]=k((...a)=>n.saveArticle&&n.saveArticle(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[42]||(t[42]=(...a)=>n.closeArticleModal&&n.closeArticleModal(...a))}," \u2715 "),e("div",hs,[e("label",ps,l(n.translations.item_ref),1),p(e("input",{type:"text",id:"name_ref","onUpdate:modelValue":t[43]||(t[43]=a=>i.articleForm.ref=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.ref]])]),e("div",ms,[e("label",fs,l(n.translations.item_name),1),p(e("input",{type:"text",id:"name_article","onUpdate:modelValue":t[44]||(t[44]=a=>i.articleForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.name]])]),e("div",bs,[e("label",_s,l(n.translations.description),1),p(e("textarea",{id:"desc_article","onUpdate:modelValue":t[45]||(t[45]=a=>i.articleForm.description=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.description]])]),e("div",gs,[e("label",ys,l(n.translations.unit_price),1),p(e("input",{type:"text",id:"price_article","onUpdate:modelValue":t[46]||(t[46]=a=>i.articleForm.unit_price=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.articleForm.unit_price]])]),e("div",vs,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[47]||(t[47]=(...a)=>n.closeArticleModal&&n.closeArticleModal(...a))},l(n.translations.cancel),1),e("button",ws,l(i.editingArticle?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",xs,[e("h3",ks,l(n.translations.articles_settings),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[49]||(t[49]=(...a)=>n.addArticle&&n.addArticle(...a))},[Cs,g(" "+l(n.translations.add),1)])]),e("div",Ts,[e("table",Ms,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.item_ref),1),e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.description),1),e("th",null,l(n.translations.unit_price),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.articles,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.ref),1),e("td",null,l(a.name),1),e("td",null,l(a.description),1),e("td",null,l(a.unit_price),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editArticle(a.id)},Ps,8,As),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("article",a.id)},Vs,8,Es)])]))),128))])])]),Is,e("h2",Fs,l(n.translations.categories),1),e("div",Rs,[e("table",Us,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.categories,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.name),1),e("td",null,[e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("category_article",a.id)},Ys,8,Ds)])]))),128))])])])])):b("",!0),i.selectedTab===4?(c(),d("div",Ns,[e("h2",qs,l(n.translations.invoices_settings),1),e("form",{onSubmit:t[65]||(t[65]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Ls,[e("div",Os,[e("label",Xs,l(n.translations.invoice_color),1),p(e("input",{type:"text",id:"invoice-color","onUpdate:modelValue":t[50]||(t[50]=a=>i.form.invoice_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.invoice_color]]),x(u,{modelValue:i.form.invoice_color,"onUpdate:modelValue":t[51]||(t[51]=a=>i.form.invoice_color=a)},null,8,["modelValue"])]),e("div",Ws,[e("label",Bs,l(n.translations.invoice_prefix),1),p(e("input",{type:"text",id:"invoice-prefix","onUpdate:modelValue":t[52]||(t[52]=a=>i.form.invoice_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.invoice_prefix]])])]),zs,e("div",Gs,[e("div",Js,[e("label",Zs,[e("input",{type:"checkbox",checked:i.form.show_phone==1,onChange:t[53]||(t[53]=a=>n.updateFormField(a,"show_phone")),class:"wcpa-ui-toggle"},null,40,Qs),e("span",Ks,l(n.translations.show_phone),1)])]),e("div",$s,[e("label",tn,[e("input",{type:"checkbox",checked:i.form.show_email==1,onChange:t[54]||(t[54]=a=>n.updateFormField(a,"show_email")),class:"wcpa-ui-toggle"},null,40,en),e("span",sn,l(n.translations.show_email),1)])]),e("div",nn,[e("label",on,[e("input",{type:"checkbox",checked:i.form.show_siren==1,onChange:t[55]||(t[55]=a=>n.updateFormField(a,"show_siren")),class:"wcpa-ui-toggle"},null,40,an),e("span",ln,l(n.translations.show_siren),1)])]),e("div",rn,[e("label",cn,[e("input",{type:"checkbox",checked:i.form.show_tax_number==1,onChange:t[56]||(t[56]=a=>n.updateFormField(a,"show_tax_number")),class:"wcpa-ui-toggle"},null,40,dn),e("span",un,l(n.translations.show_tax_number),1)])]),e("div",hn,[e("label",pn,[e("input",{type:"checkbox",checked:i.form.show_watermark==1,onChange:t[57]||(t[57]=a=>n.updateFormField(a,"show_watermark")),class:"wcpa-ui-toggle"},null,40,mn),e("span",fn,l(n.translations.show_watermark),1)])]),i.form.show_watermark==1?(c(),d("div",bn,[e("label",_n,[e("input",{type:"checkbox",checked:i.form.show_watermark_only_paid==1,onChange:t[58]||(t[58]=a=>n.updateFormField(a,"show_watermark_only_paid")),class:"wcpa-ui-toggle"},null,40,gn),e("span",yn,l(n.translations.show_watermark_only_paid),1)])])):b("",!0)]),vn,e("div",wn,[e("div",xn,[e("label",kn,l(n.translations.payment_conditions),1),p(e("input",{type:"text",id:"conditions-payment","onUpdate:modelValue":t[59]||(t[59]=a=>i.form.payment_conditions=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_conditions]])]),e("div",Cn,[e("label",Tn,l(n.translations.payment_mode),1),p(e("input",{type:"text",id:"mode-payment","onUpdate:modelValue":t[60]||(t[60]=a=>i.form.payment_mode=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_mode]])])]),e("div",Mn,[e("div",An,[e("label",Sn,l(n.translations.invoice_terms),1),e("div",null,[x(_,{modelValue:i.form.invoice_terms,"onUpdate:modelValue":t[61]||(t[61]=a=>i.form.invoice_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",Pn,[e("div",En,[e("label",jn,l(n.translations.invoice_iban),1),p(e("input",{type:"text",id:"invoice-iban","onUpdate:modelValue":t[62]||(t[62]=a=>i.form.invoice_iban=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_iban]])]),e("div",Vn,[e("label",In,l(n.translations.invoice_bic),1),p(e("input",{type:"text",id:"invoice-bic","onUpdate:modelValue":t[63]||(t[63]=a=>i.form.invoice_bic=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_bic]])])]),e("div",Fn,[e("label",Rn,l(n.translations.invoice_footer),1),e("div",null,[x(_,{modelValue:i.form.invoice_footer,"onUpdate:modelValue":t[64]||(t[64]=a=>i.form.invoice_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",Un,[e("button",Dn,[Hn,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===5?(c(),d("div",Yn,[e("h2",Nn,l(n.translations.credits_settings),1),e("form",{onSubmit:t[71]||(t[71]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",qn,[e("div",Ln,[e("label",On,l(n.translations.credit_color),1),p(e("input",{type:"text",id:"credit-color","onUpdate:modelValue":t[66]||(t[66]=a=>i.form.credit_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.credit_color]]),x(u,{modelValue:i.form.credit_color,"onUpdate:modelValue":t[67]||(t[67]=a=>i.form.credit_color=a)},null,8,["modelValue"])]),e("div",Xn,[e("label",Wn,l(n.translations.credit_prefix),1),p(e("input",{type:"text",id:"credit-prefix","onUpdate:modelValue":t[68]||(t[68]=a=>i.form.credit_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.credit_prefix]])])]),e("div",Bn,[e("div",zn,[e("label",Gn,l(n.translations.credit_footer),1),e("div",null,[x(_,{modelValue:i.form.credit_footer,"onUpdate:modelValue":t[69]||(t[69]=a=>i.form.credit_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",Jn,[e("label",Zn,l(n.translations.credit_terms),1),e("div",null,[x(_,{modelValue:i.form.credit_terms,"onUpdate:modelValue":t[70]||(t[70]=a=>i.form.credit_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",Qn,[e("button",Kn,[$n,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===6?(c(),d("div",ti,[e("h2",ei,l(n.translations.quotes_settings),1),e("form",{onSubmit:t[77]||(t[77]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",si,[e("div",ni,[e("label",ii,l(n.translations.quote_color),1),p(e("input",{type:"text",id:"quote-color","onUpdate:modelValue":t[72]||(t[72]=a=>i.form.quote_color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.quote_color]]),x(u,{modelValue:i.form.quote_color,"onUpdate:modelValue":t[73]||(t[73]=a=>i.form.quote_color=a)},null,8,["modelValue"])]),e("div",oi,[e("label",ai,l(n.translations.quote_prefix),1),p(e("input",{type:"text",id:"quote-prefix","onUpdate:modelValue":t[74]||(t[74]=a=>i.form.quote_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.quote_prefix]])])]),e("div",li,[e("div",ri,[e("label",ci,l(n.translations.quote_footer),1),e("div",null,[x(_,{modelValue:i.form.quote_footer,"onUpdate:modelValue":t[75]||(t[75]=a=>i.form.quote_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",di,[e("label",ui,l(n.translations.quote_terms),1),e("div",null,[x(_,{modelValue:i.form.quote_terms,"onUpdate:modelValue":t[76]||(t[76]=a=>i.form.quote_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",hi,[e("button",pi,[mi,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===7?(c(),d("div",fi,[e("h2",bi,l(n.translations.currency_vat_settings),1),i.showCurrencyModal?(c(),d("dialog",_i,[e("div",gi,[e("h3",null,l(i.editingCurrency?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[83]||(t[83]=k((...a)=>n.saveCurrency&&n.saveCurrency(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[78]||(t[78]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))}," \u2715 "),e("div",yi,[e("label",vi,l(n.translations.name),1),p(e("input",{type:"text",id:"name_currency","onUpdate:modelValue":t[79]||(t[79]=a=>i.currencyForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.name]])]),e("div",wi,[e("label",xi,l(n.translations.symbol),1),p(e("input",{type:"text",id:"symbol_currency","onUpdate:modelValue":t[80]||(t[80]=a=>i.currencyForm.symbol=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.symbol]])]),e("div",ki,[e("label",Ci,l(n.translations.code),1),p(e("input",{type:"text",id:"code_currency","onUpdate:modelValue":t[81]||(t[81]=a=>i.currencyForm.code=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.code]])]),e("div",Ti,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[82]||(t[82]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))},l(n.translations.cancel),1),e("button",Mi,l(i.editingCurrency?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Ai,[e("div",Si,[e("h3",Pi,l(n.translations.currencies),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[84]||(t[84]=(...a)=>n.addCurrency&&n.addCurrency(...a))},[Ei,g(" "+l(n.translations.add_currency),1)])]),e("div",ji,[e("table",Vi,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.symbol),1),e("th",null,l(n.translations.code),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.currencies,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.name),1),e("td",null,l(a.symbol),1),e("td",null,l(a.code),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editCurrency(a.id)},Ri,8,Ii),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("currency",a.id)},Hi,8,Ui)])]))),128))])])])]),e("div",null,[i.showVATModal?(c(),d("dialog",Yi,[e("div",Ni,[e("h3",null,l(i.editingVAT?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[89]||(t[89]=k((...a)=>n.saveVAT&&n.saveVAT(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[85]||(t[85]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))}," \u2715 "),e("div",qi,[e("label",Li,l(n.translations.description),1),p(e("input",{type:"text",id:"vat-description","onUpdate:modelValue":t[86]||(t[86]=a=>i.vatForm.description=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.description]])]),e("div",Oi,[e("label",Xi,l(n.translations.rate)+" (%)",1),p(e("input",{type:"text",id:"vat-rate","onUpdate:modelValue":t[87]||(t[87]=a=>i.vatForm.rate=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.rate]])]),e("div",Wi,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[88]||(t[88]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))},l(n.translations.cancel),1),e("button",Bi,l(i.editingVAT?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",zi,[e("h3",Gi,l(n.translations.vat_rates),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[90]||(t[90]=(...a)=>n.addVAT&&n.addVAT(...a))},[Ji,g(" "+l(n.translations.add_vat),1)])]),e("div",Zi,[e("table",Qi,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.description),1),e("th",null,l(n.translations.rate)+" (%)",1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.vats,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.description),1),e("td",null,l(a.rate),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editVAT(a.id)},to,8,Ki),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("vat",a.id)},no,8,eo)])]))),128))])])])])])):b("",!0),i.selectedTab===8?(c(),d("div",io,[e("h2",oo,l(n.translations.payments_settings),1),i.showPaymentModal?(c(),d("dialog",ao,[e("div",lo,[e("h3",null,l(i.editingPayment?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[94]||(t[94]=k((...a)=>n.savePayment&&n.savePayment(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[91]||(t[91]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))}," \u2715 "),e("div",ro,[e("label",co,l(n.translations.name),1),p(e("input",{type:"text",id:"name_payment","onUpdate:modelValue":t[92]||(t[92]=a=>i.paymentForm.method_name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.paymentForm.method_name]])]),e("div",uo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[93]||(t[93]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))},l(n.translations.cancel),1),e("button",ho,l(i.editingPayment?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",po,[e("div",mo,[e("h3",fo,l(n.translations.payments_methods),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[95]||(t[95]=(...a)=>n.addPayment&&n.addPayment(...a))},[bo,g(l(n.translations.add_method),1)])]),e("div",_o,[e("table",go,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.payments,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.method_name),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editPayment(a.id)},wo,8,yo),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("payment",a.id)},Co,8,xo)])]))),128))])])])])])):b("",!0),i.selectedTab===9?(c(),d("div",To,[e("h2",Mo,l(n.translations.expenses_settings),1),i.showExpenseModal?(c(),d("dialog",Ao,[e("div",So,[e("h3",null,l(i.editingExpense?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[99]||(t[99]=k((...a)=>n.saveExpCat&&n.saveExpCat(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[96]||(t[96]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))}," \u2715 "),e("div",Po,[e("label",Eo,l(n.translations.name),1),p(e("input",{type:"text",id:"name_expense","onUpdate:modelValue":t[97]||(t[97]=a=>i.expenseForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.expenseForm.name]])]),e("div",jo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[98]||(t[98]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))},l(n.translations.cancel),1),e("button",Vo,l(i.editingExpense?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Io,[e("div",Fo,[e("h3",Ro,l(n.translations.expenses_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[100]||(t[100]=(...a)=>n.addExpCat&&n.addExpCat(...a))},[Uo,g(" "+l(n.translations.add_category),1)])]),e("div",Do,[e("table",Ho,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.expenses,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.name),1),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editExpCat(a.id)},qo,8,Yo),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("expense",a.id)},Xo,8,Lo)])]))),128))])])])])])):b("",!0),i.selectedTab===10?(c(),d("div",Wo,[e("h2",Bo,l(n.translations.planning_settings),1),i.showPlanningModal?(c(),d("dialog",zo,[e("div",Go,[e("h3",null,l(i.editingPlanning?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[108]||(t[108]=k((...a)=>n.savePlanningCat&&n.savePlanningCat(...a),["prevent"]))},[e("button",{class:"btn btn-sm btn-circle btn-ghost absolute right-2 top-2",onClick:t[101]||(t[101]=(...a)=>n.closePlanningModal&&n.closePlanningModal(...a))}," \u2715 "),e("div",Jo,[e("label",Zo,l(n.translations.name),1),p(e("input",{type:"text",id:"name_planning","onUpdate:modelValue":t[102]||(t[102]=a=>i.planningForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.name]])]),e("div",Qo,[e("label",Ko,l(n.translations.background),1),p(e("input",{type:"text",id:"background_planning","onUpdate:modelValue":t[103]||(t[103]=a=>i.planningForm.background=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.background]]),x(u,{modelValue:i.planningForm.background,"onUpdate:modelValue":t[104]||(t[104]=a=>i.planningForm.background=a)},null,8,["modelValue"])]),e("div",$o,[e("label",ta,l(n.translations.text_color),1),p(e("input",{type:"text",id:"color_planning","onUpdate:modelValue":t[105]||(t[105]=a=>i.planningForm.color=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.color]]),x(u,{modelValue:i.planningForm.color,"onUpdate:modelValue":t[106]||(t[106]=a=>i.planningForm.color=a)},null,8,["modelValue"])]),e("div",ea,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[107]||(t[107]=(...a)=>n.closePlanningModal&&n.closePlanningModal(...a))},l(n.translations.cancel),1),e("button",{type:"submit",class:"btn btn-primary rounded-full mx-2",disabled:i.loading},[g(l(i.editingPlanning?n.translations.save:n.translations.add)+" ",1),i.loading?(c(),d("span",na)):b("",!0)],8,sa)])],32)])])):b("",!0),e("div",ia,[e("div",oa,[e("h3",aa,l(n.translations.planning_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[109]||(t[109]=(...a)=>n.addPlanningCat&&n.addPlanningCat(...a))},[la,g(" "+l(n.translations.add_category),1)])]),e("div",ra,[e("table",ca,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.id),1),e("th",null,l(n.translations.name),1),e("th",null,l(n.translations.background),1),e("th",null,l(n.translations.color),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.planning,a=>(c(),d("tr",{key:a.id},[e("td",null,l(a.id),1),e("td",null,l(a.name),1),e("td",null,[e("span",{class:"ecwp-color-preview",style:C({backgroundColor:a.background})},null,4)]),e("td",null,[e("span",{class:"ecwp-color-preview",style:C({backgroundColor:a.color})},null,4)]),e("td",null,[e("button",{class:"p-2 text-secondary",onClick:y=>n.editPlanningCat(a.id)},ha,8,da),e("button",{class:"p-2 text-error",onClick:y=>n.delete_item("planning",a.id)},fa,8,pa)])]))),128))])])])])])):b("",!0),i.selectedTab===11?(c(),d("div",ba,[e("h2",_a,l(n.translations.email_settings),1),e("form",{onSubmit:t[121]||(t[121]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ga,[e("label",ya,[e("span",va,l(n.translations.email_log_active),1),e("input",{type:"checkbox",checked:i.form.email_log_active==1,onChange:t[110]||(t[110]=(...a)=>n.updateEmailLogsActive&&n.updateEmailLogsActive(...a)),class:"wcpa-ui-toggle"},null,40,wa)])]),xa,e("div",ka,[e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabEmail==="tab1"}]),onClick:t[111]||(t[111]=a=>n.setActiveTab("tab1"))},l(n.translations.email_invoice),3),e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabEmail==="tab2"}]),onClick:t[112]||(t[112]=a=>n.setActiveTab("tab2"))},l(n.translations.email_quote),3),e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabEmail==="tab3"}]),onClick:t[113]||(t[113]=a=>n.setActiveTab("tab3"))},l(n.translations.invoice_reminder),3),e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabEmail==="tab4"}]),onClick:t[114]||(t[114]=a=>n.setActiveTab("tab4"))},l(n.translations.payment_received),3)]),i.activeTabEmail==="tab1"?(c(),d("div",Ca,[e("div",Ta,[e("div",Ma,[e("label",Aa,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_invoice_subject","onUpdate:modelValue":t[115]||(t[115]=a=>i.form.email_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_invoice_subject]])]),e("div",Sa,[e("label",Pa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_invoice_content,"onUpdate:modelValue":t[116]||(t[116]=a=>i.form.email_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Ea])])])):b("",!0),i.activeTabEmail==="tab2"?(c(),d("div",ja,[e("div",Va,[e("div",Ia,[e("label",Fa,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_quote_subject","onUpdate:modelValue":t[117]||(t[117]=a=>i.form.email_quote_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_quote_subject]])]),e("div",Ra,[e("label",Ua,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_quote_content,"onUpdate:modelValue":t[118]||(t[118]=a=>i.form.email_quote_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Da])])])):b("",!0),i.activeTabEmail==="tab3"?(c(),d("div",Ha,[e("div",Ya,[e("div",Na,[e("label",qa,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"remind_invoice_subject","onUpdate:modelValue":t[119]||(t[119]=a=>i.form.remind_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.remind_invoice_subject]])]),e("div",La,[e("label",Oa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.remind_invoice_content,"onUpdate:modelValue":t[120]||(t[120]=a=>i.form.remind_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Xa])])])):b("",!0),i.activeTabEmail==="tab4"?(c(),d("div",Wa,[e("div",Ba,[za,e("div",null,[e("h2",Ga,l(n.translations.coming_soon),1)])])])):b("",!0),e("div",Ja,[e("button",Za,[Qa,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===12?(c(),d("div",Ka,[e("h2",$a,l(n.translations.users_settings),1),e("div",tl,[e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabUsers==="user1"}]),onClick:t[122]||(t[122]=a=>n.setActiveTabUsers("user1"))}," Automatic create account ",2),e("a",{role:"tab",class:v(["tab",{"tab-active":i.activeTabUsers==="user2"}]),onClick:t[123]||(t[123]=a=>n.setActiveTabUsers("user2"))}," Lost password ",2)]),i.activeTabUsers==="user1"?(c(),d("div",el,[e("form",{onSubmit:t[126]||(t[126]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",sl,[e("div",nl,[e("label",il,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_create_account_subject","onUpdate:modelValue":t[124]||(t[124]=a=>i.form.email_create_account_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_create_account_subject]])]),e("div",ol,[e("label",al,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_create_account_content,"onUpdate:modelValue":t[125]||(t[125]=a=>i.form.email_create_account_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),ll])]),e("div",rl,[e("button",cl,[dl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.activeTabUsers==="user2"?(c(),d("div",ul,[e("div",hl,[pl,e("div",null,[e("h2",ml,l(n.translations.coming_soon),1)])])])):b("",!0)])):b("",!0),i.selectedTab===13?(c(),d("div",fl,[e("h2",bl,l(n.translations.stripe_settings),1),e("form",{onSubmit:t[132]||(t[132]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",_l,[e("div",gl,[e("label",yl,l(n.translations.stripe_mode),1),p(e("select",{id:"stripe-mode","onUpdate:modelValue":t[127]||(t[127]=a=>i.form.stripe_mode=a),class:"ecwp-input input input-bordered",required:""},[e("option",vl,l(n.translations.test_mode),1),e("option",wl,l(n.translations.live_mode),1)],512),[[V,i.form.stripe_mode]])]),i.form.stripe_mode==="test"?(c(),d("div",xl,[e("div",kl,[e("label",Cl,l(n.translations.stripe_public_key_test),1),p(e("input",{type:"text",id:"stripe-public-key-test","onUpdate:modelValue":t[128]||(t[128]=a=>i.form.stripe_public_key_test=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_public_key_test]])]),e("div",Tl,[e("label",Ml,l(n.translations.stripe_secret_key_test),1),p(e("input",{type:"text",id:"stripe-secret-key-test","onUpdate:modelValue":t[129]||(t[129]=a=>i.form.stripe_secret_key_test=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_secret_key_test]])])])):b("",!0),i.form.stripe_mode==="live"?(c(),d("div",Al,[e("div",Sl,[e("label",Pl,l(n.translations.stripe_public_key_live),1),p(e("input",{type:"text",id:"stripe-public-key-live","onUpdate:modelValue":t[130]||(t[130]=a=>i.form.stripe_public_key_live=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_public_key_live]])]),e("div",El,[e("label",jl,l(n.translations.stripe_secret_key_live),1),p(e("input",{type:"text",id:"stripe-secret-key-live","onUpdate:modelValue":t[131]||(t[131]=a=>i.form.stripe_secret_key_live=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.stripe_secret_key_live]])])])):b("",!0)]),e("div",Vl,[e("button",Il,[Fl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===14?(c(),d("div",Rl,[e("h2",Ul,l(n.translations.stats_settings),1),e("form",{onSubmit:t[135]||(t[135]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Dl,[e("div",Hl,[e("label",Yl,l(n.translations.limit_declaration),1),p(e("input",{type:"number",id:"limit-declaration","onUpdate:modelValue":t[133]||(t[133]=a=>i.form.limit_declaration=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_declaration]])]),e("div",Nl,[e("label",ql,l(n.translations.limit_tva),1),p(e("input",{type:"number",id:"limit-tva","onUpdate:modelValue":t[134]||(t[134]=a=>i.form.limit_tva=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_tva]])])]),e("div",Ll,[e("button",Ol,[Xl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===15?(c(),d("div",Wl,[e("h2",Bl,l(n.translations.qrcode_settings),1),e("form",{onSubmit:t[137]||(t[137]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",zl,[e("div",Gl,[e("label",Jl,l(n.translations.stripe_api),1),p(e("input",{type:"text",id:"stripe-api","onUpdate:modelValue":t[136]||(t[136]=a=>i.form.easy_compta_stripe_secret_api=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.easy_compta_stripe_secret_api]])])]),e("div",Zl,[e("button",Ql,[Kl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===16?(c(),d("div",$l,[e("h2",tr,l(n.translations.validation_license),1),e("div",er,[e("div",sr,[e("label",nr,l(n.translations.license_key),1),p(e("input",{type:"text",id:"license-code","onUpdate:modelValue":t[138]||(t[138]=a=>i.license_key=a),class:"ecwp-input input input-bordered w-full",disabled:i.licenseData&&i.licenseData.valid,required:""},null,8,ir),[[f,i.license_key]]),e("button",{onClick:t[139]||(t[139]=(...a)=>n.checkLicense&&n.checkLicense(...a)),class:"btn btn-primary join-item rounded-r-full mt-5 -me-1",disabled:i.loadingLicense||i.licenseData&&i.licenseData.valid},[i.loadingLicense?(c(),d("span",ar)):(c(),d("span",lr,l(n.translations.validate),1))],8,or)])]),e("div",rr,[i.errorMessage?(c(),d("div",cr,l(i.errorMessage),1)):b("",!0),i.licenseData?(c(),d("div",dr,[e("table",ur,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.domain),1),e("th",null,l(n.translations.addon_name),1),e("th",null,l(n.translations.activation_date),1),e("th",null,l(n.translations.expiry_date),1),e("th",null,l(n.translations.status),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[e("tr",null,[e("td",null,l(i.licenseData.domain),1),e("td",null,[(c(!0),d(T,null,S(i.licenseData.plugins,(a,y)=>(c(),d("div",{key:y},l(y),1))),128))]),e("td",null,l(i.licenseData.start_date),1),e("td",null,l(i.licenseData.end_date),1),e("td",null,l(i.licenseData.valid?"Valid":"Invalid"),1),e("td",null,[e("button",{onClick:t[140]||(t[140]=a=>n.refresh_licence()),class:"btn btn-circle text-blue-500 hover:text-blue-700 mx-1"},pr),e("button",{onClick:t[141]||(t[141]=a=>n.delete_item("licence","")),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},fr)])])])]),e("table",br,[e("thead",null,[e("tr",null,[e("th",null,l(n.translations.addon_name),1),e("th",null,l(n.translations.slug),1),e("th",null,l(n.translations.installed),1),e("th",null,l(n.translations.version),1),e("th",null,l(n.translations.actions),1)])]),e("tbody",null,[(c(!0),d(T,null,S(i.licenseData.plugins,a=>(c(),d("tr",{key:a},[e("td",null,l(a.product_name),1),e("td",null,l(a.product_slug),1),e("td",null,[i.installed_versions[a.product_slug]?(c(),d(T,{key:0},[g(l(n.translations.installed),1)],64)):(c(),d(T,{key:1},[g(l(n.translations.not_installed),1)],64))]),e("td",null,l(i.installed_versions[a.product_slug]),1),e("td",null,[i.installed_versions[a.product_slug]?(c(),d(T,{key:0},[e("button",{onClick:y=>n.checkUpdatePlugin(a.product_slug,i.installed_versions[a.product_slug]),class:"btn btn-sm text-red-500 hover:text-red-700 mx-1"},l(n.translations.check_update),9,_r),i.updatesAvailable[a.product_slug]?(c(),d("button",{key:0,onClick:y=>n.installUpdatePlugin(a.product_slug,i.updatesAvailable[a.product_slug]),class:"btn btn-sm text-blue-500 hover:text-blue-700 mx-1"},l(n.translations.download),9,gr)):b("",!0)],64)):(c(),d("button",{key:1,onClick:y=>n.installUpdatePlugin(a.product_slug,i.updatesAvailable[a.product_slug]),class:"btn btn-sm text-green-500 hover:green-red-700 mx-1"},l(n.translations.download),9,yr))])]))),128))])])])):b("",!0)])])):b("",!0)])])]),_:1})])}var wr=$(ct,[["render",vr]]);function R(s){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(s)}var xr=/^\s+/,kr=/\s+$/;function h(s,t){if(s=s||"",t=t||{},s instanceof h)return s;if(!(this instanceof h))return new h(s,t);var o=Cr(s);this._originalInput=s,this._r=o.r,this._g=o.g,this._b=o.b,this._a=o.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||o.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=o.ok}h.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),o,r,i,n,m,u;return o=t.r/255,r=t.g/255,i=t.b/255,o<=.03928?n=o/12.92:n=Math.pow((o+.055)/1.055,2.4),r<=.03928?m=r/12.92:m=Math.pow((r+.055)/1.055,2.4),i<=.03928?u=i/12.92:u=Math.pow((i+.055)/1.055,2.4),.2126*n+.7152*m+.0722*u},setAlpha:function(t){return this._a=G(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=q(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=q(this._r,this._g,this._b),o=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.v*100);return this._a==1?"hsv("+o+", "+r+"%, "+i+"%)":"hsva("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var t=N(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=N(this._r,this._g,this._b),o=Math.round(t.h*360),r=Math.round(t.s*100),i=Math.round(t.l*100);return this._a==1?"hsl("+o+", "+r+"%, "+i+"%)":"hsla("+o+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return L(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return Sr(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(w(this._r,255)*100)+"%",g:Math.round(w(this._g,255)*100)+"%",b:Math.round(w(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%)":"rgba("+Math.round(w(this._r,255)*100)+"%, "+Math.round(w(this._g,255)*100)+"%, "+Math.round(w(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Nr[L(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var o="#"+O(this._r,this._g,this._b,this._a),r=o,i=this._gradientType?"GradientType = 1, ":"";if(t){var n=h(t);r="#"+O(n._r,n._g,n._b,n._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+o+",endColorstr="+r+")"},toString:function(t){var o=!!t;t=t||this._format;var r=!1,i=this._a<1&&this._a>=0,n=!o&&i&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return n?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return h(this.toString())},_applyModification:function(t,o){var r=t.apply(null,[this].concat([].slice.call(o)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Vr,arguments)},brighten:function(){return this._applyModification(Ir,arguments)},darken:function(){return this._applyModification(Fr,arguments)},desaturate:function(){return this._applyModification(Pr,arguments)},saturate:function(){return this._applyModification(Er,arguments)},greyscale:function(){return this._applyModification(jr,arguments)},spin:function(){return this._applyModification(Rr,arguments)},_applyCombination:function(t,o){return t.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination(Hr,arguments)},complement:function(){return this._applyCombination(Ur,arguments)},monochromatic:function(){return this._applyCombination(Yr,arguments)},splitcomplement:function(){return this._applyCombination(Dr,arguments)},triad:function(){return this._applyCombination(X,[3])},tetrad:function(){return this._applyCombination(X,[4])}};h.fromRatio=function(s,t){if(R(s)=="object"){var o={};for(var r in s)s.hasOwnProperty(r)&&(r==="a"?o[r]=s[r]:o[r]=F(s[r]));s=o}return h(s,t)};function Cr(s){var t={r:0,g:0,b:0},o=1,r=null,i=null,n=null,m=!1,u=!1;return typeof s=="string"&&(s=Xr(s)),R(s)=="object"&&(j(s.r)&&j(s.g)&&j(s.b)?(t=Tr(s.r,s.g,s.b),m=!0,u=String(s.r).substr(-1)==="%"?"prgb":"rgb"):j(s.h)&&j(s.s)&&j(s.v)?(r=F(s.s),i=F(s.v),t=Ar(s.h,r,i),m=!0,u="hsv"):j(s.h)&&j(s.s)&&j(s.l)&&(r=F(s.s),n=F(s.l),t=Mr(s.h,r,n),m=!0,u="hsl"),s.hasOwnProperty("a")&&(o=s.a)),o=G(o),{ok:m,format:s.format||u,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:o}}function Tr(s,t,o){return{r:w(s,255)*255,g:w(t,255)*255,b:w(o,255)*255}}function N(s,t,o){s=w(s,255),t=w(t,255),o=w(o,255);var r=Math.max(s,t,o),i=Math.min(s,t,o),n,m,u=(r+i)/2;if(r==i)n=m=0;else{var _=r-i;switch(m=u>.5?_/(2-r-i):_/(r+i),r){case s:n=(t-o)/_+(t<o?6:0);break;case t:n=(o-s)/_+2;break;case o:n=(s-t)/_+4;break}n/=6}return{h:n,s:m,l:u}}function Mr(s,t,o){var r,i,n;s=w(s,360),t=w(t,100),o=w(o,100);function m(M,a,y){return y<0&&(y+=1),y>1&&(y-=1),y<1/6?M+(a-M)*6*y:y<1/2?a:y<2/3?M+(a-M)*(2/3-y)*6:M}if(t===0)r=i=n=o;else{var u=o<.5?o*(1+t):o+t-o*t,_=2*o-u;r=m(_,u,s+1/3),i=m(_,u,s),n=m(_,u,s-1/3)}return{r:r*255,g:i*255,b:n*255}}function q(s,t,o){s=w(s,255),t=w(t,255),o=w(o,255);var r=Math.max(s,t,o),i=Math.min(s,t,o),n,m,u=r,_=r-i;if(m=r===0?0:_/r,r==i)n=0;else{switch(r){case s:n=(t-o)/_+(t<o?6:0);break;case t:n=(o-s)/_+2;break;case o:n=(s-t)/_+4;break}n/=6}return{h:n,s:m,v:u}}function Ar(s,t,o){s=w(s,360)*6,t=w(t,100),o=w(o,100);var r=Math.floor(s),i=s-r,n=o*(1-t),m=o*(1-i*t),u=o*(1-(1-i)*t),_=r%6,M=[o,m,n,n,u,o][_],a=[u,o,o,m,n,n][_],y=[n,n,u,o,o,m][_];return{r:M*255,g:a*255,b:y*255}}function L(s,t,o,r){var i=[E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function Sr(s,t,o,r,i){var n=[E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16)),E(J(r))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)&&n[3].charAt(0)==n[3].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0)+n[3].charAt(0):n.join("")}function O(s,t,o,r){var i=[E(J(r)),E(Math.round(s).toString(16)),E(Math.round(t).toString(16)),E(Math.round(o).toString(16))];return i.join("")}h.equals=function(s,t){return!s||!t?!1:h(s).toRgbString()==h(t).toRgbString()};h.random=function(){return h.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Pr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.s-=t/100,o.s=H(o.s),h(o)}function Er(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.s+=t/100,o.s=H(o.s),h(o)}function jr(s){return h(s).desaturate(100)}function Vr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.l+=t/100,o.l=H(o.l),h(o)}function Ir(s,t){t=t===0?0:t||10;var o=h(s).toRgb();return o.r=Math.max(0,Math.min(255,o.r-Math.round(255*-(t/100)))),o.g=Math.max(0,Math.min(255,o.g-Math.round(255*-(t/100)))),o.b=Math.max(0,Math.min(255,o.b-Math.round(255*-(t/100)))),h(o)}function Fr(s,t){t=t===0?0:t||10;var o=h(s).toHsl();return o.l-=t/100,o.l=H(o.l),h(o)}function Rr(s,t){var o=h(s).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,h(o)}function Ur(s){var t=h(s).toHsl();return t.h=(t.h+180)%360,h(t)}function X(s,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var o=h(s).toHsl(),r=[h(s)],i=360/t,n=1;n<t;n++)r.push(h({h:(o.h+n*i)%360,s:o.s,l:o.l}));return r}function Dr(s){var t=h(s).toHsl(),o=t.h;return[h(s),h({h:(o+72)%360,s:t.s,l:t.l}),h({h:(o+216)%360,s:t.s,l:t.l})]}function Hr(s,t,o){t=t||6,o=o||30;var r=h(s).toHsl(),i=360/o,n=[h(s)];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,n.push(h(r));return n}function Yr(s,t){t=t||6;for(var o=h(s).toHsv(),r=o.h,i=o.s,n=o.v,m=[],u=1/t;t--;)m.push(h({h:r,s:i,v:n})),n=(n+u)%1;return m}h.mix=function(s,t,o){o=o===0?0:o||50;var r=h(s).toRgb(),i=h(t).toRgb(),n=o/100,m={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(i.a-r.a)*n+r.a};return h(m)};h.readability=function(s,t){var o=h(s),r=h(t);return(Math.max(o.getLuminance(),r.getLuminance())+.05)/(Math.min(o.getLuminance(),r.getLuminance())+.05)};h.isReadable=function(s,t,o){var r=h.readability(s,t),i,n;switch(n=!1,i=Wr(o),i.level+i.size){case"AAsmall":case"AAAlarge":n=r>=4.5;break;case"AAlarge":n=r>=3;break;case"AAAsmall":n=r>=7;break}return n};h.mostReadable=function(s,t,o){var r=null,i=0,n,m,u,_;o=o||{},m=o.includeFallbackColors,u=o.level,_=o.size;for(var M=0;M<t.length;M++)n=h.readability(s,t[M]),n>i&&(i=n,r=h(t[M]));return h.isReadable(s,r,{level:u,size:_})||!m?r:(o.includeFallbackColors=!1,h.mostReadable(s,["#fff","#000"],o))};var Y=h.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Nr=h.hexNames=qr(Y);function qr(s){var t={};for(var o in s)s.hasOwnProperty(o)&&(t[s[o]]=o);return t}function G(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function w(s,t){Lr(s)&&(s="100%");var o=Or(s);return s=Math.min(t,Math.max(0,parseFloat(s))),o&&(s=parseInt(s*t,10)/100),Math.abs(s-t)<1e-6?1:s%t/parseFloat(t)}function H(s){return Math.min(1,Math.max(0,s))}function A(s){return parseInt(s,16)}function Lr(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function Or(s){return typeof s=="string"&&s.indexOf("%")!=-1}function E(s){return s.length==1?"0"+s:""+s}function F(s){return s<=1&&(s=s*100+"%"),s}function J(s){return Math.round(parseFloat(s)*255).toString(16)}function W(s){return A(s)/255}var P=function(){var s="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",o="(?:"+t+")|(?:"+s+")",r="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?",i="[\\s|\\(]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")[,|\\s]+("+o+")\\s*\\)?";return{CSS_UNIT:new RegExp(o),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function j(s){return!!P.CSS_UNIT.exec(s)}function Xr(s){s=s.replace(xr,"").replace(kr,"").toLowerCase();var t=!1;if(Y[s])s=Y[s],t=!0;else if(s=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var o;return(o=P.rgb.exec(s))?{r:o[1],g:o[2],b:o[3]}:(o=P.rgba.exec(s))?{r:o[1],g:o[2],b:o[3],a:o[4]}:(o=P.hsl.exec(s))?{h:o[1],s:o[2],l:o[3]}:(o=P.hsla.exec(s))?{h:o[1],s:o[2],l:o[3],a:o[4]}:(o=P.hsv.exec(s))?{h:o[1],s:o[2],v:o[3]}:(o=P.hsva.exec(s))?{h:o[1],s:o[2],v:o[3],a:o[4]}:(o=P.hex8.exec(s))?{r:A(o[1]),g:A(o[2]),b:A(o[3]),a:W(o[4]),format:t?"name":"hex8"}:(o=P.hex6.exec(s))?{r:A(o[1]),g:A(o[2]),b:A(o[3]),format:t?"name":"hex"}:(o=P.hex4.exec(s))?{r:A(o[1]+""+o[1]),g:A(o[2]+""+o[2]),b:A(o[3]+""+o[3]),a:W(o[4]+""+o[4]),format:t?"name":"hex8"}:(o=P.hex3.exec(s))?{r:A(o[1]+""+o[1]),g:A(o[2]+""+o[2]),b:A(o[3]+""+o[3]),format:t?"name":"hex"}:!1}function Wr(s){var t,o;return s=s||{level:"AA",size:"small"},t=(s.level||"AA").toUpperCase(),o=(s.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),o!=="small"&&o!=="large"&&(o="small"),{level:t,size:o}}var Z={name:"ColorPicker",props:["color","position","boxRect","disableAlpha","disableTextInputs"],emits:["updateColor","hueInputStart","hueInputEnd","hueInput","alphaInputStart","alphaInputEnd","alphaInput","saturationInputStart","saturationInputEnd","saturationInput","ready","change"],inject:["tinycolor"],data(){return{h:void 0,s:void 0,v:void 0,a:void 0,hueTranslateX:0,alphaTranslateX:0,saturationTranslateX:0,saturationTranslateY:0,sliderPointerWidth:0,saturationPointerWidth:0,saturationPointerHeight:0,pickerPositionA:{anchor:"top",offset:0},pickerPositionB:{anchor:"left",offset:0},pickerWidth:0,pickerHeight:0,textInputsFormat:"rgb",textInputActive:null,textInputsFreeze:{},arrowColor:"#0f0f0f",sliderWidth:0}},computed:{pureHueBackground(){return{background:"hsl("+this.h+", 100%, 50%)"}},hexString(){return this.color.toHexString()},huePointerStyles(){return{transform:"translate("+(this.hueTranslateX-this.sliderPointerWidth*.5)+"px)"}},alphaPointerStyles(){return{transform:"translate("+(this.alphaTranslateX-this.sliderPointerWidth*.5)+"px)"}},alphaPointerTransparentStyles(){return{backgroundPosition:-this.alphaTranslateX+"px"}},alphaPointerColorStyles(){return{opacity:this.a}},alphaCanvasStyles(){return{background:"linear-gradient(90deg, transparent 0%, "+this.color.toHexString()+" 100%)"}},saturationPointerStyles(){const s=this.saturationTranslateX-this.saturationPointerWidth*.5,t=this.saturationTranslateY+this.saturationPointerHeight*.5;return{transform:"translate("+s+"px, "+t+"px)"}},arrowsStyles(){return{"--arrow-color":this.arrowColor}},pickerPosition(){const s={},t={top:"bottom",bottom:"top",left:"right",right:"left"};let o;["top","bottom"].includes(this.position[0])?(s.marginLeft=0,s.marginRight=0,o=this.boxRect.height):(s.marginTop=0,s.marginBottom=0,o=this.boxRect.width);let r=t[this.position[0]];return s[r]=o+"px",this.position[1]==="center"?(["left","right"].includes(r)?(r="top",o=this.pickerHeight-this.boxRect.height):(r="left",o=this.pickerWidth-this.boxRect.width),o*=.5):(r=t[this.position[1]],o=0),s[r]=-o+"px",s},textInputs(){const s=this.textInputsFormat,t={};if(["name","hex"].includes(s))t.hex=this.color.toString("hex");else{const o=this.color.toString(s).split("(")[1].slice(0,-1).split(", ");s.split("").forEach((r,i)=>t[r]=o[i])}if(this.disableAlpha||(t.a=Number(this.color.getAlpha().toFixed(2))),t.hasOwnProperty("h")&&(t.h=Math.round(this.h),t.hasOwnProperty("l"))){let o=this.s;const r=this.v||.001,i=(2-o)*r/2;i<.5&&(o*=r/(i*2),t.s=Math.round(o*100)+"%")}return t}},methods:{saturationPickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.saturationPickEnd),document.addEventListener("pointermove",this.saturationPickMove),this.saturationPickMove(s),this.emitHook("saturationInputStart",{s:this.s,v:this.v}),this.colorSnapshot=this.color.toRgbString()},saturationPickEnd(s){document.removeEventListener("pointerup",this.saturationPickEnd),document.removeEventListener("pointermove",this.saturationPickMove),this.emitHook("saturationInputEnd",{s:this.s,v:this.v}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},saturationPickMove(s){s.clientX>=this.saturationCanvasRect.x&&s.clientX<=this.saturationCanvasRect.right?this.s=(s.clientX-this.saturationCanvasRect.x)/this.saturationCanvasRect.width:s.clientX<this.saturationCanvasRect.x?this.s=0:this.s=1,s.clientY>=this.saturationCanvasRect.y&&s.clientY<=this.saturationCanvasRect.bottom?this.v=1-(s.clientY-this.saturationCanvasRect.y)/this.saturationCanvasRect.height:s.clientY<this.saturationCanvasRect.y?this.v=1:this.v=0},huePickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.huePickEnd),document.addEventListener("pointermove",this.huePickMove),this.huePickMove(s),this.emitHook("hueInputStart",{h:this.h}),this.colorSnapshot=this.color.toRgbString()},huePickEnd(s){document.removeEventListener("pointerup",this.huePickEnd),document.removeEventListener("pointermove",this.huePickMove),this.emitHook("hueInputEnd",{h:this.h}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},huePickMove(s){s.clientX>=this.hueCanvasRect.x&&s.clientX<=this.hueCanvasRect.right?this.h=(s.clientX-this.hueCanvasRect.x)*360/this.hueCanvasRect.width:s.clientX<this.hueCanvasRect.x?this.h=0:this.h=360},alphaPickStart(s){this.getCanvasRects(),document.addEventListener("pointerup",this.alphaPickEnd),document.addEventListener("pointermove",this.alphaPickMove),this.alphaPickMove(s),this.emitHook("alphaInputStart",{a:this.a}),this.colorSnapshot=this.color.toRgbString()},alphaPickEnd(s){document.removeEventListener("pointerup",this.alphaPickEnd),document.removeEventListener("pointermove",this.alphaPickMove),this.emitHook("alphaInputEnd",{a:this.a}),this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a})},alphaPickMove(s){s.clientX>=this.alphaCanvasRect.x&&s.clientX<=this.alphaCanvasRect.right?this.a=(s.clientX-this.alphaCanvasRect.x)/this.alphaCanvasRect.width:s.clientX<this.alphaCanvasRect.x?this.a=0:this.a=1},emitUpdate(s){s=s||{h:this.h,s:this.s,v:this.v,a:this.a},this.$emit("updateColor",s)},emitHook(s,t){if(typeof t=="object")for(let[o,r]of Object.entries(t))t[o]=Number(r.toFixed(3));else t=Number(t.toFixed(3));this.$emit(s,t)},textInputInputHandler(s){const t=s.target.dataset.component;this.textInputsFreeze[t]=s.target.value;let o={...this.textInputsFreeze};if(o.hasOwnProperty("hex")){const n=o.a;o=this.tinycolor(o.hex),o.getFormat()!=="hex8"&&o.setAlpha(n)}else o=this.tinycolor(o);const r=o.toHsv();if(this.textInputsFormat==="hsl"&&(r.h===0&&(r.h=parseInt(this.textInputsFreeze.h)),r.v===0)){let n=this.textInputsFreeze.s;const m=n.indexOf("%")!==-1;n=parseFloat(n),!n||n<0?n=0:(m||n>1)&&(n=Math.min(n*.01,1));const u=.001,_=n*u+u;n=2-2*u/_,r.s=n}const i={h:.5,s:.001,v:.001};t!=="a"?(Object.keys(r).filter(n=>n!=="a").forEach(n=>{const m=this[n],u=r[n];Math.abs(m-u)>i[n]&&(this[n]=u)}),o.getFormat()==="hex8"&&o.getOriginalInput().length>7&&(this.disableAlpha?Object.assign(this.$data,{h:0,s:0,v:0}):(this.a=r.a,this.textInputsFreeze.a=Number(this.a.toFixed(2))))):this.a=r.a},textInputFocusHandler(s){this.textInputActive||(this.textInputsFreeze={...this.textInputs},this.colorSnapshot=this.color.toRgbString()),this.textInputActive=s.target.dataset.component},textInputBlurHandler(s){setTimeout(()=>{this.textInputActive===s.target.dataset.component&&(this.colorSnapshot!==this.color.toRgbString()&&this.emitHook("change",{h:this.h,s:this.s,v:this.v,a:this.a}),this.textInputsFreeze={},this.textInputActive=null)},0)},textInputFormatChange(s){const t=["rgb","name","hsl"];this.textInputsFormat;let o=t.indexOf(this.textInputsFormat)+s;o<0?o=t.length-1:o===t.length&&(o=0),this.textInputsFormat=t[o]},getCanvasRects(){this.saturationCanvasRect=this.$refs.saturationCanvas.getBoundingClientRect(),this.hueCanvasRect=this.$refs.hueCanvas.getBoundingClientRect(),this.alphaCanvasRect=this.disableAlpha?{}:this.$refs.alphaCanvas.getBoundingClientRect()},init(){const s=this.$refs.pickerRoot,t=window.getComputedStyle(s);Object.assign(this.$data,this.color.toHsv()),window.requestAnimationFrame(()=>{const{width:r,height:i}=s.getBoundingClientRect();this.pickerHeight=i,this.pickerWidth=r,this.getCanvasRects(),this.hueTranslateX=this.h*this.hueCanvasRect.width/360,this.alphaTranslateX=this.a*this.alphaCanvasRect.width,this.saturationTranslateX=this.s*this.saturationCanvasRect.width,this.saturationTranslateY=-this.v*this.saturationCanvasRect.height,this.sliderPointerWidth=this.$refs.huePointer.offsetWidth,this.saturationPointerWidth=this.$refs.saturationPointer.offsetWidth,this.saturationPointerHeight=this.$refs.saturationPointer.offsetHeight,window.requestAnimationFrame(()=>{this.$emit("ready")})});const o=t.getPropertyValue("background-color");this.tinycolor(o).isDark()&&(this.arrowColor="#fbfbfb")},fillCanvas(){let s=this.$refs.hueCanvas,t=s.getContext("2d"),o=t.createLinearGradient(s.width,0,0,0);o.addColorStop(0,"hsl(0,100%,50%)"),o.addColorStop(.17,"hsl(298.8, 100%, 50%)"),o.addColorStop(.33,"hsl(241.2, 100%, 50%)"),o.addColorStop(.5,"hsl(180, 100%, 50%)"),o.addColorStop(.67,"hsl(118.8, 100%, 50%)"),o.addColorStop(.83,"hsl(61.2,100%,50%)"),o.addColorStop(1,"hsl(360,100%,50%)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height),s=this.$refs.saturationCanvas,t=s.getContext("2d"),o=t.createLinearGradient(0,0,s.width,0),o.addColorStop(0,"rgba(250,250,250,1)"),o.addColorStop(1,"rgba(250,250,250,0)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height),o=t.createLinearGradient(0,s.height,0,0),o.addColorStop(0,"rgba(0,0,0,1)"),o.addColorStop(1,"rgba(0,0,0,0)"),t.fillStyle=o,t.fillRect(0,0,s.width,s.height)}},watch:{h(s,t){this.hueTranslateX=this.h*this.hueCanvasRect.width/360,t!==void 0&&(this.emitUpdate(),this.emitHook("hueInput",{h:this.h}))},s(s,t){this.saturationTranslateX=this.s*this.saturationCanvasRect.width,t!==void 0&&(this.emitUpdate(),this.emitHook("saturationInput",{s:this.s,v:this.v}))},v(s,t){this.saturationTranslateY=-this.v*this.saturationCanvasRect.height,t!==void 0&&(this.emitUpdate(),this.emitHook("saturationInput",{s:this.s,v:this.v}))},a(s,t){this.alphaTranslateX=this.a*this.alphaCanvasRect.width,t!==void 0&&(this.emitUpdate(),this.emitHook("alphaInput",{a:this.a}))}},mounted(){this.getCanvasRects(),this.fillCanvas()},beforeUnmount(){}};const Br={class:"slider-canvas",ref:"saturationCanvas"},zr={class:"slider-container"},Gr={class:"slider-canvas",ref:"hueCanvas"},Jr={class:"slider-active-area"},Zr={class:"slider-container transparency-pattern"},Qr={class:"slider-active-area"},Kr={class:"text-inputs-wrapper"},$r=["for"],tc=["value","id","data-component"];function ec(s,t,o,r,i,n){return c(),d("div",{ref:"pickerRoot",style:C([n.pickerPosition])},[e("div",{class:"saturation-area",style:C(n.pureHueBackground),onPointerdown:t[0]||(t[0]=(...m)=>n.saturationPickStart&&n.saturationPickStart(...m))},[e("canvas",Br,null,512),e("div",{class:"saturation-pointer",ref:"saturationPointer",style:C([n.saturationPointerStyles,{background:n.hexString}])},null,4)],36),e("div",{class:"slider",onPointerdown:t[1]||(t[1]=(...m)=>n.huePickStart&&n.huePickStart(...m))},[e("div",zr,[e("canvas",Gr,null,512)]),e("div",Jr,[e("div",{class:"slider-pointer",ref:"huePointer",style:C([n.huePointerStyles,n.pureHueBackground])},null,4)])],32),o.disableAlpha?b("",!0):(c(),d("div",{key:0,class:"slider",onPointerdown:t[2]||(t[2]=(...m)=>n.alphaPickStart&&n.alphaPickStart(...m))},[e("div",Zr,[e("div",{class:"slider-canvas",ref:"alphaCanvas",style:C(n.alphaCanvasStyles)},null,4)]),e("div",Qr,[e("div",{class:"slider-pointer",ref:"alphaPointer",style:C(n.alphaPointerStyles)},[e("div",{class:"pointer-transparent",style:C(n.alphaPointerTransparentStyles)},[e("div",{class:"pointer-color",style:C([n.alphaPointerColorStyles,{background:n.hexString}])},null,4)],4)],4)])],32)),o.disableTextInputs?b("",!0):(c(),d("div",{key:1,class:"text-inputs-area",style:C({"--outline-color":n.hexString})},[e("div",Kr,[(c(!0),d(T,null,S(i.textInputActive?i.textInputsFreeze:n.textInputs,(m,u)=>(c(),d("div",{key:"text-input-"+u,class:"text-input-container"},[e("label",{for:"text-input-"+u},l(u),9,$r),e("input",{value:m,class:"text-input",autocomplete:"off",spellcheck:"false",id:"text-input-"+u,"data-component":u,onInput:t[3]||(t[3]=k((..._)=>n.textInputInputHandler&&n.textInputInputHandler(..._),["prevent"])),onFocus:t[4]||(t[4]=(..._)=>n.textInputFocusHandler&&n.textInputFocusHandler(..._)),onBlur:t[5]||(t[5]=(..._)=>n.textInputBlurHandler&&n.textInputBlurHandler(..._)),onKeypress:t[6]||(t[6]=nt(_=>_.target.blur(),["enter"]))},null,40,tc)]))),128))]),e("div",{class:"text-format-arrows",style:C(n.arrowsStyles)},[e("div",{class:"arrow up",onClick:t[7]||(t[7]=m=>n.textInputFormatChange(-1))}),e("div",{class:"arrow down",onClick:t[8]||(t[8]=m=>n.textInputFormatChange(1))})],4)],4))],4)}function Q(s,t){t===void 0&&(t={});var o=t.insertAt;if(!(!s||typeof document=="undefined")){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",o==="top"&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var sc=`.color-input .pointer-transparent, .color-input .pointer-color, .color-input .slider-canvas, .color-input .slider-container {
    22  width: 100%;
    33  height: 100%;
     
    111111.color-input .text-format-arrows .arrow:hover {
    112112  opacity: 0.8;
    113 }`;Q(Xr);Z.render=Wr;var Br="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iMCIgeD0iMCIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iNSIgeD0iNSIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+Cjwvc3ZnPg==";const zr=(s,t)=>{for(;!/^(body|html)$/i.test(s.tagName);){if(s===t)return!0;s=s.parentNode}return!1};var K=tt({name:"ColorInput",props:{modelValue:[String,Object],position:{type:String,default:"bottom"},transition:{type:String,default:"picker-popup"},disableAlpha:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},disableTextInputs:{type:Boolean,default:!1},format:String},emits:["mounted","beforeUnmount","update:modelValue","pickStart","pickEnd","hueInputStart","hueInputEnd","hueInput","alphaInputStart","alphaInputEnd","alphaInput","saturationInputStart","saturationInputEnd","saturationInput","change"],components:{ColorPicker:Z},provide:{tinycolor:h},data(){return{color:null,active:!1,ready:!1,hidePicker:!1,boxRect:{},innerBoxRect:{},textInputsFormat:"rgb",originalFormat:"rgb",originalType:null}},computed:{boxColorStyles(){return{background:this.color.toRgbString()}},processedPosition(){const s=["top","right","bottom","left","center"],t={top:"bottom",right:"left",bottom:"top",left:"right"},o=s.slice(0,4).flatMap((i,n)=>s.map(m=>t[i]===m?!1:i===m?i:i+" "+m)).filter(i=>i);let r=this.position.toLowerCase();return o.includes(r)||(r&&console.warn("[vue-color-input]: invalid position -> "+r),r="bottom center"),r=r.split(" "),r[1]=r[1]||"center",r},processedFormat(){let s=["rgb","hsv","hsl"];s=s.concat(s.flatMap(i=>[i+" object","object "+i,i+" string","string "+i])),s=s.concat(["name","hex","hex8"].flatMap(i=>[i,i+" string","string "+i]));let t=this.format,o=!1;t?(t=t.toLowerCase(),s.includes(t)?o=!0:(console.warn("[vue-color-input]: invalid format -> "+t),t=this.originalFormat)):t=this.originalFormat,t=t.split(" ");let r=t.findIndex(i=>["string","object"].includes(i));return r<0?r=["rgb","hsv","hsl"].includes(t[0])?this.originalType:"string":r=t.splice(r,1)[0],t=t[0],{type:r,format:t,force:o}},processedDisableAlpha(){const s=this.processedFormat;return s.force&&["hex","name"].includes(s.format)?!0:this.disableAlpha}},methods:{pickStart(s){this.active||this.disabled||(this.getBoxRect(),this.active=!0,this.ready=!1,this.hidePicker=!0,this.$refs.picker.init(),document.body.addEventListener("pointerdown",this.pickEnd),this.$emit("pickStart"))},pickEnd(s){!this.active||s&&zr(s.target,this.$refs.picker.$refs.pickerRoot)||(document.body.removeEventListener("pointerdown",this.pickEnd),this.active=!1,this.$emit("pickEnd"))},init(){this.color=h(this.modelValue);let s=this.color.getFormat();this.originalFormat=s||"rgb";let t=typeof this.modelValue;this.originalType=["string","object"].includes(t)?t:"string",this.processedFormat,this.output=null,this.color.isValid()||console.warn("[vue-color-input]: invalid color -> "+this.color.getOriginalInput())},emitUpdate(s){s&&(this.color=h(s));let t=this.processedFormat.format;this.color.getAlpha()<1&&["hex","name"].includes(t)&&(this.processedFormat.force?this.color.setAlpha(1):t="rgb"),this.processedFormat.type==="object"?this.output=this.color["to"+t.charAt(0).toUpperCase()+t.slice(1)]():this.output=this.color.toString(t),this.$emit("update:modelValue",this.output)},getBoxRect(){this.boxRect=this.$refs.root.getBoundingClientRect()}},created(){this.init(),this.cssVars={"--transparent-pattern":"url("+Br+")"}},mounted(){this.$emit("mounted")},beforeUnmount(){this.pickEnd(),this.$emit("beforeUnmount")},watch:{modelValue(){let s=typeof this.modelValue=="object"?JSON.stringify(this.modelValue):this.modelValue,t=typeof this.output=="object"?JSON.stringify(this.output):this.output;s!==t&&(this.init(),this.active&&this.$nextTick(function(){this.$refs.picker.init()}))},disabled(){this.pickEnd()},processedDisableAlpha(s){s&&(this.color.setAlpha(1),this.emitUpdate()),this.active&&this.$nextTick(function(){this.$refs.picker.init()})},format(){this.emitUpdate()}}});const Gr={class:"inner transparent"};function Jr(s,t,o,r,i,n){const m=I("color-picker");return c(),d("div",{class:"color-input user",ref:"root",style:C(s.cssVars)},[e("div",{class:y(["box",{active:s.active,disabled:s.disabled}]),onClick:t[0]||(t[0]=k((...u)=>s.pickStart&&s.pickStart(...u),["stop"])),ref:"box"},[e("div",Gr,[e("div",{class:"color",style:C(s.boxColorStyles)},null,4)])],2),x(et,{name:s.transition},{default:z(()=>[p(x(m,{class:"picker-popup",color:this.color,position:s.processedPosition,"disable-alpha":s.processedDisableAlpha,boxRect:s.boxRect,"disable-text-inputs":s.disableTextInputs,style:C({visibility:s.hidePicker?"hidden":""}),onReady:t[1]||(t[1]=u=>s.hidePicker=!1),onUpdateColor:s.emitUpdate,onHueInputStart:t[2]||(t[2]=u=>s.$emit("hueInputStart",u)),onHueInputEnd:t[3]||(t[3]=u=>s.$emit("hueInputEnd",u)),onHueInput:t[4]||(t[4]=u=>s.$emit("hueInput",u)),onAlphaInputStart:t[5]||(t[5]=u=>s.$emit("alphaInputStart",u)),onAlphaInputEnd:t[6]||(t[6]=u=>s.$emit("alphaInputEnd",u)),onAlphaInput:t[7]||(t[7]=u=>s.$emit("alphaInput",u)),onSaturationInputStart:t[8]||(t[8]=u=>s.$emit("saturationInputStart",u)),onSaturationInputEnd:t[9]||(t[9]=u=>s.$emit("saturationInputEnd",u)),onSaturationInput:t[10]||(t[10]=u=>s.$emit("saturationInput",u)),onChange:t[11]||(t[11]=u=>s.$emit("change",u)),ref:"picker"},null,8,["color","position","disable-alpha","boxRect","disable-text-inputs","style","onUpdateColor"]),[[st,s.active]])]),_:1},8,["name"])],4)}var Zr=`.color-input .box .color, .color-input .box .transparent {
     113}`;Q(sc);Z.render=ec;var nc="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iMCIgeD0iMCIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iNSIgeD0iNSIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+Cjwvc3ZnPg==";const ic=(s,t)=>{for(;!/^(body|html)$/i.test(s.tagName);){if(s===t)return!0;s=s.parentNode}return!1};var K=tt({name:"ColorInput",props:{modelValue:[String,Object],position:{type:String,default:"bottom"},transition:{type:String,default:"picker-popup"},disableAlpha:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},disableTextInputs:{type:Boolean,default:!1},format:String},emits:["mounted","beforeUnmount","update:modelValue","pickStart","pickEnd","hueInputStart","hueInputEnd","hueInput","alphaInputStart","alphaInputEnd","alphaInput","saturationInputStart","saturationInputEnd","saturationInput","change"],components:{ColorPicker:Z},provide:{tinycolor:h},data(){return{color:null,active:!1,ready:!1,hidePicker:!1,boxRect:{},innerBoxRect:{},textInputsFormat:"rgb",originalFormat:"rgb",originalType:null}},computed:{boxColorStyles(){return{background:this.color.toRgbString()}},processedPosition(){const s=["top","right","bottom","left","center"],t={top:"bottom",right:"left",bottom:"top",left:"right"},o=s.slice(0,4).flatMap((i,n)=>s.map(m=>t[i]===m?!1:i===m?i:i+" "+m)).filter(i=>i);let r=this.position.toLowerCase();return o.includes(r)||(r&&console.warn("[vue-color-input]: invalid position -> "+r),r="bottom center"),r=r.split(" "),r[1]=r[1]||"center",r},processedFormat(){let s=["rgb","hsv","hsl"];s=s.concat(s.flatMap(i=>[i+" object","object "+i,i+" string","string "+i])),s=s.concat(["name","hex","hex8"].flatMap(i=>[i,i+" string","string "+i]));let t=this.format,o=!1;t?(t=t.toLowerCase(),s.includes(t)?o=!0:(console.warn("[vue-color-input]: invalid format -> "+t),t=this.originalFormat)):t=this.originalFormat,t=t.split(" ");let r=t.findIndex(i=>["string","object"].includes(i));return r<0?r=["rgb","hsv","hsl"].includes(t[0])?this.originalType:"string":r=t.splice(r,1)[0],t=t[0],{type:r,format:t,force:o}},processedDisableAlpha(){const s=this.processedFormat;return s.force&&["hex","name"].includes(s.format)?!0:this.disableAlpha}},methods:{pickStart(s){this.active||this.disabled||(this.getBoxRect(),this.active=!0,this.ready=!1,this.hidePicker=!0,this.$refs.picker.init(),document.body.addEventListener("pointerdown",this.pickEnd),this.$emit("pickStart"))},pickEnd(s){!this.active||s&&ic(s.target,this.$refs.picker.$refs.pickerRoot)||(document.body.removeEventListener("pointerdown",this.pickEnd),this.active=!1,this.$emit("pickEnd"))},init(){this.color=h(this.modelValue);let s=this.color.getFormat();this.originalFormat=s||"rgb";let t=typeof this.modelValue;this.originalType=["string","object"].includes(t)?t:"string",this.processedFormat,this.output=null,this.color.isValid()||console.warn("[vue-color-input]: invalid color -> "+this.color.getOriginalInput())},emitUpdate(s){s&&(this.color=h(s));let t=this.processedFormat.format;this.color.getAlpha()<1&&["hex","name"].includes(t)&&(this.processedFormat.force?this.color.setAlpha(1):t="rgb"),this.processedFormat.type==="object"?this.output=this.color["to"+t.charAt(0).toUpperCase()+t.slice(1)]():this.output=this.color.toString(t),this.$emit("update:modelValue",this.output)},getBoxRect(){this.boxRect=this.$refs.root.getBoundingClientRect()}},created(){this.init(),this.cssVars={"--transparent-pattern":"url("+nc+")"}},mounted(){this.$emit("mounted")},beforeUnmount(){this.pickEnd(),this.$emit("beforeUnmount")},watch:{modelValue(){let s=typeof this.modelValue=="object"?JSON.stringify(this.modelValue):this.modelValue,t=typeof this.output=="object"?JSON.stringify(this.output):this.output;s!==t&&(this.init(),this.active&&this.$nextTick(function(){this.$refs.picker.init()}))},disabled(){this.pickEnd()},processedDisableAlpha(s){s&&(this.color.setAlpha(1),this.emitUpdate()),this.active&&this.$nextTick(function(){this.$refs.picker.init()})},format(){this.emitUpdate()}}});const oc={class:"inner transparent"};function ac(s,t,o,r,i,n){const m=I("color-picker");return c(),d("div",{class:"color-input user",ref:"root",style:C(s.cssVars)},[e("div",{class:v(["box",{active:s.active,disabled:s.disabled}]),onClick:t[0]||(t[0]=k((...u)=>s.pickStart&&s.pickStart(...u),["stop"])),ref:"box"},[e("div",oc,[e("div",{class:"color",style:C(s.boxColorStyles)},null,4)])],2),x(et,{name:s.transition},{default:z(()=>[p(x(m,{class:"picker-popup",color:this.color,position:s.processedPosition,"disable-alpha":s.processedDisableAlpha,boxRect:s.boxRect,"disable-text-inputs":s.disableTextInputs,style:C({visibility:s.hidePicker?"hidden":""}),onReady:t[1]||(t[1]=u=>s.hidePicker=!1),onUpdateColor:s.emitUpdate,onHueInputStart:t[2]||(t[2]=u=>s.$emit("hueInputStart",u)),onHueInputEnd:t[3]||(t[3]=u=>s.$emit("hueInputEnd",u)),onHueInput:t[4]||(t[4]=u=>s.$emit("hueInput",u)),onAlphaInputStart:t[5]||(t[5]=u=>s.$emit("alphaInputStart",u)),onAlphaInputEnd:t[6]||(t[6]=u=>s.$emit("alphaInputEnd",u)),onAlphaInput:t[7]||(t[7]=u=>s.$emit("alphaInput",u)),onSaturationInputStart:t[8]||(t[8]=u=>s.$emit("saturationInputStart",u)),onSaturationInputEnd:t[9]||(t[9]=u=>s.$emit("saturationInputEnd",u)),onSaturationInput:t[10]||(t[10]=u=>s.$emit("saturationInput",u)),onChange:t[11]||(t[11]=u=>s.$emit("change",u)),ref:"picker"},null,8,["color","position","disable-alpha","boxRect","disable-text-inputs","style","onUpdateColor"]),[[st,s.active]])]),_:1},8,["name"])],4)}var lc=`.color-input .box .color, .color-input .box .transparent {
    114114  width: 100%;
    115115  height: 100%;
     
    168168.color-input .picker-popup-leave-active {
    169169  transition: transform 0.3s, opacity 0.3s;
    170 }`;Q(Zr);K.render=Jr;var Qr=(()=>{const s=K;return s.install=t=>{t.component("ColorInput",s)},s})();const Kr=U;(function(s,t){const o=U,r=s();for(;[];)try{if(-parseInt(o(208))/1+-parseInt(o(210))/2+-parseInt(o(209))/3+-parseInt(o(204))/4*(-parseInt(o(213))/5)+-parseInt(o(211))/6+parseInt(o(203))/7*(parseInt(o(207))/8)+parseInt(o(212))/9*(parseInt(o(205))/10)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(D,644507);const B=it({render:()=>ot(dr)});function U(s,t){const o=D();return U=function(r,i){return r=r-203,o[r]},U(s,t)}function D(){const s=["2266107rRgBLR","543830IrpAHY","7079928BhzLfu","14300946vbHAWS","10MBQDdS","21QDSxPa","1435484wHjNmO","10XBjOil","use","2215208WImkZy","285660sbJcrM"];return D=function(){return s},D()}B[Kr(206)](Qr),B.mount("#my-easy-compta-settings-app");
     170}`;Q(lc);K.render=ac;var rc=(()=>{const s=K;return s.install=t=>{t.component("ColorInput",s)},s})();const cc=U;(function(s,t){const o=U,r=s();for(;[];)try{if(-parseInt(o(377))/1*(parseInt(o(371))/2)+parseInt(o(379))/3+parseInt(o(375))/4*(parseInt(o(369))/5)+parseInt(o(370))/6*(parseInt(o(376))/7)+-parseInt(o(373))/8*(parseInt(o(381))/9)+parseInt(o(374))/10*(parseInt(o(378))/11)+parseInt(o(372))/12===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(D,930936);const B=it({render:()=>ot(wr)});B[cc(380)](rc),B.mount("#my-easy-compta-settings-app");function U(s,t){const o=D();return U=function(r,i){return r=r-369,o[r]},U(s,t)}function D(){const s=["13816168eTGMoZ","60HQdbqr","16sjkZgV","28REcYob","778667MLyPJN","2813635EiAdLU","1960359YDyoOn","use","9tsBtxa","2206745dPlkVn","171372jZtPQX","4tSoKJJ","1769808AxJICy"];return D=function(){return s},D()}
  • my-easy-compta/trunk/includes/Migrations/SQL/quotes-items.php

    r3142459 r3167980  
    1515    item_category int(11) NOT NULL,
    1616    item_description longtext NOT NULL,
    17     quantity int(11) NOT NULL,
     17    quantity varchar(255) NOT NULL,
    1818    vat_rate int(11) NOT NULL,
    1919    unit_price decimal(10,2) NOT NULL,
  • my-easy-compta/trunk/includes/Modules/Invoices.php

    r3166746 r3167980  
    186186        $invoice_details['client_id'] = $invoice_details['client_id'];
    187187        $invoice_details['exchange_rate'] = number_format($encrypt->decrypt($invoice_details['exchange_rate']), 2, '.', ' ');
     188        $invoice_details['total_amount'] = $encrypt->decrypt($invoice_details['total_amount']);
    188189        $invoice_details['status'] = $encrypt->decrypt($invoice_details['status']);
    189190        if (isset($invoice_details['advance_amount'])) {
     
    494495            $item['item_ref'] = $encrypt->decrypt($item['item_ref']);
    495496            $item['item_description'] = $encrypt->decrypt($item['item_description']);
    496             $item['quantity'] = (int) $encrypt->decrypt($item['quantity']);
     497            $item['quantity'] = $encrypt->decrypt($item['quantity']);
    497498            $item['vat_rate'] = (int) $encrypt->decrypt($item['vat_rate']);
    498499            $item['unit_price'] = number_format((float) $encrypt->decrypt($item['unit_price']), 2, '.', '');
     
    527528        $item_details['item_ref'] = $encrypt->decrypt($item_details['item_ref']);
    528529        $item_details['item_description'] = $encrypt->decrypt($item_details['item_description']);
    529         $item_details['quantity'] = (int) $encrypt->decrypt($item_details['quantity']);
     530        $item_details['quantity'] = $encrypt->decrypt($item_details['quantity']);
    530531        $item_details['vat_rate'] = (int) $encrypt->decrypt($item_details['vat_rate']);
    531532        $item_details['unit_price'] = number_format((float) $encrypt->decrypt($item_details['unit_price']), 2, '.', '');
     
    553554        $item_ref = sanitize_text_field($request['item_ref']);
    554555        $item_description = wp_kses_post($request['item_description']);
    555         $quantity = absint($request['quantity']);
     556        $quantity = sanitize_text_field($request['quantity']);
    556557        $vat_rate = absint($request['vat_rate']);
    557558        $unit_price = floatval($request['unit_price']);
  • my-easy-compta/trunk/includes/Modules/Quotes.php

    r3144896 r3167980  
    283283            'item_category' => sanitize_text_field($params['item_category']),
    284284            'item_description' => sanitize_textarea_field($params['item_description'] ?? ''),
    285             'quantity' => intval($params['quantity']),
     285            'quantity' => sanitize_text_field($params['quantity']),
    286286            'vat_rate' => intval($params['vat_rate']),
    287287            'unit_price' => floatval($params['unit_price']),
     
    551551        $item_ref = sanitize_text_field($request['item_ref']);
    552552        $item_description = wp_kses_post($request['item_description']);
    553         $quantity = absint($request['quantity']);
     553        $quantity = sanitize_text_field($request['quantity']);
    554554        $vat_rate = absint($request['vat_rate']);
    555555        $unit_price = floatval($request['unit_price']);
  • my-easy-compta/trunk/includes/Modules/Settings.php

    r3142459 r3167980  
    154154        });
    155155        $this->routes->add_route('/license/check-license', 'GET', $this, 'check_license', function () {
     156            return current_user_can('manage_options');
     157        });
     158        $this->routes->add_route('/license/refresh-license', 'GET', $this, 'refresh_license', function () {
    156159            return current_user_can('manage_options');
    157160        });
     
    977980    public function check_license(\WP_REST_Request $request)
    978981    {
     982
    979983        $nonce = sanitize_text_field(wp_unslash($request->get_header('X-WP-Nonce')));
    980984        if (!wp_verify_nonce($nonce, 'wp_rest')) {
     
    10131017
    10141018        // Construct the response
     1019        $response_data = [
     1020            'success' => true,
     1021            'valid' => true,
     1022            'license_key' => $license_key,
     1023            'license_data' => $license_data,
     1024            'installed_versions' => $installed_versions,
     1025        ];
     1026
     1027        return new \WP_REST_Response($response_data, 200);
     1028    }
     1029    public function refresh_license(\WP_REST_Request $request)
     1030    {
     1031        $nonce = sanitize_text_field(wp_unslash($request->get_header('X-WP-Nonce')));
     1032        if (!wp_verify_nonce($nonce, 'wp_rest')) {
     1033            return new \WP_Error('invalid_nonce', 'Nonce verification failed.', array('status' => 403));
     1034        }
     1035
     1036        $encrypted_license_key = get_option('ecwp_client_license_key');
     1037        if (empty($encrypted_license_key)) {
     1038            return new \WP_REST_Response(['success' => false, 'message' => 'License key not found.'], 404);
     1039        }
     1040
     1041        $license_key = openssl_decrypt($encrypted_license_key, 'AES-128-ECB', ECWP_SECRET_KEY);
     1042
     1043        $license_data = $this->get_validate_license($license_key);
     1044
     1045        if (!$license_data || !$license_data['valid']) {
     1046            return new \WP_REST_Response(['success' => false, 'message' => 'License validation failed.'], 500);
     1047        }
     1048
     1049        update_option('ecwp_client_license_data', $license_data);
     1050
     1051        $installed_plugins = get_plugins();
     1052        $installed_versions = array();
     1053
     1054        foreach ($installed_plugins as $plugin_path => $plugin_data) {
     1055            $plugin_slug = dirname(plugin_basename($plugin_path));
     1056            $installed_versions[$plugin_slug] = $plugin_data['Version'];
     1057        }
     1058
    10151059        $response_data = [
    10161060            'success' => true,
  • my-easy-compta/trunk/languages/my-easy-compta-fr_FR.l10n.php

    r3166746 r3167980  
    11<?php
    2 return ['project-id-version'=>'myEasyCompta','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-05-28 11:22+0000','po-revision-date'=>'2024-10-10 17:13+0000','last-translator'=>'','language-team'=>'Français','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','language'=>'fr_FR','plural-forms'=>'nplurals=2; plural=n > 1;','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.1','messages'=>['Account'=>'Mon compte','Account settings'=>'Paramètres des utilisateurs','Actions'=>'Actions','Activate email logs'=>'Activer les logs des emails','Activate Logo mentions'=>'Activer la mention du logo','Activate Vat'=>'Activer la TVA','Activation date'=>'Date d\'activation','Add'=>'Ajouter','Add category'=>'Ajouter une catégorie','Add currency'=>'Ajouter une devise','Add method'=>'Ajouter une méthode','Add VAT'=>'Ajouter la TVA','Addon name'=>'Nom de l\'addon','Addons'=>'Addons','Address'=>'Adresse','Advance'=>'Acompte','Advance invoice'=>'Facture d\'acompte','After amount'=>'Après le montant','Agreement & signature'=>'Mention "Bon pour accord" et signature','All Earnings'=>'Tous les revenus','Amount'=>'Montant','Annual Payments Overview'=>'Aperçu des paiements annuels','API access error'=>'Erreur d\'accès à l\'API','Approved'=>'Approuvé','April'=>'Avril','Are you sure?'=>'Êtes-vous sûr ?','Articles settings'=>'Paramètres des articles','Attached file'=>'Fichier joint','Attachment'=>'Pièce jointe','August'=>'Août','Back'=>'Retour','Background'=>'Arrière plan','Backup'=>'Sauvegarder','Backup date'=>'Date de sauvegarde','Backup list'=>'Liste des sauvegardes','Before amount'=>'Avant le montant','BIC'=>'BIC','Bill to'=>'Destinataire','Cancel'=>'Annuler','Canceled'=>'Annulé','Card number'=>'Numéro de la carte','Categories'=>'Catégories','Category'=>'Catégorie','Check update'=>'Vérifier la mise à jour','City'=>'Ville','Clear'=>'Supprimer','Client'=>'Client','Client added successfully'=>'Client ajouté avec succès','Client already exists'=>'Le client existe déjà','Client deleted successfully'=>'Client supprimé avec succès','Client details'=>'Détails du client','Client edited successfully'=>'Client édité avec succès','Client not found.'=>'Client introuvable.','Clients'=>'Clients','Code'=>'Code','Color'=>'Couleur','Coming soon'=>'Bientôt disponible','Company Code'=>'SIRET','Company logo'=>'Logo de l\'entreprise','Company name'=>'Nom de l\'entreprise','Conditions terms'=>'Conditions générales','Confirm new password'=>'Confirmer le nouveau mot de passe','Content'=>'Contenu','Convert to invoice'=>'Convertir en facture','Could not insert invoice into database'=>'Impossible d\'insérer une facture dans la base de données','Could not insert quote into database'=>'Impossible d\'insérer un devis dans la base de données','Country'=>'Pays','Create backup'=>'Créer une sauvegarde','Create secure access for your customers. Allow them to view quotes, invoices, payments, and statistics, and update their information and passwords through a dedicated dashboard.'=>'Créez un accès sécurisé pour vos clients. Permettez-leur de consulter les devis, factures, paiements et statistiques, et de mettre à jour leurs informations et mots de passe via un tableau de bord dédié.','Create user'=>'Créer un utilisateur','Created at'=>'Créé le','Credit'=>'Avoir','Credit color'=>'Couleur de l\'avoir','Credit footer'=>'Pied de page de l\'avoir','Credit invoice created successfully'=>'Facture d\'avoir créée avec succès','Credit invoice removed successfully'=>'Facture d\'avoir supprimée avec succès','Credit not found'=>'Avoir non trouvé','Credit number'=>'Numéro de l\'avoir','Credit prefix'=>'Préfixe de l\'avoir','Credit terms'=>'Conditions de l\'avoir','Credits'=>'Avoirs','Credits settings'=>'Paramètres des avoirs','Currencies'=>'Devises','Currencies & VAT settings'=>'Paramètres Devises et TVA ','Currency'=>'Devise','Currency ID is invalid'=>'L\'ID de la devise n\'est pas valide','Currency position'=>'Position de la devise','Current month'=>'Mois en cours','Dashboard'=>'Tableau de bord','Data settings already exist'=>'Les paramètres des données existent déjà','Data settings created successfully'=>'Paramètres de données créés avec succès','Database error when inserting attachment:'=>'Erreur de base de données lors de l\'insertion d\'une pièce jointe :','Database migration completed successfully.'=>'La migration de la base de données a bien été effectuée.','Date planned'=>'Date prévue','Date sent'=>'Date d\'envoi','December'=>'Décembre','Declaration limit'=>'Plafond de la déclaration','Default currency'=>'Devise par défaut','Default Vat'=>'TVA par défaut','Delete'=>'Supprimer','Deleted successfully'=>'Suppression réussie','Description'=>'Description','Discount'=>'Réduction','Display per page'=>'Affichage par page','Domain'=>'Domaine','Done'=>'Terminé','Download'=>'Télécharger','DRAFT'=>'BROUILLON','Draft'=>'Brouillon','Due date'=>'Date de validité','Duplicate'=>'Dupliquer','Earnings'=>'Revenus','Edit'=>'Editer','Edit client'=>'Éditer le client','Edit expense'=>'Éditer la dépense','Edit invoice'=>'Éditer la facture','Edit item'=>'Modifier l\'article','Edit payment'=>'Éditer le paiement','Edit quote'=>'Éditer le devis','Email'=>'E-mail','Emails Invoices'=>'E-mails des factures','Emails logs'=>'E-mails des logs','Emails Quotes'=>'E-mails des devis','Emails settings'=>'Paramètres des e-mails','Enhance myEasyCompta with email notification functionalities. Customize email templates, send estimates or invoices directly, and log sent emails. Ideal for maintaining smooth email communication with clients.'=>'Améliorez myEasyCompta avec des fonctionnalités de notification par e-mail. Personnalisez les modèles d\'e-mail, envoyez des devis ou des factures directement, et enregistrez les e-mails envoyés. Idéal pour maintenir une communication fluide avec les clients.','Error'=>'Erreur','Error API access'=>'Erreur d\'accès à l\'API','Event category'=>'Catégorie d\'événement','Event end time'=>'Heure de fin de l\'événement','Event start date'=>'Date de début de l\'événement','Event title'=>'Titre de l\'événement','Exchange rate'=>'Taux de change','Expense date'=>'Date de la dépense','Expense deleted successfully'=>'Dépense supprimée avec succès','Expense edited successfully'=>'Dépense éditée avec succès','Expense not found.'=>'Dépense introuvable.','Expenses'=>'Dépenses','Expenses categories'=>'Catégories de dépenses','Expenses settings'=>'Paramètres des dépenses','Expiration date'=>'Date d\'expiration','Expiry date'=>'Date d\'expiration','Export'=>'Exporter','Export to PDF'=>'Exporter en PDF','Export your financial data in various formats such as CSV and Excel. Customize export fields to include customers, quotes, invoices, payments, expenses, and statistics.'=>'Exportez vos données financières dans divers formats tels que CSV et Excel. Personnalisez les champs d\'exportation pour inclure les clients, devis, factures, paiements, dépenses et statistiques.','Failed to add client'=>'Échec de l\'ajout d\'un client','Failed to add invoice item'=>'Échec de l\'ajout d\'un élément de facture','Failed to add payment to database'=>'Échec de l\'ajout d\'un paiement à la base de données','Failed to add quote item'=>'Échec de l\'ajout d\'un élément de devis','Failed to check for updates.'=>'Échec de la vérification des mises à jour.','Failed to create invoice'=>'Échec de la création de la facture','Failed to delete client'=>'Échec de la suppression du client','Failed to delete expense'=>'Échec de la suppression de la dépense','Failed to delete invoice item.'=>'Échec de la suppression de l\'élément de la facture.','Failed to delete payment'=>'Échec de la suppression du paiement','Failed to edit client'=>'Échec de l\'édition du client','Failed to edit expense'=>'Échec de l\'édition de la dépense','Failed to edit Item'=>'Échec de l\'édition de l\'élément','Failed to edit item'=>'Échec de la modification de l\'élément','Failed to edit payment'=>'Échec de l\'édition du paiement','Failed to retrieve exchange rate for client currency'=>'Échec de la récupération du taux de change pour la devise du client','Failed to update invoice'=>'Échec de la mise à jour de la facture','Failed to update invoice status in database'=>'Échec de la mise à jour du statut de la facture dans la base de données','Failed to update quote status'=>'Échec de la mise à jour du statut du devis','Failure to delete invoice and/or associated items'=>'Impossible de supprimer la facture et/ou des éléments associés','Failure to delete Quote and/or associated items'=>'Impossible de supprimer le devis et/ou des éléments associés','Fax'=>'Fax','February'=>'Février','File name'=>'Nom du fichier','File upload failed:'=>'Le téléchargement du fichier a échoué :','Format date'=>'Format de la date','General settings'=>'Paramètres généraux','Generate credit invoice'=>'Générer une facture d\'avoir','Get detailed statistical analysis of your financial data. Generate various reports on income, expenses, and profitability with graphical representations for easier interpretation.'=>'Obtenez une analyse statistique détaillée de vos données financières. Générez divers rapports sur les revenus, les dépenses et la rentabilité avec des représentations graphiques pour une interprétation plus facile.','Go to the dashboard'=>'Accéder au tableau de bord','https://myeasycompta.com'=>'https://myeasycompta.com','IBAN'=>'IBAN','ID'=>'ID','ID Client'=>'ID Client','Import demo data'=>'Importer des données de démonstration','Install configuration settings'=>'Installer les paramètres de configuration','Install database tables'=>'Installation des tables de la base de données','Install settings datas'=>'Installer les données de configuration','Installed'=>'Installé','Integrate a planning module to manage your schedule. Create and assign tasks with specific categories, and track project deadlines and workloads efficiently.'=>'Intégrez un module de planification pour gérer votre emploi du temps. Créez et assignez des tâches avec des catégories spécifiques, et suivez les échéances et les charges de travail des projets efficacement.','Integrate myEasyCompta with WooCommerce to automatically generate invoices for each new order. Sync WooCommerce sales data, manage transactions, track sales, and handle customer invoicing seamlessly.'=>'Intégrez myEasyCompta avec WooCommerce pour générer automatiquement des factures pour chaque nouvelle commande. Synchronisez les données de vente de WooCommerce, gérez les transactions, suivez les ventes et gérez la facturation des clients sans interruption.','Invalid expense ID.'=>'ID de dépense non valide.','Invalid ID provided'=>'L\'identifiant fourni n\'est pas valide','Invalid invoice ID'=>'ID de la facture non valide','Invalid invoice ID.'=>'ID de la facture non valide.','Invalid item ID.'=>'ID de l\'article invalide.','Invalid nonce'=>'Nonce non valide','Invalid order data'=>'Données d\'ordre non valides','Invalid payment ID.'=>'ID de paiement non valide.','Invalid quote ID.'=>'ID de devis non valide.','Invoice'=>'Facture','Invoice added successfully'=>'Facture ajoutée avec succès','Invoice and related items successfully deleted'=>'La facture et ces éléments ont été supprimés avec succès','Invoice color'=>'Couleur de la facture','Invoice footer'=>'Pied de page de la facture','Invoice in'=>'Facture en','Invoice item deleted.'=>'Élément de facture supprimé.','Invoice item successfully added'=>'Élément de facture ajouté avec succès','Invoice items order updated successfully'=>'Mise à jour réussie de l\'ordre des éléments de la facture','Invoice not found'=>'Facture introuvable','Invoice not found.'=>'Facture introuvable.','Invoice number'=>'Numéro de facture','Invoice Overdue'=>'Facture en retard','Invoice prefix'=>'Préfixe de la facture','Invoice reminder'=>'Rappel de facture','Invoice status updated successfully'=>'Le statut de la facture a été mis à jour avec succès','Invoice terms'=>'Conditions de facture','Invoice updated successfully'=>'Paiement mis à jour avec succès','Invoices'=>'Factures','Invoices in draft status cannot be sent.'=>'Les factures en brouillon ne peuvent pas être envoyées.','Invoices settings'=>'Paramètres des factures','Item edited successfully'=>'Article édité avec succès','Item name'=>'Nom de l\'article','January'=>'Janvier','July'=>'Juillet','June'=>'Juin','Last invoices'=>'Dernières factures','Let\'s GO'=>'Allons-y','License Addons'=>'Licence Addons','License data deleted successfully.'=>'Les données de licence ont été supprimées avec succès.','License key'=>'Clé de licence','Live mode'=>'Mode Live','Logo mentions'=>'Mentions du logo','Logout'=>'Déconnexion','Manager name'=>'Contact','March'=>'Mars','Mark as accepted'=>'Marquer comme accepté','Mark as canceled'=>'Marquer comme annulé','Mark as paid'=>'Marquer comme payé','Mark as rejected'=>'Marquer comme rejeté','May'=>'Mai','Mobile'=>'Mobile','Mode'=>'Mode','Monthly Payments'=>'Paiements mensuels','myEasyCompta'=>'myEasyCompta','myEasyCompta - Setup Process'=>'myEasyCompta - Processus d\'installation','myEasyCompta Acompte is a plugin designed to simplify your invoicing process. Once a quote has been validated, Acompte lets you generate down-payment and balance invoices with ease. You can set up down-payment invoices as percentages or fixed amounts, with automatic calculation of remaining amounts.'=>'myEasyCompta Acompte est un plugin conçu pour simplifier votre processus de facturation. Une fois un devis validé, Acompte vous permet de générer des factures d\'acompte et des factures de solde de manière simple. Vous pouvez configurer les factures d\'acompte en pourcentage ou en montant fixe avec un calcul automatique des montants restants.','myEasyCompta Addons'=>'myEasyCompta Addons','myEasyCompta Advance'=>'myEasyCOmpta Acompte','myEasyCompta Backup'=>'myEasyCompta Backup','myEasyCompta Backup plugin provides integrated solutions for securely backing up, restoring, and managing financial data.'=>'Le plugin myEasyCompta Backup offre des solutions intégrées pour sauvegarder, restaurer et gérer les données financières de manière sécurisée.','myEasyCompta Email'=>'myEasyCompta Email','myEasyCompta Export'=>'myEasyCompta Export','myEasyCompta is ready to use.'=>'myEasyCompta est prêt à l\'emploi.','myEasyCompta Payment'=>'myEasyCompta Payment','myEasyCompta Payment allows myEasyCompta users to offer their clients the ability to pay invoices directly through secure and integrated payment options.'=>'myEasyCompta Payment permet aux utilisateurs de myEasyCompta d\'offrir à leurs clients la possibilité de payer leurs factures directement grâce à des options de paiement sécurisées et intégrées.','myEasyCompta Planning'=>'myEasyCompta Planning','myEasyCompta requires a database update.'=>'myEasyCompta nécessite une mise à jour de la base de données.','myEasyCompta Signature'=>'myEasyCompta Signature','myEasyCompta Signature allows myEasyCompta users to easily collect digital signatures on quotes, ensuring secure and efficient document approval.'=>'myEasyCompta Signature permet aux utilisateurs d\'myEasyCompta de collecter facilement des signatures numériques sur les devis, garantissant ainsi une approbation des documents sécurisée et efficace.','myEasyCompta SIRET Search'=>'myEasyCompta SIRET Search','myEasyCompta Stats'=>'myEasyCompta Stats','myEasyCompta User'=>'myEasyCompta User','myEasyCompta Woo'=>'myEasyCompta Woo','Name'=>'Nom','New client'=>'Nouveau client','New invoice'=>'Nouvelle facture','New password'=>'Nouveau mot de passe','New quote'=>'Nouveau devis','No data for the moment'=>'Pas de données pour le moment','No invoice found for the given item.'=>'Aucune facture n\'a été trouvée pour l\'article en question.','No item details found.'=>'Aucun détail de l\'article n\'a été trouvé.','No items found for this invoice.'=>'Aucun article n\'a été trouvé pour cette facture.','No items found for this quote.'=>'Aucun élément n\'a été trouvé pour ce devis.','No quote found for the given item.'=>'Aucun devis n\'a été trouvé pour l\'élément donné.','No update available.'=>'Aucune mise à jour n\'est disponible.','Nonce invalide'=>'Nonce invalide','Nonce verification failed.'=>'La vérification du nonce a échoué.','Not installed'=>'Non installé','Note'=>'Note','November'=>'Novembre','October'=>'Octobre','PAID'=>'PAYÉ','Paid'=>'Payé','Pay'=>'Payer','Pay invoice'=>'Payer la facture','Payed'=>'Payé','Payment conditions'=>'Conditions de règlement','Payment date'=>'Date de paiement','Payment deleted successfully'=>'Paiement supprimé avec succès','Payment edited successfully'=>'Paiement édité avec succès','Payment method'=>'Méthode de paiement','Payment mode'=>'Mode de règlement','Payment not found.'=>'Paiement introuvable.','Payment received'=>'Paiement reçu','Payment successful'=>'Paiement réussi','Payments'=>'Paiements','Payments methods'=>'Méthodes de paiement','Payments settings'=>'Paramètres des paiements','Pending'=>'En attente','Phone'=>'Téléphone','Planning settings'=>'Paramètres du planning','Plugin activation error'=>'Erreur d\'activation du plugin','Plugin deactivation error'=>'Erreur de désactivation du plugin','Postal code'=>'Code postal','Preview PDF'=>'Prévisualiser la facture','Provisional start date'=>'Date de début provisoire','Public key (Live mode)'=>'Public key (Live mode)','Public key (Test mode)'=>'Public key (Test mode)','Qty'=>'Qté','Quantity'=>'Quantité','Quote'=>'Devis','Quote added successfully'=>'Devis ajouté avec succès','Quote and related items successfully deleted'=>'Suppression réussie de devis et ces éléments','Quote color'=>'Couleur de devis','Quote converted to invoice successfully'=>'Devis converti en facture avec succès','Quote expired'=>'Devis expiré','Quote footer'=>'Pied de page de devis','Quote item deleted.'=>'Élément de devis supprimé.','Quote item successfully added'=>'L\'élément de devis a été ajouté avec succès','Quote items order updated successfully'=>'Mise à jour réussie de l\'ordre des éléments de devis','Quote not found'=>'Devisintrouvable','Quote not found.'=>'Le devis n\'a pas été trouvée.','Quote number'=>'Numéro de devis','Quote prefix'=>'Préfixe de devis','Quote status updated successfully'=>'Le statut du devis a été mis à jour avec succès','Quote terms'=>'Conditions du devis','Quotes'=>'Devis','Quotes settings'=>'Paramètres de devis','Rate'=>'Taux','Read more'=>'Lire la suite','Received From'=>'Reçu de','Received from'=>'Reçu de','Recently Paid Invoices'=>'Factures récemment payées','Recipient'=>'Destinataire','Recipient email'=>'E-mail du destinataire','Ref'=>'Réf','Reference No'=>'Réf. n°','Rejected'=>'Rejeté','Remind client'=>'Relancer le client','Resend invoice'=>'Re-envoyer la facture','Restore'=>'Restaurer','RIB'=>'RIB','Save'=>'Sauvegarder','Search'=>'Recherche','Secret key (Live mode)'=>'Secret key (Live mode)','Secret key (Test mode)'=>'Secret key (Test mode)','Security code'=>'Code de sécurité','Select'=>'Sélectionner','Select / Unselect All'=>'Sélectionner / désélectionner tout','Select category'=>'Sélectionner une catégorie','Select client'=>'Sélectionner un client','Send'=>'Envoyer','Send invoice'=>'Envoyer la facture','Send quote'=>'Envoyer le devis','September'=>'Septembre','Settings'=>'Paramètres','Settings saved successfully'=>'Les paramètres ont été sauvegardés avec succès','Setup complete!'=>'Installation terminée !','Shipping fees'=>'Frais d\'expédition','Show Email'=>'Afficher l\'e-mail','Show Phone'=>'Afficher le téléphone','Show SIREN n°'=>'Afficher le n° de SIREN','Show TAX n°'=>'Afficher le n° de TVA','Show Watermark'=>'Afficher le filigrane','Show Watermark only for Paid status'=>'Afficher le filigrane uniquement pour le statut Payé','Sign'=>'Signer','Sign quote'=>'Signer le devis','Signed'=>'Signé','SIREN n°'=>'N° de SIREN','SIRET n°'=>'N° de SIRET','Skip'=>'Pas de besoin','Slug'=>'Slug','Statistics'=>'Statistiques','Stats settings'=>'Paramètres des statistiques','Status'=>'Statut','Step'=>'Étape','Streamline your financial management with myEasyCompta, an all-in-one accounting plugin. Effortlessly handle quotes, invoices, expenses, and more, all within a sleek, user-friendly interface. Perfect for freelancers and small businesses looking to simplify their accounting processes.'=>'Rationalisez votre gestion financière avec myEasyCompta, un plugin de comptabilité tout-en-un. Gérez sans effort les devis, les factures, les dépenses et bien plus encore, le tout dans une interface élégante et conviviale. Parfait pour les freelances et les petites entreprises qui cherchent à simplifier leurs processus comptables.','Stripe settings'=>'Paramètres de Stripe','Sub total'=>'Sous-total','Subject'=>'Sujet','Submit'=>'Soumettre','Subtotal'=>'Sous-total','Success'=>'Succès','Symbol'=>'Symbole','System settings'=>'Paramètres du système','Tables already exist'=>'Les tables existent déjà','Tables created successfully'=>'Tables créées avec succès','Tax'=>'TVA','Tax number'=>'Numéro de TVA','Test mode'=>'Mode Test','Text Color'=>'Couleur du texte','The <strong>myEasyCompta</strong> plugin requires PHP version %s or higher.'=>'Le plugin <strong>myEasyCompta</strong> nécessite la version PHP %s ou supérieure.','The Easy-Compta SIRET plugin adds a field to quickly retrieve customer information using the French government business directory API (https://api.gouv.fr). This enhances the efficiency of managing client data within the Easy-Compta system.'=>'Le plugin Easy-Compta-SIRET ajoute un champ pour récupérer rapidement les informations des clients en utilisant l\'API du répertoire des entreprises du gouvernement français (https://api.gouv.fr). Cela améliore l\'efficacité de la gestion des données clients au sein du système Easy-Compta.','The email address is invalid'=>'L\'adresse e-mail n\'est pas valide','The field %s is required'=>'Le champ %s est obligatoire','There\'s no turning back!'=>'Vous ne pourrez pas revenir en arrière!','This will automatically create a backup and delete all data to restore the backup.'=>'Cela va créer automatiquement une sauvegarde et supprimer toutes les données pour restaurer la sauvegarde.','Token api SIREN v 3.11'=>'Token api SIREN v 3.11','Total'=>'Total','Total amount'=>'Montant total','Total invoices'=>'Total des factures','Total paid invoices'=>'Total des factures payées','Total quotes'=>'Total des devis','TVA limit'=>'Plafond de la TVA','Type'=>'Type','Unauthorized request'=>'Requête non autorisée','Unit price'=>'Prix unitaire','UNPAID'=>'NON PAYÉ','Unpaid'=>'Non payé','Unpaid invoices'=>'Factures impayées','Update'=>'Mise à jour','Update available! New version'=>'Mise à jour disponible ! Nouvelle version','Update Database'=>'Mettre à jour la base de données','Users settings'=>'Paramètres utilisateurs','Validate'=>'Valider','Validate invoice'=>'Valider la facture','Validate quote'=>'Valider le devis','VAT'=>'TVA','Vat'=>'Tva','VAT Rates'=>'Taux de TVA','Version'=>'Version','View'=>'Voir','Website'=>'Site web','Yes, confirm it!'=>'Oui, confirmez !','Yes, delete it!'=>'Oui, supprimez !','You cannot deactivate the myEasyCompta plugin while add-ons are enabled.'=>'Vous ne pouvez pas désactiver le plugin myEasyCompta lorsque les addons sont activés.','You must have at least one article'=>'Vous devez avoir au moins un article','You need to activate the Email addon to benefit from this feature.'=>'Vous devez activer l\'addon Email pour bénéficier de cette fonctionnalité.','You need to activate the Export addon to benefit from this feature.'=>'Vous devez activer l\'addon Export pour bénéficier de cette fonctionnalité.','Your payment is secure, and no card details are stored by our platform. The transaction is protected by Stripe\'s service.'=>'Votre paiement est sécurisé et aucun détail de carte n\'est stocké par notre plateforme. La transaction est protégée par le service Stripe.']];
     2return ['project-id-version'=>'myEasyCompta','report-msgid-bugs-to'=>'','pot-creation-date'=>'2024-05-28 11:22+0000','po-revision-date'=>'2024-10-13 11:04+0000','last-translator'=>'','language-team'=>'Français','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','language'=>'fr_FR','plural-forms'=>'nplurals=2; plural=n > 1;','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.11; wp-6.6.1','messages'=>['Account'=>'Mon compte','Account settings'=>'Paramètres des utilisateurs','Actions'=>'Actions','Activate email logs'=>'Activer les logs des emails','Activate Logo mentions'=>'Activer la mention du logo','Activate Vat'=>'Activer la TVA','Activation date'=>'Date d\'activation','Add'=>'Ajouter','Add category'=>'Ajouter une catégorie','Add currency'=>'Ajouter une devise','Add method'=>'Ajouter une méthode','Add VAT'=>'Ajouter la TVA','Addon name'=>'Nom de l\'addon','Addons'=>'Addons','Address'=>'Adresse','Advance'=>'Acompte','Advance invoice'=>'Facture d\'acompte','After amount'=>'Après le montant','Agreement & signature'=>'Mention "Bon pour accord" et signature','All Earnings'=>'Tous les revenus','Amount'=>'Montant','Annual Payments Overview'=>'Aperçu des paiements annuels','API access error'=>'Erreur d\'accès à l\'API','Approved'=>'Approuvé','April'=>'Avril','Are you sure?'=>'Êtes-vous sûr ?','Articles settings'=>'Paramètres des articles','Attached file'=>'Fichier joint','Attachment'=>'Pièce jointe','August'=>'Août','Back'=>'Retour','Background'=>'Arrière plan','Backup'=>'Sauvegarder','Backup date'=>'Date de sauvegarde','Backup list'=>'Liste des sauvegardes','Before amount'=>'Avant le montant','BIC'=>'BIC','Bill to'=>'Destinataire','Cancel'=>'Annuler','Canceled'=>'Annulé','Card number'=>'Numéro de la carte','Categories'=>'Catégories','Category'=>'Catégorie','Check update'=>'Vérifier la mise à jour','City'=>'Ville','Clear'=>'Supprimer','Client'=>'Client','Client added successfully'=>'Client ajouté avec succès','Client already exists'=>'Le client existe déjà','Client deleted successfully'=>'Client supprimé avec succès','Client details'=>'Détails du client','Client edited successfully'=>'Client édité avec succès','Client not found.'=>'Client introuvable.','Clients'=>'Clients','Code'=>'Code','Color'=>'Couleur','Coming soon'=>'Bientôt disponible','Company Code'=>'SIRET','Company logo'=>'Logo de l\'entreprise','Company name'=>'Nom de l\'entreprise','Conditions terms'=>'Conditions générales','Confirm new password'=>'Confirmer le nouveau mot de passe','Content'=>'Contenu','Convert to invoice'=>'Convertir en facture','Could not insert invoice into database'=>'Impossible d\'insérer une facture dans la base de données','Could not insert quote into database'=>'Impossible d\'insérer un devis dans la base de données','Country'=>'Pays','Create backup'=>'Créer une sauvegarde','Create secure access for your customers. Allow them to view quotes, invoices, payments, and statistics, and update their information and passwords through a dedicated dashboard.'=>'Créez un accès sécurisé pour vos clients. Permettez-leur de consulter les devis, factures, paiements et statistiques, et de mettre à jour leurs informations et mots de passe via un tableau de bord dédié.','Create user'=>'Créer un utilisateur','Created at'=>'Créé le','Credit'=>'Avoir','Credit color'=>'Couleur de l\'avoir','Credit footer'=>'Pied de page de l\'avoir','Credit invoice created successfully'=>'Facture d\'avoir créée avec succès','Credit invoice removed successfully'=>'Facture d\'avoir supprimée avec succès','Credit not found'=>'Avoir non trouvé','Credit number'=>'Numéro de l\'avoir','Credit prefix'=>'Préfixe de l\'avoir','Credit terms'=>'Conditions de l\'avoir','Credits'=>'Avoirs','Credits settings'=>'Paramètres des avoirs','Currencies'=>'Devises','Currencies & VAT settings'=>'Paramètres Devises et TVA ','Currency'=>'Devise','Currency ID is invalid'=>'L\'ID de la devise n\'est pas valide','Currency position'=>'Position de la devise','Current month'=>'Mois en cours','Dashboard'=>'Tableau de bord','Data settings already exist'=>'Les paramètres des données existent déjà','Data settings created successfully'=>'Paramètres de données créés avec succès','Database error when inserting attachment:'=>'Erreur de base de données lors de l\'insertion d\'une pièce jointe :','Database migration completed successfully.'=>'La migration de la base de données a bien été effectuée.','Date planned'=>'Date prévue','Date sent'=>'Date d\'envoi','December'=>'Décembre','Declaration limit'=>'Plafond de la déclaration','Default currency'=>'Devise par défaut','Default Vat'=>'TVA par défaut','Delete'=>'Supprimer','Deleted successfully'=>'Suppression réussie','Description'=>'Description','Discount'=>'Réduction','Display per page'=>'Affichage par page','Domain'=>'Domaine','Done'=>'Terminé','Download'=>'Télécharger','Download QRCode Stripe payment link'=>'Télécharger QRCode Stripe lien de paiement','DRAFT'=>'BROUILLON','Draft'=>'Brouillon','Due date'=>'Date de validité','Duplicate'=>'Dupliquer','Earnings'=>'Revenus','Edit'=>'Editer','Edit client'=>'Éditer le client','Edit expense'=>'Éditer la dépense','Edit invoice'=>'Éditer la facture','Edit item'=>'Modifier l\'article','Edit payment'=>'Éditer le paiement','Edit quote'=>'Éditer le devis','Email'=>'E-mail','Emails Invoices'=>'E-mails des factures','Emails logs'=>'E-mails des logs','Emails Quotes'=>'E-mails des devis','Emails settings'=>'Paramètres des e-mails','Enhance myEasyCompta with email notification functionalities. Customize email templates, send estimates or invoices directly, and log sent emails. Ideal for maintaining smooth email communication with clients.'=>'Améliorez myEasyCompta avec des fonctionnalités de notification par e-mail. Personnalisez les modèles d\'e-mail, envoyez des devis ou des factures directement, et enregistrez les e-mails envoyés. Idéal pour maintenir une communication fluide avec les clients.','Error'=>'Erreur','Error API access'=>'Erreur d\'accès à l\'API','Event category'=>'Catégorie d\'événement','Event end time'=>'Heure de fin de l\'événement','Event start date'=>'Date de début de l\'événement','Event title'=>'Titre de l\'événement','Exchange rate'=>'Taux de change','Expense date'=>'Date de la dépense','Expense deleted successfully'=>'Dépense supprimée avec succès','Expense edited successfully'=>'Dépense éditée avec succès','Expense not found.'=>'Dépense introuvable.','Expenses'=>'Dépenses','Expenses categories'=>'Catégories de dépenses','Expenses settings'=>'Paramètres des dépenses','Expiration date'=>'Date d\'expiration','Expiry date'=>'Date d\'expiration','Export'=>'Exporter','Export to PDF'=>'Exporter en PDF','Export your financial data in various formats such as CSV and Excel. Customize export fields to include customers, quotes, invoices, payments, expenses, and statistics.'=>'Exportez vos données financières dans divers formats tels que CSV et Excel. Personnalisez les champs d\'exportation pour inclure les clients, devis, factures, paiements, dépenses et statistiques.','Failed to add client'=>'Échec de l\'ajout d\'un client','Failed to add invoice item'=>'Échec de l\'ajout d\'un élément de facture','Failed to add payment to database'=>'Échec de l\'ajout d\'un paiement à la base de données','Failed to add quote item'=>'Échec de l\'ajout d\'un élément de devis','Failed to check for updates.'=>'Échec de la vérification des mises à jour.','Failed to create invoice'=>'Échec de la création de la facture','Failed to delete client'=>'Échec de la suppression du client','Failed to delete expense'=>'Échec de la suppression de la dépense','Failed to delete invoice item.'=>'Échec de la suppression de l\'élément de la facture.','Failed to delete payment'=>'Échec de la suppression du paiement','Failed to edit client'=>'Échec de l\'édition du client','Failed to edit expense'=>'Échec de l\'édition de la dépense','Failed to edit Item'=>'Échec de l\'édition de l\'élément','Failed to edit item'=>'Échec de la modification de l\'élément','Failed to edit payment'=>'Échec de l\'édition du paiement','Failed to retrieve exchange rate for client currency'=>'Échec de la récupération du taux de change pour la devise du client','Failed to update invoice'=>'Échec de la mise à jour de la facture','Failed to update invoice status in database'=>'Échec de la mise à jour du statut de la facture dans la base de données','Failed to update quote status'=>'Échec de la mise à jour du statut du devis','Failure to delete invoice and/or associated items'=>'Impossible de supprimer la facture et/ou des éléments associés','Failure to delete Quote and/or associated items'=>'Impossible de supprimer le devis et/ou des éléments associés','Fax'=>'Fax','February'=>'Février','File name'=>'Nom du fichier','File upload failed:'=>'Le téléchargement du fichier a échoué :','Format date'=>'Format de la date','General settings'=>'Paramètres généraux','Generate credit invoice'=>'Générer une facture d\'avoir','Get detailed statistical analysis of your financial data. Generate various reports on income, expenses, and profitability with graphical representations for easier interpretation.'=>'Obtenez une analyse statistique détaillée de vos données financières. Générez divers rapports sur les revenus, les dépenses et la rentabilité avec des représentations graphiques pour une interprétation plus facile.','Go to the dashboard'=>'Accéder au tableau de bord','https://myeasycompta.com'=>'https://myeasycompta.com','IBAN'=>'IBAN','ID'=>'ID','ID Client'=>'ID Client','Import demo data'=>'Importer des données de démonstration','Install configuration settings'=>'Installer les paramètres de configuration','Install database tables'=>'Installation des tables de la base de données','Install settings datas'=>'Installer les données de configuration','Installed'=>'Installé','Integrate a planning module to manage your schedule. Create and assign tasks with specific categories, and track project deadlines and workloads efficiently.'=>'Intégrez un module de planification pour gérer votre emploi du temps. Créez et assignez des tâches avec des catégories spécifiques, et suivez les échéances et les charges de travail des projets efficacement.','Integrate myEasyCompta with WooCommerce to automatically generate invoices for each new order. Sync WooCommerce sales data, manage transactions, track sales, and handle customer invoicing seamlessly.'=>'Intégrez myEasyCompta avec WooCommerce pour générer automatiquement des factures pour chaque nouvelle commande. Synchronisez les données de vente de WooCommerce, gérez les transactions, suivez les ventes et gérez la facturation des clients sans interruption.','Invalid expense ID.'=>'ID de dépense non valide.','Invalid ID provided'=>'L\'identifiant fourni n\'est pas valide','Invalid invoice ID'=>'ID de la facture non valide','Invalid invoice ID.'=>'ID de la facture non valide.','Invalid item ID.'=>'ID de l\'article invalide.','Invalid nonce'=>'Nonce non valide','Invalid order data'=>'Données d\'ordre non valides','Invalid payment ID.'=>'ID de paiement non valide.','Invalid quote ID.'=>'ID de devis non valide.','Invoice'=>'Facture','Invoice added successfully'=>'Facture ajoutée avec succès','Invoice and related items successfully deleted'=>'La facture et ces éléments ont été supprimés avec succès','Invoice color'=>'Couleur de la facture','Invoice footer'=>'Pied de page de la facture','Invoice in'=>'Facture en','Invoice item deleted.'=>'Élément de facture supprimé.','Invoice item successfully added'=>'Élément de facture ajouté avec succès','Invoice items order updated successfully'=>'Mise à jour réussie de l\'ordre des éléments de la facture','Invoice not found'=>'Facture introuvable','Invoice not found.'=>'Facture introuvable.','Invoice number'=>'Numéro de facture','Invoice Overdue'=>'Facture en retard','Invoice prefix'=>'Préfixe de la facture','Invoice reminder'=>'Rappel de facture','Invoice status updated successfully'=>'Le statut de la facture a été mis à jour avec succès','Invoice terms'=>'Conditions de facture','Invoice updated successfully'=>'Paiement mis à jour avec succès','Invoices'=>'Factures','Invoices in draft status cannot be sent.'=>'Les factures en brouillon ne peuvent pas être envoyées.','Invoices settings'=>'Paramètres des factures','Item edited successfully'=>'Article édité avec succès','Item name'=>'Nom de l\'article','January'=>'Janvier','July'=>'Juillet','June'=>'Juin','Last invoices'=>'Dernières factures','Let\'s GO'=>'Allons-y','License Addons'=>'Licence Addons','License data deleted successfully.'=>'Les données de licence ont été supprimées avec succès.','License key'=>'Clé de licence','Live mode'=>'Mode Live','Logo mentions'=>'Mentions du logo','Logout'=>'Déconnexion','Manager name'=>'Contact','March'=>'Mars','Mark as accepted'=>'Marquer comme accepté','Mark as canceled'=>'Marquer comme annulé','Mark as paid'=>'Marquer comme payé','Mark as rejected'=>'Marquer comme rejeté','May'=>'Mai','Mobile'=>'Mobile','Mode'=>'Mode','Monthly Payments'=>'Paiements mensuels','myEasyCompta'=>'myEasyCompta','myEasyCompta - Setup Process'=>'myEasyCompta - Processus d\'installation','myEasyCompta Acompte is a plugin designed to simplify your invoicing process. Once a quote has been validated, Acompte lets you generate down-payment and balance invoices with ease. You can set up down-payment invoices as percentages or fixed amounts, with automatic calculation of remaining amounts.'=>'myEasyCompta Acompte est un plugin conçu pour simplifier votre processus de facturation. Une fois un devis validé, Acompte vous permet de générer des factures d\'acompte et des factures de solde de manière simple. Vous pouvez configurer les factures d\'acompte en pourcentage ou en montant fixe avec un calcul automatique des montants restants.','myEasyCompta Addons'=>'myEasyCompta Addons','myEasyCompta Advance'=>'myEasyCOmpta Acompte','myEasyCompta Backup'=>'myEasyCompta Backup','myEasyCompta Backup plugin provides integrated solutions for securely backing up, restoring, and managing financial data.'=>'Le plugin myEasyCompta Backup offre des solutions intégrées pour sauvegarder, restaurer et gérer les données financières de manière sécurisée.','myEasyCompta Email'=>'myEasyCompta Email','myEasyCompta Export'=>'myEasyCompta Export','myEasyCompta is ready to use.'=>'myEasyCompta est prêt à l\'emploi.','myEasyCompta Payment'=>'myEasyCompta Payment','myEasyCompta Payment allows myEasyCompta users to offer their clients the ability to pay invoices directly through secure and integrated payment options.'=>'myEasyCompta Payment permet aux utilisateurs de myEasyCompta d\'offrir à leurs clients la possibilité de payer leurs factures directement grâce à des options de paiement sécurisées et intégrées.','myEasyCompta Planning'=>'myEasyCompta Planning','myEasyCompta requires a database update.'=>'myEasyCompta nécessite une mise à jour de la base de données.','myEasyCompta Signature'=>'myEasyCompta Signature','myEasyCompta Signature allows myEasyCompta users to easily collect digital signatures on quotes, ensuring secure and efficient document approval.'=>'myEasyCompta Signature permet aux utilisateurs d\'myEasyCompta de collecter facilement des signatures numériques sur les devis, garantissant ainsi une approbation des documents sécurisée et efficace.','myEasyCompta SIRET Search'=>'myEasyCompta SIRET Search','myEasyCompta Stats'=>'myEasyCompta Stats','myEasyCompta User'=>'myEasyCompta User','myEasyCompta Woo'=>'myEasyCompta Woo','Name'=>'Nom','New client'=>'Nouveau client','New invoice'=>'Nouvelle facture','New password'=>'Nouveau mot de passe','New quote'=>'Nouveau devis','No data for the moment'=>'Pas de données pour le moment','No invoice found for the given item.'=>'Aucune facture n\'a été trouvée pour l\'article en question.','No item details found.'=>'Aucun détail de l\'article n\'a été trouvé.','No items found for this invoice.'=>'Aucun article n\'a été trouvé pour cette facture.','No items found for this quote.'=>'Aucun élément n\'a été trouvé pour ce devis.','No quote found for the given item.'=>'Aucun devis n\'a été trouvé pour l\'élément donné.','No update available.'=>'Aucune mise à jour n\'est disponible.','Nonce invalide'=>'Nonce invalide','Nonce verification failed.'=>'La vérification du nonce a échoué.','Not installed'=>'Non installé','Note'=>'Note','November'=>'Novembre','October'=>'Octobre','PAID'=>'PAYÉ','Paid'=>'Payé','Pay'=>'Payer','Pay invoice'=>'Payer la facture','Payed'=>'Payé','Payment conditions'=>'Conditions de règlement','Payment date'=>'Date de paiement','Payment deleted successfully'=>'Paiement supprimé avec succès','Payment edited successfully'=>'Paiement édité avec succès','Payment method'=>'Méthode de paiement','Payment mode'=>'Mode de règlement','Payment not found.'=>'Paiement introuvable.','Payment received'=>'Paiement reçu','Payment successful'=>'Paiement réussi','Payments'=>'Paiements','Payments methods'=>'Méthodes de paiement','Payments settings'=>'Paramètres des paiements','Pending'=>'En attente','Phone'=>'Téléphone','Planning settings'=>'Paramètres du planning','Plugin activation error'=>'Erreur d\'activation du plugin','Plugin deactivation error'=>'Erreur de désactivation du plugin','Postal code'=>'Code postal','Preview PDF'=>'Prévisualiser la facture','Provisional start date'=>'Date de début provisoire','Public key (Live mode)'=>'Public key (Live mode)','Public key (Test mode)'=>'Public key (Test mode)','QRCode Settings'=>'Réglages QRCode','QRCode Stripe'=>'QRCode Stripe','Qty'=>'Qté','Quantity'=>'Quantité','Quote'=>'Devis','Quote added successfully'=>'Devis ajouté avec succès','Quote and related items successfully deleted'=>'Suppression réussie de devis et ces éléments','Quote color'=>'Couleur de devis','Quote converted to invoice successfully'=>'Devis converti en facture avec succès','Quote expired'=>'Devis expiré','Quote footer'=>'Pied de page de devis','Quote item deleted.'=>'Élément de devis supprimé.','Quote item successfully added'=>'L\'élément de devis a été ajouté avec succès','Quote items order updated successfully'=>'Mise à jour réussie de l\'ordre des éléments de devis','Quote not found'=>'Devisintrouvable','Quote not found.'=>'Le devis n\'a pas été trouvée.','Quote number'=>'Numéro de devis','Quote prefix'=>'Préfixe de devis','Quote status updated successfully'=>'Le statut du devis a été mis à jour avec succès','Quote terms'=>'Conditions du devis','Quotes'=>'Devis','Quotes settings'=>'Paramètres de devis','Rate'=>'Taux','Read more'=>'Lire la suite','Received From'=>'Reçu de','Received from'=>'Reçu de','Recently Paid Invoices'=>'Factures récemment payées','Recipient'=>'Destinataire','Recipient email'=>'E-mail du destinataire','Ref'=>'Réf','Reference No'=>'Réf. n°','Rejected'=>'Rejeté','Remind client'=>'Relancer le client','Resend invoice'=>'Re-envoyer la facture','Restore'=>'Restaurer','RIB'=>'RIB','Save'=>'Sauvegarder','Search'=>'Recherche','Secret key (Live mode)'=>'Secret key (Live mode)','Secret key (Test mode)'=>'Secret key (Test mode)','Security code'=>'Code de sécurité','Select'=>'Sélectionner','Select / Unselect All'=>'Sélectionner / désélectionner tout','Select category'=>'Sélectionner une catégorie','Select client'=>'Sélectionner un client','Send'=>'Envoyer','Send invoice'=>'Envoyer la facture','Send quote'=>'Envoyer le devis','September'=>'Septembre','Settings'=>'Paramètres','Settings saved successfully'=>'Les paramètres ont été sauvegardés avec succès','Setup complete!'=>'Installation terminée !','Shipping fees'=>'Frais d\'expédition','Show Email'=>'Afficher l\'e-mail','Show Phone'=>'Afficher le téléphone','Show SIREN n°'=>'Afficher le n° de SIREN','Show TAX n°'=>'Afficher le n° de TVA','Show Watermark'=>'Afficher le filigrane','Show Watermark only for Paid status'=>'Afficher le filigrane uniquement pour le statut Payé','Sign'=>'Signer','Sign quote'=>'Signer le devis','Signed'=>'Signé','SIREN n°'=>'N° de SIREN','SIRET n°'=>'N° de SIRET','Skip'=>'Pas de besoin','Slug'=>'Slug','Statistics'=>'Statistiques','Stats settings'=>'Paramètres des statistiques','Status'=>'Statut','Step'=>'Étape','Streamline your financial management with myEasyCompta, an all-in-one accounting plugin. Effortlessly handle quotes, invoices, expenses, and more, all within a sleek, user-friendly interface. Perfect for freelancers and small businesses looking to simplify their accounting processes.'=>'Rationalisez votre gestion financière avec myEasyCompta, un plugin de comptabilité tout-en-un. Gérez sans effort les devis, les factures, les dépenses et bien plus encore, le tout dans une interface élégante et conviviale. Parfait pour les freelances et les petites entreprises qui cherchent à simplifier leurs processus comptables.','Stripe secret key'=>'Clé secrète Stripe','Stripe settings'=>'Paramètres de Stripe','Sub total'=>'Sous-total','Subject'=>'Sujet','Submit'=>'Soumettre','Subtotal'=>'Sous-total','Success'=>'Succès','Symbol'=>'Symbole','System settings'=>'Paramètres du système','Tables already exist'=>'Les tables existent déjà','Tables created successfully'=>'Tables créées avec succès','Tax'=>'TVA','Tax number'=>'Numéro de TVA','Test mode'=>'Mode Test','Text Color'=>'Couleur du texte','The <strong>myEasyCompta</strong> plugin requires PHP version %s or higher.'=>'Le plugin <strong>myEasyCompta</strong> nécessite la version PHP %s ou supérieure.','The Easy-Compta SIRET plugin adds a field to quickly retrieve customer information using the French government business directory API (https://api.gouv.fr). This enhances the efficiency of managing client data within the Easy-Compta system.'=>'Le plugin Easy-Compta-SIRET ajoute un champ pour récupérer rapidement les informations des clients en utilisant l\'API du répertoire des entreprises du gouvernement français (https://api.gouv.fr). Cela améliore l\'efficacité de la gestion des données clients au sein du système Easy-Compta.','The email address is invalid'=>'L\'adresse e-mail n\'est pas valide','The field %s is required'=>'Le champ %s est obligatoire','There\'s no turning back!'=>'Vous ne pourrez pas revenir en arrière!','This will automatically create a backup and delete all data to restore the backup.'=>'Cela va créer automatiquement une sauvegarde et supprimer toutes les données pour restaurer la sauvegarde.','Token api SIREN v 3.11'=>'Token api SIREN v 3.11','Total'=>'Total','Total amount'=>'Montant total','Total invoices'=>'Total des factures','Total paid invoices'=>'Total des factures payées','Total quotes'=>'Total des devis','TVA limit'=>'Plafond de la TVA','Type'=>'Type','Unauthorized request'=>'Requête non autorisée','Unit price'=>'Prix unitaire','UNPAID'=>'NON PAYÉ','Unpaid'=>'Non payé','Unpaid invoices'=>'Factures impayées','Update'=>'Mise à jour','Update available! New version'=>'Mise à jour disponible ! Nouvelle version','Update Database'=>'Mettre à jour la base de données','Users settings'=>'Paramètres utilisateurs','Validate'=>'Valider','Validate invoice'=>'Valider la facture','Validate quote'=>'Valider le devis','VAT'=>'TVA','Vat'=>'Tva','VAT Rates'=>'Taux de TVA','Version'=>'Version','View'=>'Voir','Website'=>'Site web','Yes, confirm it!'=>'Oui, confirmez !','Yes, delete it!'=>'Oui, supprimez !','You cannot deactivate the myEasyCompta plugin while add-ons are enabled.'=>'Vous ne pouvez pas désactiver le plugin myEasyCompta lorsque les addons sont activés.','You must have at least one article'=>'Vous devez avoir au moins un article','You need to activate the Email addon to benefit from this feature.'=>'Vous devez activer l\'addon Email pour bénéficier de cette fonctionnalité.','You need to activate the Export addon to benefit from this feature.'=>'Vous devez activer l\'addon Export pour bénéficier de cette fonctionnalité.','You need to activate the QRCode Stripe addon to benefit from this feature.'=>'Vous devez activer l\'addon QRCode Stripe pour bénéficier de cette fonctionnalité.','Your payment is secure, and no card details are stored by our platform. The transaction is protected by Stripe\'s service.'=>'Votre paiement est sécurisé et aucun détail de carte n\'est stocké par notre plateforme. La transaction est protégée par le service Stripe.']];
  • my-easy-compta/trunk/languages/my-easy-compta-fr_FR.po

    r3166746 r3167980  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2024-05-28 11:22+0000\n"
    6 "PO-Revision-Date: 2024-10-10 17:13+0000\n"
     6"PO-Revision-Date: 2024-10-13 11:04+0000\n"
    77"Last-Translator: \n"
    88"Language-Team: Français\n"
     
    104104msgstr "Aperçu des paiements annuels"
    105105
    106 #: includes/Modules/Invoices.php:216 includes/Modules/Invoices.php:290
     106#: includes/Modules/Invoices.php:217 includes/Modules/Invoices.php:291
    107107#: includes/Modules/Quotes.php:201 includes/Modules/Quotes.php:500
    108108msgid "API access error"
     
    277277msgstr "Convertir en facture"
    278278
    279 #: includes/Modules/Invoices.php:261 includes/Modules/Invoices.php:271
     279#: includes/Modules/Invoices.php:262 includes/Modules/Invoices.php:272
    280280msgid "Could not insert invoice into database"
    281281msgstr "Impossible d'insérer une facture dans la base de données"
     
    460460msgstr "Télécharger"
    461461
     462#: languages/my-easy-compta-translations.php:296
     463msgid "Download QRCode Stripe payment link"
     464msgstr "Télécharger QRCode Stripe lien de paiement"
     465
    462466#: includes/Modules/PDFGenerator.php:226
    463467msgid "DRAFT"
     
    545549msgstr "Erreur"
    546550
    547 #: includes/Modules/Clients.php:194 includes/Modules/Invoices.php:633
     551#: includes/Modules/Clients.php:194 includes/Modules/Invoices.php:634
    548552#: includes/Modules/Quotes.php:258 includes/Modules/Quotes.php:620
    549553msgid "Error API access"
     
    631635msgstr "Échec de l'ajout d'un client"
    632636
    633 #: includes/Modules/Invoices.php:372
     637#: includes/Modules/Invoices.php:373
    634638msgid "Failed to add invoice item"
    635639msgstr "Échec de l'ajout d'un élément de facture"
    636640
    637 #: includes/Modules/Invoices.php:780
     641#: includes/Modules/Invoices.php:781
    638642msgid "Failed to add payment to database"
    639643msgstr "Échec de l'ajout d'un paiement à la base de données"
     
    659663msgstr "Échec de la suppression de la dépense"
    660664
    661 #: includes/Modules/Invoices.php:651
     665#: includes/Modules/Invoices.php:652
    662666msgid "Failed to delete invoice item."
    663667msgstr "Échec de la suppression de l'élément de la facture."
     
    679683msgstr "Échec de l'édition de l'élément"
    680684
    681 #: includes/Modules/Invoices.php:596
     685#: includes/Modules/Invoices.php:597
    682686msgid "Failed to edit item"
    683687msgstr "Échec de la modification de l'élément"
     
    687691msgstr "Échec de l'édition du paiement"
    688692
    689 #: includes/Modules/Invoices.php:752
     693#: includes/Modules/Invoices.php:753
    690694msgid "Failed to retrieve exchange rate for client currency"
    691695msgstr "Échec de la récupération du taux de change pour la devise du client"
    692696
    693 #: includes/Modules/Credits.php:202 includes/Modules/Invoices.php:412
     697#: includes/Modules/Credits.php:202 includes/Modules/Invoices.php:413
    694698msgid "Failed to update invoice"
    695699msgstr "Échec de la mise à jour de la facture"
    696700
    697 #: includes/Modules/Invoices.php:736
     701#: includes/Modules/Invoices.php:737
    698702msgid "Failed to update invoice status in database"
    699703msgstr ""
     
    704708msgstr "Échec de la mise à jour du statut du devis"
    705709
    706 #: includes/Modules/Invoices.php:446
     710#: includes/Modules/Invoices.php:447
    707711msgid "Failure to delete invoice and/or associated items"
    708712msgstr "Impossible de supprimer la facture et/ou des éléments associés"
     
    816820msgstr "ID de dépense non valide."
    817821
    818 #: includes/Modules/Invoices.php:713
     822#: includes/Modules/Invoices.php:714
    819823msgid "Invalid ID provided"
    820824msgstr "L'identifiant fourni n'est pas valide"
    821825
    822 #: includes/Modules/Invoices.php:384
     826#: includes/Modules/Invoices.php:385
    823827msgid "Invalid invoice ID"
    824828msgstr "ID de la facture non valide"
    825829
    826 #: includes/Modules/Invoices.php:433
     830#: includes/Modules/Invoices.php:434
    827831msgid "Invalid invoice ID."
    828832msgstr "ID de la facture non valide."
    829833
    830 #: includes/Modules/Invoices.php:546
     834#: includes/Modules/Invoices.php:547
    831835msgid "Invalid item ID."
    832836msgstr "ID de l'article invalide."
     
    834838#: includes/Modules/Clients.php:321 includes/Modules/Credits.php:132
    835839#: includes/Modules/Credits.php:178 includes/Modules/Expenses.php:153
    836 #: includes/Modules/Expenses.php:334 includes/Modules/Invoices.php:211
    837 #: includes/Modules/Invoices.php:285 includes/Modules/Invoices.php:427
     840#: includes/Modules/Expenses.php:334 includes/Modules/Invoices.php:212
     841#: includes/Modules/Invoices.php:286 includes/Modules/Invoices.php:428
    838842#: includes/Modules/Quotes.php:196 includes/Modules/Quotes.php:253
    839843#: includes/Modules/Quotes.php:404 includes/Modules/Quotes.php:495
     
    842846msgstr "Nonce non valide"
    843847
    844 #: includes/Modules/Invoices.php:684 includes/Modules/Quotes.php:663
     848#: includes/Modules/Invoices.php:685 includes/Modules/Quotes.php:663
    845849msgid "Invalid order data"
    846850msgstr "Données d'ordre non valides"
     
    858862msgstr "Facture"
    859863
    860 #: includes/Modules/Invoices.php:268
     864#: includes/Modules/Invoices.php:269
    861865msgid "Invoice added successfully"
    862866msgstr "Facture ajoutée avec succès"
    863867
    864 #: includes/Modules/Invoices.php:443
     868#: includes/Modules/Invoices.php:444
    865869msgid "Invoice and related items successfully deleted"
    866870msgstr "La facture et ces éléments ont été supprimés avec succès"
     
    878882msgstr "Facture en"
    879883
    880 #: includes/Modules/Invoices.php:668
     884#: includes/Modules/Invoices.php:669
    881885msgid "Invoice item deleted."
    882886msgstr "Élément de facture supprimé."
    883887
    884 #: includes/Modules/Invoices.php:370
     888#: includes/Modules/Invoices.php:371
    885889msgid "Invoice item successfully added"
    886890msgstr "Élément de facture ajouté avec succès"
    887891
    888 #: includes/Modules/Invoices.php:697
     892#: includes/Modules/Invoices.php:698
    889893msgid "Invoice items order updated successfully"
    890894msgstr "Mise à jour réussie de l'ordre des éléments de la facture"
    891895
    892896#: includes/Modules/Credits.php:138 includes/Modules/Credits.php:186
    893 #: includes/Modules/Invoices.php:718
     897#: includes/Modules/Invoices.php:719
    894898msgid "Invoice not found"
    895899msgstr "Facture introuvable"
     
    915919msgstr "Rappel de facture"
    916920
    917 #: includes/Modules/Invoices.php:784
     921#: includes/Modules/Invoices.php:785
    918922msgid "Invoice status updated successfully"
    919923msgstr "Le statut de la facture a été mis à jour avec succès"
     
    923927msgstr "Conditions de facture"
    924928
    925 #: includes/Modules/Invoices.php:417
     929#: includes/Modules/Invoices.php:418
    926930msgid "Invoice updated successfully"
    927931msgstr "Paiement mis à jour avec succès"
     
    942946msgstr "Paramètres des factures"
    943947
    944 #: includes/Modules/Invoices.php:617 includes/Modules/Quotes.php:605
     948#: includes/Modules/Invoices.php:618 includes/Modules/Quotes.php:605
    945949msgid "Item edited successfully"
    946950msgstr "Article édité avec succès"
     
    11121116msgstr "myEasyCompta Planning"
    11131117
    1114 #: my-easy-compta.php:340
     1118#: my-easy-compta.php:341
    11151119msgid "myEasyCompta requires a database update."
    11161120msgstr "myEasyCompta nécessite une mise à jour de la base de données."
     
    11731177msgstr "Pas de données pour le moment"
    11741178
    1175 #: includes/Modules/Invoices.php:601 includes/Modules/Invoices.php:641
     1179#: includes/Modules/Invoices.php:602 includes/Modules/Invoices.php:642
    11761180msgid "No invoice found for the given item."
    11771181msgstr "Aucune facture n'a été trouvée pour l'article en question."
    11781182
    1179 #: includes/Modules/Invoices.php:522
     1183#: includes/Modules/Invoices.php:523
    11801184msgid "No item details found."
    11811185msgstr "Aucun détail de l'article n'a été trouvé."
    11821186
    1183 #: includes/Modules/Invoices.php:489
     1187#: includes/Modules/Invoices.php:490
    11841188msgid "No items found for this invoice."
    11851189msgstr "Aucun article n'a été trouvé pour cette facture."
     
    11971201msgstr "Aucune mise à jour n'est disponible."
    11981202
    1199 #: includes/Modules/Clients.php:189 includes/Modules/Invoices.php:628
     1203#: includes/Modules/Clients.php:189 includes/Modules/Invoices.php:629
    12001204#: includes/Modules/Quotes.php:616
    12011205msgid "Nonce invalide"
    12021206msgstr "Nonce invalide"
    12031207
    1204 #: includes/Modules/Invoices.php:380
     1208#: includes/Modules/Invoices.php:381
    12051209msgid "Nonce verification failed."
    12061210msgstr "La vérification du nonce a échoué."
     
    13121316msgstr "Erreur d'activation du plugin"
    13131317
    1314 #: my-easy-compta.php:361
     1318#: my-easy-compta.php:362
    13151319msgid "Plugin deactivation error"
    13161320msgstr "Erreur de désactivation du plugin"
     
    13351339msgid "Public key (Test mode)"
    13361340msgstr "Public key (Test mode)"
     1341
     1342#: languages/my-easy-compta-translations.php:293
     1343msgid "QRCode Settings"
     1344msgstr "Réglages QRCode"
     1345
     1346#: languages/my-easy-compta-translations.php:295
     1347msgid "QRCode Stripe"
     1348msgstr "QRCode Stripe"
    13371349
    13381350#: languages/my-easy-compta-translations.php:142
     
    16331645"conviviale. Parfait pour les freelances et les petites entreprises qui "
    16341646"cherchent à simplifier leurs processus comptables."
     1647
     1648#: languages/my-easy-compta-translations.php:294
     1649msgid "Stripe secret key"
     1650msgstr "Clé secrète Stripe"
    16351651
    16361652#: languages/my-easy-compta-translations.php:150
     
    17271743#. %s: is the field name.
    17281744#. %s is the field name
    1729 #: includes/Modules/Clients.php:206 includes/Modules/Invoices.php:302
     1745#: includes/Modules/Clients.php:206 includes/Modules/Invoices.php:303
    17301746#: includes/Modules/Quotes.php:270
    17311747#, php-format
     
    17781794msgstr "Type"
    17791795
    1780 #: includes/Modules/Invoices.php:678 includes/Modules/Quotes.php:657
     1796#: includes/Modules/Invoices.php:679 includes/Modules/Quotes.php:657
    17811797msgid "Unauthorized request"
    17821798msgstr "Requête non autorisée"
     
    18071823msgstr "Mise à jour disponible ! Nouvelle version"
    18081824
    1809 #: my-easy-compta.php:343
     1825#: my-easy-compta.php:344
    18101826msgid "Update Database"
    18111827msgstr "Mettre à jour la base de données"
     
    18591875msgstr "Oui, supprimez !"
    18601876
    1861 #: my-easy-compta.php:360
     1877#: my-easy-compta.php:361
    18621878msgid ""
    18631879"You cannot deactivate the myEasyCompta plugin while add-ons are enabled."
     
    18791895msgstr ""
    18801896"Vous devez activer l'addon Export pour bénéficier de cette fonctionnalité."
     1897
     1898#: languages/my-easy-compta-translations.php:297
     1899msgid ""
     1900"You need to activate the QRCode Stripe addon to benefit from this feature."
     1901msgstr ""
     1902"Vous devez activer l'addon QRCode Stripe pour bénéficier de cette "
     1903"fonctionnalité."
    18811904
    18821905#: languages/my-easy-compta-translations.php:288
  • my-easy-compta/trunk/languages/my-easy-compta-translations.php

    r3166746 r3167980  
    291291    'min_article' => __('You must have at least one article', 'my-easy-compta'),
    292292    'shipping_fees' => __('Shipping fees', 'my-easy-compta'),
     293    'qrcode_settings' => __('QRCode Settings', 'my-easy-compta'),
     294    'stripe_api' => __('Stripe secret key', 'my-easy-compta'),
     295    'generate_qrcode' => __('QRCode Stripe', 'my-easy-compta'),
     296    'download_qr_code' => __('Download QRCode Stripe payment link', 'my-easy-compta'),
     297    'active_qrcode_addon' => __('You need to activate the QRCode Stripe addon to benefit from this feature.', 'my-easy-compta'),
    293298);
  • my-easy-compta/trunk/languages/my-easy-compta.pot

    r3166746 r3167980  
    44"Project-Id-Version: myEasyCompta\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2024-10-10 17:13+0000\n"
     6"POT-Creation-Date: 2024-10-13 11:01+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    104104msgstr ""
    105105
    106 #: includes/Modules/Invoices.php:216 includes/Modules/Invoices.php:290
     106#: includes/Modules/Invoices.php:217 includes/Modules/Invoices.php:291
    107107#: includes/Modules/Quotes.php:201 includes/Modules/Quotes.php:500
    108108msgid "API access error"
     
    275275msgstr ""
    276276
    277 #: includes/Modules/Invoices.php:261 includes/Modules/Invoices.php:271
     277#: includes/Modules/Invoices.php:262 includes/Modules/Invoices.php:272
    278278msgid "Could not insert invoice into database"
    279279msgstr ""
     
    455455msgstr ""
    456456
     457#: languages/my-easy-compta-translations.php:296
     458msgid "Download QRCode Stripe payment link"
     459msgstr ""
     460
    457461#: includes/Modules/PDFGenerator.php:226
    458462msgid "DRAFT"
     
    536540msgstr ""
    537541
    538 #: includes/Modules/Clients.php:194 includes/Modules/Invoices.php:633
     542#: includes/Modules/Clients.php:194 includes/Modules/Invoices.php:634
    539543#: includes/Modules/Quotes.php:258 includes/Modules/Quotes.php:620
    540544msgid "Error API access"
     
    619623msgstr ""
    620624
    621 #: includes/Modules/Invoices.php:372
     625#: includes/Modules/Invoices.php:373
    622626msgid "Failed to add invoice item"
    623627msgstr ""
    624628
    625 #: includes/Modules/Invoices.php:780
     629#: includes/Modules/Invoices.php:781
    626630msgid "Failed to add payment to database"
    627631msgstr ""
     
    647651msgstr ""
    648652
    649 #: includes/Modules/Invoices.php:651
     653#: includes/Modules/Invoices.php:652
    650654msgid "Failed to delete invoice item."
    651655msgstr ""
     
    667671msgstr ""
    668672
    669 #: includes/Modules/Invoices.php:596
     673#: includes/Modules/Invoices.php:597
    670674msgid "Failed to edit item"
    671675msgstr ""
     
    675679msgstr ""
    676680
    677 #: includes/Modules/Invoices.php:752
     681#: includes/Modules/Invoices.php:753
    678682msgid "Failed to retrieve exchange rate for client currency"
    679683msgstr ""
    680684
    681 #: includes/Modules/Credits.php:202 includes/Modules/Invoices.php:412
     685#: includes/Modules/Credits.php:202 includes/Modules/Invoices.php:413
    682686msgid "Failed to update invoice"
    683687msgstr ""
    684688
    685 #: includes/Modules/Invoices.php:736
     689#: includes/Modules/Invoices.php:737
    686690msgid "Failed to update invoice status in database"
    687691msgstr ""
     
    691695msgstr ""
    692696
    693 #: includes/Modules/Invoices.php:446
     697#: includes/Modules/Invoices.php:447
    694698msgid "Failure to delete invoice and/or associated items"
    695699msgstr ""
     
    793797msgstr ""
    794798
    795 #: includes/Modules/Invoices.php:713
     799#: includes/Modules/Invoices.php:714
    796800msgid "Invalid ID provided"
    797801msgstr ""
    798802
    799 #: includes/Modules/Invoices.php:384
     803#: includes/Modules/Invoices.php:385
    800804msgid "Invalid invoice ID"
    801805msgstr ""
    802806
    803 #: includes/Modules/Invoices.php:433
     807#: includes/Modules/Invoices.php:434
    804808msgid "Invalid invoice ID."
    805809msgstr ""
    806810
    807 #: includes/Modules/Invoices.php:546
     811#: includes/Modules/Invoices.php:547
    808812msgid "Invalid item ID."
    809813msgstr ""
     
    811815#: includes/Modules/Clients.php:321 includes/Modules/Credits.php:132
    812816#: includes/Modules/Credits.php:178 includes/Modules/Expenses.php:153
    813 #: includes/Modules/Expenses.php:334 includes/Modules/Invoices.php:211
    814 #: includes/Modules/Invoices.php:285 includes/Modules/Invoices.php:427
     817#: includes/Modules/Expenses.php:334 includes/Modules/Invoices.php:212
     818#: includes/Modules/Invoices.php:286 includes/Modules/Invoices.php:428
    815819#: includes/Modules/Quotes.php:196 includes/Modules/Quotes.php:253
    816820#: includes/Modules/Quotes.php:404 includes/Modules/Quotes.php:495
     
    819823msgstr ""
    820824
    821 #: includes/Modules/Invoices.php:684 includes/Modules/Quotes.php:663
     825#: includes/Modules/Invoices.php:685 includes/Modules/Quotes.php:663
    822826msgid "Invalid order data"
    823827msgstr ""
     
    835839msgstr ""
    836840
    837 #: includes/Modules/Invoices.php:268
     841#: includes/Modules/Invoices.php:269
    838842msgid "Invoice added successfully"
    839843msgstr ""
    840844
    841 #: includes/Modules/Invoices.php:443
     845#: includes/Modules/Invoices.php:444
    842846msgid "Invoice and related items successfully deleted"
    843847msgstr ""
     
    855859msgstr ""
    856860
    857 #: includes/Modules/Invoices.php:668
     861#: includes/Modules/Invoices.php:669
    858862msgid "Invoice item deleted."
    859863msgstr ""
    860864
    861 #: includes/Modules/Invoices.php:370
     865#: includes/Modules/Invoices.php:371
    862866msgid "Invoice item successfully added"
    863867msgstr ""
    864868
    865 #: includes/Modules/Invoices.php:697
     869#: includes/Modules/Invoices.php:698
    866870msgid "Invoice items order updated successfully"
    867871msgstr ""
    868872
    869873#: includes/Modules/Credits.php:138 includes/Modules/Credits.php:186
    870 #: includes/Modules/Invoices.php:718
     874#: includes/Modules/Invoices.php:719
    871875msgid "Invoice not found"
    872876msgstr ""
     
    892896msgstr ""
    893897
    894 #: includes/Modules/Invoices.php:784
     898#: includes/Modules/Invoices.php:785
    895899msgid "Invoice status updated successfully"
    896900msgstr ""
     
    900904msgstr ""
    901905
    902 #: includes/Modules/Invoices.php:417
     906#: includes/Modules/Invoices.php:418
    903907msgid "Invoice updated successfully"
    904908msgstr ""
     
    919923msgstr ""
    920924
    921 #: includes/Modules/Invoices.php:617 includes/Modules/Quotes.php:605
     925#: includes/Modules/Invoices.php:618 includes/Modules/Quotes.php:605
    922926msgid "Item edited successfully"
    923927msgstr ""
     
    10791083msgstr ""
    10801084
    1081 #: my-easy-compta.php:340
     1085#: my-easy-compta.php:341
    10821086msgid "myEasyCompta requires a database update."
    10831087msgstr ""
     
    11331137msgstr ""
    11341138
    1135 #: includes/Modules/Invoices.php:601 includes/Modules/Invoices.php:641
     1139#: includes/Modules/Invoices.php:602 includes/Modules/Invoices.php:642
    11361140msgid "No invoice found for the given item."
    11371141msgstr ""
    11381142
    1139 #: includes/Modules/Invoices.php:522
     1143#: includes/Modules/Invoices.php:523
    11401144msgid "No item details found."
    11411145msgstr ""
    11421146
    1143 #: includes/Modules/Invoices.php:489
     1147#: includes/Modules/Invoices.php:490
    11441148msgid "No items found for this invoice."
    11451149msgstr ""
     
    11571161msgstr ""
    11581162
    1159 #: includes/Modules/Clients.php:189 includes/Modules/Invoices.php:628
     1163#: includes/Modules/Clients.php:189 includes/Modules/Invoices.php:629
    11601164#: includes/Modules/Quotes.php:616
    11611165msgid "Nonce invalide"
    11621166msgstr ""
    11631167
    1164 #: includes/Modules/Invoices.php:380
     1168#: includes/Modules/Invoices.php:381
    11651169msgid "Nonce verification failed."
    11661170msgstr ""
     
    12721276msgstr ""
    12731277
    1274 #: my-easy-compta.php:361
     1278#: my-easy-compta.php:362
    12751279msgid "Plugin deactivation error"
    12761280msgstr ""
     
    12941298#: languages/my-easy-compta-translations.php:283
    12951299msgid "Public key (Test mode)"
     1300msgstr ""
     1301
     1302#: languages/my-easy-compta-translations.php:293
     1303msgid "QRCode Settings"
     1304msgstr ""
     1305
     1306#: languages/my-easy-compta-translations.php:295
     1307msgid "QRCode Stripe"
    12961308msgstr ""
    12971309
     
    15891601msgstr ""
    15901602
     1603#: languages/my-easy-compta-translations.php:294
     1604msgid "Stripe secret key"
     1605msgstr ""
     1606
    15911607#: languages/my-easy-compta-translations.php:150
    15921608#: languages/my-easy-compta-translations.php:275
     
    16701686#. %s: is the field name.
    16711687#. %s is the field name
    1672 #: includes/Modules/Clients.php:206 includes/Modules/Invoices.php:302
     1688#: includes/Modules/Clients.php:206 includes/Modules/Invoices.php:303
    16731689#: includes/Modules/Quotes.php:270
    16741690#, php-format
     
    17191735msgstr ""
    17201736
    1721 #: includes/Modules/Invoices.php:678 includes/Modules/Quotes.php:657
     1737#: includes/Modules/Invoices.php:679 includes/Modules/Quotes.php:657
    17221738msgid "Unauthorized request"
    17231739msgstr ""
     
    17481764msgstr ""
    17491765
    1750 #: my-easy-compta.php:343
     1766#: my-easy-compta.php:344
    17511767msgid "Update Database"
    17521768msgstr ""
     
    18001816msgstr ""
    18011817
    1802 #: my-easy-compta.php:360
     1818#: my-easy-compta.php:361
    18031819msgid ""
    18041820"You cannot deactivate the myEasyCompta plugin while add-ons are enabled."
     
    18151831#: languages/my-easy-compta-translations.php:273
    18161832msgid "You need to activate the Export addon to benefit from this feature."
     1833msgstr ""
     1834
     1835#: languages/my-easy-compta-translations.php:297
     1836msgid ""
     1837"You need to activate the QRCode Stripe addon to benefit from this feature."
    18171838msgstr ""
    18181839
  • my-easy-compta/trunk/my-easy-compta.php

    r3166746 r3167980  
    33 * Plugin Name: myEasyCompta
    44 * Description: Streamline your financial management with myEasyCompta, an all-in-one accounting plugin. Effortlessly handle quotes, invoices, expenses, and more, all within a sleek, user-friendly interface. Perfect for freelancers and small businesses looking to simplify their accounting processes.
    5  * Version: 1.2.2
     5 * Version: 1.2.3
    66 * Author: MELIOZ.dev
    77 * Author URI: https://myeasycompta.com
     
    2222 *
    2323 * @package myEasyCompta
    24  * @since 1.2.2
     24 * @since 1.2.3
    2525 */
    2626
     
    3737     * @var string
    3838     */
    39     public $version = '1.2.2';
     39    public $version = '1.2.3';
    4040
    4141    /**
     
    317317        $migrations = [
    318318            '1.1.0' => ECWP_INCLUDES . '/Migrations/migration_1_1_0.php',
     319            '1.2.3' => ECWP_INCLUDES . '/Migrations/migration_1_2_3.php',
    319320        ];
    320321
     
    336337        $installed_db_version = get_option('ecwp_db_version', '1.0.0');
    337338
    338         if (version_compare($installed_db_version, '1.1.0', '<')) {
     339        if (version_compare($installed_db_version, $this->version, '<')) {
    339340            echo '<div class="notice notice-warning is-dismissible">
    340341                    <p>' . __('myEasyCompta requires a database update.', 'my-easy-compta') . '</p>
  • my-easy-compta/trunk/readme.txt

    r3166746 r3167980  
    44Tested up to: 6.6.1
    55Requires PHP: 8.0
    6 Stable tag: 1.2.2
     6Stable tag: 1.2.3
    77License: GPLv2 or later
    88License URI: https://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.