Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

emailRecipientEdit.vue 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. <option value="WeekOfferMade-User">Timeshare Week Offer Made (User)</option>
  43. <option value="WeekOfferMade-Owner">Timeshare Week Offer Made (Admin)</option>
  44. <option value="WeekLoaded-Agent">Timeshare Week Listed (Agent)</option>
  45. <option value="WeekLoaded-Owner">Timeshare Week Listed (Owner)</option>
  46. </select>
  47. </float-label>
  48. </div>
  49. </div>
  50. <div class="row mt-4">
  51. <div class="col">
  52. <button class="btn-solid-blue" @click="sendToApi()">UPDATE</button>
  53. </div>
  54. <div class="col">
  55. <router-link class="btn-solid-blue" to="/emailRecipient">CANCEL</router-link>
  56. </div>
  57. </div>
  58. </div>
  59. </main>
  60. </template>
  61. <script>
  62. /* eslint-disable */
  63. import { mapActions, mapState } from "vuex";
  64. import alert from "../shared/alert";
  65. export default {
  66. components: {
  67. alert
  68. },
  69. created() {
  70. this.getMailRecipientById(this.$route.params.id).then(() => {
  71. console.log(this.recipient);
  72. });
  73. },
  74. computed: {
  75. ...mapState("template", ["recipient"])
  76. },
  77. methods: {
  78. ...mapActions("template", ["getMailRecipientById", "updateMailRecipient"]),
  79. sendToApi() {
  80. if (this.checkEmail(this.recipient.recipientMail)) {
  81. if (this.recipient.recipientUsage != "") {
  82. this.updateMailRecipient(this.recipient).then(() => {
  83. this.$router.push("/emailRecipient");
  84. });
  85. } else {
  86. this.alertMessage = "Please select a usage type";
  87. this.alertState = "ERROR";
  88. }
  89. } else {
  90. this.alertMessage = "Invalid Email";
  91. this.alertState = "ERROR";
  92. }
  93. },
  94. checkEmail(email) {
  95. 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,}))$/;
  96. return re.test(String(email).toLowerCase());
  97. }
  98. }
  99. };
  100. </script>
  101. <style lang="scss" scoped></style>