add new event and attendance table with automatic now timestamp
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m34s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m39s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m46s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m32s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m35s
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m34s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m39s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m46s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m32s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m35s
This commit is contained in:
79
src/vueLib/tables/events/EventsTable.ts
Normal file
79
src/vueLib/tables/events/EventsTable.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import { appApi } from 'src/boot/axios';
|
||||
import { ref, computed } from 'vue';
|
||||
import type { Events } from 'src/vueLib/models/event';
|
||||
import { useNotify } from 'src/vueLib/general/useNotify';
|
||||
import { i18n } from 'boot/lang';
|
||||
|
||||
export function useEventTable() {
|
||||
const Events = ref<Events>([]);
|
||||
|
||||
const pagination = ref({
|
||||
sortBy: 'firstName',
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 20,
|
||||
});
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'name',
|
||||
align: 'left' as const,
|
||||
label: i18n.global.t('name'),
|
||||
field: 'name',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'attendees',
|
||||
align: 'center' as const,
|
||||
label: i18n.global.t('attendees'),
|
||||
field: 'attendees',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'date',
|
||||
align: 'left' as const,
|
||||
label: i18n.global.t('dateAndTime'),
|
||||
field: 'date',
|
||||
sortable: true,
|
||||
},
|
||||
{ name: 'option', align: 'center' as const, label: '', field: 'option', icon: 'option' },
|
||||
]);
|
||||
|
||||
const { NotifyResponse } = useNotify();
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
//updates Event list from database
|
||||
function updateEvents() {
|
||||
loading.value = true;
|
||||
|
||||
appApi
|
||||
.get('events')
|
||||
.then((resp) => {
|
||||
if (resp.data === null) {
|
||||
Events.value = [];
|
||||
return;
|
||||
}
|
||||
Events.value = resp.data as Events;
|
||||
if (Events.value === null) {
|
||||
Events.value = [];
|
||||
return;
|
||||
}
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
NotifyResponse(err, 'error');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
Events,
|
||||
pagination,
|
||||
columns,
|
||||
loading,
|
||||
updateEvents,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user