import{br as r,A as i,c}from"./index.cf09daef.js";const m=e=>[{label:e.$t("label.default"),value:"start_at"},{label:e.$t("label.class"),value:"class_id"},{label:e.$t("label.instructor"),value:"instructor_id"}],b=r("member-class-schedule",{getters:{module:e=>({name:"Class schedules",label:e.$t("label.classSchedules"),singular:e.$t("singular.classSchedule"),plural:e.$t("plural.classSchedules")}),columns:e=>[{name:"start_at",align:"left",label:e.$t("label.time"),field:"time",style:"width: 40px",sortable:!1},{name:"class",align:"left",label:e.$t("label.className"),field:"class",format:l=>l?l.name:"",style:"width: 40px",sortable:!1},{name:"location",align:"left",label:e.$t("label.location"),field:"location",format:l=>l?l.label:"",style:"width: 40px",sortable:!1},{name:"instructor",align:"left",label:e.$t("label.instructor"),field:"instructor",format:l=>l?l.name:"",style:"width: 40px",sortable:!1},{name:"actions",align:"right",sortable:!1}],toolbar:e=>[{title:e.$t("label.sort"),action:"request",component:"base-select",dense:!0,outlined:!0,key:"otherSortBy",placeholder:e.$t("placeholder.select"),optionsDense:!0,style:"width: 150px",mapOptions:!0,emitValue:!0,options:m(e),prefix:e.$t("prefix.sort"),deleted:"all"}],filters:e=>[]},actions:{get(e){return new Promise((l,s)=>{i.get("member/class-schedules",e).then(t=>{this.setRows(t.data),l(t)}).catch(t=>{s(t)})})},show(e){return new Promise((l,s)=>{i.get(`member/class-schedules/${e}`).then(t=>{l(t)}).catch(t=>{s(t)})})},book(e){return new Promise((l,s)=>{c.confirm(`${e.class.name} on ${e.day} (${e.date_at_formated}) at ${e.time}`).then(()=>{i.post(`member/class-schedules/${e.id}`).then(t=>{e.is_active=!e.is_active;const{message:n}=t;c.success(n),l(t)}).catch(t=>{c.error(t),s(t)})}).catch(t=>{s(t)})})},cancel(e){return new Promise((l,s)=>{const n=e.booking.cancelable==="late-cancellation"?this.$t("dialog.info.lateCancel"):"";c.confirm(`${n}${this.$t("dialog.info.cancel")}`).then(()=>{i.post(`member/bookings/${e.booking.id}/cancel`).then(a=>{e.booking.cancelable=!1;const{message:o}=a;c.success(o),l(a)}).catch(a=>{c.error(a),s(a)})}).catch(a=>{s(a)})})}}});export{b as u};
