Sfoglia il codice sorgente

Email Recipients

master
30117125 4 anni fa
parent
commit
cc32e2a6a0

+ 100
- 0
src/components/communication/emailRecipientEdit.vue Vedi File

@@ -0,0 +1,100 @@
1
+<template>
2
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col">
6
+          <div class="section-header">
7
+            <h2>Edit Recipient</h2>
8
+          </div>
9
+        </div>
10
+      </div>
11
+      <div class="row mb-5">
12
+        <div class="col">
13
+          <alert :text="alertMessage" :type="alertState" />
14
+        </div>
15
+      </div>
16
+      <div class="row">
17
+        <div class="col">
18
+          <float-label>
19
+            <input
20
+              v-model="recipient.recipientName"
21
+              type="text"
22
+              class="form-control uniInput"
23
+              placeholder="RECIPIENT NAME"
24
+            />
25
+          </float-label>
26
+        </div>
27
+        <div class="col">
28
+          <float-label>
29
+            <input
30
+              v-model="recipient.recipientMail"
31
+              type="text"
32
+              class="form-control uniInput"
33
+              placeholder="RECIPIENT EMAIL"
34
+            />
35
+          </float-label>
36
+        </div>
37
+        <div class="col">
38
+          <float-label fixed label="USAGE">
39
+            <select v-model="recipient.recipientUsage" class="form-control uniSelect">
40
+              <option value="ContactUs">Contact Us</option>
41
+              <option value="EnquireNow">Enquire Now</option>
42
+            </select>
43
+          </float-label>
44
+        </div>
45
+      </div>
46
+      <div class="row mt-4">
47
+        <div class="col">
48
+          <button class="btn-solid-blue" @click="sendToApi()">UPDATE</button>
49
+        </div>
50
+        <div class="col">
51
+          <router-link class="btn-solid-blue" to="/emailRecipient">CANCEL</router-link>
52
+        </div>
53
+      </div>
54
+    </div>
55
+  </main>
56
+</template>
57
+
58
+<script>
59
+/* eslint-disable */
60
+import { mapActions, mapState } from "vuex";
61
+import alert from "../shared/alert";
62
+
63
+export default {
64
+  components: {
65
+    alert
66
+  },
67
+  created() {
68
+    this.getMailRecipientById(this.$route.params.id).then(() => {
69
+      console.log(this.recipient);
70
+    });
71
+  },
72
+  computed: {
73
+    ...mapState("template", ["recipient"])
74
+  },
75
+  methods: {
76
+    ...mapActions("template", ["getMailRecipientById", "updateMailRecipient"]),
77
+    sendToApi() {
78
+      if (this.checkEmail(this.recipient.recipientMail)) {
79
+        if (this.recipient.recipientUsage != "") {
80
+          this.updateMailRecipient(this.recipient).then(() => {
81
+            this.$router.push("/emailRecipient");
82
+          });
83
+        } else {
84
+          this.alertMessage = "Please select a usage type";
85
+          this.alertState = "ERROR";
86
+        }
87
+      } else {
88
+        this.alertMessage = "Invalid Email";
89
+        this.alertState = "ERROR";
90
+      }
91
+    },
92
+    checkEmail(email) {
93
+      const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
94
+      return re.test(String(email).toLowerCase());
95
+    }
96
+  }
97
+};
98
+</script>
99
+
100
+<style lang="scss" scoped></style>

+ 103
- 0
src/components/communication/emailRecipientNew.vue Vedi File

@@ -0,0 +1,103 @@
1
+<template>
2
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col">
6
+          <div class="section-header">
7
+            <h2>New Email Recipient</h2>
8
+          </div>
9
+        </div>
10
+      </div>
11
+      <div class="row mb-5">
12
+        <div class="col">
13
+          <alert :text="alertMessage" :type="alertState" />
14
+        </div>
15
+      </div>
16
+      <div class="row">
17
+        <div class="col">
18
+          <float-label>
19
+            <input
20
+              v-model="recipient.recipientName"
21
+              type="text"
22
+              class="form-control uniInput"
23
+              placeholder="RECIPIENT NAME"
24
+            />
25
+          </float-label>
26
+        </div>
27
+        <div class="col">
28
+          <float-label>
29
+            <input
30
+              v-model="recipient.recipientMail"
31
+              type="text"
32
+              class="form-control uniInput"
33
+              placeholder="RECIPIENT EMAIL"
34
+            />
35
+          </float-label>
36
+        </div>
37
+        <div class="col">
38
+          <float-label fixed label="USAGE">
39
+            <select v-model="recipient.recipientUsage" class="form-control uniSelect">
40
+              <option value="ContactUs">Contact Us</option>
41
+              <option value="EnquireNow">Enquire Now</option>
42
+            </select>
43
+          </float-label>
44
+        </div>
45
+      </div>
46
+      <div class="row mt-4">
47
+        <div class="col">
48
+          <button class="btn-solid-blue" @click="sendToApi()">SAVE</button>
49
+        </div>
50
+        <div class="col">
51
+          <router-link class="btn-solid-blue" to="/emailRecipient">CANCEL</router-link>
52
+        </div>
53
+      </div>
54
+    </div>
55
+  </main>
56
+</template>
57
+
58
+<script>
59
+/* eslint-disable */
60
+import { mapActions } from "vuex";
61
+import alert from "../shared/alert";
62
+
63
+export default {
64
+  components: {
65
+    alert
66
+  },
67
+  data() {
68
+    return {
69
+      recipient: {
70
+        recipientName: "",
71
+        recipientMail: "",
72
+        recipientUsage: ""
73
+      },
74
+      alertMessage: "",
75
+      alertState: ""
76
+    };
77
+  },
78
+  methods: {
79
+    ...mapActions("template", ["addMailRecipient"]),
80
+    sendToApi() {
81
+      if (this.checkEmail(this.recipient.recipientMail)) {
82
+        if (this.recipient.recipientUsage != "") {
83
+          this.addMailRecipient(this.recipient).then(() => {
84
+            this.$router.push("/emailRecipient");
85
+          });
86
+        } else {
87
+          this.alertMessage = "Please select a usage type";
88
+          this.alertState = "ERROR";
89
+        }
90
+      } else {
91
+        this.alertMessage = "Invalid Email";
92
+        this.alertState = "ERROR";
93
+      }
94
+    },
95
+    checkEmail(email) {
96
+      const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
97
+      return re.test(String(email).toLowerCase());
98
+    }
99
+  }
100
+};
101
+</script>
102
+
103
+<style lang="scss" scoped></style>

