import{d as I,i as $,q as b,H as y,E as h,J as i,n as H,o as a,j as l,k as d,c as o,w as r,b as _,r as g,B,x as N,F as V,e as p,a as A,f as D,a4 as E,av as L}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{_ as T}from"./Type.ec60a9ee.js";/* empty css              */import"./filters.69c883c5.js";const F={class:"",style:{"margin-bottom":"10px"}},S=D("Add New Hospital"),j=["src"],q={key:2},J=["onClick"],M=d("a",null,"Delete",-1),z=["href"],at=I({__name:"Hospital",setup(G){const k=[{title:"ID",dataIndex:"id",key:"id"},{title:"Image",dataIndex:"images",key:"images"},{title:"Type",dataIndex:"hospitaltype",key:"hospitaltype"},{title:"Name",dataIndex:"name",key:"name"},{title:"Telephone",dataIndex:"tel",key:"tel"},{title:"Address",dataIndex:"address",key:"address"},{title:"Action",key:"action"}];let c=$();b(()=>{m()});const m=()=>{y(),h.getHospitals().then(e=>{i(),c.value=e.data}).catch(e=>{i(),H.error(e.message)})},f=async e=>{y(),await h.deleteHospital(e).then(s=>{i(),m()}).catch(s=>{i()})};return(e,s)=>{const x=B,u=E,v=L,w=N;return a(),l("div",null,[d("div",F,[o(x,{type:"primary",onClick:s[0]||(s[0]=n=>_(g).push("/data/hospital/create"))},{default:r(()=>[S]),_:1})]),o(w,{columns:k,"data-source":_(c)},{bodyCell:r(({column:n,text:K,record:t})=>[n.key==="images"?(a(),l(V,{key:0},[t.images.length>0?(a(),l("img",{key:0,src:t.images[0],alt:"",style:{width:"60px"}},null,8,j)):p("",!0)],64)):p("",!0),n.key==="hospitaltype"?(a(),A(T,{key:1,type:t.hospitaltype},null,8,["type"])):p("",!0),n.key==="action"?(a(),l("span",q,[d("a",{onClick:C=>_(g).push("/data/hospital/edit/"+t.id)},"Edit",8,J),o(u,{type:"vertical"}),o(v,{title:"Sure to delete?",onConfirm:C=>f(t.id)},{default:r(()=>[M]),_:2},1032,["onConfirm"]),o(u,{type:"vertical"}),d("a",{href:`https://www.google.com/maps/@${t.lat},${t.lng}`,target:"_blank"},"Location",8,z)])):p("",!0)]),_:1},8,["data-source"])])}}});export{at as default};
