2 lines
35 KiB
JavaScript
2 lines
35 KiB
JavaScript
import{e as ve,f as te,o as r,c as n,a as e,k,t as i,F as $,r as S,b as E,j as x,g as Le,d as y,y as w,z,x as I,N as he,L as Z,I as Ve,n as Ae,M as Ie,m as ee,l as v,J as Oe,h as He,D as De,K as Ue,O as Ee,i as We}from"./CQHa_U7G.js";import{_ as Je}from"./Ihs0kuGb.js";import{u as Re,_ as Fe}from"./Dzw8_R8m.js";import{_ as Pe}from"./DlAUqK2U.js";const Xe={class:"flex items-center gap-2 py-1"},Ke={class:"flex items-center gap-2 cursor-pointer flex-1"},qe=["checked"],Ye={class:"text-sm text-slate-300"},Ge={class:"text-xs text-slate-500"},Qe={key:0,class:"ml-6 border-l border-slate-700 pl-3"},be=ve({__name:"TreeNode",props:{node:{},selectedIds:{},expandedIds:{}},emits:["toggle","toggle-expand"],setup(g){let a="hu";try{const p=te();a=p.locale?.value||p.locale||"hu"}catch{}function T(p){return p.name_i18n?.[a]?p.name_i18n[a]:p.name_i18n?.hu?p.name_i18n.hu:p.name_hu?p.name_hu:p.key}return(p,b)=>{const W=be;return r(),n("div",null,[e("div",Xe,[e("button",{onClick:b[0]||(b[0]=j=>p.$emit("toggle-expand",g.node.id)),class:"text-slate-500 hover:text-slate-300 transition w-4 h-4 flex items-center justify-center"},[(r(),n("svg",{class:k(["w-3 h-3 transition-transform",g.expandedIds.has(g.node.id)?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...b[4]||(b[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))]),e("label",Ke,[e("input",{type:"checkbox",checked:g.selectedIds.includes(g.node.id),onChange:b[1]||(b[1]=j=>p.$emit("toggle",g.node.id)),class:"w-4 h-4 rounded border-slate-500 bg-slate-700 text-indigo-500 focus:ring-indigo-500/50"},null,40,qe),e("span",Ye,i(T(g.node)),1),e("span",Ge,"(Szint "+i(g.node.level)+")",1)])]),g.expandedIds.has(g.node.id)&&g.node.children?.length?(r(),n("div",Qe,[(r(!0),n($,null,S(g.node.children,j=>(r(),n("div",{key:j.id},[E(W,{node:j,"selected-ids":g.selectedIds,"expanded-ids":g.expandedIds,onToggle:b[2]||(b[2]=C=>p.$emit("toggle",C)),onToggleExpand:b[3]||(b[3]=C=>p.$emit("toggle-expand",C))},null,8,["node","selected-ids","expanded-ids"])]))),128))])):x("",!0)])}}}),Ze={class:"mb-8"},et={class:"text-2xl font-bold text-white"},tt={class:"text-slate-400 mt-1"},st={key:0,class:"flex items-center justify-center py-20"},ot={class:"text-slate-400 flex items-center gap-3"},lt={key:1,class:"bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8"},it={class:"text-rose-400"},rt={key:2,class:"bg-slate-800 rounded-xl border border-slate-700 p-6"},nt={class:"text-slate-400 text-center py-12"},dt={class:"border-b border-slate-700 mb-6 flex items-center justify-between"},at={class:"flex gap-6 -mb-px"},ut=["onClick"],ct={key:0,class:"max-w-3xl"},pt={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 mb-6"},_t={class:"text-lg font-semibold text-white mb-4"},mt={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},gt={class:"md:col-span-2"},ht={class:"block text-sm font-medium text-slate-300 mb-1"},vt={class:"block text-sm font-medium text-slate-300 mb-1"},bt=["placeholder"],ft={class:"block text-sm font-medium text-slate-300 mb-1"},xt={class:"w-full px-3 py-2 bg-slate-700/50 border border-slate-600 rounded-lg text-slate-400 text-sm"},yt={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 mb-6"},wt={class:"text-lg font-semibold text-white mb-4"},kt={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},$t={class:"block text-sm font-medium text-slate-300 mb-1"},Ct=["placeholder"],zt={class:"block text-sm font-medium text-slate-300 mb-1"},St=["placeholder"],jt={class:"md:col-span-2"},Mt={class:"block text-sm font-medium text-slate-300 mb-1"},Tt=["placeholder"],Bt={key:1,class:"max-w-4xl"},Nt={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 mb-6"},Lt={class:"text-lg font-semibold text-white mb-2"},Vt={class:"text-sm text-slate-400 mb-6"},At={class:"mb-8"},It={class:"text-md font-medium text-white mb-3 flex items-center gap-2"},Ot={class:"text-xs text-slate-500 mb-3"},Ht={class:"grid grid-cols-2 md:grid-cols-4 gap-3"},Dt=["value","checked","onChange"],Ut={class:"text-sm"},Et={class:"mb-8"},Wt={class:"text-md font-medium text-white mb-3 flex items-center gap-2"},Jt={class:"text-xs text-slate-500 mb-3"},Rt={key:0,class:"flex items-center gap-2 text-sm text-slate-400 py-4"},Ft={key:1,class:"space-y-1 max-h-96 overflow-y-auto pr-2"},Pt={class:"flex items-center gap-2 py-1"},Xt=["onClick"],Kt={class:"flex items-center gap-2 cursor-pointer flex-1"},qt=["checked","onChange"],Yt={class:"text-sm font-medium text-white"},Gt={class:"text-xs text-slate-500"},Qt={key:0,class:"ml-6 border-l border-slate-700 pl-3"},Zt={key:2,class:"mt-4 flex flex-wrap gap-2"},es=["onClick"],ts={class:"mb-4"},ss={class:"text-md font-medium text-white mb-3 flex items-center gap-2"},os={class:"text-xs text-slate-500 mb-3"},ls={class:"grid grid-cols-1 md:grid-cols-2 gap-6"},is={class:"block text-sm font-medium text-slate-300 mb-1"},rs={class:"flex flex-wrap gap-2 mb-2"},ns=["onClick"],ds={class:"flex gap-2"},as=["onKeydown","placeholder"],us=["disabled"],cs={class:"block text-sm font-medium text-slate-300 mb-1"},ps={class:"flex flex-wrap gap-2 mb-2"},_s=["onClick"],ms={class:"flex gap-2"},gs=["onKeydown","placeholder"],hs=["disabled"],vs={key:2,class:"max-w-3xl"},bs={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 mb-6"},fs={class:"text-lg font-semibold text-white mb-4"},xs={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},ys={class:"md:col-span-2"},ws={class:"block text-sm font-medium text-slate-300 mb-1"},ks=["placeholder"],$s={class:"md:col-span-2"},Cs={class:"block text-sm font-medium text-slate-300 mb-1"},zs=["placeholder"],Ss={key:3,class:"max-w-3xl"},js={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 mb-6"},Ms={class:"text-lg font-semibold text-white mb-2"},Ts={class:"text-sm text-slate-400 mb-6"},Bs={class:"mb-6 p-4 rounded-lg border bg-indigo-500/5 border-indigo-500/20"},Ns={class:"flex items-center gap-3 cursor-pointer"},Ls={class:"text-sm font-medium text-white"},Vs={class:"text-xs text-slate-400 mt-0.5"},As={class:"flex items-center gap-2 w-36 flex-shrink-0 cursor-pointer"},Is=["checked","onChange","disabled"],Os={class:"text-sm font-medium text-white"},Hs={key:0,class:"flex items-center gap-2"},Ds=["value","onInput","disabled"],Us=["value","onInput","disabled"],Es={key:1,class:"text-sm text-slate-500 italic"},Ws={class:"sticky bottom-0 bg-slate-900/90 backdrop-blur-sm border-t border-slate-700 -mx-6 px-6 py-4 mt-8"},Js={class:"flex items-center justify-between max-w-4xl"},Rs={class:"text-sm text-slate-400"},Fs={key:0,class:"text-amber-400"},Ps={key:1,class:"text-slate-500"},Xs={class:"flex gap-3"},Ks=["disabled"],qs={key:0,class:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ys={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Gs={class:"sticky top-0 z-10 bg-slate-900/95 backdrop-blur-sm border-b border-slate-700 px-6 py-4 flex items-center justify-between"},Qs={class:"flex items-center gap-2"},Zs={class:"text-lg font-semibold text-white"},eo={class:"p-6 space-y-6"},to={class:"flex flex-wrap gap-3"},so={class:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-slate-800 rounded-lg text-xs font-medium"},oo={class:"text-slate-400"},lo={class:"text-cyan-300 font-mono"},io={class:"text-slate-400"},ro={class:"font-semibold"},no={class:"text-sm font-medium text-slate-300 mb-3"},ao={class:"bg-slate-800/50 rounded-lg border border-slate-700 p-4 overflow-x-auto"},uo={key:0},co={class:"text-sm font-medium text-slate-300 mb-3"},po={class:"bg-slate-800/50 rounded-lg border border-slate-700 p-4 overflow-x-auto"},_o={key:1,class:"flex items-start gap-3 p-4 bg-rose-500/10 border border-rose-500/30 rounded-lg"},mo={class:"text-sm font-medium text-rose-300"},go={class:"text-sm text-rose-200/70 mt-0.5"},ho=ve({__name:"edit",setup(g){const{t:a}=te();let T="hu";try{const t=te();T=t.locale?.value||t.locale||"hu"}catch{}function p(t){return t.name_i18n?.[T]?t.name_i18n[T]:t.name_i18n?.hu?t.name_i18n.hu:t.name_hu?t.name_hu:t.key}const b=[{key:"car",label:a("providers.detail_vehicle_class_car")},{key:"motorcycle",label:a("providers.detail_vehicle_class_motorcycle")},{key:"truck",label:a("providers.detail_vehicle_class_truck")},{key:"hgv",label:a("providers.detail_vehicle_class_hgv")},{key:"light_commercial",label:a("providers.detail_vehicle_class_light_commercial")},{key:"personal",label:a("providers.detail_vehicle_class_personal")},{key:"boat",label:a("providers.detail_vehicle_class_boat")},{key:"other",label:a("providers.detail_vehicle_class_other")}],W=Ue(),j=De(),C=ee(()=>Number(W.params.id)),{getCategoryName:fe,getCategoryParentId:xe}=Re(),J=v(!0),R=v(!1),_=v(null),O=v(!1),B=v(null),N=v(!1),F=v(512),P=v(!1);function ye(t){P.value=!0,window.__resizeStartX=t.clientX,window.__resizeStartWidth=F.value,window.addEventListener("mousemove",se),window.addEventListener("mouseup",oe),document.body.style.userSelect="none",document.body.style.cursor="col-resize"}function se(t){if(!P.value)return;const o=window.__resizeStartX,u=window.__resizeStartWidth,d=o-t.clientX,h=u+d,l=window.innerWidth*.8;F.value=Math.max(320,Math.min(l,h))}function oe(){P.value=!1,window.removeEventListener("mousemove",se),window.removeEventListener("mouseup",oe),document.body.style.userSelect="",document.body.style.cursor="",window.__resizeStartX=null,window.__resizeStartWidth=null}const M=v("basic"),we=[{key:"basic",label:a("providers.edit_tab_basic"),icon:"svg"},{key:"matrix",label:a("providers.edit_tab_matrix"),icon:"svg"},{key:"location",label:a("providers.edit_tab_location"),icon:"svg"},{key:"hours",label:a("providers.edit_tab_hours"),icon:"svg"}],le=v([]),X=v(!1),L=v(new Set),V=v(""),A=v(""),s=Oe({name:"",category:"",contact_phone:"",contact_email:"",website:"",plus_code:"",status:"active",supported_vehicle_classes:[],category_ids:[],specializations:{brands:[],propulsion:[]},opening_hours:{},address:{zip:null,city:null,street_name:null,street_type:null,house_number:null,stairwell:null,floor:null,door:null,parcel_id:null,full_address_text:null,latitude:null,longitude:null},is_always_open:!1}),H=[{key:"monday",label:a("providers.detail_day_monday")},{key:"tuesday",label:a("providers.detail_day_tuesday")},{key:"wednesday",label:a("providers.detail_day_wednesday")},{key:"thursday",label:a("providers.detail_day_thursday")},{key:"friday",label:a("providers.detail_day_friday")},{key:"saturday",label:a("providers.detail_day_saturday")},{key:"sunday",label:a("providers.detail_day_sunday")}],ke=ee(()=>{const t=_.value?.trust_score;return t==null?"bg-slate-700 text-slate-400":t>80?"bg-emerald-500/20 text-emerald-400 border border-emerald-500/30":t>50?"bg-amber-500/20 text-amber-400 border border-amber-500/30":"bg-rose-500/20 text-rose-400 border border-rose-500/30"}),ie=ee(()=>{if(!_.value)return!1;const t=_.value;if(s.name!==t.name||s.category!==(t.category||"")||s.contact_phone!==(t.contact_phone||"")||s.contact_email!==(t.contact_email||"")||s.website!==(t.website||"")||s.plus_code!==(t.plus_code||""))return!0;const o=t.supported_vehicle_classes||[];if(JSON.stringify(s.supported_vehicle_classes.slice().sort())!==JSON.stringify([...o].sort()))return!0;const u=t.category_ids||[];if(JSON.stringify(s.category_ids.slice().sort())!==JSON.stringify([...u].sort()))return!0;const d=t.specializations||{},h=s.specializations||{};if(JSON.stringify(h.brands||[])!==JSON.stringify(d.brands||[])||JSON.stringify(h.propulsion||[])!==JSON.stringify(d.propulsion||[]))return!0;const l=t.opening_hours||{},c=s.opening_hours||{},Q=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"];for(const ge of Q){const D=l[ge],U=c[ge];if(!(!D&&!U)&&(!D||!U||D.open!==U.open||D.close!==U.close))return!0}const m=t.address_detail||{},f=s.address;return f.zip!==(m.zip||m.address_zip||null)||f.city!==(m.city||null)||f.street_name!==(m.street_name||m.address_street_name||null)||f.street_type!==(m.street_type||m.address_street_type||null)||f.house_number!==(m.house_number||m.address_house_number||null)||f.stairwell!==(m.stairwell||null)||f.floor!==(m.floor||null)||f.door!==(m.door||null)||f.parcel_id!==(m.parcel_id||null)||f.full_address_text!==(m.full_address_text||null)||f.latitude!==(m.latitude??null)||f.longitude!==(m.longitude??null)});function $e(t){return s.category_ids.includes(t)}function re(t){const o=s.category_ids.indexOf(t);if(o===-1){s.category_ids.push(t);const u=xe(t);u!=null&&!s.category_ids.includes(u)&&(s.category_ids.push(u),console.log("P0 AUTO-PARENT: Child category #"+t+" selected, auto-added parent #"+u))}else s.category_ids.splice(o,1)}function Ce(t){const o=s.category_ids.indexOf(t);o!==-1&&s.category_ids.splice(o,1)}function ne(t){const o=new Set(L.value);o.has(t)?o.delete(t):o.add(t),L.value=o}function ze(t){const o=s.supported_vehicle_classes.indexOf(t);o===-1?s.supported_vehicle_classes.push(t):s.supported_vehicle_classes.splice(o,1)}function de(){const t=V.value.trim();t&&(s.specializations||(s.specializations={brands:[],propulsion:[]}),s.specializations.brands||(s.specializations.brands=[]),s.specializations.brands.push(t),V.value="")}function Se(t){s.specializations?.brands&&s.specializations.brands.splice(t,1)}function ae(){const t=A.value.trim();t&&(s.specializations||(s.specializations={brands:[],propulsion:[]}),s.specializations.propulsion||(s.specializations.propulsion=[]),s.specializations.propulsion.push(t),A.value="")}function je(t){s.specializations?.propulsion&&s.specializations.propulsion.splice(t,1)}function Me(t){s.opening_hours[t]?delete s.opening_hours[t]:s.opening_hours[t]={open:"08:00",close:"17:00"}}function ue(t,o,u){s.opening_hours[t]||(s.opening_hours[t]={open:"08:00",close:"17:00"}),s.opening_hours[t][o]=u}function ce(t,o){for(const u of H)s.opening_hours[u.key]={open:t,close:o}}function Te(){const t=prompt(a("providers.edit_copy_weekdays_open_prompt"),"08:00");if(!t)return;const o=prompt(a("providers.edit_copy_weekdays_close_prompt"),"17:00");if(!o)return;const u=["monday","tuesday","wednesday","thursday","friday"];for(const d of u)s.opening_hours[d]={open:t,close:o}}function pe(){for(const t of H)delete s.opening_hours[t.key]}function Be(){s.is_always_open?ce("00:00","23:59"):pe()}function K(){const t=He("access_token").value,o={"Content-Type":"application/json"};return t&&(o.Authorization=`Bearer ${t}`),o}async function _e(){J.value=!0,R.value=!1;try{const t=await $fetch(`/api/v1/admin/providers/${C.value}`,{headers:K()});_.value=t,me(t)}catch(t){console.error("Failed to fetch provider:",t),R.value=!0}finally{J.value=!1}}async function Ne(){X.value=!0;try{const t=await $fetch("/api/v1/providers/categories/tree",{headers:K()});le.value=t}catch(t){console.error("Failed to fetch category tree:",t)}finally{X.value=!1}}function me(t){s.name=t.name||"",s.category=t.category||"",s.contact_phone=t.contact_phone||"",s.contact_email=t.contact_email||"",s.website=t.website||"",s.plus_code=t.plus_code||"",s.status=t.status||"active",s.supported_vehicle_classes=[...t.supported_vehicle_classes||[]],s.category_ids=[...t.category_ids||[]];const o=t.specializations||{};s.specializations.brands=Array.isArray(o.brands)?[...o.brands]:[],s.specializations.propulsion=Array.isArray(o.propulsion)?[...o.propulsion]:[];const u=t.opening_hours||{};for(const h of Object.keys(s.opening_hours))delete s.opening_hours[h];for(const[h,l]of Object.entries(u))s.opening_hours[h]=l;const d=t.address_detail||{};typeof d=="object"&&!Array.isArray(d)&&(s.address.zip=d.zip||d.address_zip||null,s.address.city=d.city||null,s.address.street_name=d.street_name||d.address_street_name||null,s.address.street_type=d.street_type||d.address_street_type||null,s.address.house_number=d.house_number||d.address_house_number||null,s.address.stairwell=d.stairwell||null,s.address.floor=d.floor||null,s.address.door=d.door||null,s.address.parcel_id=d.parcel_id||null,s.address.full_address_text=d.full_address_text||null,s.address.latitude=d.latitude??null,s.address.longitude=d.longitude??null)}async function q(){O.value=!0;try{const t={};for(const h of H){const l=s.opening_hours[h.key];l&&l.open&&l.close&&(t[h.key]={open:l.open,close:l.close})}const o={name:s.name,category:s.category||null,contact_phone:s.contact_phone||null,contact_email:s.contact_email||null,website:s.website||null,plus_code:s.plus_code||null,supported_vehicle_classes:s.supported_vehicle_classes,category_ids:s.category_ids,specializations:s.specializations,opening_hours:t,address_detail:{zip:s.address.zip,city:s.address.city,street_name:s.address.street_name,street_type:s.address.street_type,house_number:s.address.house_number,stairwell:s.address.stairwell,floor:s.address.floor,door:s.address.door,parcel_id:s.address.parcel_id,full_address_text:s.address.full_address_text,latitude:s.address.latitude,longitude:s.address.longitude}},u=await $fetch(`/api/v1/admin/providers/${C.value}`,{method:"PATCH",headers:K(),body:o});_.value=u,me(u);const d=u.id;d&&Number(d)!==C.value?(G(a("providers.edit_toast_promoted"),"success"),setTimeout(()=>{j.push(`/providers/${d}/edit`)},1500)):(G(a("providers.edit_toast_saved"),"success"),setTimeout(()=>{Y()},1500))}catch(t){console.error("Failed to save provider:",t),G(a("providers.edit_toast_error",{message:t.message}),"error")}finally{O.value=!1}}function Y(){j.push(`/providers/${C.value}`)}function G(t,o){B.value={message:t,type:o},setTimeout(()=>{B.value=null},4e3)}return Le(()=>{_e(),Ne()}),(t,o)=>{const u=be,d=Je,h=Fe;return r(),n("div",null,[e("div",Ze,[e("button",{onClick:Y,class:"inline-flex items-center gap-1.5 text-sm text-slate-400 hover:text-white transition mb-4"},[o[14]||(o[14]=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:"M15 19l-7-7 7-7"})],-1)),y(" "+i(t.$t("providers.edit_back")),1)]),e("h1",et,i(t.$t("providers.edit_title")),1),e("p",tt,i(_.value?.name||t.$t("providers.detail_provider_number",{id:C.value})),1)]),J.value?(r(),n("div",st,[e("div",ot,[o[15]||(o[15]=e("svg",{class:"w-5 h-5 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1)),e("span",null,i(t.$t("providers.edit_loading")),1)])])):R.value?(r(),n("div",lt,[e("p",it,i(t.$t("providers.edit_error")),1),e("button",{onClick:_e,class:"mt-3 text-sm text-rose-300 hover:text-rose-200 underline"},i(t.$t("providers.retry")),1)])):_.value?(r(),n($,{key:3},[e("div",dt,[e("nav",at,[(r(),n($,null,S(we,l=>e("button",{key:l.key,onClick:c=>M.value=l.key,class:k(["pb-3 text-sm font-medium border-b-2 transition flex items-center gap-2",M.value===l.key?"text-indigo-400 border-indigo-400":"text-slate-400 border-transparent hover:text-slate-300"])},[(r(),Z(Ee(l.icon),{class:"w-4 h-4"})),y(" "+i(l.label),1)],10,ut)),64))]),e("button",{onClick:o[0]||(o[0]=l=>N.value=!N.value),class:k(["flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg transition",N.value?"bg-indigo-600 text-white shadow-lg shadow-indigo-500/25":"bg-slate-700 text-slate-300 hover:bg-slate-600 hover:text-white"])},[o[16]||(o[16]=e("svg",{class:"w-3.5 h-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})],-1)),y(" 🤖 "+i(t.$t("providers.edit_raw_data")),1)],2)]),M.value==="basic"?(r(),n("div",ct,[e("form",{onSubmit:I(q,["prevent"])},[e("div",pt,[e("h2",_t,i(t.$t("providers.edit_section_basic")),1),e("div",mt,[e("div",gt,[e("label",ht,i(t.$t("providers.edit_field_name")),1),w(e("input",{"onUpdate:modelValue":o[1]||(o[1]=l=>s.name=l),required:"",class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,512),[[z,s.name]])]),e("div",null,[e("label",vt,i(t.$t("providers.edit_field_category")),1),w(e("input",{"onUpdate:modelValue":o[2]||(o[2]=l=>s.category=l),placeholder:t.$t("providers.edit_field_category_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,bt),[[z,s.category]])]),e("div",null,[e("label",ft,i(t.$t("providers.edit_field_source")),1),e("div",xt,i(_.value.source),1)])])]),e("div",yt,[e("h2",wt,i(t.$t("providers.edit_section_contact")),1),e("div",kt,[e("div",null,[e("label",$t,i(t.$t("providers.edit_field_phone")),1),w(e("input",{"onUpdate:modelValue":o[3]||(o[3]=l=>s.contact_phone=l),placeholder:t.$t("providers.edit_field_phone_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,Ct),[[z,s.contact_phone]])]),e("div",null,[e("label",zt,i(t.$t("providers.edit_field_email")),1),w(e("input",{"onUpdate:modelValue":o[4]||(o[4]=l=>s.contact_email=l),type:"email",placeholder:t.$t("providers.edit_field_email_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,St),[[z,s.contact_email]])]),e("div",jt,[e("label",Mt,i(t.$t("providers.edit_field_website")),1),w(e("input",{"onUpdate:modelValue":o[5]||(o[5]=l=>s.website=l),placeholder:t.$t("providers.edit_field_website_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,Tt),[[z,s.website]])])])])],32)])):x("",!0),M.value==="matrix"?(r(),n("div",Bt,[e("div",Nt,[e("h2",Lt,i(t.$t("providers.edit_section_matrix")),1),e("p",Vt,i(t.$t("providers.edit_section_matrix_desc")),1),e("div",At,[e("h3",It,[o[17]||(o[17]=e("span",{class:"w-6 h-6 rounded-full bg-indigo-500/20 text-indigo-400 flex items-center justify-center text-xs font-bold"},"A",-1)),y(" "+i(t.$t("providers.edit_section_vehicle_classes")),1)]),e("p",Ot,i(t.$t("providers.edit_section_vehicle_classes_desc")),1),e("div",Ht,[(r(),n($,null,S(b,l=>e("label",{key:l.key,class:k(["flex items-center gap-3 p-3 rounded-lg border cursor-pointer transition",s.supported_vehicle_classes.includes(l.key)?"bg-indigo-500/10 border-indigo-500/40 text-indigo-300":"bg-slate-700/50 border-slate-600 hover:border-slate-500 text-slate-300"])},[e("input",{type:"checkbox",value:l.key,checked:s.supported_vehicle_classes.includes(l.key),onChange:c=>ze(l.key),class:"w-4 h-4 rounded border-slate-500 bg-slate-700 text-indigo-500 focus:ring-indigo-500/50"},null,40,Dt),e("span",Ut,i(l.label),1)],2)),64))])]),e("div",Et,[e("h3",Wt,[o[18]||(o[18]=e("span",{class:"w-6 h-6 rounded-full bg-emerald-500/20 text-emerald-400 flex items-center justify-center text-xs font-bold"},"B",-1)),y(" "+i(t.$t("providers.edit_section_expertise_tags")),1)]),e("p",Jt,i(t.$t("providers.edit_section_expertise_tags_desc")),1),X.value?(r(),n("div",Rt,[o[19]||(o[19]=e("svg",{class:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})],-1)),e("span",null,i(t.$t("providers.edit_categories_loading")),1)])):(r(),n("div",Ft,[(r(!0),n($,null,S(le.value,l=>(r(),n("div",{key:l.id,class:"ml-0"},[e("div",Pt,[e("button",{onClick:c=>ne(l.id),class:"text-slate-500 hover:text-slate-300 transition w-4 h-4 flex items-center justify-center"},[(r(),n("svg",{class:k(["w-3 h-3 transition-transform",L.value.has(l.id)?"rotate-90":""]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...o[20]||(o[20]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))],8,Xt),e("label",Kt,[e("input",{type:"checkbox",checked:$e(l.id),onChange:c=>re(l.id),class:"w-4 h-4 rounded border-slate-500 bg-slate-700 text-indigo-500 focus:ring-indigo-500/50"},null,40,qt),e("span",Yt,i(p(l)),1),e("span",Gt,i(t.$t("providers.edit_level_label",{level:l.level})),1)])]),L.value.has(l.id)&&l.children?.length?(r(),n("div",Qt,[(r(!0),n($,null,S(l.children,c=>(r(),n("div",{key:c.id},[E(u,{node:c,"selected-ids":s.category_ids,"expanded-ids":L.value,onToggle:re,onToggleExpand:ne},null,8,["node","selected-ids","expanded-ids"])]))),128))])):x("",!0)]))),128))])),s.category_ids.length>0?(r(),n("div",Zt,[(r(!0),n($,null,S(s.category_ids,l=>(r(),n("span",{key:l,class:"inline-flex items-center gap-1 px-2 py-1 bg-indigo-500/10 text-indigo-300 rounded-full text-xs"},[y(i(We(fe)(l))+" ",1),e("button",{onClick:c=>Ce(l),class:"hover:text-white transition"},[...o[21]||(o[21]=[e("svg",{class:"w-3 h-3",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)])],8,es)]))),128))])):x("",!0)]),e("div",ts,[e("h3",ss,[o[22]||(o[22]=e("span",{class:"w-6 h-6 rounded-full bg-amber-500/20 text-amber-400 flex items-center justify-center text-xs font-bold"},"C",-1)),y(" "+i(t.$t("providers.edit_section_specializations")),1)]),e("p",os,i(t.$t("providers.edit_section_specializations_desc")),1),e("div",ls,[e("div",null,[e("label",is,i(t.$t("providers.edit_field_brands")),1),e("div",rs,[(r(!0),n($,null,S(s.specializations?.brands||[],(l,c)=>(r(),n("span",{key:c,class:"inline-flex items-center gap-1 px-2 py-1 bg-amber-500/10 text-amber-300 rounded-full text-xs"},[y(i(l)+" ",1),e("button",{onClick:Q=>Se(c),class:"hover:text-white transition"},[...o[23]||(o[23]=[e("svg",{class:"w-3 h-3",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)])],8,ns)]))),128))]),e("div",ds,[w(e("input",{"onUpdate:modelValue":o[6]||(o[6]=l=>V.value=l),onKeydown:he(I(de,["prevent"]),["enter"]),placeholder:t.$t("providers.edit_field_brands_placeholder"),class:"flex-1 px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,40,as),[[z,V.value]]),e("button",{onClick:de,disabled:!V.value.trim(),class:"px-3 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:bg-indigo-600/50 text-white rounded-lg text-sm transition"},i(t.$t("providers.edit_field_add")),9,us)])]),e("div",null,[e("label",cs,i(t.$t("providers.edit_field_propulsion")),1),e("div",ps,[(r(!0),n($,null,S(s.specializations?.propulsion||[],(l,c)=>(r(),n("span",{key:c,class:"inline-flex items-center gap-1 px-2 py-1 bg-emerald-500/10 text-emerald-300 rounded-full text-xs"},[y(i(l)+" ",1),e("button",{onClick:Q=>je(c),class:"hover:text-white transition"},[...o[24]||(o[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:"M6 18L18 6M6 6l12 12"})],-1)])],8,_s)]))),128))]),e("div",ms,[w(e("input",{"onUpdate:modelValue":o[7]||(o[7]=l=>A.value=l),onKeydown:he(I(ae,["prevent"]),["enter"]),placeholder:t.$t("providers.edit_field_propulsion_placeholder"),class:"flex-1 px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,40,gs),[[z,A.value]]),e("button",{onClick:ae,disabled:!A.value.trim(),class:"px-3 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:bg-indigo-600/50 text-white rounded-lg text-sm transition"},i(t.$t("providers.edit_field_add")),9,hs)])])])])])])):x("",!0),M.value==="location"?(r(),n("div",vs,[e("form",{onSubmit:I(q,["prevent"])},[s.address?(r(),Z(d,{key:0,modelValue:s.address,"onUpdate:modelValue":o[8]||(o[8]=l=>s.address=l)},null,8,["modelValue"])):x("",!0),e("div",bs,[e("h2",fs,i(t.$t("providers.edit_section_location_extra")),1),e("div",xs,[e("div",ys,[e("label",ws,i(t.$t("providers.edit_field_full_address")),1),w(e("input",{"onUpdate:modelValue":o[9]||(o[9]=l=>s.address.full_address_text=l),placeholder:t.$t("providers.edit_field_full_address_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,ks),[[z,s.address.full_address_text]])]),e("div",$s,[e("label",Cs,i(t.$t("providers.edit_field_plus_code")),1),w(e("input",{"onUpdate:modelValue":o[10]||(o[10]=l=>s.plus_code=l),placeholder:t.$t("providers.edit_field_plus_code_placeholder"),class:"w-full px-3 py-2 bg-slate-700 border border-slate-600 rounded-lg text-white placeholder-slate-500 focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 text-sm"},null,8,zs),[[z,s.plus_code]])])])])],32)])):x("",!0),M.value==="hours"?(r(),n("div",Ss,[e("div",js,[e("h2",Ms,i(t.$t("providers.edit_section_opening_hours")),1),e("p",Ts,i(t.$t("providers.edit_section_opening_hours_desc")),1),e("div",Bs,[e("label",Ns,[w(e("input",{type:"checkbox","onUpdate:modelValue":o[11]||(o[11]=l=>s.is_always_open=l),onChange:Be,class:"w-5 h-5 rounded border-slate-500 bg-slate-700 text-indigo-500 focus:ring-indigo-500/50"},null,544),[[Ve,s.is_always_open]]),e("div",null,[e("span",Ls,i(t.$t("providers.edit_always_open")),1),e("p",Vs,i(t.$t("providers.edit_always_open_desc")),1)])])]),e("div",{class:k(["flex flex-wrap gap-2 mb-6",{"opacity-50 pointer-events-none":s.is_always_open}])},[e("button",{onClick:o[12]||(o[12]=l=>ce("00:00","23:59")),class:"px-3 py-1.5 text-xs font-medium rounded-lg border border-emerald-600/30 text-emerald-400 hover:bg-emerald-600/10 transition"},i(t.$t("providers.edit_btn_24_7")),1),e("button",{onClick:Te,class:"px-3 py-1.5 text-xs font-medium rounded-lg border border-indigo-600/30 text-indigo-400 hover:bg-indigo-600/10"},i(t.$t("providers.edit_btn_copy_weekdays")),1),e("button",{onClick:pe,class:"px-3 py-1.5 text-xs font-medium rounded-lg border border-rose-600/30 text-rose-400 hover:bg-rose-600/10"},i(t.$t("providers.edit_btn_clear_all")),1)],2),e("div",{class:k(["space-y-3",{"opacity-50 pointer-events-none":s.is_always_open}])},[(r(),n($,null,S(H,l=>e("div",{key:l.key,class:k(["flex items-center gap-4 p-4 rounded-lg border",s.opening_hours?.[l.key]?"bg-indigo-500/5 border-indigo-500/20":"bg-slate-700/30 border-slate-600"])},[e("label",As,[e("input",{type:"checkbox",checked:!!s.opening_hours?.[l.key],onChange:c=>Me(l.key),disabled:s.is_always_open,class:"w-4 h-4 rounded border-slate-500 bg-slate-700 text-indigo-500 focus:ring-indigo-500/50"},null,40,Is),e("span",Os,i(l.label),1)]),s.opening_hours?.[l.key]?(r(),n("div",Hs,[e("input",{type:"time",value:s.opening_hours?.[l.key]?.open||"08:00",onInput:c=>ue(l.key,"open",c.target.value),disabled:s.is_always_open,class:"w-28 px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 disabled:opacity-50"},null,40,Ds),o[25]||(o[25]=e("span",{class:"text-slate-500 text-sm"},"–",-1)),e("input",{type:"time",value:s.opening_hours?.[l.key]?.close||"17:00",onInput:c=>ue(l.key,"close",c.target.value),disabled:s.is_always_open,class:"w-28 px-2 py-1.5 bg-slate-700 border border-slate-600 rounded-lg text-white text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500/50 focus:border-indigo-500 disabled:opacity-50"},null,40,Us)])):(r(),n("span",Es,i(t.$t("providers.edit_closed")),1))],2)),64))],2)])])):x("",!0),e("div",Ws,[e("div",Js,[e("div",Rs,[ie.value?(r(),n("span",Fs,i(t.$t("providers.edit_has_changes")),1)):(r(),n("span",Ps,i(t.$t("providers.edit_no_changes")),1))]),e("div",Xs,[e("button",{onClick:Y,class:"px-4 py-2 text-sm text-slate-400 hover:text-white transition"},i(t.$t("providers.edit_cancel")),1),e("button",{onClick:q,disabled:O.value||!ie.value,class:"px-6 py-2 bg-indigo-600 hover:bg-indigo-500 disabled:bg-indigo-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2"},[O.value?(r(),n("svg",qs,[...o[26]||(o[26]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)])])):(r(),n("svg",Ys,[...o[27]||(o[27]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])),y(" "+i(t.$t("providers.edit_save")),1)],8,Ks)])])])],64)):(r(),n("div",rt,[e("p",nt,i(t.$t("providers.edit_not_found")),1)])),B.value?(r(),n("div",{key:4,class:k(["fixed top-4 right-4 z-50 px-4 py-3 rounded-lg shadow-xl text-sm font-medium transition-all duration-300",B.value.type==="success"?"bg-emerald-600 text-white":"bg-rose-600 text-white"])},i(B.value.message),3)):x("",!0),(r(),Z(Ie,{to:"body"},[N.value?(r(),n("div",{key:0,class:"fixed inset-y-0 right-0 bg-slate-900 border-l border-slate-700 shadow-2xl z-40 overflow-y-auto",style:Ae({width:F.value+"px",minWidth:"320px",maxWidth:"80vw"})},[e("div",{class:"absolute left-0 top-0 bottom-0 w-2 cursor-col-resize hover:bg-primary-500/50 active:bg-primary-500/70 transition-colors z-50 group",onMousedown:I(ye,["prevent"])},[...o[28]||(o[28]=[e("div",{class:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 w-0.5 h-8 rounded-full bg-slate-600 group-hover:bg-primary-400 transition-colors"},null,-1)])],32),e("div",Gs,[e("div",Qs,[o[29]||(o[29]=e("svg",{class:"w-5 h-5 text-indigo-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"})],-1)),e("h2",Zs,"🤖 "+i(t.$t("providers.edit_raw_data")),1)]),e("button",{onClick:o[13]||(o[13]=l=>N.value=!1),class:"p-1.5 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition"},[...o[30]||(o[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",eo,[e("div",to,[e("div",so,[e("span",oo,i(t.$t("providers.edit_source_label")),1),e("code",lo,i(_.value?.source||"—"),1)]),e("div",{class:k(["inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium",ke.value])},[e("span",io,i(t.$t("providers.edit_trust_score_label")),1),e("span",ro,i(_.value?.trust_score??"—"),1)],2)]),e("div",null,[e("h3",no,i(t.$t("providers.edit_raw_data_title")),1),e("div",ao,[E(h,{data:_.value?.raw_data},null,8,["data"])])]),_.value?.audit_trail&&Object.keys(_.value.audit_trail).length>0?(r(),n("div",uo,[e("h3",co,i(t.$t("providers.edit_audit_trail_title")),1),e("div",po,[E(h,{data:_.value?.audit_trail},null,8,["data"])])])):x("",!0),_.value?.rejection_reason?(r(),n("div",_o,[o[31]||(o[31]=e("svg",{class:"w-5 h-5 text-rose-400 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("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-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L4.082 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),e("div",null,[e("p",mo,i(t.$t("providers.edit_rejection_reason_title")),1),e("p",go,i(_.value.rejection_reason),1)])])):x("",!0)])],4)):x("",!0)]))])}}}),yo=Pe(ho,[["__scopeId","data-v-1a169f11"]]);export{yo as default};
|