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