add new table feature for responsible person and assignment close #2
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m23s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m37s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m49s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m37s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m34s
All checks were successful
Build Quasar SPA and Go Backend for memberApp / build-spa (push) Successful in 2m23s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, .exe, windows) (push) Successful in 5m37s
Build Quasar SPA and Go Backend for memberApp / build-backend (amd64, , linux) (push) Successful in 5m49s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm, 6, , linux) (push) Successful in 5m37s
Build Quasar SPA and Go Backend for memberApp / build-backend (arm64, , linux) (push) Successful in 5m34s
This commit is contained in:
68
src/vueLib/tables/responsible/ResponsibleTable.ts
Normal file
68
src/vueLib/tables/responsible/ResponsibleTable.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { appApi } from 'src/boot/axios';
|
||||
import { ref, computed } from 'vue';
|
||||
import type { Members } from 'src/vueLib/models/member';
|
||||
import { useNotify } from 'src/vueLib/general/useNotify';
|
||||
import { i18n } from 'boot/lang';
|
||||
|
||||
export function useResponsibleTable() {
|
||||
const responsibles = ref<Members>([]);
|
||||
|
||||
const pagination = ref({
|
||||
sortBy: 'firstName',
|
||||
descending: false,
|
||||
page: 1,
|
||||
rowsPerPage: 20,
|
||||
});
|
||||
|
||||
const columns = computed(() => [
|
||||
{
|
||||
name: 'firstName',
|
||||
align: 'left' as const,
|
||||
label: i18n.global.t('prename'),
|
||||
field: 'firstName',
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: 'lastName',
|
||||
align: 'left' as const,
|
||||
label: i18n.global.t('lastName'),
|
||||
field: 'lastName',
|
||||
sortable: true,
|
||||
},
|
||||
{ name: 'option', align: 'center' as const, label: '', field: 'option', icon: 'option' },
|
||||
]);
|
||||
|
||||
const { NotifyResponse } = useNotify();
|
||||
|
||||
const loading = ref(false);
|
||||
|
||||
//updates responsible list from database
|
||||
async function updateResponsibles() {
|
||||
loading.value = true;
|
||||
|
||||
await appApi
|
||||
.get('responsible')
|
||||
.then((resp) => {
|
||||
if (resp.data === null) {
|
||||
responsibles.value = [];
|
||||
return;
|
||||
}
|
||||
responsibles.value = resp.data as Members;
|
||||
})
|
||||
|
||||
.catch((err) => {
|
||||
NotifyResponse(err, 'error');
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
responsibles,
|
||||
pagination,
|
||||
columns,
|
||||
loading,
|
||||
updateResponsibles,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user