import{_ as L}from"./Ba76BwjT.js";import{e as S,J as T,K as V,j as z,c as a,a as e,b as p,y as f,z as I,f as d,D as b,N as M,F as U,r as $,i as m,E as B,o as n,t as o,m as F,h as u,d as k,w as P,_ as j}from"./DpdQcRr7.js";import"./BcpEzrWT.js";const E={class:"org-page"},J={class:"org-container"},R={class:"filter-bar"},q={class:"search-input-wrapper"},A={key:0,class:"state-box"},K={key:1,class:"empty-state"},Q={key:2,class:"user-list"},G={class:"user-avatar"},H={class:"user-main"},O={class:"user-name-row"},W={class:"user-name"},X={class:"tag"},Y={class:"tag tag-link"},Z={key:0,class:"tag tag-info"},ee={key:1,class:"user-meta"},se={key:0,class:"user-email"},te={class:"user-meta"},ae={key:0},ne=S({__name:"index",setup(oe){const w={regular:"通常",trial:"体験",short_term:"短期",special:"特別"},x={individual:"個人ユーザー",student:"生徒",instructor:"講師",manager:"教室管理者",owner:"企業管理者",system_admin:"システム管理者"},{$api:C}=T(),_=m([]),v=m(!1),l=m(""),c=m(""),h=async()=>{v.value=!0;try{const i=new URLSearchParams;l.value&&i.append("search",l.value),c.value&&i.append("status",c.value);const t=i.toString(),r=await C(`/api/organization/users${t?`?${t}`:""}`);_.value=r.users}catch(i){console.error("ユーザー一覧の取得に失敗しました:",i)}finally{v.value=!1}},D=()=>{l.value="",c.value="",h()},g=i=>new Date(i).toLocaleDateString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit"});let y=null;return V([l,c],()=>{y&&clearTimeout(y),y=setTimeout(()=>{h()},300)}),z(()=>{h()}),(i,t)=>{const r=B("Icon"),N=L;return n(),a("div",E,[e("div",J,[t[7]||(t[7]=e("div",{class:"page-header"},[e("div",null,[e("h1",{class:"page-title"},"ユーザー管理"),e("p",{class:"page-sub"},"教室に所属するユーザーを管理します。アカウント作成は MCP で行います。")])],-1)),e("div",R,[e("div",q,[p(r,{icon:"mdi:magnify",width:18,height:18,class:"search-icon"}),f(e("input",{"onUpdate:modelValue":t[0]||(t[0]=s=>b(l)?l.value=s:null),type:"text",class:"search-input",placeholder:"ユーザー名・ユーザーID"},null,512),[[I,d(l)]])]),f(e("select",{"onUpdate:modelValue":t[1]||(t[1]=s=>b(c)?c.value=s:null),class:"filter-select"},[...t[2]||(t[2]=[e("option",{value:""},"全てのステータス",-1),e("option",{value:"active"},"アクティブ",-1),e("option",{value:"inactive"},"非アクティブ",-1)])],512),[[M,d(c)]]),e("button",{class:"btn btn-secondary",onClick:D},"フィルタークリア")]),d(v)?(n(),a("div",A,[...t[3]||(t[3]=[e("div",{class:"loader"},null,-1),e("p",null,"読み込み中...",-1)])])):d(_).length===0?(n(),a("div",K,[p(r,{icon:"mdi:account-multiple-outline",width:48,height:48,class:"empty-icon"}),t[4]||(t[4]=e("p",{class:"empty-title"},"ユーザーが見つかりません",-1)),t[5]||(t[5]=e("p",{class:"empty-sub"},"条件に一致するユーザーがありません。",-1))])):(n(),a("div",Q,[(n(!0),a(U,null,$(d(_),s=>(n(),a("div",{key:s.id,class:"user-card"},[e("span",G,[p(r,{icon:"mdi:account-circle",width:44,height:44})]),e("div",H,[e("div",O,[e("span",W,o(s.name||"未設定"),1),e("span",X,o(s.user_id),1),e("span",{class:F(["tag",s.is_active?"tag-success":"tag-danger"])},o(s.is_active?"アクティブ":"非アクティブ"),3),e("span",Y,o(x[s.role]||s.role),1),s.membership_type?(n(),a("span",Z,o(w[s.membership_type]||s.membership_type),1)):u("",!0),s.membership_ended_at?(n(),a("span",ee," 〜"+o(g(s.membership_ended_at)),1)):u("",!0)]),s.email?(n(),a("p",se,o(s.email),1)):u("",!0),e("p",te,[k(" 作成日: "+o(g(s.created_at))+" ",1),s.last_login_at?(n(),a("span",ae," | 最終ログイン: "+o(g(s.last_login_at)),1)):u("",!0)])]),p(N,{to:`/organization/users/${s.id}/edit`,class:"btn btn-secondary btn-sm"},{default:P(()=>[...t[6]||(t[6]=[k(" 編集 ",-1)])]),_:1},8,["to"])]))),128))]))])])}}}),re=j(ne,[["__scopeId","data-v-4ce97607"]]);export{re as default};
