import{d as L,i as b,q as I,H as g,E as h,J as n,n as $,o as s,j as i,k as c,c as a,w as d,b as l,r as v,B as N,x as S,F as B,e as _,f as V,a4 as A,av as D}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"}},F=V("Add New Location"),H=["src"],T={key:1},j=["onClick"],q=c("a",null,"Delete",-1),J=["href"],X=L({__name:"ServiceLocation",setup(M){const y=[{title:"ID",dataIndex:"id",key:"id"},{title:"Image",dataIndex:"images",key:"images"},{title:"Name",dataIndex:"name",key:"name"},{title:"Telephone",dataIndex:"tel",key:"tel"},{title:"Address",dataIndex:"address",key:"address"},{title:"Action",key:"action"}];let m=b();I(()=>{p()});const p=()=>{g(),h.getServiceLocations().then(t=>{n(),m.value=t.data}).catch(t=>{n(),$.error(t.message)})},k=async t=>{g(),await h.deleteServiceLocation(t).then(o=>{n(),p()}).catch(o=>{n()})};return(t,o)=>{const f=N,u=A,x=D,w=S;return s(),i("div",null,[c("div",E,[a(f,{type:"primary",onClick:o[0]||(o[0]=r=>l(v).push("/data/service/location/create"))},{default:d(()=>[F]),_:1})]),a(w,{columns:y,"data-source":l(m)},{bodyCell:d(({column:r,text:z,record:e})=>[r.key==="images"?(s(),i(B,{key:0},[e.images&&e.images.length>0?(s(),i("img",{key:0,src:e.images[0],alt:"",style:{width:"60px"}},null,8,H)):_("",!0)],64)):_("",!0),r.key==="action"?(s(),i("span",T,[c("a",{onClick:C=>l(v).push("/data/service/location/edit/"+e.id)},"Edit",8,j),a(u,{type:"vertical"}),a(x,{title:"Sure to delete?",onConfirm:C=>k(e.id)},{default:d(()=>[q]),_:2},1032,["onConfirm"]),a(u,{type:"vertical"}),c("a",{href:`https://www.google.com/maps/@${e.lat},${e.lng}`,target:"_blank"},"Location",8,J)])):_("",!0)]),_:1},8,["data-source"])])}}});export{X as default};
