1import{f as m}from"./DL83gLVV.js";import{d as E,u as b,w,z as D,j as i,k as d,t,m as l,v as g,O as C,Q as T,N as k,F as x,K as N,H as r,y as S,S as c,V as p}from"./B_l_-w4o.js";import{u as $}from"./DNR-fDXs.js";import"./B-YVwB4U.js";const A={class:"new-event"},V={class:"container"},B={class:"section"},M={class:"segment"},O={class:"flex center-vertically"},P=["disabled"],j={class:"flex-row"},F={class:"flex-col-6"},H={class:"info"},L=["onClick"],z={class:"no-wrap"},I=["href"],J=E({__name:"event-cms",async setup(K){let o,u;const{$api:v}=b(),{data:_,refresh:f}=([o,u]=w(()=>D("/api/v2/events/",{server:!1})),o=await o,u(),o),a=S(),h=async()=>{try{await v("/api/v2/events/",{method:"POST",body:{title:a.value}}),f(),c("Event created!"),a.value=void 0}catch(n){p(n)}},y=async(n,e)=>{if(confirm(`Are you sure you want to delete ${n}?`))try{await v(`/api/v2/events/${e}`,{method:"DELETE"}),f(),c("Event deleted!")}catch(s){p(s)}};return $({title:"Event CMS - Trails Offroad"}),(n,e)=>(i(),d("div",A,[t("div",V,[t("div",B,[t("div",M,[t("div",O,[e[3]||(e[3]=t("div",null,[t("h1",{class:"no-margin"},"Event CMS")],-1)),t("button",{class:"primary right",disabled:!l(a),onClick:e[0]||(e[0]=s=>h())},[...e[2]||(e[2]=[g(" Create ",-1),t("i",{class:"fa fa-plus"},null,-1)])],8,P)])]),t("div",j,[t("div",F,[e[4]||(e[4]=t("label",null,"Event Name",-1)),C(t("input",{"onUpdate:modelValue":e[1]||(e[1]=s=>k(a)?a.value=s:null),type:"text"},null,512),[[T,l(a)]])])]),e[7]||(e[7]=t("hr",null,null,-1)),t("table",H,[t("tbody",null,[e[6]||(e[6]=t("tr",null,[t("th"),t("th",null,"Event"),t("th",null,"Published"),t("th",null,"Dates")],-1)),(i(!0),d(x,null,N(l(_),s=>(i(),d("tr",null,[t("td",null,[t("button",{class:"error medium-button",onClick:Q=>y(s.title,s.slug)},[...e[5]||(e[5]=[t("i",{class:"fa fa-trash"},null,-1)])],8,L)]),t("td",z,[t("a",{href:`/events/${s.slug}`},r(s.title),9,I)]),t("td",null,r(s.is_published),1),t("td",null,r(("formatDate"in n?n.formatDate:l(m))(s.start_date))+" - "+r(("formatDate"in n?n.formatDate:l(m))(s.end_date)),1)]))),256))])])])])]))}});export{J as default}; 2//# sourceMappingURL=CQjpm87c.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.