refactor overlay conditions on admin creation confirmation page

This commit is contained in:
mahula 2023-01-25 12:11:06 +01:00
parent 579ef7b25e
commit cc4c8ce351
3 changed files with 21 additions and 33 deletions

View File

@ -123,7 +123,7 @@
"title": "Gemeinwohl-Beitrag löschen!",
"yes": "Ja, Beitrag löschen!"
},
"reject": {
"deny": {
"question": "Willst du diesen Gemeinwohl-Beitrag wirklich ablehnen?",
"text": "Nach dem Speichern ist der Datensatz nicht mehr änderbar und kann auch nicht mehr gelöscht werden. Bitte überprüfe genau, dass alles stimmt.",
"title": "Gemeinwohl-Beitrag ablehnen!",

View File

@ -123,7 +123,7 @@
"title": "Delete creation!",
"yes": "Yes, delete and save creation!"
},
"reject": {
"deny": {
"question": "Do you really want to carry out and finally save this pre-stored creation?",
"text": "After saving, the record can no longer be changed or deleted. Please check carefully that everything is correct.",
"title": "Reject creation!",

View File

@ -14,7 +14,7 @@
</template>
<template #submit-btn>
<b-button size="md" variant="success" class="m-3 text-right" @click="overlayEvent">
{{ $t(overlyBtnText) }}
{{ $t(overlayBtnText) }}
</b-button>
</template>
</overlay>
@ -46,16 +46,12 @@ export default {
return {
pendingCreations: [],
overlay: false,
overlayTitle: '',
overlayText: '',
overlayQuestion: '',
overlayEvent: '',
overlyBtnText: '',
item: {},
variant: 'confirm',
}
},
methods: {
removeCreation() {
deleteCreation() {
this.$apollo
.mutate({
mutation: adminDeleteContribution,
@ -98,30 +94,7 @@ export default {
showOverlay(item, variant) {
this.overlay = true
this.item = item
switch (variant) {
case 'confirm':
this.overlayTitle = 'overlay.confirm.title'
this.overlayText = 'overlay.confirm.text'
this.overlayQuestion = 'overlay.confirm.question'
this.overlyBtnText = 'overlay.confirm.yes'
this.overlayEvent = this.confirmCreation
break
case 'delete':
this.overlayTitle = 'overlay.delete.title'
this.overlayText = 'overlay.delete.text'
this.overlayQuestion = 'overlay.delete.question'
this.overlyBtnText = 'overlay.delete.yes'
this.overlayEvent = this.removeCreation
break
case 'reject':
this.overlayTitle = 'overlay.reject.title'
this.overlayText = 'overlay.reject.text'
this.overlayQuestion = 'overlay.reject.question'
this.overlyBtnText = 'overlay.reject.yes'
this.overlayEvent = 'reject-creation'
break
}
this.variant = variant
},
updateState(id) {
this.pendingCreations.find((obj) => obj.id === id).messagesCount++
@ -155,6 +128,21 @@ export default {
{ key: 'confirm', label: this.$t('save') },
]
},
overlayTitle() {
return `overlay.${this.variant}.title`
},
overlayText() {
return `overlay.${this.variant}.text`
},
overlayQuestion() {
return `overlay.${this.variant}.question`
},
overlayBtnText() {
return `overlay.${this.variant}.yes`
},
overlayEvent() {
return this[`${this.variant}Creation`]
},
},
apollo: {
PendingContributions: {