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

6 lines
28 KiB
JavaScript

import{e as de,y as ue,c as r,a as e,t as o,d as H,F as j,r as D,j as K,k as _,v as x,q as O,z as Q,i as y,h as E,n as Z,m as g,x as pe,s as me,A as _e,o as i}from"./CqYPuxVf.js";import{u as X}from"./DWjNh9rV.js";function ge(){const f=X();function $(n,c){const d=f.activeLocale||"en-EU";try{return new Intl.NumberFormat(d,c).format(n)}catch{return new Intl.NumberFormat("en-EU",c).format(n)}}function v(n,c,d){const m=f.activeLocale||"en-EU",u=c||f.activeCurrency||"EUR";try{return new Intl.NumberFormat(m,{style:"currency",currency:u,minimumFractionDigits:2,maximumFractionDigits:2,...d}).format(n)}catch{return`${n.toFixed(2)} ${u}`}}function L(n,c){const d=f.activeLocale||"en-EU",m=f.activeTimezone||"Europe/Brussels",u=typeof n=="string"||typeof n=="number"?new Date(n):n;try{return new Intl.DateTimeFormat(d,{timezone:m,year:"numeric",month:"2-digit",day:"2-digit",...c}).format(u)}catch{return u.toLocaleDateString("en-GB")}}function b(n,c){const d=f.activeLocale||"en-EU",m=f.activeTimezone||"Europe/Brussels",u=typeof n=="string"||typeof n=="number"?new Date(n):n;try{return new Intl.DateTimeFormat(d,{timezone:m,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",...c}).format(u)}catch{return u.toLocaleString("en-GB")}}function A(n,c){const d=f.activeLocale||"en-EU";try{return new Intl.NumberFormat(d,{style:"percent",minimumFractionDigits:0,maximumFractionDigits:1,...c}).format(n/100)}catch{return`${n}%`}}function V(n,c){const d=c??f.activeVatRate??0,m=n*(d/100),u=n+m;return{net:n,vat:m,gross:u,vatRate:d}}function T(n,c,d){const{net:m,vat:u,gross:C,vatRate:h}=V(n,c),k=d||f.activeCurrency||"EUR";return`Net: ${v(m,k)} | VAT: ${v(u,k)} (${h}%) | Gross: ${v(C,k)}`}return{formatNumber:$,formatCurrency:v,formatDate:L,formatDateTime:b,formatPercent:A,calculatePriceWithVat:V,formatPriceWithVat:T}}const fe={class:"mb-8 flex items-center justify-between"},be={class:"text-2xl font-bold text-white"},xe={class:"text-slate-400 mt-1"},ye={key:0,class:"flex items-center justify-center py-20"},ve={class:"flex flex-col items-center gap-3"},he={class:"text-slate-400 text-sm"},ke={key:1,class:"bg-red-900/30 border border-red-700 rounded-xl p-6 text-center"},we={class:"text-red-300 mb-3"},$e={key:2,class:"bg-slate-800/50 border border-slate-700 rounded-xl p-12 text-center"},Ce={class:"text-lg font-medium text-slate-300 mb-2"},Ue={class:"text-slate-500 mb-6"},ze={key:3,class:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6 mb-8"},Ve={class:"flex items-center justify-between mb-4"},Fe={class:"flex items-center gap-3"},Ee=["innerHTML"],Te={class:"text-lg font-semibold text-white"},je={class:"text-xs text-slate-500 font-mono"},De={class:"flex items-center gap-1.5 flex-wrap"},Le={key:0,class:"px-2 py-0.5 text-xs font-semibold rounded-full bg-indigo-500/20 text-indigo-300"},Pe={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"},Me=["title"],Re={class:"mb-4"},Ne={class:"text-3xl font-bold text-white"},Ae={class:"text-sm text-slate-400 ml-1"},Be={class:"text-sm text-slate-400 mb-4 flex-1"},Ie={class:"border-t border-slate-700 pt-4 mb-4"},Se={class:"text-xs font-semibold uppercase tracking-wider text-slate-500 mb-3"},He={class:"space-y-2"},Oe={class:"flex items-center justify-between text-sm"},Ze={class:"text-slate-400"},Ge={class:"text-slate-200 font-medium"},Je={class:"flex items-center justify-between text-sm"},qe={class:"text-slate-400"},We={class:"text-slate-200 font-medium"},Ke={class:"flex items-center justify-between text-sm"},Qe={class:"text-slate-400"},Xe={class:"text-slate-200 font-medium"},Ye={class:"mb-4"},et={class:"text-xs text-slate-500"},tt={class:"text-xs font-mono text-slate-400"},st={class:"flex gap-2"},at=["onClick"],lt=["onClick","title"],ot={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"},nt={class:"flex items-center justify-between px-6 py-4 border-b border-slate-700"},rt={class:"text-lg font-semibold text-white"},it={class:"flex border-b border-slate-700 px-6"},ct=["onClick"],dt={class:"flex-1 overflow-y-auto px-6 py-5"},ut={key:0,class:"space-y-4"},pt={class:"block text-sm font-medium text-slate-300 mb-1"},mt=["placeholder"],_t={class:"block text-sm font-medium text-slate-300 mb-1"},gt=["placeholder"],ft={class:"grid grid-cols-2 gap-4"},bt={class:"block text-sm font-medium text-slate-300 mb-1"},xt={value:"private"},yt={value:"corporate"},vt={class:"block text-sm font-medium text-slate-300 mb-1"},ht={class:"text-xs text-slate-500 mt-1"},kt={class:"grid grid-cols-2 gap-4"},wt={class:"block text-sm font-medium text-slate-300 mb-1"},$t=["placeholder"],Ct={class:"block text-sm font-medium text-slate-300 mb-1"},Ut=["placeholder"],zt={class:"flex items-center gap-3"},Vt={for:"is_custom",class:"text-sm text-slate-300"},Ft={class:"border-t border-slate-700 pt-4"},Et={class:"text-sm font-semibold text-slate-300 mb-3"},Tt={class:"space-y-4"},jt={class:"flex items-center gap-3"},Dt={for:"is_default_fallback",class:"text-sm text-slate-300"},Lt={class:"block text-sm text-slate-300 mb-1"},Pt={class:"text-xs text-slate-500 mt-1"},Mt={key:1,class:"space-y-6"},Rt={class:"text-sm font-semibold text-slate-300 mb-3"},Nt={class:"overflow-x-auto"},At={class:"w-full text-sm"},Bt={class:"border-b border-slate-700"},It={class:"text-left py-2 px-3 text-slate-400 font-medium"},St={class:"text-left py-2 px-3 text-slate-400 font-medium"},Ht={class:"text-left py-2 px-3 text-slate-400 font-medium"},Ot={class:"py-2 px-3 text-slate-200 font-medium"},Zt={class:"inline-flex items-center gap-1.5"},Gt={class:"text-xs text-slate-500"},Jt={class:"py-2 px-3"},qt=["value","onInput"],Wt={class:"py-2 px-3"},Kt=["value","onInput"],Qt={class:"py-2 px-3"},Xt=["value","onInput"],Yt={class:"border-t border-slate-700 pt-5"},es={class:"text-sm font-semibold text-slate-300 mb-3"},ts={class:"bg-slate-700/30 rounded-xl p-4 space-y-4"},ss={class:"grid grid-cols-3 gap-4"},as={class:"block text-xs text-slate-400 mb-1"},ls={class:"block text-xs text-slate-400 mb-1"},os=["value"],ns={class:"block text-xs text-slate-400 mb-1"},rs=["value"],is={class:"grid grid-cols-3 gap-4 pt-2"},cs={class:"bg-slate-800 rounded-lg p-3 text-center"},ds={class:"text-xs text-slate-400 mb-1"},us={class:"text-lg font-bold text-white"},ps={class:"bg-slate-800 rounded-lg p-3 text-center"},ms={class:"text-xs text-slate-400 mb-1"},_s={class:"text-lg font-bold text-amber-400"},gs={class:"bg-slate-800 rounded-lg p-3 text-center ring-2 ring-emerald-500/50"},fs={class:"text-xs text-slate-400 mb-1"},bs={class:"text-lg font-bold text-emerald-400"},xs={class:"flex justify-end pt-1"},ys={key:2,class:"space-y-5"},vs={class:"text-sm font-semibold text-slate-300 mb-3"},hs={class:"grid grid-cols-3 gap-4"},ks={class:"block text-xs text-slate-400 mb-1"},ws={class:"block text-xs text-slate-400 mb-1"},$s={class:"block text-xs text-slate-400 mb-1"},Cs={class:"border-t border-slate-700 pt-4"},Us={class:"text-sm font-semibold text-slate-300 mb-3"},zs={class:"text-xs text-slate-500 mt-1"},Vs={key:0,class:"text-xs text-red-400 mt-1"},Fs={class:"flex items-center justify-between px-6 py-4 border-t border-slate-700"},Es={class:"text-xs text-slate-500"},Ts={class:"flex items-center gap-3"},js=["disabled"],Ds={key:0,class:"animate-spin h-4 w-4",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Ls={class:"bg-slate-800 border border-slate-700 rounded-xl w-full max-w-md mx-4 p-6 shadow-2xl"},Ps={class:"text-lg font-semibold text-white mb-2"},Ms={class:"text-slate-400 text-sm mb-6"},Rs={class:"flex items-center justify-end gap-3"},Ns=["disabled"],Is=de({__name:"index",setup(f){const $=X(),{formatCurrency:v}=ge(),L=[{key:"basic",label:"📋 Basic Info"},{key:"pricing",label:"💰 Pricing"},{key:"features",label:"⚡ Features"}],b=g("basic"),A=pe(()=>{const t=L.find(s=>s.key===b.value);return t?t.label:""}),V=g([]),T=g(!0),n=g(null),c=g(!1),d=g(!1),m=g(null),u=g(null),C=g(!1),h=g(!1),k=g(null),P=g(null),U=g(0),F=g(27),z=g("EUR"),G={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,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=me({...G});function J(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 p=parseFloat(a)||0;l.pricing_zones[t]||(l.pricing_zones[t]={monthly_price:0,yearly_price:0,currency:"EUR"}),s==="monthly"?l.pricing_zones[t].monthly_price=p:l.pricing_zones[t].yearly_price=p}function Y(t){const s=l.pricing_zones[t];return s?s.currency:"EUR"}function ee(t,s){l.pricing_zones[t]||(l.pricing_zones[t]={monthly_price:0,yearly_price:0,currency:"EUR"}),l.pricing_zones[t].currency=s.toUpperCase()}function te(){const t=$.regions.find(a=>a.default_vat_rate===F);if(!t){w("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,currency:t.currency}),l.pricing_zones[s].monthly_price=U,l.pricing_zones[s].currency=z,w("success",`Applied net price ${v(U,z)} to ${s} region`)}function M(){const s=_e("access_token").value;return s?{Authorization:`Bearer ${s}`}:{}}async function R(){T.value=!0,n.value=null;try{const t=await $fetch("/api/v1/admin/packages",{headers:M()});V.value=t.tiers||[]}catch(t){n.value=t?.data?.detail||t?.message||"Failed to load packages",console.error("[Packages] Fetch error:",t)}finally{T.value=!1}}function N(t){return t.rules?.display_name||t.name}function se(t){return t.rules?.marketing?.subtitle||t.rules?.marketing?.badge||""}function ae(t){const s=t.rules?.pricing_zones,a=t.rules?.pricing;if(s&&s.DEFAULT){const p=s.DEFAULT,I=p.currency==="HUF"?"Ft":"€";return`${p.monthly_price} ${I}`}if(a){const p=a.currency==="HUF"?"Ft":"€";return`${a.monthly_price} ${p}`}return"—"}function B(t,s){const a=t.rules?.allowances;return a?a[s]??"—":"—"}function le(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 oe(t){return t>=2?"🏢":t>=1?"⭐":"🔓"}function W(){C.value=!0,m.value=null,b.value="basic",Object.assign(l,G),c.value=!0}function ne(t){C.value=!1,m.value=t,b.value="basic";const s=t.rules||{},a=s.pricing_zones?.DEFAULT||s.pricing||{},p=s.allowances||{};if(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=p.max_vehicles||1,l.max_garages=p.max_garages||1,l.monthly_free_credits=p.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,l.pricing_zones={},s.pricing_zones)for(const[I,S]of Object.entries(s.pricing_zones))l.pricing_zones[I]={monthly_price:S.monthly_price||0,yearly_price:S.yearly_price||0,currency:S.currency||"EUR"};l.feature_capabilities_json=JSON.stringify(t.feature_capabilities||{},null,2),c.value=!0}function re(t){u.value=t,d.value=!0}async function ie(){if(!l.name.trim()){w("error","Package name is required");return}let t={};try{t=JSON.parse(l.feature_capabilities_json),P.value=null}catch{P.value="Invalid JSON in feature capabilities",b.value="features";return}h.value=!0;try{const s={...l.pricing_zones};s.DEFAULT||(s.DEFAULT={monthly_price:l.monthly_price,yearly_price:l.yearly_price,currency:l.currency.toUpperCase()});const a={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}};C.value?(await $fetch("/api/v1/admin/packages",{method:"POST",headers:{...M(),"Content-Type":"application/json"},body:{name:l.name.trim().toLowerCase(),rules:a,is_custom:l.is_custom,tier_level:l.tier_level,feature_capabilities:t,is_default_fallback:l.is_default_fallback,trial_days_on_signup:l.trial_days_on_signup}}),w("success",`Package "${l.name}" created successfully`)):m.value&&(await $fetch(`/api/v1/admin/packages/${m.value.id}`,{method:"PATCH",headers:{...M(),"Content-Type":"application/json"},body:{name:l.name.trim().toLowerCase(),rules:a,is_custom:l.is_custom,tier_level:l.tier_level,feature_capabilities:t,is_default_fallback:l.is_default_fallback,trial_days_on_signup:l.trial_days_on_signup}}),w("success",`Package "${l.name}" updated successfully`)),c.value=!1,await R()}catch(s){const a=s?.data?.detail||s?.message||"Operation failed";w("error",a),console.error("[Packages] Save error:",s)}finally{h.value=!1}}async function ce(){if(u.value){h.value=!0;try{await $fetch(`/api/v1/admin/packages/${u.value.id}`,{method:"DELETE",headers:M()}),w("success",`Package "${N(u.value)}" deactivated`),d.value=!1,u.value=null,await R()}catch(t){const s=t?.data?.detail||t?.message||"Delete failed";w("error",s),console.error("[Packages] Delete error:",t)}finally{h.value=!1}}}function w(t,s){k.value={type:t,message:s},setTimeout(()=>{k.value=null},4e3)}return ue(()=>{R(),$.fetchRegions()}),(t,s)=>(i(),r("div",null,[e("div",fe,[e("div",null,[e("h1",be,o(t.$t("packages.title")),1),e("p",xe,o(t.$t("packages.subtitle")),1)]),e("button",{onClick:W,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[21]||(s[21]=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)),H(" "+o(t.$t("packages.create_new")),1)])]),T.value?(i(),r("div",ye,[e("div",ve,[s[22]||(s[22]=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",he,o(t.$t("packages.loading")),1)])])):n.value?(i(),r("div",ke,[e("p",we,o(n.value),1),e("button",{onClick:R,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)])):V.value.length===0?(i(),r("div",$e,[s[23]||(s[23]=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",Ce,o(t.$t("packages.no_packages")),1),e("p",Ue,o(t.$t("packages.no_packages_desc")),1),e("button",{onClick:W,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)])):(i(),r("div",ze,[(i(!0),r(j,null,D(V.value,a=>(i(),r("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",Ve,[e("div",Fe,[e("div",{class:Z(["p-2 rounded-lg",le(a.tier_level)])},[e("span",{class:"w-5 h-5 text-lg",innerHTML:oe(a.tier_level)},null,8,Ee)],2),e("div",null,[e("h2",Te,o(N(a)),1),e("span",je,o(a.name),1)])]),e("div",De,[a.tier_level>=1?(i(),r("span",Le,o(t.$t("packages.popular")),1)):y("",!0),a.is_default_fallback?(i(),r("span",Pe," 🔒 "+o(t.$t("packages.fallback_badge")),1)):y("",!0),a.trial_days_on_signup>0?(i(),r("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,Me)):y("",!0)])]),e("div",Re,[e("span",Ne,o(ae(a)),1),e("span",Ae,"/ "+o(t.$t("packages.month")),1)]),e("p",Be,o(se(a)),1),e("div",Ie,[e("h3",Se,o(t.$t("packages.allowances")),1),e("div",He,[e("div",Oe,[e("span",Ze,o(t.$t("packages.max_vehicles")),1),e("span",Ge,o(B(a,"max_vehicles")),1)]),e("div",Je,[e("span",qe,o(t.$t("packages.max_garages")),1),e("span",We,o(B(a,"max_garages")),1)]),e("div",Ke,[e("span",Qe,o(t.$t("packages.monthly_credits")),1),e("span",Xe,o(B(a,"monthly_free_credits")),1)])])]),e("div",Ye,[e("span",et,o(t.$t("packages.tier_level"))+": ",1),e("span",tt,o(a.tier_level),1)]),e("div",st,[e("button",{onClick:p=>ne(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,at),e("button",{onClick:p=>re(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[24]||(s[24]=[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,lt)])]))),128))])),c.value?(i(),r("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s[18]||(s[18]=K(a=>c.value=!1,["self"]))},[e("div",ot,[e("div",nt,[e("h3",rt,o(C.value?t.$t("packages.create_title"):t.$t("packages.edit_title")+": "+N(m.value)),1),e("button",{onClick:s[0]||(s[0]=a=>c.value=!1),class:"p-1 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"},[...s[25]||(s[25]=[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",it,[(i(),r(j,null,D(L,a=>e("button",{key:a.key,onClick:p=>b.value=a.key,class:Z(["px-4 py-3 text-sm font-medium border-b-2 transition",b.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,ct)),64))]),e("div",dt,[b.value==="basic"?(i(),r("div",ut,[e("div",null,[e("label",pt,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,mt),[[x,l.name]])]),e("div",null,[e("label",_t,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,gt),[[x,l.display_name]])]),e("div",ft,[e("div",null,[e("label",bt,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",xt,o(t.$t("packages.type_private")),1),e("option",yt,o(t.$t("packages.type_corporate")),1)],512),[[O,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),[[x,l.tier_level,void 0,{number:!0}]]),e("p",ht,o(t.$t("packages.form_tier_level_hint")),1)])]),e("div",kt,[e("div",null,[e("label",wt,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,$t),[[x,l.subtitle]])]),e("div",null,[e("label",Ct,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,Ut),[[x,l.badge]])])]),e("div",zt,[_(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),[[Q,l.is_custom]]),e("label",Vt,o(t.$t("packages.form_is_custom")),1)]),e("div",Ft,[e("h4",Et,o(t.$t("packages.singleton_rules")),1),e("div",Tt,[e("div",jt,[_(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),[[Q,l.is_default_fallback]]),e("label",Dt,o(t.$t("packages.form_is_default_fallback")),1)]),e("div",null,[e("label",Lt,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),[[x,l.trial_days_on_signup,void 0,{number:!0}]]),e("p",Pt,o(t.$t("packages.form_trial_days_hint")),1)])])])])):y("",!0),b.value==="pricing"?(i(),r("div",Mt,[e("div",null,[e("h4",Rt,o(t.$t("packages.per_region_pricing")),1),e("div",Nt,[e("table",At,[e("thead",null,[e("tr",Bt,[s[26]||(s[26]=e("th",{class:"text-left py-2 px-3 text-slate-400 font-medium"},"Region",-1)),e("th",It,o(t.$t("packages.form_monthly_price")),1),e("th",St,o(t.$t("packages.form_yearly_price")),1),e("th",Ht,o(t.$t("packages.form_currency")),1)])]),e("tbody",null,[(i(!0),r(j,null,D(E($).regions,a=>(i(),r("tr",{key:a.country_code,class:"border-b border-slate-700/50"},[e("td",Ot,[e("span",Zt,[e("span",null,o(a.country_code),1),e("span",Gt,"("+o(a.currency)+", "+o(a.default_vat_rate)+"% VAT)",1)])]),e("td",Jt,[e("input",{value:J(a.country_code,"monthly"),onInput:p=>q(a.country_code,"monthly",p.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,qt)]),e("td",Wt,[e("input",{value:J(a.country_code,"yearly"),onInput:p=>q(a.country_code,"yearly",p.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,Kt)]),e("td",Qt,[e("input",{value:Y(a.country_code),onInput:p=>ee(a.country_code,p.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,Xt)])]))),128))])])])]),e("div",Yt,[e("h4",es,"🧮 "+o(t.$t("packages.smart_calculator")),1),e("div",ts,[e("div",ss,[e("div",null,[e("label",as,o(t.$t("packages.calc_net_price")),1),_(e("input",{"onUpdate:modelValue":s[10]||(s[10]=a=>U.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),[[x,U.value,void 0,{number:!0}]])]),e("div",null,[e("label",ls,o(t.$t("packages.calc_vat_rate")),1),_(e("select",{"onUpdate:modelValue":s[11]||(s[11]=a=>F.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"},[(i(!0),r(j,null,D(E($).regions,a=>(i(),r("option",{key:a.country_code,value:a.default_vat_rate},o(a.country_code)+" — "+o(a.default_vat_rate)+"% ",9,os))),128))],512),[[O,F.value]])]),e("div",null,[e("label",ns,o(t.$t("packages.calc_currency")),1),_(e("select",{"onUpdate:modelValue":s[12]||(s[12]=a=>z.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"},[(i(!0),r(j,null,D(E($).regions,a=>(i(),r("option",{key:a.country_code,value:a.currency},o(a.currency)+" ("+o(a.country_code)+") ",9,rs))),128))],512),[[O,z.value]])])]),e("div",is,[e("div",cs,[e("p",ds,o(t.$t("packages.calc_net")),1),e("p",us,o(E(v)(U.value,z.value)),1)]),e("div",ps,[e("p",ms,o(t.$t("packages.calc_vat"))+" ("+o(F.value)+"%)",1),e("p",_s,o(E(v)(U.value*(F.value/100),z.value)),1)]),e("div",gs,[e("p",fs,o(t.$t("packages.calc_gross")),1),e("p",bs,o(E(v)(U.value*(1+F.value/100),z.value)),1)])]),e("div",xs,[e("button",{onClick:te,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[27]||(s[27]=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)),H(" "+o(t.$t("packages.calc_apply")),1)])])])])])):y("",!0),b.value==="features"?(i(),r("div",ys,[e("div",null,[e("h4",vs,o(t.$t("packages.allowances")),1),e("div",hs,[e("div",null,[e("label",ks,o(t.$t("packages.max_vehicles")),1),_(e("input",{"onUpdate:modelValue":s[13]||(s[13]=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),[[x,l.max_vehicles,void 0,{number:!0}]])]),e("div",null,[e("label",ws,o(t.$t("packages.max_garages")),1),_(e("input",{"onUpdate:modelValue":s[14]||(s[14]=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),[[x,l.max_garages,void 0,{number:!0}]])]),e("div",null,[e("label",$s,o(t.$t("packages.monthly_credits")),1),_(e("input",{"onUpdate:modelValue":s[15]||(s[15]=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),[[x,l.monthly_free_credits,void 0,{number:!0}]])])])]),e("div",Cs,[e("h4",Us,o(t.$t("packages.feature_capabilities")),1),_(e("textarea",{"onUpdate:modelValue":s[16]||(s[16]=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),[[x,l.feature_capabilities_json]]),e("p",zs,o(t.$t("packages.feature_capabilities_hint")),1),P.value?(i(),r("p",Vs,o(P.value),1)):y("",!0)])])):y("",!0)]),e("div",Fs,[e("div",Es,o(A.value),1),e("div",Ts,[e("button",{onClick:s[17]||(s[17]=a=>c.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:ie,disabled:h.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"},[h.value?(i(),r("svg",Ds,[...s[28]||(s[28]=[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)])])):y("",!0),H(" "+o(C.value?t.$t("packages.create"):t.$t("packages.save")),1)],8,js)])])])])):y("",!0),d.value&&u.value?(i(),r("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:s[20]||(s[20]=K(a=>d.value=!1,["self"]))},[e("div",Ls,[e("h3",Ps,o(t.$t("packages.delete_title")),1),e("p",Ms,o(t.$t("packages.delete_confirm",{name:N(u.value)})),1),e("div",Rs,[e("button",{onClick:s[19]||(s[19]=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:ce,disabled:h.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,Ns)])])])):y("",!0),k.value?(i(),r("div",{key:6,class:Z(["fixed bottom-6 right-6 px-5 py-3 rounded-xl shadow-xl text-sm font-medium z-50",k.value.type==="success"?"bg-emerald-600 text-white":"bg-red-600 text-white"])},o(k.value.message),3)):y("",!0)]))}});export{Is as default};