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!", "title": "Gemeinwohl-Beitrag löschen!",
"yes": "Ja, Beitrag löschen!" "yes": "Ja, Beitrag löschen!"
}, },
"reject": { "deny": {
"question": "Willst du diesen Gemeinwohl-Beitrag wirklich ablehnen?", "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.", "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!", "title": "Gemeinwohl-Beitrag ablehnen!",

View File

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

View File

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