mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
liniting
This commit is contained in:
parent
d4d38e29b6
commit
d9b19fbfa0
@ -83,343 +83,343 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Overlay from '../components/Overlay'
|
import Overlay from '../components/Overlay'
|
||||||
import OpenCreationsTable from '../components/Tables/OpenCreationsTable'
|
import OpenCreationsTable from '../components/Tables/OpenCreationsTable'
|
||||||
import { adminListContributions } from '../graphql/adminListContributions'
|
import { adminListContributions } from '../graphql/adminListContributions'
|
||||||
import { adminDeleteContribution } from '../graphql/adminDeleteContribution'
|
import { adminDeleteContribution } from '../graphql/adminDeleteContribution'
|
||||||
import { confirmContribution } from '../graphql/confirmContribution'
|
import { confirmContribution } from '../graphql/confirmContribution'
|
||||||
import { denyContribution } from '../graphql/denyContribution'
|
import { denyContribution } from '../graphql/denyContribution'
|
||||||
|
|
||||||
const FILTER_TAB_MAP = [
|
const FILTER_TAB_MAP = [
|
||||||
['IN_PROGRESS', 'PENDING'],
|
['IN_PROGRESS', 'PENDING'],
|
||||||
['CONFIRMED'],
|
['CONFIRMED'],
|
||||||
['DENIED'],
|
['DENIED'],
|
||||||
['DELETED'],
|
['DELETED'],
|
||||||
['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
['IN_PROGRESS', 'PENDING', 'CONFIRMED', 'DENIED', 'DELETED'],
|
||||||
]
|
]
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'CreationConfirm',
|
name: 'CreationConfirm',
|
||||||
components: {
|
components: {
|
||||||
OpenCreationsTable,
|
OpenCreationsTable,
|
||||||
Overlay,
|
Overlay,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tabIndex: 0,
|
tabIndex: 0,
|
||||||
items: [],
|
items: [],
|
||||||
overlay: false,
|
overlay: false,
|
||||||
item: {},
|
item: {},
|
||||||
variant: 'confirm',
|
variant: 'confirm',
|
||||||
rows: 0,
|
rows: 0,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
pageSize: 25,
|
pageSize: 25,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
deleteCreation() {
|
deleteCreation() {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: adminDeleteContribution,
|
mutation: adminDeleteContribution,
|
||||||
variables: {
|
variables: {
|
||||||
id: this.item.id,
|
id: this.item.id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.updatePendingCreations(this.item.id)
|
this.updatePendingCreations(this.item.id)
|
||||||
this.toastSuccess(this.$t('creation_form.toasted_delete'))
|
this.toastSuccess(this.$t('creation_form.toasted_delete'))
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.toastError(error.message)
|
this.toastError(error.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
denyCreation() {
|
denyCreation() {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: denyContribution,
|
mutation: denyContribution,
|
||||||
variables: {
|
variables: {
|
||||||
id: this.item.id,
|
id: this.item.id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.updatePendingCreations(this.item.id)
|
this.updatePendingCreations(this.item.id)
|
||||||
this.toastSuccess(this.$t('creation_form.toasted_denied'))
|
this.toastSuccess(this.$t('creation_form.toasted_denied'))
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.toastError(error.message)
|
this.toastError(error.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
confirmCreation() {
|
confirmCreation() {
|
||||||
this.$apollo
|
this.$apollo
|
||||||
.mutate({
|
.mutate({
|
||||||
mutation: confirmContribution,
|
mutation: confirmContribution,
|
||||||
variables: {
|
variables: {
|
||||||
id: this.item.id,
|
id: this.item.id,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.updatePendingCreations(this.item.id)
|
this.updatePendingCreations(this.item.id)
|
||||||
this.toastSuccess(this.$t('creation_form.toasted_created'))
|
this.toastSuccess(this.$t('creation_form.toasted_created'))
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this.overlay = false
|
this.overlay = false
|
||||||
this.toastError(error.message)
|
this.toastError(error.message)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
updatePendingCreations(id) {
|
updatePendingCreations(id) {
|
||||||
this.items = this.items.filter((obj) => obj.id !== id)
|
this.items = this.items.filter((obj) => obj.id !== id)
|
||||||
this.$store.commit('openCreationsMinus', 1)
|
this.$store.commit('openCreationsMinus', 1)
|
||||||
},
|
},
|
||||||
showOverlay(item, variant) {
|
showOverlay(item, variant) {
|
||||||
this.overlay = true
|
this.overlay = true
|
||||||
this.item = item
|
this.item = item
|
||||||
this.variant = variant
|
this.variant = variant
|
||||||
},
|
},
|
||||||
updateStatus(id) {
|
updateStatus(id) {
|
||||||
this.items.find((obj) => obj.id === id).messagesCount++
|
this.items.find((obj) => obj.id === id).messagesCount++
|
||||||
this.items.find((obj) => obj.id === id).state = 'IN_PROGRESS'
|
this.items.find((obj) => obj.id === id).state = 'IN_PROGRESS'
|
||||||
},
|
},
|
||||||
formatDateOrDash(value) {
|
formatDateOrDash(value) {
|
||||||
return value ? this.$d(new Date(value), 'short') : '—'
|
return value ? this.$d(new Date(value), 'short') : '—'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
fields() {
|
fields() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
// open contributions
|
// 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: 'firstName', label: this.$t('firstname') },
|
{ key: 'firstName', label: this.$t('firstname') },
|
||||||
{ key: 'lastName', label: this.$t('lastname') },
|
{ key: 'lastName', label: this.$t('lastname') },
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: this.$t('creation'),
|
label: this.$t('creation'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return value + ' GDD'
|
return value + ' GDD'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
||||||
{
|
{
|
||||||
key: 'contributionDate',
|
key: 'contributionDate',
|
||||||
label: this.$t('created'),
|
label: this.$t('created'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'moderator', label: this.$t('moderator') },
|
{ key: 'moderator', label: this.$t('moderator') },
|
||||||
{ key: 'editCreation', label: this.$t('chat') },
|
{ key: 'editCreation', label: this.$t('chat') },
|
||||||
{ key: 'confirm', label: this.$t('save') },
|
{ key: 'confirm', label: this.$t('save') },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// confirmed contributions
|
// 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') },
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: this.$t('creation'),
|
label: this.$t('creation'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return value + ' GDD'
|
return value + ' GDD'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
||||||
{
|
{
|
||||||
key: 'contributionDate',
|
key: 'contributionDate',
|
||||||
label: this.$t('created'),
|
label: this.$t('created'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
label: this.$t('createdAt'),
|
label: this.$t('createdAt'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'confirmedAt',
|
key: 'confirmedAt',
|
||||||
label: this.$t('contributions.confirms'),
|
label: this.$t('contributions.confirms'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'confirmedBy', label: this.$t('moderator') },
|
{ key: 'confirmedBy', label: this.$t('moderator') },
|
||||||
{ key: 'chatCreation', label: this.$t('chat') },
|
{ key: 'chatCreation', label: this.$t('chat') },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// denied contributions
|
// denied 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') },
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: this.$t('creation'),
|
label: this.$t('creation'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return value + ' GDD'
|
return value + ' GDD'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
||||||
{
|
{
|
||||||
key: 'contributionDate',
|
key: 'contributionDate',
|
||||||
label: this.$t('created'),
|
label: this.$t('created'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
label: this.$t('createdAt'),
|
label: this.$t('createdAt'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'deniedAt',
|
key: 'deniedAt',
|
||||||
label: this.$t('contributions.denied'),
|
label: this.$t('contributions.denied'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'deniedBy', label: this.$t('moderator') },
|
{ key: 'deniedBy', label: this.$t('moderator') },
|
||||||
{ key: 'chatCreation', label: this.$t('chat') },
|
{ key: 'chatCreation', label: this.$t('chat') },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// deleted contributions
|
// deleted 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') },
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: this.$t('creation'),
|
label: this.$t('creation'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return value + ' GDD'
|
return value + ' GDD'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
||||||
{
|
{
|
||||||
key: 'contributionDate',
|
key: 'contributionDate',
|
||||||
label: this.$t('created'),
|
label: this.$t('created'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
label: this.$t('createdAt'),
|
label: this.$t('createdAt'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'deletedAt',
|
key: 'deletedAt',
|
||||||
label: this.$t('contributions.deleted'),
|
label: this.$t('contributions.deleted'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'deletedBy', label: this.$t('moderator') },
|
{ key: 'deletedBy', label: this.$t('moderator') },
|
||||||
{ key: 'chatCreation', label: this.$t('chat') },
|
{ key: 'chatCreation', label: this.$t('chat') },
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
// all contributions
|
// all contributions
|
||||||
{ key: 'state', label: this.$t('status') },
|
{ key: 'state', label: this.$t('status') },
|
||||||
{ key: 'firstName', label: this.$t('firstname') },
|
{ key: 'firstName', label: this.$t('firstname') },
|
||||||
{ key: 'lastName', label: this.$t('lastname') },
|
{ key: 'lastName', label: this.$t('lastname') },
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: this.$t('creation'),
|
label: this.$t('creation'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return value + ' GDD'
|
return value + ' GDD'
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
{ key: 'memo', label: this.$t('text'), class: 'text-break' },
|
||||||
{
|
{
|
||||||
key: 'contributionDate',
|
key: 'contributionDate',
|
||||||
label: this.$t('created'),
|
label: this.$t('created'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'createdAt',
|
key: 'createdAt',
|
||||||
label: this.$t('createdAt'),
|
label: this.$t('createdAt'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'confirmedAt',
|
key: 'confirmedAt',
|
||||||
label: this.$t('contributions.confirms'),
|
label: this.$t('contributions.confirms'),
|
||||||
formatter: (value) => {
|
formatter: (value) => {
|
||||||
return this.formatDateOrDash(value)
|
return this.formatDateOrDash(value)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ key: 'confirmedBy', label: this.$t('moderator') },
|
{ key: 'confirmedBy', label: this.$t('moderator') },
|
||||||
{ key: 'chatCreation', label: this.$t('chat') },
|
{ key: 'chatCreation', label: this.$t('chat') },
|
||||||
],
|
],
|
||||||
][this.tabIndex]
|
][this.tabIndex]
|
||||||
},
|
},
|
||||||
statusFilter() {
|
statusFilter() {
|
||||||
return FILTER_TAB_MAP[this.tabIndex]
|
return FILTER_TAB_MAP[this.tabIndex]
|
||||||
},
|
},
|
||||||
overlayTitle() {
|
overlayTitle() {
|
||||||
return `overlay.${this.variant}.title`
|
return `overlay.${this.variant}.title`
|
||||||
},
|
},
|
||||||
overlayText() {
|
overlayText() {
|
||||||
return `overlay.${this.variant}.text`
|
return `overlay.${this.variant}.text`
|
||||||
},
|
},
|
||||||
overlayQuestion() {
|
overlayQuestion() {
|
||||||
return `overlay.${this.variant}.question`
|
return `overlay.${this.variant}.question`
|
||||||
},
|
},
|
||||||
overlayBtnText() {
|
overlayBtnText() {
|
||||||
return `overlay.${this.variant}.yes`
|
return `overlay.${this.variant}.yes`
|
||||||
},
|
},
|
||||||
overlayEvent() {
|
overlayEvent() {
|
||||||
return this[`${this.variant}Creation`]
|
return this[`${this.variant}Creation`]
|
||||||
},
|
},
|
||||||
overlayIcon() {
|
overlayIcon() {
|
||||||
switch (this.variant) {
|
switch (this.variant) {
|
||||||
case 'confirm':
|
case 'confirm':
|
||||||
return 'success'
|
return 'success'
|
||||||
case 'deny':
|
case 'deny':
|
||||||
return 'warning'
|
return 'warning'
|
||||||
case 'delete':
|
case 'delete':
|
||||||
return 'danger'
|
return 'danger'
|
||||||
default:
|
default:
|
||||||
return 'info'
|
return 'info'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
apollo: {
|
apollo: {
|
||||||
ListAllContributions: {
|
ListAllContributions: {
|
||||||
query() {
|
query() {
|
||||||
return adminListContributions
|
return adminListContributions
|
||||||
},
|
},
|
||||||
variables() {
|
variables() {
|
||||||
return {
|
return {
|
||||||
currentPage: this.currentPage,
|
currentPage: this.currentPage,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
statusFilter: this.statusFilter,
|
statusFilter: this.statusFilter,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchPolicy: 'no-cache',
|
fetchPolicy: 'no-cache',
|
||||||
update({ adminListContributions }) {
|
update({ adminListContributions }) {
|
||||||
this.rows = adminListContributions.contributionCount
|
this.rows = adminListContributions.contributionCount
|
||||||
this.items = adminListContributions.contributionList
|
this.items = adminListContributions.contributionList
|
||||||
if (this.statusFilter === FILTER_TAB_MAP[0]) {
|
if (this.statusFilter === FILTER_TAB_MAP[0]) {
|
||||||
this.$store.commit('setOpenCreations', adminListAllContributions.contributionCount)
|
this.$store.commit('setOpenCreations', adminListContributions.contributionCount)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error({ message }) {
|
error({ message }) {
|
||||||
this.toastError(message)
|
this.toastError(message)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
#overlay {
|
#overlay {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user