import{u as w}from"./useAuthAbilities-ChsiVvyF.js";import{_ as A}from"./AppLayout.vue_vue_type_script_setup_true_lang-C-UlPCqH.js";import{d as D,a5 as $,m as p,o as r,a,b as m,e as d,h as j,w as y,f as e,t as i,j as u,l as C,i as N,F as b,D as f}from"./app-D9-EssCM.js";import"./index-CcjNLu6f.js";import"./index-CMWG4mbA.js";import"./useForwardExpose-MNmriUeS.js";import"./VisuallyHidden-DG35s1YI.js";import"./RovingFocusGroup-Diffidi3.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./x-DwmBYYXD.js";import"./_plugin-vue_export-helper-DmjF0He4.js";const R={class:"space-y-6 p-4"},B={class:"flex flex-wrap items-start justify-between gap-3"},T={class:"text-2xl font-semibold text-gray-900"},V={class:"text-sm text-gray-600"},F={key:0,class:"mt-2 inline-flex rounded-full bg-green-100 px-2.5 py-0.5 text-xs font-medium text-green-800"},S={key:1,class:"mt-2 inline-flex rounded-full bg-gray-200 px-2.5 py-0.5 text-xs font-medium text-gray-800"},q={class:"grid gap-4 md:grid-cols-2"},E={class:"rounded-lg border border-gray-200 bg-white p-4 shadow-sm"},H={class:"space-y-2 text-sm"},L={class:"flex justify-between gap-4"},U={class:"text-right text-gray-900"},Y={class:"flex justify-between gap-4"},Z={class:"text-right text-gray-900"},z={key:0,class:"flex justify-between gap-4"},G={class:"text-right text-gray-900"},I={class:"rounded-lg border border-gray-200 bg-white p-4 shadow-sm"},J={class:"font-medium text-gray-900"},K={class:"text-sm text-gray-600"},M={key:1,class:"text-sm text-gray-500"},O={key:0,class:"flex flex-wrap gap-3 rounded-lg border border-gray-200 bg-gray-50 p-4"},P={key:1,class:"rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900"},ne=D({__name:"Show",props:{user:{}},setup(x){const o=x,{formatDateTime:c}=$(),g=w("registered-users","approve"),l=p(()=>o.user.approval_status==="approved"),n=p(()=>o.user.approval_status==="deactivated"),v=p(()=>`/registered-users/registered${n.value?"?account_filter=deactivated":""}`),_=p(()=>[{title:"Registered Users",href:"/registered-users"},{title:"Registered users",href:v.value},{title:o.user.name,href:`/registered-users/registered/${o.user.id}`}]),h=()=>{confirm(`Deactivate ${o.user.name}? They will lose Client Zone access until reactivated.`)&&f.post(`/registered-users/${o.user.id}/deactivate`)},k=()=>{f.post(`/registered-users/${o.user.id}/reactivate`)};return(s,t)=>(r(),a(b,null,[m(d(j),{title:`Registered user — ${s.user.name}`},null,8,["title"]),m(A,{breadcrumbs:_.value},{default:y(()=>[e("div",R,[e("div",B,[e("div",null,[e("h1",T,i(s.user.name),1),e("p",V,i(s.user.email),1),l.value?(r(),a("span",F," Active ")):n.value?(r(),a("span",S," Deactivated ")):u("",!0)]),m(d(C),{href:v.value,class:"rounded-md border border-gray-300 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50"},{default:y(()=>[...t[0]||(t[0]=[N(" Back to list ",-1)])]),_:1},8,["href"])]),e("div",q,[e("div",E,[t[4]||(t[4]=e("h2",{class:"mb-3 text-sm font-medium uppercase tracking-wide text-gray-500"},"Account",-1)),e("dl",H,[e("div",L,[t[1]||(t[1]=e("dt",{class:"text-gray-500"},"Registered",-1)),e("dd",U,i(d(c)(s.user.created_at)),1)]),e("div",Y,[t[2]||(t[2]=e("dt",{class:"text-gray-500"},"Approved",-1)),e("dd",Z,i(s.user.approved_at?d(c)(s.user.approved_at):"—"),1)]),s.user.approved_by?(r(),a("div",z,[t[3]||(t[3]=e("dt",{class:"text-gray-500"},"Approved by",-1)),e("dd",G,i(s.user.approved_by.name),1)])):u("",!0)])]),e("div",I,[t[5]||(t[5]=e("h2",{class:"mb-3 text-sm font-medium uppercase tracking-wide text-gray-500"},"Linked customer",-1)),s.user.customer?(r(),a(b,{key:0},[e("p",J,i(s.user.customer.name),1),e("p",K,i(s.user.customer.email??"—"),1)],64)):(r(),a("p",M,"No customer linked"))])]),d(g)&&(l.value||n.value)?(r(),a("div",O,[l.value?(r(),a("button",{key:0,type:"button",class:"rounded-md bg-gray-800 px-4 py-2 text-sm font-medium text-white hover:bg-gray-900",onClick:h}," Deactivate client user ")):u("",!0),n.value?(r(),a("button",{key:1,type:"button",class:"rounded-md bg-green-600 px-4 py-2 text-sm font-medium text-white hover:bg-green-700",onClick:k}," Reactivate client user ")):u("",!0)])):!d(g)&&(l.value||n.value)?(r(),a("p",P," Your group cannot deactivate or reactivate client users (requires Approve / reject permission). ")):u("",!0)])]),_:1},8,["breadcrumbs"])],64))}});export{ne as default};
