add deleted contribution table

This commit is contained in:
Moriz Wahl 2023-02-28 17:20:56 +01:00
parent f83c364d1d
commit 457cea4619
3 changed files with 50 additions and 13 deletions

View File

@ -7,7 +7,7 @@ export const listAllContributions = gql`
$order: Order = DESC $order: Order = DESC
$statusFilter: [ContributionStatus!] $statusFilter: [ContributionStatus!]
) { ) {
listAllContributions( adminListAllContributions(
currentPage: $currentPage currentPage: $currentPage
pageSize: $pageSize pageSize: $pageSize
order: $order order: $order
@ -28,6 +28,8 @@ export const listAllContributions = gql`
messagesCount messagesCount
deniedAt deniedAt
deniedBy deniedBy
deletedAt
deletedBy
} }
} }
} }

View File

@ -173,15 +173,11 @@ export default {
this.items.find((obj) => obj.id === id).state = 'IN_PROGRESS' this.items.find((obj) => obj.id === id).state = 'IN_PROGRESS'
}, },
}, },
watch: {
statusFilter() {
this.$apollo.queries.ListAllContributions.refetch()
},
},
computed: { computed: {
fields() { fields() {
return [ return [
[ [
// open contributions
{ key: 'bookmark', label: this.$t('delete') }, { key: 'bookmark', label: this.$t('delete') },
{ key: 'deny', label: this.$t('deny') }, { key: 'deny', label: this.$t('deny') },
{ key: 'email', label: this.$t('e_mail') }, { key: 'email', label: this.$t('e_mail') },
@ -207,6 +203,7 @@ export default {
{ key: 'confirm', label: this.$t('save') }, { key: 'confirm', label: this.$t('save') },
], ],
[ [
// confirmed contributions
{ key: 'firstName', label: this.$t('firstname') }, { key: 'firstName', label: this.$t('firstname') },
{ key: 'lastName', label: this.$t('lastname') }, { key: 'lastName', label: this.$t('lastname') },
{ {
@ -241,6 +238,7 @@ export default {
{ key: 'chatCreation', label: this.$t('chat') }, { key: 'chatCreation', label: this.$t('chat') },
], ],
[ [
// denied contributions
{ key: 'reActive', label: 'reActive' }, { key: 'reActive', label: 'reActive' },
{ key: 'firstName', label: this.$t('firstname') }, { key: 'firstName', label: this.$t('firstname') },
{ key: 'lastName', label: this.$t('lastname') }, { key: 'lastName', label: this.$t('lastname') },
@ -276,8 +274,45 @@ export default {
{ key: 'deniedBy', label: this.$t('mod') }, { key: 'deniedBy', label: this.$t('mod') },
{ key: 'chatCreation', label: this.$t('chat') }, { key: 'chatCreation', label: this.$t('chat') },
], ],
[],
[ [
// deleted contributions
{ key: 'reActive', label: 'reActive' },
{ key: 'firstName', label: this.$t('firstname') },
{ key: 'lastName', label: this.$t('lastname') },
{
key: 'amount',
label: this.$t('creation'),
formatter: (value) => {
return value + ' GDD'
},
},
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
{
key: 'contributionDate',
label: this.$t('created'),
formatter: (value) => {
return this.$d(new Date(value), 'short')
},
},
{
key: 'createdAt',
label: this.$t('createdAt'),
formatter: (value) => {
return this.$d(new Date(value), 'short')
},
},
{
key: 'deletedAt',
label: this.$t('contributions.denied'),
formatter: (value) => {
return this.$d(new Date(value), 'short')
},
},
{ key: 'deletedBy', label: this.$t('mod') },
{ key: 'chatCreation', label: this.$t('chat') },
],
[
// all contributions
{ key: 'state', label: 'state' }, { key: 'state', label: 'state' },
{ key: 'firstName', label: this.$t('firstname') }, { key: 'firstName', label: this.$t('firstname') },
{ key: 'lastName', label: this.$t('lastname') }, { key: 'lastName', label: this.$t('lastname') },
@ -352,16 +387,16 @@ export default {
return listAllContributions return listAllContributions
}, },
variables() { variables() {
// may be at some point we need a pagination here
return { return {
currentPage: this.currentPage, currentPage: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize,
statusFilter: this.statusFilter, statusFilter: this.statusFilter,
} }
}, },
update({ listAllContributions }) { fetchPolicy: 'no-cache',
this.rows = listAllContributions.contributionCount update({ adminListAllContributions }) {
this.items = listAllContributions.contributionList this.rows = adminListAllContributions.contributionCount
this.items = adminListAllContributions.contributionList
}, },
error({ message }) { error({ message }) {
this.toastError(message) this.toastError(message)

View File

@ -51,8 +51,8 @@ export default {
statusFilter: this.statusFilter, statusFilter: this.statusFilter,
} }
}, },
update({ listAllContributions }) { update({ adminListAllContributions }) {
this.$store.commit('setOpenCreations', listAllContributions.contributionCount) this.$store.commit('setOpenCreations', adminListAllContributions.contributionCount)
}, },
error({ message }) { error({ message }) {
this.toastError(message) this.toastError(message)