Plugin Directory

Changeset 3155882


Ignore:
Timestamp:
09/22/2024 10:33:50 AM (18 months ago)
Author:
melioze
Message:

fix vat + add watermark

Location:
my-easy-compta
Files:
757 added
1 deleted
20 edited

Legend:

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

    r3148192 r3155882  
    1 (function(x,n){const t=o,a=x();for(;[];)try{if(-parseInt(t(445))/1+parseInt(t(438))/2*(-parseInt(t(425))/3)+-parseInt(t(443))/4+parseInt(t(441))/5+-parseInt(t(428))/6+-parseInt(t(442))/7+parseInt(t(436))/8===n)break;a.push(a.shift())}catch{a.push(a.shift())}})(i,829195);function u(x,n,t="\u20AC"){const a=o,e=parseFloat(x),c=parseFloat(n),r=e*(c/100);return(e+r)[a(427)](2)[a(433)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+t}function d(x,n="\u20AC"){const t=o;return parseFloat(x)[t(427)](2)[t(433)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+n}function o(x,n){const t=i();return o=function(a,e){return a=a-425,t[a]},o(x,n)}function l(x,n){const t=o;let a=[];if(n<=5)for(let e=1;e<=n;e++)a[t(439)](e);else if(x<=3){for(let e=1;e<=5;e++)a.push(e);a[t(439)](t(431)),a[t(439)](n)}else if(x>n-3){a[t(439)](1),a[t(439)](t(431));for(let e=n-4;e<=n;e++)a.push(e)}else{a.push(1),a[t(439)](t(431));for(let e=x-1;e<=x+1;e++)a[t(439)](e);a[t(439)](t(431)),a[t(439)](n)}return a}function _(x,n,t){const a=o,e=parseFloat(x).toFixed(2)[a(433)](/\B(?=(\d{3})+(?!\d))/g," ");return t==="before"?n+" "+e:e+" "+n}function h(x,n,t){const a=o;x[a(429)]=n,x[a(440)]=t,x.visible=!![],setTimeout(()=>{const e=a;x[e(437)]=![]},3e3)}function i(){const x=["push","type","966855htCUXQ","11024489LcZFFM","2842376ZIYmrO","length","605991nDFqvQ","3lBxEDK","split","toFixed","390318rbVGSp","message","Invalid Date","...","toString","replace","YYYY","indexOf","39085144hhsITX","visible","2586508uJGEoW"];return i=function(){return x},i()}function f(x,n){const t=p();return f=function(a,e){return a=a-168,t[a]},f(x,n)}function p(){const x=["549010XTlNvq","application/json","1160KeFPFn","/wp-json/my-easy-compta/v1/settings/vat/","Failed to fetch VAT data:","nonce","1740984RnLAmz","525936JeNQwb","18tugHlm","121412URFLaf","Failed to fetch currency data:","/wp-json/my-easy-compta/v1/settings/currency/","8RaHIIJ","error","statusText","message","980TaQWEk","6372BMYufV","88xMkAaG","GET","217588xbmmTv","json","/wp-json/my-easy-compta/v1/settings/vats","symbol","default_currency","11977bBptmu"];return p=function(){return x},p()}(function(x,n){const t=f,a=x();for(;[];)try{if(-parseInt(t(178))/1+-parseInt(t(193))/2+parseInt(t(191))/3*(-parseInt(t(170))/4)+-parseInt(t(174))/5*(parseInt(t(175))/6)+-parseInt(t(183))/7*(parseInt(t(186))/8)+-parseInt(t(192))/9*(-parseInt(t(184))/10)+-parseInt(t(176))/11*(-parseInt(t(190))/12)===n)break;a.push(a.shift())}catch{a.push(a.shift())}})(p,185293);async function m(){const x=f;try{const n=await fetch("/wp-json/my-easy-compta/v1/settings/get",{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin[x(189)]}});if(n.ok){const t=await n.json();let a=null,e=null,c=null;if(t[x(182)]){const r=t[x(182)],s=await fetch(x(169)+r,{method:x(177),headers:{"Content-Type":x(185),"X-WP-Nonce":myEasyComptaAdmin[x(189)]}});s.ok?a=(await s[x(179)]())[x(181)]:console[x(171)](x(168),s[x(172)])}if(t.vat_active==1){const r=t.default_vat,s=await fetch(x(187)+r,{method:x(177),headers:{"Content-Type":x(185),"X-WP-Nonce":myEasyComptaAdmin[x(189)]}});s.ok?e=await s[x(179)]():console.error("Failed to fetch VAT data:",s[x(172)]);const b=await fetch(x(180),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin.nonce}});b.ok?c=await b[x(179)]():console[x(171)](x(188),b[x(172)])}return{settings:t,currencySymbol:a,vatData:e,listVatData:c}}else{const t=await n.json();throw new Error(t[x(173)])}}catch(n){throw console[x(171)](n),new Error(n[x(173)])}}export{d as a,_ as b,u as c,m as f,l as g,h as s};
     1(function(t,n){const e=o,x=t();for(;[];)try{if(parseInt(e(369))/1+-parseInt(e(378))/2*(parseInt(e(388))/3)+parseInt(e(389))/4+-parseInt(e(383))/5*(parseInt(e(374))/6)+parseInt(e(382))/7*(parseInt(e(391))/8)+parseInt(e(376))/9+parseInt(e(387))/10===n)break;x.push(x.shift())}catch{x.push(x.shift())}})(i,794396);function d(t,n,e="\u20AC"){const x=o,a=parseFloat(t),c=parseFloat(n),r=a*(c/100);return(a+r).toFixed(2)[x(381)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+e}function l(t,n="\u20AC"){const e=o;return parseFloat(t)[e(371)](2)[e(381)](/\B(?=(\d{3})+(?!\d))/g," ")+" "+n}function _(t,n){const e=o;let x=[];if(n<=5)for(let a=1;a<=n;a++)x[e(373)](a);else if(t<=3){for(let a=1;a<=5;a++)x.push(a);x[e(373)](e(380)),x.push(n)}else if(t>n-3){x[e(373)](1),x.push(e(380));for(let a=n-4;a<=n;a++)x[e(373)](a)}else{x.push(1),x[e(373)](e(380));for(let a=t-1;a<=t+1;a++)x[e(373)](a);x.push(e(380)),x.push(n)}return x}function o(t,n){const e=i();return o=function(x,a){return x=x-369,e[x]},o(t,n)}function h(t,n,e){const x=o,a=parseFloat(t)[x(371)](2)[x(381)](/\B(?=(\d{3})+(?!\d))/g," ");return e===x(385)?n+" "+a:a+" "+n}function i(){const t=["11349459HwEIfA","split","8698HcLXUy","length","...","replace","991739rTzeJM","135hqekSg","YYYY","before","indexOf","9596880qZptoB","372zqXgVm","1150776HBVJzs","message","16iHhsSA","344hkonWR","visible","toFixed","type","push","324102tIwhLD","toString"];return i=function(){return t},i()}function b(t,n,e){const x=o;t[x(390)]=n,t[x(372)]=e,t[x(370)]=!![],setTimeout(()=>{const a=x;t[a(370)]=![]},3e3)}(function(t,n){const e=u,x=t();for(;[];)try{if(-parseInt(e(165))/1+parseInt(e(172))/2+parseInt(e(170))/3+-parseInt(e(161))/4+parseInt(e(164))/5+parseInt(e(177))/6*(-parseInt(e(169))/7)+-parseInt(e(159))/8===n)break;x.push(x.shift())}catch{x.push(x.shift())}})(p,483995);function u(t,n){const e=p();return u=function(x,a){return x=x-157,e[x]},u(t,n)}function p(){const t=["Failed to fetch VAT data:","5173880JvUuel","GET","642788ntTOAU","error","application/json","2389415dFAZdD","284289abPpaX","/wp-json/my-easy-compta/v1/settings/vats","symbol","json","2288727jjCDDR","2836494ZdtTJu","message","958592OLWYJD","/wp-json/my-easy-compta/v1/settings/vat/","/wp-json/my-easy-compta/v1/settings/get","nonce","vat_active","6tIPiyP","default_currency","Failed to fetch currency data:"];return p=function(){return t},p()}async function y(){const t=u;try{const n=await fetch(t(174),{method:"GET",headers:{"Content-Type":"application/json","X-WP-Nonce":myEasyComptaAdmin[t(175)]}});if(n.ok){const e=await n[t(168)]();let x=null,a=null,c=null;if(e[t(178)]){const r=e[t(178)],s=await fetch("/wp-json/my-easy-compta/v1/settings/currency/"+r,{method:"GET",headers:{"Content-Type":t(163),"X-WP-Nonce":myEasyComptaAdmin.nonce}});s.ok?x=(await s.json())[t(167)]:console.error(t(157),s.statusText)}if(e[t(176)]==1){const r=e.default_vat,s=await fetch(t(173)+r,{method:t(160),headers:{"Content-Type":t(163),"X-WP-Nonce":myEasyComptaAdmin[t(175)]}});s.ok?a=await s[t(168)]():console[t(162)](t(158),s.statusText);const f=await fetch(t(166),{method:t(160),headers:{"Content-Type":t(163),"X-WP-Nonce":myEasyComptaAdmin[t(175)]}});f.ok?c=await f[t(168)]():console.error(t(158),f.statusText)}else a=0,c=0;return{settings:e,currencySymbol:x,vatData:a,listVatData:c}}else{const e=await n[t(168)]();throw new Error(e[t(171)])}}catch(n){throw console.error(n),new Error(n[t(171)])}}export{l as a,h as b,d as c,y as f,_ as g,b as s};
  • my-easy-compta/trunk/assets/dist/app.min.js

    r3148192 r3155882  
    1 import{_ 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 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"},I={class:"stats shadow border"},j={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),$={class:"stat-title dark:text-slate-300"},P={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),X=[N],S={key:1},H={class:"stats shadow border"},W={class:"stat"},F=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"fas fa-receipt text-4xl"})],-1),G={class:"stat-title dark:text-slate-300"},U={class:"stat-value dark:text-slate-300 text-primary"},V={key:0},L=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),Q=[L],q={key:1},D={key:0},J={key:1},O={class:"stat-desc"},R={class:"stats shadow border"},Z={class:"stat"},z=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"far fa-money-bill-alt text-4xl"})],-1),K={class:"stat-title dark:text-slate-300"},Y={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},fs=t("div",{class:"stat-desc"},null,-1);function xs(s,n,r,c,e,l){return a(),o("div",T,[t("div",A,[t("div",I,[t("div",j,[M,t("div",$,i(l.translations.unpaid),1),t("div",P,[e.loading?(a(),o("div",B,X)):(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",H,[t("div",W,[F,t("div",G,i(l.translations.expenses),1),t("div",U,[e.loading?(a(),o("div",V,Q)):(a(),o("div",q,[e.MonthExpenses?(a(),o("span",D,i(e.MonthExpenses)+i(e.symbol),1)):(a(),o("span",J," 0"+i(e.symbol),1))]))]),t("div",O,i(l.translations.current_month),1)])]),t("div",R,[t("div",Z,[z,t("div",K,i(l.translations.earnings),1),t("div",Y,[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))]))]),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 js(s,n,r,c,e,l){return a(),o("div",null,[t("div",ks,i(l.translations.annual_payments_overview),1),bs,t("div",Es,[e.loading?(a(),o("div",Cs,As)):(a(),o("canvas",Is))])])}var Ms=u(ws,[["render",js]]);const $s={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}}}},Ps={class:"text-xl font-semibold"},Bs=t("div",{class:"divider mt-2"},null,-1),Ns={class:"overflow-x-auto"},Xs={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),Hs=[Ss],Ws={key:1},Fs={class:"text-gray-500"},Gs={key:2,class:"table table-xs ecwp-table-dash-invoice"},Us={class:"badge badge-outline badge-success badge-sm"};function Vs(s,n,r,c,e,l){return a(),o("div",null,[t("div",Ps,i(l.translations.recently_paid_invoice),1),Bs,t("div",Ns,[e.loading?(a(),o("div",Xs,Hs)):e.recentPayments.length===0?(a(),o("div",Ws,[t("div",Fs,i(l.translations.no_data_for_moment),1)])):(a(),o("table",Gs,[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",Us,i(d.method_name),1)])]))),128))])]))])])}var Ls=u($s,[["render",Vs]]);const Qs={name:"Dashboard",components:{Stats:gs,BarChart:Ms,InvoicesHistory:Ls},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}}},qs={class:"relative pt-2 pr-4"},Ds={class:"ecwp-swap swap swap-rotate bg-base-100 p-2 mt-10"},Js=t("i",{class:"swap-off far fa-sun text-xl"},null,-1),Os=t("i",{class:"swap-on far fa-moon text-xl"},null,-1),Rs={class:"grid lg:grid-cols-3 mt-4 grid-cols-1 gap-6"},Zs={class:"card w-full p-6 bg-base-100 shadow-xl col-span-2 mt-4"},zs={class:"card w-full p-6 bg-base-100 shadow-xl mt-4"};function Ks(s,n,r,c,e,l){const d=p("Stats"),g=p("BarChart"),w=p("InvoicesHistory");return a(),o("div",qs,[t("label",Ds,[t("input",{type:"checkbox",class:"theme-controller",onChange:n[0]||(n[0]=(...k)=>l.toggleTheme&&l.toggleTheme(...k))},null,32),Js,Os]),v(d),t("div",Rs,[t("div",Zs,[v(g)]),t("div",zs,[v(w)])])])}var Ys=u(Qs,[["render",Ks]]);function _(){const s=["1485351TtyEIb","301244rwaLXq","2416696tMNoBW","#my-easy-compta-admin-app","15471SiUThc","119227XjhoOu","mount","126FLJdYK","3965230ghClJX","8rwfQQQ","5kVzlXO","46518UrIrnq"];return _=function(){return s},_()}const y=m;function m(s,n){const r=_();return m=function(c,e){return c=c-398,r[c]},m(s,n)}(function(s,n){const r=m,c=s();for(;[];)try{if(-parseInt(r(408))/1*(parseInt(r(400))/2)+-parseInt(r(407))/3+parseInt(r(404))/4*(parseInt(r(401))/5)+-parseInt(r(402))/6*(parseInt(r(398))/7)+parseInt(r(405))/8+parseInt(r(403))/9+parseInt(r(399))/10===n)break;c.push(c.shift())}catch{c.push(c.shift())}})(_,317341);const st=b({render:()=>E(Ys)});st[y(409)](y(406));
     1import{_ as p,o as a,c as o,a as t,t as i,F as y,r as f,b as h,d as u,e as v,f as k,h as b}from"./plugin-vue_export-helper.min.js";const E={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}}},C={class:"mt-8"},T={class:"grid lg:grid-cols-4 mt-2 md:grid-cols-2 grid-cols-1 gap-6"},A={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),j={class:"stat-title dark:text-slate-300"},P={class:"stat-value dark:text-slate-300 text-primary"},$={key:0},B=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=[B],S={key:1},H={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),F={class:"stat-title dark:text-slate-300"},G={class:"stat-value dark:text-slate-300 text-primary"},z={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),D=[V],L={key:1},R={key:0},U={key:1},Z={class:"stat-desc"},q={class:"stats shadow border"},J={class:"stat"},K=t("div",{class:"stat-figure dark:text-slate-300 text-primary"},[t("i",{class:"far fa-money-bill-alt text-4xl"})],-1),O={class:"stat-title dark:text-slate-300"},Q={class:"stat-value dark:text-slate-300 text-primary"},Y={key:0},ss=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),ts=[ss],es={key:1},ns={key:0},as={key:1},os={class:"stat-desc"},is={class:"stats shadow border"},rs={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),cs={class:"stat-title dark:text-slate-300"},ds={class:"stat-value dark:text-slate-300 text-primary"},hs={key:0},_s=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),ms=[_s],ps={key:1},us={key:0},vs={key:1},ys=t("div",{class:"stat-desc"},null,-1);function fs(s,n,r,c,e,l){return a(),o("div",C,[t("div",T,[t("div",A,[t("div",I,[M,t("div",j,i(l.translations.unpaid),1),t("div",P,[e.loading?(a(),o("div",$,N)):(a(),o("div",S,[(a(!0),o(y,null,f(e.unpaidAmountsByCurrency,d=>(a(),o("div",{key:d.currencyId},i(d.total_amount)+i(d.symbol),1))),128))]))])])]),t("div",H,[t("div",W,[X,t("div",F,i(l.translations.expenses),1),t("div",G,[e.loading?(a(),o("div",z,D)):(a(),o("div",L,[e.MonthExpenses?(a(),o("span",R,i(e.MonthExpenses)+i(e.symbol),1)):(a(),o("span",U," 0"+i(e.symbol),1))]))]),t("div",Z,i(l.translations.current_month),1)])]),t("div",q,[t("div",J,[K,t("div",O,i(l.translations.earnings),1),t("div",Q,[e.loading?(a(),o("div",Y,ts)):(a(),o("div",es,[e.currentMonthEarnings?(a(),o("span",ns,i(e.currentMonthEarnings.total)+" "+i(e.currentMonthEarnings.default_currency_symbol),1)):(a(),o("span",as," 0"+i(e.symbol),1))]))]),t("div",os,i(l.translations.current_month),1)])]),t("div",is,[t("div",rs,[ls,t("div",cs,i(l.translations.all_Earnings),1),t("div",ds,[e.loading?(a(),o("div",hs,ms)):(a(),o("div",ps,[e.totalEarnings?(a(),o("span",us,i(e.totalEarnings.total)+" "+i(e.totalEarnings.default_currency_symbol),1)):(a(),o("span",vs," 0"+i(e.totalEarnings.default_currency_symbol),1))]))]),ys])])])])}var xs=p(E,[["render",fs]]);const gs={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}}}})}}},ws={class:"text-xl font-semibold"},ks=t("div",{class:"divider mt-2"},null,-1),bs={class:"h-full w-full pb-6"},Es={key:0},Cs=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),Ts=[Cs],As={key:1,id:"bar-chart"};function Is(s,n,r,c,e,l){return a(),o("div",null,[t("div",ws,i(l.translations.annual_payments_overview),1),ks,t("div",bs,[e.loading?(a(),o("div",Es,Ts)):(a(),o("canvas",As))])])}var Ms=p(gs,[["render",Is]]);const js={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}}}},Ps={class:"text-xl font-semibold"},$s=t("div",{class:"divider mt-2"},null,-1),Bs={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),Hs=[Ss],Ws={key:1},Xs={class:"text-gray-500"},Fs={key:2,class:"table table-xs ecwp-table-dash-invoice"},Gs={class:"badge badge-outline badge-success badge-sm"};function zs(s,n,r,c,e,l){return a(),o("div",null,[t("div",Ps,i(l.translations.recently_paid_invoice),1),$s,t("div",Bs,[e.loading?(a(),o("div",Ns,Hs)):e.recentPayments.length===0?(a(),o("div",Ws,[t("div",Xs,i(l.translations.no_data_for_moment),1)])):(a(),o("table",Fs,[t("tbody",null,[(a(!0),o(y,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",Gs,i(d.method_name),1)])]))),128))])]))])])}var Vs=p(js,[["render",zs]]);const Ds={name:"Dashboard",components:{Stats:xs,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}}},Ls={class:"relative pt-2 pr-4"},Rs={class:"ecwp-swap swap swap-rotate bg-base-100 p-2 mt-10"},Us=t("i",{class:"swap-off far fa-sun text-xl"},null,-1),Zs=t("i",{class:"swap-on far fa-moon text-xl"},null,-1),qs={class:"grid lg:grid-cols-3 mt-4 grid-cols-1 gap-6"},Js={class:"card w-full p-6 bg-base-100 shadow-xl col-span-2 mt-4"},Ks={class:"card w-full p-6 bg-base-100 shadow-xl mt-4"};function Os(s,n,r,c,e,l){const d=u("Stats"),x=u("BarChart"),g=u("InvoicesHistory");return a(),o("div",Ls,[t("label",Rs,[t("input",{type:"checkbox",class:"theme-controller",onChange:n[0]||(n[0]=(...w)=>l.toggleTheme&&l.toggleTheme(...w))},null,32),Us,Zs]),v(d),t("div",qs,[t("div",Js,[v(x)]),t("div",Ks,[v(g)])])])}var Qs=p(Ds,[["render",Os]]);const Ys=_;function _(s,n){const r=m();return _=function(c,e){return c=c-100,r[c]},_(s,n)}(function(s,n){const r=_,c=s();for(;[];)try{if(parseInt(r(106))/1*(parseInt(r(109))/2)+-parseInt(r(110))/3+-parseInt(r(103))/4+parseInt(r(102))/5*(-parseInt(r(101))/6)+parseInt(r(108))/7*(-parseInt(r(105))/8)+parseInt(r(107))/9+parseInt(r(100))/10===n)break;c.push(c.shift())}catch{c.push(c.shift())}})(m,940341);const st=k({render:()=>b(Qs)});st.mount(Ys(104));function m(){const s=["#my-easy-compta-admin-app","312OhtLtd","5hyFzEn","5737104vMbrLz","234241VBvITa","115148QXKyrV","1984722bpzoqY","24288150dcdpex","1302852ASWsrl","5BPwDzo","920108yNSzAJ"];return m=function(){return s},m()}
  • my-easy-compta/trunk/assets/dist/clients.min.js

    r3148192 r3155882  
    1 import{_ as oe,o as y,c as _,n as M,a,t as h,g as N,w as Je,i as A,v as W,F as T,r as R,j as Ee,k as We,l as _t,m as K,d as z,e as V,p as gt,f as bt,h as wt}from"./plugin-vue_export-helper.min.js";import{C as xt,R as Et}from"./RemoveAlert.min.js";import{g as vt,f as Ct,s as St}from"./api.min.js";import{r as Tt}from"./index.min.js";import"./VueSearchSelect.min.js";import"./vue-datepicker.min.js";import"./vue3-editor.common.min.js";function Ke(e,t){return function(){return e.apply(t,arguments)}}const{toString:Rt}=Object.prototype,{getPrototypeOf:ve}=Object,re=(e=>t=>{const n=Rt.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 Ot(e){return e!==null&&!X(e)&&e.constructor!==null&&!X(e.constructor)&&O(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Xe=D("ArrayBuffer");function At(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Xe(e.buffer),t}const Pt=ie("string"),O=ie("function"),$e=ie("number"),ae=e=>e!==null&&typeof e=="object",kt=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)},Dt=D("Date"),Nt=D("File"),Bt=D("Blob"),Ft=D("FileList"),Lt=e=>ae(e)&&O(e.pipe),Mt=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"),[jt,It,qt,Ht]=["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 Ge(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 pe(){const{caseless:e}=Ye(this)&&this||{},t={},n=(s,o)=>{const r=e&&Ge(t,o)||o;G(t[r])&&G(s)?t[r]=pe(t[r],s):G(s)?t[r]=pe({},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 Vt=(e,t,n,{allOwnKeys:s}={})=>($(t,(o,r)=>{n&&O(o)?e[r]=Ke(o,n):e[r]=o},{allOwnKeys:s}),e),Jt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Wt=(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)},Kt=(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},Xt=(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},$t=e=>{if(!e)return null;if(I(e))return e;let t=e.length;if(!$e(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Gt=(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},Zt=D("HTMLFormElement"),en=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,o){return s.toUpperCase()+o}),ke=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),tn=D("RegExp"),Ze=(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)},nn=e=>{Ze(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+"'")})}})},sn=(e,t)=>{const n={},s=o=>{o.forEach(r=>{n[r]=!0})};return I(e)?s(e):s(String(e).split(t)),n},on=()=>{},rn=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,ue="abcdefghijklmnopqrstuvwxyz",De="0123456789",et={DIGIT:De,ALPHA:ue,ALPHA_DIGIT:ue+ue.toUpperCase()+De},an=(e=16,t=et.ALPHA_DIGIT)=>{let n="";const{length:s}=t;for(;e--;)n+=t[Math.random()*s|0];return n};function ln(e){return!!(e&&O(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const cn=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)},dn=D("AsyncFunction"),un=e=>e&&(ae(e)||O(e))&&O(e.then)&&O(e.catch);var l={isArray:I,isArrayBuffer:Xe,isBuffer:Ot,isFormData:Mt,isArrayBufferView:At,isString:Pt,isNumber:$e,isBoolean:kt,isObject:ae,isPlainObject:G,isReadableStream:jt,isRequest:It,isResponse:qt,isHeaders:Ht,isUndefined:X,isDate:Dt,isFile:Nt,isBlob:Bt,isRegExp:tn,isFunction:O,isStream:Lt,isURLSearchParams:Ut,isTypedArray:Gt,isFileList:Ft,forEach:$,merge:pe,extend:Vt,trim:zt,stripBOM:Jt,inherits:Wt,toFlatObject:Kt,kindOf:re,kindOfTest:D,endsWith:Xt,toArray:$t,forEachEntry:Qt,matchAll:Yt,isHTMLForm:Zt,hasOwnProperty:ke,hasOwnProp:ke,reduceDescriptors:Ze,freezeMethods:nn,toObjectSet:sn,toCamelCase:en,noop:on,toFiniteNumber:rn,findKey:Ge,global:Qe,isContextDefined:Ye,ALPHABET:et,generateString:an,isSpecCompliantForm:ln,toJSONObject:cn,isAsyncFn:dn,isThenable:un};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 tt=g.prototype,nt={};["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=>{nt[e]={value:e}});Object.defineProperties(g,nt);Object.defineProperty(tt,"isAxiosError",{value:!0});g.from=(e,t,n,s,o,r)=>{const i=Object.create(tt);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 fn=null;function ye(e){return l.isPlainObject(e)||l.isArray(e)}function st(e){return l.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(o,r){return o=st(o),!n&&r?"["+o+"]":o}).join(n?".":""):t}function mn(e){return l.isArray(e)&&!e.some(ye)}const hn=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 m(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=st(b),S.forEach(function(E,H){!(l.isUndefined(E)||E===null)&&t.append(i===!0?Ne([b],H,r):i===null?b:b+"[]",m(E))}),!1}return ye(p)?!0:(t.append(Ne(C,b,r),m(p)),!1)}const u=[],w=Object.assign(hn,{defaultVisitor:d,convertValue:m,isVisitable:ye});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 Be(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function Ce(e,t){this._pairs=[],e&&le(e,this,t)}const ot=Ce.prototype;ot.append=function(t,n){this._pairs.push([t,n])};ot.toString=function(t){const n=t?function(s){return t.call(this,s,Be)}:Be;return this._pairs.map(function(o){return n(o[0])+"="+n(o[1])},"").join("&")};function pn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function rt(e,t,n){if(!t)return e;const s=n&&n.encode||pn,o=n&&n.serialize;let r;if(o?r=o(t,n):r=l.isURLSearchParams(t)?t.toString():new Ce(t,n).toString(s),r){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+r}return e}class yn{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 Fe=yn,it={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_n=typeof URLSearchParams!="undefined"?URLSearchParams:Ce,gn=typeof FormData!="undefined"?FormData:null,bn=typeof Blob!="undefined"?Blob:null,wn={isBrowser:!0,classes:{URLSearchParams:_n,FormData:gn,Blob:bn},protocols:["http","https","file","blob","url","data"]};const Se=typeof window!="undefined"&&typeof document!="undefined",xn=(e=>Se&&["ReactNative","NativeScript","NS"].indexOf(e)<0)(typeof navigator!="undefined"&&navigator.product),En=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),vn=Se&&window.location.href||"http://localhost";var Cn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Se,hasStandardBrowserWebWorkerEnv:En,hasStandardBrowserEnv:xn,origin:vn},Symbol.toStringTag,{value:"Module"})),P={...Cn,...wn};function Sn(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 Tn(e){return l.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Rn(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 at(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]=Rn(o[i])),!c)}if(l.isFormData(e)&&l.isFunction(e.entries)){const n={};return l.forEachEntry(e,(s,o)=>{t(Tn(s),o,n,0)}),n}return null}function On(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 Te={transitional:it,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(at(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 Sn(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),On(t)):t}],transformResponse:[function(t){const n=this.transitional||Te.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=>{Te.headers[e]={}});var Re=Te;const An=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 Pn=e=>{const t={};let n,s,o;return e&&e.split(`
    2 `).forEach(function(i){o=i.indexOf(":"),n=i.substring(0,o).trim().toLowerCase(),s=i.substring(o+1).trim(),!(!n||t[n]&&An[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 J(e){return e&&String(e).trim().toLowerCase()}function Q(e){return e===!1||e==null?e:l.isArray(e)?e.map(Q):String(e)}function kn(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 Dn=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 Nn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function Bn(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,m){const d=J(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||m===!0||m===void 0&&o[u]!==!1)&&(o[u||f]=Q(c))}const i=(c,f)=>l.forEach(c,(m,d)=>r(m,d,f));if(l.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(l.isString(t)&&(t=t.trim())&&!Dn(t))i(Pn(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=J(t),t){const s=l.findKey(this,t);if(s){const o=this[s];if(!n)return o;if(n===!0)return kn(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=J(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=J(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]=Q(o),delete n[r];return}const c=t?Nn(r):String(r).trim();c!==r&&delete n[r],n[c]=Q(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=J(i);s[c]||(Bn(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 me(e,t){const n=this||Re,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 lt(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 ct(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 Fn(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 m=Date.now(),d=s[r];i||(i=m),n[o]=f,s[o]=m;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),m-i<t)return;const x=d&&m-d;return x?Math.round(w*1e3/x):void 0}}function Mn(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 Z=(e,t,n=3)=>{let s=0;const o=Ln(50,250);return Mn(r=>{const i=r.loaded,c=r.lengthComputable?r.total:void 0,f=i-s,m=o(f),d=i<=c;s=i;const u={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:m||void 0,estimated:m&&c&&d?(c-i)/m: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}}(),jn=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 In(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function dt(e,t){return e&&!In(t)?qn(e,t):t}const Me=e=>e instanceof k?{...e}:e;function U(e,t){t=t||{};const n={};function s(m,d,u){return l.isPlainObject(m)&&l.isPlainObject(d)?l.merge.call({caseless:u},m,d):l.isPlainObject(d)?l.merge({},d):l.isArray(d)?d.slice():d}function o(m,d,u){if(l.isUndefined(d)){if(!l.isUndefined(m))return s(void 0,m,u)}else return s(m,d,u)}function r(m,d){if(!l.isUndefined(d))return s(void 0,d)}function i(m,d){if(l.isUndefined(d)){if(!l.isUndefined(m))return s(void 0,m)}else return s(void 0,d)}function c(m,d,u){if(u in t)return s(m,d);if(u in e)return s(void 0,m)}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:(m,d)=>o(Me(m),Me(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 ut=e=>{const t=U({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:o,xsrfCookieName:r,headers:i,auth:c}=t;t.headers=i=k.from(i),t.url=rt(dt(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[m,...d]=f?f.split(";").map(u=>u.trim()).filter(Boolean):[];i.setContentType([m||"multipart/form-data",...d].join("; "))}}if(P.hasStandardBrowserEnv&&(s&&l.isFunction(s)&&(s=s(t)),s||s!==!1&&Un(t.url))){const m=o&&r&&jn.read(r);m&&i.set(o,m)}return t};const Hn=typeof XMLHttpRequest!="undefined";var zn=Hn&&function(e){return new Promise(function(n,s){const o=ut(e);let r=o.data;const i=k.from(o.headers).normalize();let{responseType:c}=o,f;function m(){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};ct(function(S){n(S),m()},function(S){s(S),m()},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||it;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",Z(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Z(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=Fn(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 Vn=(e,t)=>{let n=new AbortController,s;const o=function(f){if(!s){s=!0,i();const m=f instanceof Error?f:this.reason;n.abort(m instanceof g?m:new q(m instanceof Error?m.message:m))}};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=Vn;const Wn=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},Kn=async function*(e,t,n){for await(const s of e)yield*Wn(ArrayBuffer.isView(s)?s:await n(String(s)),t)},Ue=(e,t,n,s,o)=>{const r=Kn(e,t,o);let i=0;return new ReadableStream({type:"bytes",async pull(c){const{done:f,value:m}=await r.next();if(f){c.close(),s();return}let d=m.byteLength;n&&n(i+=d),c.enqueue(new Uint8Array(m))},cancel(c){return s(c),r.return()}},{highWaterMark:2})},je=(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",ft=de&&typeof ReadableStream=="function",_e=de&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Xn=ft&&(()=>{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})(),Ie=64*1024,ge=ft&&!!(()=>{try{return l.isReadableStream(new Response("").body)}catch{}})(),ee={stream:ge&&(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 $n=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 _e(e)).byteLength},Gn=async(e,t)=>{const n=l.toFiniteNumber(e.getContentLength());return n==null?$n(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:m,headers:d,withCredentials:u="same-origin",fetchOptions:w}=ut(e);m=m?(m+"").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&&Xn&&n!=="get"&&n!=="head"&&(B=await Gn(d,s))!==0){let F=new Request(t,{method:"POST",body:s,duplex:"half"}),j;l.isFormData(s)&&(j=F.headers.get("content-type"))&&d.setContentType(j),F.body&&(s=Ue(F.body,Ie,je(B,Z(f)),null,_e))}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=ge&&(m==="stream"||m==="response");if(ge&&(c||H)){const F={};["status","statusText","headers"].forEach(Pe=>{F[Pe]=E[Pe]});const j=l.toFiniteNumber(E.headers.get("content-length"));E=new Response(Ue(E.body,Ie,c&&je(j,Z(c,!0)),H&&S,_e),F)}m=m||"text";let yt=await ee[l.findKey(ee,m)||"text"](E,e);return!H&&S(),p&&p(),await new Promise((F,j)=>{ct(F,j,{data:yt,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 be={http:fn,xhr:zn,fetch:Qn};l.forEach(be,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const qe=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=be[(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 :
    4 `+r.map(qe).join(`
    5 `):" "+qe(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:be};function he(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new q(null,e)}function He(e){return he(e),e.headers=k.from(e.headers),e.data=me.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),mt.getAdapter(e.adapter||Re.adapter)(e).then(function(s){return he(e),s.data=me.call(e,e.transformResponse,s),s.headers=k.from(s.headers),s},function(s){return lt(s)||(he(e),s&&s.response&&(s.response.data=me.call(e,e.transformResponse,s.response),s.response.headers=k.from(s.response.headers))),Promise.reject(s)})}const ht="1.7.2",Oe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Oe[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const ze={};Oe.transitional=function(t,n,s){function o(r,i){return"[Axios v"+ht+"] 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 Zn(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 we={assertOptions:Zn,validators:Oe};const L=we.validators;class te{constructor(t){this.defaults=t,this.interceptors={request:new Fe,response:new Fe}}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=U(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:r}=n;s!==void 0&&we.assertOptions(s,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:we.assertOptions(o,{encode:L.function,serialize:L.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 m=[];this.interceptors.response.forEach(function(b){m.push(b.fulfilled,b.rejected)});let d,u=0,w;if(!f){const p=[He.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,m),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=He.call(this,x)}catch(p){return Promise.reject(p)}for(u=0,w=m.length;u<w;)d=d.then(m[u++],m[u++]);return d}getUri(t){t=U(this.defaults,t);const n=dt(t.baseURL,t.url);return rt(n,t.params,t.paramsSerializer)}}l.forEach(["delete","get","head","options"],function(t){te.prototype[t]=function(n,s){return this.request(U(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(U(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 Y=te;class Ae{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 Ae(function(o){t=o}),cancel:t}}}var es=Ae;function ts(e){return function(n){return e.apply(null,n)}}function ns(e){return l.isObject(e)&&e.isAxiosError===!0}const xe={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(xe).forEach(([e,t])=>{xe[t]=e});var ss=xe;function pt(e){const t=new Y(e),n=Ke(Y.prototype.request,t);return l.extend(n,Y.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return pt(U(e,o))},n}const v=pt(Re);v.Axios=Y;v.CanceledError=q;v.CancelToken=es;v.isCancel=lt;v.VERSION=ht;v.toFormData=le;v.AxiosError=g;v.Cancel=v.CanceledError;v.all=function(t){return Promise.all(t)};v.spread=ts;v.isAxiosError=ns;v.mergeConfig=U;v.AxiosHeaders=k;v.formToJSON=e=>at(l.isHTMLForm(e)?new FormData(e):e);v.getAdapter=mt.getAdapter;v.HttpStatusCode=ss;v.default=v;var Ve=v;const os={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,Ve.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(){Ve.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()}},rs={id:"modal_clients",class:"modal"},is={class:"modal-box"},as={class:"font-bold text-lg"},ls={key:0,class:"grid grid-cols-1 gap-4"},cs={class:"ecwp-group form-group relative join"},ds={for:"siret",class:"ecwp-label form-label"},us=["disabled"],fs={key:0,class:"loading loading-spinner loading-sm"},ms={key:1},hs={class:"grid grid-cols-1 gap-4"},ps={class:"ecwp-group form-group relative"},ys={for:"siren",class:"ecwp-label form-label"},_s={class:"grid grid-cols-1 gap-4"},gs={class:"ecwp-group form-group relative"},bs={for:"tax_number",class:"ecwp-label form-label"},ws={class:"grid grid-cols-2 gap-4"},xs=["for"],Es=["id","onUpdate:modelValue","required"],vs=["value"],Cs=["value"],Ss=["type","id","onUpdate:modelValue","required"],Ts={class:"ecwp-group form-group mt-4 relative"},Rs=["for"],Os={key:1,class:"ecwp-group form-group mt-6 w-52 flex justify-between"},As={class:"form-group mt-4 flex justify-end"},Ps=["disabled"],ks={key:0,class:"loading loading-spinner loading-sm"};function Ds(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["alert",o.toast.type,"text-white"])},[a("span",null,h(o.toast.message),1)],2)],2)):N("",!0),a("dialog",rs,[a("div",is,[a("h3",as,h(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",ls,[a("div",cs,[a("label",ds,h(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),[[W,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",fs)):(y(),_("span",ms,h(r.translations.search),1))],8,us)])])):N("",!0),a("div",hs,[a("div",ps,[a("label",ys,h(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),[[W,o.formData.siren_number]])])]),a("div",_s,[a("div",gs,[a("label",bs,h(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),[[W,o.formData.tax_number]])])]),a("div",ws,[(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"},h(i.label),9,xs),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},h(r.translations.default_currency),9,vs),(y(!0),_(T,null,R(r.getOptions(c),f=>(y(),_("option",{key:f.id,value:f.id},h(f.name)+" - "+h(f.code)+" ("+h(f.symbol)+") ",9,Cs))),128))],8,Es)),[[Ee,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,Ss)),[[We,o.formData[c]]])]))),128))]),a("div",Ts,[a("label",{for:e.key,class:"ecwp-label form-label"},h(r.translations.note),9,Rs),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),[[W,o.formData.note]])]),o.options.addon_user_active?(y(),_("div",Os,[a("label",null,h(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),[[_t,o.formData.user_create]])])):N("",!0),a("div",As,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(h(r.translations.add)+" ",1),o.loadingBtn?(y(),_("span",ks)):N("",!0)],8,Ps)])],32)])])])}var Ns=oe(os,[["render",Ds]]);const Bs={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"}}},Fs=["id","open"],Ls={class:"modal-box"},Ms={class:"font-bold text-lg"},Us={key:0},js={class:"grid grid-cols-2 gap-4"},Is=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),qs=a("div",{class:"skeleton h-4 w-full"},null,-1),Hs=[Is,qs],zs={key:1},Vs={class:"grid grid-cols-2 gap-4"},Js={key:0,class:"py-2"},Ws={class:"text-sm font-medium text-gray-500"},Ks={class:"mt-1 text-sm text-gray-900"},Xs=a("dl",{class:"divide-y divide-gray-200"},null,-1),$s={key:1,class:"py-2"},Gs={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),Zs={class:"grid grid-cols-1 gap-4"},eo={key:0,class:"py-2"},to={class:"text-sm font-medium text-gray-500"},no={class:"mt-1 text-sm text-gray-900"},so=a("dl",{class:"divide-y divide-gray-200"},null,-1),oo={class:"grid grid-cols-2 gap-4"},ro={class:"text-sm font-medium text-gray-500"},io={class:"mt-1 text-sm text-gray-900"},ao=a("dl",{class:"divide-y divide-gray-200"},null,-1),lo={class:"grid grid-cols-2 gap-4"},co={class:"py-2"},uo={class:"text-sm font-medium text-gray-500"},fo={class:"mt-1 text-sm text-gray-900"},mo=a("dl",{class:"divide-y divide-gray-200"},null,-1),ho={class:"py-2"},po={class:"text-sm font-medium text-gray-500"},yo={class:"mt-1 text-sm text-gray-900"},_o=a("dl",{class:"divide-y divide-gray-200"},null,-1),go={key:2},bo={class:"grid grid-cols-2 gap-4"},wo=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),xo=a("div",{class:"skeleton h-4 w-full"},null,-1),Eo=[wo,xo];function vo(e,t,n,s,o,r){return y(),_("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Ls,[a("h3",Ms,h(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",js,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Hs))),128))])])):n.client?(y(),_("div",zs,[a("div",Vs,[n.client.siret_number!=0&&o.addon_siret_active?(y(),_("div",Js,[a("dt",Ws,h(o.translations.siret),1),a("dd",Ks,h(n.client.siret_number),1),Xs])):N("",!0),n.client.siren_number!=0?(y(),_("div",$s,[a("dt",Gs,h(o.translations.siren),1),a("dd",Qs,h(n.client.siren_number),1),Ys])):N("",!0)]),a("div",Zs,[n.client.tax_number!=0?(y(),_("div",eo,[a("dt",to,h(o.translations.tax_number),1),a("dd",no,h(n.client.tax_number),1),so])):N("",!0)]),a("div",oo,[(y(!0),_(T,null,R(r.fields,(i,c)=>(y(),_("div",{key:c,class:"py-2"},[a("dt",ro,h(i.label),1),a("dd",io,h(n.client[c]),1),ao]))),128))]),a("div",lo,[a("div",co,[a("dt",uo,h(o.translations.currency),1),a("dd",fo,h(r.getCurrencyOption(n.client.currency_id)),1),mo])]),a("div",ho,[a("dt",po,h(o.translations.note),1),a("dd",yo,h(n.client.note),1),_o])])):(y(),_("div",go,[a("div",bo,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},Eo))),128))])]))])],8,Fs)}var Co=oe(Bs,[["render",vo]]);const So={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}}},To=["id","open"],Ro={class:"modal-box"},Oo={class:"font-bold text-lg"},Ao={key:0},Po={class:"grid grid-cols-2 gap-4"},ko=a("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Do=a("div",{class:"skeleton h-4 w-full"},null,-1),No=[ko,Do],Bo={class:"grid grid-cols-2 gap-4"},Fo=["for"],Lo=["type","id","onUpdate:modelValue"],Mo={class:"grid grid-cols-2 gap-4"},Uo={class:"ecwp-group form-group"},jo={for:"currencyId",class:"ecwp-label form-label"},Io=["value"],qo={class:"ecwp-group form-group mt-4"},Ho={for:"note",class:"ecwp-label form-label"},zo={class:"form-group mt-4 flex justify-end"},Vo=["disabled"],Jo={key:0,class:"loading loading-spinner loading-sm"};function Wo(e,t,n,s,o,r){return y(),_("div",null,[o.toast.visible?(y(),_("div",{key:0,class:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["alert",o.toast.type,"text-white"])},[a("span",null,h(o.toast.message),1)],2)],2)):N("",!0),a("dialog",{id:n.modalId,class:"modal",open:n.showModal},[a("div",Ro,[a("h3",Oo,h(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",Ao,[a("div",Po,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},No))),128))])])):(y(),_("form",{key:1,onSubmit:t[3]||(t[3]=Je((...i)=>r.submitForm&&r.submitForm(...i),["prevent"])),class:"form"},[a("div",Bo,[(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"},h(i.label),9,Fo),A(a("input",{type:i.type||"text",id:c,"onUpdate:modelValue":f=>o.editedClient[c]=f,class:M(["ecwp-input input","input-bordered",i.class||"w-full"])},null,10,Lo),[[We,o.editedClient[c]]])]))),128))]),a("div",Mo,[a("div",Uo,[a("label",jo,h(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},h(i.name)+" - "+h(i.code)+" ("+h(i.symbol)+") ",9,Io))),128))],512),[[Ee,o.editedClient.currency_id]])])]),a("div",qo,[a("label",Ho,h(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),[[W,o.editedClient.note]])]),a("div",zo,[a("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:o.loadingBtn},[K(h(r.translations.save)+" ",1),o.loadingBtn?(y(),_("span",Jo)):N("",!0)],8,Vo)])],32))])],8,To)])}var Ko=oe(So,[["render",Wo]]);const Xo={name:"Clients",components:{Card:xt,AddClientModal:Ns,ClientDetailsModal:Co,ClientEditModal:Ko,RemoveModal:Et},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 Ct();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){St(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}}},$o={class:"pt-2 pr-4"},Go={class:"flex justify-between items-center"},Qo={class:"card-title"},Yo=a("i",{class:"fas fa-plus-circle"},null,-1),Zo={key:0,class:"ms-2"},er={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab1"},tr=a("i",{class:"fas fa-file-export"},null,-1),nr=["data-tip"],sr={class:"btn btn-outline btn-accent rounded-full",disabled:""},or=a("i",{class:"fas fa-file-export"},null,-1),rr=a("div",{class:"divider mt-2"},null,-1),ir={class:"flex items-center mb-4"},ar={for:"perPageSelect",class:"mr-2"},lr=["value"],cr={class:"overflow-x-auto"},dr={key:0,class:"table w-full"},ur={class:"flex justify-center"},fr={class:"flex items-center gap-3"},mr={class:"avatar"},hr={class:"mask mask-squircle w-12 h-12"},pr={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"},yr=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),_r=[yr],gr={class:"font-bold"},br={class:"text-sm opacity-50"},wr={class:"badge badge-ghost badge-sm"},xr={class:"flex justify-end"},Er=["data-tip"],vr=["onClick"],Cr=a("i",{class:"far fa-eye"},null,-1),Sr=[Cr],Tr=["data-tip"],Rr=["onClick"],Or=a("i",{class:"fas fa-pencil-alt"},null,-1),Ar=[Or],Pr=["data-tip"],kr=["onClick"],Dr=a("i",{class:"far fa-trash-alt"},null,-1),Nr=[Dr],Br={key:1},Fr=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),Mr=[Fr,Lr],Ur={class:"join ecwp_pagination mt-6 pt-4"},jr=["onClick"];function Ir(e,t,n,s,o,r){const i=z("client-details-modal"),c=z("client-edit-modal"),f=z("remove-modal"),m=z("AddClientModal"),d=z("Card");return y(),_("div",$o,[o.toast.visible?(y(),_("div",{key:0,class:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["alert",o.toast.type,"text-white"])},[a("span",null,h(o.toast.message),1)],2)],2)):N("",!0),V(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"]),V(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"]),V(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"]),V(d,{topMargin:"mt-8"},{default:gt(()=>[a("div",Go,[a("h2",Qo,h(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(h(r.translations.add)+" ",1),Yo]),o.settings.easy_compta_export_addon_active==1?(y(),_("span",Zo,[a("a",er,[K(h(r.translations.export)+" ",1),tr])])):(y(),_("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":r.translations.active_export_addon},[a("button",sr,[K(h(r.translations.export)+" ",1),or])],8,nr))])]),rr,V(m,{onClientAdded:r.fetchClients},null,8,["onClientAdded"]),a("div",ir,[a("label",ar,h(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},h(u),9,lr))),128))],544),[[Ee,o.perPage]])]),a("div",cr,[o.loading?(y(),_("div",Br,[(y(!0),_(T,null,R(o.skeletonRows,u=>(y(),_("div",{key:u,class:"flex flex-col gap-4 w-full"},Mr))),128))])):(y(),_("table",dr,[a("thead",null,[a("tr",null,[a("th",null,h(r.translations.company_name),1),a("th",null,h(r.translations.manager_name),1),a("th",null,h(r.translations.email),1),a("th",null,h(r.translations.phone),1),a("th",ur,h(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",fr,[a("div",mr,[a("div",hr,[(y(),_("svg",pr,_r))])]),a("div",null,[a("div",gr,h(u.company_name),1),a("div",br,[a("span",wr,h(u.city)+" - "+h(u.country),1)])])])]),a("td",null,h(u.manager_name),1),a("td",null,h(u.email),1),a("td",null,h(u.phone),1),a("td",xr,[a("span",{class:"lg:tooltip","data-tip":r.translations.view},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.showClientDetails(u)},Sr,8,vr)],8,Er),a("span",{class:"lg:tooltip","data-tip":r.translations.edit},[a("button",{class:"btn btn-circle mx-1",onClick:w=>r.editClient(u)},Ar,8,Rr)],8,Tr),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"},Nr,8,kr)],8,Pr)])]))),128))])])),a("div",Ur,[(y(!0),_(T,null,R(o.paginationButtons,u=>(y(),_("button",{key:u,class:M(["join-item btn",{"btn-disabled":u==="..."||u===o.currentPage}]),onClick:w=>r.goToPage(u)},h(u),11,jr))),128))])])]),_:1})])}var qr=oe(Xo,[["render",Ir]]);function ne(){const e=["168lLFUmO","30MlmNmb","mount","5TPImUY","2475918uXsMXe","5896504KLJJSC","510911emiGfX","512253vBsvvB","1858hzkJFY","10245928tGJcib","5897388gimKEn","2865bOAdFD"];return ne=function(){return e},ne()}const Hr=se;function se(e,t){const n=ne();return se=function(s,o){return s=s-238,n[s]},se(e,t)}(function(e,t){const n=se,s=e();for(;[];)try{if(parseInt(n(243))/1+parseInt(n(245))/2*(-parseInt(n(248))/3)+parseInt(n(242))/4*(-parseInt(n(240))/5)+parseInt(n(247))/6+parseInt(n(244))/7*(parseInt(n(249))/8)+-parseInt(n(241))/9*(parseInt(n(238))/10)+parseInt(n(246))/11===t)break;s.push(s.shift())}catch{s.push(s.shift())}})(ne,775389);const zr=bt({render:()=>wt(qr)});zr.use(Tt)[Hr(239)]("#my-easy-compta-clients-app");
     1import{_ as oe,o as y,c as _,n as M,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 z,e as V,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"),Lt=D("FileList"),Mt=e=>ae(e)&&O(e.pipe),Ut=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]"))},jt=D("URLSearchParams"),[It,qt,Ht,zt]=["ReadableStream","Request","Response","Headers"].map(D),Vt=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 Qe(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 Ye=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Ze=e=>!X(e)&&e!==Ye;function ye(){const{caseless:e}=Ze(this)&&this||{},t={},n=(s,o)=>{const r=e&&Qe(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},Qt=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&ve(Uint8Array)),Yt=(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])}},Zt=(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:Ut,isArrayBufferView:Pt,isString:kt,isNumber:Ge,isBoolean:Dt,isObject:ae,isPlainObject:G,isReadableStream:It,isRequest:qt,isResponse:Ht,isHeaders:zt,isUndefined:X,isDate:Nt,isFile:Bt,isBlob:Ft,isRegExp:nn,isFunction:O,isStream:Mt,isURLSearchParams:jt,isTypedArray:Qt,isFileList:Lt,forEach:$,merge:ye,extend:Wt,trim:Vt,stripBOM:Jt,inherits:Kt,toFlatObject:Xt,kindOf:re,kindOfTest:D,endsWith:$t,toArray:Gt,forEachEntry:Yt,matchAll:Zt,isHTMLForm:en,hasOwnProperty:De,hasOwnProp:De,reduceDescriptors:et,freezeMethods:sn,toObjectSet:on,toCamelCase:tn,noop:rn,toFiniteNumber:an,findKey:Qe,global:Ye,isContextDefined:Ze,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 Le=_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(`
     2`).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 Me=Symbol("internals");function W(e){return e&&String(e).trim().toLowerCase()}function Q(e){return e===!1||e==null?e:l.isArray(e)?e.map(Q):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]=Q(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]=Q(o),delete n[r];return}const c=t?Bn(r):String(r).trim();c!==r&&delete n[r],n[c]=Q(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[Me]=this[Me]={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 Ln(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Mn(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 Un(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 Z=(e,t,n=3)=>{let s=0;const o=Mn(50,250);return Un(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)},jn=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 Ue=e=>e instanceof k?{...e}:e;function U(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(Ue(h),Ue(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=U({},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&&jn(t.url))){const h=o&&r&&In.read(r);h&&i.set(o,h)}return t};const zn=typeof XMLHttpRequest!="undefined";var Vn=zn&&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",Z(o.onDownloadProgress,!0)),typeof o.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",Z(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=Ln(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)},je=(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},Qn=async(e,t)=>{const n=l.toFiniteNumber(e.getContentLength());return n==null?Gn(t):n};var Yn=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 Qn(d,s))!==0){let F=new Request(t,{method:"POST",body:s,duplex:"half"}),j;l.isFormData(s)&&(j=F.headers.get("content-type"))&&d.setContentType(j),F.body&&(s=je(F.body,qe,Ie(B,Z(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 j=l.toFiniteNumber(E.headers.get("content-length"));E=new Response(je(E.body,qe,c&&Ie(j,Z(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,j)=>{dt(F,j,{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:Vn,fetch:Yn};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}`,Zn=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,!Zn(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 :
     4`+r.map(He).join(`
     5`):" "+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 ze(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 Ve={};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&&!Ve[i]&&(Ve[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 L=xe.validators;class te{constructor(t){this.defaults=t,this.interceptors={request:new Le,response:new Le}}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=U(this.defaults,n);const{transitional:s,paramsSerializer:o,headers:r}=n;s!==void 0&&xe.assertOptions(s,{silentJSONParsing:L.transitional(L.boolean),forcedJSONParsing:L.transitional(L.boolean),clarifyTimeoutError:L.transitional(L.boolean)},!1),o!=null&&(l.isFunction(o)?n.paramsSerializer={serialize:o}:xe.assertOptions(o,{encode:L.function,serialize:L.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=[ze.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=ze.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=U(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(U(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(U(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 Y=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 Y(e),n=Xe(Y.prototype.request,t);return l.extend(n,Y.prototype,t,{allOwnKeys:!0}),l.extend(n,t,null,{allOwnKeys:!0}),n.create=function(o){return yt(U(e,o))},n}const C=yt(Oe);C.Axios=Y;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=U;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:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["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"}}},Ls=["id","open"],Ms={class:"modal-box"},Us={class:"font-bold text-lg"},js={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),zs=[qs,Hs],Vs={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"},Qs={class:"text-sm font-medium text-gray-500"},Ys={class:"mt-1 text-sm text-gray-900"},Zs=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",Ms,[a("h3",Us,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",js,[a("div",Is,[(y(!0),_(T,null,R(r.skeletonItems,i=>(y(),_("div",{key:i,class:"py-2"},zs))),128))])])):n.client?(y(),_("div",Vs,[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",Qs,m(o.translations.siren),1),a("dd",Ys,m(n.client.siren_number),1),Zs])):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,Ls)}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"},Lo=["for"],Mo=["type","id","onUpdate:modelValue"],Uo={class:"grid grid-cols-2 gap-4"},jo={class:"ecwp-group form-group"},Io={for:"currencyId",class:"ecwp-label form-label"},qo=["value"],Ho={class:"ecwp-group form-group mt-4"},zo={for:"note",class:"ecwp-label form-label"},Vo={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:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["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,Lo),A(a("input",{type:i.type||"text",id:c,"onUpdate:modelValue":f=>o.editedClient[c]=f,class:M(["ecwp-input input","input-bordered",i.class||"w-full"])},null,10,Mo),[[Ke,o.editedClient[c]]])]))),128))]),a("div",Uo,[a("div",jo,[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",zo,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",Vo,[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"},Qo={class:"flex justify-between items-center"},Yo={class:"card-title"},Zo=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},Lr=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),Mr=a("div",{class:"divider my-1"},null,-1),Ur=[Lr,Mr],jr={class:"join ecwp_pagination mt-6 pt-4"},Ir=["onClick"];function qr(e,t,n,s,o,r){const i=z("client-details-modal"),c=z("client-edit-modal"),f=z("remove-modal"),h=z("AddClientModal"),d=z("Card");return y(),_("div",Go,[o.toast.visible?(y(),_("div",{key:0,class:M(["toast",o.toast.position]),style:{zIndex:9999}},[a("div",{class:M(["alert",o.toast.type,"text-white"])},[a("span",null,m(o.toast.message),1)],2)],2)):N("",!0),V(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"]),V(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"]),V(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"]),V(d,{topMargin:"mt-8"},{default:bt(()=>[a("div",Qo,[a("h2",Yo,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),Zo]),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,V(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"},Ur))),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",jr,[(y(!0),_(T,null,R(o.paginationButtons,u=>(y(),_("button",{key:u,class:M(["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(355))/1+parseInt(n(346))/2+-parseInt(n(356))/3+parseInt(n(348))/4+parseInt(n(349))/5*(parseInt(n(353))/6)+parseInt(n(354))/7*(-parseInt(n(351))/8)+-parseInt(n(357))/9===t)break;s.push(s.shift())}catch{s.push(s.shift())}})(se,228345);function ne(e,t){const n=se();return ne=function(s,o){return s=s-346,n[s]},ne(e,t)}const zr=wt({render:()=>xt(Hr)});function se(){const e=["2512sdCZjB","mount","198294TinhoW","4893YRgzQd","33366YDUgzl","147339hQXEWy","805770OagQBe","288860wqxmwU","#my-easy-compta-clients-app","841536KGJHpN","30hYwWzv","use"];return se=function(){return e},se()}zr[pe(350)](Rt)[pe(352)](pe(347));
  • my-easy-compta/trunk/assets/dist/credits.min.js

    r3148192 r3155882  
    1 import{_ as b,d as x,o as r,c,n as f,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 E}from"./plugin-vue_export-helper.min.js";import{C as j,R}from"./RemoveAlert.min.js";import{g as B,b as M,s as S,f as A}from"./api.min.js";const D={name:"Credits",components:{Card:j,RemoveModal:R},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(o=1){this.loading=!0;const{perPage:t}=this;fetch(`/wp-json/my-easy-compta/v1/credits?page=${o}&per_page=${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>n.json()).then(n=>{this.credits=n.credits,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 credits:",n)}).finally(()=>{this.loading=!1})},generatePaginationButtons(){this.paginationButtons=B(this.currentPage,this.totalPages)},goToPage(o){o!=="..."&&this.fetchCredits(o)},perPageChanged(){this.fetchCredits()},formatAmount(o,t){return M(o,t,this.settings.currency_position)},showToast(o,t){S(this.toast,o,t)},confirmDeleteCredit(o){this.selectedCredit=o,modal_remove.showModal(),this.showRemoveModal=!0},deleteCredit(o){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/credits/${o}`,{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(o){this.loadingPdfId=o,fetch(`/wp-json/my-easy-compta/v1/credits/pdf/${o}`,{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 n=URL.createObjectURL(t);this.loadingPdfId=null,window.open(n)}).catch(t=>{this.loadingPdfId=null,console.error("There was a problem with the fetch operation:",t)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:o,currencySymbol:t,vatData:n}=await A();this.settings=o,this.default_currency_symbol=t,this.default_vat=n,this.loadingPrice=!1}catch(o){this.showToast(o.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},L={class:"pt-2 pr-4"},N={class:"flex justify-between items-center"},F={class:"card-title"},G=e("div",{class:"divider mt-2"},null,-1),U={class:"flex items-center mb-4"},O={for:"perPageSelect",class:"mr-2"},V=["value"],W={class:"overflow-x-auto"},X={key:0,class:"table w-full"},q={class:"flex justify-end"},z={key:0},Q={key:1},Y=e("span",{class:"loading loading-bars loading-sm"},null,-1),H=[Y],J={class:"flex justify-end"},K=["data-tip"],Z=["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],ce={class:"join ecwp_pagination mt-6 pt-4"},de=["onClick"];function he(o,t,n,d,a,l){const w=x("remove-modal"),P=x("Card");return r(),c("div",L,[a.toast.visible?(r(),c("div",{key:0,class:f(["toast",a.toast.position]),style:{zIndex:9999}},[e("div",{class:f(["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",N,[e("h2",F,i(l.translations.credits),1)]),G,e("div",U,[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),c(h,null,u(a.perPageOptions,s=>(r(),c("option",{key:s,value:s},i(s),9,V))),128))],544),[[I,a.perPage]])]),e("div",W,[a.loading?(r(),c("div",ae,[(r(!0),c(h,null,u(a.skeletonRows,s=>(r(),c("div",{key:s,class:"flex flex-col gap-4 w-full"},re))),128))])):(r(),c("table",X,[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),c(h,null,u(a.credits,s=>(r(),c("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(),c("div",Q,H)):(r(),c("div",z,[e("span",null,i(l.formatAmount(s.total_amount,a.default_currency_symbol)),1)]))]),e("td",J,[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,Z)],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(),c("i",ne)):g("",!0),a.loadingPdfId===s.credit_id?(r(),c("span",oe)):g("",!0)],8,se)],8,te)])]))),128))])])),e("div",ce,[(r(!0),c(h,null,u(a.paginationButtons,s=>(r(),c("button",{key:s,class:f(["join-item btn",{"btn-disabled":s==="..."||s===a.currentPage}]),onClick:p=>l.goToPage(s)},i(s),11,de))),128))])])]),_:1})])}var ue=b(D,[["render",he]]);const v=_;(function(o,t){const n=_,d=o();for(;[];)try{if(-parseInt(n(383))/1*(-parseInt(n(391))/2)+parseInt(n(384))/3+parseInt(n(389))/4+parseInt(n(382))/5*(parseInt(n(386))/6)+-parseInt(n(385))/7*(parseInt(n(390))/8)+parseInt(n(379))/9+parseInt(n(387))/10*(-parseInt(n(380))/11)===t)break;d.push(d.shift())}catch{d.push(d.shift())}})(m,975065);function _(o,t){const n=m();return _=function(d,a){return d=d-379,n[d]},_(o,t)}function m(){const o=["11SgNLTn","mount","9582100dWFBNj","211992iIfLnQ","3047397GyUQhG","6482YcMNnc","6SRnLGC","22376790dxlmgA","#my-easy-compta-credits-app","2196680nOwxkq","12904EGbpaR","2qutwDU","9117009lsyYiE"];return m=function(){return o},m()}const _e=T({render:()=>E(ue)});_e[v(381)](v(388));
     1import{_ as P,d as x,o as r,c as d,n as f,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 E}from"./plugin-vue_export-helper.min.js";import{C as j,R as S}from"./RemoveAlert.min.js";import{g as R,b as A,s as B,f as M}from"./api.min.js";const D={name:"Credits",components:{Card:j,RemoveModal:S},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(o=1){this.loading=!0;const{perPage:t}=this;fetch(`/wp-json/my-easy-compta/v1/credits?page=${o}&per_page=${t}`,{headers:{"X-WP-Nonce":myEasyComptaAdmin.nonce}}).then(n=>n.json()).then(n=>{this.credits=n.credits,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 credits:",n)}).finally(()=>{this.loading=!1})},generatePaginationButtons(){this.paginationButtons=R(this.currentPage,this.totalPages)},goToPage(o){o!=="..."&&this.fetchCredits(o)},perPageChanged(){this.fetchCredits()},formatAmount(o,t){return A(o,t,this.settings.currency_position)},showToast(o,t){B(this.toast,o,t)},confirmDeleteCredit(o){this.selectedCredit=o,modal_remove.showModal(),this.showRemoveModal=!0},deleteCredit(o){this.loading=!0,fetch(`/wp-json/my-easy-compta/v1/credits/${o}`,{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(o){this.loadingPdfId=o,fetch(`/wp-json/my-easy-compta/v1/credits/pdf/${o}`,{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 n=URL.createObjectURL(t);this.loadingPdfId=null,window.open(n)}).catch(t=>{this.loadingPdfId=null,console.error("There was a problem with the fetch operation:",t)})},async loadSettings(){try{this.loadingPrice=!0;const{settings:o,currencySymbol:t,vatData:n}=await M();this.settings=o,this.default_currency_symbol=t,this.default_vat=n,this.loadingPrice=!1}catch(o){this.showToast(o.message,"alert-error"),this.loadingPrice=!1}}},computed:{translations(){return window.myEasyComptaAdmin.easyComptaTranslations}}},V={class:"pt-2 pr-4"},F={class:"flex justify-between items-center"},L={class:"card-title"},O=e("div",{class:"divider mt-2"},null,-1),z={class:"flex items-center mb-4"},N={for:"perPageSelect",class:"mr-2"},U=["value"],X={class:"overflow-x-auto"},W={key:0,class:"table w-full"},K={class:"flex justify-end"},G={key:0},H={key:1},J=e("span",{class:"loading loading-bars loading-sm"},null,-1),Q=[J],Y={class:"flex justify-end"},Z=["data-tip"],q=["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(o,t,n,c,a,l){const w=x("remove-modal"),b=x("Card");return r(),d("div",V,[a.toast.visible?(r(),d("div",{key:0,class:f(["toast",a.toast.position]),style:{zIndex:9999}},[e("div",{class:f(["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(b,{topMargin:"mt-8"},{default:C(()=>[e("div",F,[e("h2",L,i(l.translations.credits),1)]),O,e("div",z,[e("label",N,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",W,[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",K,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",H,Q)):(r(),d("div",G,[e("span",null,i(l.formatAmount(s.total_amount,a.default_currency_symbol)),1)]))]),e("td",Y,[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,q)],8,Z),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:f(["join-item btn",{"btn-disabled":s==="..."||s===a.currentPage}]),onClick:p=>l.goToPage(s)},i(s),11,ce))),128))])])]),_:1})])}var ue=P(D,[["render",he]]);const v=_;(function(o,t){const n=_,c=o();for(;[];)try{if(-parseInt(n(479))/1*(parseInt(n(478))/2)+-parseInt(n(482))/3+parseInt(n(480))/4*(-parseInt(n(477))/5)+parseInt(n(472))/6*(parseInt(n(475))/7)+-parseInt(n(473))/8*(parseInt(n(471))/9)+-parseInt(n(474))/10+parseInt(n(476))/11*(parseInt(n(470))/12)===t)break;c.push(c.shift())}catch{c.push(c.shift())}})(m,377455);function _(o,t){const n=m();return _=function(c,a){return c=c-469,n[c]},_(o,t)}function m(){const o=["#my-easy-compta-credits-app","41121jdkmsf","mount","19709724bthbpO","585gagmYV","6UeXxpN","89384iIFuRp","2341670OEoVSQ","1693223IbHCBe","11gCSxrA","2415nMiabt","136fKzyKk","647ZAcLzv","4048SSVDVJ"];return m=function(){return o},m()}const _e=T({render:()=>E(ue)});_e[v(469)](v(481));
  • my-easy-compta/trunk/assets/dist/expenses.min.js

    r3148192 r3155882  
    1 import{_ as M,o as a,c as i,a as t,t as d,w as B,F as g,r as x,n as f,i as y,k as j,g as _,j as E,v as P,m as w,d as b,H as A,e as v,p as I,f as V,h as S}from"./plugin-vue_export-helper.min.js";import{C as U,R as O}from"./RemoveAlert.min.js";import{T as N}from"./VueSearchSelect.min.js";import{V as F}from"./vue-datepicker.min.js";import{f as X,g as R,b as W,s as q}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"},Y={class:"modal-box"},J={class:"font-bold text-lg"},L={class:"grid grid-cols-2 gap-4"},Z=["for"],Q=["type","id","onUpdate:modelValue"],G=["id"],K=["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",Y,[t("h3",J,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]=B((...h)=>o.submitForm&&o.submitForm(...h),["prevent"]))},[t("div",L,[(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,Z),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)),[[j,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,K))),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)),[[P,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),[[P,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=M(z,[["render",de]]);const pe={components:{ModelSelect:N,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}}},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"},Pe={for:"note",class:"ecwp-label form-label"},Me={class:"form-group mt-4 flex justify-end"},De=["disabled"],Ae={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",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]=B((...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)),[[j,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(),A(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(),A(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",Pe,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",Me,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(d(o.translations.save)+" ",1),n.loadingBtn?(a(),i("span",Ae)):_("",!0)],8,De)])],32))])],8,ue)])}var Be=M(pe,[["render",Te]]);const je={name:"Expenses",components:{Card:U,AddExpenseModal:ce,ExpenseEditModal:Be,RemoveModal:O},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 X();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 W(s,e,this.settings.currency_position)},showToast(s,e){q(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"}}},Ie={class:"pt-2 pr-4"},Ve={class:"flex justify-between items-center"},Se={class:"card-title"},Ue=t("i",{class:"fas fa-plus-circle"},null,-1),Oe={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"},Fe=t("i",{class:"fas fa-file-export"},null,-1),Xe=["data-tip"],Re={class:"btn btn-outline btn-accent rounded-full",disabled:""},We=t("i",{class:"fas fa-file-export"},null,-1),qe=t("div",{class:"divider mt-2"},null,-1),ze={class:"flex items-center mb-4"},He={for:"perPageSelect",class:"mr-2"},Ye=["value"],Je={class:"overflow-x-auto"},Le={key:0,class:"table w-full"},Ze={class:"flex justify-center"},Qe={key:0},Ge={key:1},Ke=t("span",{class:"loading loading-bars loading-sm"},null,-1),$e=[Ke],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",Ie,[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:I(()=>[t("div",Ve,[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",Oe,[t("a",Ne,[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),We])],8,Xe))])]),qe,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,Ye))),128))],544),[[E,n.perPage]])]),t("div",Je,[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",Le,[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",Ze,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=M(je,[["render",vt]]);const T=C;(function(s,e){const r=C,u=s();for(;[];)try{if(-parseInt(r(465))/1+parseInt(r(457))/2*(parseInt(r(456))/3)+-parseInt(r(455))/4+-parseInt(r(460))/5*(-parseInt(r(464))/6)+parseInt(r(458))/7*(parseInt(r(453))/8)+parseInt(r(462))/9*(-parseInt(r(454))/10)+-parseInt(r(461))/11*(-parseInt(r(463))/12)===e)break;u.push(u.shift())}catch{u.push(u.shift())}})(k,625794);const kt=V({render:()=>S(Et)});function k(){const s=["6ShMYAU","237613xxWPuP","mount","126216nAnaem","10COXYoH","67876kBNrbn","192438OhkdZQ","26bvXyIM","126zssAbw","#my-easy-compta-expenses-app","1075655UoEzXO","16687baufJn","8019468nvxnlw","3468zZUubH"];return k=function(){return s},k()}function C(s,e){const r=k();return C=function(u,n){return u=u-453,r[u]},C(s,e)}kt[T(466)](T(459));
     1import{_ as M,o as a,c as i,a as t,t as d,w as B,F as g,r as x,n as f,i as y,k as j,g as h,j as E,v as P,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 N}from"./RemoveAlert.min.js";import{T as O}from"./VueSearchSelect.min.js";import{V as F}from"./vue-datepicker.min.js";import{f as R,g as q,b as X,s as W}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"},J={class:"modal-box"},L={class:"font-bold text-lg"},Y={class:"grid grid-cols-2 gap-4"},Z=["for"],G=["type","id","onUpdate:modelValue"],K=["id"],Q=["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",J,[t("h3",L,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]=(..._)=>o.closeModal&&o.closeModal(..._))}," \u2715 "),t("form",{onSubmit:e[5]||(e[5]=B((..._)=>o.submitForm&&o.submitForm(..._),["prevent"]))},[t("div",Y,[(a(!0),i(g,null,x(n.fields,(_,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(_.label),11,Z),p!=="category_id"&&p!=="client_id"&&p!=="expense_date"?y((a(),i("input",{key:0,type:_.type||"text",id:p,"onUpdate:modelValue":c=>n.formData[p]=c,class:f(["ecwp-input input","input-bordered",_.class||"w-full"])},null,10,G)),[[j,n.formData[p]]]):h("",!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",_.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,Q))),128))],10,K)),[[E,n.formData.category_id]]):h("",!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]]):h("",!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]]):h("",!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]=_=>n.formData.note=_),class:"ecwp-input textarea textarea-bordered w-full peer",rows:"4",placeholder:"Note"},null,512),[[P,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)):h("",!0)],8,ie)])],32)])])])}var ce=M(z,[["render",de]]);const pe={components:{ModelSelect:O,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}}},ue=["id","open"],me={class:"modal-box"},_e={class:"font-bold text-lg"},he={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"},Pe={for:"note",class:"ecwp-label form-label"},Me={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 _=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)):h("",!0),t("dialog",{id:r.modalId,class:"modal",open:r.showModal},[t("div",me,[t("h3",_e,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",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]=B((...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)),[[j,n.editedExpense[m]]]):h("",!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]]):h("",!0),m==="client_id"?(a(),T(_,{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"])):h("",!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"])):h("",!0)]))),128))]),t("div",Ce,[t("label",Pe,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",Me,[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)):h("",!0)],8,De)])],32))])],8,ue)])}var Be=M(pe,[["render",Ae]]);const je={name:"Expenses",components:{Card:U,AddExpenseModal:ce,ExpenseEditModal:Be,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 R();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=q(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchExpenses(s)},perPageChanged(){this.fetchExpenses()},formatAmount(s,e){return X(s,e,this.settings.currency_position)},showToast(s,e){W(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),Ne={key:0,class:"ms-2"},Oe={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),Re=["data-tip"],qe={class:"btn btn-outline btn-accent rounded-full",disabled:""},Xe=t("i",{class:"fas fa-file-export"},null,-1),We=t("div",{class:"divider mt-2"},null,-1),ze={class:"flex items-center mb-4"},He={for:"perPageSelect",class:"mr-2"},Je=["value"],Le={class:"overflow-x-auto"},Ye={key:0,class:"table w-full"},Ze={class:"flex justify-center"},Ge={key:0},Ke={key:1},Qe=t("span",{class:"loading loading-bars loading-sm"},null,-1),$e=[Qe],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"],_t=t("i",{class:"far fa-trash-alt"},null,-1),ht=[_t],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 _=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)):h("",!0),v(_,{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",Ne,[t("a",Oe,[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",qe,[w(d(o.translations.export)+" ",1),Xe])],8,Re))])]),We,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,Je))),128))],544),[[E,n.perPage]])]),t("div",Le,[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",Ye,[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",Ze,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",Ke,$e)):(a(),i("div",Ge,[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)]))])):h("",!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"},ht,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=M(je,[["render",vt]]);const A=C;function k(){const s=["1799424BqCmTs","mount","937372kaAePN","6238974ZnTkwx","11205423XHPEqy","512409eAqolg","8938122JCzHsE","8xtYRaT","3AxtBPv","#my-easy-compta-expenses-app","3146675JRiOAO"];return k=function(){return s},k()}(function(s,e){const r=C,u=s();for(;[];)try{if(-parseInt(r(407))/1+-parseInt(r(402))/2+parseInt(r(410))/3*(-parseInt(r(404))/4)+parseInt(r(401))/5+parseInt(r(408))/6+-parseInt(r(405))/7+-parseInt(r(409))/8*(-parseInt(r(406))/9)===e)break;u.push(u.shift())}catch{u.push(u.shift())}})(k,826323);const kt=I({render:()=>S(Et)});function C(s,e){const r=k();return C=function(u,n){return u=u-401,r[u]},C(s,e)}kt[A(403)](A(411));
  • my-easy-compta/trunk/assets/dist/index.min.js

    r3148192 r3155882  
    1 import{s as Ds,u as ut,q as js,x as Ms,y as Kn,z as qs,A as yt,B as Ce,h as Jn,C as Jt,D as Os,E as Rs,_ as oe,d as M,o as d,c as u,n as T,a as i,t as l,g,e as D,p as re,i as F,v as K,j as Ie,m as x,w as J,F as X,r as Q,G as Zn,H as Vs}from"./plugin-vue_export-helper.min.js";import{C as Qe,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 js,x as Ms,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 M,o as c,c as d,n as k,a as i,t as l,g,e as P,p as re,i as F,v as J,j as Ie,m as w,w as K,F as X,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";/*!
    22  * vue-router v4.4.0
    33  * (c) 2024 Eduardo San Martin Morote
    44  * @license MIT
    5   */const Je=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]=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,Qs=/%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(Qs,"[").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 Ks(t){return vn(t).replace(os,"%23").replace(Xs,"%3F")}function Js(t){return t==null?"":Ks(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 h=e.indexOf("#");let m=e.indexOf("?");return h<m&&h>=0&&(m=-1),m>-1&&(a=e.slice(0,m),o=e.slice(m+1,h>-1?h:e.length),n=t(o)),h>-1&&(a=a||e.slice(0,h),f=e.slice(h,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 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)?Tn(t,e):Ee(e)?Tn(e,t):t===e}function Tn(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,f,h;for(f=0;f<a.length;f++)if(h=a[f],h!==".")if(h==="..")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(Je){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 kn(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,m=n.slice(h);return m[0]!=="/"&&(m="/"+m),Cn(m,"")}return Cn(s,t)+a+n}function mo(t,e,s,a){let n=[],o=[],f=null;const h=({state:_})=>{const v=ds(t,location),I=s.value,C=e.value;let R=0;if(_){if(s.value=v,e.value=_,f&&f===I){f=null;return}R=C?_.position-C.position:0}else a(v);n.forEach(B=>{B(s.value,I,{delta:R,type:wt.pop,direction:R?R>0?mt.forward:mt.back:mt.unknown})})};function m(){f=s.value}function r(_){n.push(_);const v=()=>{const I=n.indexOf(_);I>-1&&n.splice(I,1)};return o.push(v),v}function c(){const{history:_}=window;!_.state||_.replaceState(U({},_.state,{scroll:Ht()}),"")}function p(){for(const _ of o)_();o=[],window.removeEventListener("popstate",h),window.removeEventListener("beforeunload",c)}return window.addEventListener("popstate",h),window.addEventListener("beforeunload",c,{passive:!0}),{pauseListeners:m,listen:r,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(m,r,c){const p=t.indexOf("#"),_=p>-1?(s.host&&document.querySelector("base")?t:t.slice(p))+m:ho()+t+m;try{e[c?"replaceState":"pushState"](r,"",_),n.value=r}catch(v){console.error(v),s[c?"replace":"assign"](_)}}function f(m,r){const c=U({},e.state,An(n.value.back,m,n.value.forward,!0),r,{position:n.value.position});o(m,c,!0),a.value=m}function h(m,r){const c=U({},n.value,e.state,{forward:m,scroll:Ht()});o(c.current,c,!0);const p=U({},An(a.value,m,null),{position:c.position+1},r);o(m,p,!1),a.value=m}return{location:a,state:n,push:h,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 je(t,e){return t instanceof Error&&hs in t&&(e==null||!!(t.type&e))}const Pn="[^/]+?",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 r of t){const c=r.length?[]:[90];s.strict&&!r.length&&(n+="/");for(let p=0;p<r.length;p++){const _=r[p];let v=40+(s.sensitive?.25:0);if(_.type===0)p||(n+="/"),n+=_.value.replace(yo,"\\$&"),v+=40;else if(_.type===1){const{value:I,repeatable:C,optional:R,regexp:B}=_;o.push({name:I,repeatable:C,optional:R});const P=B||Pn;if(P!==Pn){v+=10;try{new RegExp(`(${P})`)}catch(z){throw new Error(`Invalid custom RegExp for param "${I}" (${P}): `+z.message)}}let q=C?`((?:${P})(?:/(?:${P}))*)`:`(${P})`;p||(q=R&&r.length<2?`(?:/${q})`:"/"+q),R&&(q+="?"),n+=q,v+=20,R&&(v+=-8),C&&(v+=-20),P===".*"&&(v+=-50)}c.push(v)}a.push(c)}if(s.strict&&s.end){const r=a.length-1;a[r][a[r].length-1]+=.7000000000000001}s.strict||(n+="/?"),s.end?n+="$":s.strict&&(n+="(?:/|$)");const f=new RegExp(n,s.sensitive?"":"i");function h(r){const c=r.match(f),p={};if(!c)return null;for(let _=1;_<c.length;_++){const v=c[_]||"",I=o[_-1];p[I.name]=v&&I.repeatable?v.split("/"):v}return p}function m(r){let c="",p=!1;for(const _ of t){(!p||!c.endsWith("/"))&&(c+="/"),p=!1;for(const v of _)if(v.type===0)c+=v.value;else if(v.type===1){const{value:I,repeatable:C,optional:R}=v,B=I in r?r[I]:"";if(Ee(B)&&!C)throw new Error(`Provided param "${I}" is an array but it is not repeatable (* or + modifiers)`);const P=Ee(B)?B.join("/"):B;if(!P)if(R)_.length<2&&(c.endsWith("/")?c=c.slice(0,-1):p=!0);else throw new Error(`Missing required param "${I}"`);c+=P}}return c||"/"}return{re:f,score:a,keys:o,parse:h,stringify:m}}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(Dn(a))return 1;if(Dn(n))return-1}return n.length-a.length}function Dn(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})/"${r}": ${v}`)}let s=0,a=s;const n=[];let o;function f(){o&&n.push(o),o=[]}let h=0,m,r="",c="";function p(){!r||(s===0?o.push({type:0,value:r}):s===1||s===2||s===3?(o.length>1&&(m==="*"||m==="+")&&e(`A repeatable param (${r}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:r,regexp:c,repeatable:m==="*"||m==="+",optional:m==="*"||m==="?"})):e("Invalid state to consume buffer"),r="")}function _(){r+=m}for(;h<t.length;){if(m=t[h++],m==="\\"&&s!==2){a=s,s=4;continue}switch(s){case 0:m==="/"?(r&&p(),f()):m===":"?(p(),s=1):_();break;case 4:_(),s=a;break;case 1:m==="("?s=2:Io.test(m)?_():(p(),s=0,m!=="*"&&m!=="?"&&m!=="+"&&h--);break;case 2:m===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+m:s=3:c+=m;break;case 3:p(),s=0,m!=="*"&&m!=="?"&&m!=="+"&&h--,c="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${r}"`),p(),f(),n}function Co(t,e,s){const a=bo(Eo(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 To(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,_,v){const I=!v,C=ko(p);C.aliasOf=v&&v.record;const R=qn(e,p),B=[C];if("alias"in p){const z=typeof p.alias=="string"?[p.alias]:p.alias;for(const ce of z)B.push(U({},C,{components:v?v.record.components:C.components,path:ce,aliasOf:v?v.record:C}))}let P,q;for(const z of B){const{path:ce}=z;if(_&&ce[0]!=="/"){const ne=_.record.path,Z=ne[ne.length-1]==="/"?"":"/";z.path=_.record.path+(ce&&Z+ce)}if(P=Co(z,_,R),v?v.alias.push(P):(q=q||P,q!==P&&q.alias.push(P),I&&p.name&&!Mn(P)&&f(p.name)),fs(P)&&m(P),C.children){const ne=C.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(p){if(us(p)){const _=a.get(p);_&&(a.delete(p),s.splice(s.indexOf(_),1),_.children.forEach(f),_.alias.forEach(f))}else{const _=s.indexOf(p);_>-1&&(s.splice(_,1),p.record.name&&a.delete(p.record.name),p.children.forEach(f),p.alias.forEach(f))}}function h(){return s}function m(p){const _=Po(p,s);s.splice(_,0,p),p.record.name&&!Mn(p)&&a.set(p.record.name,p)}function r(p,_){let v,I={},C,R;if("name"in p&&p.name){if(v=a.get(p.name),!v)throw nt(1,{location:p});R=v.record.name,I=U(jn(_.params,v.keys.filter(q=>!q.optional).concat(v.parent?v.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),p.params&&jn(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),R=v.record.name);else{if(v=_.name?a.get(_.name):s.find(q=>q.re.test(_.path)),!v)throw nt(1,{location:p,currentLocation:_});R=v.record.name,I=U({},_.params,p.params),C=v.stringify(I)}const B=[];let P=v;for(;P;)B.unshift(P.record),P=P.parent;return{name:R,path:C,params:I,matched:B,meta:So(B)}}t.forEach(p=>o(p));function c(){s.length=0,a.clear()}return{addRoute:o,resolve:r,removeRoute:f,clearRoutes:c,getRoutes:h,getRecordMatcher:n}}function jn(t,e){const s={};for(const a of e)a in t&&(s[a]=t[a]);return s}function ko(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 Mn(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 Po(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=Do(t);return n&&(a=e.lastIndexOf(n,a-1)),a}function Do(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 jo(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("="),h=bt(f<0?o:o.slice(0,f)),m=f<0?null:bt(o.slice(f+1));if(h in e){let r=e[h];Ee(r)||(r=e[h]=[r]),r.push(m)}else e[h]=m}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 Mo(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(""),Rn=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((h,m)=>{const r=_=>{_===!1?m(nt(4,{from:s,to:e})):_ instanceof Error?m(_):go(_)?m(nt(2,{from:e,to:_})):(f&&a.enterCallbacks[n]===f&&typeof _=="function"&&f.push(_),h())},c=o(()=>t.call(a&&a.instances[n],e,s,r));let p=Promise.resolve(c);t.length<3&&(p=p.then(r)),p.catch(_=>m(_))})}function en(t,e,s,a,n=o=>o()){const o=[];for(const f of t)for(const h in f.components){let m=f.components[h];if(!(e!=="beforeRouteEnter"&&!f.instances[h]))if(Oo(m)){const c=(m.__vccOpts||m)[e];c&&o.push(Be(c,s,a,f,h,n))}else{let r=m();o.push(()=>r.then(c=>{if(!c)return Promise.reject(new Error(`Couldn't resolve component "${h}" at "${f.path}"`));const p=Ns(c)?c.default:c;f.components[h]=p;const v=(p.__vccOpts||p)[e];return v&&Be(v,s,a,f,h,n)()}))}}return o}function Oo(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=Ce(()=>{const m=ut(t.to);return e.resolve(m)}),n=Ce(()=>{const{matched:m}=a.value,{length:r}=m,c=m[r-1],p=s.matched;if(!c||!p.length)return-1;const _=p.findIndex(tt.bind(null,c));if(_>-1)return _;const v=Nn(m[r-2]);return r>1&&Nn(c)===v&&p[p.length-1].path!==v?p.findIndex(tt.bind(null,m[r-2])):_}),o=Ce(()=>n.value>-1&&Bo(s.params,a.value.params)),f=Ce(()=>n.value>-1&&n.value===s.matched.length-1&&cs(s.params,a.value.params));function h(m={}){return No(m)?e[ut(t.replace)?"replace":"push"](ut(t.to)).catch(ht):Promise.resolve()}return{route:a,href:Ce(()=>a.value.href),isActive:o,isExactActive:f,navigate:h}}const Ro=Kn({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=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:Jn("a",{"aria-current":s.isExactActive?t.ariaCurrentValue:null,href:s.href,onClick:s.navigate,class:n.value},o)}}}),Vo=Ro;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,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=Kn({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(Rn,0),f=Ce(()=>{let r=ut(o);const{matched:c}=n.value;let p;for(;(p=c[r])&&!p.components;)r++;return r}),h=Ce(()=>n.value.matched[f.value]);Jt(Rn,Ce(()=>f.value+1)),Jt(qo,h),Jt(mn,n);const m=Os();return Rs(()=>[m.value,h.value,t.name],([r,c,p],[_,v,I])=>{c&&(c.instances[p]=r,v&&v!==c&&r&&r===_&&(c.leaveGuards.size||(c.leaveGuards=v.leaveGuards),c.updateGuards.size||(c.updateGuards=v.updateGuards))),r&&c&&(!v||!tt(c,v)||!_)&&(c.enterCallbacks[p]||[]).forEach(C=>C(r))},{flush:"post"}),()=>{const r=n.value,c=t.name,p=h.value,_=p&&p.components[c];if(!_)return Fn(s.default,{Component:_,route:r});const v=p.props[c],I=v?v===!0?r.params:typeof v=="function"?v(r):v:null,R=Jn(_,U({},I,e,{onVnodeUnmounted:B=>{B.component.isUnmounted&&(p.instances[c]=null)},ref:m}));return Fn(s.default,{Component:R,route:r})||R}}});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=To(t.routes,t),s=t.parseQuery||jo,a=t.stringifyQuery||On,n=t.history,o=lt(),f=lt(),h=lt(),m=Ds(Ne);let r=Ne;Je&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Zt.bind(null,y=>""+y),p=Zt.bind(null,Js),_=Zt.bind(null,bt);function v(y,E){let w,k;return us(y)?(w=e.getRecordMatcher(y),k=E):k=y,e.addRoute(k,w)}function I(y){const E=e.getRecordMatcher(y);E&&e.removeRoute(E)}function C(){return e.getRoutes().map(y=>y.record)}function R(y){return!!e.getRecordMatcher(y)}function B(y,E){if(E=U({},E||m.value),typeof y=="string"){const O=$t(s,y,E.path),se=e.resolve({path:O.path},E),at=n.createHref(O.fullPath);return U(O,se,{params:_(se.params),hash:bt(O.hash),redirectedFrom:void 0,href:at})}let w;if(y.path!=null)w=U({},y,{path:$t(s,y.path,E.path).path});else{const O=U({},y.params);for(const se in O)O[se]==null&&delete O[se];w=U({},y,{params:p(O)}),E.params=p(E.params)}const k=e.resolve(w,E),L=y.hash||"";k.params=c(_(k.params));const $=eo(a,U({},y,{hash:Gs(L),path:k.path})),V=n.createHref($);return U({fullPath:$,hash:L,query:a===On?Mo(y.query):y.query||{}},k,{redirectedFrom:void 0,href:V})}function P(y){return typeof y=="string"?$t(s,y,m.value.path):U({},y)}function q(y,E){if(r!==y)return nt(8,{from:E,to:y})}function z(y){return Z(y)}function ce(y){return z(U(P(y),{replace:!0}))}function ne(y){const E=y.matched[y.matched.length-1];if(E&&E.redirect){const{redirect:w}=E;let k=typeof w=="function"?w(y):w;return typeof k=="string"&&(k=k.includes("?")||k.includes("#")?k=P(k):{path:k},k.params={}),U({query:y.query,hash:y.hash,params:k.path!=null?{}:y.params},k)}}function Z(y,E){const w=r=B(y),k=m.value,L=y.state,$=y.force,V=y.replace===!0,O=ne(w);if(O)return Z(U(P(O),{state:typeof O=="object"?U({},L,O.state):L,force:$,replace:V}),E||w);const se=w;se.redirectedFrom=E;let at;return!$&&to(a,k,w)&&(at=nt(16,{to:se,from:k}),ot(k,k,!0,!1)),(at?Promise.resolve(at):Re(se,k)).catch(he=>je(he)?je(he,2)?he:kt(he):De(he,se,k)).then(he=>{if(he){if(je(he,2))return Z(U({replace:V},P(he.to),{state:typeof he.to=="object"?U({},L,he.to.state):L,force:$}),E||se)}else he=Ve(se,k,!0,V,L);return ye(se,k,he),he})}function Ue(y,E){const w=q(y,E);return w?Promise.reject(w):Promise.resolve()}function ie(y){const E=At.values().next().value;return E&&typeof E.runWithContext=="function"?E.runWithContext(y):y()}function Re(y,E){let w;const[k,L,$]=Qo(y,E);w=en(k.reverse(),"beforeRouteLeave",y,E);for(const O of k)O.leaveGuards.forEach(se=>{w.push(Be(se,y,E))});const V=Ue.bind(null,y,E);return w.push(V),Ge(w).then(()=>{w=[];for(const O of o.list())w.push(Be(O,y,E));return w.push(V),Ge(w)}).then(()=>{w=en(L,"beforeRouteUpdate",y,E);for(const O of L)O.updateGuards.forEach(se=>{w.push(Be(se,y,E))});return w.push(V),Ge(w)}).then(()=>{w=[];for(const O of $)if(O.beforeEnter)if(Ee(O.beforeEnter))for(const se of O.beforeEnter)w.push(Be(se,y,E));else w.push(Be(O.beforeEnter,y,E));return w.push(V),Ge(w)}).then(()=>(y.matched.forEach(O=>O.enterCallbacks={}),w=en($,"beforeRouteEnter",y,E,ie),w.push(V),Ge(w))).then(()=>{w=[];for(const O of f.list())w.push(Be(O,y,E));return w.push(V),Ge(w)}).catch(O=>je(O,8)?O:Promise.reject(O))}function ye(y,E,w){h.list().forEach(k=>ie(()=>k(y,E,w)))}function Ve(y,E,w,k,L){const $=q(y,E);if($)return $;const V=E===Ne,O=Je?history.state:{};w&&(k||V?n.replace(y.fullPath,U({scroll:V&&O&&O.scroll},L)):n.push(y.fullPath,L)),m.value=y,ot(y,E,w,V),kt()}let de;function Ae(){de||(de=n.listen((y,E,w)=>{if(!En.listening)return;const k=B(y),L=ne(k);if(L){Z(U(L,{replace:!0}),k).catch(ht);return}r=k;const $=m.value;Je&&co(kn($.fullPath,w.delta),Ht()),Re(k,$).catch(V=>je(V,12)?V:je(V,2)?(Z(V.to,k).then(O=>{je(O,20)&&!w.delta&&w.type===wt.pop&&n.go(-1,!1)}).catch(ht),Promise.reject()):(w.delta&&n.go(-w.delta,!1),De(V,k,$))).then(V=>{V=V||Ve(k,$,!1),V&&(w.delta&&!je(V,8)?n.go(-w.delta,!1):w.type===wt.pop&&je(V,20)&&n.go(-1,!1)),ye(k,$,V)}).catch(ht)}))}let Se=lt(),be=lt(),Pe;function De(y,E,w){kt(y);const k=be.list();return k.length?k.forEach(L=>L(y,E,w)):console.error(y),Promise.reject(y)}function Yt(){return Pe&&m.value!==Ne?Promise.resolve():new Promise((y,E)=>{Se.add([y,E])})}function kt(y){return Pe||(Pe=!y,Ae(),Se.list().forEach(([E,w])=>y?w(y):E()),Se.reset()),y}function ot(y,E,w,k){const{scrollBehavior:L}=t;if(!Je||!L)return Promise.resolve();const $=!w&&uo(kn(y.fullPath,0))||(k||!w)&&history.state&&history.state.scroll||null;return Ms().then(()=>L(y,E,$)).then(V=>V&&ro(V)).catch(V=>De(V,y,E))}const it=y=>n.go(y);let Kt;const At=new Set,En={currentRoute:m,listening:!0,addRoute:v,removeRoute:I,clearRoutes:e.clearRoutes,hasRoute:R,getRoutes:C,resolve:B,options:t,push:z,replace:ce,go:it,back:()=>it(-1),forward:()=>it(1),beforeEach:o.add,beforeResolve:f.add,afterEach:h.add,onError:be.add,isReady:Yt,install(y){const E=this;y.component("RouterLink",Vo),y.component("RouterView",Wo),y.config.globalProperties.$router=E,Object.defineProperty(y.config.globalProperties,"$route",{enumerable:!0,get:()=>ut(m)}),Je&&!Kt&&m.value===Ne&&(Kt=!0,z(n.location).catch(L=>{}));const w={};for(const L in Ne)Object.defineProperty(w,L,{get:()=>m.value[L],enumerable:!0});y.provide(yn,E),y.provide(ps,js(w)),y.provide(mn,m);const k=y.unmount;At.add(y),y.unmount=function(){At.delete(y),At.size<1&&(r=Ne,de&&de(),de=null,m.value=Ne,Kt=!1,Pe=!1),k()}}};function Ge(y){return y.reduce((E,w)=>E.then(()=>ie(w)),Promise.resolve())}return En}function Qo(t,e){const s=[],a=[],n=[],o=Math.max(e.matched.length,t.matched.length);for(let f=0;f<o;f++){const h=e.matched[f];h&&(t.matched.find(r=>tt(r,h))?a.push(h):s.push(h));const m=t.matched[f];m&&(e.matched.find(r=>tt(r,m))||n.push(m))}return[s,a,n]}const Uo={name:"QuoteEdit",components:{Card:Qe,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"},Ko={class:"grid grid-cols-3 gap-4"},Jo={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=M("VueDatePicker"),h=M("model-select"),m=M("Card");return d(),u("div",Lo,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),D(m,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",zo,[i("h2",Ho,l(o.translations.edit_quote),1)]),Go,n.loading?(d(),u("div",Yo)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=J((...r)=>o.submitQuote&&o.submitQuote(...r),["prevent"]))},[i("div",Ko,[i("div",Jo,[i("label",Zo,l(o.translations.quote_number),1),F(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.quote.quote_number=r),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[K,n.quote.quote_number]])]),i("div",$o,[i("label",ei,l(o.translations.due_date),1),D(f,{class:T(["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]=r=>n.quote.due_date=r),"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:T(["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]=r=>n.quote.provisional_start_date=r),"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(h,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=r=>n.quote.client_id=r),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:T(["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),F(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=r=>n.quote.status=r),required:"",class:T(["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),[[Ie,n.quote.status]])])]),i("div",hi,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.save)+" ",1),n.loadingBtn?(d(),u("span",fi)):g("",!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.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 d(),u("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",Ii,[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",Ei]]);const Ci={name:"QuotesList",components:{Card:Qe,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}}},Ti={class:"pt-2 pr-4"},ki={class:"flex justify-between items-center"},Ai={class:"card-title"},Si={class:"btn btn-primary rounded-full"},Pi=i("i",{class:"fas fa-plus-circle"},null,-1),Di={key:0,class:"ms-2"},ji={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab2"},Mi=i("i",{class:"fas fa-file-export"},null,-1),qi=["data-tip"],Oi={class:"btn btn-outline btn-accent rounded-full",disabled:""},Ri=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"},Xi={key:0,class:"table w-full"},Qi={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},Ki={key:0},Ji={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},Ta=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),ka=i("div",{class:"divider my-1"},null,-1),Aa=[Ta,ka],Sa={class:"join ecwp_pagination mt-6 pt-4"},Pa=["onClick"];function Da(t,e,s,a,n,o){const f=M("confirm-modal"),h=M("remove-modal"),m=M("router-link"),r=M("Card");return d(),u("div",Ti,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!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]=c=>this.duplicateQuote(n.selectedQuote)),onCancel:e[1]||(e[1]=c=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(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]=c=>this.deleteQuote(n.selectedQuote)),onCancel:e[3]||(e[3]=c=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(r,{topMargin:"mt-8"},{default:re(()=>[i("div",ki,[i("h2",Ai,l(o.translations.quotes),1),i("div",null,[D(m,{to:{name:"QuoteNew"}},{default:re(()=>[i("button",Si,[x(l(o.translations.add)+" ",1),Pi])]),_:1}),n.settings.easy_compta_export_addon_active==1?(d(),u("span",Di,[i("a",ji,[x(l(o.translations.export)+" ",1),Mi])])):(d(),u("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",Oi,[x(l(o.translations.export)+" ",1),Ri])],8,qi))])]),Vi,i("div",Ni,[i("label",Bi,l(o.translations.display_per_page),1),F(i("select",{id:"perPageSelect","onUpdate:modelValue":e[4]||(e[4]=c=>n.perPage=c),onChange:e[5]||(e[5]=(...c)=>o.perPageChanged&&o.perPageChanged(...c))},[(d(!0),u(X,null,Q(n.perPageOptions,c=>(d(),u("option",{key:c,value:c},l(c),9,Fi))),128))],544),[[Ie,n.perPage]])]),i("div",Wi,[n.loading?(d(),u("div",Ca,[(d(!0),u(X,null,Q(n.skeletonRows,c=>(d(),u("div",{key:c,class:"flex flex-col gap-4 w-full"},Aa))),128))])):(d(),u("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",Qi,l(o.translations.actions),1)])]),i("tbody",null,[(d(!0),u(X,null,Q(n.quotes,c=>(d(),u("tr",{key:c.id},[i("td",null,l(c.quote_number),1),i("td",null,l(c.client_name),1),i("td",null,[c.status=="draft"?(d(),u("span",Ui,l(o.translations.draft),1)):g("",!0),c.status=="pending"?(d(),u("span",Li,l(o.translations.pending),1)):g("",!0),c.status=="approved"?(d(),u("span",zi,l(o.translations.approved),1)):g("",!0),c.status=="rejected"?(d(),u("span",Hi,l(o.translations.rejected),1)):g("",!0)]),i("td",null,[n.loadingPrice?(d(),u("div",ta,sa)):(d(),u("div",Gi,[n.settings.vat_active==1?(d(),u("div",Yi,[n.default_currency_symbol==c.client_currency||c.client_currency==null?(d(),u("span",Ki,l(o.formatAmount(c.total_amount,n.default_currency_symbol)),1)):(d(),u("span",Ji,l(o.formatAmount(c.total_amount,c.client_currency)),1))])):(d(),u("div",Zi,[n.default_currency_symbol==c.client_currency||c.client_currency==null?(d(),u("span",$i,l(o.formatAmount(c.total_amount,n.default_currency_symbol)),1)):(d(),u("span",ea,l(o.formatAmount(c.total_amount,c.client_currency)),1))]))]))]),i("td",null,[n.loadingPrice?(d(),u("div",ia,la)):(d(),u("div",oa,l(c.due_date),1))]),i("td",null,[n.loadingPrice?(d(),u("div",ca,ua)):(d(),u("div",ra,l(c.created),1))]),i("td",ha,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[D(m,{to:{name:"QuoteViewDetail",params:{id:c.id}}},{default:re(()=>[fa]),_:2},1032,["to"])],8,ma),i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[D(m,{to:{name:"QuoteEdit",params:{id:c.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(c.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(c.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Ea,8,xa)],8,wa)])]))),128))])]))]),i("div",Sa,[(d(!0),u(X,null,Q(n.paginationButtons,c=>(d(),u("button",{key:c,class:T(["join-item btn",{"btn-disabled":c==="..."||c===n.currentPage}]),onClick:p=>o.goToPage(c)},l(c),11,Pa))),128))])]),_:1})])}var ja=oe(Ci,[["render",Da]]);const Ma={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"},Ra={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],Xa={class:"grid grid-cols-1 gap-4"},Qa=["type"],Ua=["for"],La=["id","value","disabled","onInput"],za={key:1},Ha=["for"],Ga={class:"form-group mt-4 flex justify-end"},Ya=["disabled"],Ka={key:0,class:"loading loading-spinner loading-sm"};function Ja(t,e,s,a,n,o){const f=M("vue-editor");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Oa,[i("h3",Ra,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?(d(),u("div",Va,[i("div",Na,[(d(!0),u(X,null,Q(o.skeletonItems,h=>(d(),u("div",{key:h,class:"py-2"},Wa))),128))])])):(d(),u("form",{key:1,onSubmit:e[1]||(e[1]=J((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Xa,[(d(!0),u(X,null,Q(n.fields,(h,m)=>(d(),u("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(d(),u("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Ua),i("input",{id:m,class:T(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,La)],8,Qa)):(d(),u("div",za,[i("label",{for:m,class:"form-label"},l(h.label),9,Ha),D(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,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},[x(l(o.translations.send)+" ",1),n.loadingBtn?(d(),u("span",Ka)):g("",!0)],8,Ya)])],32))])],8,qa)])}var Za=oe(Ma,[["render",Ja]]);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"},Tl=["disabled"];function kl(t,e,s,a,n,o){const f=M("VueDatePicker");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!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?(d(),u("p",il," Le montant s\xE9lectionn\xE9 d\xE9passe le montant total du devis. ")):g("",!0),i("div",al,[s.advanceSold=="no_sold"&&!n.invoiceSolded?(d(),u("div",ll,[i("div",rl,[cl,F(i("select",{"onUpdate:modelValue":e[1]||(e[1]=h=>n.selectedType=h),id:"advance-type",class:T(["ecwp-select ecwp-input input input-bordered w-full",{"input-error":!n.selectedType&&n.showError}])},hl,2),[[Ie,n.selectedType]])])])):g("",!0),n.selectedType&&s.advanceSold=="no_sold"&&!n.invoiceSolded?(d(),u("div",ml,[i("div",fl,[pl,F(i("input",{"onUpdate:modelValue":e[2]||(e[2]=h=>n.inputValue=h),type:"text",id:"advance-value",class:T([{"input-error":!n.inputValue&&n.showError},"ecwp-input input input-bordered w-full"])},null,2),[[K,n.inputValue]]),i("div",_l,[i("div",gl,[n.selectedType==="percentage"?(d(),u("span",vl,"%")):(d(),u("span",yl,l(s.currency),1))])])])])):g("",!0)]),n.selectedType==="percentage"&&!o.inputValueExceeds&!n.invoiceSolded?(d(),u("div",bl,[i("p",wl," Montant bas\xE9 sur le pourcentage: "+l(o.calculatedAmount)+" "+l(s.currency),1)])):g("",!0),n.invoiceSolded?g("",!0):(d(),u("div",xl,[i("label",Il,l(o.translations.due_date),1),D(f,{class:T(["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?(d(),u("div",El,"Facture d\xE9j\xE0 sold\xE9")):g("",!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,Tl)])])],8,el)])}var Al=oe($a,[["render",kl]]);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)}}},Pl={key:0},Dl={key:1},jl={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"},Ml=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),ql=[Ml],Ol={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Rl=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"],Xl={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Ql=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),Kl={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},Jl={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=M("send-quote-modal"),h=M("confirm-modal"),m=M("advance-modal"),r=M("router-link");return d(),u("div",null,[s.emailActive==1?(d(),u("div",Pl,[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]=c=>n.sendQuoteModal=!1)},null,8,["loading","show-modal","client","quote-id","subject","content"])])):g("",!0),D(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]=c=>this.convertToInvoice(n.selectedQuote)),onCancel:e[2]||(e[2]=c=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),s.advanceActive==1?(d(),u("div",Dl,[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,"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]=c=>t.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","total-amount","currency","quoteId","advance-sold","onConfirm"])])):g("",!0),n.toast.visible?(d(),u("div",{key:2,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),n.loading?(d(),u("div",jl,ql)):g("",!0),i("div",Ol,[i("div",null,[Rl,i("div",Vl,[D(r,{to:{name:"QuoteEdit",params:{id:s.quoteInfo.id}}},{default:re(()=>[i("button",Nl,[Bl,x(l(o.translations.edit_quote),1)])]),_:1},8,["to"]),s.quoteInfo.status=="draft"&&!s.noItems?(d(),u("button",{key:0,class:"btn btn-outline btn-success btn-sm",onClick:e[4]||(e[4]=c=>o.changeQuoteStatus("pending"))},[Fl,x(" "+l(o.translations.validate_quote),1)])):g("",!0),s.quoteInfo.status=="draft"&&s.noItems?(d(),u("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",Xl,[Ql,x(" "+l(o.translations.validate_quote),1)])],8,Wl)):g("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="rejected")&&!s.noItems?(d(),u("button",{key:2,class:"btn btn-outline btn-success btn-sm",onClick:e[5]||(e[5]=c=>o.changeQuoteStatus("approved"))},[Ul,x(" "+l(o.translations.mark_as_accepted),1)])):g("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="approved")&&!s.noItems?(d(),u("button",{key:3,class:"btn btn-outline btn-error btn-sm",onClick:e[6]||(e[6]=c=>o.changeQuoteStatus("rejected"))},[Ll,x(" "+l(o.translations.mark_as_rejected),1)])):g("",!0),s.advanceActive==1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(d(),u("div",zl,[i("div",Hl,[i("div",Gl,[Yl,x(" "+l(o.translations.convertToInvoice),1)]),i("ul",Kl,[s.quoteInfo.advance!=1?(d(),u("li",Jl,[i("a",{href:"#",onClick:e[7]||(e[7]=J(c=>o.confirmConvertQuote(s.quoteInfo.id),["prevent"]))}," Facture global ")])):g("",!0),i("li",null,[i("a",{href:"#",onClick:e[8]||(e[8]=J(c=>o.ConvertAdvanceQuote(s.quoteInfo.id,"no_sold"),["prevent"]))}," Facture d'acompte "),s.quoteInfo.advance!=0?(d(),u("a",{key:0,href:"#",onClick:e[9]||(e[9]=J(c=>o.ConvertAdvanceQuote(s.quoteInfo.id,"sold"),["prevent"]))}," Facture du solde ")):g("",!0)])])])])):g("",!0),s.advanceActive!=1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(d(),u("div",Zl,[i("button",{onClick:e[10]||(e[10]=c=>o.confirmConvertQuote(s.quoteInfo.id)),class:"btn btn-sm"},[$l,x(" "+l(o.translations.convertToInvoice),1)])])):g("",!0)])]),i("div",er,[s.emailActive==1&&!s.noItems?(d(),u("button",{key:0,onClick:e[11]||(e[11]=J(c=>o.sendQuote(s.quoteInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[tr,x(" "+l(o.translations.send_quote)+" ",1),s.quoteInfo.sent==1?(d(),u("i",nr)):g("",!0)])):s.emailActive==0?(d(),u("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",or,[ir,x(" "+l(o.translations.send_quote),1)])],8,sr)):s.emailActive==1&&s.noItems?(d(),u("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.min_article},[i("button",lr,[rr,x(" "+l(o.translations.send_quote),1)])],8,ar)):g("",!0),i("button",{onClick:e[12]||(e[12]=(...c)=>o.exportToPDF&&o.exportToPDF(...c)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[dr,x(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(d(),u("span",ur)):g("",!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"],Tr=["id","onUpdate:modelValue"],kr={key:1},Ar=["for"],Sr={class:"form-group mt-4 flex justify-end"},Pr=["disabled"],Dr={key:0,class:"loading loading-spinner loading-sm"};function jr(t,e,s,a,n,o){const f=M("vue-editor");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!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?(d(),u("div",vr,[i("div",yr,[(d(!0),u(X,null,Q(o.skeletonItems,h=>(d(),u("div",{key:h,class:"py-2"},xr))),128))])])):(d(),u("form",{key:1,onSubmit:e[1]||(e[1]=J((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Ir,[(d(!0),u(X,null,Q(n.fields,(h,m)=>(d(),u("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(d(),u("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Cr),F(i("input",{id:m,"onUpdate:modelValue":r=>n.editedItem[m]=r,class:T(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,Tr),[[K,n.editedItem[m]]])],8,Er)):(d(),u("div",kr,[i("label",{for:m,class:"form-label"},l(h.label),9,Ar),D(f,{id:m,modelValue:n.editedItem[m],"onUpdate:modelValue":r=>n.editedItem[m]=r,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},[x(l(o.translations.save)+" ",1),n.loadingBtn?(d(),u("span",Dr)):g("",!0)],8,Pr)])],32))])],8,pr)])}var Mr=oe(fr,[["render",jr]]);/**!
     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="",f="";const h=e.indexOf("#");let m=e.indexOf("?");return h<m&&h>=0&&(m=-1),m>-1&&(a=e.slice(0,m),o=e.slice(m+1,h>-1?h:e.length),n=t(o)),h>-1&&(a=a||e.slice(0,h),f=e.slice(h,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 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,f,h;for(f=0;f<a.length;f++)if(h=a[f],h!==".")if(h==="..")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 h=n.includes(t.slice(o))?t.slice(o).length:1,m=n.slice(h);return m[0]!=="/"&&(m="/"+m),Cn(m,"")}return Cn(s,t)+a+n}function mo(t,e,s,a){let n=[],o=[],f=null;const h=({state:_})=>{const v=ds(t,location),I=s.value,C=e.value;let V=0;if(_){if(s.value=v,e.value=_,f&&f===I){f=null;return}V=C?_.position-C.position:0}else a(v);n.forEach(B=>{B(s.value,I,{delta:V,type:wt.pop,direction:V?V>0?mt.forward:mt.back:mt.unknown})})};function m(){f=s.value}function r(_){n.push(_);const v=()=>{const I=n.indexOf(_);I>-1&&n.splice(I,1)};return o.push(v),v}function u(){const{history:_}=window;!_.state||_.replaceState(Q({},_.state,{scroll:Ht()}),"")}function p(){for(const _ of o)_();o=[],window.removeEventListener("popstate",h),window.removeEventListener("beforeunload",u)}return window.addEventListener("popstate",h),window.addEventListener("beforeunload",u,{passive:!0}),{pauseListeners:m,listen:r,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(m,r,u){const p=t.indexOf("#"),_=p>-1?(s.host&&document.querySelector("base")?t:t.slice(p))+m:ho()+t+m;try{e[u?"replaceState":"pushState"](r,"",_),n.value=r}catch(v){console.error(v),s[u?"replace":"assign"](_)}}function f(m,r){const u=Q({},e.state,An(n.value.back,m,n.value.forward,!0),r,{position:n.value.position});o(m,u,!0),a.value=m}function h(m,r){const u=Q({},n.value,e.state,{forward:m,scroll:Ht()});o(u.current,u,!0);const p=Q({},An(a.value,m,null),{position:u.position+1},r);o(m,p,!1),a.value=m}return{location:a,state:n,push:h,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=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 je(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 r of t){const u=r.length?[]:[90];s.strict&&!r.length&&(n+="/");for(let p=0;p<r.length;p++){const _=r[p];let v=40+(s.sensitive?.25:0);if(_.type===0)p||(n+="/"),n+=_.value.replace(yo,"\\$&"),v+=40;else if(_.type===1){const{value:I,repeatable:C,optional:V,regexp:B}=_;o.push({name:I,repeatable:C,optional:V});const D=B||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&&r.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 r=a.length-1;a[r][a[r].length-1]+=.7000000000000001}s.strict||(n+="/?"),s.end?n+="$":s.strict&&(n+="(?:/|$)");const f=new RegExp(n,s.sensitive?"":"i");function h(r){const u=r.match(f),p={};if(!u)return null;for(let _=1;_<u.length;_++){const v=u[_]||"",I=o[_-1];p[I.name]=v&&I.repeatable?v.split("/"):v}return p}function m(r){let u="",p=!1;for(const _ of t){(!p||!u.endsWith("/"))&&(u+="/"),p=!1;for(const v of _)if(v.type===0)u+=v.value;else if(v.type===1){const{value:I,repeatable:C,optional:V}=v,B=I in r?r[I]:"";if(Ee(B)&&!C)throw new Error(`Provided param "${I}" is an array but it is not repeatable (* or + modifiers)`);const D=Ee(B)?B.join("/"):B;if(!D)if(V)_.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:f,score:a,keys:o,parse:h,stringify:m}}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})/"${r}": ${v}`)}let s=0,a=s;const n=[];let o;function f(){o&&n.push(o),o=[]}let h=0,m,r="",u="";function p(){!r||(s===0?o.push({type:0,value:r}):s===1||s===2||s===3?(o.length>1&&(m==="*"||m==="+")&&e(`A repeatable param (${r}) must be alone in its segment. eg: '/:ids+.`),o.push({type:1,value:r,regexp:u,repeatable:m==="*"||m==="+",optional:m==="*"||m==="?"})):e("Invalid state to consume buffer"),r="")}function _(){r+=m}for(;h<t.length;){if(m=t[h++],m==="\\"&&s!==2){a=s,s=4;continue}switch(s){case 0:m==="/"?(r&&p(),f()):m===":"?(p(),s=1):_();break;case 4:_(),s=a;break;case 1:m==="("?s=2:Io.test(m)?_():(p(),s=0,m!=="*"&&m!=="?"&&m!=="+"&&h--);break;case 2:m===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+m:s=3:u+=m;break;case 3:p(),s=0,m!=="*"&&m!=="?"&&m!=="+"&&h--,u="";break;default:e("Unknown state");break}}return s===2&&e(`Unfinished custom RegExp for param "${r}"`),p(),f(),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,_,v){const I=!v,C=To(p);C.aliasOf=v&&v.record;const V=qn(e,p),B=[C];if("alias"in p){const z=typeof p.alias=="string"?[p.alias]:p.alias;for(const ce of z)B.push(Q({},C,{components:v?v.record.components:C.components,path:ce,aliasOf:v?v.record:C}))}let D,q;for(const z of B){const{path:ce}=z;if(_&&ce[0]!=="/"){const ne=_.record.path,Z=ne[ne.length-1]==="/"?"":"/";z.path=_.record.path+(ce&&Z+ce)}if(D=Co(z,_,V),v?v.alias.push(D):(q=q||D,q!==D&&q.alias.push(D),I&&p.name&&!Mn(D)&&f(p.name)),fs(D)&&m(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?()=>{f(q)}:ht}function f(p){if(us(p)){const _=a.get(p);_&&(a.delete(p),s.splice(s.indexOf(_),1),_.children.forEach(f),_.alias.forEach(f))}else{const _=s.indexOf(p);_>-1&&(s.splice(_,1),p.record.name&&a.delete(p.record.name),p.children.forEach(f),p.alias.forEach(f))}}function h(){return s}function m(p){const _=Do(p,s);s.splice(_,0,p),p.record.name&&!Mn(p)&&a.set(p.record.name,p)}function r(p,_){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(jn(_.params,v.keys.filter(q=>!q.optional).concat(v.parent?v.parent.keys.filter(q=>q.optional):[]).map(q=>q.name)),p.params&&jn(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=_.name?a.get(_.name):s.find(q=>q.re.test(_.path)),!v)throw nt(1,{location:p,currentLocation:_});V=v.record.name,I=Q({},_.params,p.params),C=v.stringify(I)}const B=[];let D=v;for(;D;)B.unshift(D.record),D=D.parent;return{name:V,path:C,params:I,matched:B,meta:So(B)}}t.forEach(p=>o(p));function u(){s.length=0,a.clear()}return{addRoute:o,resolve:r,removeRoute:f,clearRoutes:u,getRoutes:h,getRecordMatcher:n}}function jn(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 Mn(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 jo(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("="),h=bt(f<0?o:o.slice(0,f)),m=f<0?null:bt(o.slice(f+1));if(h in e){let r=e[h];Ee(r)||(r=e[h]=[r]),r.push(m)}else e[h]=m}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 Mo(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=f=>f()){const f=a&&(a.enterCallbacks[n]=a.enterCallbacks[n]||[]);return()=>new Promise((h,m)=>{const r=_=>{_===!1?m(nt(4,{from:s,to:e})):_ instanceof Error?m(_):go(_)?m(nt(2,{from:e,to:_})):(f&&a.enterCallbacks[n]===f&&typeof _=="function"&&f.push(_),h())},u=o(()=>t.call(a&&a.instances[n],e,s,r));let p=Promise.resolve(u);t.length<3&&(p=p.then(r)),p.catch(_=>m(_))})}function en(t,e,s,a,n=o=>o()){const o=[];for(const f of t)for(const h in f.components){let m=f.components[h];if(!(e!=="beforeRouteEnter"&&!f.instances[h]))if(Oo(m)){const u=(m.__vccOpts||m)[e];u&&o.push(Be(u,s,a,f,h,n))}else{let r=m();o.push(()=>r.then(u=>{if(!u)return Promise.reject(new Error(`Couldn't resolve component "${h}" at "${f.path}"`));const p=Ns(u)?u.default:u;f.components[h]=p;const v=(p.__vccOpts||p)[e];return v&&Be(v,s,a,f,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 m=ut(t.to);return e.resolve(m)}),n=Ce(()=>{const{matched:m}=a.value,{length:r}=m,u=m[r-1],p=s.matched;if(!u||!p.length)return-1;const _=p.findIndex(tt.bind(null,u));if(_>-1)return _;const v=Nn(m[r-2]);return r>1&&Nn(u)===v&&p[p.length-1].path!==v?p.findIndex(tt.bind(null,m[r-2])):_}),o=Ce(()=>n.value>-1&&Bo(s.params,a.value.params)),f=Ce(()=>n.value>-1&&n.value===s.matched.length-1&&cs(s.params,a.value.params));function h(m={}){return No(m)?e[ut(t.replace)?"replace":"push"](ut(t.to)).catch(ht):Promise.resolve()}return{route:a,href:Ce(()=>a.value.href),isActive:o,isExactActive:f,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,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=Ce(()=>t.route||a.value),o=yt(Vn,0),f=Ce(()=>{let r=ut(o);const{matched:u}=n.value;let p;for(;(p=u[r])&&!p.components;)r++;return r}),h=Ce(()=>n.value.matched[f.value]);Kt(Vn,Ce(()=>f.value+1)),Kt(qo,h),Kt(mn,n);const m=Os();return Vs(()=>[m.value,h.value,t.name],([r,u,p],[_,v,I])=>{u&&(u.instances[p]=r,v&&v!==u&&r&&r===_&&(u.leaveGuards.size||(u.leaveGuards=v.leaveGuards),u.updateGuards.size||(u.updateGuards=v.updateGuards))),r&&u&&(!v||!tt(u,v)||!_)&&(u.enterCallbacks[p]||[]).forEach(C=>C(r))},{flush:"post"}),()=>{const r=n.value,u=t.name,p=h.value,_=p&&p.components[u];if(!_)return Fn(s.default,{Component:_,route:r});const v=p.props[u],I=v?v===!0?r.params:typeof v=="function"?v(r):v:null,V=Kn(_,Q({},I,e,{onVnodeUnmounted:B=>{B.component.isUnmounted&&(p.instances[u]=null)},ref:m}));return Fn(s.default,{Component:V,route:r})||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||jo,a=t.stringifyQuery||On,n=t.history,o=lt(),f=lt(),h=lt(),m=Ps(Ne);let r=Ne;Ke&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Zt.bind(null,y=>""+y),p=Zt.bind(null,Ks),_=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 B(y,E){if(E=Q({},E||m.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:_(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(_(T.params));const $=eo(a,Q({},y,{hash:Gs(L),path:T.path})),R=n.createHref($);return Q({fullPath:$,hash:L,query:a===On?Mo(y.query):y.query||{}},T,{redirectedFrom:void 0,href:R})}function D(y){return typeof y=="string"?$t(s,y,m.value.path):Q({},y)}function q(y,E){if(r!==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=r=B(y),T=m.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=>je(he)?je(he,2)?he:Tt(he):Pe(he,se,T)).then(he=>{if(he){if(je(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 ve(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 f.list())x.push(Be(O,y,E));return x.push(R),Ge(x)}).catch(O=>je(O,8)?O:Promise.reject(O))}function ve(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)),m.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=B(y),L=ne(T);if(L){Z(Q(L,{replace:!0}),T).catch(ht);return}r=T;const $=m.value;Ke&&co(Tn($.fullPath,x.delta),Ht()),Ve(T,$).catch(R=>je(R,12)?R:je(R,2)?(Z(R.to,T).then(O=>{je(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&&!je(R,8)?n.go(-x.delta,!1):x.type===wt.pop&&je(R,20)&&n.go(-1,!1)),ve(T,$,R)}).catch(ht)}))}let Se=lt(),ye=lt(),De;function Pe(y,E,x){Tt(y);const T=ye.list();return T.length?T.forEach(L=>L(y,E,x)):console.error(y),Promise.reject(y)}function Yt(){return De&&m.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 Ms().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:m,listening:!0,addRoute:v,removeRoute:I,clearRoutes:e.clearRoutes,hasRoute:V,getRoutes:C,resolve:B,options:t,push:z,replace:ce,go:it,back:()=>it(-1),forward:()=>it(1),beforeEach:o.add,beforeResolve:f.add,afterEach:h.add,onError:ye.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(m)}),Ke&&!Jt&&m.value===Ne&&(Jt=!0,z(n.location).catch(L=>{}));const x={};for(const L in Ne)Object.defineProperty(x,L,{get:()=>m.value[L],enumerable:!0});y.provide(yn,E),y.provide(ps,js(x)),y.provide(mn,m);const T=y.unmount;At.add(y),y.unmount=function(){At.delete(y),At.size<1&&(r=Ne,de&&de(),de=null,m.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 f=0;f<o;f++){const h=e.matched[f];h&&(t.matched.find(r=>tt(r,h))?a.push(h):s.push(h));const m=t.matched[f];m&&(e.matched.find(r=>tt(r,m))||n.push(m))}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 f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return c(),d("div",Lo,[n.toast.visible?(c(),d("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)):g("",!0),P(m,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",zo,[i("h2",Ho,l(o.translations.edit_quote),1)]),Go,n.loading?(c(),d("div",Yo)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...r)=>o.submitQuote&&o.submitQuote(...r),["prevent"]))},[i("div",Jo,[i("div",Ko,[i("label",Zo,l(o.translations.quote_number),1),F(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.quote.quote_number=r),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(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]=r=>n.quote.due_date=r),"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(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]=r=>n.quote.provisional_start_date=r),"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]=r=>n.quote.client_id=r),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),F(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=r=>n.quote.status=r),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),[[Ie,n.quote.status]])])]),i("div",hi,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},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?(c(),d("span",fi)):g("",!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 c(),d("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",Ii,[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",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"},ji={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab2"},Mi=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 f=M("confirm-modal"),h=M("remove-modal"),m=M("router-link"),r=M("Card");return c(),d("div",ki,[n.toast.visible?(c(),d("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)):g("",!0),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,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(r,{topMargin:"mt-8"},{default:re(()=>[i("div",Ti,[i("h2",Ai,l(o.translations.quotes),1),i("div",null,[P(m,{to:{name:"QuoteNew"}},{default:re(()=>[i("button",Si,[w(l(o.translations.add)+" ",1),Di])]),_:1}),n.settings.easy_compta_export_addon_active==1?(c(),d("span",Pi,[i("a",ji,[w(l(o.translations.export)+" ",1),Mi])])):(c(),d("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),F(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))},[(c(!0),d(X,null,U(n.perPageOptions,u=>(c(),d("option",{key:u,value:u},l(u),9,Fi))),128))],544),[[Ie,n.perPage]])]),i("div",Wi,[n.loading?(c(),d("div",Ca,[(c(!0),d(X,null,U(n.skeletonRows,u=>(c(),d("div",{key:u,class:"flex flex-col gap-4 w-full"},Aa))),128))])):(c(),d("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,[(c(!0),d(X,null,U(n.quotes,u=>(c(),d("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"?(c(),d("span",Qi,l(o.translations.draft),1)):g("",!0),u.status=="pending"?(c(),d("span",Li,l(o.translations.pending),1)):g("",!0),u.status=="approved"?(c(),d("span",zi,l(o.translations.approved),1)):g("",!0),u.status=="rejected"?(c(),d("span",Hi,l(o.translations.rejected),1)):g("",!0)]),i("td",null,[n.loadingPrice?(c(),d("div",ta,sa)):(c(),d("div",Gi,[n.settings.vat_active==1?(c(),d("div",Yi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(c(),d("span",Ji,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(c(),d("span",Ki,l(o.formatAmount(u.total_amount,u.client_currency)),1))])):(c(),d("div",Zi,[n.default_currency_symbol==u.client_currency||u.client_currency==null?(c(),d("span",$i,l(o.formatAmount(u.total_amount,n.default_currency_symbol)),1)):(c(),d("span",ea,l(o.formatAmount(u.total_amount,u.client_currency)),1))]))]))]),i("td",null,[n.loadingPrice?(c(),d("div",ia,la)):(c(),d("div",oa,l(u.due_date),1))]),i("td",null,[n.loadingPrice?(c(),d("div",ca,ua)):(c(),d("div",ra,l(u.created),1))]),i("td",ha,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[P(m,{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(m,{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,[(c(!0),d(X,null,U(n.paginationButtons,u=>(c(),d("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 ja=oe(Ci,[["render",Pa]]);const Ma={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 f=M("vue-editor");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!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?(c(),d("div",Ra,[i("div",Na,[(c(!0),d(X,null,U(o.skeletonItems,h=>(c(),d("div",{key:h,class:"py-2"},Wa))),128))])])):(c(),d("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Xa,[(c(!0),d(X,null,U(n.fields,(h,m)=>(c(),d("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(c(),d("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Qa),i("input",{id:m,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,La)],8,Ua)):(c(),d("div",za,[i("label",{for:m,class:"form-label"},l(h.label),9,Ha),P(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,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?(c(),d("span",Ja)):g("",!0)],8,Ya)])],32))])],8,qa)])}var Za=oe(Ma,[["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 f=M("VueDatePicker");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!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?(c(),d("p",il," Le montant s\xE9lectionn\xE9 d\xE9passe le montant total du devis. ")):g("",!0),i("div",al,[s.advanceSold=="no_sold"&&!n.invoiceSolded?(c(),d("div",ll,[i("div",rl,[cl,F(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),[[Ie,n.selectedType]])])])):g("",!0),n.selectedType&&s.advanceSold=="no_sold"&&!n.invoiceSolded?(c(),d("div",ml,[i("div",fl,[pl,F(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"?(c(),d("span",vl,"%")):(c(),d("span",yl,l(s.currency),1))])])])])):g("",!0)]),n.selectedType==="percentage"&&!o.inputValueExceeds&!n.invoiceSolded?(c(),d("div",bl,[i("p",wl," Montant bas\xE9 sur le pourcentage: "+l(o.calculatedAmount)+" "+l(s.currency),1)])):g("",!0),n.invoiceSolded?g("",!0):(c(),d("div",xl,[i("label",Il,l(o.translations.due_date),1),P(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]=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?(c(),d("div",El,"Facture d\xE9j\xE0 sold\xE9")):g("",!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},jl={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"},Ml=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),ql=[Ml],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 f=M("send-quote-modal"),h=M("confirm-modal"),m=M("advance-modal"),r=M("router-link");return c(),d("div",null,[s.emailActive==1?(c(),d("div",Dl,[P(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"])])):g("",!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?(c(),d("div",Pl,[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,"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"])])):g("",!0),n.toast.visible?(c(),d("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)):g("",!0),n.loading?(c(),d("div",jl,ql)):g("",!0),i("div",Ol,[i("div",null,[Vl,i("div",Rl,[P(r,{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?(c(),d("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)])):g("",!0),s.quoteInfo.status=="draft"&&s.noItems?(c(),d("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)):g("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="rejected")&&!s.noItems?(c(),d("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)])):g("",!0),(s.quoteInfo.status=="pending"||s.quoteInfo.status=="approved")&&!s.noItems?(c(),d("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)])):g("",!0),s.advanceActive==1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(c(),d("div",zl,[i("div",Hl,[i("div",Gl,[Yl,w(" "+l(o.translations.convertToInvoice),1)]),i("ul",Jl,[s.quoteInfo.advance!=1?(c(),d("li",Kl,[i("a",{href:"#",onClick:e[7]||(e[7]=K(u=>o.confirmConvertQuote(s.quoteInfo.id),["prevent"]))}," Facture global ")])):g("",!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?(c(),d("a",{key:0,href:"#",onClick:e[9]||(e[9]=K(u=>o.ConvertAdvanceQuote(s.quoteInfo.id,"sold"),["prevent"]))}," Facture du solde ")):g("",!0)])])])])):g("",!0),s.advanceActive!=1&&s.quoteInfo.converted!=1&&s.quoteInfo.status=="approved"&&!s.noItems?(c(),d("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)])])):g("",!0)])]),i("div",er,[s.emailActive==1&&!s.noItems?(c(),d("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?(c(),d("i",nr)):g("",!0)])):s.emailActive==0?(c(),d("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?(c(),d("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)):g("",!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?(c(),d("span",ur)):g("",!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 jr(t,e,s,a,n,o){const f=M("vue-editor");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!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?(c(),d("div",vr,[i("div",yr,[(c(!0),d(X,null,U(o.skeletonItems,h=>(c(),d("div",{key:h,class:"py-2"},xr))),128))])])):(c(),d("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Ir,[(c(!0),d(X,null,U(n.fields,(h,m)=>(c(),d("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(c(),d("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Cr),F(i("input",{id:m,"onUpdate:modelValue":r=>n.editedItem[m]=r,class:k(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,kr),[[J,n.editedItem[m]]])],8,Er)):(c(),d("div",Tr,[i("label",{for:m,class:"form-label"},l(h.label),9,Ar),P(f,{id:m,modelValue:n.editedItem[m],"onUpdate:modelValue":r=>n.editedItem[m]=r,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?(c(),d("span",Pr)):g("",!0)],8,Dr)])],32))])],8,pr)])}var Mr=oe(fr,[["render",jr]]);/**!
    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 ke(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 Mt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mt=function(e){return typeof e}:Mt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mt(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 Rr(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 Vr="1.15.2";function Me(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var Oe=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ct=Me(/Edge/i),Xn=Me(/firefox/i),ft=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i),gs=Me(/iP(ad|od|hone)/i),vs=Me(/chrome/i)&&Me(/android/i),ys={capture:!1,passive:!1};function W(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 xe(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 Qn=/\s+/g;function pe(t,e,s){if(t&&e)if(t.classList)t.classList[s?"add":"remove"](e);else{var a=(" "+t.className+" ").replace(Qn," ").replace(" "+e+" "," ");t.className=(a+(s?" "+e:"")).replace(Qn," ")}}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 Te(){var t=document.scrollingElement;return t||document.documentElement}function te(t,e,s,a,n){if(!(!t.getBoundingClientRect&&t!==window)){var o,f,h,m,r,c,p;if(t!==window&&t.parentNode&&t!==Te()?(o=t.getBoundingClientRect(),f=o.top,h=o.left,m=o.bottom,r=o.right,c=o.height,p=o.width):(f=0,h=0,m=window.innerHeight,r=window.innerWidth,c=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 _=n.getBoundingClientRect();f-=_.top+parseInt(S(n,"border-top-width")),h-=_.left+parseInt(S(n,"border-left-width")),m=f+o.height,r=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&&(f/=C,h/=I,p/=I,c/=C,m=f+c,r=h+p)}return{top:f,left:h,bottom:m,right:r,width:p,height:c}}}function Un(t,e,s){for(var a=Xe(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===Te())break;a=Xe(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)&&xe(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 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=Te();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 Xe(t,e){if(!t||!t.getBoundingClientRect)return Te();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 Te();if(a||e)return s;a=!0}}while(s=s.parentNode);return Te()}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,f,h,m;if(!(!xe(n,e.draggable,t,!1)||n.animated||n===s)){var r=te(n);a.left=Math.min((o=a.left)!==null&&o!==void 0?o:1/0,r.left),a.top=Math.min((f=a.top)!==null&&f!==void 0?f:1/0,r.top),a.right=Math.max((h=a.right)!==null&&h!==void 0?h:-1/0,r.right),a.bottom=Math.max((m=a.bottom)!==null&&m!==void 0?m:-1/0,r.bottom)}}),a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}var ge="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=ke({},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(h){var m=0,r=h.target,c=r.fromRect,p=te(r),_=r.prevFromRect,v=r.prevToRect,I=h.rect,C=et(r,!0);C&&(p.top-=C.f,p.left-=C.e),r.toRect=p,r.thisAnimationDuration&&tn(_,p)&&!tn(c,p)&&(I.top-p.top)/(I.left-p.left)===(c.top-p.top)/(c.left-p.left)&&(m=Ur(I,_,v,n.options)),tn(p,c)||(r.prevFromRect=c,r.prevToRect=p,m||(m=n.options.animation),n.animate(r,I,p,m)),m&&(o=!0,f=Math.max(f,m),clearTimeout(r.animationResetTimer),r.animationResetTimer=setTimeout(function(){r.animationTime=0,r.prevFromRect=null,r.fromRect=null,r.prevToRect=null,r.thisAnimationDuration=null},m),r.thisAnimationDuration=m)}),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 h=et(this.el),m=h&&h.a,r=h&&h.d,c=(n.left-o.left)/(m||1),p=(n.top-o.top)/(r||1);a.animatingX=!!c,a.animatingY=!!p,S(a,"transform","translate3d("+c+"px,"+p+"px,0)"),this.forRepaintDummy=Qr(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 Qr(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},Tt={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](ke({sortable:s},a)),s.options[f.pluginName]&&s[f.pluginName][e]&&s[f.pluginName][e](ke({sortable:s},a)))})},initializePlugins:function(e,s,a,n){Ye.forEach(function(h){var m=h.pluginName;if(!(!e.options[m]&&!h.initializeByDefault)){var r=new h(e,s,e.options);r.sortable=e,r.options=e.options,e[m]=r,qe(a,r.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,h=t.fromEl,m=t.oldIndex,r=t.newIndex,c=t.oldDraggableIndex,p=t.newDraggableIndex,_=t.originalEvent,v=t.putSortable,I=t.extraEventProperties;if(e=e||s&&s[ge],!!e){var C,R=e.options,B="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=f||s,C.from=h||s,C.item=n||s,C.clone=o,C.oldIndex=m,C.newIndex=r,C.oldDraggableIndex=c,C.newDraggableIndex=p,C.originalEvent=_,C.pullMode=v?v.lastPutMode:void 0;var P=ke(ke({},I),Tt.getEventProperties(a,e));for(var q in P)C[q]=P[q];s&&s.dispatchEvent(C),R[B]&&R[B].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=Rr(a,zr);Tt.pluginEvent.bind(A)(e,s,ke({dragEl:b,parentEl:Y,ghostEl:j,rootEl:H,nextEl:He,lastDownEl:qt,cloneEl:G,cloneHidden:We,dragStarted:rt,putSortable:ae,activeSortable:A.active,originalEvent:n,oldIndex:$e,oldDraggableIndex:_t,newIndex:_e,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(ke({putSortable:ae,cloneEl:G,targetEl:b,rootEl:H,oldIndex:$e,oldDraggableIndex:_t,newIndex:_e,newDraggableIndex:Fe},t))}var b,Y,j,H,He,qt,G,We,$e,_e,_t,Fe,St,ae,Ze=!1,Bt=!1,Ft=[],Le,we,sn,on,zn,Hn,rt,Ke,gt,vt=!1,Pt=!1,Ot,le,an=[],fn=!1,Wt=[],Gt=typeof document!="undefined",Dt=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"}}(),Ts=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),h=o&&S(o),m=f&&S(f),r=h&&parseInt(h.marginLeft)+parseInt(h.marginRight)+te(o).width,c=m&&parseInt(m.marginLeft)+parseInt(m.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&&h.float&&h.float!=="none"){var p=h.float==="left"?"left":"right";return f&&(m.clear==="both"||m.clear===p)?"vertical":"horizontal"}return o&&(h.display==="block"||h.display==="flex"||h.display==="table"||h.display==="grid"||r>=n&&a[Gn]==="none"||f&&a[Gn]==="none"&&r+c>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,h=a?s.left:s.top,m=a?s.right:s.bottom,r=a?s.width:s.height;return n===h||o===m||n+f/2===h+r/2},Yr=function(e,s){var a;return Ft.some(function(n){var o=n[ge].options.emptyInsertThreshold;if(!(!o||wn(n))){var f=te(n),h=e>=f.left-o&&e<=f.right+o,m=s>=f.top-o&&s<=f.bottom+o;if(h&&m)return a=n}}),a},ks=function(e){function s(o,f){return function(h,m,r,c){var p=h.options.group.name&&m.options.group.name&&h.options.group.name===m.options.group.name;if(o==null&&(f||p))return!0;if(o==null||o===!1)return!1;if(f&&o==="clone")return o;if(typeof o=="function")return s(o(h,m,r,c),f)(h,m,r,c);var _=(f?h:m).options.group.name;return o===!0||typeof o=="string"&&o===_||o.join&&o.indexOf(_)>-1}}var a={},n=e.group;(!n||Mt(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&&j&&S(j,"display","none")},Ss=function(){!Cs&&j&&S(j,"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[ge]._onDragOver(a)}}},Kr=function(e){b&&b.parentNode[ge]._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[ge]=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 Ts(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,h){f.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};Tt.initializePlugins(this,t,s);for(var a in s)!(a in e)&&(e[a]=s[a]);ks(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?W(t,"pointerdown",this._onTapStart):(W(t,"mousedown",this._onTapStart),W(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(W(t,"dragover",this),W(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&&(Ke=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,h=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,m=(h||e).target,r=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||m,c=n.filter;if(oc(a),!b&&!(/mousedown|pointerdown/.test(f)&&e.button!==0||n.disabled)&&!r.isContentEditable&&!(!this.nativeDraggable&&ft&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=xe(m,n.draggable,a,!1),!(m&&m.animated)&&qt!==m)){if($e=ve(m),_t=ve(m,n.draggable),typeof c=="function"){if(c.call(this,e,m,this)){ue({sortable:s,rootEl:r,name:"filter",targetEl:m,toEl:a,fromEl:a}),me("filter",s,{evt:e}),o&&e.cancelable&&e.preventDefault();return}}else if(c&&(c=c.split(",").some(function(p){if(p=xe(r,p.trim(),a,!1),p)return ue({sortable:s,rootEl:p,name:"filter",targetEl:m,fromEl:a,toEl:a}),me("filter",s,{evt:e}),!0}),c)){o&&e.cancelable&&e.preventDefault();return}n.handle&&!xe(r,n.handle,a,!1)||this._prepareDragStart(e,h,m)}}},_prepareDragStart:function(e,s,a){var n=this,o=n.el,f=n.options,h=o.ownerDocument,m;if(a&&!b&&a.parentNode===o){var r=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-r.left,Hn=Le.clientY-r.top,this._lastX=(s||e).clientX,this._lastY=(s||e).clientY,b.style["will-change"]="all",m=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}),pe(b,f.chosenClass,!0)},f.ignore.split(",").forEach(function(c){bs(b,c.trim(),ln)}),W(h,"dragover",ze),W(h,"mousemove",ze),W(h,"touchmove",ze),W(h,"mouseup",n._onDrop),W(h,"touchend",n._onDrop),W(h,"touchcancel",n._onDrop),Xn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,b.draggable=!0),me("delayStart",this,{evt:e}),f.delay&&(!f.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(Ct||Oe))){if(A.eventCanceled){this._onDrop();return}W(h,"mouseup",n._disableDelayedDrag),W(h,"touchend",n._disableDelayedDrag),W(h,"touchcancel",n._disableDelayedDrag),W(h,"mousemove",n._delayedDragTouchMoveHandler),W(h,"touchmove",n._delayedDragTouchMoveHandler),f.supportPointer&&W(h,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(m,f.delay)}else m()}},_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?W(document,"pointermove",this._onTouchMove):s?W(document,"touchmove",this._onTouchMove):W(document,"mousemove",this._onTouchMove):(W(b,"dragend",this),W(H,"dragstart",this._onDragStart));try{document.selection?Rt(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,s){if(Ze=!1,H&&b){me("dragStarted",this,{evt:s}),this.nativeDraggable&&W(document,"dragover",Kr);var a=this.options;!e&&pe(b,a.dragClass,!1),pe(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[ge]._isOutsideThisEl(e),s)do{if(s[ge]){var a=void 0;if(a=s[ge]._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=j&&et(j,!0),h=j&&f&&f.a,m=j&&f&&f.d,r=Dt&&le&&Ln(le),c=(o.clientX-Le.clientX+n.x)/(h||1)+(r?r[0]-an[0]:0)/(h||1),p=(o.clientY-Le.clientY+n.y)/(m||1)+(r?r[1]-an[1]:0)/(m||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(j){f?(f.e+=c-(sn||0),f.f+=p-(on||0)):f={a:1,b:0,c:0,d:1,e:c,f:p};var _="matrix(".concat(f.a,",").concat(f.b,",").concat(f.c,",").concat(f.d,",").concat(f.e,",").concat(f.f,")");S(j,"webkitTransform",_),S(j,"mozTransform",_),S(j,"msTransform",_),S(j,"transform",_),sn=c,on=p,we=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!j){var e=this.options.fallbackOnBody?document.body:H,s=te(b,!0,Dt,!0,e),a=this.options;if(Dt){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=Te()),s.top+=le.scrollTop,s.left+=le.scrollLeft):le=Te(),an=Ln(le)}j=b.cloneNode(!0),pe(j,a.ghostClass,!1),pe(j,a.fallbackClass,!0),pe(j,a.dragClass,!0),S(j,"transition",""),S(j,"transform",""),S(j,"box-sizing","border-box"),S(j,"margin",0),S(j,"top",s.top),S(j,"left",s.left),S(j,"width",s.width),S(j,"height",s.height),S(j,"opacity","0.8"),S(j,"position",Dt?"absolute":"fixed"),S(j,"zIndex","100000"),S(j,"pointerEvents","none"),A.ghost=j,e.appendChild(j),S(j,"transform-origin",zn/parseInt(j.style.width)*100+"% "+Hn/parseInt(j.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(),pe(G,this.options.chosenClass,!1),A.clone=G),a.cloneId=Rt(function(){me("clone",a),!A.eventCanceled&&(a.options.removeCloneOnHide||H.insertBefore(G,b),a._hideClone(),ue({sortable:a,name:"clone"}))}),!s&&pe(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)),W(document,"drop",a),S(b,"transform","translateZ(0)")),Ze=!0,a._dragStartId=Rt(a._dragStarted.bind(a,s,e)),W(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,h=this.options,m=h.group,r=A.active,c=St===m,p=h.sort,_=ae||r,v,I=this,C=!1;if(fn)return;function R(De,Yt){me(De,I,ke({evt:e,isOwner:c,axis:v?"vertical":"horizontal",revert:f,dragRect:n,targetRect:o,canSort:p,fromSortable:_,target:a,completed:P,onMove:function(ot,it){return jt(H,s,b,n,ot,te(ot),e,it)},changed:q},Yt))}function B(){R("dragOverAnimationCapture"),I.captureAnimationState(),I!==_&&_.captureAnimationState()}function P(De){return R("dragOverCompleted",{insertion:De}),De&&(c?r._hideClone():r._showClone(I),I!==_&&(pe(b,ae?ae.options.ghostClass:r.options.ghostClass,!1),pe(b,h.ghostClass,!0)),ae!==I&&I!==A.active?ae=I:I===A.active&&ae&&(ae=null),_===I&&(I._ignoreWhileAnimating=a),I.animateAll(function(){R("dragOverAnimationComplete"),I._ignoreWhileAnimating=null}),I!==_&&(_.animateAll(),_._ignoreWhileAnimating=null)),(a===b&&!b.animated||a===s&&!a.animated)&&(Ke=null),!h.dragoverBubble&&!e.rootEl&&a!==document&&(b.parentNode[ge]._isOutsideThisEl(e.target),!De&&ze(e)),!h.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),C=!0}function q(){_e=ve(b),Fe=ve(b,h.draggable),ue({sortable:I,name:"change",toEl:s,newIndex:_e,newDraggableIndex:Fe,originalEvent:e})}if(e.preventDefault!==void 0&&e.cancelable&&e.preventDefault(),a=xe(a,h.draggable,s,!0),R("dragOver"),A.eventCanceled)return C;if(b.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||I._ignoreWhileAnimating===a)return P(!1);if(Bt=!1,r&&!h.disabled&&(c?p||(f=Y!==H):ae===this||(this.lastPutMode=St.checkPull(this,r,b,e))&&m.checkPut(this,r,b,e))){if(v=this._getDirection(e,a)==="vertical",n=te(b),R("dragOverValid"),A.eventCanceled)return C;if(f)return Y=H,B(),this._hideClone(),R("revert"),A.eventCanceled||(He?H.insertBefore(b,He):H.appendChild(b)),P(!0);var z=wn(s,h.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)),jt(H,s,b,n,a,o,e,!!a)!==!1)return B(),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,h,!0);if(ce===b)return P(!1);if(a=ce,o=te(a),jt(H,s,b,n,a,o,e,!1)!==!1)return B(),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),Re=v?"top":"left",ye=Un(a,"top","top")||Un(b,"top","top"),Ve=ye?ye.scrollTop:void 0;Ke!==a&&(Z=o[Re],vt=!1,Pt=!ie&&h.invertSwap||Ue),ne=tc(e,a,o,v,ie?1:h.swapThreshold,h.invertedSwapThreshold==null?h.swapThreshold:h.invertedSwapThreshold,Pt,Ke===a);var de;if(ne!==0){var Ae=ve(b);do Ae-=ne,de=Y.children[Ae];while(de&&(S(de,"display")==="none"||de===j))}if(ne===0||de===a)return P(!1);Ke=a,gt=ne;var Se=a.nextElementSibling,be=!1;be=ne===1;var Pe=jt(H,s,b,n,a,o,e,be);if(Pe!==!1)return(Pe===1||Pe===-1)&&(be=Pe===1),fn=!0,setTimeout(Zr,30),B(),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&&!Pt&&(Ot=Math.abs(Z-te(a)[Re])),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(_e=ve(b),Fe=ve(b,a.draggable),me("drop",this,{evt:e}),Y=b&&b.parentNode,_e=ve(b),Fe=ve(b,a.draggable),A.eventCanceled){this._nulling();return}Ze=!1,Pt=!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()),j&&j.parentNode&&j.parentNode.removeChild(j),(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&&pe(b,ae?ae.options.ghostClass:this.options.ghostClass,!1),pe(b,this.options.chosenClass,!1),ue({sortable:this,name:"unchoose",toEl:Y,newIndex:null,newDraggableIndex:null,originalEvent:e}),H!==Y?(_e>=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()):_e!==$e&&_e>=0&&(ue({sortable:this,name:"update",toEl:Y,originalEvent:e}),ue({sortable:this,name:"sort",toEl:Y,originalEvent:e})),A.active&&((_e==null||_e===-1)&&(_e=$e,Fe=_t),ue({sortable:this,name:"end",toEl:Y,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){me("nulling",this),H=b=Y=j=He=G=qt=We=Le=we=rt=_e=Fe=$e=_t=Ke=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),Jr(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],xe(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 h=n.children[f];xe(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 xe(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=Tt.modifyOption(this,e,s);typeof n!="undefined"?a[e]=n:a[e]=s,e==="group"&&ks(a)},destroy:function(){me("destroy",this);var e=this.el;e[ge]=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 Jr(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function jt(t,e,s,a,n,o,f,h){var m,r=t[ge],c=r.options.onMove,p;return window.CustomEvent&&!Oe&&!Ct?m=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent("move",!0,!0)),m.to=e,m.from=t,m.dragged=s,m.draggedRect=a,m.related=n||e,m.relatedRect=o||te(e),m.willInsertAfter=h,m.originalEvent=f,t.dispatchEvent(m),c&&(p=c.call(r,m,f)),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,j),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,j),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,h){var m=a?t.clientY:t.clientX,r=a?s.height:s.width,c=a?s.top:s.left,p=a?s.bottom:s.right,_=!1;if(!f){if(h&&Ot<r*n){if(!vt&&(gt===1?m>c+r*o/2:m<p-r*o/2)&&(vt=!0),vt)_=!0;else if(gt===1?m<c+Ot:m>p-Ot)return-gt}else if(m>c+r*(1-n)/2&&m<p-r*(1-n)/2)return nc(e)}return _=_||f,_&&(m<c+r*o/2||m>p-r*o/2)?m>c+r/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 Rt(t){return setTimeout(t,0)}function pn(t){return clearTimeout(t)}Gt&&W(document,"touchmove",function(t){(A.active||Ze)&&t.cancelable&&t.preventDefault()});A.utils={on:W,off:N,css:S,find:bs,is:function(e,s){return!!xe(e,s,e,!1)},extend:Fr,throttle:ws,closest:xe,toggleClass:pe,clone:Is,index:ve,nextTick:Rt,cancelNextTick:pn,detectDirection:Ts,getChild:st};A.get=function(t){return t[ge]};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=ke(ke({},A.utils),a.utils)),Tt.mount(a)})};A.create=function(t,e){return new A(t,e)};A.version=Vr;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?W(document,"dragover",this._handleAutoScroll):this.options.supportPointer?W(document,"pointermove",this._handleFallbackAutoScroll):a.touches?W(document,"touchmove",this._handleFallbackAutoScroll):W(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(){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,f=(s.touches?s.touches[0]:s).clientY,h=document.elementFromPoint(o,f);if(Xt=s,a||this.options.forceAutoScrollFallback||Ct||Oe||ft){dn(s,this.options,h,a);var m=Xe(h,!0);gn&&(!dt||o!==rn||f!==cn)&&(dt&&Yn(),dt=setInterval(function(){var r=Xe(document.elementFromPoint(o,f),!0);r!==m&&(m=r,Vt()),dn(s,n.options,r,a)},10),rn=o,cn=f)}else{if(!this.options.bubbleScroll||Xe(h,!0)===Te()){Vt();return}dn(s,this.options,Xe(h,!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,h=e.scrollSpeed,m=Te(),r=!1,c;_n!==s&&(_n=s,Vt(),ct=e.scroll,c=e.scrollFn,ct===!0&&(ct=Xe(s,!0)));var p=0,_=ct;do{var v=_,I=te(v),C=I.top,R=I.bottom,B=I.left,P=I.right,q=I.width,z=I.height,ce=void 0,ne=void 0,Z=v.scrollWidth,Ue=v.scrollHeight,ie=S(v),Re=v.scrollLeft,ye=v.scrollTop;v===m?(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&&Re+q<Z)-(Math.abs(B-n)<=f&&!!Re),de=ne&&(Math.abs(R-o)<=f&&ye+z<Ue)-(Math.abs(C-o)<=f&&!!ye);if(!ee[p])for(var Ae=0;Ae<=p;Ae++)ee[Ae]||(ee[Ae]={});(ee[p].vx!=Ve||ee[p].vy!=de||ee[p].el!==v)&&(ee[p].el=v,ee[p].vx=Ve,ee[p].vy=de,clearInterval(ee[p].pid),(Ve!=0||de!=0)&&(r=!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,be=ee[this.layer].vx?ee[this.layer].vx*h:0;typeof c=="function"&&c.call(A.dragged.parentNode[ge],be,Se,t,Xt,ee[this.layer].el)!=="continue"||xs(ee[this.layer].el,be,Se)}.bind({layer:p}),24))),p++}while(e.bubbleScroll&&_!==m&&(_=Xe(_,!1)));gn=r}},30),Ps=function(e){var s=e.originalEvent,a=e.putSortable,n=e.dragEl,o=e.activeSortable,f=e.dispatchSortableEvent,h=e.hideGhostForTarget,m=e.unhideGhostForTarget;if(!!s){var r=a||o;h();var c=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,p=document.elementFromPoint(c.clientX,c.clientY);m(),r&&!r.el.contains(p)&&(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:Ps};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:Ps};qe(In,{pluginName:"removeOnSpill"});A.mount(new ic);A.mount(In,xn);const ac={name:"QuoteViewDetail",components:{Card:Qe,QuoteNavBar:mr,EditItemModal:Mr,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,a=s*this.newItem.vat_rate/100,n=s+a;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(n)},calculateTotal(t,e,s,a){const n=t*e,o=n*a/100,f=n-o,h=f*s/100,m=f+h;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}`},calculateDiscountAmount(t,e,s,a){const o=t*e*a/100,f=o*s/100,h=o+f;return this.formatCurrency(h)},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"},Tc=i("br",null,null,-1),kc=i("br",null,null,-1),Ac=i("br",null,null,-1),Sc=["href"],Pc=i("br",null,null,-1),Dc=i("br",null,null,-1),jc=i("br",null,null,-1),Mc=["href"],qc=i("br",null,null,-1),Oc=["href"],Rc={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"},Xc={width:"8%",class:"text-center"},Qc={width:"5%",class:"text-center"},Uc={width:"10%",class:"text-center"},Lc={width:"10%",class:"text-right"},zc=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),Hc=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),Gc={key:0,class:"badge badge-ghost badge-xs"},Yc=["innerHTML"],Kc={class:"text-center"},Jc={class:"text-center"},Zc={key:0},$c={key:1},ed={class:"text-center"},td={class:"text-center"},nd=i("br",null,null,-1),sd={class:"text-right"},od={key:0},id={key:1},ad=["data-tip"],ld=["onClick"],rd=i("i",{class:"far fa-edit"},null,-1),cd=[rd],dd=["data-tip"],ud=["onClick"],hd={key:0,class:"far fa-trash-alt"},md={key:1,class:"loading loading-spinner loading-xs"},fd={key:0},pd=i("td",{class:"px-2"},null,-1),_d={class:"align-top px-2"},gd={class:"flex items-center border rounded-md relative"},vd=["placeholder"],yd={key:0,class:"autocomplete-dropdown bg-base-300"},bd=["onClick","innerHTML"],wd={class:"align-top px-2"},xd=i("option",{disabled:"",selected:""},"Type",-1),Id=["value"],Ed={class:"flex items-center border rounded-md relative"},Cd=["placeholder"],Td={key:0,class:"autocomplete-dropdown bg-base-300"},kd=["onClick","innerHTML"],Ad={class:"align-top"},Sd={class:"flex items-center rounded-md"},Pd=["placeholder"],Dd={class:"align-top"},jd={class:"flex items-center border rounded-lg"},Md={class:"inline-flex"},qd=["placeholder"],Od={class:"align-top"},Rd={class:"flex items-center border rounded-md"},Vd=["placeholder"],Nd={class:"align-top"},Bd=["value"],Fd={class:"align-top"},Wd={class:"flex items-center border rounded-md"},Xd=["placeholder"],Qd=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),Ud={class:"text-right"},Ld=["data-tip"],zd={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},Hd={key:0,class:"fa fa-plus"},Gd={key:1,class:"loading loading-spinner loading-xs"},Yd={colspan:"8",class:"text-right no-border"},Kd={class:"text-right"},Jd={key:0,class:"line-through"},Zd=i("td",null,null,-1),$d={colspan:"8",class:"text-right no-border"},eu={class:"text-right"},tu=i("td",null,null,-1),nu={colspan:"8",class:"text-right no-border font-bold text-xl"},su={class:"text-right no-border font-bold text-xl"},ou=i("td",null,null,-1),iu={key:2},au={colspan:"8",class:"text-right no-border"},lu={class:"text-right no-border"},ru={key:3},cu={colspan:"8",class:"text-right no-border"},du={class:"text-right no-border font-bold text-xl"},uu={key:1,class:"relative"},hu={class:"flex justify-end mt-4"},mu={class:"border-2 border-slate-300 max-w-md"},fu=["src"];function pu(t,e,s,a,n,o){const f=M("QuoteNavBar"),h=M("remove-modal"),m=M("edit-item-modal"),r=M("Card");return d(),u("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?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),D(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]=c=>this.removeItem(n.selectedItem,n.selectedInvoiceId)),onCancel:e[1]||(e[1]=c=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(d(),u("div",rc,dc)):g("",!0),o.isQuoteExpired&&n.quote.status=="pending"?(d(),u("div",uc,[i("div",hc,[mc,i("span",null,l(o.translations.quote_expired),1)])])):g("",!0),D(r,{topMargin:"mt-8",id:"quote-content"},{default:re(()=>[n.settings.easy_compta_signature_addon_active&&n.quote.signed==1?(d(),u("div",fc,[i("span",pc,l(o.translations.signed),1)])):g("",!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,[x(l(o.translations.created_at)+": ",1),i("strong",null,l(n.quote.created_at),1)]),i("div",null,[x(l(o.translations.due_date)+": ",1),i("strong",null,l(n.quote.due_date),1)]),i("div",null,[x(l(o.translations.provisional_date)+": ",1),i("strong",null,l(n.quote.provisional_start_date),1)]),i("div",null,[x(l(o.translations.status)+": ",1),n.quote.status=="draft"?(d(),u("span",wc,l(o.translations.draft),1)):g("",!0),n.quote.status=="pending"?(d(),u("span",xc,l(o.translations.pending),1)):g("",!0),n.quote.status=="approved"?(d(),u("span",Ic,l(o.translations.approved),1)):g("",!0),n.quote.status=="rejected"?(d(),u("span",Ec,l(o.translations.rejected),1)):g("",!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,[x(l(n.client_detail.address),1),Tc,x(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),kc,x(" "+l(n.client_detail.country),1),Ac,n.client_detail.phone?(d(),u("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Sc)):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,[x(l(n.settings.company_address),1),Pc,x(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Dc,x(" "+l(n.settings.country),1),jc,n.settings.company_phone?(d(),u("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,Mc)):g("",!0),qc,n.settings.mobile_phone?(d(),u("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Oc)):g("",!0)])])]),D(m,{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]=c=>n.editItemsModal=!1),onItemEdited:o.fetchItems},null,8,["loading","show-modal","modal-title","item","onItemEdited"]),i("form",{onSubmit:e[22]||(e[22]=J((...c)=>o.submitItems&&o.submitItems(...c),["prevent"]))},[i("table",Rc,[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",Xc,l(o.translations.unit_price),1),i("th",Qc,l(o.translations.vat),1),i("th",Uc,l(o.translations.discount),1),i("th",Lc,l(o.translations.total),1),zc])]),i("tbody",null,[(d(!0),u(X,null,Q(n.quoteItems,(c,p)=>(d(),u("tr",{key:c.id||p},[Hc,i("td",null,l(c.item_ref),1),i("td",null,[c.category_name?(d(),u("div",Gc,l(c.category_name),1)):g("",!0),i("div",null,l(c.item_name),1)]),i("td",{innerHTML:o.nl2br(c.item_description)},null,8,Yc),i("td",Kc,l(c.quantity),1),i("td",Jc,[x(l(c.unit_price),1),n.default_currency_symbol==n.client_currency?(d(),u("span",Zc,l(n.default_currency_symbol),1)):(d(),u("span",$c,l(n.client_currency),1))]),i("td",ed,l(c.vat_rate)+"%",1),i("td",td,[x(l(c.discount)+"% ",1),nd,x(" "+l(o.calculateDiscountAmount(c.quantity,c.unit_price,c.vat_rate,c.discount)),1)]),i("td",sd,[x(l(c.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(d(),u("span",od,l(n.default_currency_symbol),1)):(d(),u("span",id,l(n.client_currency),1))]),i("td",null,[n.quote.status=="draft"||n.quote.status=="pending"?(d(),u("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:J(_=>o.editItem(c.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},cd,8,ld)],8,ad)):g("",!0),n.quote.status=="draft"||n.quote.status=="pending"?(d(),u("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:J(_=>o.confirmremoveItem(c.id,n.quote.id),["prevent"]),class:"bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-3 mx-2 rounded"},[c.loading_del?g("",!0):(d(),u("i",hd)),c.loading_del?(d(),u("span",md)):g("",!0)],8,ud)],8,dd)):g("",!0)])]))),128)),n.quote.status=="draft"||n.quote.status=="pending"?(d(),u("tr",fd,[pd,i("td",_d,[i("div",gd,[F(i("input",{type:"text","onUpdate:modelValue":e[3]||(e[3]=c=>n.newItem.item_ref=c),onInput:e[4]||(e[4]=(...c)=>o.fetchRefs&&o.fetchRefs(...c)),onFocus:e[5]||(e[5]=c=>n.showDropdownRef=!0),placeholder:o.translations.item_ref,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,vd),[[K,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(d(),u("ul",yd,[(d(!0),u(X,null,Q(n.refs,c=>(d(),u("li",{key:c.ref,onClick:p=>o.selectItem(c),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(c.ref)},null,8,bd))),128))])):g("",!0)])]),i("td",wd,[F(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[6]||(e[6]=c=>n.newItem.item_category=c)},[xd,(d(!0),u(X,null,Q(n.categories,c=>(d(),u("option",{key:c.id,value:c.id},l(c.name),9,Id))),128))],512),[[Ie,n.newItem.item_category]]),i("div",Ed,[F(i("input",{type:"text","onUpdate:modelValue":e[7]||(e[7]=c=>n.newItem.item_name=c),onInput:e[8]||(e[8]=(...c)=>o.fetchArticles&&o.fetchArticles(...c)),onFocus:e[9]||(e[9]=c=>n.showDropdown=!0),placeholder:o.translations.item_name,class:"w-full p-2.5 bg-transparent input-xs outline-none"},null,40,Cd),[[K,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(d(),u("ul",Td,[(d(!0),u(X,null,Q(n.articles,c=>(d(),u("li",{key:c.name,onClick:p=>o.selectItem(c),class:"autocomplete-item hover:bg-base-200",innerHTML:o.highlightMatch(c.name)},null,8,kd))),128))])):g("",!0)])]),i("td",Ad,[i("div",Sd,[F(i("textarea",{"onUpdate:modelValue":e[10]||(e[10]=c=>n.newItem.item_description=c),placeholder:o.translations.item_description,class:"textarea textarea-bordered input-xs w-full",onInput:e[11]||(e[11]=c=>o.resize()),ref:"textarea"},null,40,Pd),[[K,n.newItem.item_description]])])]),i("td",Dd,[i("div",jd,[i("div",Md,[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]=(...c)=>o.decrease&&o.decrease(...c))}," - "),F(i("input",{type:"number",min:"1","onUpdate:modelValue":e[13]||(e[13]=c=>n.newItem.quantity=c),placeholder:o.translations.quantity,class:"w-full p-2.5 bg-transparent outline-none max-w-40",onInput:e[14]||(e[14]=(...c)=>o.updateTotal&&o.updateTotal(...c))},null,40,qd),[[K,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]=(...c)=>o.increase&&o.increase(...c))}," + ")])])]),i("td",Od,[i("div",Rd,[F(i("input",{type:"number","onUpdate:modelValue":e[16]||(e[16]=c=>n.newItem.unit_price=c),placeholder:o.translations.unit_price,class:"w-full p-2.5 bg-transparent outline-none max-w-40",onInput:e[17]||(e[17]=(...c)=>o.updateTotal&&o.updateTotal(...c))},null,40,Vd),[[K,n.newItem.unit_price]])])]),i("td",Nd,[F(i("select",{"onUpdate:modelValue":e[18]||(e[18]=c=>n.newItem.vat_rate=c),onChange:e[19]||(e[19]=(...c)=>o.updateTotal&&o.updateTotal(...c)),class:"select select-md w-full mb-1 ecwp-select min-w-20"},[(d(!0),u(X,null,Q(n.list_vats,c=>(d(),u("option",{key:c,value:c.rate},l(c.rate)+"% ",9,Bd))),128))],544),[[Ie,n.newItem.vat_rate]])]),i("td",Fd,[i("div",Wd,[F(i("input",{type:"number",min:"0",max:"100","onUpdate:modelValue":e[20]||(e[20]=c=>n.newItem.discount=c),placeholder:o.translations.discount,class:"w-full p-2.5 bg-transparent outline-none max-w-40",onInput:e[21]||(e[21]=(...c)=>o.updateTotal&&o.updateTotal(...c))},null,40,Xd),[[K,n.newItem.discount]]),Qd])]),i("td",Ud,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",zd,[n.loading_add?g("",!0):(d(),u("i",Hd)),n.loading_add?(d(),u("span",Gd)):g("",!0)])],8,Ld)])])):g("",!0),i("tr",null,[i("td",Yd,[i("strong",null,l(o.translations.subtotal),1)]),i("td",Kd,[o.totalAmount!==o.totalAmountWithoutDiscount?(d(),u("span",Jd,l(o.totalAmountWithoutDiscount),1)):g("",!0),x(" "+l(o.totalAmount),1)]),Zd]),n.settings.vat_active==1?(d(!0),u(X,{key:1},Q(o.getUniqueVATRates(),(c,p)=>(d(),u("tr",{key:p},[i("td",$d,[i("strong",null,l(o.translations.tax)+" ("+l(c)+"%) ",1)]),i("td",eu,l(o.calculateVATForRate(c)),1),tu]))),128)):g("",!0),i("tr",null,[i("td",nu,[i("strong",null,l(o.translations.total),1)]),i("td",su,l(o.calculateTotalAmountWithVAT()),1),ou]),n.client_currency!=n.default_currency_symbol?(d(),u("tr",iu,[i("td",au,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",lu,l(n.quote.exchange_rate),1)])):g("",!0),n.client_currency!=n.default_currency_symbol?(d(),u("tr",ru,[i("td",cu,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",du,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):g("",!0)])])],32),n.settings.easy_compta_signature_addon_active&&n.quote.signed==1&&n.quote.file_sign?(d(),u("div",uu,[i("div",hu,[i("span",mu,[i("img",{src:o.signatureImageUrl,alt:"Signature"},null,8,fu)])])])):g("",!0)]),_:1})])}var _u=oe(ac,[["render",pu]]);const gu={name:"QuoteNew",components:{Card:Qe,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)}}},vu={class:"pt-2 pr-4"},yu={class:"flex justify-between items-center mb-4"},bu={class:"card-title"},wu=i("div",{class:"divider mt-2"},null,-1),xu={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"},Iu={class:"grid grid-cols-3 gap-4"},Eu={class:"ecwp-group form-group mb-4"},Cu={for:"quoteNumber",class:"ecwp-label"},Tu={class:"ecwp-group form-group mb-4"},ku={for:"quoteDate",class:"ecwp-label"},Au={class:"ecwp-group form-group mb-4"},Su={for:"quoteDatePr",class:"ecwp-label"},Pu={class:"grid grid-cols-2 gap-4"},Du={class:"ecwp-group form-group mb-4"},ju={for:"client",class:"ecwp-label"},Mu={class:"ecwp-group form-group mb-4"},qu={for:"status",class:"ecwp-label"},Ou={value:"draft",selected:""},Ru={value:"pending"},Vu={value:"approved"},Nu={value:"rejected"},Bu={class:"flex justify-between"},Fu=["disabled"],Wu={key:0,class:"loading loading-spinner loading-sm"};function Xu(t,e,s,a,n,o){const f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return d(),u("div",vu,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),D(m,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",yu,[i("h2",bu,l(o.translations.new_quote),1)]),wu,n.loading?(d(),u("div",xu)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=J((...r)=>o.submitQuote&&o.submitQuote(...r),["prevent"]))},[i("div",Iu,[i("div",Eu,[i("label",Cu,l(o.translations.quote_number),1),F(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.quote.number=r),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[K,n.quote.number]])]),i("div",Tu,[i("label",ku,l(o.translations.due_date),1),D(f,{class:T(["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]=r=>n.quote.due_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",Au,[i("label",Su,l(o.translations.provisional_date),1),D(f,{class:T(["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]=r=>n.quote.provisional_start_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])])]),i("div",Pu,[i("div",Du,[i("label",ju,l(o.translations.company_name),1),D(h,{modelValue:n.quote.client_id,"onUpdate:modelValue":e[3]||(e[3]=r=>n.quote.client_id=r),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:T(["ecwp-input input input-bordered w-full",[!n.quote.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Mu,[i("label",qu,l(o.translations.status),1),F(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=r=>n.quote.status=r),class:T(["ecwp-input select select-bordered w-full",[!n.quote.status&&n.showError?"input-error":""]])},[i("option",Ou,l(o.translations.draft),1),i("option",Ru,l(o.translations.pending),1),i("option",Vu,l(o.translations.approved),1),i("option",Nu,l(o.translations.rejected),1)],2),[[Ie,n.quote.status]])])]),i("div",Bu,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.submit)+" ",1),n.loadingBtn?(d(),u("span",Wu)):g("",!0)],8,Fu)])],32)]),_:1})])}var Qu=oe(gu,[["render",Xu]]);const Uu={name:"InvoicesList",components:{Card:Qe,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}}},Lu={class:"pt-2 pr-4"},zu={class:"flex justify-between items-center"},Hu={class:"card-title"},Gu={class:"btn btn-primary rounded-full"},Yu=i("i",{class:"fas fa-plus-circle"},null,-1),Ku={key:0,class:"ms-2"},Ju={class:"btn btn-outline btn-accent rounded-full hover:text-white",href:"/wp-admin/admin.php?page=my-easy-compta-export#tab3"},Zu=i("i",{class:"fas fa-file-export"},null,-1),$u=["data-tip"],eh={class:"btn btn-outline btn-accent rounded-full",disabled:""},th=i("i",{class:"fas fa-file-export"},null,-1),nh=i("div",{class:"divider mt-2"},null,-1),sh={class:"flex items-center mb-4"},oh={for:"perPageSelect",class:"mr-2"},ih=["value"],ah={class:"overflow-x-auto"},lh={key:0,class:"table w-full"},rh={class:"flex justify-center"},ch={key:0,class:"badge badge-primary badge-outline badge-sm mr-2"},dh={key:0,class:"badge badge-scondary badge-outline badge-sm"},uh={key:1,class:"badge badge-warning badge-outline badge-sm"},hh={key:2,class:"badge badge-success badge-outline badge-sm"},mh={key:3,class:"badge badge-error badge-outline badge-sm ms-2"},fh={key:0},ph={key:0},_h={key:0},gh={key:1},vh={key:0},yh={key:1},bh={key:1},wh=i("span",{class:"loading loading-bars loading-sm"},null,-1),xh=[wh],Ih={key:0},Eh={key:1},Ch=i("span",{class:"loading loading-bars loading-sm"},null,-1),Th=[Ch],kh={key:0},Ah={key:1},Sh=i("span",{class:"loading loading-bars loading-sm"},null,-1),Ph=[Sh],Dh={class:"flex justify-end"},jh=["data-tip"],Mh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"far fa-eye"})],-1),qh=["data-tip"],Oh=i("button",{class:"btn btn-circle mx-1"},[i("i",{class:"fas fa-pencil-alt"})],-1),Rh=["data-tip"],Vh=["onClick"],Nh=i("i",{class:"far fa-trash-alt"},null,-1),Bh=[Nh],Fh={key:1},Wh=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),Xh=i("div",{class:"divider my-1"},null,-1),Qh=[Wh,Xh],Uh={class:"join ecwp_pagination mt-6 pt-4"},Lh=["onClick"];function zh(t,e,s,a,n,o){const f=M("remove-modal"),h=M("router-link"),m=M("Card");return d(),u("div",Lu,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!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]=r=>this.deleteInvoice(n.selectedInvoice)),onCancel:e[1]||(e[1]=r=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),D(m,{topMargin:"mt-8"},{default:re(()=>[i("div",zu,[i("h2",Hu,l(o.translations.invoices),1),i("div",null,[D(h,{to:{name:"InvoiceNew"}},{default:re(()=>[i("button",Gu,[x(l(o.translations.add)+" ",1),Yu])]),_:1}),n.settings.easy_compta_export_addon_active==1?(d(),u("span",Ku,[i("a",Ju,[x(l(o.translations.export)+" ",1),Zu])])):(d(),u("span",{key:1,class:"tooltip tooltip-left tooltip-warning ms-2","data-tip":o.translations.active_export_addon},[i("button",eh,[x(l(o.translations.export)+" ",1),th])],8,$u))])]),nh,i("div",sh,[i("label",oh,l(o.translations.display_per_page),1),F(i("select",{id:"perPageSelect","onUpdate:modelValue":e[2]||(e[2]=r=>n.perPage=r),onChange:e[3]||(e[3]=(...r)=>o.perPageChanged&&o.perPageChanged(...r))},[(d(!0),u(X,null,Q(n.perPageOptions,r=>(d(),u("option",{key:r,value:r},l(r),9,ih))),128))],544),[[Ie,n.perPage]])]),i("div",ah,[n.loading?(d(),u("div",Fh,[(d(!0),u(X,null,Q(n.skeletonRows,r=>(d(),u("div",{key:r,class:"flex flex-col gap-4 w-full"},Qh))),128))])):(d(),u("table",lh,[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",rh,l(o.translations.actions),1)])]),i("tbody",null,[(d(!0),u(X,null,Q(n.invoices,r=>(d(),u("tr",{key:r.id},[i("td",null,[r.advance==1?(d(),u("span",ch,l(o.translations.advance),1)):g("",!0),x(l(r.invoice_number),1)]),i("td",null,l(r.client_name),1),i("td",null,[r.status=="draft"?(d(),u("span",dh,l(o.translations.draft),1)):g("",!0),r.status=="unpaid"?(d(),u("span",uh,l(o.translations.unpaid),1)):g("",!0),r.status=="paid"?(d(),u("span",hh,l(o.translations.paid),1)):g("",!0),r.credit=="1"?(d(),u("span",mh,l(o.translations.credit),1)):g("",!0)]),i("td",null,[n.loadingPrice?(d(),u("div",bh,xh)):(d(),u("div",fh,[n.settings.easy_compta_advance_addon_active&&r.advance==1?(d(),u("div",ph,l(o.formatAmount(r.advance_amount,r.client_currency||n.default_currency_symbol)),1)):g("",!0),n.settings.vat_active==1?(d(),u("div",{key:1,class:T({"text-xs":r.advance==1})},[n.default_currency_symbol==r.client_currency||r.client_currency==null?(d(),u("span",_h,l(o.formatAmount(r.total_amount,n.default_currency_symbol)),1)):(d(),u("span",gh,l(o.formatAmount(r.total_amount,r.client_currency)),1))],2)):(d(),u("div",{key:2,class:T({"text-xs":r.advance==1})},[n.default_currency_symbol==r.client_currency||r.client_currency==null?(d(),u("span",vh,l(o.formatAmount(r.total_amount,n.default_currency_symbol)),1)):(d(),u("span",yh,l(o.formatAmount(r.total_amount,r.client_currency)),1))],2))]))]),i("td",null,[n.loadingPrice?(d(),u("div",Eh,Th)):(d(),u("div",Ih,l(r.due_date),1))]),i("td",null,[n.loadingPrice?(d(),u("div",Ah,Ph)):(d(),u("div",kh,l(r.created),1))]),i("td",Dh,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[D(h,{to:{name:"InvoiceViewDetail",params:{id:r.id}}},{default:re(()=>[Mh]),_:2},1032,["to"])],8,jh),r.status=="draft"?(d(),u("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[D(h,{to:{name:"InvoiceEdit",params:{id:r.id}}},{default:re(()=>[Oh]),_:2},1032,["to"])],8,qh)):g("",!0),r.status=="draft"?(d(),u("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:c=>o.confirmDeleteInvoice(r.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Bh,8,Vh)],8,Rh)):g("",!0)])]))),128))])]))]),i("div",Uh,[(d(!0),u(X,null,Q(n.paginationButtons,r=>(d(),u("button",{key:r,class:T(["join-item btn",{"btn-disabled":r==="..."||r===n.currentPage}]),onClick:c=>o.goToPage(r)},l(r),11,Lh))),128))])]),_:1})])}var Hh=oe(Uu,[["render",zh]]);const Gh={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)}}},Yh=["id","open"],Kh={class:"modal-box"},Jh={class:"font-bold text-lg"},Zh={key:0},$h={class:"grid grid-cols-1 gap-4"},em=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),tm=i("div",{class:"skeleton h-4 w-full"},null,-1),nm=[em,tm],sm={class:"grid grid-cols-1 gap-4"},om=["type"],im=["for"],am=["id","value","disabled","onInput"],lm={key:1},rm=["for"],cm={class:"form-group mt-4 flex justify-end"},dm=["disabled"],um={key:0,class:"loading loading-spinner loading-sm"};function hm(t,e,s,a,n,o){const f=M("vue-editor");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Kh,[i("h3",Jh,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?(d(),u("div",Zh,[i("div",$h,[(d(!0),u(X,null,Q(o.skeletonItems,h=>(d(),u("div",{key:h,class:"py-2"},nm))),128))])])):(d(),u("form",{key:1,onSubmit:e[1]||(e[1]=J((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",sm,[(d(!0),u(X,null,Q(n.fields,(h,m)=>(d(),u("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(d(),u("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,im),i("input",{id:m,class:T(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,am)],8,om)):(d(),u("div",lm,[i("label",{for:m,class:"form-label"},l(h.label),9,rm),D(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",cm,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.send)+" ",1),n.loadingBtn?(d(),u("span",um)):g("",!0)],8,dm)])],32))])],8,Yh)])}var mm=oe(Gh,[["render",hm]]);const fm={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()}}},pm=["open"],_m={class:"modal-box"},gm={class:"font-bold text-lg"},vm=i("div",{class:"text-center text-red-400 mb-2"},[i("i",{class:"fas fa-exclamation-triangle text-4xl"})],-1),ym={class:"text-lg font-semibold text-center"},bm={class:"my-4 text-center text-xl"},wm={class:"flex justify-between space-x-4"};function xm(t,e,s,a,n,o){return d(),u("div",null,[i("dialog",{id:"modal_confirm_credit",class:"modal",open:t.showModal},[i("div",_m,[i("h3",gm,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 "),vm,i("h2",ym,l(s.title),1),i("p",bm,l(s.message),1),i("div",wm,[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,pm)])}var Im=oe(fm,[["render",xm]]);const Em={name:"InvoiceNavBar",components:{SendInvoiceModal:mm,RemoveModal:xt,ConfirmModal:bn,ConfirmModalCredit:Im},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:{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.showModal(),this.showConfirmModal=!0},confirmCreditInvoice(){modal_confirm_credit.showModal(),this.showConfirmCreditModal=!0}}},Cm={key:0},Tm={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"},km=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Am=[km],Sm={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Pm=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),Dm={class:"hidden lg:flex gap-2"},jm={class:"btn btn-sm"},Mm=i("i",{class:"far fa-edit"},null,-1),qm={key:1},Om={class:"btn btn-sm",disabled:""},Rm=i("i",{class:"far fa-edit"},null,-1),Vm={key:2},Nm=i("i",{class:"fa fa-check"},null,-1),Bm={class:"btn btn-outline btn-success btn-sm hover:text-white",disabled:""},Fm=i("i",{class:"fa fa-check"},null,-1),Wm={key:0},Xm={class:"btn btn-sm ms-2",disabled:""},Qm=i("i",{class:"fas fa-undo"},null,-1),Um={key:1},Lm=i("i",{class:"fas fa-undo"},null,-1),zm=["disabled"],Hm=i("i",{class:"far fa-file-pdf"},null,-1),Gm={key:0,class:"loading loading-spinner loading-sm"},Ym={class:"flex gap-2"},Km=i("i",{class:"fas fa-paper-plane"},null,-1),Jm={key:0},Zm={key:1},$m={key:2,class:"far fa-envelope"},ef=["data-tip"],tf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},nf=i("i",{class:"fas fa-paper-plane"},null,-1),sf=["data-tip"],of={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},af=i("i",{class:"fas fa-paper-plane"},null,-1),lf={key:3},rf={key:0,class:"dropdown dropdown-end"},cf={tabindex:"0",role:"button",class:"btn btn-outline btn-success btn-sm"},df=i("i",{class:"far fa-file-pdf"},null,-1),uf={key:0,class:"loading loading-spinner loading-sm"},hf={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},mf=["disabled"],ff=["disabled"],pf={key:4},_f=["disabled"],gf=i("i",{class:"far fa-file-pdf"},null,-1),vf={key:0},yf={key:1},bf={key:2,class:"loading loading-spinner loading-sm"},wf=i("i",{class:"fas fa-check"},null,-1),xf=["data-tip"],If={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Ef=i("i",{class:"fas fa-check"},null,-1);function Cf(t,e,s,a,n,o){const f=M("send-invoice-modal"),h=M("confirm-modal"),m=M("confirm-modal-credit"),r=M("router-link");return d(),u("div",null,[s.emailActive==1?(d(),u("div",Cm,[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]=c=>n.sendInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):g("",!0),D(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:e[1]||(e[1]=c=>this.changeInvoiceStatus(n.selectedStatus)),onCancel:e[2]||(e[2]=c=>n.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","status"]),D(m,{"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[3]||(e[3]=c=>this.addCreditInvoice()),onCancel:e[4]||(e[4]=c=>n.showConfirmCreditModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(d(),u("div",Tm,Am)):g("",!0),i("div",Sm,[i("div",null,[Pm,i("div",Dm,[s.invoiceInfo.status=="draft"?(d(),Vs(r,{key:0,to:{name:"InvoiceEdit",params:{id:s.invoiceInfo.id}}},{default:re(()=>[i("button",jm,[Mm,x(" "+l(o.translations.edit_invoice),1)])]),_:1},8,["to"])):(d(),u("div",qm,[i("button",Om,[Rm,x(" "+l(o.translations.edit_invoice),1)])])),s.invoiceInfo.status=="unpaid"&&!s.noItems?(d(),u("div",Vm,[i("button",{class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[5]||(e[5]=c=>o.confirmValidateInvoice("paid"))},[Nm,x(" "+l(o.translations.mark_as_paid),1)])])):(d(),u(X,{key:3},[i("div",null,[i("button",Bm,[Fm,x(" "+l(o.translations.mark_as_paid),1)])]),s.invoiceInfo.credit!=0&&s.invoiceInfo.status=="paid"&&!s.noItems?(d(),u("div",Wm,[i("button",Xm,[Qm,x(" "+l(o.translations.credit_invoice),1)])])):g("",!0),s.invoiceInfo.credit==0&&s.invoiceInfo.status=="paid"&&!s.noItems?(d(),u("div",Um,[i("button",{class:"btn btn-sm ms-2",onClick:e[6]||(e[6]=c=>o.confirmCreditInvoice())},[Lm,x(" "+l(o.translations.credit_invoice),1)])])):g("",!0)],64))])]),s.invoiceInfo.status=="draft"?(d(),u("button",{key:0,onClick:e[7]||(e[7]=c=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-secondary btn-sm",disabled:n.loadingPdf},[Hm,i("span",null,l(o.translations.previewPDF),1),n.loadingPdf?(d(),u("span",Gm)):g("",!0)],8,zm)):g("",!0),i("div",Ym,[s.emailActive==1&&s.invoiceInfo.status!="draft"?(d(),u("button",{key:0,onClick:e[8]||(e[8]=J(c=>o.sendInvoice(s.invoiceInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[Km,s.invoiceInfo.sent==1?(d(),u("span",Jm,l(o.translations.resend_invoice),1)):(d(),u("span",Zm,l(o.translations.send_invoice),1)),s.invoiceInfo.sent==1?(d(),u("i",$m)):g("",!0)])):s.emailActive==1&&s.invoiceInfo.status=="draft"?(d(),u("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.draft_cannot_send},[i("button",tf,[nf,x(" "+l(o.translations.send_invoice),1)])],8,ef)):(d(),u("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",of,[af,x(" "+l(o.translations.send_invoice),1)])],8,sf)),s.currencyDefault.currency_id!==s.currencyClient.currency_id?(d(),u("div",lf,[s.invoiceInfo.status!="draft"?(d(),u("div",rf,[i("div",cf,[df,x(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(d(),u("span",uf)):g("",!0)]),i("ul",hf,[i("li",null,[i("a",{onClick:e[9]||(e[9]=c=>o.exportToPDF(s.currencyDefault.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyDefault.currency_symbol),9,mf)]),i("li",null,[i("a",{onClick:e[10]||(e[10]=c=>o.exportToPDF(s.currencyClient.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyClient.currency_symbol),9,ff)])])])):g("",!0)])):(d(),u("div",pf,[s.invoiceInfo.status!="draft"?(d(),u("button",{key:0,onClick:e[11]||(e[11]=c=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[gf,s.invoiceInfo.status!="draft"?(d(),u("span",vf,l(o.translations.exportToPDF),1)):(d(),u("span",yf,l(o.translations.previewPDF),1)),n.loadingPdf?(d(),u("span",bf)):g("",!0)],8,_f)):g("",!0)])),s.invoiceInfo.status=="draft"&&!s.noItems?(d(),u("button",{key:5,class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[12]||(e[12]=c=>o.confirmValidateInvoice("unpaid"))},[wf,x(" "+l(o.translations.validateInvoice),1)])):g("",!0),s.invoiceInfo.status=="draft"&&s.noItems?(d(),u("div",{key:6,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.min_article},[i("button",If,[Ef,x(" "+l(o.translations.validateInvoice),1)])],8,xf)):g("",!0)])])])}var Tf=oe(Em,[["render",Cf]]);const kf={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}}},Af=["id","open"],Sf={class:"modal-box"},Pf={class:"font-bold text-lg"},Df={key:0},jf={class:"grid grid-cols-1 gap-4"},Mf=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),qf=i("div",{class:"skeleton h-4 w-full"},null,-1),Of=[Mf,qf],Rf={class:"grid grid-cols-1 gap-4"},Vf=["type"],Nf=["for"],Bf=["id","onUpdate:modelValue"],Ff={key:1},Wf=["for"],Xf={class:"form-group mt-4 flex justify-end"},Qf=["disabled"],Uf={key:0,class:"loading loading-spinner loading-sm"};function Lf(t,e,s,a,n,o){const f=M("vue-editor");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Sf,[i("h3",Pf,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?(d(),u("div",Df,[i("div",jf,[(d(!0),u(X,null,Q(o.skeletonItems,h=>(d(),u("div",{key:h,class:"py-2"},Of))),128))])])):(d(),u("form",{key:1,onSubmit:e[1]||(e[1]=J((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Rf,[(d(!0),u(X,null,Q(n.fields,(h,m)=>(d(),u("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(d(),u("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Nf),F(i("input",{id:m,"onUpdate:modelValue":r=>n.editedItem[m]=r,class:T(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,Bf),[[K,n.editedItem[m]]])],8,Vf)):(d(),u("div",Ff,[i("label",{for:m,class:"form-label"},l(h.label),9,Wf),D(f,{id:m,modelValue:n.editedItem[m],"onUpdate:modelValue":r=>n.editedItem[m]=r,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Xf,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.save)+" ",1),n.loadingBtn?(d(),u("span",Uf)):g("",!0)],8,Qf)])],32))])],8,Af)])}var zf=oe(kf,[["render",Lf]]);const Hf={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)}}},Gf=["id","open"],Yf={class:"modal-box"},Kf={class:"font-bold text-lg"},Jf={key:0},Zf={class:"grid grid-cols-1 gap-4"},$f=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),ep=i("div",{class:"skeleton h-4 w-full"},null,-1),tp=[$f,ep],np={class:"grid grid-cols-1 gap-4"},sp=["type"],op=["for"],ip=["id","value","disabled","onInput"],ap={key:1},lp=["for"],rp={class:"form-group mt-4 flex justify-end"},cp=["disabled"],dp={key:0,class:"loading loading-spinner loading-sm"};function up(t,e,s,a,n,o){const f=M("vue-editor");return d(),u("div",null,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Yf,[i("h3",Kf,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?(d(),u("div",Jf,[i("div",Zf,[(d(!0),u(X,null,Q(o.skeletonItems,h=>(d(),u("div",{key:h,class:"py-2"},tp))),128))])])):(d(),u("form",{key:1,onSubmit:e[1]||(e[1]=J((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",np,[(d(!0),u(X,null,Q(n.fields,(h,m)=>(d(),u("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(d(),u("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,op),i("input",{id:m,class:T(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,ip)],8,sp)):(d(),u("div",ap,[i("label",{for:m,class:"form-label"},l(h.label),9,lp),D(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",rp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.send)+" ",1),n.loadingBtn?(d(),u("span",dp)):g("",!0)],8,cp)])],32))])],8,Gf)])}var hp=oe(Hf,[["render",up]]);const mp={name:"InvoiceViewDetail",components:{Card:Qe,InvoiceNavBar:Tf,EditItemModal:zf,RemoveModal:xt,RemindInvoiceModal:hp},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.formatCurrency(t)},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,a=s*this.newItem.vat_rate/100,n=s+a;this.newItem.total_price=this.formatCurrency(s),this.newItem.total_amount=this.formatCurrency(n)},calculateTotal(t,e,s,a){const n=t*e,o=n*a/100,f=n-o,h=f*s/100,m=f+h;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}`},calculateDiscountAmount(t,e,s,a){const o=t*e*a/100,f=o*s/100,h=o+f;return this.formatCurrency(h)},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})}},fp={class:"pt-2 pr-4"},pp={key:0},_p={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"},gp=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),vp=[gp],yp={key:3},bp={role:"alert",class:"alert alert-warning"},wp=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),xp={key:0},Ip=["data-tip"],Ep={class:"btn btn-sm btn-primary",disabled:""},Cp={class:"grid grid-cols-2"},Tp={class:"md:col-span-1"},kp=["src"],Ap={class:"md:col-span-1 text-right"},Sp={class:"text-lg font-semibold"},Pp={key:0,class:"badge badge-error text-white"},Dp={key:1,class:"badge badge-error text-white"},jp={key:2,class:"badge badge-success text-white"},Mp={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},qp=i("br",null,null,-1),Op=i("br",null,null,-1),Rp=i("br",null,null,-1),Vp=["href"],Np=i("br",null,null,-1),Bp=i("br",null,null,-1),Fp=i("br",null,null,-1),Wp=["href"],Xp=i("br",null,null,-1),Qp=["href"],Up={class:"table mt-8"},Lp=i("th",null,null,-1),zp={width:"5%"},Hp={width:"19%"},Gp={width:"21%"},Yp={width:"10%",class:"text-center"},Kp={width:"8%",class:"text-center"},Jp={width:"5%",class:"text-center"},Zp={width:"10%",class:"text-center"},$p={width:"10%",class:"text-right"},e_=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),t_=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),n_={key:0,class:"badge badge-ghost badge-xs"},s_=["innerHTML"],o_={class:"text-center"},i_={class:"text-center"},a_={key:0},l_={key:1},r_={class:"text-center"},c_={class:"text-center"},d_=i("br",null,null,-1),u_={class:"text-right"},h_={key:0},m_={key:1},f_={key:0},p_=["data-tip"],__=["onClick"],g_=i("i",{class:"far fa-edit"},null,-1),v_=[g_],y_=["data-tip"],b_=["onClick"],w_={key:0,class:"far fa-trash-alt"},x_={key:1,class:"loading loading-spinner loading-xs"},I_={key:0},E_=i("td",{class:"px-2"},null,-1),C_={class:"align-top px-2"},T_={class:"flex items-center border rounded-md relative"},k_=["placeholder"],A_={key:0,class:"autocomplete-dropdown bg-base-100"},S_=["onClick","innerHTML"],P_={class:"align-top px-2"},D_=i("option",{disabled:"",selected:""},"Type",-1),j_=["value"],M_={class:"flex items-center border rounded-md relative"},q_=["placeholder"],O_={key:0,class:"autocomplete-dropdown bg-base-100"},R_=["onClick","innerHTML"],V_={class:"align-top"},N_={class:"flex items-center rounded-md"},B_=["placeholder"],F_={class:"align-top"},W_={class:"flex items-center border rounded-lg"},X_={class:"inline-flex"},Q_=["placeholder"],U_={class:"align-top"},L_={class:"flex items-center border rounded-md"},z_=["placeholder"],H_={class:"align-top"},G_=["value"],Y_={class:"align-top"},K_={class:"flex items-center border rounded-md"},J_=["placeholder"],Z_=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),$_={class:"text-right"},eg=["data-tip"],tg={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},ng={key:0,class:"fa fa-plus"},sg={key:1,class:"loading loading-spinner loading-xs"},og={colspan:"8",class:"text-right no-border"},ig={class:"text-right"},ag={key:0,class:"line-through"},lg=i("td",null,null,-1),rg={colspan:"8",class:"text-right no-border"},cg={class:"text-right"},dg=i("td",null,null,-1),ug={colspan:"8",class:"text-right no-border font-bold text-xl"},hg={class:"text-right no-border font-bold text-xl"},mg=i("td",null,null,-1),fg={key:2},pg={colspan:"8",class:"text-right no-border"},_g={class:"text-right no-border"},gg={key:3},vg={colspan:"8",class:"text-right no-border"},yg={class:"text-right no-border font-bold text-xl"};function bg(t,e,s,a,n,o){const f=M("InvoiceNavBar"),h=M("remove-modal"),m=M("remind-invoice-modal"),r=M("edit-item-modal"),c=M("Card");return d(),u("div",fp,[D(f,{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"]),D(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?(d(),u("div",pp,[D(m,{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"])])):g("",!0),n.toast.visible?(d(),u("div",{key:1,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),n.loading?(d(),u("div",_p,vp)):g("",!0),o.isInvoiceOverdue&&n.invoice.status=="unpaid"?(d(),u("div",yp,[i("div",bp,[wp,i("span",null,l(o.translations.invoice_overdue),1),n.settings.easy_compta_email_addon_active==1?(d(),u("div",xp,[i("button",{onClick:e[3]||(e[3]=J(p=>o.sendRemind(n.invoice.client_id),["prevent"])),class:"btn btn-sm btn-primary"},l(o.translations.remind_invoice),1)])):(d(),u("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",Ep,l(o.translations.remind_invoice),1)],8,Ip))])])):g("",!0),D(c,{topMargin:"mt-8",id:"invoice-content"},{default:re(()=>[i("div",Cp,[i("div",Tp,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,kp)])]),i("div",Ap,[i("p",Sp,l(n.invoice.invoice_number),1),i("div",null,[x(l(o.translations.created_at)+": ",1),i("strong",null,l(n.invoice.created_at),1)]),i("div",null,[x(l(o.translations.due_date)+": ",1),i("strong",null,l(n.invoice.due_date),1)]),i("div",null,[x(l(o.translations.status)+": ",1),n.invoice.status=="draft"?(d(),u("span",Pp,l(o.translations.draft),1)):g("",!0),n.invoice.status=="unpaid"?(d(),u("span",Dp,l(o.translations.unpaid),1)):g("",!0),n.invoice.status=="paid"?(d(),u("span",jp,l(o.translations.paid),1)):g("",!0)])])]),i("div",Mp,[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,[x(l(n.client_detail.address),1),qp,x(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),Op,x(" "+l(n.client_detail.country),1),Rp,n.client_detail.phone?(d(),u("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Vp)):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,[x(l(n.settings.company_address),1),Np,x(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Bp,x(" "+l(n.settings.country),1),Fp,n.settings.company_phone?(d(),u("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,Wp)):g("",!0),Xp,n.settings.mobile_phone?(d(),u("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Qp)):g("",!0)])])]),D(r,{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]=J((...p)=>o.submitItems&&o.submitItems(...p),["prevent"]))},[i("table",Up,[i("thead",null,[i("tr",null,[Lp,i("th",zp,l(o.translations.item_ref),1),i("th",Hp,l(o.translations.item_name),1),i("th",Gp,l(o.translations.description),1),i("th",Yp,l(o.translations.quantity),1),i("th",Kp,l(o.translations.unit_price),1),i("th",Jp,l(o.translations.vat),1),i("th",Zp,l(o.translations.discount),1),i("th",$p,l(o.translations.total),1),e_])]),i("tbody",null,[(d(!0),u(X,null,Q(n.invoiceItems,(p,_)=>(d(),u("tr",{key:p.id||_},[t_,i("td",null,l(p.item_ref),1),i("td",null,[p.category_name?(d(),u("div",n_,l(p.category_name),1)):g("",!0),i("div",null,l(p.item_name),1)]),i("td",{innerHTML:o.nl2br(p.item_description)},null,8,s_),i("td",o_,l(p.quantity),1),i("td",i_,[x(l(p.unit_price),1),n.default_currency_symbol==n.client_currency?(d(),u("span",a_,l(n.default_currency_symbol),1)):(d(),u("span",l_,l(n.client_currency),1))]),i("td",r_,l(p.vat_rate)+"%",1),i("td",c_,[x(l(p.discount)+"% ",1),d_,x(" "+l(o.calculateDiscountAmount(p.quantity,p.unit_price,p.vat_rate,p.discount)),1)]),i("td",u_,[x(l(p.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(d(),u("span",h_,l(n.default_currency_symbol),1)):(d(),u("span",m_,l(n.client_currency),1))]),i("td",null,[n.invoice.status=="draft"?(d(),u("div",f_,[i("span",{class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:J(v=>o.editItem(p.id),["prevent"]),class:"bg-purple-500 hover:bg-purple-700 text-white font-bold py-2 px-3 rounded"},v_,8,__)],8,p_),i("span",{class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:J(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?g("",!0):(d(),u("i",w_)),p.loading_del?(d(),u("span",x_)):g("",!0)],8,b_)],8,y_)])):g("",!0)])]))),128)),n.invoice.status=="draft"?(d(),u("tr",I_,[E_,i("td",C_,[i("div",T_,[F(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,k_),[[K,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(d(),u("ul",A_,[(d(!0),u(X,null,Q(n.refs,p=>(d(),u("li",{key:p.ref,onClick:_=>o.selectItem(p),class:"autocomplete-item",innerHTML:o.highlightMatch(p.ref)},null,8,S_))),128))])):g("",!0)])]),i("td",P_,[F(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[8]||(e[8]=p=>n.newItem.item_category=p)},[D_,(d(!0),u(X,null,Q(n.categories,p=>(d(),u("option",{key:p.id,value:p.id},l(p.name),9,j_))),128))],512),[[Ie,n.newItem.item_category]]),i("div",M_,[F(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,q_),[[K,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(d(),u("ul",O_,[(d(!0),u(X,null,Q(n.articles,p=>(d(),u("li",{key:p.name,onClick:_=>o.selectItem(p),class:"autocomplete-item bt-primary",innerHTML:o.highlightMatch(p.name)},null,8,R_))),128))])):g("",!0)])]),i("td",V_,[i("div",N_,[F(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,B_),[[K,n.newItem.item_description]])])]),i("td",F_,[i("div",W_,[i("div",X_,[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))}," - "),F(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",onInput:e[16]||(e[16]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,Q_),[[K,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",U_,[i("div",L_,[F(i("input",{type:"number","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",onInput:e[19]||(e[19]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,z_),[[K,n.newItem.unit_price]])])]),i("td",H_,[F(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"},[(d(!0),u(X,null,Q(n.list_vats,p=>(d(),u("option",{key:p,value:p.rate},l(p.rate)+"% ",9,G_))),128))],544),[[Ie,n.newItem.vat_rate]])]),i("td",Y_,[i("div",K_,[F(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",onInput:e[23]||(e[23]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,J_),[[K,n.newItem.discount]]),Z_])]),i("td",$_,l(o.calculateTotal(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1),i("td",null,[i("span",{class:"lg:tooltip","data-tip":o.translations.add},[i("button",tg,[n.loading_add?g("",!0):(d(),u("i",ng)),n.loading_add?(d(),u("span",sg)):g("",!0)])],8,eg)])])):g("",!0),i("tr",null,[i("td",og,[i("strong",null,l(o.translations.subtotal),1)]),i("td",ig,[o.totalAmount!==o.totalAmountWithoutDiscount?(d(),u("span",ag,l(o.totalAmountWithoutDiscount),1)):g("",!0),x(" "+l(o.totalAmount),1)]),lg]),n.settings.vat_active==1?(d(!0),u(X,{key:1},Q(o.getUniqueVATRates(),(p,_)=>(d(),u("tr",{key:_},[i("td",rg,[i("strong",null,l(o.translations.tax)+" ("+l(p)+"%) ",1)]),i("td",cg,l(o.calculateVATForRate(p)),1),dg]))),128)):g("",!0),i("tr",null,[i("td",ug,[i("strong",null,l(o.translations.total),1)]),i("td",hg,l(o.calculateTotalAmountWithVAT()),1),mg]),n.client_currency!=n.default_currency_symbol?(d(),u("tr",fg,[i("td",pg,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",_g,l(n.invoice.exchange_rate),1)])):g("",!0),n.client_currency!=n.default_currency_symbol?(d(),u("tr",gg,[i("td",vg,[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)])):g("",!0)])])],32)]),_:1})])}var wg=oe(mp,[["render",bg]]);const xg={name:"InvoiceNew",components:{Card:Qe,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)}}},Ig={class:"pt-2 pr-4"},Eg={class:"flex justify-between items-center mb-4"},Cg={class:"card-title"},Tg=i("div",{class:"divider mt-2"},null,-1),kg={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"},Ag={class:"grid grid-cols-2 gap-4"},Sg={class:"ecwp-group form-group mb-4"},Pg={for:"invoiceNumber",class:"ecwp-label"},Dg={class:"ecwp-group form-group mb-4"},jg={for:"invoiceDate",class:"ecwp-label"},Mg={class:"ecwp-group form-group mb-4"},qg={for:"client",class:"ecwp-label"},Og={class:"ecwp-group form-group mb-4"},Rg={for:"status",class:"ecwp-label"},Vg={value:"draft"},Ng={key:0,class:"ecwp-group form-group mb-4"},Bg={for:"exchangeRate",class:"ecwp-label"},Fg={class:"flex justify-between"},Wg=["disabled"],Xg={key:0,class:"loading loading-spinner loading-sm"};function Qg(t,e,s,a,n,o){const f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return d(),u("div",Ig,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),D(m,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",Eg,[i("h2",Cg,l(o.translations.new_invoice),1)]),Tg,n.loading?(d(),u("div",kg)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=J((...r)=>o.submitInvoice&&o.submitInvoice(...r),["prevent"]))},[i("div",Ag,[i("div",Sg,[i("label",Pg,l(o.translations.invoice_number),1),F(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.invoice.number=r),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[K,n.invoice.number]])]),i("div",Dg,[i("label",jg,l(o.translations.due_date),1),D(f,{class:T(["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]=r=>n.invoice.due_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",Mg,[i("label",qg,l(o.translations.company_name),1),D(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=r=>n.invoice.client_id=r),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:T(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",Og,[i("label",Rg,l(o.translations.status),1),F(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=r=>n.invoice.status=r),class:T(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",Vg,l(o.translations.draft),1)],2),[[Ie,n.invoice.status]])]),o.currencyMismatch?(d(),u("div",Ng,[i("label",Bg,l(o.translations.exchange_rate),1),F(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=r=>n.invoice.exchange_rate=r),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[K,n.invoice.exchange_rate]])])):g("",!0)]),i("div",Fg,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.submit)+" ",1),n.loadingBtn?(d(),u("span",Xg)):g("",!0)],8,Wg)])],32)]),_:1})])}var Ug=oe(xg,[["render",Qg]]);const Lg={name:"invoiceEdit",components:{Card:Qe,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)}}},zg={class:"pt-2 pr-4"},Hg={class:"flex justify-between items-center mb-4"},Gg={class:"card-title"},Yg=i("div",{class:"divider mt-2"},null,-1),Kg={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"},Jg={class:"grid grid-cols-2 gap-4"},Zg={class:"ecwp-group form-group mb-4"},$g={for:"invoiceNumber",class:"ecwp-label"},ev={class:"ecwp-group form-group mb-4"},tv={for:"invoiceDate",class:"ecwp-label"},nv={class:"ecwp-group form-group mb-4"},sv={for:"client",class:"ecwp-label"},ov={class:"ecwp-group form-group mb-4"},iv={for:"status",class:"ecwp-label"},av={value:"draft",selected:""},lv={value:"unpaid"},rv={value:"paid"},cv={key:0,class:"ecwp-group form-group mb-4"},dv={for:"exchangeRate",class:"ecwp-label"},uv={class:"flex justify-between"},hv=["disabled"],mv={key:0,class:"loading loading-spinner loading-sm"};function fv(t,e,s,a,n,o){const f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return d(),u("div",zg,[n.toast.visible?(d(),u("div",{key:0,class:T(["toast",n.toast.position]),style:{zIndex:9999}},[i("div",{class:T(["alert",n.toast.type,"text-white"])},[i("span",null,l(n.toast.message),1)],2)],2)):g("",!0),D(m,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",Hg,[i("h2",Gg,l(o.translations.edit_invoice),1)]),Yg,n.loading?(d(),u("div",Kg)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=J((...r)=>o.submitInvoice&&o.submitInvoice(...r),["prevent"]))},[i("div",Jg,[i("div",Zg,[i("label",$g,l(o.translations.invoice_number),1),F(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.invoice.invoice_number=r),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[K,n.invoice.invoice_number]])]),i("div",ev,[i("label",tv,l(o.translations.due_date),1),D(f,{class:T(["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]=r=>n.invoice.due_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",nv,[i("label",sv,l(o.translations.company_name),1),D(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=r=>n.invoice.client_id=r),options:n.clientOptions,label:"text","track-by":"value",placeholder:o.translations.select,class:T(["ecwp-input input input-bordered w-full",[!n.invoice.client_id&&n.showError?"input-error":""]])},null,8,["modelValue","options","placeholder","class"])]),i("div",ov,[i("label",iv,l(o.translations.status),1),F(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=r=>n.invoice.status=r),class:T(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",av,l(o.translations.draft),1),i("option",lv,l(o.translations.unpaid),1),i("option",rv,l(o.translations.paid),1)],2),[[Ie,n.invoice.status]])]),o.currencyMismatch?(d(),u("div",cv,[i("label",dv,l(o.translations.exchange_rate),1),F(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=r=>n.invoice.exchange_rate=r),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[K,n.invoice.exchange_rate]])])):g("",!0)]),i("div",uv,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},l(o.translations.cancel),1),i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[x(l(o.translations.save)+" ",1),n.loadingBtn?(d(),u("span",mv)):g("",!0)],8,hv)])],32)]),_:1})])}var pv=oe(Lg,[["render",fv]]);const fe=Ut;(function(t,e){const s=Ut,a=t();for(;[];)try{if(-parseInt(s(125))/1*(-parseInt(s(140))/2)+-parseInt(s(120))/3*(-parseInt(s(134))/4)+-parseInt(s(135))/5*(parseInt(s(142))/6)+parseInt(s(121))/7*(-parseInt(s(130))/8)+parseInt(s(133))/9*(-parseInt(s(137))/10)+parseInt(s(127))/11*(-parseInt(s(139))/12)+-parseInt(s(129))/13*(-parseInt(s(136))/14)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Qt,142165);function Qt(){const t=["/quote/edit/:id","66069nKvLVw","602245eneFNf","InvoiceViewDetail","/quote/new","/invoices","33697saBYbq","/quote/detail/:id","17930GhfEfd","InvoiceNew","13ywfxSK","24Tajaus","QuoteEdit","/invoice/detail/:id","9YGZylV","20VhFRVw","32345vKqlxG","10776892PVPNgO","825710PLQsMV","Invoice","1800ihvJqZ","4brrDgA","/invoice/new","204aukWrI","/quotes","Quote","InvoiceEdit"];return Qt=function(){return t},Qt()}function Ut(t,e){const s=Qt();return Ut=function(a,n){return a=a-116,s[a]},Ut(t,e)}const _v=[{path:fe(116),name:fe(117),component:ja},{path:fe(126),name:"QuoteViewDetail",component:_u},{path:fe(123),name:"QuoteNew",component:Qu},{path:fe(119),name:fe(131),component:_s},{path:fe(124),name:fe(138),component:Hh},{path:fe(132),name:fe(122),component:wg},{path:"/invoice/edit/:id",name:fe(118),component:pv},{path:fe(141),name:fe(128),component:Ug}],Iv=Xo({history:_o(),routes:_v});export{Iv 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 Mt(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mt=function(e){return typeof e}:Mt=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Mt(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 Me(t){if(typeof window!="undefined"&&window.navigator)return!!navigator.userAgent.match(t)}var Oe=Me(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ct=Me(/Edge/i),Xn=Me(/firefox/i),ft=Me(/safari/i)&&!Me(/chrome/i)&&!Me(/android/i),gs=Me(/iP(ad|od|hone)/i),vs=Me(/chrome/i)&&Me(/android/i),ys={capture:!1,passive:!1};function W(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 xe(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,f,h,m,r,u,p;if(t!==window&&t.parentNode&&t!==ke()?(o=t.getBoundingClientRect(),f=o.top,h=o.left,m=o.bottom,r=o.right,u=o.height,p=o.width):(f=0,h=0,m=window.innerHeight,r=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 _=n.getBoundingClientRect();f-=_.top+parseInt(S(n,"border-top-width")),h-=_.left+parseInt(S(n,"border-left-width")),m=f+o.height,r=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&&(f/=C,h/=I,p/=I,u/=C,m=f+u,r=h+p)}return{top:f,left:h,bottom:m,right:r,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],f=void 0;if(s==="top"||s==="left"?f=n>=o:f=n<=o,!f)return a;if(a===ke())break;a=Xe(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)&&xe(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 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,f,h,m;if(!(!xe(n,e.draggable,t,!1)||n.animated||n===s)){var r=te(n);a.left=Math.min((o=a.left)!==null&&o!==void 0?o:1/0,r.left),a.top=Math.min((f=a.top)!==null&&f!==void 0?f:1/0,r.top),a.right=Math.max((h=a.right)!==null&&h!==void 0?h:-1/0,r.right),a.bottom=Math.max((m=a.bottom)!==null&&m!==void 0?m:-1/0,r.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 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(h){var m=0,r=h.target,u=r.fromRect,p=te(r),_=r.prevFromRect,v=r.prevToRect,I=h.rect,C=et(r,!0);C&&(p.top-=C.f,p.left-=C.e),r.toRect=p,r.thisAnimationDuration&&tn(_,p)&&!tn(u,p)&&(I.top-p.top)/(I.left-p.left)===(u.top-p.top)/(u.left-p.left)&&(m=Qr(I,_,v,n.options)),tn(p,u)||(r.prevFromRect=u,r.prevToRect=p,m||(m=n.options.animation),n.animate(r,I,p,m)),m&&(o=!0,f=Math.max(f,m),clearTimeout(r.animationResetTimer),r.animationResetTimer=setTimeout(function(){r.animationTime=0,r.prevFromRect=null,r.fromRect=null,r.prevToRect=null,r.thisAnimationDuration=null},m),r.thisAnimationDuration=m)}),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 h=et(this.el),m=h&&h.a,r=h&&h.d,u=(n.left-o.left)/(m||1),p=(n.top-o.top)/(r||1);a.animatingX=!!u,a.animatingY=!!p,S(a,"transform","translate3d("+u+"px,"+p+"px,0)"),this.forRepaintDummy=Ur(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 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(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(h){var m=h.pluginName;if(!(!e.options[m]&&!h.initializeByDefault)){var r=new h(e,s,e.options);r.sortable=e,r.options=e.options,e[m]=r,qe(a,r.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,h=t.fromEl,m=t.oldIndex,r=t.newIndex,u=t.oldDraggableIndex,p=t.newDraggableIndex,_=t.originalEvent,v=t.putSortable,I=t.extraEventProperties;if(e=e||s&&s[_e],!!e){var C,V=e.options,B="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=f||s,C.from=h||s,C.item=n||s,C.clone=o,C.oldIndex=m,C.newIndex=r,C.oldDraggableIndex=u,C.newDraggableIndex=p,C.originalEvent=_,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[B]&&V[B].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:j,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,j,H,He,qt,G,We,$e,pe,_t,Fe,St,ae,Ze=!1,Bt=!1,Ft=[],Le,be,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),f=st(e,1,s),h=o&&S(o),m=f&&S(f),r=h&&parseInt(h.marginLeft)+parseInt(h.marginRight)+te(o).width,u=m&&parseInt(m.marginLeft)+parseInt(m.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&&h.float&&h.float!=="none"){var p=h.float==="left"?"left":"right";return f&&(m.clear==="both"||m.clear===p)?"vertical":"horizontal"}return o&&(h.display==="block"||h.display==="flex"||h.display==="table"||h.display==="grid"||r>=n&&a[Gn]==="none"||f&&a[Gn]==="none"&&r+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,h=a?s.left:s.top,m=a?s.right:s.bottom,r=a?s.width:s.height;return n===h||o===m||n+f/2===h+r/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),h=e>=f.left-o&&e<=f.right+o,m=s>=f.top-o&&s<=f.bottom+o;if(h&&m)return a=n}}),a},Ts=function(e){function s(o,f){return function(h,m,r,u){var p=h.options.group.name&&m.options.group.name&&h.options.group.name===m.options.group.name;if(o==null&&(f||p))return!0;if(o==null||o===!1)return!1;if(f&&o==="clone")return o;if(typeof o=="function")return s(o(h,m,r,u),f)(h,m,r,u);var _=(f?h:m).options.group.name;return o===!0||typeof o=="string"&&o===_||o.join&&o.indexOf(_)>-1}}var a={},n=e.group;(!n||Mt(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&&j&&S(j,"display","none")},Ss=function(){!Cs&&j&&S(j,"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,h){f.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?W(t,"pointerdown",this._onTapStart):(W(t,"mousedown",this._onTapStart),W(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(W(t,"dragover",this),W(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,f=e.type,h=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,m=(h||e).target,r=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||m,u=n.filter;if(oc(a),!b&&!(/mousedown|pointerdown/.test(f)&&e.button!==0||n.disabled)&&!r.isContentEditable&&!(!this.nativeDraggable&&ft&&m&&m.tagName.toUpperCase()==="SELECT")&&(m=xe(m,n.draggable,a,!1),!(m&&m.animated)&&qt!==m)){if($e=ge(m),_t=ge(m,n.draggable),typeof u=="function"){if(u.call(this,e,m,this)){ue({sortable:s,rootEl:r,name:"filter",targetEl:m,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=xe(r,p.trim(),a,!1),p)return ue({sortable:s,rootEl:p,name:"filter",targetEl:m,fromEl:a,toEl:a}),me("filter",s,{evt:e}),!0}),u)){o&&e.cancelable&&e.preventDefault();return}n.handle&&!xe(r,n.handle,a,!1)||this._prepareDragStart(e,h,m)}}},_prepareDragStart:function(e,s,a){var n=this,o=n.el,f=n.options,h=o.ownerDocument,m;if(a&&!b&&a.parentNode===o){var r=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-r.left,Hn=Le.clientY-r.top,this._lastX=(s||e).clientX,this._lastY=(s||e).clientY,b.style["will-change"]="all",m=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,f.chosenClass,!0)},f.ignore.split(",").forEach(function(u){bs(b,u.trim(),ln)}),W(h,"dragover",ze),W(h,"mousemove",ze),W(h,"touchmove",ze),W(h,"mouseup",n._onDrop),W(h,"touchend",n._onDrop),W(h,"touchcancel",n._onDrop),Xn&&this.nativeDraggable&&(this.options.touchStartThreshold=4,b.draggable=!0),me("delayStart",this,{evt:e}),f.delay&&(!f.delayOnTouchOnly||s)&&(!this.nativeDraggable||!(Ct||Oe))){if(A.eventCanceled){this._onDrop();return}W(h,"mouseup",n._disableDelayedDrag),W(h,"touchend",n._disableDelayedDrag),W(h,"touchcancel",n._disableDelayedDrag),W(h,"mousemove",n._delayedDragTouchMoveHandler),W(h,"touchmove",n._delayedDragTouchMoveHandler),f.supportPointer&&W(h,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(m,f.delay)}else m()}},_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?W(document,"pointermove",this._onTouchMove):s?W(document,"touchmove",this._onTouchMove):W(document,"mousemove",this._onTouchMove):(W(b,"dragend",this),W(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&&W(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(be){this._lastX=be.clientX,this._lastY=be.clientY,As();for(var e=document.elementFromPoint(be.clientX,be.clientY),s=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(be.clientX,be.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:be.clientX,clientY:be.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=j&&et(j,!0),h=j&&f&&f.a,m=j&&f&&f.d,r=Pt&&le&&Ln(le),u=(o.clientX-Le.clientX+n.x)/(h||1)+(r?r[0]-an[0]:0)/(h||1),p=(o.clientY-Le.clientY+n.y)/(m||1)+(r?r[1]-an[1]:0)/(m||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(j){f?(f.e+=u-(sn||0),f.f+=p-(on||0)):f={a:1,b:0,c:0,d:1,e:u,f:p};var _="matrix(".concat(f.a,",").concat(f.b,",").concat(f.c,",").concat(f.d,",").concat(f.e,",").concat(f.f,")");S(j,"webkitTransform",_),S(j,"mozTransform",_),S(j,"msTransform",_),S(j,"transform",_),sn=u,on=p,be=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!j){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)}j=b.cloneNode(!0),fe(j,a.ghostClass,!1),fe(j,a.fallbackClass,!0),fe(j,a.dragClass,!0),S(j,"transition",""),S(j,"transform",""),S(j,"box-sizing","border-box"),S(j,"margin",0),S(j,"top",s.top),S(j,"left",s.left),S(j,"width",s.width),S(j,"height",s.height),S(j,"opacity","0.8"),S(j,"position",Pt?"absolute":"fixed"),S(j,"zIndex","100000"),S(j,"pointerEvents","none"),A.ghost=j,e.appendChild(j),S(j,"transform-origin",zn/parseInt(j.style.width)*100+"% "+Hn/parseInt(j.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)),W(document,"drop",a),S(b,"transform","translateZ(0)")),Ze=!0,a._dragStartId=Vt(a._dragStarted.bind(a,s,e)),W(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,h=this.options,m=h.group,r=A.active,u=St===m,p=h.sort,_=ae||r,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:f,dragRect:n,targetRect:o,canSort:p,fromSortable:_,target:a,completed:D,onMove:function(ot,it){return jt(H,s,b,n,ot,te(ot),e,it)},changed:q},Yt))}function B(){V("dragOverAnimationCapture"),I.captureAnimationState(),I!==_&&_.captureAnimationState()}function D(Pe){return V("dragOverCompleted",{insertion:Pe}),Pe&&(u?r._hideClone():r._showClone(I),I!==_&&(fe(b,ae?ae.options.ghostClass:r.options.ghostClass,!1),fe(b,h.ghostClass,!0)),ae!==I&&I!==A.active?ae=I:I===A.active&&ae&&(ae=null),_===I&&(I._ignoreWhileAnimating=a),I.animateAll(function(){V("dragOverAnimationComplete"),I._ignoreWhileAnimating=null}),I!==_&&(_.animateAll(),_._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=ge(b),Fe=ge(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=xe(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,r&&!h.disabled&&(u?p||(f=Y!==H):ae===this||(this.lastPutMode=St.checkPull(this,r,b,e))&&m.checkPut(this,r,b,e))){if(v=this._getDirection(e,a)==="vertical",n=te(b),V("dragOverValid"),A.eventCanceled)return C;if(f)return Y=H,B(),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)),jt(H,s,b,n,a,o,e,!!a)!==!1)return B(),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),jt(H,s,b,n,a,o,e,!1)!==!1)return B(),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",ve=Qn(a,"top","top")||Qn(b,"top","top"),Re=ve?ve.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=ge(b);do Ae-=ne,de=Y.children[Ae];while(de&&(S(de,"display")==="none"||de===j))}if(ne===0||de===a)return D(!1);Je=a,gt=ne;var Se=a.nextElementSibling,ye=!1;ye=ne===1;var De=jt(H,s,b,n,a,o,e,ye);if(De!==!1)return(De===1||De===-1)&&(ye=De===1),fn=!0,setTimeout(Zr,30),B(),ye&&!Se?s.appendChild(b):a.parentNode.insertBefore(b,ye?Se:a),ve&&xs(ve,0,Re-ve.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=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()),j&&j.parentNode&&j.parentNode.removeChild(j),(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=j=He=G=qt=We=Le=be=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],xe(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 h=n.children[f];xe(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 xe(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 jt(t,e,s,a,n,o,f,h){var m,r=t[_e],u=r.options.onMove,p;return window.CustomEvent&&!Oe&&!Ct?m=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent("move",!0,!0)),m.to=e,m.from=t,m.dragged=s,m.draggedRect=a,m.related=n||e,m.relatedRect=o||te(e),m.willInsertAfter=h,m.originalEvent=f,t.dispatchEvent(m),u&&(p=u.call(r,m,f)),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,j),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,j),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,h){var m=a?t.clientY:t.clientX,r=a?s.height:s.width,u=a?s.top:s.left,p=a?s.bottom:s.right,_=!1;if(!f){if(h&&Ot<r*n){if(!vt&&(gt===1?m>u+r*o/2:m<p-r*o/2)&&(vt=!0),vt)_=!0;else if(gt===1?m<u+Ot:m>p-Ot)return-gt}else if(m>u+r*(1-n)/2&&m<p-r*(1-n)/2)return nc(e)}return _=_||f,_&&(m<u+r*o/2||m>p-r*o/2)?m>u+r/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 Vt(t){return setTimeout(t,0)}function pn(t){return clearTimeout(t)}Gt&&W(document,"touchmove",function(t){(A.active||Ze)&&t.cancelable&&t.preventDefault()});A.utils={on:W,off:N,css:S,find:bs,is:function(e,s){return!!xe(e,s,e,!1)},extend:Fr,throttle:ws,closest:xe,toggleClass:fe,clone:Is,index:ge,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?W(document,"dragover",this._handleAutoScroll):this.options.supportPointer?W(document,"pointermove",this._handleFallbackAutoScroll):a.touches?W(document,"touchmove",this._handleFallbackAutoScroll):W(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,f=(s.touches?s.touches[0]:s).clientY,h=document.elementFromPoint(o,f);if(Xt=s,a||this.options.forceAutoScrollFallback||Ct||Oe||ft){dn(s,this.options,h,a);var m=Xe(h,!0);gn&&(!dt||o!==rn||f!==cn)&&(dt&&Yn(),dt=setInterval(function(){var r=Xe(document.elementFromPoint(o,f),!0);r!==m&&(m=r,Rt()),dn(s,n.options,r,a)},10),rn=o,cn=f)}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,f=e.scrollSensitivity,h=e.scrollSpeed,m=ke(),r=!1,u;_n!==s&&(_n=s,Rt(),ct=e.scroll,u=e.scrollFn,ct===!0&&(ct=Xe(s,!0)));var p=0,_=ct;do{var v=_,I=te(v),C=I.top,V=I.bottom,B=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,ve=v.scrollTop;v===m?(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)<=f&&Ve+q<Z)-(Math.abs(B-n)<=f&&!!Ve),de=ne&&(Math.abs(V-o)<=f&&ve+z<Qe)-(Math.abs(C-o)<=f&&!!ve);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)&&(r=!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,ye=ee[this.layer].vx?ee[this.layer].vx*h:0;typeof u=="function"&&u.call(A.dragged.parentNode[_e],ye,Se,t,Xt,ee[this.layer].el)!=="continue"||xs(ee[this.layer].el,ye,Se)}.bind({layer:p}),24))),p++}while(e.bubbleScroll&&_!==m&&(_=Xe(_,!1)));gn=r}},30),Ds=function(e){var s=e.originalEvent,a=e.putSortable,n=e.dragEl,o=e.activeSortable,f=e.dispatchSortableEvent,h=e.hideGhostForTarget,m=e.unhideGhostForTarget;if(!!s){var r=a||o;h();var u=s.changedTouches&&s.changedTouches.length?s.changedTouches[0]:s,p=document.elementFromPoint(u.clientX,u.clientY);m(),r&&!r.el.contains(p)&&(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 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:Mr,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,h=f*s/100,m=f+h;return this.formatCurrency(m)},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,h=o+f;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),jc=i("br",null,null,-1),Mc=["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"],jd={class:"align-top"},Md={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 f=M("QuoteNavBar"),h=M("remove-modal"),m=M("edit-item-modal"),r=M("Card");return c(),d("div",lc,[P(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?(c(),d("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)):g("",!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?(c(),d("div",rc,dc)):g("",!0),o.isQuoteExpired&&n.quote.status=="pending"?(c(),d("div",uc,[i("div",hc,[mc,i("span",null,l(o.translations.quote_expired),1)])])):g("",!0),P(r,{topMargin:"mt-8",id:"quote-content"},{default:re(()=>[n.settings.easy_compta_signature_addon_active&&n.quote.signed==1?(c(),d("div",fc,[i("span",pc,l(o.translations.signed),1)])):g("",!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"?(c(),d("span",wc,l(o.translations.draft),1)):g("",!0),n.quote.status=="pending"?(c(),d("span",xc,l(o.translations.pending),1)):g("",!0),n.quote.status=="approved"?(c(),d("span",Ic,l(o.translations.approved),1)):g("",!0),n.quote.status=="rejected"?(c(),d("span",Ec,l(o.translations.rejected),1)):g("",!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?(c(),d("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Sc)):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),Dc,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Pc,w(" "+l(n.settings.country),1),jc,n.settings.company_phone?(c(),d("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,Mc)):g("",!0),qc,n.settings.mobile_phone?(c(),d("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Oc)):g("",!0)])])]),P(m,{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?(c(),d("th",Uc,l(o.translations.vat),1)):(c(),d("th",Qc)),i("th",Lc,l(o.translations.discount),1),i("th",zc,l(o.translations.total),1),Hc])]),i("tbody",null,[(c(!0),d(X,null,U(n.quoteItems,(u,p)=>(c(),d("tr",{key:u.id||p},[Gc,i("td",null,l(u.item_ref),1),i("td",null,[u.category_name?(c(),d("div",Yc,l(u.category_name),1)):g("",!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?(c(),d("span",$c,l(n.default_currency_symbol),1)):(c(),d("span",ed,l(n.client_currency),1))]),n.settings.vat_active==1?(c(),d("td",td,l(u.vat_rate)+"%",1)):(c(),d("td",nd)),n.settings.vat_active==1?(c(),d("td",sd,[w(l(u.discount)+"% ",1),od,w(" "+l(o.calculateDiscountAmountWithVAT(u.quantity,u.unit_price,u.vat_rate,u.discount)),1)])):(c(),d("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?(c(),d("span",rd,l(n.default_currency_symbol),1)):(c(),d("span",cd,l(n.client_currency),1))]),i("td",null,[n.quote.status=="draft"||n.quote.status=="pending"?(c(),d("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[i("button",{onClick:K(_=>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)):g("",!0),n.quote.status=="draft"||n.quote.status=="pending"?(c(),d("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:K(_=>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?g("",!0):(c(),d("i",_d)),u.loading_del?(c(),d("span",gd)):g("",!0)],8,pd)],8,fd)):g("",!0)])]))),128)),n.quote.status=="draft"||n.quote.status=="pending"?(c(),d("tr",vd,[yd,i("td",bd,[i("div",wd,[F(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?(c(),d("ul",Id,[(c(!0),d(X,null,U(n.refs,u=>(c(),d("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))])):g("",!0)])]),i("td",Cd,[F(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,(c(!0),d(X,null,U(n.categories,u=>(c(),d("option",{key:u.id,value:u.id},l(u.name),9,Td))),128))],512),[[Ie,n.newItem.item_category]]),i("div",Ad,[F(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?(c(),d("ul",Dd,[(c(!0),d(X,null,U(n.articles,u=>(c(),d("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))])):g("",!0)])]),i("td",jd,[i("div",Md,[F(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))}," - "),F(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",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,[F(i("input",{type:"number","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",onInput:e[17]||(e[17]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Wd),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(c(),d("td",Xd,[F(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"},[(c(!0),d(X,null,U(n.list_vats,u=>(c(),d("option",{key:u,value:u.rate},l(u.rate)+"% ",9,Ud))),128))],544),[[Ie,n.newItem.vat_rate]])])):(c(),d("td",Qd)),i("td",Ld,[i("div",zd,[F(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",onInput:e[21]||(e[21]=(...u)=>o.updateTotal&&o.updateTotal(...u))},null,40,Hd),[[J,n.newItem.discount]]),Gd])]),n.settings.vat_active==1?(c(),d("td",Yd,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(c(),d("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?g("",!0):(c(),d("i",$d)),n.loading_add?(c(),d("span",eu)):g("",!0)])],8,Kd)])])):g("",!0),i("tr",null,[i("td",tu,[i("strong",null,l(o.translations.subtotal),1)]),i("td",nu,[o.totalAmount!==o.totalAmountWithoutDiscount?(c(),d("span",su,l(o.totalAmountWithoutDiscount),1)):g("",!0),w(" "+l(o.totalAmount),1)]),ou]),n.settings.vat_active==1?(c(!0),d(X,{key:1},U(o.getUniqueVATRates(),(u,p)=>(c(),d("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)):g("",!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?(c(),d("tr",uu,[i("td",hu,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",mu,l(n.quote.exchange_rate),1)])):g("",!0),n.client_currency!=n.default_currency_symbol?(c(),d("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)])):g("",!0)])])],32),n.settings.easy_compta_signature_addon_active&&n.quote.signed==1&&n.quote.file_sign?(c(),d("div",gu,[i("div",vu,[i("span",yu,[i("img",{src:o.signatureImageUrl,alt:"Signature"},null,8,bu)])])])):g("",!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"},ju={class:"ecwp-group form-group mb-4"},Mu={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 f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return c(),d("div",Eu,[n.toast.visible?(c(),d("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)):g("",!0),P(m,{topMargin:"mt-8",modalType:"modal_quote_new"},{default:re(()=>[i("div",Cu,[i("h2",ku,l(o.translations.new_quote),1)]),Tu,n.loading?(c(),d("div",Au)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...r)=>o.submitQuote&&o.submitQuote(...r),["prevent"]))},[i("div",Su,[i("div",Du,[i("label",Pu,l(o.translations.quote_number),1),F(i("input",{type:"text",id:"quoteNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.quote.number=r),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.quote.number]])]),i("div",ju,[i("label",Mu,l(o.translations.due_date),1),P(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]=r=>n.quote.due_date=r),"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(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]=r=>n.quote.provisional_start_date=r),"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]=r=>n.quote.client_id=r),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),F(i("select",{id:"status","onUpdate:modelValue":e[4]||(e[4]=r=>n.quote.status=r),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),[[Ie,n.quote.status]])])]),i("div",Lu,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},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?(c(),d("span",Hu)):g("",!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),jh=[Ph],Mh={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 f=M("remove-modal"),h=M("router-link"),m=M("Card");return c(),d("div",Ku,[n.toast.visible?(c(),d("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)):g("",!0),P(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]=r=>this.deleteInvoice(n.selectedInvoice)),onCancel:e[1]||(e[1]=r=>t.showRemoveModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),P(m,{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?(c(),d("span",nh,[i("a",sh,[w(l(o.translations.export)+" ",1),oh])])):(c(),d("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),F(i("select",{id:"perPageSelect","onUpdate:modelValue":e[2]||(e[2]=r=>n.perPage=r),onChange:e[3]||(e[3]=(...r)=>o.perPageChanged&&o.perPageChanged(...r))},[(c(!0),d(X,null,U(n.perPageOptions,r=>(c(),d("option",{key:r,value:r},l(r),9,uh))),128))],544),[[Ie,n.perPage]])]),i("div",hh,[n.loading?(c(),d("div",zh,[(c(!0),d(X,null,U(n.skeletonRows,r=>(c(),d("div",{key:r,class:"flex flex-col gap-4 w-full"},Yh))),128))])):(c(),d("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,[(c(!0),d(X,null,U(n.invoices,r=>(c(),d("tr",{key:r.id},[i("td",null,[r.advance==1?(c(),d("span",ph,l(o.translations.advance),1)):g("",!0),w(l(r.invoice_number),1)]),i("td",null,l(r.client_name),1),i("td",null,[r.status=="draft"?(c(),d("span",_h,l(o.translations.draft),1)):g("",!0),r.status=="unpaid"?(c(),d("span",gh,l(o.translations.unpaid),1)):g("",!0),r.status=="paid"?(c(),d("span",vh,l(o.translations.paid),1)):g("",!0),r.credit=="1"?(c(),d("span",yh,l(o.translations.credit),1)):g("",!0)]),i("td",null,[n.loadingPrice?(c(),d("div",kh,Ah)):(c(),d("div",bh,[n.settings.easy_compta_advance_addon_active&&r.advance==1?(c(),d("div",wh,l(o.formatAmount(r.advance_amount,r.client_currency||n.default_currency_symbol)),1)):g("",!0),n.settings.vat_active==1?(c(),d("div",{key:1,class:k({"text-xs":r.advance==1})},[n.default_currency_symbol==r.client_currency||r.client_currency==null?(c(),d("span",xh,l(o.formatAmount(r.total_amount,n.default_currency_symbol)),1)):(c(),d("span",Ih,l(o.formatAmount(r.total_amount,r.client_currency)),1))],2)):(c(),d("div",{key:2,class:k({"text-xs":r.advance==1})},[n.default_currency_symbol==r.client_currency||r.client_currency==null?(c(),d("span",Eh,l(o.formatAmount(r.total_amount,n.default_currency_symbol)),1)):(c(),d("span",Ch,l(o.formatAmount(r.total_amount,r.client_currency)),1))],2))]))]),i("td",null,[n.loadingPrice?(c(),d("div",Dh,jh)):(c(),d("div",Sh,l(r.due_date),1))]),i("td",null,[n.loadingPrice?(c(),d("div",qh,Vh)):(c(),d("div",Mh,l(r.created),1))]),i("td",Rh,[i("span",{class:"lg:tooltip","data-tip":o.translations.view},[P(h,{to:{name:"InvoiceViewDetail",params:{id:r.id}}},{default:re(()=>[Bh]),_:2},1032,["to"])],8,Nh),r.status=="draft"?(c(),d("span",{key:0,class:"lg:tooltip","data-tip":o.translations.edit},[P(h,{to:{name:"InvoiceEdit",params:{id:r.id}}},{default:re(()=>[Wh]),_:2},1032,["to"])],8,Fh)):g("",!0),r.status=="draft"?(c(),d("span",{key:1,class:"lg:tooltip","data-tip":o.translations.delete},[i("button",{onClick:u=>o.confirmDeleteInvoice(r.id),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Lh,8,Uh)],8,Xh)):g("",!0)])]))),128))])]))]),i("div",Jh,[(c(!0),d(X,null,U(n.paginationButtons,r=>(c(),d("button",{key:r,class:k(["join-item btn",{"btn-disabled":r==="..."||r===n.currentPage}]),onClick:u=>o.goToPage(r)},l(r),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 f=M("vue-editor");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!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?(c(),d("div",om,[i("div",im,[(c(!0),d(X,null,U(o.skeletonItems,h=>(c(),d("div",{key:h,class:"py-2"},rm))),128))])])):(c(),d("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",cm,[(c(!0),d(X,null,U(n.fields,(h,m)=>(c(),d("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(c(),d("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,um),i("input",{id:m,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,hm)],8,dm)):(c(),d("div",mm,[i("label",{for:m,class:"form-label"},l(h.label),9,fm),P(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,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?(c(),d("span",gm)):g("",!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:""}},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()}}},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={class:"flex justify-between space-x-4"};function Am(t,e,s,a,n,o){return c(),d("div",null,[i("dialog",{id:"modal_confirm_credit",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]=(...f)=>o.closeModal&&o.closeModal(...f))}," \u2715 "),Em,i("h2",Cm,l(s.title),1),i("p",km,l(s.message),1),i("div",Tm,[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,wm)])}var Sm=oe(bm,[["render",Am]]);const Dm={name:"InvoiceNavBar",components:{SendInvoiceModal:ym,RemoveModal:xt,ConfirmModal:bn,ConfirmModalCredit:Sm},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:{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.showModal(),this.showConfirmModal=!0},confirmCreditInvoice(){modal_confirm_credit.showModal(),this.showConfirmCreditModal=!0}}},Pm={key:0},jm={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"},Mm=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),qm=[Mm],Om={class:"navbar bg-base-100 mb-4 shadow-xl rounded-box flex justify-between"},Vm=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),Rm={class:"hidden lg:flex gap-2"},Nm={class:"btn btn-sm"},Bm=i("i",{class:"far fa-edit"},null,-1),Fm={key:1},Wm={class:"btn btn-sm",disabled:""},Xm=i("i",{class:"far fa-edit"},null,-1),Um={key:2},Qm=i("i",{class:"fa fa-check"},null,-1),Lm={class:"btn btn-outline btn-success btn-sm hover:text-white",disabled:""},zm=i("i",{class:"fa fa-check"},null,-1),Hm={key:0},Gm={class:"btn btn-sm ms-2",disabled:""},Ym=i("i",{class:"fas fa-undo"},null,-1),Jm={key:1},Km=i("i",{class:"fas fa-undo"},null,-1),Zm=["disabled"],$m=i("i",{class:"far fa-file-pdf"},null,-1),ef={key:0,class:"loading loading-spinner loading-sm"},tf={class:"flex gap-2"},nf=i("i",{class:"fas fa-paper-plane"},null,-1),sf={key:0},of={key:1},af={key:2,class:"far fa-envelope"},lf=["data-tip"],rf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},cf=i("i",{class:"fas fa-paper-plane"},null,-1),df=["data-tip"],uf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},hf=i("i",{class:"fas fa-paper-plane"},null,-1),mf={key:3},ff={key:0,class:"dropdown dropdown-end"},pf={tabindex:"0",role:"button",class:"btn btn-outline btn-success btn-sm"},_f=i("i",{class:"far fa-file-pdf"},null,-1),gf={key:0,class:"loading loading-spinner loading-sm"},vf={tabindex:"0",class:"dropdown-content menu bg-base-100 rounded-box z-[1] w-52 p-2 shadow"},yf=["disabled"],bf=["disabled"],wf={key:4},xf=["disabled"],If=i("i",{class:"far fa-file-pdf"},null,-1),Ef={key:0},Cf={key:1},kf={key:2,class:"loading loading-spinner loading-sm"},Tf=i("i",{class:"fas fa-check"},null,-1),Af=["data-tip"],Sf={click:"#",class:"btn btn-outline btn-primary btn-sm hover:text-white",disabled:""},Df=i("i",{class:"fas fa-check"},null,-1);function Pf(t,e,s,a,n,o){const f=M("send-invoice-modal"),h=M("confirm-modal"),m=M("confirm-modal-credit"),r=M("router-link");return c(),d("div",null,[s.emailActive==1?(c(),d("div",Pm,[P(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]=u=>n.sendInvoiceModal=!1)},null,8,["loading","show-modal","client","invoice-id","subject","content"])])):g("",!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:e[1]||(e[1]=u=>this.changeInvoiceStatus(n.selectedStatus)),onCancel:e[2]||(e[2]=u=>n.showConfirmModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText","status"]),P(m,{"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[3]||(e[3]=u=>this.addCreditInvoice()),onCancel:e[4]||(e[4]=u=>n.showConfirmCreditModal=!1)},null,8,["show-modal","title","message","confirmText","cancelText"]),n.loading?(c(),d("div",jm,qm)):g("",!0),i("div",Om,[i("div",null,[Vm,i("div",Rm,[s.invoiceInfo.status=="draft"?(c(),Rs(r,{key:0,to:{name:"InvoiceEdit",params:{id:s.invoiceInfo.id}}},{default:re(()=>[i("button",Nm,[Bm,w(" "+l(o.translations.edit_invoice),1)])]),_:1},8,["to"])):(c(),d("div",Fm,[i("button",Wm,[Xm,w(" "+l(o.translations.edit_invoice),1)])])),s.invoiceInfo.status=="unpaid"&&!s.noItems?(c(),d("div",Um,[i("button",{class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[5]||(e[5]=u=>o.confirmValidateInvoice("paid"))},[Qm,w(" "+l(o.translations.mark_as_paid),1)])])):(c(),d(X,{key:3},[i("div",null,[i("button",Lm,[zm,w(" "+l(o.translations.mark_as_paid),1)])]),s.invoiceInfo.credit!=0&&s.invoiceInfo.status=="paid"&&!s.noItems?(c(),d("div",Hm,[i("button",Gm,[Ym,w(" "+l(o.translations.credit_invoice),1)])])):g("",!0),s.invoiceInfo.credit==0&&s.invoiceInfo.status=="paid"&&!s.noItems?(c(),d("div",Jm,[i("button",{class:"btn btn-sm ms-2",onClick:e[6]||(e[6]=u=>o.confirmCreditInvoice())},[Km,w(" "+l(o.translations.credit_invoice),1)])])):g("",!0)],64))])]),s.invoiceInfo.status=="draft"?(c(),d("button",{key:0,onClick:e[7]||(e[7]=u=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-secondary btn-sm",disabled:n.loadingPdf},[$m,i("span",null,l(o.translations.previewPDF),1),n.loadingPdf?(c(),d("span",ef)):g("",!0)],8,Zm)):g("",!0),i("div",tf,[s.emailActive==1&&s.invoiceInfo.status!="draft"?(c(),d("button",{key:0,onClick:e[8]||(e[8]=K(u=>o.sendInvoice(s.invoiceInfo.client_id),["prevent"])),class:"btn btn-outline btn-primary btn-sm hover:text-white"},[nf,s.invoiceInfo.sent==1?(c(),d("span",sf,l(o.translations.resend_invoice),1)):(c(),d("span",of,l(o.translations.send_invoice),1)),s.invoiceInfo.sent==1?(c(),d("i",af)):g("",!0)])):s.emailActive==1&&s.invoiceInfo.status=="draft"?(c(),d("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.draft_cannot_send},[i("button",rf,[cf,w(" "+l(o.translations.send_invoice),1)])],8,lf)):(c(),d("div",{key:2,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",uf,[hf,w(" "+l(o.translations.send_invoice),1)])],8,df)),s.currencyDefault.currency_id!==s.currencyClient.currency_id?(c(),d("div",mf,[s.invoiceInfo.status!="draft"?(c(),d("div",ff,[i("div",pf,[_f,w(" "+l(o.translations.exportToPDF)+" ",1),n.loadingPdf?(c(),d("span",gf)):g("",!0)]),i("ul",vf,[i("li",null,[i("a",{onClick:e[9]||(e[9]=u=>o.exportToPDF(s.currencyDefault.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyDefault.currency_symbol),9,yf)]),i("li",null,[i("a",{onClick:e[10]||(e[10]=u=>o.exportToPDF(s.currencyClient.currency_id)),disabled:n.loadingPdf},l(o.translations.invoice_in)+" "+l(s.currencyClient.currency_symbol),9,bf)])])])):g("",!0)])):(c(),d("div",wf,[s.invoiceInfo.status!="draft"?(c(),d("button",{key:0,onClick:e[11]||(e[11]=u=>o.exportToPDF(s.currencyDefault.currency_id)),class:"btn btn-outline btn-success btn-sm",disabled:n.loadingPdf},[If,s.invoiceInfo.status!="draft"?(c(),d("span",Ef,l(o.translations.exportToPDF),1)):(c(),d("span",Cf,l(o.translations.previewPDF),1)),n.loadingPdf?(c(),d("span",kf)):g("",!0)],8,xf)):g("",!0)])),s.invoiceInfo.status=="draft"&&!s.noItems?(c(),d("button",{key:5,class:"btn btn-outline btn-success btn-sm hover:text-white",onClick:e[12]||(e[12]=u=>o.confirmValidateInvoice("unpaid"))},[Tf,w(" "+l(o.translations.validateInvoice),1)])):g("",!0),s.invoiceInfo.status=="draft"&&s.noItems?(c(),d("div",{key:6,class:"tooltip tooltip-left tooltip-warning","data-tip":o.translations.min_article},[i("button",Sf,[Df,w(" "+l(o.translations.validateInvoice),1)])],8,Af)):g("",!0)])])])}var jf=oe(Dm,[["render",Pf]]);const Mf={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}}},qf=["id","open"],Of={class:"modal-box"},Vf={class:"font-bold text-lg"},Rf={key:0},Nf={class:"grid grid-cols-1 gap-4"},Bf=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),Ff=i("div",{class:"skeleton h-4 w-full"},null,-1),Wf=[Bf,Ff],Xf={class:"grid grid-cols-1 gap-4"},Uf=["type"],Qf=["for"],Lf=["id","onUpdate:modelValue"],zf={key:1},Hf=["for"],Gf={class:"form-group mt-4 flex justify-end"},Yf=["disabled"],Jf={key:0,class:"loading loading-spinner loading-sm"};function Kf(t,e,s,a,n,o){const f=M("vue-editor");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",Of,[i("h3",Vf,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?(c(),d("div",Rf,[i("div",Nf,[(c(!0),d(X,null,U(o.skeletonItems,h=>(c(),d("div",{key:h,class:"py-2"},Wf))),128))])])):(c(),d("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",Xf,[(c(!0),d(X,null,U(n.fields,(h,m)=>(c(),d("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(c(),d("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,Qf),F(i("input",{id:m,"onUpdate:modelValue":r=>n.editedItem[m]=r,class:k(["ecwp-input input input-bordered",h.class||"w-full"])},null,10,Lf),[[J,n.editedItem[m]]])],8,Uf)):(c(),d("div",zf,[i("label",{for:m,class:"form-label"},l(h.label),9,Hf),P(f,{id:m,modelValue:n.editedItem[m],"onUpdate:modelValue":r=>n.editedItem[m]=r,editorToolbar:t.toolbarOptions},null,8,["id","modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",Gf,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.save)+" ",1),n.loadingBtn?(c(),d("span",Jf)):g("",!0)],8,Yf)])],32))])],8,qf)])}var Zf=oe(Mf,[["render",Kf]]);const $f={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)}}},ep=["id","open"],tp={class:"modal-box"},np={class:"font-bold text-lg"},sp={key:0},op={class:"grid grid-cols-1 gap-4"},ip=i("div",{class:"skeleton h-4 w-full mb-2"},null,-1),ap=i("div",{class:"skeleton h-4 w-full"},null,-1),lp=[ip,ap],rp={class:"grid grid-cols-1 gap-4"},cp=["type"],dp=["for"],up=["id","value","disabled","onInput"],hp={key:1},mp=["for"],fp={class:"form-group mt-4 flex justify-end"},pp=["disabled"],_p={key:0,class:"loading loading-spinner loading-sm"};function gp(t,e,s,a,n,o){const f=M("vue-editor");return c(),d("div",null,[n.toast.visible?(c(),d("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)):g("",!0),i("dialog",{id:s.modalId,class:"modal",open:s.showModal},[i("div",tp,[i("h3",np,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?(c(),d("div",sp,[i("div",op,[(c(!0),d(X,null,U(o.skeletonItems,h=>(c(),d("div",{key:h,class:"py-2"},lp))),128))])])):(c(),d("form",{key:1,onSubmit:e[1]||(e[1]=K((...h)=>o.submitForm&&o.submitForm(...h),["prevent"])),class:"form"},[i("div",rp,[(c(!0),d(X,null,U(n.fields,(h,m)=>(c(),d("div",{key:m,class:"ecwp-group form-group"},[h.type!=="textarea"?(c(),d("div",{key:0,type:h.type||"text"},[i("label",{for:m,class:"ecwp-label form-label"},l(h.label),9,dp),i("input",{id:m,class:k(["ecwp-input input input-bordered",h.class||"w-full"]),value:h.value,disabled:h.disabled,onInput:r=>o.updateFieldValue(m,r.target.value)},null,42,up)],8,cp)):(c(),d("div",hp,[i("label",{for:m,class:"form-label"},l(h.label),9,mp),P(f,{modelValue:h.value,"onUpdate:modelValue":r=>h.value=r,editorToolbar:n.toolbarOptions},null,8,["modelValue","onUpdate:modelValue","editorToolbar"])]))]))),128))]),i("div",fp,[i("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[w(l(o.translations.send)+" ",1),n.loadingBtn?(c(),d("span",_p)):g("",!0)],8,pp)])],32))])],8,ep)])}var vp=oe($f,[["render",gp]]);const yp={name:"InvoiceViewDetail",components:{Card:Ue,InvoiceNavBar:jf,EditItemModal:Zf,RemoveModal:xt,RemindInvoiceModal:vp},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.formatCurrency(t)},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,h=f*s/100,m=f+h;return this.formatCurrency(m)},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,h=o+f;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})}},bp={class:"pt-2 pr-4"},wp={key:0},xp={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"},Ip=i("span",{class:"loading loading-spinner text-primary loading-lg"},null,-1),Ep=[Ip],Cp={key:3},kp={role:"alert",class:"alert alert-warning"},Tp=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),Ap={key:0},Sp=["data-tip"],Dp={class:"btn btn-sm btn-primary",disabled:""},Pp={class:"grid grid-cols-2"},jp={class:"md:col-span-1"},Mp=["src"],qp={class:"md:col-span-1 text-right"},Op={class:"text-lg font-semibold"},Vp={key:0,class:"badge badge-error text-white"},Rp={key:1,class:"badge badge-error text-white"},Np={key:2,class:"badge badge-success text-white"},Bp={class:"bg-base-300 rounded-lg shadow-md flex justify-between p-4 mt-4 gap-4"},Fp=i("br",null,null,-1),Wp=i("br",null,null,-1),Xp=i("br",null,null,-1),Up=["href"],Qp=i("br",null,null,-1),Lp=i("br",null,null,-1),zp=i("br",null,null,-1),Hp=["href"],Gp=i("br",null,null,-1),Yp=["href"],Jp={class:"table mt-8"},Kp=i("th",null,null,-1),Zp={width:"5%"},$p={width:"19%"},e_={width:"21%"},t_={width:"10%",class:"text-center"},n_={width:"8%",class:"text-center"},s_={key:0,width:"5%",class:"text-center"},o_={key:1,width:"5%"},i_={width:"10%",class:"text-center"},a_={width:"10%",class:"text-right"},l_=i("th",{width:"18%",class:"text-right inv-actions"},null,-1),r_=i("td",{class:"draggable-item drag-handle px-2"},[i("i",{class:"fas fa-bars"})],-1),c_={key:0,class:"badge badge-ghost badge-xs"},d_=["innerHTML"],u_={class:"text-center"},h_={class:"text-center"},m_={key:0},f_={key:1},p_={key:0,class:"text-center"},__={key:1},g_={key:2,class:"text-center"},v_=i("br",null,null,-1),y_={key:3,class:"text-center"},b_=i("br",null,null,-1),w_={class:"text-right"},x_={key:0},I_={key:1},E_={key:0},C_=["data-tip"],k_=["onClick"],T_=i("i",{class:"far fa-edit"},null,-1),A_=[T_],S_=["data-tip"],D_=["onClick"],P_={key:0,class:"far fa-trash-alt"},j_={key:1,class:"loading loading-spinner loading-xs"},M_={key:0},q_=i("td",{class:"px-2"},null,-1),O_={class:"align-top px-2"},V_={class:"flex items-center border rounded-md relative"},R_=["placeholder"],N_={key:0,class:"autocomplete-dropdown bg-base-100"},B_=["onClick","innerHTML"],F_={class:"align-top px-2"},W_=i("option",{disabled:"",selected:""},"Type",-1),X_=["value"],U_={class:"flex items-center border rounded-md relative"},Q_=["placeholder"],L_={key:0,class:"autocomplete-dropdown bg-base-100"},z_=["onClick","innerHTML"],H_={class:"align-top"},G_={class:"flex items-center rounded-md"},Y_=["placeholder"],J_={class:"align-top"},K_={class:"flex items-center border rounded-lg"},Z_={class:"inline-flex"},$_=["placeholder"],eg={class:"align-top"},tg={class:"flex items-center border rounded-md"},ng=["placeholder"],sg={key:0,class:"align-top"},og=["value"],ig={key:1,class:"align-top"},ag={class:"align-top"},lg={class:"flex items-center border rounded-md"},rg=["placeholder"],cg=i("div",{class:"px-3 py-2.5 rounded-l-md bg-base-300 border-r"}," % ",-1),dg={key:2,class:"text-right"},ug={key:3,class:"text-right"},hg=["data-tip"],mg={type:"submit",class:"bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded"},fg={key:0,class:"fa fa-plus"},pg={key:1,class:"loading loading-spinner loading-xs"},_g={colspan:"8",class:"text-right no-border"},gg={class:"text-right"},vg={key:0,class:"line-through"},yg=i("td",null,null,-1),bg={colspan:"8",class:"text-right no-border"},wg={class:"text-right"},xg=i("td",null,null,-1),Ig={colspan:"8",class:"text-right no-border font-bold text-xl"},Eg={class:"text-right no-border font-bold text-xl"},Cg=i("td",null,null,-1),kg={key:2},Tg={colspan:"8",class:"text-right no-border"},Ag={class:"text-right no-border"},Sg={key:3},Dg={colspan:"8",class:"text-right no-border"},Pg={class:"text-right no-border font-bold text-xl"};function jg(t,e,s,a,n,o){const f=M("InvoiceNavBar"),h=M("remove-modal"),m=M("remind-invoice-modal"),r=M("edit-item-modal"),u=M("Card");return c(),d("div",bp,[P(f,{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?(c(),d("div",wp,[P(m,{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"])])):g("",!0),n.toast.visible?(c(),d("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)):g("",!0),n.loading?(c(),d("div",xp,Ep)):g("",!0),o.isInvoiceOverdue&&n.invoice.status=="unpaid"?(c(),d("div",Cp,[i("div",kp,[Tp,i("span",null,l(o.translations.invoice_overdue),1),n.settings.easy_compta_email_addon_active==1?(c(),d("div",Ap,[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)])):(c(),d("div",{key:1,class:"tooltip tooltip-bottom tooltip-warning","data-tip":o.translations.active_email_addon},[i("button",Dp,l(o.translations.remind_invoice),1)],8,Sp))])])):g("",!0),P(u,{topMargin:"mt-8",id:"invoice-content"},{default:re(()=>[i("div",Pp,[i("div",jp,[i("div",null,[i("img",{src:n.settings.logo_url,style:Zn({width:n.settings.logo_width+"px"}),alt:"Logo"},null,12,Mp)])]),i("div",qp,[i("p",Op,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"?(c(),d("span",Vp,l(o.translations.draft),1)):g("",!0),n.invoice.status=="unpaid"?(c(),d("span",Rp,l(o.translations.unpaid),1)):g("",!0),n.invoice.status=="paid"?(c(),d("span",Np,l(o.translations.paid),1)):g("",!0)])])]),i("div",Bp,[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),Fp,w(" "+l(n.client_detail.postal_code)+", "+l(n.client_detail.city)+" ",1),Wp,w(" "+l(n.client_detail.country),1),Xp,n.client_detail.phone?(c(),d("a",{key:0,href:"tel:"+n.client_detail.phone},l(n.client_detail.phone),9,Up)):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),Qp,w(" "+l(n.settings.postal_code)+", "+l(n.settings.city)+" ",1),Lp,w(" "+l(n.settings.country),1),zp,n.settings.company_phone?(c(),d("a",{key:0,href:"tel:"+n.settings.company_phone},l(n.settings.company_phone),9,Hp)):g("",!0),Gp,n.settings.mobile_phone?(c(),d("a",{key:1,href:"tel:"+n.settings.mobile_phone},l(n.settings.mobile_phone),9,Yp)):g("",!0)])])]),P(r,{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",Jp,[i("thead",null,[i("tr",null,[Kp,i("th",Zp,l(o.translations.item_ref),1),i("th",$p,l(o.translations.item_name),1),i("th",e_,l(o.translations.description),1),i("th",t_,l(o.translations.quantity),1),i("th",n_,l(o.translations.unit_price),1),n.settings.vat_active==1?(c(),d("th",s_,l(o.translations.vat),1)):(c(),d("th",o_)),i("th",i_,l(o.translations.discount),1),i("th",a_,l(o.translations.total),1),l_])]),i("tbody",null,[(c(!0),d(X,null,U(n.invoiceItems,(p,_)=>(c(),d("tr",{key:p.id||_},[r_,i("td",null,l(p.item_ref),1),i("td",null,[p.category_name?(c(),d("div",c_,l(p.category_name),1)):g("",!0),i("div",null,l(p.item_name),1)]),i("td",{innerHTML:o.nl2br(p.item_description)},null,8,d_),i("td",u_,l(p.quantity),1),i("td",h_,[w(l(p.unit_price),1),n.default_currency_symbol==n.client_currency?(c(),d("span",m_,l(n.default_currency_symbol),1)):(c(),d("span",f_,l(n.client_currency),1))]),n.settings.vat_active==1?(c(),d("td",p_,l(p.vat_rate)+"%",1)):(c(),d("td",__)),n.settings.vat_active==1?(c(),d("td",g_,[w(l(p.discount)+"% ",1),v_,w(" "+l(o.calculateDiscountAmountWithVAT(p.quantity,p.unit_price,p.vat_rate,p.discount)),1)])):(c(),d("td",y_,[w(l(p.discount)+"% ",1),b_,w(" "+l(o.calculateDiscountAmount(p.quantity,p.unit_price,p.discount)),1)])),i("td",w_,[w(l(p.total_amount)+" ",1),n.default_currency_symbol==n.client_currency?(c(),d("span",x_,l(n.default_currency_symbol),1)):(c(),d("span",I_,l(n.client_currency),1))]),i("td",null,[n.invoice.status=="draft"?(c(),d("div",E_,[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"},A_,8,k_)],8,C_),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?g("",!0):(c(),d("i",P_)),p.loading_del?(c(),d("span",j_)):g("",!0)],8,D_)],8,S_)])):g("",!0)])]))),128)),n.invoice.status=="draft"?(c(),d("tr",M_,[q_,i("td",O_,[i("div",V_,[F(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,R_),[[J,n.newItem.item_ref]]),n.showDropdownRef&&n.refs.length?(c(),d("ul",N_,[(c(!0),d(X,null,U(n.refs,p=>(c(),d("li",{key:p.ref,onClick:_=>o.selectItem(p),class:"autocomplete-item",innerHTML:o.highlightMatch(p.ref)},null,8,B_))),128))])):g("",!0)])]),i("td",F_,[F(i("select",{class:"select select-xs w-full mb-1 ecwp-select","onUpdate:modelValue":e[8]||(e[8]=p=>n.newItem.item_category=p)},[W_,(c(!0),d(X,null,U(n.categories,p=>(c(),d("option",{key:p.id,value:p.id},l(p.name),9,X_))),128))],512),[[Ie,n.newItem.item_category]]),i("div",U_,[F(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,Q_),[[J,n.newItem.item_name]]),n.showDropdown&&n.articles.length?(c(),d("ul",L_,[(c(!0),d(X,null,U(n.articles,p=>(c(),d("li",{key:p.name,onClick:_=>o.selectItem(p),class:"autocomplete-item bt-primary",innerHTML:o.highlightMatch(p.name)},null,8,z_))),128))])):g("",!0)])]),i("td",H_,[i("div",G_,[F(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,Y_),[[J,n.newItem.item_description]])])]),i("td",J_,[i("div",K_,[i("div",Z_,[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))}," - "),F(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",onInput:e[16]||(e[16]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,$_),[[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",eg,[i("div",tg,[F(i("input",{type:"number","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",onInput:e[19]||(e[19]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,ng),[[J,n.newItem.unit_price]])])]),n.settings.vat_active==1?(c(),d("td",sg,[F(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"},[(c(!0),d(X,null,U(n.list_vats,p=>(c(),d("option",{key:p,value:p.rate},l(p.rate)+"% ",9,og))),128))],544),[[Ie,n.newItem.vat_rate]])])):(c(),d("td",ig)),i("td",ag,[i("div",lg,[F(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",onInput:e[23]||(e[23]=(...p)=>o.updateTotal&&o.updateTotal(...p))},null,40,rg),[[J,n.newItem.discount]]),cg])]),n.settings.vat_active==1?(c(),d("td",dg,l(o.calculateTotalWithVat(n.newItem.quantity,n.newItem.unit_price,n.newItem.vat_rate,n.newItem.discount)),1)):(c(),d("td",ug,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",mg,[n.loading_add?g("",!0):(c(),d("i",fg)),n.loading_add?(c(),d("span",pg)):g("",!0)])],8,hg)])])):g("",!0),i("tr",null,[i("td",_g,[i("strong",null,l(o.translations.subtotal),1)]),i("td",gg,[o.totalAmount!==o.totalAmountWithoutDiscount?(c(),d("span",vg,l(o.totalAmountWithoutDiscount),1)):g("",!0),w(" "+l(o.totalAmount),1)]),yg]),n.settings.vat_active==1?(c(!0),d(X,{key:1},U(o.getUniqueVATRates(),(p,_)=>(c(),d("tr",{key:_},[i("td",bg,[i("strong",null,l(o.translations.tax)+" ("+l(p)+"%) ",1)]),i("td",wg,l(o.calculateVATForRate(p)),1),xg]))),128)):g("",!0),i("tr",null,[i("td",Ig,[i("strong",null,l(o.translations.total),1)]),i("td",Eg,l(o.calculateTotalAmountWithVAT()),1),Cg]),n.client_currency!=n.default_currency_symbol?(c(),d("tr",kg,[i("td",Tg,[i("strong",null,l(o.translations.exchange_rate),1)]),i("td",Ag,l(n.invoice.exchange_rate),1)])):g("",!0),n.client_currency!=n.default_currency_symbol?(c(),d("tr",Sg,[i("td",Dg,[i("strong",null,l(o.translations.total)+" "+l(n.default_currency_symbol),1)]),i("td",Pg,l(o.totalAmountDefaultCurrency)+l(n.default_currency_symbol),1)])):g("",!0)])])],32)]),_:1})])}var Mg=oe(yp,[["render",jg]]);const qg={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)}}},Og={class:"pt-2 pr-4"},Vg={class:"flex justify-between items-center mb-4"},Rg={class:"card-title"},Ng=i("div",{class:"divider mt-2"},null,-1),Bg={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"},Fg={class:"grid grid-cols-2 gap-4"},Wg={class:"ecwp-group form-group mb-4"},Xg={for:"invoiceNumber",class:"ecwp-label"},Ug={class:"ecwp-group form-group mb-4"},Qg={for:"invoiceDate",class:"ecwp-label"},Lg={class:"ecwp-group form-group mb-4"},zg={for:"client",class:"ecwp-label"},Hg={class:"ecwp-group form-group mb-4"},Gg={for:"status",class:"ecwp-label"},Yg={value:"draft"},Jg={key:0,class:"ecwp-group form-group mb-4"},Kg={for:"exchangeRate",class:"ecwp-label"},Zg={class:"flex justify-between"},$g=["disabled"],ev={key:0,class:"loading loading-spinner loading-sm"};function tv(t,e,s,a,n,o){const f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return c(),d("div",Og,[n.toast.visible?(c(),d("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)):g("",!0),P(m,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",Vg,[i("h2",Rg,l(o.translations.new_invoice),1)]),Ng,n.loading?(c(),d("div",Bg)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...r)=>o.submitInvoice&&o.submitInvoice(...r),["prevent"]))},[i("div",Fg,[i("div",Wg,[i("label",Xg,l(o.translations.invoice_number),1),F(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.invoice.number=r),class:"ecwp-input input input-bordered w-full",disabled:"disabled"},null,512),[[J,n.invoice.number]])]),i("div",Ug,[i("label",Qg,l(o.translations.due_date),1),P(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]=r=>n.invoice.due_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",Lg,[i("label",zg,l(o.translations.company_name),1),P(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=r=>n.invoice.client_id=r),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",Hg,[i("label",Gg,l(o.translations.status),1),F(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=r=>n.invoice.status=r),class:k(["ecwp-input select select-bordered w-full",[!n.invoice.status&&n.showError?"input-error":""]])},[i("option",Yg,l(o.translations.draft),1)],2),[[Ie,n.invoice.status]])]),o.currencyMismatch?(c(),d("div",Jg,[i("label",Kg,l(o.translations.exchange_rate),1),F(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=r=>n.invoice.exchange_rate=r),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):g("",!0)]),i("div",Zg,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},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?(c(),d("span",ev)):g("",!0)],8,$g)])],32)]),_:1})])}var nv=oe(qg,[["render",tv]]);const sv={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)}}},ov={class:"pt-2 pr-4"},iv={class:"flex justify-between items-center mb-4"},av={class:"card-title"},lv=i("div",{class:"divider mt-2"},null,-1),rv={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"},cv={class:"grid grid-cols-2 gap-4"},dv={class:"ecwp-group form-group mb-4"},uv={for:"invoiceNumber",class:"ecwp-label"},hv={class:"ecwp-group form-group mb-4"},mv={for:"invoiceDate",class:"ecwp-label"},fv={class:"ecwp-group form-group mb-4"},pv={for:"client",class:"ecwp-label"},_v={class:"ecwp-group form-group mb-4"},gv={for:"status",class:"ecwp-label"},vv={value:"draft",selected:""},yv={value:"unpaid"},bv={value:"paid"},wv={key:0,class:"ecwp-group form-group mb-4"},xv={for:"exchangeRate",class:"ecwp-label"},Iv={class:"flex justify-between"},Ev=["disabled"],Cv={key:0,class:"loading loading-spinner loading-sm"};function kv(t,e,s,a,n,o){const f=M("VueDatePicker"),h=M("model-select"),m=M("Card");return c(),d("div",ov,[n.toast.visible?(c(),d("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)):g("",!0),P(m,{topMargin:"mt-8",modalType:"modal_invoice_new"},{default:re(()=>[i("div",iv,[i("h2",av,l(o.translations.edit_invoice),1)]),lv,n.loading?(c(),d("div",rv)):g("",!0),i("form",{onSubmit:e[6]||(e[6]=K((...r)=>o.submitInvoice&&o.submitInvoice(...r),["prevent"]))},[i("div",cv,[i("div",dv,[i("label",uv,l(o.translations.invoice_number),1),F(i("input",{type:"text",id:"invoiceNumber","onUpdate:modelValue":e[0]||(e[0]=r=>n.invoice.invoice_number=r),class:"ecwp-input input input-bordered w-full",disabled:"true"},null,512),[[J,n.invoice.invoice_number]])]),i("div",hv,[i("label",mv,l(o.translations.due_date),1),P(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]=r=>n.invoice.due_date=r),"enable-time-picker":!1,"auto-apply":"",format:o.formattedDate,"min-date":new Date,locale:"fr"},null,8,["class","modelValue","format","min-date"])]),i("div",fv,[i("label",pv,l(o.translations.company_name),1),P(h,{modelValue:n.invoice.client_id,"onUpdate:modelValue":e[2]||(e[2]=r=>n.invoice.client_id=r),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",_v,[i("label",gv,l(o.translations.status),1),F(i("select",{id:"status","onUpdate:modelValue":e[3]||(e[3]=r=>n.invoice.status=r),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",yv,l(o.translations.unpaid),1),i("option",bv,l(o.translations.paid),1)],2),[[Ie,n.invoice.status]])]),o.currencyMismatch?(c(),d("div",wv,[i("label",xv,l(o.translations.exchange_rate),1),F(i("input",{type:"text",id:"exchangeRate","onUpdate:modelValue":e[4]||(e[4]=r=>n.invoice.exchange_rate=r),class:"ecwp-input input input-bordered w-full",required:""},null,512),[[J,n.invoice.exchange_rate]])])):g("",!0)]),i("div",Iv,[i("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:e[5]||(e[5]=(...r)=>o.cancelAction&&o.cancelAction(...r))},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?(c(),d("span",Cv)):g("",!0)],8,Ev)])],32)]),_:1})])}var Tv=oe(sv,[["render",kv]]);const we=Qt;(function(t,e){const s=Qt,a=t();for(;[];)try{if(parseInt(s(353))/1+parseInt(s(336))/2*(-parseInt(s(340))/3)+parseInt(s(338))/4*(parseInt(s(342))/5)+parseInt(s(344))/6*(parseInt(s(355))/7)+parseInt(s(348))/8+parseInt(s(341))/9*(-parseInt(s(345))/10)+parseInt(s(350))/11*(-parseInt(s(352))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Ut,347969);function Ut(){const t=["441583qMNFVP","InvoiceNew","3377682uCiSVP","Quote","/invoice/detail/:id","InvoiceViewDetail","2amEBit","/quote/detail/:id","4MdSzOn","/quote/edit/:id","895119FtyMfL","162BLVpZn","2831455SaAzsC","QuoteEdit","6dpZVDv","247550HSKaXY","Invoice","QuoteViewDetail","4071216MjUAJK","/invoice/edit/:id","1705IAGfBM","/quotes","70248XdLfXe"];return Ut=function(){return t},Ut()}function Qt(t,e){const s=Ut();return Qt=function(a,n){return a=a-335,s[a]},Qt(t,e)}const Av=[{path:we(351),name:we(356),component:ja},{path:we(337),name:we(347),component:xu},{path:"/quote/new",name:"QuoteNew",component:Yu},{path:we(339),name:we(343),component:_s},{path:"/invoices",name:we(346),component:$h},{path:we(357),name:we(335),component:Mg},{path:we(349),name:"InvoiceEdit",component:Tv},{path:"/invoice/new",name:we(354),component:nv}],Ov=Xo({history:_o(),routes:Av});export{Ov as r};
  • my-easy-compta/trunk/assets/dist/invoices.min.js

    r3148192 r3155882  
    1 import{_ as i,d,o as _,H as f,f as u,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 b={name:"Invoices",mounted(){this.$router.push("/invoices")}};function h(r,n,t,e,x,p){const c=d("router-view");return _(),f(c)}var v=i(b,[["render",h]]);const a=o;function o(r,n){const t=s();return o=function(e,x){return e=e-211,t[e]},o(r,n)}(function(r,n){const t=o,e=r();for(;[];)try{if(parseInt(t(222))/1*(parseInt(t(220))/2)+-parseInt(t(215))/3*(-parseInt(t(213))/4)+-parseInt(t(214))/5*(parseInt(t(212))/6)+-parseInt(t(211))/7*(parseInt(t(219))/8)+parseInt(t(223))/9+-parseInt(t(216))/10+parseInt(t(217))/11===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(s,927172);function s(){const r=["17671UdrAPX","7353414WbnYiR","use","15036EriDLV","246dmQNZm","4kHDcor","176635vLGguk","3940659aPKRKl","17988050lwpamF","20994215WZsvND","#my-easy-compta-invoices-app","5288geMAHb","176ivAsVU","mount"];return s=function(){return r},s()}const l=u({render:()=>m(v)});l[a(224)](I)[a(221)](a(218));
     1import{_ as i,d as f,o as u,H as _,f as m,h as d}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 b={name:"Invoices",mounted(){this.$router.push("/invoices")}};function h(r,n,t,e,o,a){const p=f("router-view");return u(),_(p)}var v=i(b,[["render",h]]);const x=c;(function(r,n){const t=c,e=r();for(;[];)try{if(-parseInt(t(206))/1*(parseInt(t(199))/2)+-parseInt(t(204))/3*(parseInt(t(200))/4)+parseInt(t(208))/5*(-parseInt(t(207))/6)+-parseInt(t(198))/7+-parseInt(t(203))/8*(-parseInt(t(212))/9)+parseInt(t(211))/10*(-parseInt(t(210))/11)+parseInt(t(201))/12===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(s,872447);function s(){const r=["9707747vQyDCp","41034jZMfsn","20uYGFry","38341608iysbiC","mount","2824FKmQdI","870009LokKsf","use","7swYaeh","234iNasTy","56820OMaYZY","#my-easy-compta-invoices-app","11fYPdUC","1475970mNvKfK","31833qusIbv"];return s=function(){return r},s()}function c(r,n){const t=s();return c=function(e,o){return e=e-198,t[e]},c(r,n)}const y=m({render:()=>d(v)});y[x(205)](I)[x(202)](x(209));
  • my-easy-compta/trunk/assets/dist/payments.min.js

    r3148192 r3155882  
    1 import{_ 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 B,j as T,H as I,v as j,m as w,e as P,p as D,f as S,h as V}from"./plugin-vue_export-helper.min.js";import{C as A,R as U}from"./RemoveAlert.min.js";import{V as F}from"./vue-datepicker.min.js";import{g as q,b as N,s as R,f as O}from"./api.min.js";const W={components:{VueDatePicker:F},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"),m=s.getFullYear();return`${e}-${l}-${m}`}},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}}},X=["id","open"],z={class:"modal-box"},L={class:"font-bold text-lg"},Y={key:0},H={class:"grid grid-cols-2 gap-4"},J=t("div",{class:"skeleton h-4 w-full mb-2"},null,-1),G=t("div",{class:"skeleton h-4 w-full"},null,-1),K=[J,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,m,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",z,[t("h3",L,r(l.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 "),l.loading?(i(),d("div",Y,[t("div",H,[(i(!0),d(p,null,_(o.skeletonItems,c=>(i(),d("div",{key:c,class:"py-2"},K))),128))])])):(i(),d("form",{key:1,onSubmit:e[4]||(e[4]=E((...c)=>o.submitForm&&o.submitForm(...c),["prevent"])),class:"form"},[t("div",Q,[(i(!0),d(p,null,_(n.fields,(c,u)=>(i(),d("div",{key:u,class:"ecwp-group form-group"},[t("label",{for:u,class:"ecwp-label form-label"},r(c.label),9,Z),u!=="payment_method"&&u!=="payment_date"?g((i(),d("input",{key:0,type:c.type||"text",id:u,"onUpdate:modelValue":a=>n.editedPayment[u]=a,class:h(["ecwp-input input","input-bordered",c.class||"w-full"]),disabled:c.disabled},null,10,$)),[[B,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",c.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]=c=>n.editedPayment.notes=c),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[j,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,X)])}var de=C(W,[["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=q(this.currentPage,this.totalPages)},goToPage(s){s!=="..."&&this.fetchPayments(s)},perPageChanged(){this.fetchPayments()},formatAmount(s,e){return N(s,e,this.settings.currency_position)},showToast(s,e){R(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 O();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}}},ce={class:"pt-2 pr-4"},me={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),Be=[Ee],Ie={class:"flex justify-end"},je=["data-tip"],De=["onClick"],Se=t("i",{class:"fas fa-pencil-alt"},null,-1),Ve=[Se],Ae=["data-tip"],Ue=["onClick"],Fe=t("i",{class:"far fa-trash-alt"},null,-1),qe=[Fe],Ne={key:1},Re=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),Oe=t("div",{class:"divider my-1"},null,-1),We=[Re,Oe],Xe={class:"join ecwp_pagination mt-6 pt-4"},ze=["onClick"];function Le(s,e,l,m,n,o){const x=y("payment-edit-modal"),c=y("remove-modal"),u=y("Card");return i(),d("div",ce,[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(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[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:D(()=>[t("div",me,[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",Ne,[(i(!0),d(p,null,_(n.skeletonRows,a=>(i(),d("div",{key:a,class:"flex flex-col gap-4 w-full"},We))),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,Be)):(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)},Ve,8,De)],8,je),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"},qe,8,Ue)],8,Ae)])]))),128))])])),t("div",Xe,[(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,ze))),128))])])]),_:1})])}var Ye=C(re,[["render",Le]]);const M=b;(function(s,e){const l=b,m=s();for(;[];)try{if(-parseInt(l(450))/1*(parseInt(l(460))/2)+-parseInt(l(456))/3*(-parseInt(l(448))/4)+-parseInt(l(454))/5*(parseInt(l(446))/6)+-parseInt(l(459))/7*(parseInt(l(457))/8)+-parseInt(l(458))/9*(parseInt(l(455))/10)+parseInt(l(461))/11*(parseInt(l(451))/12)+parseInt(l(449))/13*(parseInt(l(447))/14)===e)break;m.push(m.shift())}catch{m.push(m.shift())}})(v,995600);function b(s,e){const l=v();return b=function(m,n){return m=m-446,l[m]},b(s,e)}function v(){const s=["1164sXoveq","mount","#my-easy-compta-payments-app","595NANSyB","4809830cgocOL","2343273fkNUbb","1928CqYZcq","18qtWtca","48475FlYUqt","60968kvqPiE","63305dlUtAt","31764yKnwzO","14hakETd","4XULeQp","53774643GyWHTJ","40OogkEF"];return v=function(){return s},v()}const He=S({render:()=>V(Ye)});He[M(452)](M(453));
     1import{_ 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 D,m as P,e as w,p as I,f as j,h as S}from"./plugin-vue_export-helper.min.js";import{C as V,R as A}from"./RemoveAlert.min.js";import{V as U}from"./vue-datepicker.min.js";import{g as R,b as F,s as O,f as X}from"./api.min.js";const N={components:{VueDatePicker:U},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"),m=s.getFullYear();return`${e}-${l}-${m}`}},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}}},W=["id","open"],z={class:"modal-box"},L={class:"font-bold text-lg"},q={key:0},Q={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],J={class:"grid grid-cols-2 gap-4"},K=["for"],Z=["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,m,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",z,[t("h3",L,r(l.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 "),l.loading?(i(),d("div",q,[t("div",Q,[(i(!0),d(p,null,_(o.skeletonItems,c=>(i(),d("div",{key:c,class:"py-2"},H))),128))])])):(i(),d("form",{key:1,onSubmit:e[4]||(e[4]=T((...c)=>o.submitForm&&o.submitForm(...c),["prevent"])),class:"form"},[t("div",J,[(i(!0),d(p,null,_(n.fields,(c,u)=>(i(),d("div",{key:u,class:"ecwp-group form-group"},[t("label",{for:u,class:"ecwp-label form-label"},r(c.label),9,K),u!=="payment_method"&&u!=="payment_date"?g((i(),d("input",{key:0,type:c.type||"text",id:u,"onUpdate:modelValue":a=>n.editedPayment[u]=a,class:h(["ecwp-input input","input-bordered",c.class||"w-full"]),disabled:c.disabled},null,10,Z)),[[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",c.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(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",te,[t("label",se,r(o.translations.note),1),g(t("textarea",{id:"note","onUpdate:modelValue":e[3]||(e[3]=c=>n.editedPayment.notes=c),class:"ecwp-input textarea textarea-bordered w-full",rows:"4"},null,512),[[D,n.editedPayment.notes]])]),t("div",ne,[t("button",{type:"submit",class:"btn btn-primary rounded-full",disabled:n.loadingBtn},[P(r(o.translations.save)+" ",1),n.loadingBtn?(i(),d("span",oe)):f("",!0)],8,ae)])],32))])],8,W)])}var ie=M(N,[["render",le]]);const de={name:"Payments",components:{Card:V,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=R(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){O(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 X();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"},ce={class:"flex justify-between items-center"},me={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"},xe=["value"],we={class:"overflow-x-auto"},Pe={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"},De=["data-tip"],Ie=["onClick"],je=t("i",{class:"fas fa-pencil-alt"},null,-1),Se=[je],Ve=["data-tip"],Ae=["onClick"],Ue=t("i",{class:"far fa-trash-alt"},null,-1),Re=[Ue],Fe={key:1},Oe=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),Xe=t("div",{class:"divider my-1"},null,-1),Ne=[Oe,Xe],We={class:"join ecwp_pagination mt-6 pt-4"},ze=["onClick"];function Le(s,e,l,m,n,o){const x=y("payment-edit-modal"),c=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),w(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"]),w(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[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"]),w(u,{topMargin:"mt-8"},{default:I(()=>[t("div",ce,[t("h2",me,r(o.translations.payments),1),n.settings.easy_compta_export_addon_active==1?(i(),d("div",ue,[t("a",he,[P(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,[P(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,xe))),128))],544),[[C,n.perPage]])]),t("div",we,[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"},Ne))),128))])):(i(),d("table",Pe,[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)},Se,8,Ie)],8,De),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"},Re,8,Ae)],8,Ve)])]))),128))])])),t("div",We,[(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,ze))),128))])])]),_:1})])}var qe=M(de,[["render",Le]]);const Qe=b;(function(s,e){const l=b,m=s();for(;[];)try{if(-parseInt(l(142))/1+parseInt(l(145))/2*(parseInt(l(137))/3)+parseInt(l(140))/4+-parseInt(l(144))/5*(-parseInt(l(135))/6)+-parseInt(l(136))/7+parseInt(l(134))/8*(parseInt(l(138))/9)+-parseInt(l(141))/10*(parseInt(l(139))/11)===e)break;m.push(m.shift())}catch{m.push(m.shift())}})(v,122020);function b(s,e){const l=v();return b=function(m,n){return m=m-134,l[m]},b(s,e)}function v(){const s=["8610waRgyU","30633QXZXMn","mount","1915DYjGsc","4hMfYAI","16uAkWbm","72EbOLrB","240765zqhyrD","180633tkwtva","287748dOQPQi","3025LAlfUK","939444kSPDwU"];return v=function(){return s},v()}const Ye=j({render:()=>S(qe)});Ye[Qe(143)]("#my-easy-compta-payments-app");
  • my-easy-compta/trunk/assets/dist/quotes.min.js

    r3148192 r3155882  
    1 import{_ as c,d as u,o as _,H as i,f as m,h as d}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:"Quotes",mounted(){this.$router.push("/quotes")}};function l(r,n,t,e,a,f){const p=u("router-view");return _(),i(p)}var b=c(h,[["render",l]]);const x=s;function o(){const r=["1990224EzlbOL","50838pAmKZg","#my-easy-compta-quotes-app","use","2616fRtSyB","10kiuTzH","148987qlKAHC","1163617ttlmYQ","581824BMNnbX","5835OIUaZa","2kgDyXd","5065480uyUxrq"];return o=function(){return r},o()}(function(r,n){const t=s,e=r();for(;[];)try{if(parseInt(t(249))/1+-parseInt(t(253))/2*(parseInt(t(256))/3)+parseInt(t(251))/4+parseInt(t(252))/5*(-parseInt(t(247))/6)+parseInt(t(250))/7+parseInt(t(254))/8+parseInt(t(255))/9*(-parseInt(t(248))/10)===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(o,346965);const y=m({render:()=>d(b)});function s(r,n){const t=o();return s=function(e,a){return e=e-247,t[e]},s(r,n)}y[x(258)](I).mount(x(257));
     1import{_ as u,d as _,o as i,H as f,f as m,h as d}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:"Quotes",mounted(){this.$router.push("/quotes")}};function b(r,n,t,e,x,p){const c=_("router-view");return i(),f(c)}var l=u(h,[["render",b]]);const a=o;(function(r,n){const t=o,e=r();for(;[];)try{if(-parseInt(t(375))/1*(parseInt(t(381))/2)+-parseInt(t(376))/3+-parseInt(t(386))/4*(parseInt(t(384))/5)+-parseInt(t(379))/6*(-parseInt(t(387))/7)+parseInt(t(383))/8*(parseInt(t(382))/9)+parseInt(t(378))/10+-parseInt(t(377))/11===n)break;e.push(e.shift())}catch{e.push(e.shift())}})(s,621994);function o(r,n){const t=s();return o=function(e,x){return e=e-375,t[e]},o(r,n)}const k=m({render:()=>d(l)});k[a(380)](I)[a(385)]("#my-easy-compta-quotes-app");function s(){const r=["1003116PFWNKt","1506450LRjfQN","3745860kHUwTG","5599626qMDXTJ","use","2gxLxjS","69831PtcGlk","568Ummgfs","3105010kPxOYZ","mount","4kzLYZH","7glbYIm","144428gRJzut"];return s=function(){return r},s()}
  • my-easy-compta/trunk/assets/dist/settings.min.js

    r3148192 r3155882  
    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:"",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=e("div",{class:"divider my-4"},null,-1),hn={class:"grid grid-cols-2 gap-4"},pn={class:"ecwp-group form-control"},mn={class:"ecwp-label label",for:"conditions-payment"},fn={class:"ecwp-group form-control"},bn={class:"ecwp-label label",for:"mode-payment"},_n={class:"grid grid-cols-1 gap-4"},gn={class:"form-control"},vn={class:"ecwp-label label",for:"invoice-prefix"},yn={class:"grid grid-cols-2 gap-4"},wn={class:"ecwp-group form-control"},xn={class:"ecwp-label label",for:"invoice-iban"},kn={class:"ecwp-group form-control"},Cn={class:"ecwp-label label",for:"invoice-bic"},Tn={class:"form-control"},Mn={class:"ecwp-label label",for:"invoice-prefix"},An={class:"mt-6 flex justify-end"},Sn={type:"submit",class:"btn btn-primary rounded-full"},Pn=e("i",{class:"far fa-save"},null,-1),En={key:5},jn={class:"text-xl font-semibold mb-4"},Vn={class:"grid grid-cols-2 gap-4"},In={class:"ecwp-group form-control"},Fn={class:"ecwp-label label",for:"credit-color"},Rn={class:"ecwp-group form-control"},Un={class:"ecwp-label label",for:"credit-prefix"},Dn={class:"grid grid-cols-1 gap-4"},Hn={class:"form-control"},Yn={class:"ecwp-label label",for:"credit-prefix"},Nn={class:"form-control"},qn={class:"ecwp-label label",for:"credit-prefix"},Ln={class:"mt-6 flex justify-end"},On={type:"submit",class:"btn btn-primary rounded-full"},Wn=e("i",{class:"far fa-save"},null,-1),Xn={key:6},Bn={class:"text-xl font-semibold mb-4"},zn={class:"grid grid-cols-2 gap-4"},Gn={class:"ecwp-group form-control"},Jn={class:"ecwp-label label",for:"quote-color"},Zn={class:"ecwp-group form-control"},Qn={class:"ecwp-label label",for:"quote-prefix"},Kn={class:"grid grid-cols-1 gap-4"},$n={class:"form-control"},ti={class:"ecwp-label label",for:"quote-prefix"},ei={class:"form-control"},si={class:"ecwp-label label",for:"quote-prefix"},ni={class:"mt-6 flex justify-end"},ii={type:"submit",class:"btn btn-primary rounded-full"},oi=e("i",{class:"far fa-save"},null,-1),ai={key:7},li={class:"text-xl font-semibold mb-4"},ri={key:0,id:"modal_currency",class:"modal"},ci={class:"modal-box"},di={class:"ecwp-group form-control"},ui={class:"ecwp-label label",for:"name_currency"},hi={class:"ecwp-group form-control"},pi={class:"ecwp-label label",for:"symbol_currency"},mi={class:"ecwp-group form-control"},fi={class:"ecwp-label label",for:"code_currency"},bi={class:"form-group mt-4 flex justify-end"},_i={type:"submit",class:"btn btn-primary rounded-full mx-2"},gi={class:"mb-8"},vi={class:"flex justify-between items-center mb-4"},yi={class:"text-lg font-semibold"},wi=e("i",{class:"fas fa-plus mr-2"},null,-1),xi={class:"table-container"},ki={class:"table w-full"},Ci=["onClick"],Ti=e("i",{class:"fas fa-edit"},null,-1),Mi=[Ti],Ai=["onClick"],Si=e("i",{class:"fas fa-trash"},null,-1),Pi=[Si],Ei={key:0,id:"modal_vat",class:"modal"},ji={class:"modal-box"},Vi={class:"ecwp-group form-control"},Ii={class:"ecwp-label label",for:"vat-description"},Fi={class:"ecwp-group form-control"},Ri={class:"ecwp-label label",for:"vat-rate"},Ui={class:"form-group mt-4 flex justify-end"},Di={type:"submit",class:"btn btn-primary rounded-full mx-2"},Hi={class:"flex justify-between items-center mb-4"},Yi={class:"text-lg font-semibold"},Ni=e("i",{class:"fas fa-plus mr-2"},null,-1),qi={class:"table-container"},Li={class:"table w-full"},Oi=["onClick"],Wi=e("i",{class:"fas fa-edit"},null,-1),Xi=[Wi],Bi=["onClick"],zi=e("i",{class:"fas fa-trash"},null,-1),Gi=[zi],Ji={key:8},Zi={class:"text-xl font-semibold mb-4"},Qi={key:0,id:"modal_payments",class:"modal"},Ki={class:"modal-box"},$i={class:"ecwp-group form-control"},to={class:"ecwp-label label",for:"name_payment"},eo={class:"form-group mt-4 flex justify-end"},so={type:"submit",class:"btn btn-primary rounded-full mx-2"},no={class:"mb-8"},io={class:"flex justify-between items-center mb-4"},oo={class:"text-lg font-semibold"},ao=e("i",{class:"fas fa-plus mr-2"},null,-1),lo={class:"table-container"},ro={class:"table w-full"},co=["onClick"],uo=e("i",{class:"fas fa-edit"},null,-1),ho=[uo],po=["onClick"],mo=e("i",{class:"fas fa-trash"},null,-1),fo=[mo],bo={key:9},_o={class:"text-xl font-semibold mb-4"},go={key:0,id:"modal_expenses",class:"modal"},vo={class:"modal-box"},yo={class:"ecwp-group form-control"},wo={class:"ecwp-label label",for:"name_expense"},xo={class:"form-group mt-4 flex justify-end"},ko={type:"submit",class:"btn btn-primary rounded-full mx-2"},Co={class:"mb-8"},To={class:"flex justify-between items-center mb-4"},Mo={class:"text-lg font-semibold"},Ao=e("i",{class:"fas fa-plus mr-2"},null,-1),So={class:"table-container"},Po={class:"table w-full"},Eo=["onClick"],jo=e("i",{class:"fas fa-edit"},null,-1),Vo=[jo],Io=["onClick"],Fo=e("i",{class:"fas fa-trash"},null,-1),Ro=[Fo],Uo={key:10},Do={class:"text-xl font-semibold mb-4"},Ho={key:0,id:"modal_planning",class:"modal"},Yo={class:"modal-box"},No={class:"ecwp-group form-control"},qo={class:"ecwp-label label",for:"name_planning"},Lo={class:"ecwp-group form-control"},Oo={class:"ecwp-label label",for:"background_planning"},Wo={class:"ecwp-group form-control"},Xo={class:"ecwp-label label",for:"color_planning"},Bo={class:"form-group mt-4 flex justify-end"},zo=["disabled"],Go={key:0,class:"loading loading-spinner loading-sm"},Jo={class:"mb-8"},Zo={class:"flex justify-between items-center mb-4"},Qo={class:"text-lg font-semibold"},Ko=e("i",{class:"fas fa-plus mr-2"},null,-1),$o={class:"table-container"},ta={class:"table w-full"},ea=["onClick"],sa=e("i",{class:"fas fa-edit"},null,-1),na=[sa],ia=["onClick"],oa=e("i",{class:"fas fa-trash"},null,-1),aa=[oa],la={key:11},ra={class:"text-xl font-semibold mb-4"},ca={class:"form-control mt-4 mb-4"},da={class:"cursor-pointer"},ua={class:"label-text mr-2 font-bold"},ha=["checked"],pa=e("div",{class:"divider mt-2 mb-4"},null,-1),ma={role:"tablist",class:"tabs tabs-boxed"},fa={key:0,class:"p-4"},ba={class:"grid grid-cols-1 gap-4"},_a={class:"ecwp-group form-control"},ga={class:"ecwp-label label",for:"email_invoice_subject"},va={class:"form-control"},ya={class:"ecwp-label label"},wa=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),xa={key:1,class:"p-4"},ka={class:"grid grid-cols-1 gap-4"},Ca={class:"ecwp-group form-control"},Ta={class:"ecwp-label label",for:"email_quote_subject"},Ma={class:"form-control"},Aa={class:"ecwp-label label"},Sa=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),Pa={key:2,class:"p-4"},Ea={class:"grid grid-cols-1 gap-4"},ja={class:"ecwp-group form-control"},Va={class:"ecwp-label label",for:"remind_invoice_subject"},Ia={class:"form-control"},Fa={class:"ecwp-label label"},Ra=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),Ua={key:3,class:"p-4"},Da={role:"alert",class:"alert shadow"},Ha=e("i",{class:"fas fa-exclamation-circle"},null,-1),Ya={class:"text-xl text-center my-4"},Na={class:"mt-6 flex justify-end"},qa={type:"submit",class:"btn btn-primary rounded-full"},La=e("i",{class:"far fa-save"},null,-1),Oa={key:12},Wa={class:"text-xl font-semibold mb-4"},Xa={role:"tablist",class:"tabs tabs-boxed"},Ba={key:0,class:"p-4"},za={class:"grid grid-cols-1 gap-4"},Ga={class:"ecwp-group form-control"},Ja={class:"ecwp-label label",for:"email_create_account_subject"},Za={class:"form-control"},Qa={class:"ecwp-label label"},Ka=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),$a={class:"mt-6 flex justify-end"},tl={type:"submit",class:"btn btn-primary rounded-full"},el=e("i",{class:"far fa-save"},null,-1),sl={key:1,class:"p-4"},nl={role:"alert",class:"alert shadow"},il=e("i",{class:"fas fa-exclamation-circle"},null,-1),ol={class:"text-xl text-center my-4"},al={key:13},ll={class:"text-xl font-semibold mb-4"},rl={class:"grid grid-cols-1 gap-4"},cl={class:"ecwp-group form-control"},dl={class:"ecwp-label label",for:"stripe-mode"},ul={value:"test"},hl={value:"live"},pl={key:0},ml={class:"ecwp-group form-control"},fl={class:"ecwp-label label",for:"stripe-public-key-test"},bl={class:"ecwp-group form-control"},_l={class:"ecwp-label label",for:"stripe-secret-key-test"},gl={key:1},vl={class:"ecwp-group form-control"},yl={class:"ecwp-label label",for:"stripe-public-key-live"},wl={class:"ecwp-group form-control"},xl={class:"ecwp-label label",for:"stripe-secret-key-live"},kl={class:"mt-6 flex justify-end"},Cl={type:"submit",class:"btn btn-primary rounded-full"},Tl=e("i",{class:"far fa-save"},null,-1),Ml={key:14},Al={class:"text-xl font-semibold mb-4"},Sl={class:"grid grid-cols-1 gap-4"},Pl={class:"ecwp-group form-control mt-2"},El={class:"ecwp-label label",for:"limit-declaration"},jl={class:"ecwp-group form-control mt-2"},Vl={class:"ecwp-label label",for:"limit-tva"},Il={class:"mt-6 flex justify-end"},Fl={type:"submit",class:"btn btn-primary rounded-full"},Rl=e("i",{class:"far fa-save"},null,-1),Ul={key:15},Dl={class:"text-xl font-semibold mb-4"},Hl={class:"grid grid-cols-2 gap-4"},Yl={class:"ecwp-group form-group relative join"},Nl={class:"ecwp-label label",for:"license-code"},ql=["disabled"],Ll=["disabled"],Ol={key:0,class:"loading loading-spinner loading-sm"},Wl={key:1},Xl={class:"grid grid-cols-1 gap-4"},Bl={key:0,class:"error-message"},zl={key:1,class:"overflow-x-auto my-4"},Gl={class:"table table-xs table-pin-rows table-pin-cols"},Jl=e("i",{class:"far fa-trash-alt"},null,-1),Zl=[Jl],Ql={class:"table table-xs table-pin-rows table-pin-cols mt-6"},Kl=["onClick"],$l=["onClick"],tr=["onClick"];function er(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",required:""},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[62]||(t[62]=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)])])]),un,e("div",hn,[e("div",pn,[e("label",mn,l(n.translations.payment_conditions),1),p(e("input",{type:"text",id:"conditions-payment","onUpdate:modelValue":t[56]||(t[56]=a=>i.form.payment_conditions=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_conditions]])]),e("div",fn,[e("label",bn,l(n.translations.payment_mode),1),p(e("input",{type:"text",id:"mode-payment","onUpdate:modelValue":t[57]||(t[57]=a=>i.form.payment_mode=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.payment_mode]])])]),e("div",_n,[e("div",gn,[e("label",vn,l(n.translations.invoice_terms),1),e("div",null,[x(_,{modelValue:i.form.invoice_terms,"onUpdate:modelValue":t[58]||(t[58]=a=>i.form.invoice_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",yn,[e("div",wn,[e("label",xn,l(n.translations.invoice_iban),1),p(e("input",{type:"text",id:"invoice-iban","onUpdate:modelValue":t[59]||(t[59]=a=>i.form.invoice_iban=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_iban]])]),e("div",kn,[e("label",Cn,l(n.translations.invoice_bic),1),p(e("input",{type:"text",id:"invoice-bic","onUpdate:modelValue":t[60]||(t[60]=a=>i.form.invoice_bic=a),class:"ecwp-input input input-bordered"},null,512),[[f,i.form.invoice_bic]])])]),e("div",Tn,[e("label",Mn,l(n.translations.invoice_footer),1),e("div",null,[x(_,{modelValue:i.form.invoice_footer,"onUpdate:modelValue":t[61]||(t[61]=a=>i.form.invoice_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",An,[e("button",Sn,[Pn,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===5?(c(),d("div",En,[e("h2",jn,l(n.translations.credits_settings),1),e("form",{onSubmit:t[68]||(t[68]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Vn,[e("div",In,[e("label",Fn,l(n.translations.credit_color),1),p(e("input",{type:"text",id:"credit-color","onUpdate:modelValue":t[63]||(t[63]=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[64]||(t[64]=a=>i.form.credit_color=a)},null,8,["modelValue"])]),e("div",Rn,[e("label",Un,l(n.translations.credit_prefix),1),p(e("input",{type:"text",id:"credit-prefix","onUpdate:modelValue":t[65]||(t[65]=a=>i.form.credit_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.credit_prefix]])])]),e("div",Dn,[e("div",Hn,[e("label",Yn,l(n.translations.credit_footer),1),e("div",null,[x(_,{modelValue:i.form.credit_footer,"onUpdate:modelValue":t[66]||(t[66]=a=>i.form.credit_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",Nn,[e("label",qn,l(n.translations.credit_terms),1),e("div",null,[x(_,{modelValue:i.form.credit_terms,"onUpdate:modelValue":t[67]||(t[67]=a=>i.form.credit_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",Ln,[e("button",On,[Wn,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===6?(c(),d("div",Xn,[e("h2",Bn,l(n.translations.quotes_settings),1),e("form",{onSubmit:t[74]||(t[74]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",zn,[e("div",Gn,[e("label",Jn,l(n.translations.quote_color),1),p(e("input",{type:"text",id:"quote-color","onUpdate:modelValue":t[69]||(t[69]=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[70]||(t[70]=a=>i.form.quote_color=a)},null,8,["modelValue"])]),e("div",Zn,[e("label",Qn,l(n.translations.quote_prefix),1),p(e("input",{type:"text",id:"quote-prefix","onUpdate:modelValue":t[71]||(t[71]=a=>i.form.quote_prefix=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.quote_prefix]])])]),e("div",Kn,[e("div",$n,[e("label",ti,l(n.translations.quote_footer),1),e("div",null,[x(_,{modelValue:i.form.quote_footer,"onUpdate:modelValue":t[72]||(t[72]=a=>i.form.quote_footer=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])]),e("div",ei,[e("label",si,l(n.translations.quote_terms),1),e("div",null,[x(_,{modelValue:i.form.quote_terms,"onUpdate:modelValue":t[73]||(t[73]=a=>i.form.quote_terms=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])])])]),e("div",ni,[e("button",ii,[oi,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===7?(c(),d("div",ai,[e("h2",li,l(n.translations.currency_vat_settings),1),i.showCurrencyModal?(c(),d("dialog",ri,[e("div",ci,[e("h3",null,l(i.editingCurrency?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[80]||(t[80]=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[75]||(t[75]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))}," \u2715 "),e("div",di,[e("label",ui,l(n.translations.name),1),p(e("input",{type:"text",id:"name_currency","onUpdate:modelValue":t[76]||(t[76]=a=>i.currencyForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.name]])]),e("div",hi,[e("label",pi,l(n.translations.symbol),1),p(e("input",{type:"text",id:"symbol_currency","onUpdate:modelValue":t[77]||(t[77]=a=>i.currencyForm.symbol=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.symbol]])]),e("div",mi,[e("label",fi,l(n.translations.code),1),p(e("input",{type:"text",id:"code_currency","onUpdate:modelValue":t[78]||(t[78]=a=>i.currencyForm.code=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.currencyForm.code]])]),e("div",bi,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[79]||(t[79]=(...a)=>n.closeCurrencyModal&&n.closeCurrencyModal(...a))},l(n.translations.cancel),1),e("button",_i,l(i.editingCurrency?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",gi,[e("div",vi,[e("h3",yi,l(n.translations.currencies),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[81]||(t[81]=(...a)=>n.addCurrency&&n.addCurrency(...a))},[wi,g(" "+l(n.translations.add_currency),1)])]),e("div",xi,[e("table",ki,[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)},Mi,8,Ci),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("currency",a.id)},Pi,8,Ai)])]))),128))])])])]),e("div",null,[i.showVATModal?(c(),d("dialog",Ei,[e("div",ji,[e("h3",null,l(i.editingVAT?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[86]||(t[86]=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[82]||(t[82]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))}," \u2715 "),e("div",Vi,[e("label",Ii,l(n.translations.description),1),p(e("input",{type:"text",id:"vat-description","onUpdate:modelValue":t[83]||(t[83]=a=>i.vatForm.description=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.description]])]),e("div",Fi,[e("label",Ri,l(n.translations.rate)+" (%)",1),p(e("input",{type:"text",id:"vat-rate","onUpdate:modelValue":t[84]||(t[84]=a=>i.vatForm.rate=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.vatForm.rate]])]),e("div",Ui,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[85]||(t[85]=(...a)=>n.closeVATModal&&n.closeVATModal(...a))},l(n.translations.cancel),1),e("button",Di,l(i.editingVAT?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Hi,[e("h3",Yi,l(n.translations.vat_rates),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[87]||(t[87]=(...a)=>n.addVAT&&n.addVAT(...a))},[Ni,g(" "+l(n.translations.add_vat),1)])]),e("div",qi,[e("table",Li,[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)},Xi,8,Oi),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("vat",a.id)},Gi,8,Bi)])]))),128))])])])])])):b("",!0),i.selectedTab===8?(c(),d("div",Ji,[e("h2",Zi,l(n.translations.payments_settings),1),i.showPaymentModal?(c(),d("dialog",Qi,[e("div",Ki,[e("h3",null,l(i.editingPayment?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[91]||(t[91]=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[88]||(t[88]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))}," \u2715 "),e("div",$i,[e("label",to,l(n.translations.name),1),p(e("input",{type:"text",id:"name_payment","onUpdate:modelValue":t[89]||(t[89]=a=>i.paymentForm.method_name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.paymentForm.method_name]])]),e("div",eo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[90]||(t[90]=(...a)=>n.closePaymentModal&&n.closePaymentModal(...a))},l(n.translations.cancel),1),e("button",so,l(i.editingPayment?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",no,[e("div",io,[e("h3",oo,l(n.translations.payments_methods),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[92]||(t[92]=(...a)=>n.addPayment&&n.addPayment(...a))},[ao,g(l(n.translations.add_method),1)])]),e("div",lo,[e("table",ro,[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)},ho,8,co),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("payment",a.id)},fo,8,po)])]))),128))])])])])])):b("",!0),i.selectedTab===9?(c(),d("div",bo,[e("h2",_o,l(n.translations.expenses_settings),1),i.showExpenseModal?(c(),d("dialog",go,[e("div",vo,[e("h3",null,l(i.editingExpense?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[96]||(t[96]=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[93]||(t[93]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))}," \u2715 "),e("div",yo,[e("label",wo,l(n.translations.name),1),p(e("input",{type:"text",id:"name_expense","onUpdate:modelValue":t[94]||(t[94]=a=>i.expenseForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.expenseForm.name]])]),e("div",xo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[95]||(t[95]=(...a)=>n.closeExpenseModal&&n.closeExpenseModal(...a))},l(n.translations.cancel),1),e("button",ko,l(i.editingExpense?n.translations.save:n.translations.add),1)])],32)])])):b("",!0),e("div",Co,[e("div",To,[e("h3",Mo,l(n.translations.expenses_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[97]||(t[97]=(...a)=>n.addExpCat&&n.addExpCat(...a))},[Ao,g(" "+l(n.translations.add_category),1)])]),e("div",So,[e("table",Po,[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)},Vo,8,Eo),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("expense",a.id)},Ro,8,Io)])]))),128))])])])])])):b("",!0),i.selectedTab===10?(c(),d("div",Uo,[e("h2",Do,l(n.translations.planning_settings),1),i.showPlanningModal?(c(),d("dialog",Ho,[e("div",Yo,[e("h3",null,l(i.editingPlanning?n.translations.edit:n.translations.add),1),e("form",{onSubmit:t[105]||(t[105]=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[98]||(t[98]=(...a)=>n.closePlanningModal&&n.closePlanningModal(...a))}," \u2715 "),e("div",No,[e("label",qo,l(n.translations.name),1),p(e("input",{type:"text",id:"name_planning","onUpdate:modelValue":t[99]||(t[99]=a=>i.planningForm.name=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.planningForm.name]])]),e("div",Lo,[e("label",Oo,l(n.translations.background),1),p(e("input",{type:"text",id:"background_planning","onUpdate:modelValue":t[100]||(t[100]=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[101]||(t[101]=a=>i.planningForm.background=a)},null,8,["modelValue"])]),e("div",Wo,[e("label",Xo,l(n.translations.text_color),1),p(e("input",{type:"text",id:"color_planning","onUpdate:modelValue":t[102]||(t[102]=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[103]||(t[103]=a=>i.planningForm.color=a)},null,8,["modelValue"])]),e("div",Bo,[e("button",{type:"button",class:"btn btn-secondary rounded-full",onClick:t[104]||(t[104]=(...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",Go)):b("",!0)],8,zo)])],32)])])):b("",!0),e("div",Jo,[e("div",Zo,[e("h3",Qo,l(n.translations.planning_categories),1),e("button",{class:"btn btn-primary rounded-full",onClick:t[106]||(t[106]=(...a)=>n.addPlanningCat&&n.addPlanningCat(...a))},[Ko,g(" "+l(n.translations.add_category),1)])]),e("div",$o,[e("table",ta,[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)},na,8,ea),e("button",{class:"p-2 text-error",onClick:v=>n.delete_item("planning",a.id)},aa,8,ia)])]))),128))])])])])])):b("",!0),i.selectedTab===11?(c(),d("div",la,[e("h2",ra,l(n.translations.email_settings),1),e("form",{onSubmit:t[118]||(t[118]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ca,[e("label",da,[e("span",ua,l(n.translations.email_log_active),1),e("input",{type:"checkbox",checked:i.form.email_log_active==1,onChange:t[107]||(t[107]=(...a)=>n.updateEmailLogsActive&&n.updateEmailLogsActive(...a)),class:"wcpa-ui-toggle"},null,40,ha)])]),pa,e("div",ma,[e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab1"}]),onClick:t[108]||(t[108]=a=>n.setActiveTab("tab1"))},l(n.translations.email_invoice),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab2"}]),onClick:t[109]||(t[109]=a=>n.setActiveTab("tab2"))},l(n.translations.email_quote),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab3"}]),onClick:t[110]||(t[110]=a=>n.setActiveTab("tab3"))},l(n.translations.invoice_reminder),3),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabEmail==="tab4"}]),onClick:t[111]||(t[111]=a=>n.setActiveTab("tab4"))},l(n.translations.payment_received),3)]),i.activeTabEmail==="tab1"?(c(),d("div",fa,[e("div",ba,[e("div",_a,[e("label",ga,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_invoice_subject","onUpdate:modelValue":t[112]||(t[112]=a=>i.form.email_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_invoice_subject]])]),e("div",va,[e("label",ya,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_invoice_content,"onUpdate:modelValue":t[113]||(t[113]=a=>i.form.email_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),wa])])])):b("",!0),i.activeTabEmail==="tab2"?(c(),d("div",xa,[e("div",ka,[e("div",Ca,[e("label",Ta,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_quote_subject","onUpdate:modelValue":t[114]||(t[114]=a=>i.form.email_quote_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.email_quote_subject]])]),e("div",Ma,[e("label",Aa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_quote_content,"onUpdate:modelValue":t[115]||(t[115]=a=>i.form.email_quote_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Sa])])])):b("",!0),i.activeTabEmail==="tab3"?(c(),d("div",Pa,[e("div",Ea,[e("div",ja,[e("label",Va,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"remind_invoice_subject","onUpdate:modelValue":t[116]||(t[116]=a=>i.form.remind_invoice_subject=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.remind_invoice_subject]])]),e("div",Ia,[e("label",Fa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.remind_invoice_content,"onUpdate:modelValue":t[117]||(t[117]=a=>i.form.remind_invoice_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Ra])])])):b("",!0),i.activeTabEmail==="tab4"?(c(),d("div",Ua,[e("div",Da,[Ha,e("div",null,[e("h2",Ya,l(n.translations.coming_soon),1)])])])):b("",!0),e("div",Na,[e("button",qa,[La,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===12?(c(),d("div",Oa,[e("h2",Wa,l(n.translations.users_settings),1),e("div",Xa,[e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabUsers==="user1"}]),onClick:t[119]||(t[119]=a=>n.setActiveTabUsers("user1"))}," Automatic create account ",2),e("a",{role:"tab",class:y(["tab",{"tab-active":i.activeTabUsers==="user2"}]),onClick:t[120]||(t[120]=a=>n.setActiveTabUsers("user2"))}," Lost password ",2)]),i.activeTabUsers==="user1"?(c(),d("div",Ba,[e("form",{onSubmit:t[123]||(t[123]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",za,[e("div",Ga,[e("label",Ja,l(n.translations.email_subject),1),p(e("input",{type:"text",id:"email_create_account_subject","onUpdate:modelValue":t[121]||(t[121]=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",Za,[e("label",Qa,l(n.translations.email_content),1),e("div",null,[x(_,{modelValue:i.form.email_create_account_content,"onUpdate:modelValue":t[122]||(t[122]=a=>i.form.email_create_account_content=a),editorToolbar:i.toolbarOptions},null,8,["modelValue","editorToolbar"])]),Ka])]),e("div",$a,[e("button",tl,[el,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.activeTabUsers==="user2"?(c(),d("div",sl,[e("div",nl,[il,e("div",null,[e("h2",ol,l(n.translations.coming_soon),1)])])])):b("",!0)])):b("",!0),i.selectedTab===13?(c(),d("div",al,[e("h2",ll,l(n.translations.stripe_settings),1),e("form",{onSubmit:t[129]||(t[129]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",rl,[e("div",cl,[e("label",dl,l(n.translations.stripe_mode),1),p(e("select",{id:"stripe-mode","onUpdate:modelValue":t[124]||(t[124]=a=>i.form.stripe_mode=a),class:"ecwp-input input input-bordered",required:""},[e("option",ul,l(n.translations.test_mode),1),e("option",hl,l(n.translations.live_mode),1)],512),[[V,i.form.stripe_mode]])]),i.form.stripe_mode==="test"?(c(),d("div",pl,[e("div",ml,[e("label",fl,l(n.translations.stripe_public_key_test),1),p(e("input",{type:"text",id:"stripe-public-key-test","onUpdate:modelValue":t[125]||(t[125]=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",bl,[e("label",_l,l(n.translations.stripe_secret_key_test),1),p(e("input",{type:"text",id:"stripe-secret-key-test","onUpdate:modelValue":t[126]||(t[126]=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",gl,[e("div",vl,[e("label",yl,l(n.translations.stripe_public_key_live),1),p(e("input",{type:"text",id:"stripe-public-key-live","onUpdate:modelValue":t[127]||(t[127]=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",wl,[e("label",xl,l(n.translations.stripe_secret_key_live),1),p(e("input",{type:"text",id:"stripe-secret-key-live","onUpdate:modelValue":t[128]||(t[128]=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",kl,[e("button",Cl,[Tl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===14?(c(),d("div",Ml,[e("h2",Al,l(n.translations.stats_settings),1),e("form",{onSubmit:t[132]||(t[132]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",Sl,[e("div",Pl,[e("label",El,l(n.translations.limit_declaration),1),p(e("input",{type:"number",id:"limit-declaration","onUpdate:modelValue":t[130]||(t[130]=a=>i.form.limit_declaration=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_declaration]])]),e("div",jl,[e("label",Vl,l(n.translations.limit_tva),1),p(e("input",{type:"number",id:"limit-tva","onUpdate:modelValue":t[131]||(t[131]=a=>i.form.limit_tva=a),class:"ecwp-input input input-bordered",required:""},null,512),[[f,i.form.limit_tva]])])]),e("div",Il,[e("button",Fl,[Rl,g(" "+l(n.translations.save),1)])])],32)])):b("",!0),i.selectedTab===15?(c(),d("div",Ul,[e("h2",Dl,l(n.translations.validation_license),1),e("div",Hl,[e("div",Yl,[e("label",Nl,l(n.translations.license_key),1),p(e("input",{type:"text",id:"license-code","onUpdate:modelValue":t[133]||(t[133]=a=>i.license_key=a),class:"ecwp-input input input-bordered w-full",disabled:i.licenseData&&i.licenseData.valid,required:""},null,8,ql),[[f,i.license_key]]),e("button",{onClick:t[134]||(t[134]=(...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",Ol)):(c(),d("span",Wl,l(n.translations.validate),1))],8,Ll)])]),e("div",Xl,[i.errorMessage?(c(),d("div",Bl,l(i.errorMessage),1)):b("",!0),i.licenseData?(c(),d("div",zl,[e("table",Gl,[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[135]||(t[135]=a=>n.delete_item("licence","")),class:"btn btn-circle text-red-500 hover:text-red-700 mx-1"},Zl)])])])]),e("table",Ql,[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,Kl),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,$l)):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,tr))])]))),128))])])])):b("",!0)])])):b("",!0)])])]),_:1})])}var sr=$(ct,[["render",er]]);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 nr=/^\s+/,ir=/\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=or(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 cr(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:wr[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(pr,arguments)},brighten:function(){return this._applyModification(mr,arguments)},darken:function(){return this._applyModification(fr,arguments)},desaturate:function(){return this._applyModification(dr,arguments)},saturate:function(){return this._applyModification(ur,arguments)},greyscale:function(){return this._applyModification(hr,arguments)},spin:function(){return this._applyModification(br,arguments)},_applyCombination:function(t,o){return t.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination(vr,arguments)},complement:function(){return this._applyCombination(_r,arguments)},monochromatic:function(){return this._applyCombination(yr,arguments)},splitcomplement:function(){return this._applyCombination(gr,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 or(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=Tr(s)),R(s)=="object"&&(j(s.r)&&j(s.g)&&j(s.b)?(t=ar(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=rr(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=lr(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 ar(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 lr(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 rr(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 cr(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 dr(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 ur(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 hr(s){return h(s).desaturate(100)}function pr(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 mr(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 br(s,t){var o=h(s).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,h(o)}function _r(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 gr(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 vr(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=Mr(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"},wr=h.hexNames=xr(Y);function xr(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){kr(s)&&(s="100%");var o=Cr(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 kr(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function Cr(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 Tr(s){s=s.replace(nr,"").replace(ir,"").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 Mr(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 Ar={class:"slider-canvas",ref:"saturationCanvas"},Sr={class:"slider-container"},Pr={class:"slider-canvas",ref:"hueCanvas"},Er={class:"slider-active-area"},jr={class:"slider-container transparency-pattern"},Vr={class:"slider-active-area"},Ir={class:"text-inputs-wrapper"},Fr=["for"],Rr=["value","id","data-component"];function Ur(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",Ar,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",Sr,[e("canvas",Pr,null,512)]),e("div",Er,[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",jr,[e("div",{class:"slider-canvas",ref:"alphaCanvas",style:C(n.alphaCanvasStyles)},null,4)]),e("div",Vr,[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",Ir,[(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,Fr),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,Rr)]))),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 Dr=`.color-input .pointer-transparent, .color-input .pointer-color, .color-input .slider-canvas, .color-input .slider-container {
     1import{_ as tt,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 G,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 et,T as st,Z as nt,J as it,f as ot,h as at}from"./plugin-vue_export-helper.min.js";import{C as lt,R as rt}from"./RemoveAlert.min.js";import{v as ct}from"./vue3-editor.common.min.js";const dt={name:"Settings",components:{Card:lt,VueEditor:ct.exports.VueEditor,RemoveModal:rt},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()}},ut={class:"pt-2 pr-4"},ht={class:"flex justify-between items-center"},pt={class:"card-title"},mt=e("div",{class:"divider mt-2"},null,-1),ft={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4"},bt={class:"tabs tabs-vertical tabs-boxed col-span-1"},_t=e("i",{class:"fas fa-home mr-2"},null,-1),gt=e("i",{class:"fas fa-tools mr-2"},null,-1),vt=e("i",{class:"fas fa-newspaper mr-2"},null,-1),yt=e("i",{class:"fas fa-file-invoice-dollar mr-2"},null,-1),wt=e("i",{class:"fas fa-undo mr-2"},null,-1),xt=e("i",{class:"far fa-question-circle mr-2"},null,-1),kt=e("i",{class:"fas fa-dollar-sign mr-2"},null,-1),Ct=e("i",{class:"fas fa-money-check-alt mr-2"},null,-1),Tt=e("i",{class:"fas fa-shopping-basket mr-2"},null,-1),Mt=e("i",{class:"fas fa-calendar-alt mr-2"},null,-1),At=e("i",{class:"far fa-envelope mr-2"},null,-1),St=e("i",{class:"fas fa-user mr-2"},null,-1),Pt=e("i",{class:"far fa-credit-card mr-2"},null,-1),Et=e("i",{class:"far fa-chart-bar 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"},ve={class:"cursor-pointer"},ye={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"},vs={class:"ecwp-label label",for:"price_article"},ys={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"],vn={class:"label-text mr-2 font-bold"},yn=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"},vi={class:"ecwp-group form-control"},yi={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"},vo=["onClick"],yo=e("i",{class:"fas fa-edit"},null,-1),wo=[yo],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"},va={class:"cursor-pointer"},ya={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"},vl={class:"ecwp-label label",for:"stripe-mode"},yl={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-2 gap-4"},Gl={class:"ecwp-group form-group relative join"},Jl={class:"ecwp-label label",for:"license-code"},Zl=["disabled"],Ql=["disabled"],Kl={key:0,class:"loading loading-spinner loading-sm"},$l={key:1},tr={class:"grid grid-cols-1 gap-4"},er={key:0,class:"error-message"},sr={key:1,class:"overflow-x-auto my-4"},nr={class:"table table-xs table-pin-rows table-pin-cols"},ir=e("i",{class:"far fa-trash-alt"},null,-1),or=[ir],ar={class:"table table-xs table-pin-rows table-pin-cols mt-6"},lr=["onClick"],rr=["onClick"],cr=["onClick"];function dr(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",ut,[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:G(()=>[e("div",ht,[e("h2",pt,l(n.translations.settings),1)]),mt,e("div",ft,[e("div",bt,[e("a",{class:y([n.tabClass(1),"justify-start w-full"]),onClick:t[2]||(t[2]=a=>n.selectTab(1))},[_t,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))},[gt,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))},[vt,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))},[yt,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))},[wt,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))},[xt,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))},[kt,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))},[Ct,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))},[Tt,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))},[Mt,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))},[At,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))},[St,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))},[Pt,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))},[Et,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))},[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[29]||(t[29]=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[17]||(t[17]=a=>i.form.company_code=a),class:"ecwp-input input input-bordered",required:""},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[18]||(t[18]=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[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",Bt,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",zt,[e("label",Gt,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",Jt,[e("label",Zt,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",Qt,[e("label",Kt,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",$t,[e("label",te,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",ee,[e("label",se,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",ne,[e("label",ie,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",oe,[e("label",ae,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]])])]),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[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",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[40]||(t[40]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ge,[e("label",ve,[e("span",ye,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,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[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",Ce,[e("label",Te,l(n.translations.company_logo),1),e("div",Me,[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",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[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",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[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,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[36]||(t[36]=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[37]||(t[37]=(...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[38]||(t[38]=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[39]||(t[39]=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[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",hs,[e("label",ps,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",ms,[e("label",fs,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",bs,[e("label",_s,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",gs,[e("label",vs,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",ys,[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",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[48]||(t[48]=(...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:v=>n.editArticle(a.id)},Ps,8,As),e("button",{class:"p-2 text-error",onClick:v=>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:v=>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[64]||(t[64]=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[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",Bs,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]])])]),zs,e("div",Gs,[e("div",Js,[e("label",Zs,[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,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[53]||(t[53]=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[54]||(t[54]=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[55]||(t[55]=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[56]||(t[56]=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[57]||(t[57]=a=>n.updateFormField(a,"show_watermark_only_paid")),class:"wcpa-ui-toggle"},null,40,gn),e("span",vn,l(n.translations.show_watermark_only_paid),1)])])):b("",!0)]),yn,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[58]||(t[58]=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[59]||(t[59]=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[60]||(t[60]=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[61]||(t[61]=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[62]||(t[62]=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[63]||(t[63]=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[70]||(t[70]=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[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",Xn,[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",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[68]||(t[68]=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[69]||(t[69]=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[76]||(t[76]=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[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",oi,[e("label",ai,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",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[74]||(t[74]=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[75]||(t[75]=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[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",vi,[e("label",yi,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",wi,[e("label",xi,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",ki,[e("label",Ci,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",Ti,[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",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[83]||(t[83]=(...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:v=>n.editCurrency(a.id)},Ri,8,Ii),e("button",{class:"p-2 text-error",onClick:v=>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[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",qi,[e("label",Li,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",Oi,[e("label",Xi,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",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[89]||(t[89]=(...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:v=>n.editVAT(a.id)},to,8,Ki),e("button",{class:"p-2 text-error",onClick:v=>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[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",ro,[e("label",co,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",uo,[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",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[94]||(t[94]=(...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:v=>n.editPayment(a.id)},wo,8,vo),e("button",{class:"p-2 text-error",onClick:v=>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[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",Po,[e("label",Eo,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",jo,[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",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[99]||(t[99]=(...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:v=>n.editExpCat(a.id)},qo,8,Yo),e("button",{class:"p-2 text-error",onClick:v=>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[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",Jo,[e("label",Zo,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",Qo,[e("label",Ko,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",$o,[e("label",ta,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",ea,[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",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[108]||(t[108]=(...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:v=>n.editPlanningCat(a.id)},ha,8,da),e("button",{class:"p-2 text-error",onClick:v=>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[120]||(t[120]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",ga,[e("label",va,[e("span",ya,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,wa)])]),xa,e("div",ka,[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",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[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",Sa,[e("label",Pa,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"])]),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[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",Ra,[e("label",Ua,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"])]),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[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",La,[e("label",Oa,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"])]),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: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",el,[e("form",{onSubmit:t[125]||(t[125]=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[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",ol,[e("label",al,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"])]),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[131]||(t[131]=k((...a)=>n.handleSubmit&&n.handleSubmit(...a),["prevent"]))},[e("div",_l,[e("div",gl,[e("label",vl,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",yl,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[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",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[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",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[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",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[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",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[134]||(t[134]=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[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",Nl,[e("label",ql,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",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.validation_license),1),e("div",zl,[e("div",Gl,[e("label",Jl,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,Zl),[[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",Kl)):(c(),d("span",$l,l(n.translations.validate),1))],8,Ql)])]),e("div",tr,[i.errorMessage?(c(),d("div",er,l(i.errorMessage),1)):b("",!0),i.licenseData?(c(),d("div",sr,[e("table",nr,[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"},or)])])])]),e("table",ar,[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,lr),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,rr)):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,cr))])]))),128))])])])):b("",!0)])])):b("",!0)])])]),_:1})])}var ur=tt(dt,[["render",dr]]);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 hr=/^\s+/,pr=/\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=mr(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=J(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 gr(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:Er[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(xr,arguments)},brighten:function(){return this._applyModification(kr,arguments)},darken:function(){return this._applyModification(Cr,arguments)},desaturate:function(){return this._applyModification(vr,arguments)},saturate:function(){return this._applyModification(yr,arguments)},greyscale:function(){return this._applyModification(wr,arguments)},spin:function(){return this._applyModification(Tr,arguments)},_applyCombination:function(t,o){return t.apply(null,[this].concat([].slice.call(o)))},analogous:function(){return this._applyCombination(Sr,arguments)},complement:function(){return this._applyCombination(Mr,arguments)},monochromatic:function(){return this._applyCombination(Pr,arguments)},splitcomplement:function(){return this._applyCombination(Ar,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 mr(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=Fr(s)),R(s)=="object"&&(j(s.r)&&j(s.g)&&j(s.b)?(t=fr(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=_r(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=br(s.h,r,n),m=!0,u="hsl"),s.hasOwnProperty("a")&&(o=s.a)),o=J(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 fr(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 br(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 _r(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 gr(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(Z(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(Z(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 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,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 wr(s){return h(s).desaturate(100)}function xr(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 kr(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 Cr(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 Tr(s,t){var o=h(s).toHsl(),r=(o.h+t)%360;return o.h=r<0?360+r:r,h(o)}function Mr(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 Ar(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 Sr(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 Pr(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=Rr(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"},Er=h.hexNames=jr(Y);function jr(s){var t={};for(var o in s)s.hasOwnProperty(o)&&(t[s[o]]=o);return t}function J(s){return s=parseFloat(s),(isNaN(s)||s<0||s>1)&&(s=1),s}function w(s,t){Vr(s)&&(s="100%");var o=Ir(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 Vr(s){return typeof s=="string"&&s.indexOf(".")!=-1&&parseFloat(s)===1}function Ir(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 Z(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 Fr(s){s=s.replace(hr,"").replace(pr,"").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 Rr(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 Q={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 Ur={class:"slider-canvas",ref:"saturationCanvas"},Dr={class:"slider-container"},Hr={class:"slider-canvas",ref:"hueCanvas"},Yr={class:"slider-active-area"},Nr={class:"slider-container transparency-pattern"},qr={class:"slider-active-area"},Lr={class:"text-inputs-wrapper"},Or=["for"],Xr=["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",Ur,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",Dr,[e("canvas",Hr,null,512)]),e("div",Yr,[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",Nr,[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",Lr,[(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,Or),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]=it(_=>_.target.blur(),["enter"]))},null,40,Xr)]))),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 K(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 Br=`.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(Dr);Z.render=Ur;var Hr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iMCIgeD0iMCIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iNSIgeD0iNSIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+Cjwvc3ZnPg==";const Yr=(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&&Yr(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("+Hr+")"}},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 Nr={class:"inner transparent"};function qr(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",Nr,[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 Lr=`.color-input .box .color, .color-input .box .transparent {
     113}`;K(Br);Q.render=Wr;var zr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAiIGhlaWdodD0iMTAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iMCIgeD0iMCIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+CiAgPHJlY3QgaGVpZ2h0PSI1IiB3aWR0aD0iNSIgeT0iNSIgeD0iNSIgZmlsbD0iI2NjY2NjYyIgc2hhcGUtcmVuZGVyaW5nPSJjcmlzcEVkZ2VzIi8+Cjwvc3ZnPg==";const Gr=(s,t)=>{for(;!/^(body|html)$/i.test(s.tagName);){if(s===t)return!0;s=s.parentNode}return!1};var $=et({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:Q},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&&Gr(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("+zr+")"}},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 Jr={class:"inner transparent"};function Zr(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",Jr,[e("div",{class:"color",style:C(s.boxColorStyles)},null,4)])],2),x(st,{name:s.transition},{default:G(()=>[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"]),[[nt,s.active]])]),_:1},8,["name"])],4)}var Qr=`.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(Lr);K.render=qr;var Or=(()=>{const s=K;return s.install=t=>{t.component("ColorInput",s)},s})();const Wr=U;function U(s,t){const o=D();return U=function(r,i){return r=r-195,o[r]},U(s,t)}(function(s,t){const o=U,r=s();for(;[];)try{if(-parseInt(o(202))/1+-parseInt(o(198))/2+-parseInt(o(203))/3+-parseInt(o(200))/4+-parseInt(o(199))/5*(parseInt(o(195))/6)+-parseInt(o(196))/7+-parseInt(o(201))/8*(-parseInt(o(204))/9)===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(D,871905);const B=it({render:()=>ot(sr)});B.use(Or),B.mount(Wr(197));function D(){const s=["1501782QJKfbZ","47052108reJHsi","6STtvis","3280228JWWibW","#my-easy-compta-settings-app","258532CvdcQn","1382890jabPmq","6013528rDlEWd","8yzvTYt","1477683VawRyf"];return D=function(){return s},D()}
     170}`;K(Qr);$.render=Zr;var Kr=(()=>{const s=$;return s.install=t=>{t.component("ColorInput",s)},s})();function U(s,t){const o=D();return U=function(r,i){return r=r-244,o[r]},U(s,t)}const B=U;(function(s,t){const o=U,r=s();for(;[];)try{if(-parseInt(o(255))/1+-parseInt(o(247))/2+-parseInt(o(251))/3*(-parseInt(o(252))/4)+-parseInt(o(248))/5+parseInt(o(249))/6*(-parseInt(o(245))/7)+parseInt(o(250))/8*(parseInt(o(254))/9)+parseInt(o(253))/10===t)break;r.push(r.shift())}catch{r.push(r.shift())}})(D,767510);const z=ot({render:()=>at(ur)});z[B(246)](Kr),z.mount(B(244));function D(){const s=["2667710xApRMi","7595210KeMZqk","780594IMwRxP","48232hdzczO","1689USAJnQ","9004qIXvCd","40972110IIhaVY","171DRstUp","427579QUoqkQ","#my-easy-compta-settings-app","77nxoFAK","use"];return D=function(){return s},D()}
  • my-easy-compta/trunk/includes/Migrations/Seed.php

    r3148192 r3155882  
    130130            array('meta_key' => 'show_siren', 'meta_value' => '1'),
    131131            array('meta_key' => 'show_tax_number', 'meta_value' => '1'),
     132            array('meta_key' => 'show_watermark', 'meta_value' => '1'),
     133            array('meta_key' => 'show_watermark_only_paid', 'meta_value' => '1'),
    132134        );
    133135
  • my-easy-compta/trunk/includes/Migrations/migration_1_1_0.php

    r3148192 r3155882  
    3232        array('meta_key' => 'show_siren', 'meta_value' => '1'),
    3333        array('meta_key' => 'show_tax_number', 'meta_value' => '1'),
     34        array('meta_key' => 'show_watermark', 'meta_value' => '1'),
     35        array('meta_key' => 'show_watermark_only_paid', 'meta_value' => '1'),
    3436    );
    3537
  • my-easy-compta/trunk/includes/Modules/PDFGenerator.php

    r3148276 r3155882  
    2929    private $show_siren;
    3030    private $show_tax_number;
     31    private $show_watermark;
     32    private $show_watermark_only_paid;
    3133    private $payment_conditions;
    3234    private $payment_mode;
     
    8587        $this->show_siren = $this->settings_array['show_siren'] ?? '1';
    8688        $this->show_tax_number = $this->settings_array['show_tax_number'] ?? '1';
     89        $this->show_watermark = $this->settings_array['show_watermark'] ?? '1';
     90        $this->show_watermark_only_paid = $this->settings_array['show_watermark_only_paid'] ?? '1';
    8791        $this->payment_conditions = $this->settings_array['payment_conditions'] ?? '';
    8892        $this->payment_mode = $this->settings_array['payment_mode'] ?? '';
     
    207211        $mpdf->SetTitle(htmlspecialchars($invoice->invoice_number));
    208212        $mpdf->SetAuthor(htmlspecialchars($client->company_name));
    209         $mpdf->WriteHTML($html);
    210 
     213       
    211214        $encrypt = new \ECWP\Admin\Encrypt\ECWP_Encrypt();
    212215        $invoice_number = $encrypt->decrypt($invoice->invoice_number);
     216        $invoice_status = $encrypt->decrypt($invoice->status);
     217        if ($this->show_watermark == 1) {
     218            if ($this->show_watermark_only_paid == 1) {
     219                if($invoice_status == 'paid') {
     220                    $mpdf->SetWatermarkText(__('PAID', 'my-easy-compta'), 0.1);
     221                    $mpdf->showWatermarkText = true;
     222                    $mpdf->watermarkTextAlpha = 0.1;
     223                }
     224            } else {
     225                if ($invoice_status == 'draft') {
     226                    $invoice_status = __('DRAFT', 'my-easy-compta');
     227                } else if ($invoice_status == 'unpaid') {
     228                    $invoice_status = __('UNPAID', 'my-easy-compta');
     229                }
     230                $mpdf->SetWatermarkText($invoice_status, 0.1);
     231                $mpdf->showWatermarkText = true;
     232                $mpdf->watermarkTextAlpha = 0.1;
     233            }
     234        }
     235       
     236        $mpdf->WriteHTML($html);
     237
    213238
    214239        if ($type == 'email') {
     
    612637                }
    613638                $tva_totaux[$vat_rate] += $item_total_vat;
     639            } else {
     640                $discount_amount_with_vat = ($item_total * $discount_percentage) / 100;
     641                $total_after_discount_with_vat = $item_total - $discount_amount_with_vat;
    614642            }
    615643
     
    637665                    style="text-align: right;border: 0.2mm solid #ffffff; background-color: #F5F5F5; vertical-align: top;">
    638666                    ' . $this->positionCurrency($this->formatAmount($unit_price), $default_currency_symbol->symbol) . '
    639                 </td>
    640                 <td width="15%"
     667                </td>';
     668            if ($this->vat_active == 1) {   
     669                $items_html .= '<td width="15%"
    641670                    style="text-align: right;border: 0.2mm solid #ffffff; background-color: #F5F5F5; vertical-align: top;">
    642671                    ' . $this->positionCurrency($this->formatAmount($item_total_vat), $default_currency_symbol->symbol)
    643672                . '<br /><small>' . $vat_rate . '%</small></td>';
    644 
     673            }
    645674            if ($discount_exist) {
    646675                $items_html .= '<td width="15%"
     
    677706                <td width="15%"
    678707                    style="vertical-align: bottom; text-align: center; text-transform: uppercase; font-size: 7pt; font-weight: bold; background-color: #FFFFFF; color: #111111;border-bottom: 0.2mm solid ' . $global_color . '">
    679                     ' . __('Unit price', 'my-easy-compta') . '</td>
    680                 <td width="15%"
     708                    ' . __('Unit price', 'my-easy-compta') . '</td>';
     709
     710            if ($this->vat_active == 1) {
     711                $html .= '<td width="15%"
    681712                    style="vertical-align: bottom; text-align: center; text-transform: uppercase; font-size: 7pt; font-weight: bold; background-color: #FFFFFF; color: #111111;border-bottom: 0.2mm solid ' . $global_color . '">
    682713                    ' . __('Vat', 'my-easy-compta') . '</td>';
     714            }
    683715        if ($discount_exist) {
    684716            $html .= '<td width="15%"
     
    704736            $html .= '<tr>';
    705737
    706             if ($discount_exist) {
    707                 $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     738            if ($this->vat_active == 1) {
     739                if ($discount_exist) {
     740                    $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     741                } else {
     742                    $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     743                }
    708744            } else {
    709                 $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     745                if ($discount_exist) {
     746                    $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     747                } else {
     748                    $html .= '<td colspan="1" style="background-color:#ffffff;"></td>';
     749                } 
    710750            }
    711751            $html .= '<td colspan="2"
     
    719759        } else {
    720760            $html .= ' <tr>';
    721             if ($discount_exist) {
    722                 $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     761            if ($this->vat_active == 1) {
     762                if ($discount_exist) {
     763                    $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     764                } else {
     765                    $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     766                }
    723767            } else {
    724                 $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     768                if ($discount_exist) {
     769                    $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     770                } else {
     771                    $html .= '<td colspan="1" style="background-color:#ffffff;"></td>';
     772                } 
    725773            }
    726774            $html .= '<td colspan="2"
     
    755803        $html .= '<tr>';
    756804
    757         if ($discount_exist) {
    758             $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     805        if ($this->vat_active == 1) {
     806            if ($discount_exist) {
     807                $html .= '<td colspan="3" style="background-color:#ffffff;"></td>';
     808            } else {
     809                $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     810            }
    759811        } else {
    760             $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     812            if ($discount_exist) {
     813                $html .= '<td colspan="2" style="background-color:#ffffff;"></td>';
     814            } else {
     815                $html .= '<td colspan="1" style="background-color:#ffffff;"></td>';
     816            } 
    761817        }
    762818        $html .= '<td colspan="2"
     
    815871    </div>';
    816872        }
    817         /* if ($invoice_status == 'paid') {
    818         $html .= '<table>
    819         <tr>
    820         <td text-rotate="10"> <span style="
    821         font-size: 3rem;
    822         font-weight: 700;
    823         display: inline-block;
    824         text-transform: uppercase;
    825         mix-blend-mode: multiply; color: #0A9928;">
    826         Paid
    827         </span></td>
    828         </tr>
    829         </table>';
    830         } */
    831873        $html .= '
    832874</body>
  • my-easy-compta/trunk/languages/my-easy-compta-fr_FR.l10n.php

    r3148192 r3155882  
    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-09-08 13:42+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.9; wp-6.5.3','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','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é','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'=>'Modes 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 !','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','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 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-09-22 10:15+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 !','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.']];
  • my-easy-compta/trunk/languages/my-easy-compta-fr_FR.po

    r3148192 r3155882  
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2024-05-28 11:22+0000\n"
    6 "PO-Revision-Date: 2024-09-08 13:42+0000\n"
     6"PO-Revision-Date: 2024-09-22 10:15+0000\n"
    77"Last-Translator: \n"
    88"Language-Team: Français\n"
     
    1313"Plural-Forms: nplurals=2; plural=n > 1;\n"
    1414"X-Generator: Loco https://localise.biz/\n"
    15 "X-Loco-Version: 2.6.9; wp-6.5.3"
    16 
    17 #: languages/my-easy-compta-translations.php:262
     15"X-Loco-Version: 2.6.11; wp-6.6.1"
     16
     17#: languages/my-easy-compta-translations.php:264
    1818msgid "Account"
    1919msgstr "Mon compte"
    2020
    21 #: languages/my-easy-compta-translations.php:215
     21#: languages/my-easy-compta-translations.php:217
    2222msgid "Account settings"
    2323msgstr "Paramètres des utilisateurs"
     
    2727msgstr "Actions"
    2828
    29 #: languages/my-easy-compta-translations.php:223
     29#: languages/my-easy-compta-translations.php:225
    3030msgid "Activate email logs"
    3131msgstr "Activer les logs des emails"
     
    3939msgstr "Activer la TVA"
    4040
    41 #: languages/my-easy-compta-translations.php:257
     41#: languages/my-easy-compta-translations.php:259
    4242msgid "Activation date"
    4343msgstr "Date d'activation"
     
    4747msgstr "Ajouter"
    4848
    49 #: languages/my-easy-compta-translations.php:206
     49#: languages/my-easy-compta-translations.php:208
    5050msgid "Add category"
    5151msgstr "Ajouter une catégorie"
    5252
    53 #: languages/my-easy-compta-translations.php:197
     53#: languages/my-easy-compta-translations.php:199
    5454msgid "Add currency"
    5555msgstr "Ajouter une devise"
    5656
    57 #: languages/my-easy-compta-translations.php:203
     57#: languages/my-easy-compta-translations.php:205
    5858msgid "Add method"
    5959msgstr "Ajouter une méthode"
    6060
    61 #: languages/my-easy-compta-translations.php:201
     61#: languages/my-easy-compta-translations.php:203
    6262msgid "Add VAT"
    6363msgstr "Ajouter la TVA"
    6464
    65 #: languages/my-easy-compta-translations.php:254
     65#: languages/my-easy-compta-translations.php:256
    6666msgid "Addon name"
    6767msgstr "Nom de l'addon"
     
    7575msgstr "Adresse"
    7676
    77 #: languages/my-easy-compta-translations.php:287
     77#: languages/my-easy-compta-translations.php:289
    7878msgid "Advance"
    7979msgstr "Acompte"
    8080
    81 #: languages/my-easy-compta-translations.php:288
     81#: languages/my-easy-compta-translations.php:290
    8282msgid "Advance invoice"
    8383msgstr "Facture d'acompte"
     
    8888
    8989#: languages/my-easy-compta-translations.php:99
    90 #: includes/Modules/PDFGenerator.php:803
     90#: includes/Modules/PDFGenerator.php:866
    9191msgid "Agreement & signature"
    9292msgstr "Mention \"Bon pour accord\" et signature"
     
    117117msgstr "Avril"
    118118
    119 #: languages/my-easy-compta-translations.php:207
     119#: languages/my-easy-compta-translations.php:209
    120120msgid "Are you sure?"
    121121msgstr "Êtes-vous sûr ?"
     
    141141msgstr "Retour"
    142142
    143 #: languages/my-easy-compta-translations.php:194
     143#: languages/my-easy-compta-translations.php:196
    144144msgid "Background"
    145145msgstr "Arrière plan"
    146146
    147 #: languages/my-easy-compta-translations.php:236
     147#: languages/my-easy-compta-translations.php:238
    148148msgid "Backup"
    149149msgstr "Sauvegarder"
    150150
    151 #: languages/my-easy-compta-translations.php:240
     151#: languages/my-easy-compta-translations.php:242
    152152msgid "Backup date"
    153153msgstr "Date de sauvegarde"
    154154
    155 #: languages/my-easy-compta-translations.php:239
     155#: languages/my-easy-compta-translations.php:241
    156156msgid "Backup list"
    157157msgstr "Liste des sauvegardes"
     
    161161msgstr "Avant le montant"
    162162
    163 #: languages/my-easy-compta-translations.php:179
    164 #: includes/Modules/PDFGenerator.php:790
     163#: languages/my-easy-compta-translations.php:181
     164#: includes/Modules/PDFGenerator.php:853
    165165msgid "BIC"
    166166msgstr "BIC"
     
    180180msgstr "Annulé"
    181181
    182 #: languages/my-easy-compta-translations.php:282
     182#: languages/my-easy-compta-translations.php:284
    183183msgid "Card number"
    184184msgstr "Numéro de la carte"
     
    192192msgstr "Catégorie"
    193193
    194 #: languages/my-easy-compta-translations.php:253
     194#: languages/my-easy-compta-translations.php:255
    195195msgid "Check update"
    196196msgstr "Vérifier la mise à jour"
     
    237237msgstr "Clients"
    238238
    239 #: languages/my-easy-compta-translations.php:192
     239#: languages/my-easy-compta-translations.php:194
    240240msgid "Code"
    241241msgstr "Code"
    242242
    243 #: languages/my-easy-compta-translations.php:193
     243#: languages/my-easy-compta-translations.php:195
    244244msgid "Color"
    245245msgstr "Couleur"
    246246
    247 #: languages/my-easy-compta-translations.php:222
     247#: languages/my-easy-compta-translations.php:224
    248248msgid "Coming soon"
    249249msgstr "Bientôt disponible"
     
    261261msgstr "Nom de l'entreprise"
    262262
    263 #: includes/Modules/PDFGenerator.php:770
     263#: includes/Modules/PDFGenerator.php:833
    264264msgid "Conditions terms"
    265265msgstr "Conditions générales"
    266266
    267 #: languages/my-easy-compta-translations.php:214
     267#: languages/my-easy-compta-translations.php:216
    268268msgid "Confirm new password"
    269269msgstr "Confirmer le nouveau mot de passe"
     
    289289msgstr "Pays"
    290290
    291 #: languages/my-easy-compta-translations.php:237
     291#: languages/my-easy-compta-translations.php:239
    292292msgid "Create backup"
    293293msgstr "Créer une sauvegarde"
     
    303303"informations et mots de passe via un tableau de bord dédié."
    304304
    305 #: languages/my-easy-compta-translations.php:211
     305#: languages/my-easy-compta-translations.php:213
    306306msgid "Create user"
    307307msgstr "Créer un utilisateur"
    308308
    309309#: languages/my-easy-compta-translations.php:47
    310 #: includes/Modules/PDFGenerator.php:433 includes/Modules/PDFGenerator.php:447
     310#: includes/Modules/PDFGenerator.php:458 includes/Modules/PDFGenerator.php:472
    311311msgid "Created at"
    312312msgstr "Créé le"
    313313
    314314#: languages/my-easy-compta-translations.php:75
    315 #: includes/Modules/PDFGenerator.php:443
     315#: includes/Modules/PDFGenerator.php:468
    316316msgid "Credit"
    317317msgstr "Avoir"
    318318
    319 #: languages/my-easy-compta-translations.php:182
     319#: languages/my-easy-compta-translations.php:184
    320320msgid "Credit color"
    321321msgstr "Couleur de l'avoir"
    322322
    323 #: languages/my-easy-compta-translations.php:184
     323#: languages/my-easy-compta-translations.php:186
    324324msgid "Credit footer"
    325325msgstr "Pied de page de l'avoir"
     
    333333msgstr "Facture d'avoir supprimée avec succès"
    334334
    335 #: includes/Modules/PDFGenerator.php:245
     335#: includes/Modules/PDFGenerator.php:270
    336336msgid "Credit not found"
    337337msgstr "Avoir non trouvé"
     
    341341msgstr "Numéro de l'avoir"
    342342
    343 #: languages/my-easy-compta-translations.php:183
     343#: languages/my-easy-compta-translations.php:185
    344344msgid "Credit prefix"
    345345msgstr "Préfixe de l'avoir"
    346346
    347 #: languages/my-easy-compta-translations.php:185
     347#: languages/my-easy-compta-translations.php:187
    348348msgid "Credit terms"
    349349msgstr "Conditions de l'avoir"
     
    358358msgstr "Paramètres des avoirs"
    359359
    360 #: languages/my-easy-compta-translations.php:196
     360#: languages/my-easy-compta-translations.php:198
    361361msgid "Currencies"
    362362msgstr "Devises"
     
    382382msgstr "Mois en cours"
    383383
    384 #: languages/my-easy-compta-translations.php:261 includes/Modules/App.php:33
     384#: languages/my-easy-compta-translations.php:263 includes/Modules/App.php:33
    385385#: includes/Modules/App.php:34
    386386msgid "Dashboard"
     
    403403msgstr "La migration de la base de données a bien été effectuée."
    404404
    405 #: includes/Modules/PDFGenerator.php:419
     405#: includes/Modules/PDFGenerator.php:444
    406406msgid "Date planned"
    407407msgstr "Date prévue"
    408408
    409 #: languages/my-easy-compta-translations.php:226
     409#: languages/my-easy-compta-translations.php:228
    410410msgid "Date sent"
    411411msgstr "Date d'envoi"
     
    431431msgstr "Supprimer"
    432432
    433 #: languages/my-easy-compta-translations.php:245
     433#: languages/my-easy-compta-translations.php:247
    434434msgid "Deleted successfully"
    435435msgstr "Suppression réussie"
     
    440440
    441441#: languages/my-easy-compta-translations.php:144
    442 #: includes/Modules/PDFGenerator.php:679
     442#: includes/Modules/PDFGenerator.php:718
    443443msgid "Discount"
    444444msgstr "Réduction"
     
    448448msgstr "Affichage par page"
    449449
    450 #: languages/my-easy-compta-translations.php:258
     450#: languages/my-easy-compta-translations.php:260
    451451msgid "Domain"
    452452msgstr "Domaine"
    453453
    454 #: languages/my-easy-compta-translations.php:234
     454#: languages/my-easy-compta-translations.php:236
    455455msgid "Done"
    456456msgstr "Terminé"
    457457
    458 #: languages/my-easy-compta-translations.php:241
     458#: languages/my-easy-compta-translations.php:243
    459459msgid "Download"
    460460msgstr "Télécharger"
     461
     462#: includes/Modules/PDFGenerator.php:226
     463msgid "DRAFT"
     464msgstr "BROUILLON"
    461465
    462466#: languages/my-easy-compta-translations.php:52
     
    465469
    466470#: languages/my-easy-compta-translations.php:50
    467 #: includes/Modules/PDFGenerator.php:418
     471#: includes/Modules/PDFGenerator.php:443
    468472msgid "Due date"
    469473msgstr "Date de validité"
     
    506510
    507511#: languages/my-easy-compta-translations.php:32
    508 #: includes/Modules/PDFGenerator.php:558 includes/Modules/Setup.php:185
     512#: includes/Modules/PDFGenerator.php:583 includes/Modules/Setup.php:185
    509513msgid "Email"
    510514msgstr "E-mail"
    511515
    512 #: languages/my-easy-compta-translations.php:218
     516#: languages/my-easy-compta-translations.php:220
    513517msgid "Emails Invoices"
    514518msgstr "E-mails des factures"
    515519
    516 #: languages/my-easy-compta-translations.php:224
     520#: languages/my-easy-compta-translations.php:226
    517521msgid "Emails logs"
    518522msgstr "E-mails des logs"
    519523
    520 #: languages/my-easy-compta-translations.php:219
     524#: languages/my-easy-compta-translations.php:221
    521525msgid "Emails Quotes"
    522526msgstr "E-mails des devis"
    523527
    524 #: languages/my-easy-compta-translations.php:217
     528#: languages/my-easy-compta-translations.php:219
    525529msgid "Emails settings"
    526530msgstr "Paramètres des e-mails"
     
    537541"communication fluide avec les clients."
    538542
    539 #: languages/my-easy-compta-translations.php:235
     543#: languages/my-easy-compta-translations.php:237
    540544msgid "Error"
    541545msgstr "Erreur"
     
    546550msgstr "Erreur d'accès à l'API"
    547551
    548 #: languages/my-easy-compta-translations.php:228
     552#: languages/my-easy-compta-translations.php:230
    549553msgid "Event category"
    550554msgstr "Catégorie d'événement"
    551555
     556#: languages/my-easy-compta-translations.php:233
     557#: languages/my-easy-compta-translations.php:234
     558msgid "Event end time"
     559msgstr "Heure de fin de l'événement"
     560
    552561#: languages/my-easy-compta-translations.php:231
    553562#: languages/my-easy-compta-translations.php:232
    554 msgid "Event end time"
    555 msgstr "Heure de fin de l'événement"
    556 
    557 #: languages/my-easy-compta-translations.php:229
    558 #: languages/my-easy-compta-translations.php:230
    559563msgid "Event start date"
    560564msgstr "Date de début de l'événement"
    561565
    562 #: languages/my-easy-compta-translations.php:227
     566#: languages/my-easy-compta-translations.php:229
    563567msgid "Event title"
    564568msgstr "Titre de l'événement"
     
    589593msgstr "Dépenses"
    590594
    591 #: languages/my-easy-compta-translations.php:205
     595#: languages/my-easy-compta-translations.php:207
    592596msgid "Expenses categories"
    593597msgstr "Catégories de dépenses"
     
    597601msgstr "Paramètres des dépenses"
    598602
    599 #: languages/my-easy-compta-translations.php:283
     603#: languages/my-easy-compta-translations.php:285
    600604msgid "Expiration date"
    601605msgstr "Date d'expiration"
    602606
    603 #: languages/my-easy-compta-translations.php:256
     607#: languages/my-easy-compta-translations.php:258
    604608msgid "Expiry date"
    605609msgstr "Date d'expiration"
     
    639643msgstr "Échec de l'ajout d'un élément de devis"
    640644
    641 #: languages/my-easy-compta-translations.php:252
     645#: languages/my-easy-compta-translations.php:254
    642646msgid "Failed to check for updates."
    643647msgstr "Échec de la vérification des mises à jour."
     
    716720msgstr "Février"
    717721
    718 #: languages/my-easy-compta-translations.php:238
     722#: languages/my-easy-compta-translations.php:240
    719723msgid "File name"
    720724msgstr "Nom du fichier"
     
    754758msgstr "https://myeasycompta.com"
    755759
    756 #: languages/my-easy-compta-translations.php:178
    757 #: includes/Modules/PDFGenerator.php:787
     760#: languages/my-easy-compta-translations.php:180
     761#: includes/Modules/PDFGenerator.php:850
    758762msgid "IBAN"
    759763msgstr "IBAN"
    760764
    761 #: languages/my-easy-compta-translations.php:204
     765#: languages/my-easy-compta-translations.php:206
    762766msgid "ID"
    763767msgstr "ID"
     
    783787msgstr "Installer les données de configuration"
    784788
    785 #: languages/my-easy-compta-translations.php:249
     789#: languages/my-easy-compta-translations.php:251
    786790msgid "Installed"
    787791msgstr "Installé"
     
    850854msgstr "ID de devis non valide."
    851855
    852 #: includes/Modules/PDFGenerator.php:431
     856#: includes/Modules/PDFGenerator.php:456
    853857msgid "Invoice"
    854858msgstr "Facture"
     
    866870msgstr "Couleur de la facture"
    867871
    868 #: languages/my-easy-compta-translations.php:180
     872#: languages/my-easy-compta-translations.php:182
    869873msgid "Invoice footer"
    870874msgstr "Pied de page de la facture"
     
    899903msgstr "Numéro de facture"
    900904
    901 #: languages/my-easy-compta-translations.php:269
     905#: languages/my-easy-compta-translations.php:271
    902906msgid "Invoice Overdue"
    903907msgstr "Facture en retard"
     
    907911msgstr "Préfixe de la facture"
    908912
    909 #: languages/my-easy-compta-translations.php:220
     913#: languages/my-easy-compta-translations.php:222
    910914msgid "Invoice reminder"
    911915msgstr "Rappel de facture"
     
    915919msgstr "Le statut de la facture a été mis à jour avec succès"
    916920
    917 #: languages/my-easy-compta-translations.php:181
     921#: languages/my-easy-compta-translations.php:183
    918922msgid "Invoice terms"
    919923msgstr "Conditions de facture"
     
    930934msgstr "Factures"
    931935
    932 #: languages/my-easy-compta-translations.php:272
     936#: languages/my-easy-compta-translations.php:274
    933937msgid "Invoices in draft status cannot be sent."
    934938msgstr "Les factures en brouillon ne peuvent pas être envoyées."
     
    943947
    944948#: languages/my-easy-compta-translations.php:138
    945 #: includes/Modules/PDFGenerator.php:666
     949#: includes/Modules/PDFGenerator.php:702
    946950msgid "Item name"
    947951msgstr "Nom de l'article"
     
    959963msgstr "Juin"
    960964
    961 #: languages/my-easy-compta-translations.php:212
     965#: languages/my-easy-compta-translations.php:214
    962966msgid "Last invoices"
    963967msgstr "Dernières factures"
     
    975979msgstr "Les données de licence ont été supprimées avec succès."
    976980
    977 #: languages/my-easy-compta-translations.php:246
     981#: languages/my-easy-compta-translations.php:248
    978982msgid "License key"
    979983msgstr "Clé de licence"
    980984
    981 #: languages/my-easy-compta-translations.php:277
     985#: languages/my-easy-compta-translations.php:279
    982986msgid "Live mode"
    983987msgstr "Mode Live"
     
    987991msgstr "Mentions du logo"
    988992
    989 #: languages/my-easy-compta-translations.php:263
     993#: languages/my-easy-compta-translations.php:265
    990994msgid "Logout"
    991995msgstr "Déconnexion"
     
    10271031msgstr "Mobile"
    10281032
    1029 #: languages/my-easy-compta-translations.php:275
     1033#: languages/my-easy-compta-translations.php:277
    10301034msgid "Mode"
    10311035msgstr "Mode"
     
    11451149msgstr "myEasyCompta Woo"
    11461150
    1147 #: languages/my-easy-compta-translations.php:190
     1151#: languages/my-easy-compta-translations.php:192
    11481152msgid "Name"
    11491153msgstr "Nom"
     
    11571161msgstr "Nouvelle facture"
    11581162
    1159 #: languages/my-easy-compta-translations.php:213
     1163#: languages/my-easy-compta-translations.php:215
    11601164msgid "New password"
    11611165msgstr "Nouveau mot de passe"
     
    11891193msgstr "Aucun devis n'a été trouvé pour l'élément donné."
    11901194
    1191 #: languages/my-easy-compta-translations.php:250
     1195#: languages/my-easy-compta-translations.php:252
    11921196msgid "No update available."
    11931197msgstr "Aucune mise à jour n'est disponible."
     
    12021206msgstr "La vérification du nonce a échoué."
    12031207
    1204 #: languages/my-easy-compta-translations.php:248
     1208#: languages/my-easy-compta-translations.php:250
    12051209msgid "Not installed"
    12061210msgstr "Non installé"
     
    12181222msgstr "Octobre"
    12191223
     1224#: includes/Modules/PDFGenerator.php:220
     1225msgid "PAID"
     1226msgstr "PAYÉ"
     1227
    12201228#: languages/my-easy-compta-translations.php:74
    12211229msgid "Paid"
     
    12341242msgstr "Payé"
    12351243
    1236 #: languages/my-easy-compta-translations.php:176
    1237 #: includes/Modules/PDFGenerator.php:773
     1244#: languages/my-easy-compta-translations.php:178
     1245#: includes/Modules/PDFGenerator.php:836
    12381246msgid "Payment conditions"
    12391247msgstr "Conditions de règlement"
    12401248
    12411249#: languages/my-easy-compta-translations.php:112
    1242 #: includes/Modules/PDFGenerator.php:432 includes/Modules/PDFGenerator.php:446
     1250#: includes/Modules/PDFGenerator.php:457 includes/Modules/PDFGenerator.php:471
    12431251msgid "Payment date"
    12441252msgstr "Date de paiement"
     
    12561264msgstr "Méthode de paiement"
    12571265
    1258 #: languages/my-easy-compta-translations.php:177
    1259 #: includes/Modules/PDFGenerator.php:776
     1266#: languages/my-easy-compta-translations.php:179
     1267#: includes/Modules/PDFGenerator.php:839
    12601268msgid "Payment mode"
    1261 msgstr "Modes de règlement"
     1269msgstr "Mode de règlement"
    12621270
    12631271#: includes/Modules/Payments.php:135
     
    12651273msgstr "Paiement introuvable."
    12661274
    1267 #: languages/my-easy-compta-translations.php:221
     1275#: languages/my-easy-compta-translations.php:223
    12681276msgid "Payment received"
    12691277msgstr "Paiement reçu"
    12701278
    1271 #: languages/my-easy-compta-translations.php:285
     1279#: languages/my-easy-compta-translations.php:287
    12721280msgid "Payment successful"
    12731281msgstr "Paiement réussi"
     
    12781286msgstr "Paiements"
    12791287
    1280 #: languages/my-easy-compta-translations.php:202
     1288#: languages/my-easy-compta-translations.php:204
    12811289msgid "Payments methods"
    12821290msgstr "Méthodes de paiement"
     
    12911299
    12921300#: languages/my-easy-compta-translations.php:33
    1293 #: includes/Modules/PDFGenerator.php:533 includes/Modules/PDFGenerator.php:555
     1301#: includes/Modules/PDFGenerator.php:558 includes/Modules/PDFGenerator.php:580
    12941302#: includes/Modules/Setup.php:191
    12951303msgid "Phone"
    12961304msgstr "Téléphone"
    12971305
    1298 #: languages/my-easy-compta-translations.php:216
     1306#: languages/my-easy-compta-translations.php:218
    12991307msgid "Planning settings"
    13001308msgstr "Paramètres du planning"
     
    13201328msgstr "Date de début provisoire"
    13211329
    1322 #: languages/my-easy-compta-translations.php:279
     1330#: languages/my-easy-compta-translations.php:281
    13231331msgid "Public key (Live mode)"
    13241332msgstr "Public key (Live mode)"
    13251333
    1326 #: languages/my-easy-compta-translations.php:281
     1334#: languages/my-easy-compta-translations.php:283
    13271335msgid "Public key (Test mode)"
    13281336msgstr "Public key (Test mode)"
    13291337
    13301338#: languages/my-easy-compta-translations.php:142
    1331 #: includes/Modules/PDFGenerator.php:669
     1339#: includes/Modules/PDFGenerator.php:705
    13321340msgid "Qty"
    13331341msgstr "Qté"
     
    13371345msgstr "Quantité"
    13381346
    1339 #: includes/Modules/PDFGenerator.php:417
     1347#: includes/Modules/PDFGenerator.php:442
    13401348msgid "Quote"
    13411349msgstr "Devis"
     
    13491357msgstr "Suppression réussie de devis et ces éléments"
    13501358
    1351 #: languages/my-easy-compta-translations.php:186
     1359#: languages/my-easy-compta-translations.php:188
    13521360msgid "Quote color"
    13531361msgstr "Couleur de devis"
     
    13571365msgstr "Devis converti en facture avec succès"
    13581366
    1359 #: languages/my-easy-compta-translations.php:268
     1367#: languages/my-easy-compta-translations.php:270
    13601368msgid "Quote expired"
    13611369msgstr "Devis expiré"
    13621370
    1363 #: languages/my-easy-compta-translations.php:188
     1371#: languages/my-easy-compta-translations.php:190
    13641372msgid "Quote footer"
    13651373msgstr "Pied de page de devis"
     
    13891397msgstr "Numéro de devis"
    13901398
    1391 #: languages/my-easy-compta-translations.php:187 includes/Modules/Setup.php:248
     1399#: languages/my-easy-compta-translations.php:189 includes/Modules/Setup.php:248
    13921400msgid "Quote prefix"
    13931401msgstr "Préfixe de devis"
     
    13971405msgstr "Le statut du devis a été mis à jour avec succès"
    13981406
    1399 #: languages/my-easy-compta-translations.php:189
     1407#: languages/my-easy-compta-translations.php:191
    14001408msgid "Quote terms"
    14011409msgstr "Conditions du devis"
     
    14101418msgstr "Paramètres de devis"
    14111419
    1412 #: languages/my-easy-compta-translations.php:198
     1420#: languages/my-easy-compta-translations.php:200
    14131421msgid "Rate"
    14141422msgstr "Taux"
     
    14231431msgstr "Lire la suite"
    14241432
    1425 #: includes/Modules/PDFGenerator.php:518
     1433#: includes/Modules/PDFGenerator.php:543
    14261434msgid "Received From"
    14271435msgstr "Reçu de"
     
    14351443msgstr "Factures récemment payées"
    14361444
    1437 #: includes/Modules/PDFGenerator.php:522
     1445#: includes/Modules/PDFGenerator.php:547
    14381446msgid "Recipient"
    14391447msgstr "Destinataire"
    14401448
    1441 #: languages/my-easy-compta-translations.php:225
     1449#: languages/my-easy-compta-translations.php:227
    14421450msgid "Recipient email"
    14431451msgstr "E-mail du destinataire"
    14441452
    14451453#: languages/my-easy-compta-translations.php:137
    1446 #: includes/Modules/PDFGenerator.php:663
     1454#: includes/Modules/PDFGenerator.php:699
    14471455msgid "Ref"
    14481456msgstr "Réf"
    14491457
    1450 #: includes/Modules/PDFGenerator.php:488
     1458#: includes/Modules/PDFGenerator.php:513
    14511459msgid "Reference No"
    14521460msgstr "Réf. n°"
     
    14641472msgstr "Re-envoyer la facture"
    14651473
    1466 #: languages/my-easy-compta-translations.php:242
     1474#: languages/my-easy-compta-translations.php:244
    14671475msgid "Restore"
    14681476msgstr "Restaurer"
    14691477
    1470 #: includes/Modules/PDFGenerator.php:784
     1478#: includes/Modules/PDFGenerator.php:847
    14711479msgid "RIB"
    14721480msgstr "RIB"
     
    14801488msgstr "Recherche"
    14811489
    1482 #: languages/my-easy-compta-translations.php:278
     1490#: languages/my-easy-compta-translations.php:280
    14831491msgid "Secret key (Live mode)"
    14841492msgstr "Secret key (Live mode)"
    14851493
    1486 #: languages/my-easy-compta-translations.php:280
     1494#: languages/my-easy-compta-translations.php:282
    14871495msgid "Secret key (Test mode)"
    14881496msgstr "Secret key (Test mode)"
    14891497
    1490 #: languages/my-easy-compta-translations.php:284
     1498#: languages/my-easy-compta-translations.php:286
    14911499msgid "Security code"
    14921500msgstr "Code de sécurité"
     
    14961504msgstr "Sélectionner"
    14971505
    1498 #: languages/my-easy-compta-translations.php:233
     1506#: languages/my-easy-compta-translations.php:235
    14991507msgid "Select / Unselect All"
    15001508msgstr "Sélectionner / désélectionner tout"
     
    15531561msgstr "Afficher le n° de TVA"
    15541562
     1563#: languages/my-easy-compta-translations.php:176
     1564msgid "Show Watermark"
     1565msgstr "Afficher le filigrane"
     1566
     1567#: languages/my-easy-compta-translations.php:177
     1568msgid "Show Watermark only for Paid status"
     1569msgstr "Afficher le filigrane uniquement pour le statut Payé"
     1570
    15551571#: languages/my-easy-compta-translations.php:94
    15561572msgid "Sign"
     
    15661582
    15671583#: languages/my-easy-compta-translations.php:24
     1584#: includes/Modules/PDFGenerator.php:586
    15681585msgid "SIREN n°"
    15691586msgstr "N° de SIREN"
    15701587
    1571 #: languages/my-easy-compta-translations.php:23 includes/Modules/Setup.php:145
     1588#: languages/my-easy-compta-translations.php:23
     1589#: includes/Modules/PDFGenerator.php:564 includes/Modules/Setup.php:145
    15721590msgid "SIRET n°"
    15731591msgstr "N° de SIRET"
     
    15771595msgstr "Pas de besoin"
    15781596
    1579 #: languages/my-easy-compta-translations.php:255
     1597#: languages/my-easy-compta-translations.php:257
    15801598msgid "Slug"
    15811599msgstr "Slug"
     
    15851603msgstr "Statistiques"
    15861604
    1587 #: languages/my-easy-compta-translations.php:274
     1605#: languages/my-easy-compta-translations.php:276
    15881606msgid "Stats settings"
    15891607msgstr "Paramètres des statistiques"
     
    16121630
    16131631#: languages/my-easy-compta-translations.php:150
    1614 #: languages/my-easy-compta-translations.php:273
     1632#: languages/my-easy-compta-translations.php:275
    16151633msgid "Stripe settings"
    16161634msgstr "Paramètres de Stripe"
     
    16281646msgstr "Soumettre"
    16291647
    1630 #: includes/Modules/PDFGenerator.php:706 includes/Modules/PDFGenerator.php:721
     1648#: includes/Modules/PDFGenerator.php:753 includes/Modules/PDFGenerator.php:776
    16311649msgid "Subtotal"
    16321650msgstr "Sous-total"
    16331651
    1634 #: languages/my-easy-compta-translations.php:260
     1652#: languages/my-easy-compta-translations.php:262
    16351653msgid "Success"
    16361654msgstr "Succès"
    16371655
    1638 #: languages/my-easy-compta-translations.php:191
     1656#: languages/my-easy-compta-translations.php:193
    16391657msgid "Symbol"
    16401658msgstr "Symbole"
     
    16531671
    16541672#: languages/my-easy-compta-translations.php:45
    1655 #: includes/Modules/PDFGenerator.php:741
     1673#: includes/Modules/PDFGenerator.php:796
    16561674msgid "Tax"
    16571675msgstr "TVA"
    16581676
    16591677#: languages/my-easy-compta-translations.php:22
    1660 #: includes/Modules/PDFGenerator.php:542 includes/Modules/PDFGenerator.php:564
     1678#: includes/Modules/PDFGenerator.php:567 includes/Modules/PDFGenerator.php:589
    16611679#: includes/Modules/Setup.php:151
    16621680msgid "Tax number"
    16631681msgstr "Numéro de TVA"
    16641682
    1665 #: languages/my-easy-compta-translations.php:276
     1683#: languages/my-easy-compta-translations.php:278
    16661684msgid "Test mode"
    16671685msgstr "Mode Test"
    16681686
    1669 #: languages/my-easy-compta-translations.php:195
     1687#: languages/my-easy-compta-translations.php:197
    16701688msgid "Text Color"
    16711689msgstr "Couleur du texte"
     
    17101728msgstr "Le champ %s est obligatoire"
    17111729
    1712 #: languages/my-easy-compta-translations.php:210
     1730#: languages/my-easy-compta-translations.php:212
    17131731msgid "There's no turning back!"
    17141732msgstr "Vous ne pourrez pas revenir en arrière!"
    17151733
    1716 #: languages/my-easy-compta-translations.php:243
     1734#: languages/my-easy-compta-translations.php:245
    17171735msgid ""
    17181736"This will automatically create a backup and delete all data to restore the "
     
    17221740"pour restaurer la sauvegarde."
    17231741
    1724 #: languages/my-easy-compta-translations.php:244
     1742#: languages/my-easy-compta-translations.php:246
    17251743msgid "Token api SIREN v 3.11"
    17261744msgstr "Token api SIREN v 3.11"
    17271745
    17281746#: languages/my-easy-compta-translations.php:43
    1729 #: includes/Modules/PDFGenerator.php:683 includes/Modules/PDFGenerator.php:757
     1747#: includes/Modules/PDFGenerator.php:722 includes/Modules/PDFGenerator.php:820
    17301748msgid "Total"
    17311749msgstr "Total"
     
    17351753msgstr "Montant total"
    17361754
    1737 #: languages/my-easy-compta-translations.php:265
     1755#: languages/my-easy-compta-translations.php:267
    17381756msgid "Total invoices"
    17391757msgstr "Total des factures"
    17401758
    1741 #: languages/my-easy-compta-translations.php:266
     1759#: languages/my-easy-compta-translations.php:268
    17421760msgid "Total paid invoices"
    17431761msgstr "Total des factures payées"
    17441762
    1745 #: languages/my-easy-compta-translations.php:264
     1763#: languages/my-easy-compta-translations.php:266
    17461764msgid "Total quotes"
    17471765msgstr "Total des devis"
     
    17601778
    17611779#: languages/my-easy-compta-translations.php:143
    1762 #: includes/Modules/PDFGenerator.php:672
     1780#: includes/Modules/PDFGenerator.php:708
    17631781msgid "Unit price"
    17641782msgstr "Prix unitaire"
     1783
     1784#: includes/Modules/PDFGenerator.php:228
     1785msgid "UNPAID"
     1786msgstr "NON PAYÉ"
    17651787
    17661788#: languages/my-easy-compta-translations.php:73
     
    17681790msgstr "Non payé"
    17691791
    1770 #: languages/my-easy-compta-translations.php:267
     1792#: languages/my-easy-compta-translations.php:269
    17711793msgid "Unpaid invoices"
    17721794msgstr "Factures impayées"
     
    17761798msgstr "Mise à jour"
    17771799
    1778 #: languages/my-easy-compta-translations.php:251
     1800#: languages/my-easy-compta-translations.php:253
    17791801msgid "Update available! New version"
    17801802msgstr "Mise à jour disponible ! Nouvelle version"
     
    17881810msgstr "Paramètres utilisateurs"
    17891811
    1790 #: languages/my-easy-compta-translations.php:247
     1812#: languages/my-easy-compta-translations.php:249
    17911813msgid "Validate"
    17921814msgstr "Valider"
     
    18001822msgstr "Valider le devis"
    18011823
    1802 #: languages/my-easy-compta-translations.php:199
     1824#: languages/my-easy-compta-translations.php:201
    18031825msgid "VAT"
    18041826msgstr "TVA"
    18051827
    1806 #: includes/Modules/PDFGenerator.php:675
     1828#: includes/Modules/PDFGenerator.php:713
    18071829msgid "Vat"
    18081830msgstr "Tva"
    18091831
    1810 #: languages/my-easy-compta-translations.php:200
     1832#: languages/my-easy-compta-translations.php:202
    18111833msgid "VAT Rates"
    18121834msgstr "Taux de TVA"
    18131835
    1814 #: languages/my-easy-compta-translations.php:259
     1836#: languages/my-easy-compta-translations.php:261
    18151837msgid "Version"
    18161838msgstr "Version"
     
    18241846msgstr "Site web"
    18251847
    1826 #: languages/my-easy-compta-translations.php:209
     1848#: languages/my-easy-compta-translations.php:211
    18271849msgid "Yes, confirm it!"
    18281850msgstr "Oui, confirmez !"
    18291851
    1830 #: languages/my-easy-compta-translations.php:208
     1852#: languages/my-easy-compta-translations.php:210
    18311853msgid "Yes, delete it!"
    18321854msgstr "Oui, supprimez !"
     
    18391861"activés."
    18401862
    1841 #: languages/my-easy-compta-translations.php:289
     1863#: languages/my-easy-compta-translations.php:291
    18421864msgid "You must have at least one article"
    18431865msgstr "Vous devez avoir au moins un article"
    18441866
    1845 #: languages/my-easy-compta-translations.php:270
     1867#: languages/my-easy-compta-translations.php:272
    18461868msgid "You need to activate the Email addon to benefit from this feature."
    18471869msgstr ""
    18481870"Vous devez activer l'addon Email pour bénéficier de cette fonctionnalité."
    18491871
    1850 #: languages/my-easy-compta-translations.php:271
     1872#: languages/my-easy-compta-translations.php:273
    18511873msgid "You need to activate the Export addon to benefit from this feature."
    18521874msgstr ""
    18531875"Vous devez activer l'addon Export pour bénéficier de cette fonctionnalité."
    18541876
    1855 #: languages/my-easy-compta-translations.php:286
     1877#: languages/my-easy-compta-translations.php:288
    18561878msgid ""
    18571879"Your payment is secure, and no card details are stored by our platform. The "
  • my-easy-compta/trunk/languages/my-easy-compta-translations.php

    r3148192 r3155882  
    174174    'show_siren' => __('Show SIREN n°', 'my-easy-compta'),
    175175    'show_tax_number' => __('Show TAX n°', 'my-easy-compta'),
     176    'show_watermark' => __('Show Watermark', 'my-easy-compta'),
     177    'show_watermark_only_paid' => __('Show Watermark only for Paid status', 'my-easy-compta'),
    176178    'payment_conditions' => __('Payment conditions', 'my-easy-compta'),
    177179    'payment_mode' => __('Payment mode', 'my-easy-compta'),
  • my-easy-compta/trunk/languages/my-easy-compta.pot

    r3148192 r3155882  
    44"Project-Id-Version: myEasyCompta\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2024-09-08 13:21+0000\n"
     6"POT-Creation-Date: 2024-09-22 10:14+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1515"X-Generator: Loco https://localise.biz/"
    1616
    17 #: languages/my-easy-compta-translations.php:262
     17#: languages/my-easy-compta-translations.php:264
    1818msgid "Account"
    1919msgstr ""
    2020
    21 #: languages/my-easy-compta-translations.php:215
     21#: languages/my-easy-compta-translations.php:217
    2222msgid "Account settings"
    2323msgstr ""
     
    2727msgstr ""
    2828
    29 #: languages/my-easy-compta-translations.php:223
     29#: languages/my-easy-compta-translations.php:225
    3030msgid "Activate email logs"
    3131msgstr ""
     
    3939msgstr ""
    4040
    41 #: languages/my-easy-compta-translations.php:257
     41#: languages/my-easy-compta-translations.php:259
    4242msgid "Activation date"
    4343msgstr ""
     
    4747msgstr ""
    4848
    49 #: languages/my-easy-compta-translations.php:206
     49#: languages/my-easy-compta-translations.php:208
    5050msgid "Add category"
    5151msgstr ""
    5252
    53 #: languages/my-easy-compta-translations.php:197
     53#: languages/my-easy-compta-translations.php:199
    5454msgid "Add currency"
    5555msgstr ""
    5656
     57#: languages/my-easy-compta-translations.php:205
     58msgid "Add method"
     59msgstr ""
     60
    5761#: languages/my-easy-compta-translations.php:203
    58 msgid "Add method"
    59 msgstr ""
    60 
    61 #: languages/my-easy-compta-translations.php:201
    6262msgid "Add VAT"
    6363msgstr ""
    6464
    65 #: languages/my-easy-compta-translations.php:254
     65#: languages/my-easy-compta-translations.php:256
    6666msgid "Addon name"
    6767msgstr ""
     
    7575msgstr ""
    7676
    77 #: languages/my-easy-compta-translations.php:287
     77#: languages/my-easy-compta-translations.php:289
    7878msgid "Advance"
    7979msgstr ""
    8080
    81 #: languages/my-easy-compta-translations.php:288
     81#: languages/my-easy-compta-translations.php:290
    8282msgid "Advance invoice"
    8383msgstr ""
     
    8888
    8989#: languages/my-easy-compta-translations.php:99
    90 #: includes/Modules/PDFGenerator.php:803
     90#: includes/Modules/PDFGenerator.php:866
    9191msgid "Agreement & signature"
    9292msgstr ""
     
    117117msgstr ""
    118118
    119 #: languages/my-easy-compta-translations.php:207
     119#: languages/my-easy-compta-translations.php:209
    120120msgid "Are you sure?"
    121121msgstr ""
     
    141141msgstr ""
    142142
    143 #: languages/my-easy-compta-translations.php:194
     143#: languages/my-easy-compta-translations.php:196
    144144msgid "Background"
    145145msgstr ""
    146146
    147 #: languages/my-easy-compta-translations.php:236
     147#: languages/my-easy-compta-translations.php:238
    148148msgid "Backup"
    149149msgstr ""
    150150
    151 #: languages/my-easy-compta-translations.php:240
     151#: languages/my-easy-compta-translations.php:242
    152152msgid "Backup date"
    153153msgstr ""
    154154
    155 #: languages/my-easy-compta-translations.php:239
     155#: languages/my-easy-compta-translations.php:241
    156156msgid "Backup list"
    157157msgstr ""
     
    161161msgstr ""
    162162
    163 #: languages/my-easy-compta-translations.php:179
    164 #: includes/Modules/PDFGenerator.php:790
     163#: languages/my-easy-compta-translations.php:181
     164#: includes/Modules/PDFGenerator.php:853
    165165msgid "BIC"
    166166msgstr ""
     
    178178msgstr ""
    179179
    180 #: languages/my-easy-compta-translations.php:282
     180#: languages/my-easy-compta-translations.php:284
    181181msgid "Card number"
    182182msgstr ""
     
    190190msgstr ""
    191191
    192 #: languages/my-easy-compta-translations.php:253
     192#: languages/my-easy-compta-translations.php:255
    193193msgid "Check update"
    194194msgstr ""
     
    235235msgstr ""
    236236
    237 #: languages/my-easy-compta-translations.php:192
     237#: languages/my-easy-compta-translations.php:194
    238238msgid "Code"
    239239msgstr ""
    240240
    241 #: languages/my-easy-compta-translations.php:193
     241#: languages/my-easy-compta-translations.php:195
    242242msgid "Color"
    243243msgstr ""
    244244
    245 #: languages/my-easy-compta-translations.php:222
     245#: languages/my-easy-compta-translations.php:224
    246246msgid "Coming soon"
    247247msgstr ""
     
    259259msgstr ""
    260260
    261 #: includes/Modules/PDFGenerator.php:770
     261#: includes/Modules/PDFGenerator.php:833
    262262msgid "Conditions terms"
    263263msgstr ""
    264264
    265 #: languages/my-easy-compta-translations.php:214
     265#: languages/my-easy-compta-translations.php:216
    266266msgid "Confirm new password"
    267267msgstr ""
     
    287287msgstr ""
    288288
    289 #: languages/my-easy-compta-translations.php:237
     289#: languages/my-easy-compta-translations.php:239
    290290msgid "Create backup"
    291291msgstr ""
     
    298298msgstr ""
    299299
    300 #: languages/my-easy-compta-translations.php:211
     300#: languages/my-easy-compta-translations.php:213
    301301msgid "Create user"
    302302msgstr ""
    303303
    304304#: languages/my-easy-compta-translations.php:47
    305 #: includes/Modules/PDFGenerator.php:433 includes/Modules/PDFGenerator.php:447
     305#: includes/Modules/PDFGenerator.php:458 includes/Modules/PDFGenerator.php:472
    306306msgid "Created at"
    307307msgstr ""
    308308
    309309#: languages/my-easy-compta-translations.php:75
    310 #: includes/Modules/PDFGenerator.php:443
     310#: includes/Modules/PDFGenerator.php:468
    311311msgid "Credit"
    312312msgstr ""
    313313
    314 #: languages/my-easy-compta-translations.php:182
     314#: languages/my-easy-compta-translations.php:184
    315315msgid "Credit color"
    316316msgstr ""
    317317
    318 #: languages/my-easy-compta-translations.php:184
     318#: languages/my-easy-compta-translations.php:186
    319319msgid "Credit footer"
    320320msgstr ""
     
    328328msgstr ""
    329329
    330 #: includes/Modules/PDFGenerator.php:245
     330#: includes/Modules/PDFGenerator.php:270
    331331msgid "Credit not found"
    332332msgstr ""
     
    336336msgstr ""
    337337
    338 #: languages/my-easy-compta-translations.php:183
     338#: languages/my-easy-compta-translations.php:185
    339339msgid "Credit prefix"
    340340msgstr ""
    341341
    342 #: languages/my-easy-compta-translations.php:185
     342#: languages/my-easy-compta-translations.php:187
    343343msgid "Credit terms"
    344344msgstr ""
     
    353353msgstr ""
    354354
    355 #: languages/my-easy-compta-translations.php:196
     355#: languages/my-easy-compta-translations.php:198
    356356msgid "Currencies"
    357357msgstr ""
     
    377377msgstr ""
    378378
    379 #: languages/my-easy-compta-translations.php:261 includes/Modules/App.php:33
     379#: languages/my-easy-compta-translations.php:263 includes/Modules/App.php:33
    380380#: includes/Modules/App.php:34
    381381msgid "Dashboard"
     
    398398msgstr ""
    399399
    400 #: includes/Modules/PDFGenerator.php:419
     400#: includes/Modules/PDFGenerator.php:444
    401401msgid "Date planned"
    402402msgstr ""
    403403
    404 #: languages/my-easy-compta-translations.php:226
     404#: languages/my-easy-compta-translations.php:228
    405405msgid "Date sent"
    406406msgstr ""
     
    426426msgstr ""
    427427
    428 #: languages/my-easy-compta-translations.php:245
     428#: languages/my-easy-compta-translations.php:247
    429429msgid "Deleted successfully"
    430430msgstr ""
     
    435435
    436436#: languages/my-easy-compta-translations.php:144
    437 #: includes/Modules/PDFGenerator.php:679
     437#: includes/Modules/PDFGenerator.php:718
    438438msgid "Discount"
    439439msgstr ""
     
    443443msgstr ""
    444444
    445 #: languages/my-easy-compta-translations.php:258
     445#: languages/my-easy-compta-translations.php:260
    446446msgid "Domain"
    447447msgstr ""
    448448
    449 #: languages/my-easy-compta-translations.php:234
     449#: languages/my-easy-compta-translations.php:236
    450450msgid "Done"
    451451msgstr ""
    452452
    453 #: languages/my-easy-compta-translations.php:241
     453#: languages/my-easy-compta-translations.php:243
    454454msgid "Download"
     455msgstr ""
     456
     457#: includes/Modules/PDFGenerator.php:226
     458msgid "DRAFT"
    455459msgstr ""
    456460
     
    460464
    461465#: languages/my-easy-compta-translations.php:50
    462 #: includes/Modules/PDFGenerator.php:418
     466#: includes/Modules/PDFGenerator.php:443
    463467msgid "Due date"
    464468msgstr ""
     
    501505
    502506#: languages/my-easy-compta-translations.php:32
    503 #: includes/Modules/PDFGenerator.php:558 includes/Modules/Setup.php:185
     507#: includes/Modules/PDFGenerator.php:583 includes/Modules/Setup.php:185
    504508msgid "Email"
    505509msgstr ""
    506510
    507 #: languages/my-easy-compta-translations.php:218
     511#: languages/my-easy-compta-translations.php:220
    508512msgid "Emails Invoices"
    509513msgstr ""
    510514
    511 #: languages/my-easy-compta-translations.php:224
     515#: languages/my-easy-compta-translations.php:226
    512516msgid "Emails logs"
    513517msgstr ""
    514518
     519#: languages/my-easy-compta-translations.php:221
     520msgid "Emails Quotes"
     521msgstr ""
     522
    515523#: languages/my-easy-compta-translations.php:219
    516 msgid "Emails Quotes"
    517 msgstr ""
    518 
    519 #: languages/my-easy-compta-translations.php:217
    520524msgid "Emails settings"
    521525msgstr ""
     
    528532msgstr ""
    529533
    530 #: languages/my-easy-compta-translations.php:235
     534#: languages/my-easy-compta-translations.php:237
    531535msgid "Error"
    532536msgstr ""
     
    537541msgstr ""
    538542
    539 #: languages/my-easy-compta-translations.php:228
     543#: languages/my-easy-compta-translations.php:230
    540544msgid "Event category"
     545msgstr ""
     546
     547#: languages/my-easy-compta-translations.php:233
     548#: languages/my-easy-compta-translations.php:234
     549msgid "Event end time"
    541550msgstr ""
    542551
    543552#: languages/my-easy-compta-translations.php:231
    544553#: languages/my-easy-compta-translations.php:232
    545 msgid "Event end time"
     554msgid "Event start date"
    546555msgstr ""
    547556
    548557#: languages/my-easy-compta-translations.php:229
    549 #: languages/my-easy-compta-translations.php:230
    550 msgid "Event start date"
    551 msgstr ""
    552 
    553 #: languages/my-easy-compta-translations.php:227
    554558msgid "Event title"
    555559msgstr ""
     
    580584msgstr ""
    581585
    582 #: languages/my-easy-compta-translations.php:205
     586#: languages/my-easy-compta-translations.php:207
    583587msgid "Expenses categories"
    584588msgstr ""
     
    588592msgstr ""
    589593
    590 #: languages/my-easy-compta-translations.php:283
     594#: languages/my-easy-compta-translations.php:285
    591595msgid "Expiration date"
    592596msgstr ""
    593597
    594 #: languages/my-easy-compta-translations.php:256
     598#: languages/my-easy-compta-translations.php:258
    595599msgid "Expiry date"
    596600msgstr ""
     
    627631msgstr ""
    628632
    629 #: languages/my-easy-compta-translations.php:252
     633#: languages/my-easy-compta-translations.php:254
    630634msgid "Failed to check for updates."
    631635msgstr ""
     
    703707msgstr ""
    704708
    705 #: languages/my-easy-compta-translations.php:238
     709#: languages/my-easy-compta-translations.php:240
    706710msgid "File name"
    707711msgstr ""
     
    738742msgstr ""
    739743
    740 #: languages/my-easy-compta-translations.php:178
    741 #: includes/Modules/PDFGenerator.php:787
     744#: languages/my-easy-compta-translations.php:180
     745#: includes/Modules/PDFGenerator.php:850
    742746msgid "IBAN"
    743747msgstr ""
    744748
    745 #: languages/my-easy-compta-translations.php:204
     749#: languages/my-easy-compta-translations.php:206
    746750msgid "ID"
    747751msgstr ""
     
    767771msgstr ""
    768772
    769 #: languages/my-easy-compta-translations.php:249
     773#: languages/my-easy-compta-translations.php:251
    770774msgid "Installed"
    771775msgstr ""
     
    827831msgstr ""
    828832
    829 #: includes/Modules/PDFGenerator.php:431
     833#: includes/Modules/PDFGenerator.php:456
    830834msgid "Invoice"
    831835msgstr ""
     
    843847msgstr ""
    844848
    845 #: languages/my-easy-compta-translations.php:180
     849#: languages/my-easy-compta-translations.php:182
    846850msgid "Invoice footer"
    847851msgstr ""
     
    876880msgstr ""
    877881
    878 #: languages/my-easy-compta-translations.php:269
     882#: languages/my-easy-compta-translations.php:271
    879883msgid "Invoice Overdue"
    880884msgstr ""
     
    884888msgstr ""
    885889
    886 #: languages/my-easy-compta-translations.php:220
     890#: languages/my-easy-compta-translations.php:222
    887891msgid "Invoice reminder"
    888892msgstr ""
     
    892896msgstr ""
    893897
    894 #: languages/my-easy-compta-translations.php:181
     898#: languages/my-easy-compta-translations.php:183
    895899msgid "Invoice terms"
    896900msgstr ""
     
    907911msgstr ""
    908912
    909 #: languages/my-easy-compta-translations.php:272
     913#: languages/my-easy-compta-translations.php:274
    910914msgid "Invoices in draft status cannot be sent."
    911915msgstr ""
     
    920924
    921925#: languages/my-easy-compta-translations.php:138
    922 #: includes/Modules/PDFGenerator.php:666
     926#: includes/Modules/PDFGenerator.php:702
    923927msgid "Item name"
    924928msgstr ""
     
    936940msgstr ""
    937941
    938 #: languages/my-easy-compta-translations.php:212
     942#: languages/my-easy-compta-translations.php:214
    939943msgid "Last invoices"
    940944msgstr ""
     
    952956msgstr ""
    953957
    954 #: languages/my-easy-compta-translations.php:246
     958#: languages/my-easy-compta-translations.php:248
    955959msgid "License key"
    956960msgstr ""
    957961
    958 #: languages/my-easy-compta-translations.php:277
     962#: languages/my-easy-compta-translations.php:279
    959963msgid "Live mode"
    960964msgstr ""
     
    964968msgstr ""
    965969
    966 #: languages/my-easy-compta-translations.php:263
     970#: languages/my-easy-compta-translations.php:265
    967971msgid "Logout"
    968972msgstr ""
     
    10041008msgstr ""
    10051009
    1006 #: languages/my-easy-compta-translations.php:275
     1010#: languages/my-easy-compta-translations.php:277
    10071011msgid "Mode"
    10081012msgstr ""
     
    11051109msgstr ""
    11061110
    1107 #: languages/my-easy-compta-translations.php:190
     1111#: languages/my-easy-compta-translations.php:192
    11081112msgid "Name"
    11091113msgstr ""
     
    11171121msgstr ""
    11181122
    1119 #: languages/my-easy-compta-translations.php:213
     1123#: languages/my-easy-compta-translations.php:215
    11201124msgid "New password"
    11211125msgstr ""
     
    11491153msgstr ""
    11501154
    1151 #: languages/my-easy-compta-translations.php:250
     1155#: languages/my-easy-compta-translations.php:252
    11521156msgid "No update available."
    11531157msgstr ""
     
    11621166msgstr ""
    11631167
    1164 #: languages/my-easy-compta-translations.php:248
     1168#: languages/my-easy-compta-translations.php:250
    11651169msgid "Not installed"
    11661170msgstr ""
     
    11781182msgstr ""
    11791183
     1184#: includes/Modules/PDFGenerator.php:220
     1185msgid "PAID"
     1186msgstr ""
     1187
    11801188#: languages/my-easy-compta-translations.php:74
    11811189msgid "Paid"
     
    11941202msgstr ""
    11951203
    1196 #: languages/my-easy-compta-translations.php:176
    1197 #: includes/Modules/PDFGenerator.php:773
     1204#: languages/my-easy-compta-translations.php:178
     1205#: includes/Modules/PDFGenerator.php:836
    11981206msgid "Payment conditions"
    11991207msgstr ""
    12001208
    12011209#: languages/my-easy-compta-translations.php:112
    1202 #: includes/Modules/PDFGenerator.php:432 includes/Modules/PDFGenerator.php:446
     1210#: includes/Modules/PDFGenerator.php:457 includes/Modules/PDFGenerator.php:471
    12031211msgid "Payment date"
    12041212msgstr ""
     
    12161224msgstr ""
    12171225
    1218 #: languages/my-easy-compta-translations.php:177
    1219 #: includes/Modules/PDFGenerator.php:776
     1226#: languages/my-easy-compta-translations.php:179
     1227#: includes/Modules/PDFGenerator.php:839
    12201228msgid "Payment mode"
    12211229msgstr ""
     
    12251233msgstr ""
    12261234
    1227 #: languages/my-easy-compta-translations.php:221
     1235#: languages/my-easy-compta-translations.php:223
    12281236msgid "Payment received"
    12291237msgstr ""
    12301238
    1231 #: languages/my-easy-compta-translations.php:285
     1239#: languages/my-easy-compta-translations.php:287
    12321240msgid "Payment successful"
    12331241msgstr ""
     
    12381246msgstr ""
    12391247
    1240 #: languages/my-easy-compta-translations.php:202
     1248#: languages/my-easy-compta-translations.php:204
    12411249msgid "Payments methods"
    12421250msgstr ""
     
    12511259
    12521260#: languages/my-easy-compta-translations.php:33
    1253 #: includes/Modules/PDFGenerator.php:533 includes/Modules/PDFGenerator.php:555
     1261#: includes/Modules/PDFGenerator.php:558 includes/Modules/PDFGenerator.php:580
    12541262#: includes/Modules/Setup.php:191
    12551263msgid "Phone"
    12561264msgstr ""
    12571265
    1258 #: languages/my-easy-compta-translations.php:216
     1266#: languages/my-easy-compta-translations.php:218
    12591267msgid "Planning settings"
    12601268msgstr ""
     
    12801288msgstr ""
    12811289
    1282 #: languages/my-easy-compta-translations.php:279
     1290#: languages/my-easy-compta-translations.php:281
    12831291msgid "Public key (Live mode)"
    12841292msgstr ""
    12851293
    1286 #: languages/my-easy-compta-translations.php:281
     1294#: languages/my-easy-compta-translations.php:283
    12871295msgid "Public key (Test mode)"
    12881296msgstr ""
    12891297
    12901298#: languages/my-easy-compta-translations.php:142
    1291 #: includes/Modules/PDFGenerator.php:669
     1299#: includes/Modules/PDFGenerator.php:705
    12921300msgid "Qty"
    12931301msgstr ""
     
    12971305msgstr ""
    12981306
    1299 #: includes/Modules/PDFGenerator.php:417
     1307#: includes/Modules/PDFGenerator.php:442
    13001308msgid "Quote"
    13011309msgstr ""
     
    13091317msgstr ""
    13101318
    1311 #: languages/my-easy-compta-translations.php:186
     1319#: languages/my-easy-compta-translations.php:188
    13121320msgid "Quote color"
    13131321msgstr ""
     
    13171325msgstr ""
    13181326
    1319 #: languages/my-easy-compta-translations.php:268
     1327#: languages/my-easy-compta-translations.php:270
    13201328msgid "Quote expired"
    13211329msgstr ""
    13221330
    1323 #: languages/my-easy-compta-translations.php:188
     1331#: languages/my-easy-compta-translations.php:190
    13241332msgid "Quote footer"
    13251333msgstr ""
     
    13491357msgstr ""
    13501358
    1351 #: languages/my-easy-compta-translations.php:187 includes/Modules/Setup.php:248
     1359#: languages/my-easy-compta-translations.php:189 includes/Modules/Setup.php:248
    13521360msgid "Quote prefix"
    13531361msgstr ""
     
    13571365msgstr ""
    13581366
    1359 #: languages/my-easy-compta-translations.php:189
     1367#: languages/my-easy-compta-translations.php:191
    13601368msgid "Quote terms"
    13611369msgstr ""
     
    13701378msgstr ""
    13711379
    1372 #: languages/my-easy-compta-translations.php:198
     1380#: languages/my-easy-compta-translations.php:200
    13731381msgid "Rate"
    13741382msgstr ""
     
    13831391msgstr ""
    13841392
    1385 #: includes/Modules/PDFGenerator.php:518
     1393#: includes/Modules/PDFGenerator.php:543
    13861394msgid "Received From"
    13871395msgstr ""
     
    13951403msgstr ""
    13961404
    1397 #: includes/Modules/PDFGenerator.php:522
     1405#: includes/Modules/PDFGenerator.php:547
    13981406msgid "Recipient"
    13991407msgstr ""
    14001408
    1401 #: languages/my-easy-compta-translations.php:225
     1409#: languages/my-easy-compta-translations.php:227
    14021410msgid "Recipient email"
    14031411msgstr ""
    14041412
    14051413#: languages/my-easy-compta-translations.php:137
    1406 #: includes/Modules/PDFGenerator.php:663
     1414#: includes/Modules/PDFGenerator.php:699
    14071415msgid "Ref"
    14081416msgstr ""
    14091417
    1410 #: includes/Modules/PDFGenerator.php:488
     1418#: includes/Modules/PDFGenerator.php:513
    14111419msgid "Reference No"
    14121420msgstr ""
     
    14241432msgstr ""
    14251433
    1426 #: languages/my-easy-compta-translations.php:242
     1434#: languages/my-easy-compta-translations.php:244
    14271435msgid "Restore"
    14281436msgstr ""
    14291437
    1430 #: includes/Modules/PDFGenerator.php:784
     1438#: includes/Modules/PDFGenerator.php:847
    14311439msgid "RIB"
    14321440msgstr ""
     
    14401448msgstr ""
    14411449
    1442 #: languages/my-easy-compta-translations.php:278
     1450#: languages/my-easy-compta-translations.php:280
    14431451msgid "Secret key (Live mode)"
    14441452msgstr ""
    14451453
    1446 #: languages/my-easy-compta-translations.php:280
     1454#: languages/my-easy-compta-translations.php:282
    14471455msgid "Secret key (Test mode)"
    14481456msgstr ""
    14491457
    1450 #: languages/my-easy-compta-translations.php:284
     1458#: languages/my-easy-compta-translations.php:286
    14511459msgid "Security code"
    14521460msgstr ""
     
    14561464msgstr ""
    14571465
    1458 #: languages/my-easy-compta-translations.php:233
     1466#: languages/my-easy-compta-translations.php:235
    14591467msgid "Select / Unselect All"
    14601468msgstr ""
     
    15131521msgstr ""
    15141522
     1523#: languages/my-easy-compta-translations.php:176
     1524msgid "Show Watermark"
     1525msgstr ""
     1526
     1527#: languages/my-easy-compta-translations.php:177
     1528msgid "Show Watermark only for Paid status"
     1529msgstr ""
     1530
    15151531#: languages/my-easy-compta-translations.php:94
    15161532msgid "Sign"
     
    15261542
    15271543#: languages/my-easy-compta-translations.php:24
     1544#: includes/Modules/PDFGenerator.php:586
    15281545msgid "SIREN n°"
    15291546msgstr ""
    15301547
    1531 #: languages/my-easy-compta-translations.php:23 includes/Modules/Setup.php:145
     1548#: languages/my-easy-compta-translations.php:23
     1549#: includes/Modules/PDFGenerator.php:564 includes/Modules/Setup.php:145
    15321550msgid "SIRET n°"
    15331551msgstr ""
     
    15371555msgstr ""
    15381556
    1539 #: languages/my-easy-compta-translations.php:255
     1557#: languages/my-easy-compta-translations.php:257
    15401558msgid "Slug"
    15411559msgstr ""
     
    15451563msgstr ""
    15461564
    1547 #: languages/my-easy-compta-translations.php:274
     1565#: languages/my-easy-compta-translations.php:276
    15481566msgid "Stats settings"
    15491567msgstr ""
     
    15671585
    15681586#: languages/my-easy-compta-translations.php:150
    1569 #: languages/my-easy-compta-translations.php:273
     1587#: languages/my-easy-compta-translations.php:275
    15701588msgid "Stripe settings"
    15711589msgstr ""
     
    15831601msgstr ""
    15841602
    1585 #: includes/Modules/PDFGenerator.php:706 includes/Modules/PDFGenerator.php:721
     1603#: includes/Modules/PDFGenerator.php:753 includes/Modules/PDFGenerator.php:776
    15861604msgid "Subtotal"
    15871605msgstr ""
    15881606
    1589 #: languages/my-easy-compta-translations.php:260
     1607#: languages/my-easy-compta-translations.php:262
    15901608msgid "Success"
    15911609msgstr ""
    15921610
    1593 #: languages/my-easy-compta-translations.php:191
     1611#: languages/my-easy-compta-translations.php:193
    15941612msgid "Symbol"
    15951613msgstr ""
     
    16081626
    16091627#: languages/my-easy-compta-translations.php:45
    1610 #: includes/Modules/PDFGenerator.php:741
     1628#: includes/Modules/PDFGenerator.php:796
    16111629msgid "Tax"
    16121630msgstr ""
    16131631
    16141632#: languages/my-easy-compta-translations.php:22
    1615 #: includes/Modules/PDFGenerator.php:542 includes/Modules/PDFGenerator.php:564
     1633#: includes/Modules/PDFGenerator.php:567 includes/Modules/PDFGenerator.php:589
    16161634#: includes/Modules/Setup.php:151
    16171635msgid "Tax number"
    16181636msgstr ""
    16191637
    1620 #: languages/my-easy-compta-translations.php:276
     1638#: languages/my-easy-compta-translations.php:278
    16211639msgid "Test mode"
    16221640msgstr ""
    16231641
    1624 #: languages/my-easy-compta-translations.php:195
     1642#: languages/my-easy-compta-translations.php:197
    16251643msgid "Text Color"
    16261644msgstr ""
     
    16531671msgstr ""
    16541672
    1655 #: languages/my-easy-compta-translations.php:210
     1673#: languages/my-easy-compta-translations.php:212
    16561674msgid "There's no turning back!"
    16571675msgstr ""
    16581676
    1659 #: languages/my-easy-compta-translations.php:243
     1677#: languages/my-easy-compta-translations.php:245
    16601678msgid ""
    16611679"This will automatically create a backup and delete all data to restore the "
     
    16631681msgstr ""
    16641682
    1665 #: languages/my-easy-compta-translations.php:244
     1683#: languages/my-easy-compta-translations.php:246
    16661684msgid "Token api SIREN v 3.11"
    16671685msgstr ""
    16681686
    16691687#: languages/my-easy-compta-translations.php:43
    1670 #: includes/Modules/PDFGenerator.php:683 includes/Modules/PDFGenerator.php:757
     1688#: includes/Modules/PDFGenerator.php:722 includes/Modules/PDFGenerator.php:820
    16711689msgid "Total"
    16721690msgstr ""
     
    16761694msgstr ""
    16771695
    1678 #: languages/my-easy-compta-translations.php:265
     1696#: languages/my-easy-compta-translations.php:267
    16791697msgid "Total invoices"
    16801698msgstr ""
    16811699
     1700#: languages/my-easy-compta-translations.php:268
     1701msgid "Total paid invoices"
     1702msgstr ""
     1703
    16821704#: languages/my-easy-compta-translations.php:266
    1683 msgid "Total paid invoices"
    1684 msgstr ""
    1685 
    1686 #: languages/my-easy-compta-translations.php:264
    16871705msgid "Total quotes"
    16881706msgstr ""
     
    17011719
    17021720#: languages/my-easy-compta-translations.php:143
    1703 #: includes/Modules/PDFGenerator.php:672
     1721#: includes/Modules/PDFGenerator.php:708
    17041722msgid "Unit price"
     1723msgstr ""
     1724
     1725#: includes/Modules/PDFGenerator.php:228
     1726msgid "UNPAID"
    17051727msgstr ""
    17061728
     
    17091731msgstr ""
    17101732
    1711 #: languages/my-easy-compta-translations.php:267
     1733#: languages/my-easy-compta-translations.php:269
    17121734msgid "Unpaid invoices"
    17131735msgstr ""
     
    17171739msgstr ""
    17181740
    1719 #: languages/my-easy-compta-translations.php:251
     1741#: languages/my-easy-compta-translations.php:253
    17201742msgid "Update available! New version"
    17211743msgstr ""
     
    17291751msgstr ""
    17301752
    1731 #: languages/my-easy-compta-translations.php:247
     1753#: languages/my-easy-compta-translations.php:249
    17321754msgid "Validate"
    17331755msgstr ""
     
    17411763msgstr ""
    17421764
    1743 #: languages/my-easy-compta-translations.php:199
     1765#: languages/my-easy-compta-translations.php:201
    17441766msgid "VAT"
    17451767msgstr ""
    17461768
    1747 #: includes/Modules/PDFGenerator.php:675
     1769#: includes/Modules/PDFGenerator.php:713
    17481770msgid "Vat"
    17491771msgstr ""
    17501772
    1751 #: languages/my-easy-compta-translations.php:200
     1773#: languages/my-easy-compta-translations.php:202
    17521774msgid "VAT Rates"
    17531775msgstr ""
    17541776
    1755 #: languages/my-easy-compta-translations.php:259
     1777#: languages/my-easy-compta-translations.php:261
    17561778msgid "Version"
    17571779msgstr ""
     
    17651787msgstr ""
    17661788
    1767 #: languages/my-easy-compta-translations.php:209
     1789#: languages/my-easy-compta-translations.php:211
    17681790msgid "Yes, confirm it!"
    17691791msgstr ""
    17701792
    1771 #: languages/my-easy-compta-translations.php:208
     1793#: languages/my-easy-compta-translations.php:210
    17721794msgid "Yes, delete it!"
    17731795msgstr ""
     
    17781800msgstr ""
    17791801
    1780 #: languages/my-easy-compta-translations.php:289
     1802#: languages/my-easy-compta-translations.php:291
    17811803msgid "You must have at least one article"
    17821804msgstr ""
    17831805
    1784 #: languages/my-easy-compta-translations.php:270
     1806#: languages/my-easy-compta-translations.php:272
    17851807msgid "You need to activate the Email addon to benefit from this feature."
    17861808msgstr ""
    17871809
    1788 #: languages/my-easy-compta-translations.php:271
     1810#: languages/my-easy-compta-translations.php:273
    17891811msgid "You need to activate the Export addon to benefit from this feature."
    17901812msgstr ""
    17911813
    1792 #: languages/my-easy-compta-translations.php:286
     1814#: languages/my-easy-compta-translations.php:288
    17931815msgid ""
    17941816"Your payment is secure, and no card details are stored by our platform. The "
  • my-easy-compta/trunk/my-easy-compta.php

    r3148192 r3155882  
    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.1.0
     5 * Version: 1.2.0
    66 * Author: MELIOZ.dev
    77 * Author URI: https://myeasycompta.com
     
    2222 *
    2323 * @package myEasyCompta
    24  * @since 1.1.0
     24 * @since 1.2.0
    2525 */
    2626
     
    3737     * @var string
    3838     */
    39     public $version = '1.1.0';
     39    public $version = '1.2.0';
    4040
    4141    /**
     
    343343                        <input type="submit" name="run_migration_now" class="button button-primary" value="' . esc_attr__('Update Database', 'my-easy-compta') . '" />
    344344                    </form>
    345                   </div>';
     345                </div>';
    346346        }
    347347    }
  • my-easy-compta/trunk/readme.txt

    r3148192 r3155882  
    44Tested up to: 6.6.1
    55Requires PHP: 8.0
    6 Stable tag: 1.1.0
     6Stable tag: 1.2.0
    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.