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