You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

178 lines
5.1 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="tw-w-3/4">
  3. <div class="element tw-mt-[16px]">
  4. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[112px_auto] xl:tw-grid-cols-[112px_auto] tw-gap-[10px]">
  5. <div class="tw-flex tw-items-center">
  6. <label class="tw-font-normal ">
  7. <span>{{ $t("First Name")}}</span><span class="required">*</span>
  8. </label>
  9. </div>
  10. <ElementInputNew
  11. :input="{
  12. id: 'FirstName',
  13. required: false,
  14. type: 'text',
  15. }"
  16. :validation="validation.first_name"
  17. @change="formData.first_name = $event"
  18. ></ElementInputNew>
  19. </div>
  20. </div>
  21. <div class="element tw-mt-[16px]">
  22. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[112px_auto] xl:tw-grid-cols-[112px_auto] tw-gap-[10px]">
  23. <div class="tw-flex tw-items-center">
  24. <label class="tw-font-normal ">
  25. <span>{{ $t("E-mail for contact")}}</span><span class="required">*</span>
  26. </label>
  27. </div>
  28. <ElementInputNew
  29. :input="{
  30. id: 'Country',
  31. required: false,
  32. type: 'text',
  33. }"
  34. :validation="validation.last_name"
  35. @change="formData.last_name = $event"
  36. >
  37. </ElementInputNew>
  38. </div>
  39. </div>
  40. <div class="element tw-mt-[16px]">
  41. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[112px_auto] xl:tw-grid-cols-[112px_auto] tw-gap-[10px]">
  42. <div class="tw-flex tw-items-center">
  43. <label class="tw-font-normal ">
  44. <span>{{ $t("Email")}}</span><span class="required">*</span>
  45. </label>
  46. </div>
  47. <ElementInputNew
  48. :input="{
  49. id: 'Email',
  50. required: false,
  51. type: 'email',
  52. }"
  53. :validation="validation.email"
  54. @change="formData.email = $event"
  55. >
  56. </ElementInputNew>
  57. </div>
  58. </div>
  59. <div class="element tw-mt-[16px]">
  60. <div class="element tw-grid tw-grid-cols-1 md:tw-grid-cols-[112px_auto] xl:tw-grid-cols-[112px_auto] tw-gap-[10px]">
  61. <div class="tw-flex tw-items-center">
  62. <label class="tw-font-normal ">
  63. <span>{{ $t("Phone")}}</span><span class="required">*</span>
  64. </label>
  65. </div>
  66. <ElementInputNew
  67. :input="{
  68. id: 'Phone',
  69. required: false,
  70. type: 'text',
  71. }"
  72. :validation="validation.phone_number"
  73. @change="formData.phone_number = $event"
  74. >
  75. </ElementInputNew>
  76. </div>
  77. </div>
  78. </div>
  79. </template>
  80. <script>
  81. import ElementInputNew from "@/components/newComponent/form/ElementInputNew";
  82. import is from "is_js";
  83. export default {
  84. name: "Contact",
  85. components: {
  86. ElementInputNew,
  87. is,
  88. },
  89. data() {
  90. return {
  91. formData: {
  92. first_name: "",
  93. last_name: "",
  94. email: "",
  95. country_code: "",
  96. phone_number: "",
  97. },
  98. validation: {
  99. first_name: true,
  100. last_name: true,
  101. email: true,
  102. phone_number: true,
  103. },
  104. errors: null,
  105. };
  106. },
  107. mounted() {},
  108. methods: {
  109. reset() {
  110. this.formData = {
  111. first_name: "",
  112. last_name: "",
  113. email: "",
  114. country_code: "",
  115. phone_number: "",
  116. };
  117. },
  118. save() {
  119. this.validators();
  120. if (this.validators()) {
  121. const patchData = JSON.parse(JSON.stringify(this.formData));
  122. // this.$axios
  123. // .post(
  124. // `/member/contacts?jwt=${
  125. // this.$auth.$storage.getUniversal("jwt").token
  126. // }`,
  127. // patchData
  128. // )
  129. // .then((result) => {
  130. // if (result.status == 200) {
  131. // this.$emit("update", true);
  132. // this.reset();
  133. // this.$modal.hide("add-contact-modal");
  134. // }
  135. // })
  136. // .catch((err) => {
  137. // console.log(err);
  138. // });
  139. }
  140. },
  141. validators() {
  142. // if (is.empty(this.formData.first_name)) {
  143. // this.validation.first_name = false;
  144. // } else {
  145. // this.validation.first_name = true;
  146. // }
  147. // if (is.empty(this.formData.last_name)) {
  148. // this.validation.last_name = false;
  149. // } else {
  150. // this.validation.last_name = true;
  151. // }
  152. // if (is.empty(this.formData.email) || is.not.email(this.formData.email)) {
  153. // this.validation.email = false;
  154. // } else {
  155. // this.validation.email = true;
  156. // }
  157. // if (
  158. // is.empty(this.formData.phone_number) &&
  159. // is.number(this.formData.phone_number)
  160. // ) {
  161. // this.validation.phone_number = false;
  162. // } else {
  163. // this.validation.phone_number = true;
  164. // }
  165. // this.errors = Object.entries(this.validation).filter(
  166. // (e) => e[1] == false
  167. // );
  168. // if (this.errors.length > 0) {
  169. // return false;
  170. // } else {
  171. // return true;
  172. // }
  173. },
  174. },
  175. };
  176. </script>
  177. <style lang="scss" scoped>
  178. </style>