All files / components/Admin/AdminOrders/AdminOrder/modals ContactModal.vue

0% Statements 0/2
100% Branches 0/0
100% Functions 0/0
0% Lines 0/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128                                                                                                                                                                                                                                                               
<template>
  <BModal v-model="show" id="contact-modal" title="Contact customer" centered>
    <form v-on:submit.prevent="submit" id="contact-form">
      <div class="row">
        <div class="col-6 d-flex flex-column">
          <label class="d-flex" for="customer-email"> To </label>
          <input
            id="customer-email"
            type="text"
            v-model="userEmail"
            required
            autofocus="true"
            disabled
          />
        </div>
        <div class="col-6 mb-2 d-flex flex-column">
          <label class="d-flex" for="organization-email"> From </label>
          <select id="organization-email" v-model="chosedFromEmails" required>
            <option v-for="email in fromMails" :key="email" :value="email">
              {{ email }}
            </option>
          </select>
        </div>
      </div>
      <div class="mb-2 w-100">
        <label class="d-flex" for=""> Send dcc to: </label>
        <div id="send-to-bcc">
          <div
            v-for="support in supportEmails"
            :key="support"
            class="d-flex align-items-center"
          >
            <input
              :id="support"
              type="checkbox"
              :value="support"
              v-model="chosedSupportEmails"
              autofocus="true"
              required
              class="mr-3"
            />
            <label class="d-flex" :for="support"> {{ support }} </label>
          </div>
        </div>
      </div>
      <div class="mb-2 w-100">
        <label class="d-flex" for="subject"> Subject </label>
        <input
          type="text"
          id="subject"
          placeholder="Message from:"
          v-model="messageFrom"
          required
          class="w-100"
        />
      </div>
      <div class="w-100">
        <label class="d-flex" for="custom-message">
          Custom message (optional)
        </label>
        <textarea
          type="text"
          id="custom-message"
          v-model="customMessage"
          class="w-100"
        />
      </div>
    </form>
    <template #modal-footer>
      <div class="w-100 d-flex justify-content-end">
        <button size="sm" class="btn btn-light mr-2" v-on:click="show = false">
          Cancel
        </button>
        <button
          size="sm"
          class="btn btn-success"
          type="submit"
          form="contact-form"
        >
          Review Email
        </button>
      </div>
    </template>
  </BModal>
</template>

<script>
export default {
  name: "ContactModal",
  props: { order: Object },
  data: () => ({
    show: false,
    userEmail: "",
    fromMails: [
      "test@gmail.com",
      "test1@gmail.com",
      "test2@gmail.com",
      "test3@gmail.com",
    ],
    supportEmails: [
      "support@gmail.com",
      "support1@gmail.com",
      "support2@gmail.com",
      "support3@gmail.com",
    ],
    messageFrom: "",
    chosedFromEmails: "",
    customMessage: "",
    chosedSupportEmails: [],
  }),
  methods: {
    submit: function () {
      console.log(
        this.messageFrom,
        this.chosedFromEmails,
        this.customMessage,
        this.chosedSupportEmails
      );
    },
  },
  mounted() {
    this.userEmail = this.order?.user?.email || "";
  },
};
</script>
 
<style scoped>
</style>