From 4f189ea08cc73c634c91552b8ac5e13e7c8b8837 Mon Sep 17 00:00:00 2001 From: vishwas1 Date: Mon, 8 Aug 2022 09:37:07 +0530 Subject: [PATCH 1/3] implemented schedules --- src/views/superAdmin/Home.vue | 103 +++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 33 deletions(-) diff --git a/src/views/superAdmin/Home.vue b/src/views/superAdmin/Home.vue index 1a39aaae..86354ae2 100644 --- a/src/views/superAdmin/Home.vue +++ b/src/views/superAdmin/Home.vue @@ -3,11 +3,12 @@

Super Admin Portal


-
+
+ role="tab" + >
Execute
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Schedule IdTime (UTC)Event IdTotal MailsPassed MailsFailed MailsStatus
{{schedule._id}}{{new Date(schedule.scheduledAt).toLocaleString()}}{{schedule.eventId}}{{schedule.totalEmailsToSend}}{{schedule.totalPassedEmails}}{{schedule.totalFailedEmails}}{{schedule.status}}
+
@@ -58,36 +87,6 @@ - //To be implemented - @@ -208,6 +207,7 @@ export default { masterKey: "StageKey1", response: null, authToken: localStorage.getItem("authToken"), + schedules: [], resources: [{ id: 1, name: "Promote An Event", @@ -251,6 +251,10 @@ export default { ] } }, + created(){ + /// TODO: Temporary fix + this.getAllSchedules(); + }, methods: { clearAll(){ this.isLoading = false; @@ -259,6 +263,35 @@ export default { this.masterKey = "" }, + async getAllSchedules(){ + try{ + this.isLoading = true; + let url = `${this.$config.studioServer.BASE_URL}api/v1/notification/email/schedules`; + const Url = new URL(this.$config.studioServer.BASE_URL) + const headers = { + Orign: Url.origin, + "Content-Type": "application/json", + Authorization: `Bearer ${this.authToken}`, + }; + + const resp = await fetch(url, { + headers + }); + + if(resp && resp.status === (403 || 401)){ + throw new Error("Incorrect master key") + } + const json = await resp.json(); + if(resp.status != 200){ + throw new Error(json) + } + this.schedules = json; + }catch(e){ + this.notifyErr(e.message); + } finally { + this.isLoading = false; + } + }, async execute(resource){ try { const res = await this.$swal @@ -327,12 +360,16 @@ export default { throw new Error(json) } - const { message } = json; + const { message, schedule } = json; if(message){ this.notifySuccess(message); } else { this.notifySuccess(json); } + + if(schedule){ + this.schedules.unshift(schedule); + } } catch (e) { this.notifyErr(e.message); From b9dbacfab7fada260833b4580dad77ea05cd0461 Mon Sep 17 00:00:00 2001 From: rajpatil6939 Date: Tue, 9 Aug 2022 14:19:55 +0530 Subject: [PATCH 2/3] just commiting --- src/mixins/fieldValidationMixin.js | 7 + src/mixins/masterKeyPopupMixin.js | 29 ++ src/views/superAdmin/Home.vue | 440 +++++++++++++++++++++++++---- 3 files changed, 423 insertions(+), 53 deletions(-) create mode 100644 src/mixins/masterKeyPopupMixin.js diff --git a/src/mixins/fieldValidationMixin.js b/src/mixins/fieldValidationMixin.js index 1feeb6d5..b8dc2dc3 100644 --- a/src/mixins/fieldValidationMixin.js +++ b/src/mixins/fieldValidationMixin.js @@ -45,6 +45,13 @@ export function isValidText(str) { return false; } } +export function isOnlyAlphaNumeric(str){ + if(str.match(/^[a-zA-Z0-9]*$/)){ + return true; + }else{ + return false + } +} export function isValidSlug(str){ if(str.match(/^([a-z0-9])*(-([a-z0-9])*)*$/)){ return true diff --git a/src/mixins/masterKeyPopupMixin.js b/src/mixins/masterKeyPopupMixin.js new file mode 100644 index 00000000..7bf30781 --- /dev/null +++ b/src/mixins/masterKeyPopupMixin.js @@ -0,0 +1,29 @@ +export default{ + methods:{ + async masterPop(){ + let masterKey; + await this.$swal + .fire({ + html: ` +
Enter Master Key To Execute
+ `, + confirmButtonText: 'Confirm', + confirmButtonColor: "red", + icon: "warning", + focusConfirm: false, + showCloseButton: true, + allowOutsideClick: false, + preConfirm: () => { + masterKey = this.$swal.getPopup().querySelector("#name").value; + if (masterKey === "") { + this.$swal.showValidationMessage(`Please enter the master key to proceed`); + } + return { masterKey }; + }, + + }) + console.log(masterKey); + return masterKey; + } + } +} \ No newline at end of file diff --git a/src/views/superAdmin/Home.vue b/src/views/superAdmin/Home.vue index 86354ae2..a56c6c48 100644 --- a/src/views/superAdmin/Home.vue +++ b/src/views/superAdmin/Home.vue @@ -3,7 +3,7 @@

Super Admin Portal


-
+
-
+
@@ -35,12 +35,62 @@
-
+
+
+
+ + +
+
+ +
+
+ +
+
+ + + + +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
@@ -56,10 +106,10 @@ - + - + @@ -69,6 +119,48 @@
{{schedule._id}} {{new Date(schedule.scheduledAt).toLocaleString()}}{{schedule.userId}} {{schedule.eventId}} {{schedule.totalEmailsToSend}} {{schedule.totalPassedEmails}}
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + +
Coupon NameDiscountExpired atMaximum LimitUsage CountUpdateDelete
{{coupon.name}}{{coupon.discount}}{{new Date(coupon.expiredAt).toLocaleString()}}{{coupon.maxClaimCount}}{{coupon.usageCount}} + + + + +
+
@@ -97,6 +189,30 @@