+ 70
- 0
src/components/communication/emailRecipients.vue Vedi File

@@ -0,0 +1,70 @@
1
+<template>
2
+  <main id="main" style="margin-top:200px; padding-bottom:50px">
3
+    <div class="container">
4
+      <div class="row">
5
+        <div class="col">
6
+          <div class="section-header">
7
+            <h2>Email Recipients</h2>
8
+          </div>
9
+        </div>
10
+      </div>
11
+      <div class="row">
12
+        <div class="col">
13
+          <listView
14
+            :items="recipients"
15
+            :showNew="true"
16
+            :editable="true"
17
+            :deleteable="true"
18
+            :hideSearch="true"
19
+            :showColumnChooser="false"
20
+            :displayColumns="columns"
21
+            :sortKey="'description'"
22
+            @onEdit="Edit"
23
+            @onDelete="Delete"
24
+            @onNew="New"
25
+          />
26
+        </div>
27
+      </div>
28
+    </div>
29
+  </main>
30
+</template>
31
+
32
+<script>
33
+/* eslint-disable */
34
+import { mapActions, mapState } from "vuex";
35
+import listView from "../shared/listView";
36
+
37
+export default {
38
+  name: "MailRecipients",
39
+  components: {
40
+    listView
41
+  },
42
+  data() {
43
+    return {
44
+      columns: ["recipientName", "recipientMail", "recipientUsage"]
45
+    };
46
+  },
47
+  created() {
48
+    this.getMailRecipients();
49
+  },
50
+  computed: {
51
+    ...mapState("template", ["recipients"])
52
+  },
53
+  methods: {
54
+    ...mapActions("template", ["getMailRecipients", "deleteMailRecipient"]),
55
+    New() {
56
+      this.$router.push("/emailRecipient/new");
57
+    },
58
+    Edit(item) {
59
+      this.$router.push({
60
+        path: `/emailRecipient/Edit/${item.id}`
61
+      });
62
+    },
63
+    Delete(item) {
64
+      this.deleteMailRecipient(item.id);
65
+    }
66
+  }
67
+};
68
+</script>
69
+
70
+<style lang="scss" scoped></style>

+ 1
- 1
src/components/shared/contactUsSection.vue Vedi File

