From 6ae0a40529ccc7812932a0a511f349f21a0ead48 Mon Sep 17 00:00:00 2001 From: Chad Derya Date: Tue, 10 Sep 2019 09:56:57 +0100 Subject: [PATCH] delete confirmation screen dynamic and pretty for success and error --- src/components/PopUps/Delete/index.vue | 53 +++++++++++++++++--------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/components/PopUps/Delete/index.vue b/src/components/PopUps/Delete/index.vue index 56a35bb4..75e9fd32 100644 --- a/src/components/PopUps/Delete/index.vue +++ b/src/components/PopUps/Delete/index.vue @@ -4,7 +4,7 @@ Delete -
+

Are you sure you want to delete this {{ type }} ? @@ -25,15 +25,9 @@ Confirm

-
-

SUCCESS you can now close this popup

-

{{ item._id }}

- - Close - -
-
-

ERROR please try again, if the error persist contact Chadmin!

+
+ +

{{ confirmation.text }}

Close @@ -68,9 +62,15 @@ export default { data() { return { dialogVisible: false, - viewState: 'initialState', isNameCorrect: true, - input: '' + input: '', + viewState: 'input', + Error: false, + confirmation: { + text: 'Loading', + icon: 'el-icon-loading', + iconStyle: 'font-size: 75px;' + } } }, watch: { @@ -84,9 +84,15 @@ export default { }, methods: { openDeletePopup() { + // do the object assing thing to default like edit/create product this.dialogVisible = true - this.viewState = 'initialState' + this.viewState = 'input' this.input = '' + this.confirmation = { + text: 'Loading', + icon: 'el-icon-loading', + iconStyle: 'font-size: 75px;' + } }, checkAllSuccess() { return Object.keys(this.listObj).every(item => this.listObj[item].hasSuccess) @@ -98,16 +104,24 @@ export default { } else { console.log(deleteProduct(this.item._id)) } - console.log(deleteProduct(this.item._id)) // delete${this.type}(this.item._id)) // .then((r) => { // console.log(r) // }) - if (this.input) { - this.viewState = 'Success' - } else if (!this.input) { - this.viewState = 'Error' + this.viewState = 'confirmation' + // if (response && response.success){ + this.confirmation = { + text: `Succesfully deleted ${this.item.name} form ${this.type}s list`, + icon: 'el-icon-circle-check', + iconStyle: 'font-size: 75px; color: green;' } + // }else if (!response || !response.success){ + // this.confirmation = { + // text: `Error deleting ${this.item.name} form ${this.type}s list. /n Please refresh your page and try again. If the Error persists, please contact Chadmin`, + // icon: 'el-icon-circle-close', + // iconStyle: 'font-size: 75px; color: red;' + // } + // } } } } @@ -117,4 +131,7 @@ export default { .inputBox { margin-bottom: 20px; } +.icon { +} +