diff --git a/resources/css/app.css b/resources/css/app.css
index 868d7e18..b6440267 100644
--- a/resources/css/app.css
+++ b/resources/css/app.css
@@ -7,6 +7,5 @@
@import 'layout';
@import 'buttons';
@import 'table';
-@import 'sidebar';
@import 'bool';
@import 'form';
diff --git a/resources/css/sidebar.css b/resources/css/sidebar.css
deleted file mode 100644
index 40ff451c..00000000
--- a/resources/css/sidebar.css
+++ /dev/null
@@ -1,3 +0,0 @@
-.sidebar {
- @apply fixed w-max shadow-2xl bg-gray-600 right-0 top-0 h-full;
-}
diff --git a/resources/js/components/page/Header.vue b/resources/js/components/page/Header.vue
index a0654323..a12e87e1 100644
--- a/resources/js/components/page/Header.vue
+++ b/resources/js/components/page/Header.vue
@@ -6,7 +6,7 @@
-
diff --git a/resources/js/components/ui/Sidebar.vue b/resources/js/components/ui/Sidebar.vue
new file mode 100644
index 00000000..0614d8d9
--- /dev/null
+++ b/resources/js/components/ui/Sidebar.vue
@@ -0,0 +1,20 @@
+
+
+
+
+
diff --git a/resources/js/composables/useApiIndex.js b/resources/js/composables/useApiIndex.js
new file mode 100644
index 00000000..684f2cf1
--- /dev/null
+++ b/resources/js/composables/useApiIndex.js
@@ -0,0 +1,77 @@
+import {ref, inject, onBeforeUnmount} from 'vue';
+import {router} from '@inertiajs/vue3';
+import useQueueEvents from './useQueueEvents.js';
+
+export function useApiIndex(url, siteName) {
+ const axios = inject('axios');
+ const {startListener, stopListener} = useQueueEvents(siteName, () => reload());
+ const single = ref(null);
+ const inner = {
+ data: ref([]),
+ meta: ref({}),
+ };
+
+ async function reload(resetPage = true) {
+ var params = {
+ page: resetPage ? 1 : inner.meta.value.current_page,
+ };
+
+ var response = (await axios.post(url, params)).data;
+ inner.data.value = response.data;
+ inner.meta.value = response.meta;
+ }
+
+ function create() {
+ single.value = JSON.parse(JSON.stringify(inner.meta.value.default));
+ }
+
+ function edit(model) {
+ single.value = JSON.parse(JSON.stringify(model));
+ }
+
+ async function submit() {
+ single.value.id ? await axios.patch(single.value.links.update, single.value) : await axios.post(inner.meta.value.links.store, single.value);
+ await reload();
+ single.value = null;
+ }
+
+ async function remove(model) {
+ await axios.delete(model.links.destroy);
+ await reload();
+ }
+
+ function can(permission) {
+ return inner.meta.value.can[permission];
+ }
+
+ function requestCallback(successMessage, failureMessage) {
+ return {
+ onSuccess: () => {
+ this.$success(successMessage);
+ reload(false);
+ },
+ onFailure: () => {
+ this.$error(failureMessage);
+ reload(false);
+ },
+ preserveState: true,
+ };
+ }
+
+ startListener();
+ onBeforeUnmount(() => stopListener());
+
+ return {
+ data: inner.data,
+ meta: inner.meta,
+ single,
+ create,
+ edit,
+ reload,
+ can,
+ requestCallback,
+ router,
+ submit,
+ remove,
+ };
+}
diff --git a/resources/js/views/member/MemberMemberships.vue b/resources/js/views/member/MemberMemberships.vue
index cbae2762..b1cac382 100644
--- a/resources/js/views/member/MemberMemberships.vue
+++ b/resources/js/views/member/MemberMemberships.vue
@@ -1,94 +1,62 @@
-
-
-
-
+
+
+
+
+
@@ -121,14 +134,14 @@ import MemberMemberships from './MemberMemberships.vue';
import MemberCourses from './MemberCourses.vue';
import Tags from './Tags.vue';
import Actions from './index/Actions.vue';
-import { indexProps, useIndex } from '../../composables/useIndex.js';
-import { ref, defineProps } from 'vue';
+import {indexProps, useIndex} from '../../composables/useIndex.js';
+import {ref, defineProps} from 'vue';
const single = ref(null);
const deleting = ref(null);
const props = defineProps(indexProps);
-var { router, data, meta, getFilter, setFilter, filterString } = useIndex(props.data, 'member');
+var {router, data, meta, getFilter, setFilter, filterString} = useIndex(props.data, 'member');
function exportMembers() {
window.open(`/member-export?filter=${filterString.value}`);
@@ -136,7 +149,7 @@ function exportMembers() {
async function remove(member) {
new Promise((resolve, reject) => {
- deleting.value = { resolve, reject, member };
+ deleting.value = {resolve, reject, member};
})
.then(() => {
router.delete(`/member/${member.id}`);
diff --git a/resources/js/views/member/index/Actions.vue b/resources/js/views/member/index/Actions.vue
index fcaf9da3..4201880f 100644
--- a/resources/js/views/member/index/Actions.vue
+++ b/resources/js/views/member/index/Actions.vue
@@ -1,7 +1,7 @@