@@ -105,7 +105,7 @@ export default {
105 105
   methods: {
106 106
     async sendMail() {
107 107
       var mailObj = {
108
-        toAddress: "abigaildf@provision-sa.com",
108
+        //toAddress: "abigaildf@provision-sa.com",
109 109
         fromAddress: "jlouw365@gmail.com",
110 110
         name: this.name,
111 111
         email: this.email,

+ 6
- 2
src/components/shared/navBar.vue Vedi File

@@ -43,7 +43,8 @@
43 43
                   </router-link>
44 44
                 </div>
45 45
               </div>
46
-              <nav id="nav-menu-container">
46
+
47
+              <nav id="nav-menu-container" class="mt-2">
47 48
                 <ul class="nav-menu sf-js-enabled sf-arrows">
48 49
                   <li style="margin-left:-20px">
49 50
                     <router-link to="/property/commercial">Commercial</router-link>
@@ -243,11 +244,14 @@
243 244
                           style="margin-top:-10px;text-align:left;width:250px"
244 245
                           :class="submenu1Class"
245 246
                         >
247
+                          <li>
248
+                            <router-link to="/termsConditions">Edit Terms & Conditions</router-link>
249
+                          </li>
246 250
                           <li>
247 251
                             <router-link to="/communication/template">Email Templates</router-link>
248 252
                           </li>
249 253
                           <li>
250
-                            <router-link to="/termsConditions">Edit Terms & Conditions</router-link>
254
+                            <router-link to="/emailRecipient">Email Recipients</router-link>
251 255
                           </li>
252 256
                           <li>
253 257
                             <router-link to="/fees">Fees</router-link>

+ 1
- 1
src/components/user/forgotPasswordReset.vue Vedi File

@@ -149,7 +149,7 @@ export default {
149 149
       var Tokendate = new Date(this.byteArrayToLong(timeArr));
150 150
       var d = new Date();
151 151
       var date = new Date(d.getTime());
152
-      var upperDate = new Date(Tokendate.setHours(Tokendate.getHours() + 2));
152
+      var upperDate = new Date(Tokendate.setHours(Tokendate.getHours() + 1));
153 153
 
154 154
       if (date < upperDate) {
155 155
         this.validLink = true;

+ 18
- 0
src/router/index.js Vedi File

@@ -73,6 +73,9 @@ import CarouselList from "../components/admin/misc/carouselList.vue";
73 73
 import CarouselDetail from "../components/admin/misc/carousel.vue";
74 74
 import AlertPage from "../components/shared/alertPage.vue";
75 75
 import PropertySearchResults from "../components/property/propertySearchResults.vue";
76
+import EmailRecipient from '../components/communication/emailRecipients.vue'
77
+import EmailRecipientNew from '../components/communication/emailRecipientNew.vue'
78
+import EmailRecipientEdit from '../components/communication/emailRecipientEdit.vue'
76 79
 
77 80
 import CommercialSearchResults from "../components/property/commercial/commercialSearchResults.vue";
78 81
 import ResidentialSearchResults from "../components/property/residential/residentialSearchResults.vue";
@@ -497,5 +500,20 @@ export default new Router({
497 500
       name: "ForgotPasswordReset",
498 501
       component: ForgotPasswordReset,
499 502
     },
503
+    {
504
+      path: "/emailRecipient",
505
+      name: "emailRecipient",
506
+      component: EmailRecipient,
507
+    },
508
+    {
509
+      path: "/emailRecipient/new",
510
+      name: "emailRecipientNew",
511
+      component: EmailRecipientNew,
512
+    },
513
+    {
514
+      path: "/emailRecipient/Edit/:id",
515
+      name: "emailRecipientEdit",
516
+      component: EmailRecipientEdit,
517
+    },
500 518
   ]
501 519
 });

+ 59
- 0
src/store/modules/communication/template.js Vedi File

@@ -1,4 +1,6 @@
1
+/* eslint-disable */
1 2
 import axios from 'axios';
3
+import { result } from 'lodash';
2 4
 
3 5
 export default {
4 6
   namespaced: true,
@@ -6,11 +8,23 @@ export default {
6 8
     list: [],
7 9
     item: {},
8 10
     message: undefined,
11
+    recipients: [],
12
+    recipient: {}
9 13
   },
10 14
   mutations: {
11 15
     setList(state, list) {
12 16
       state.list = list;
13 17
     },
18
+    setRecipients(state, recips){
19
+      state.recipients = recips
20
+    },
21
+    setRecipient(state, recip){
22
+      state.recipient = recip
23
+    },
24
+    removeRecipient(state, id){
25
+      var index = state.recipients.findIndex((recip) => recip.id == id)
26
+      state.recipients.splice(index, 1)
27
+    }
14 28
   },
15 29
   getters: {},
16 30
   actions: {
@@ -38,5 +52,50 @@ export default {
38 52
         .then(() => dispatch('getList'))
39 53
         .catch(console.error);
40 54
     },
55
+    async getMailRecipients({commit}){
56
+      await axios.get('/api/mail/mailrecipients')
57
+      .then((result) => {
58
+        commit("setRecipients", result.data)
59
+      })
60
+      .catch((e) => {
61
+        console.log(e);
62
+      })
63
+    },
64
+    async getMailRecipientById({commit}, id){
65
+      await axios.get('/api/mail/mailrecipient/' + id)
66
+      .then((result) => {
67
+        commit("setRecipient", result.data)
68
+      })
69
+      .catch((e) => {
70
+        console.log(e);
71
+      })
72
+    },
73
+    async addMailRecipient({commit}, rec){
74
+      await axios.post('/api/mail/mailrecipient', rec)
75
+      .then((result) => {
76
+        console.log(result);
77
+      })
78
+      .catch((e) => {
79
+        console.log(e);
80
+      })
81
+    },
82
+    async updateMailRecipient({commit}, rec){
83
+      await axios.put('/api/mail/mailrecipients', rec)
84
+      .then((result) => {
85
+        console.log(result);
86
+      })
87
+      .catch((e) => {
88
+        console.log(e);
89
+      })
90
+    },
91
+    async deleteMailRecipient({commit}, id){
92
+      await axios.delete('/api/mail/mailrecipient/'+ id)
93
+      .then(() => {
94
+        commit("removeRecipient", id)
95
+      })
96
+      .catch((e) => {
97
+        console.log(e);
98
+      })
99
+    }
41 100
   },
42 101
 };

Loading…
Annulla
Salva