diff --git a/resources/js/views/dashboard/EventList.vue b/resources/js/views/dashboard/EventList.vue index 9ff5100..cd129fa 100644 --- a/resources/js/views/dashboard/EventList.vue +++ b/resources/js/views/dashboard/EventList.vue @@ -47,6 +47,7 @@ { const handleActionButton = (item: Event, option: string): void => { if (option.length == 0) { handleEdit(item); + } else if (option.toLowerCase() == "view") { + handleView(item); } else if (option.toLowerCase() == "duplicate") { handleDuplicate(item); } else if (option.toLowerCase() == "delete") { @@ -212,13 +215,45 @@ const handleLoad = async () => { } }; +/** + * Handle viewing an event. + * + * @param item + */ +const handleView = (item: Event): void => { + // router.push({ name: "event", params: { id: item.id } }); + window.open( + router.resolve({ name: "event", params: { id: item.id } }).href, + "_blank" + ); +}; + /** * Handle duplicating an event. * * @param item */ -const handleDuplicate = (item: Event): void => { - alert("not implemented"); +const handleDuplicate = async (item: Event): Promise => { + // try { + // let result = await api.post({ + // url: "/events", + // body: item, + // }); + // toastStore.addToast({ + // title: "Event Duplicated", + // content: + // "The event has been duplicated.", + // type: "success", + // }); + // router.push({ name: "dashboard-event-edit", params: { id: result.id } }); + // } catch { + // toastStore.addToast({ + // title: "Server Error", + // content: + // "An error occurred duplicating the event.", + // type: "danger", + // }); + // } }; /**