Files
service-finder/frontend_admin/.nuxt/dist/client/_nuxt/iGXES_tj.js

6 lines
36 KiB
JavaScript

import{e as ye,x as ve,c as i,a as e,t as o,d as S,F as j,r as L,k as Y,l as _,v as b,y as H,D as Z,j as v,i as R,n as q,q as f,z as ee,E as he,B as ke,o as c}from"./CGTxeHv7.js";import{u as te}from"./nwypRWOF.js";function we(){const x=te();function h(n,d){const u=x.activeLocale||"en-EU";try{return new Intl.NumberFormat(u,d).format(n)}catch{return new Intl.NumberFormat("en-EU",d).format(n)}}function k(n,d,u){const m=x.activeLocale||"en-EU",p=d||x.activeCurrency||"EUR";try{return new Intl.NumberFormat(m,{style:"currency",currency:p,minimumFractionDigits:2,maximumFractionDigits:2,...u}).format(n)}catch{return`${n.toFixed(2)} ${p}`}}function A(n,d){const u=x.activeLocale||"en-EU",m=x.activeTimezone||"Europe/Brussels",p=typeof n=="string"||typeof n=="number"?new Date(n):n;try{return new Intl.DateTimeFormat(u,{timezone:m,year:"numeric",month:"2-digit",day:"2-digit",...d}).format(p)}catch{return p.toLocaleDateString("en-GB")}}function g(n,d){const u=x.activeLocale||"en-EU",m=x.activeTimezone||"Europe/Brussels",p=typeof n=="string"||typeof n=="number"?new Date(n):n;try{return new Intl.DateTimeFormat(u,{timezone:m,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",...d}).format(p)}catch{return p.toLocaleString("en-GB")}}function O(n,d){const u=x.activeLocale||"en-EU";try{return new Intl.NumberFormat(u,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:1,...d}).format(n/100)}catch{return`${n}%`}}function F(n,d){const u=d??x.activeVatRate??0,m=n*(u/100),p=n+m;return{net:n,vat:m,gross:p,vatRate:u}}function P(n,d,u){const{net:m,vat:p,gross:U,vatRate:w}=F(n,d),$=u||x.activeCurrency||"EUR";return`Net: ${k(m,$)} | VAT: ${k(p,$)} (${w}%) | Gross: ${k(U,$)}`}return{formatNumber:h,formatCurrency:k,formatDate:A,formatDateTime:g,formatPercent:O,calculatePriceWithVat:F,formatPriceWithVat:P}}const $e={class:"mb-8 flex items-center justify-between"},ze={class:"text-2xl font-bold text-white"},Ce={class:"text-slate-400 mt-1"},Ue={key:0,class:"flex items-center justify-center py-20"},Ee={class:"flex flex-col items-center gap-3"},Ve={class:"text-slate-400 text-sm"},Fe={key:1,class:"bg-red-900/30 border border-red-700 rounded-xl p-6 text-center"},De={class:"text-red-300 mb-3"},Te={key:2,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-12 text-center"},je={class:"text-lg font-medium text-slate-300 mb-2"},Le={class:"text-slate-500 mb-6"},Re={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 mb-8"},Pe={class:"flex items-center justify-between mb-4"},Ae={class:"flex items-center gap-3"},Me=["innerHTML"],Be={class:"text-lg font-semibold text-white"},Ne={class:"text-xs text-slate-500 font-mono"},Ie={class:"flex items-center gap-1.5 flex-wrap"},Se={key:0,class:"px-2 py-0.5 text-xs font-semibold rounded-full bg-indigo-500/20 text-indigo-300"},He={key:1,class:"px-2 py-0.5 text-xs font-semibold rounded-full bg-amber-500/20 text-amber-300",title:"Default fallback package for expired subscriptions"},Ze=["title"],Oe={class:"mb-4"},Je={class:"text-3xl font-bold text-white"},Ge={class:"text-sm text-slate-400 ml-1"},qe={class:"text-sm text-slate-400 mb-4 flex-1"},Ke={class:"border-t border-slate-700 pt-4 mb-4"},We={class:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-3"},Qe={class:"space-y-2"},Xe={class:"flex items-center justify-between text-sm"},Ye={class:"text-slate-400"},et={class:"text-slate-200 font-medium"},tt={class:"flex items-center justify-between text-sm"},st={class:"text-slate-400"},at={class:"text-slate-200 font-medium"},lt={class:"flex items-center justify-between text-sm"},ot={class:"text-slate-400"},rt={class:"text-slate-200 font-medium"},nt={class:"mb-4"},it={class:"text-xs text-slate-500"},ct={class:"text-xs font-mono text-slate-400"},dt={class:"flex gap-2"},ut=["onClick"],pt=["onClick","title"],_t=["onClick","title"],mt={class:"bg-slate-800 border border-slate-700 rounded-xl w-full max-w-3xl mx-4 shadow-2xl max-h-[90vh] flex flex-col"},ft={class:"flex items-center justify-between px-6 py-4 border-b border-slate-700"},gt={class:"text-lg font-semibold text-white"},bt={class:"flex border-b border-slate-700 px-6"},xt=["onClick"],yt={class:"flex-1 overflow-y-auto px-6 py-5"},vt={key:0,class:"space-y-4"},ht={class:"block text-sm font-medium text-slate-300 mb-1"},kt=["placeholder"],wt={class:"block text-sm font-medium text-slate-300 mb-1"},$t=["placeholder"],zt={class:"grid grid-cols-2 gap-4"},Ct={class:"block text-sm font-medium text-slate-300 mb-1"},Ut={value:"private"},Et={value:"corporate"},Vt={class:"block text-sm font-medium text-slate-300 mb-1"},Ft={class:"text-xs text-slate-500 mt-1"},Dt={class:"grid grid-cols-2 gap-4"},Tt={class:"block text-sm font-medium text-slate-300 mb-1"},jt=["placeholder"],Lt={class:"block text-sm font-medium text-slate-300 mb-1"},Rt=["placeholder"],Pt={class:"flex items-center gap-3"},At={for:"is_custom",class:"text-sm text-slate-300"},Mt={class:"border-t border-slate-700 pt-4"},Bt={class:"text-sm font-semibold text-slate-300 mb-3"},Nt={class:"space-y-4"},It={class:"flex items-center gap-3"},St={for:"is_default_fallback",class:"text-sm text-slate-300"},Ht={class:"block text-sm text-slate-300 mb-1"},Zt={class:"text-xs text-slate-500 mt-1"},Ot={key:1,class:"space-y-6"},Jt={class:"text-sm font-semibold text-slate-300 mb-3"},Gt={class:"overflow-x-auto"},qt={class:"w-full text-sm"},Kt={class:"border-b border-slate-700"},Wt={class:"text-left py-2 px-3 text-slate-400 font-medium"},Qt={class:"text-left py-2 px-3 text-slate-400 font-medium"},Xt={class:"text-left py-2 px-3 text-slate-400 font-medium"},Yt={class:"py-2 px-3 text-slate-200 font-medium"},es={class:"inline-flex items-center gap-1.5"},ts={class:"text-xs text-slate-500"},ss={class:"py-2 px-3"},as=["value","onInput"],ls={class:"py-2 px-3"},os=["value","onInput"],rs={class:"py-2 px-3"},ns=["value","onInput"],is={class:"py-2 px-3"},cs=["value","onInput"],ds={class:"py-2 px-3 text-center"},us=["onClick","title"],ps={class:"flex items-center gap-3 mt-4"},_s={value:"",disabled:""},ms=["value"],fs=["disabled"],gs={class:"border-t border-slate-700 pt-5"},bs={class:"text-sm font-semibold text-slate-300 mb-3"},xs={class:"bg-slate-700/30 rounded-xl p-4 space-y-4"},ys={class:"grid grid-cols-3 gap-4"},vs={class:"block text-xs text-slate-400 mb-1"},hs={class:"block text-xs text-slate-400 mb-1"},ks=["value"],ws={class:"block text-xs text-slate-400 mb-1"},$s=["value"],zs={class:"grid grid-cols-3 gap-4 pt-2"},Cs={class:"bg-slate-800 rounded-lg p-3 text-center"},Us={class:"text-xs text-slate-400 mb-1"},Es={class:"text-lg font-bold text-white"},Vs={class:"bg-slate-800 rounded-lg p-3 text-center"},Fs={class:"text-xs text-slate-400 mb-1"},Ds={class:"text-lg font-bold text-amber-400"},Ts={class:"bg-slate-800 rounded-lg p-3 text-center ring-2 ring-emerald-500/50"},js={class:"text-xs text-slate-400 mb-1"},Ls={class:"text-lg font-bold text-emerald-400"},Rs={class:"flex justify-end pt-1"},Ps={key:2,class:"space-y-5"},As={class:"text-sm font-semibold text-slate-300 mb-3"},Ms={class:"grid grid-cols-3 gap-4"},Bs={class:"block text-xs text-slate-400 mb-1"},Ns={class:"block text-xs text-slate-400 mb-1"},Is={class:"block text-xs text-slate-400 mb-1"},Ss={class:"border-t border-slate-700 pt-4"},Hs={class:"grid grid-cols-3 gap-4"},Zs={class:"flex items-center h-[38px]"},Os={class:"relative inline-flex items-center cursor-pointer"},Js={class:"ms-3 text-sm text-slate-300"},Gs={class:"flex items-center h-[38px]"},qs={class:"relative inline-flex items-center cursor-pointer"},Ks={class:"ms-3 text-sm text-slate-300"},Ws={class:"border-t border-slate-700 pt-4"},Qs={class:"text-sm font-semibold text-slate-300 mb-3"},Xs={class:"text-xs text-slate-500 mt-1"},Ys={key:0,class:"text-xs text-red-400 mt-1"},ea={class:"flex items-center justify-between px-6 py-4 border-t border-slate-700"},ta={class:"text-xs text-slate-500"},sa={class:"flex items-center gap-3"},aa=["disabled"],la={key:0,class:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},oa={class:"bg-slate-800 border border-slate-700 rounded-xl w-full max-w-md mx-4 p-6 shadow-2xl"},ra={class:"text-lg font-semibold text-white mb-2"},na={class:"text-slate-400 text-sm mb-6"},ia={class:"flex items-center justify-end gap-3"},ca=["disabled"],pa=ye({__name:"index",setup(x){const h=te(),{formatCurrency:k}=we(),A=[{key:"basic",label:"📋 Basic Info"},{key:"pricing",label:"💰 Pricing"},{key:"features",label:"⚡ Features"}],g=f("basic"),O=ee(()=>{const t=A.find(s=>s.key===g.value);return t?t.label:""}),F=f([]),P=f(!0),n=f(null),d=f(!1),u=f(!1),m=f(null),p=f(null),U=f(!1),w=f(!1),$=f(null),M=f(null),D=f(""),se=ee(()=>h.regions.filter(t=>t.country_code!=="DEFAULT"&&!l.pricing_zones[t.country_code]));function ae(){if(!D.value)return;const t=D.value;if(l.pricing_zones[t]){y("error",`Region ${t} already exists in pricing zones`);return}const s=h.getRegion(t);l.pricing_zones[t]={monthly_price:0,yearly_price:0,credit_price:0,currency:s?.currency||"EUR"},D.value="",y("success",`Added pricing zone for ${t}`)}function le(t){t!=="DEFAULT"&&(delete l.pricing_zones[t],y("success",`Removed pricing zone for ${t}`))}const E=f(0),T=f(27),V=f("EUR"),K={name:"",display_name:"",type:"private",tier_level:0,monthly_price:0,yearly_price:0,currency:"EUR",max_vehicles:1,max_garages:1,monthly_free_credits:0,max_cost_category_depth:3,advanced_reports:!1,export_data:!1,subtitle:"",badge:"",is_custom:!1,is_default_fallback:!1,trial_days_on_signup:0,feature_capabilities_json:`{
"ai_analysis": false,
"priority_support": false,
"api_access": false
}`,pricing_zones:{}},l=he({...K});function W(t,s){const a=l.pricing_zones[t];return a?s==="monthly"?a.monthly_price:a.yearly_price:0}function Q(t,s,a){const r=parseFloat(a)||0;l.pricing_zones[t]||(l.pricing_zones[t]={monthly_price:0,yearly_price:0,credit_price:0,currency:"EUR"}),s==="monthly"?l.pricing_zones[t].monthly_price=r:l.pricing_zones[t].yearly_price=r}function oe(t){const s=l.pricing_zones[t];return s?s.credit_price??0:0}function re(t,s){const a=parseFloat(s)||0;l.pricing_zones[t]||(l.pricing_zones[t]={monthly_price:0,yearly_price:0,credit_price:0,currency:"EUR"}),l.pricing_zones[t].credit_price=a}function ne(t){const s=l.pricing_zones[t];return s?s.currency:"EUR"}function ie(t,s){l.pricing_zones[t]||(l.pricing_zones[t]={monthly_price:0,yearly_price:0,credit_price:0,currency:"EUR"}),l.pricing_zones[t].currency=s.toUpperCase()}function ce(){const t=h.regions.find(a=>a.default_vat_rate===T);if(!t){y("error","No region found with the selected VAT rate");return}const s=t.country_code;l.pricing_zones[s]||(l.pricing_zones[s]={monthly_price:0,yearly_price:0,credit_price:0,currency:t.currency}),l.pricing_zones[s].monthly_price=E,l.pricing_zones[s].currency=V,y("success",`Applied net price ${k(E,V)} to ${s} region`)}function B(){const s=ke("access_token").value;return s?{Authorization:`Bearer ${s}`}:{}}async function N(){P.value=!0,n.value=null;try{const t=await $fetch("/api/v1/admin/packages",{headers:B()});F.value=t.tiers||[]}catch(t){n.value=t?.data?.detail||t?.message||"Failed to load packages",console.error("[Packages] Fetch error:",t)}finally{P.value=!1}}function I(t){return t.rules?.display_name||t.name}function de(t){return t.rules?.marketing?.subtitle||t.rules?.marketing?.badge||""}function ue(t){const s=t.rules?.pricing_zones,a=t.rules?.pricing;if(s&&s.DEFAULT){const r=s.DEFAULT,z=r.currency==="HUF"?"Ft":"€";return`${r.monthly_price} ${z}`}if(a){const r=a.currency==="HUF"?"Ft":"€";return`${a.monthly_price} ${r}`}return"—"}function J(t,s){const a=t.rules?.allowances;return a?a[s]??"—":"—"}function pe(t){return t>=2?"bg-purple-500/10 text-purple-400":t>=1?"bg-amber-500/10 text-amber-400":"bg-slate-500/10 text-slate-400"}function _e(t){return t>=2?"🏢":t>=1?"⭐":"🔓"}function X(){U.value=!0,m.value=null,g.value="basic",Object.assign(l,K),d.value=!0}function me(t){U.value=!1,m.value=t,g.value="basic";const s=t.rules||{},a=s.pricing_zones?.DEFAULT||s.pricing||{},r=s.allowances||{};l.name=t.name,l.display_name=s.display_name||"",l.type=s.type||"private",l.tier_level=t.tier_level,l.monthly_price=a.monthly_price||0,l.yearly_price=a.yearly_price||0,l.currency=a.currency||"EUR",l.max_vehicles=r.max_vehicles||1,l.max_garages=r.max_garages||1,l.monthly_free_credits=r.monthly_free_credits||0,l.subtitle=s.marketing?.subtitle||"",l.badge=s.marketing?.badge||"",l.is_custom=t.is_custom,l.is_default_fallback=t.is_default_fallback,l.trial_days_on_signup=t.trial_days_on_signup;const z=t.feature_capabilities||{};if(l.max_cost_category_depth=z.max_cost_category_depth??3,l.advanced_reports=z.advanced_reports??!1,l.export_data=z.export_data??!1,l.pricing_zones={},s.pricing_zones)for(const[G,C]of Object.entries(s.pricing_zones))l.pricing_zones[G]={monthly_price:C.monthly_price||0,yearly_price:C.yearly_price||0,credit_price:C.credit_price||0,currency:C.currency||"EUR"};l.feature_capabilities_json=JSON.stringify(t.feature_capabilities||{},null,2),d.value=!0}function fe(t){p.value=t,u.value=!0}function ge(t){U.value=!0,m.value=null,g.value="basic";const s=t.rules||{},a=s.pricing_zones?.DEFAULT||s.pricing||{},r=s.allowances||{};l.name=t.name+"_copy",l.display_name=(s.display_name||t.name)+" (másolat)",l.type=s.type||"private",l.tier_level=t.tier_level,l.monthly_price=a.monthly_price||0,l.yearly_price=a.yearly_price||0,l.currency=a.currency||"EUR",l.max_vehicles=r.max_vehicles||1,l.max_garages=r.max_garages||1,l.monthly_free_credits=r.monthly_free_credits||0,l.subtitle=s.marketing?.subtitle||"",l.badge=s.marketing?.badge||"",l.is_custom=t.is_custom,l.is_default_fallback=!1,l.trial_days_on_signup=t.trial_days_on_signup;const z=t.feature_capabilities||{};if(l.max_cost_category_depth=z.max_cost_category_depth??3,l.advanced_reports=z.advanced_reports??!1,l.export_data=z.export_data??!1,l.pricing_zones={},s.pricing_zones)for(const[G,C]of Object.entries(s.pricing_zones))l.pricing_zones[G]={monthly_price:C.monthly_price||0,yearly_price:C.yearly_price||0,credit_price:C.credit_price||0,currency:C.currency||"EUR"};l.feature_capabilities_json=JSON.stringify(t.feature_capabilities||{},null,2),d.value=!0}async function be(){if(!l.name.trim()){y("error","Package name is required");return}let t={};try{t=JSON.parse(l.feature_capabilities_json),M.value=null}catch{M.value="Invalid JSON in feature capabilities",g.value="features";return}w.value=!0;try{const s={...l.pricing_zones};s.DEFAULT||(s.DEFAULT={monthly_price:l.monthly_price,yearly_price:l.yearly_price,credit_price:0,currency:l.currency.toUpperCase()});const a={...t,max_cost_category_depth:l.max_cost_category_depth,advanced_reports:l.advanced_reports,export_data:l.export_data},r={type:l.type,display_name:l.display_name||null,pricing_zones:s,allowances:{max_vehicles:l.max_vehicles,max_garages:l.max_garages,monthly_free_credits:l.monthly_free_credits},marketing:{subtitle:l.subtitle||null,badge:l.badge||null},lifecycle:{is_public:!0}};U.value?(await $fetch("/api/v1/admin/packages",{method:"POST",headers:{...B(),"Content-Type":"application/json"},body:{name:l.name.trim().toLowerCase(),rules:r,is_custom:l.is_custom,tier_level:l.tier_level,feature_capabilities:a,is_default_fallback:l.is_default_fallback,trial_days_on_signup:l.trial_days_on_signup}}),y("success",`Package "${l.name}" created successfully`)):m.value&&(await $fetch(`/api/v1/admin/packages/${m.value.id}`,{method:"PATCH",headers:{...B(),"Content-Type":"application/json"},body:{name:l.name.trim().toLowerCase(),rules:r,is_custom:l.is_custom,tier_level:l.tier_level,feature_capabilities:a,is_default_fallback:l.is_default_fallback,trial_days_on_signup:l.trial_days_on_signup}}),y("success",`Package "${l.name}" updated successfully`)),d.value=!1,await N()}catch(s){const a=s?.data?.detail||s?.message||"Operation failed";y("error",a),console.error("[Packages] Save error:",s)}finally{w.value=!1}}async function xe(){if(p.value){w.value=!0;try{await $fetch(`/api/v1/admin/packages/${p.value.id}`,{method:"DELETE",headers:B()}),y("success",`Package "${I(p.value)}" deactivated`),u.value=!1,p.value=null,await N()}catch(t){const s=t?.data?.detail||t?.message||"Delete failed";y("error",s),console.error("[Packages] Delete error:",t)}finally{w.value=!1}}}function y(t,s){$.value={type:t,message:s},setTimeout(()=>{$.value=null},4e3)}return ve(()=>{N(),h.fetchRegions()}),(t,s)=>(c(),i("div",null,[e("div",$e,[e("div",null,[e("h1",ze,o(t.$t("packages.title")),1),e("p",Ce,o(t.$t("packages.subtitle")),1)]),e("button",{onClick:X,class:"px-5 py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition text-sm flex items-center gap-2"},[s[25]||(s[25]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1)),S(" "+o(t.$t("packages.create_new")),1)])]),P.value?(c(),i("div",Ue,[e("div",Ee,[s[26]||(s[26]=e("svg",{class:"animate-spin h-8 w-8 text-indigo-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"}),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})],-1)),e("span",Ve,o(t.$t("packages.loading")),1)])])):n.value?(c(),i("div",Fe,[e("p",De,o(n.value),1),e("button",{onClick:N,class:"px-4 py-2 bg-red-700 hover:bg-red-600 text-white rounded-lg transition text-sm"},o(t.$t("packages.retry")),1)])):F.value.length===0?(c(),i("div",Te,[s[27]||(s[27]=e("svg",{class:"w-16 h-16 mx-auto text-slate-600 mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"})],-1)),e("h3",je,o(t.$t("packages.no_packages")),1),e("p",Le,o(t.$t("packages.no_packages_desc")),1),e("button",{onClick:X,class:"px-5 py-2.5 bg-emerald-600 hover:bg-emerald-500 text-white font-medium rounded-lg transition text-sm"},o(t.$t("packages.create_first")),1)])):(c(),i("div",Re,[(c(!0),i(j,null,L(F.value,a=>(c(),i("div",{key:a.id,class:"bg-slate-800 rounded-xl border border-slate-700 p-6 flex flex-col transition-all hover:border-slate-600"},[e("div",Pe,[e("div",Ae,[e("div",{class:q(["p-2 rounded-lg",pe(a.tier_level)])},[e("span",{class:"w-5 h-5 text-lg",innerHTML:_e(a.tier_level)},null,8,Me)],2),e("div",null,[e("h2",Be,o(I(a)),1),e("span",Ne,o(a.name),1)])]),e("div",Ie,[a.tier_level>=1?(c(),i("span",Se,o(t.$t("packages.popular")),1)):v("",!0),a.is_default_fallback?(c(),i("span",He," 🔒 "+o(t.$t("packages.fallback_badge")),1)):v("",!0),a.trial_days_on_signup>0?(c(),i("span",{key:2,class:"px-2 py-0.5 text-xs font-semibold rounded-full bg-emerald-500/20 text-emerald-300",title:`${a.trial_days_on_signup} days trial on signup`}," 🎯 "+o(t.$t("packages.trial_badge"))+": "+o(a.trial_days_on_signup)+"d ",9,Ze)):v("",!0)])]),e("div",Oe,[e("span",Je,o(ue(a)),1),e("span",Ge,"/ "+o(t.$t("packages.month")),1)]),e("p",qe,o(de(a)),1),e("div",Ke,[e("h3",We,o(t.$t("packages.allowances")),1),e("div",Qe,[e("div",Xe,[e("span",Ye,o(t.$t("packages.max_vehicles")),1),e("span",et,o(J(a,"max_vehicles")),1)]),e("div",tt,[e("span",st,o(t.$t("packages.max_garages")),1),e("span",at,o(J(a,"max_garages")),1)]),e("div",lt,[e("span",ot,o(t.$t("packages.monthly_credits")),1),e("span",rt,o(J(a,"monthly_free_credits")),1)])])]),e("div",nt,[e("span",it,o(t.$t("packages.tier_level"))+": ",1),e("span",ct,o(a.tier_level),1)]),e("div",dt,[e("button",{onClick:r=>me(a),class:"flex-1 px-4 py-2.5 bg-indigo-600 hover:bg-indigo-500 text-white font-medium rounded-lg transition text-sm"},o(t.$t("packages.edit")),9,ut),e("button",{onClick:r=>ge(a),class:"px-3 py-2.5 bg-emerald-700 hover:bg-emerald-600 text-emerald-200 rounded-lg transition",title:t.$t("packages.duplicate")},[...s[28]||(s[28]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1)])],8,pt),e("button",{onClick:r=>fe(a),class:"px-3 py-2.5 bg-red-700 hover:bg-red-600 text-red-200 rounded-lg transition",title:t.$t("packages.delete")},[...s[29]||(s[29]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,_t)])]))),128))])),d.value?(c(),i("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s[22]||(s[22]=Y(a=>d.value=!1,["self"]))},[e("div",mt,[e("div",ft,[e("h3",gt,o(U.value?t.$t("packages.create_title"):t.$t("packages.edit_title")+": "+I(m.value)),1),e("button",{onClick:s[0]||(s[0]=a=>d.value=!1),class:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"},[...s[30]||(s[30]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),e("div",bt,[(c(),i(j,null,L(A,a=>e("button",{key:a.key,onClick:r=>g.value=a.key,class:q(["px-4 py-3 text-sm font-medium border-b-2 transition",g.value===a.key?"border-indigo-500 text-indigo-300":"border-transparent text-slate-400 hover:text-slate-200 hover:border-slate-500"])},o(a.label),11,xt)),64))]),e("div",yt,[g.value==="basic"?(c(),i("div",vt,[e("div",null,[e("label",ht,o(t.$t("packages.form_name")),1),_(e("input",{"onUpdate:modelValue":s[1]||(s[1]=a=>l.name=a),type:"text",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent",placeholder:t.$t("packages.form_name_placeholder")},null,8,kt),[[b,l.name]])]),e("div",null,[e("label",wt,o(t.$t("packages.form_display_name")),1),_(e("input",{"onUpdate:modelValue":s[2]||(s[2]=a=>l.display_name=a),type:"text",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent",placeholder:t.$t("packages.form_display_name_placeholder")},null,8,$t),[[b,l.display_name]])]),e("div",zt,[e("div",null,[e("label",Ct,o(t.$t("packages.form_type")),1),_(e("select",{"onUpdate:modelValue":s[3]||(s[3]=a=>l.type=a),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},[e("option",Ut,o(t.$t("packages.type_private")),1),e("option",Et,o(t.$t("packages.type_corporate")),1)],512),[[H,l.type]])]),e("div",null,[e("label",Vt,o(t.$t("packages.form_tier_level")),1),_(e("input",{"onUpdate:modelValue":s[4]||(s[4]=a=>l.tier_level=a),type:"number",min:"0",max:"10",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[b,l.tier_level,void 0,{number:!0}]]),e("p",Ft,o(t.$t("packages.form_tier_level_hint")),1)])]),e("div",Dt,[e("div",null,[e("label",Tt,o(t.$t("packages.form_subtitle")),1),_(e("input",{"onUpdate:modelValue":s[5]||(s[5]=a=>l.subtitle=a),type:"text",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent",placeholder:t.$t("packages.form_subtitle_placeholder")},null,8,jt),[[b,l.subtitle]])]),e("div",null,[e("label",Lt,o(t.$t("packages.form_badge")),1),_(e("input",{"onUpdate:modelValue":s[6]||(s[6]=a=>l.badge=a),type:"text",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent",placeholder:t.$t("packages.form_badge_placeholder")},null,8,Rt),[[b,l.badge]])])]),e("div",Pt,[_(e("input",{"onUpdate:modelValue":s[7]||(s[7]=a=>l.is_custom=a),type:"checkbox",id:"is_custom",class:"rounded bg-slate-700 border-slate-600 text-indigo-600 focus:ring-indigo-500"},null,512),[[Z,l.is_custom]]),e("label",At,o(t.$t("packages.form_is_custom")),1)]),e("div",Mt,[e("h4",Bt,o(t.$t("packages.singleton_rules")),1),e("div",Nt,[e("div",It,[_(e("input",{"onUpdate:modelValue":s[8]||(s[8]=a=>l.is_default_fallback=a),type:"checkbox",id:"is_default_fallback",class:"rounded bg-slate-700 border-slate-600 text-amber-500 focus:ring-amber-500"},null,512),[[Z,l.is_default_fallback]]),e("label",St,o(t.$t("packages.form_is_default_fallback")),1)]),e("div",null,[e("label",Ht,o(t.$t("packages.form_trial_days")),1),_(e("input",{"onUpdate:modelValue":s[9]||(s[9]=a=>l.trial_days_on_signup=a),type:"number",min:"0",max:"365",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"},null,512),[[b,l.trial_days_on_signup,void 0,{number:!0}]]),e("p",Zt,o(t.$t("packages.form_trial_days_hint")),1)])])])])):v("",!0),g.value==="pricing"?(c(),i("div",Ot,[e("div",null,[e("h4",Jt,o(t.$t("packages.per_region_pricing")),1),e("div",Gt,[e("table",qt,[e("thead",null,[e("tr",Kt,[s[31]||(s[31]=e("th",{class:"text-left py-2 px-3 text-slate-400 font-medium"},"Region",-1)),e("th",Wt,o(t.$t("packages.form_monthly_price")),1),e("th",Qt,o(t.$t("packages.form_yearly_price")),1),s[32]||(s[32]=e("th",{class:"text-left py-2 px-3 text-slate-400 font-medium"},"Kredit Ár",-1)),e("th",Xt,o(t.$t("packages.form_currency")),1),s[33]||(s[33]=e("th",{class:"text-left py-2 px-3 text-slate-400 font-medium"},null,-1))])]),e("tbody",null,[(c(!0),i(j,null,L(R(h).regions,a=>(c(),i("tr",{key:a.country_code,class:"border-b border-slate-700/50"},[e("td",Yt,[e("span",es,[e("span",null,o(a.country_code),1),e("span",ts,"("+o(a.currency)+", "+o(a.default_vat_rate)+"% VAT)",1)])]),e("td",ss,[e("input",{value:W(a.country_code,"monthly"),onInput:r=>Q(a.country_code,"monthly",r.target.value),type:"number",step:"0.01",min:"0",class:"w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,40,as)]),e("td",ls,[e("input",{value:W(a.country_code,"yearly"),onInput:r=>Q(a.country_code,"yearly",r.target.value),type:"number",step:"0.01",min:"0",class:"w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,40,os)]),e("td",rs,[e("input",{value:oe(a.country_code),onInput:r=>re(a.country_code,r.target.value),type:"number",step:"0.01",min:"0",class:"w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,40,ns)]),e("td",is,[e("input",{value:ne(a.country_code),onInput:r=>ie(a.country_code,r.target.value),type:"text",maxlength:"3",class:"w-full px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent uppercase"},null,40,cs)]),e("td",ds,[e("button",{onClick:r=>le(a.country_code),class:"p-1.5 rounded-lg text-red-400 hover:text-red-300 hover:bg-red-500/10 transition",title:"Remove "+a.country_code},[...s[34]||(s[34]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,us)])]))),128))])])]),e("div",ps,[_(e("select",{"onUpdate:modelValue":s[10]||(s[10]=a=>D.value=a),class:"px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},[e("option",_s,o(t.$t("packages.add_zone_select")),1),(c(!0),i(j,null,L(se.value,a=>(c(),i("option",{key:a.country_code,value:a.country_code},o(a.country_code)+" — "+o(a.name)+" ("+o(a.currency)+", "+o(a.default_vat_rate)+"% VAT) ",9,ms))),128))],512),[[H,D.value]]),e("button",{onClick:ae,disabled:!D.value,class:"px-4 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white text-sm font-medium rounded-lg transition flex items-center gap-2"},[s[35]||(s[35]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1)),S(" "+o(t.$t("packages.add_zone")),1)],8,fs)])]),e("div",gs,[e("h4",bs,"🧮 "+o(t.$t("packages.smart_calculator")),1),e("div",xs,[e("div",ys,[e("div",null,[e("label",vs,o(t.$t("packages.calc_net_price")),1),_(e("input",{"onUpdate:modelValue":s[11]||(s[11]=a=>E.value=a),type:"number",step:"0.01",min:"0",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent",placeholder:"0.00"},null,512),[[b,E.value,void 0,{number:!0}]])]),e("div",null,[e("label",hs,o(t.$t("packages.calc_vat_rate")),1),_(e("select",{"onUpdate:modelValue":s[12]||(s[12]=a=>T.value=a),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"},[(c(!0),i(j,null,L(R(h).regions,a=>(c(),i("option",{key:a.country_code,value:a.default_vat_rate},o(a.country_code)+" — "+o(a.default_vat_rate)+"% ",9,ks))),128))],512),[[H,T.value]])]),e("div",null,[e("label",ws,o(t.$t("packages.calc_currency")),1),_(e("select",{"onUpdate:modelValue":s[13]||(s[13]=a=>V.value=a),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-emerald-500 focus:border-transparent"},[(c(!0),i(j,null,L(R(h).regions,a=>(c(),i("option",{key:a.country_code,value:a.currency},o(a.currency)+" ("+o(a.country_code)+") ",9,$s))),128))],512),[[H,V.value]])])]),e("div",zs,[e("div",Cs,[e("p",Us,o(t.$t("packages.calc_net")),1),e("p",Es,o(R(k)(E.value,V.value)),1)]),e("div",Vs,[e("p",Fs,o(t.$t("packages.calc_vat"))+" ("+o(T.value)+"%)",1),e("p",Ds,o(R(k)(E.value*(T.value/100),V.value)),1)]),e("div",Ts,[e("p",js,o(t.$t("packages.calc_gross")),1),e("p",Ls,o(R(k)(E.value*(1+T.value/100),V.value)),1)])]),e("div",Rs,[e("button",{onClick:ce,class:"px-4 py-2 bg-emerald-600 hover:bg-emerald-500 text-white text-sm font-medium rounded-lg transition flex items-center gap-2"},[s[36]||(s[36]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 10V3L4 14h7v7l9-11h-7z"})],-1)),S(" "+o(t.$t("packages.calc_apply")),1)])])])])])):v("",!0),g.value==="features"?(c(),i("div",Ps,[e("div",null,[e("h4",As,o(t.$t("packages.allowances")),1),e("div",Ms,[e("div",null,[e("label",Bs,o(t.$t("packages.max_vehicles")),1),_(e("input",{"onUpdate:modelValue":s[14]||(s[14]=a=>l.max_vehicles=a),type:"number",min:"0",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[b,l.max_vehicles,void 0,{number:!0}]])]),e("div",null,[e("label",Ns,o(t.$t("packages.max_garages")),1),_(e("input",{"onUpdate:modelValue":s[15]||(s[15]=a=>l.max_garages=a),type:"number",min:"0",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[b,l.max_garages,void 0,{number:!0}]])]),e("div",null,[e("label",Is,o(t.$t("packages.monthly_credits")),1),_(e("input",{"onUpdate:modelValue":s[16]||(s[16]=a=>l.monthly_free_credits=a),type:"number",min:"0",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[b,l.monthly_free_credits,void 0,{number:!0}]])])])]),e("div",Ss,[s[42]||(s[42]=e("h4",{class:"text-sm font-semibold text-slate-300 mb-3"},"SaaS Allowances",-1)),e("div",Hs,[e("div",null,[s[37]||(s[37]=e("label",{class:"block text-xs text-slate-400 mb-1"},"Költségkategória mélység (max_cost_category_depth)",-1)),_(e("input",{"onUpdate:modelValue":s[17]||(s[17]=a=>l.max_cost_category_depth=a),type:"number",min:"0",max:"10",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:ring-2 focus:ring-indigo-500 focus:border-transparent"},null,512),[[b,l.max_cost_category_depth,void 0,{number:!0}]])]),e("div",null,[s[39]||(s[39]=e("label",{class:"block text-xs text-slate-400 mb-1"},"Statisztika (advanced_reports)",-1)),e("div",Zs,[e("label",Os,[_(e("input",{"onUpdate:modelValue":s[18]||(s[18]=a=>l.advanced_reports=a),type:"checkbox",class:"sr-only peer"},null,512),[[Z,l.advanced_reports]]),s[38]||(s[38]=e("div",{class:"w-11 h-6 bg-slate-600 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"},null,-1)),e("span",Js,o(l.advanced_reports?"Enabled":"Disabled"),1)])])]),e("div",null,[s[41]||(s[41]=e("label",{class:"block text-xs text-slate-400 mb-1"},"PDF/CSV Export (export_data)",-1)),e("div",Gs,[e("label",qs,[_(e("input",{"onUpdate:modelValue":s[19]||(s[19]=a=>l.export_data=a),type:"checkbox",class:"sr-only peer"},null,512),[[Z,l.export_data]]),s[40]||(s[40]=e("div",{class:"w-11 h-6 bg-slate-600 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-500 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-indigo-600"},null,-1)),e("span",Ks,o(l.export_data?"Enabled":"Disabled"),1)])])])])]),e("div",Ws,[e("h4",Qs,o(t.$t("packages.feature_capabilities")),1),_(e("textarea",{"onUpdate:modelValue":s[20]||(s[20]=a=>l.feature_capabilities_json=a),rows:"8",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm font-mono focus:ring-2 focus:ring-indigo-500 focus:border-transparent",placeholder:'{\\n "ai_analysis": true,\\n "priority_support": false,\\n "api_access": true\\n}'},null,512),[[b,l.feature_capabilities_json]]),e("p",Xs,o(t.$t("packages.feature_capabilities_hint")),1),M.value?(c(),i("p",Ys,o(M.value),1)):v("",!0)])])):v("",!0)]),e("div",ea,[e("div",ta,o(O.value),1),e("div",sa,[e("button",{onClick:s[21]||(s[21]=a=>d.value=!1),class:"px-4 py-2 text-sm text-slate-400 hover:text-white transition"},o(t.$t("packages.cancel")),1),e("button",{onClick:be,disabled:w.value,class:"px-6 py-2 bg-emerald-600 hover:bg-emerald-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white font-medium rounded-lg transition text-sm flex items-center gap-2"},[w.value?(c(),i("svg",la,[...s[43]||(s[43]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},null,-1)])])):v("",!0),S(" "+o(U.value?t.$t("packages.create"):t.$t("packages.save")),1)],8,aa)])])])])):v("",!0),u.value&&p.value?(c(),i("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s[24]||(s[24]=Y(a=>u.value=!1,["self"]))},[e("div",oa,[e("h3",ra,o(t.$t("packages.delete_title")),1),e("p",na,o(t.$t("packages.delete_confirm",{name:I(p.value)})),1),e("div",ia,[e("button",{onClick:s[23]||(s[23]=a=>u.value=!1),class:"px-4 py-2 text-sm text-slate-400 hover:text-white transition"},o(t.$t("packages.cancel")),1),e("button",{onClick:xe,disabled:w.value,class:"px-6 py-2 bg-red-600 hover:bg-red-500 disabled:bg-slate-600 disabled:cursor-not-allowed text-white font-medium rounded-lg transition text-sm"},o(t.$t("packages.delete_btn")),9,ca)])])])):v("",!0),$.value?(c(),i("div",{key:6,class:q(["fixed bottom-6 right-6 px-5 py-3 rounded-xl shadow-xl text-sm font-medium z-50",$.value.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"])},o($.value.message),3)):v("",!0)]))}});export{pa as default};