Files
service-finder/frontend_admin/.output/public/_nuxt/CyP2oF_M.js
2026-07-08 08:03:57 +00:00

2 lines
9.6 KiB
JavaScript

import{_ as P}from"./DRkNpQ1P.js";import{e as F,f as L,g as N,c as r,a as e,t as o,i as l,F as V,r as R,j as c,x as j,y as S,z as D,A as q,d as i,l as d,h as I,o as a,b as C,w as M}from"./CQHa_U7G.js";import{u as O}from"./DzZn2YD-.js";import{_ as E}from"./DlAUqK2U.js";import"./BJMSi7ez.js";const U={class:"mb-8"},G={class:"text-2xl font-bold text-white"},J={class:"text-slate-400 mt-1"},K={key:0,class:"flex items-center justify-center py-20"},Q={class:"text-slate-400 flex items-center gap-3"},W={key:1,class:"bg-rose-500/10 border border-rose-500/30 rounded-xl p-6 mb-8"},X={class:"text-rose-400"},Y={key:2,class:"space-y-4"},Z={class:"flex items-start justify-between gap-4"},ee={class:"flex-1 min-w-0"},te={class:"flex items-center gap-3 mb-2"},se={class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-amber-500/10 text-amber-400"},oe={class:"text-xs font-mono text-slate-400 bg-slate-700/50 px-2 py-0.5 rounded"},ne={class:"grid grid-cols-2 gap-x-8 gap-y-2 text-sm"},re={key:0,class:"text-slate-300"},ae={class:"text-slate-500"},le={key:1,class:"text-slate-300"},ie={class:"text-slate-500"},de={key:2,class:"text-slate-300"},ce={class:"text-slate-500"},ue={class:"text-slate-300"},pe={class:"text-slate-500"},me={class:"text-amber-400 font-medium ml-1"},ve={key:3,class:"text-slate-300"},he={class:"text-slate-500"},_e={class:"flex flex-col gap-2 flex-shrink-0"},fe=["onClick","disabled"],xe={key:0,class:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},be={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ge=["onClick","disabled"],ke={key:0,class:"bg-slate-800 rounded-xl border border-slate-700 p-12 text-center"},ye={class:"text-lg font-medium text-slate-400 mb-1"},we={class:"text-sm text-slate-500"},$e={class:"bg-slate-800 rounded-xl border border-slate-700 p-6 w-full max-w-lg mx-4 shadow-2xl"},je={class:"text-lg font-semibold text-white mb-2"},Ce={class:"text-sm text-slate-400 mb-6"},Me={class:"mb-4"},Be={class:"block text-sm font-medium text-slate-300 mb-1"},ze=["placeholder"],Te={class:"flex justify-end gap-3"},Ae=["disabled"],He={key:0,class:"w-4 h-4 animate-spin",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pe={key:4,class:"fixed bottom-6 right-6 z-50 bg-emerald-600 text-white px-4 py-3 rounded-lg shadow-lg text-sm flex items-center gap-2 animate-slide-up"},Fe=F({__name:"pending",setup(Le){const{t:m}=L(),{formatDate:B}=O(),k=d(!0),y=d(!1),u=d([]),f=d(""),v=d(null),h=d(!1),p=d(null),_=d(""),x=d(!1);function w(){const s=I("access_token").value;return s?{Authorization:`Bearer ${s}`,"Content-Type":"application/json"}:{"Content-Type":"application/json"}}function b(t){f.value=t,setTimeout(()=>{f.value=""},3e3)}async function $(){k.value=!0,y.value=!1;try{const t=await $fetch("/api/v1/admin/providers?status=pending&limit=100&sort_by=created_at&sort_order=asc",{headers:w()});u.value=t}catch(t){console.error("Failed to fetch pending providers:",t),y.value=!0}finally{k.value=!1}}async function z(t){v.value=t.id;try{await $fetch(`/api/v1/admin/providers/${t.id}/approve`,{method:"POST",headers:w(),body:{reason:"Admin approved via pending queue"}}),b(m("providers.approved_toast",{name:t.name})),u.value=u.value.filter(s=>s.id!==t.id)}catch(s){const g=s?.response?._data?.detail||s?.data?.detail||m("providers.unknown_error");b(m("providers.error_prefix",{detail:g})),console.error("Failed to approve provider:",s)}finally{v.value=null}}function T(t){p.value=t,_.value="",h.value=!0}async function A(){if(p.value){x.value=!0;try{await $fetch(`/api/v1/admin/providers/${p.value.id}/reject`,{method:"POST",headers:w(),body:{reason:_.value||"Admin rejected via pending queue"}}),b(m("providers.rejected_toast",{name:p.value.name})),u.value=u.value.filter(t=>t.id!==p.value.id),h.value=!1,p.value=null}catch(t){const s=t?.response?._data?.detail||t?.data?.detail||m("providers.unknown_error");b(m("providers.error_prefix",{detail:s})),console.error("Failed to reject provider:",t)}finally{x.value=!1}}}return N(()=>{$()}),(t,s)=>{const g=P;return a(),r("div",null,[e("div",U,[e("h1",G,o(t.$t("providers.pending_title")),1),e("p",J,o(t.$t("providers.pending_subtitle")),1)]),l(k)?(a(),r("div",K,[e("div",Q,[s[3]||(s[3]=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,o(t.$t("providers.pending_loading")),1)])])):l(y)?(a(),r("div",W,[e("p",X,o(t.$t("providers.error")),1),e("button",{onClick:$,class:"mt-3 text-sm text-rose-300 hover:text-rose-200 underline"},o(t.$t("providers.retry")),1)])):(a(),r("div",Y,[(a(!0),r(V,null,R(l(u),n=>(a(),r("div",{key:n.id,class:"bg-slate-800 rounded-xl border border-slate-700 p-6 hover:border-amber-500/30 transition"},[e("div",Z,[e("div",ee,[e("div",te,[C(g,{to:`/providers/${n.id}`,class:"text-lg font-semibold text-blue-400 hover:text-blue-300 hover:underline cursor-pointer transition-colors truncate"},{default:M(()=>[i(o(n.name),1)]),_:2},1032,["to"]),e("span",se,o(t.$t("providers.status_pending")),1),e("code",oe,o(n.source),1)]),e("div",ne,[n.address?(a(),r("div",re,[e("span",ae,o(t.$t("providers.label_address")),1),i(" "+o(n.address),1)])):c("",!0),n.city?(a(),r("div",le,[e("span",ie,o(t.$t("providers.label_city")),1),i(" "+o(n.city),1)])):c("",!0),n.category?(a(),r("div",de,[e("span",ce,o(t.$t("providers.label_category")),1),i(" "+o(n.category),1)])):c("",!0),e("div",ue,[e("span",pe,o(t.$t("providers.label_validation_score")),1),e("span",me,o(n.validation_score),1)]),n.created_at?(a(),r("div",ve,[e("span",he,o(t.$t("providers.label_submitted")),1),i(" "+o(l(B)(n.created_at)),1)])):c("",!0)])]),e("div",_e,[e("button",{onClick:H=>z(n),disabled:l(v)===n.id,class:"px-4 py-2 bg-emerald-600 hover:bg-emerald-500 disabled:bg-emerald-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2"},[l(v)===n.id?(a(),r("svg",xe,[...s[4]||(s[4]=[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)])])):(a(),r("svg",be,[...s[5]||(s[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)])])),i(" "+o(t.$t("providers.approve")),1)],8,fe),e("button",{onClick:H=>T(n),disabled:l(v)===n.id,class:"px-4 py-2 bg-rose-600/20 hover:bg-rose-600/40 disabled:opacity-50 text-rose-400 rounded-lg text-sm font-medium transition flex items-center gap-2"},[s[6]||(s[6]=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)),i(" "+o(t.$t("providers.reject")),1)],8,ge),C(g,{to:`/providers/${n.id}`,class:"px-4 py-2 bg-slate-700 hover:bg-slate-600 text-slate-300 rounded-lg text-sm font-medium transition flex items-center gap-2 text-center"},{default:M(()=>[s[7]||(s[7]=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 12a3 3 0 11-6 0 3 3 0 016 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1)),i(" "+o(t.$t("providers.details")),1)]),_:1},8,["to"])])])]))),128)),l(u).length===0?(a(),r("div",ke,[s[8]||(s[8]=e("svg",{class:"w-12 h-12 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":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("h3",ye,o(t.$t("providers.no_pending")),1),e("p",we,o(t.$t("providers.no_pending_subtitle")),1)])):c("",!0)])),l(h)?(a(),r("div",{key:3,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:s[2]||(s[2]=j(n=>h.value=!1,["self"]))},[e("div",$e,[e("h2",je,o(t.$t("providers.reject_modal_title")),1),e("p",Ce,o(t.$t("providers.reject_modal_body",{name:l(p)?.name})),1),e("form",{onSubmit:j(A,["prevent"])},[e("div",Me,[e("label",Be,o(t.$t("providers.reject_reason_label")),1),S(e("textarea",{"onUpdate:modelValue":s[0]||(s[0]=n=>q(_)?_.value=n:null),rows:"3",placeholder:t.$t("providers.reject_reason_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-rose-500/50 focus:border-rose-500 text-sm resize-none"},null,8,ze),[[D,l(_)]])]),e("div",Te,[e("button",{type:"button",onClick:s[1]||(s[1]=n=>h.value=!1),class:"px-4 py-2 text-sm text-slate-400 hover:text-white transition"},o(t.$t("common.cancel")),1),e("button",{type:"submit",disabled:l(x),class:"px-4 py-2 bg-rose-600 hover:bg-rose-500 disabled:bg-rose-600/50 text-white rounded-lg text-sm font-medium transition flex items-center gap-2"},[l(x)?(a(),r("svg",He,[...s[9]||(s[9]=[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)])])):c("",!0),i(" "+o(t.$t("providers.reject")),1)],8,Ae)])],32)])])):c("",!0),l(f)?(a(),r("div",Pe,[s[10]||(s[10]=e("svg",{class:"w-4 h-4 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),i(" "+o(l(f)),1)])):c("",!0)])}}}),qe=E(Fe,[["__scopeId","data-v-7dd923ab"]]);export{qe as default};