import{_ as x}from"./Ba76BwjT.js";import{_ as y}from"./BXGwug7E.js";import{e as C,v as k,J as w,c as $,a as s,b as o,w as d,d as D,t as n,m as r,f as c,i as b,E,o as N}from"./DpdQcRr7.js";import"./BcpEzrWT.js";const B={class:"section"},L={class:"container is-max-desktop"},T={class:"mb-4"},V={class:"icon"},I={class:"level mb-5"},J={class:"level-left"},M={class:"level-item"},O={class:"title is-3"},j={class:"level-right"},A={class:"level-item"},F={class:"buttons"},P={class:"icon"},R={class:"icon"},S={class:"box mb-5"},q={class:"columns is-multiline"},G={class:"column is-6"},H={class:"field"},K={class:"column is-6"},Q={class:"field"},U={class:"column is-6"},W={class:"field"},X={class:"column is-12"},Y={class:"field"},Z={class:"box mb-5"},ss={class:"columns is-multiline"},is={class:"column is-6"},ts={class:"field"},ns={class:"column is-6"},os={class:"field"},ls={class:"column is-12"},as={class:"field"},es={class:"box"},ds={class:"columns is-multiline"},cs={class:"column is-6"},us={class:"field"},rs={class:"column is-6"},ms={class:"field"},vs=["disabled"],gs=["disabled"],ps=C({__name:"index",props:{organization:{},refetchOrganization:{type:Function}},setup(t){const m=t,f=k(),{$api:z}=w(),l=b(!1),a=b(!1),v=e=>e?new Date(e).toLocaleString("ja-JP",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-",p=async()=>{if(m.organization){a.value=!0;try{await z(`/api/admin/organizations/${m.organization.id}?logical=true`,{method:"DELETE"}),await f.push("/admin/organizations")}catch(e){console.error("組織の削除に失敗しました:",e)}finally{a.value=!1,l.value=!1}}};return(e,i)=>{const u=E("Icon"),g=x,h=y;return N(),$("div",null,[s("section",B,[s("div",L,[s("div",T,[o(g,{to:"/admin/organizations",class:"button is-text is-small"},{default:d(()=>[s("span",V,[o(u,{icon:"mdi:arrow-left"})]),i[3]||(i[3]=s("span",null,"組織一覧に戻る",-1))]),_:1})]),s("div",I,[s("div",J,[s("div",M,[s("div",null,[s("h1",O,[D(n(t.organization.name)+" ",1),s("span",{class:r(["tag","ml-2",t.organization.is_active?"is-success is-light":"is-danger is-light"])},n(t.organization.is_active?"アクティブ":"非アクティブ"),3)])])])]),s("div",j,[s("div",A,[s("div",F,[o(g,{to:`/admin/organizations/${t.organization.id}/edit`,class:"button is-primary"},{default:d(()=>[s("span",P,[o(u,{icon:"mdi:pencil"})]),i[4]||(i[4]=s("span",null,"編集",-1))]),_:1},8,["to"]),s("button",{class:"button is-danger is-light",onClick:i[0]||(i[0]=_=>l.value=!0)},[s("span",R,[o(u,{icon:"mdi:delete"})]),i[5]||(i[5]=s("span",null,"削除",-1))])])])])]),s("div",S,[i[10]||(i[10]=s("h2",{class:"title is-5 mb-4"},"基本情報",-1)),s("div",q,[s("div",G,[s("div",H,[i[6]||(i[6]=s("label",{class:"label"},"組織名",-1)),s("p",null,n(t.organization.name),1)])]),s("div",K,[s("div",Q,[i[7]||(i[7]=s("label",{class:"label"},"所属企業",-1)),s("p",null,n(t.organization.company_name||"不明"),1)])]),s("div",U,[s("div",W,[i[8]||(i[8]=s("label",{class:"label"},"ステータス",-1)),s("p",null,[s("span",{class:r(["tag",t.organization.is_active?"is-success":"is-danger"])},n(t.organization.is_active?"アクティブ":"非アクティブ"),3)])])]),s("div",X,[s("div",Y,[i[9]||(i[9]=s("label",{class:"label"},"説明",-1)),s("p",null,n(t.organization.description||"未設定"),1)])])])]),s("div",Z,[i[14]||(i[14]=s("h2",{class:"title is-5 mb-4"},"連絡先情報",-1)),s("div",ss,[s("div",is,[s("div",ts,[i[11]||(i[11]=s("label",{class:"label"},"メールアドレス",-1)),s("p",null,n(t.organization.contact_email||"未設定"),1)])]),s("div",ns,[s("div",os,[i[12]||(i[12]=s("label",{class:"label"},"電話番号",-1)),s("p",null,n(t.organization.phone||"未設定"),1)])]),s("div",ls,[s("div",as,[i[13]||(i[13]=s("label",{class:"label"},"住所",-1)),s("p",null,n(t.organization.address||"未設定"),1)])])])]),s("div",es,[i[17]||(i[17]=s("h2",{class:"title is-5 mb-4"},"メタ情報",-1)),s("div",ds,[s("div",cs,[s("div",us,[i[15]||(i[15]=s("label",{class:"label"},"作成日時",-1)),s("p",null,n(v(t.organization.created_at)),1)])]),s("div",rs,[s("div",ms,[i[16]||(i[16]=s("label",{class:"label"},"更新日時",-1)),s("p",null,n(v(t.organization.updated_at)),1)])])])])])]),o(h,{"is-active":c(l),title:"組織の削除",size:"small",onClose:i[2]||(i[2]=_=>l.value=!1)},{footer:d(()=>[s("button",{class:r(["button is-danger",{"is-loading":c(a)}]),disabled:c(a),onClick:p}," 削除 ",10,vs),s("button",{class:"button",disabled:c(a),onClick:i[1]||(i[1]=_=>l.value=!1)}," キャンセル ",8,gs)]),default:d(()=>[s("p",null,"本当に「"+n(t.organization.name)+"」を削除しますか？",1),i[18]||(i[18]=s("p",{class:"has-text-danger mt-3"},"この操作により組織は非アクティブになります。",-1))]),_:1},8,["is-active"])])}}});export{ps as default};
