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.

458 lines
15 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div>
  3. <table class="table-auto">
  4. <template v-if="windewWidth>414">
  5. <tr class="elemen">
  6. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  7. <div class="tw-flex tw-items-center">
  8. <label class="tw-font-normal ">
  9. <span>{{ $t("Company Name")}}</span>
  10. </label>
  11. </div>
  12. </td>
  13. <td width="99%">
  14. <div class="element tw-my-[10px] tw-w-full">
  15. <ElementInputNew
  16. :input="{
  17. id: 'CompanyName',
  18. required: false,
  19. type: 'text',
  20. placeholder: ''
  21. }"
  22. :validation="validation.company_name"
  23. @change="formData.company_name = $event"
  24. ></ElementInputNew></div>
  25. </td>
  26. </tr>
  27. <tr class="element">
  28. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  29. <div class="tw-flex tw-items-center">
  30. <label class="tw-font-normal ">
  31. <span>{{ $t("Unified Number")}}</span>
  32. </label>
  33. </div>
  34. </td>
  35. <td width="99%">
  36. <div class="element tw-my-[10px]">
  37. <ElementInputNew
  38. :input="{
  39. id: 'UnifiedBumber',
  40. required: false,
  41. type: 'text',
  42. placeholder: ''
  43. }"
  44. :validation="validation.unified_number"
  45. @change="formData.unified_number = $event"
  46. >
  47. </ElementInputNew></div>
  48. </td>
  49. </tr>
  50. <tr class="element">
  51. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  52. <div class="tw-flex tw-items-center">
  53. <label class="tw-font-normal ">
  54. <span>{{ $t("Company Address")}}</span>
  55. </label>
  56. </div>
  57. </td>
  58. <td width="99%">
  59. <div class="element tw-my-[10px]">
  60. <ElementInputNew
  61. :input="{
  62. id: 'Company address',
  63. required: false,
  64. type: 'text',
  65. placeholder: ''
  66. }"
  67. :maxlength="500"
  68. :validation="validation.company_address"
  69. @change="formData.company_address = $event"
  70. >
  71. </ElementInputNew></div>
  72. </td>
  73. </tr>
  74. <tr class="element">
  75. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  76. <div class="tw-flex tw-items-center">
  77. <label class="tw-font-normal ">
  78. <span>{{ $t("Company City")}}</span>
  79. </label>
  80. </div>
  81. </td>
  82. <td width="99%">
  83. <div class="element tw-my-[10px]">
  84. <ElementInputNew
  85. :input="{
  86. id: 'companyCity',
  87. required: false,
  88. type: 'text',
  89. placeholder: ''
  90. }"
  91. :validation="validation.city_"
  92. @change="formData.city_ = $event"
  93. >
  94. </ElementInputNew></div>
  95. </td>
  96. </tr>
  97. <tr class="element">
  98. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  99. <div class="tw-flex tw-items-center">
  100. <label class="tw-font-normal ">
  101. <span>{{ $t("State or Province")}}</span>
  102. </label>
  103. </div>
  104. </td>
  105. <td width="99%">
  106. <div class="element tw-my-[10px]">
  107. <ElementInputNew
  108. :input="{
  109. id: 'State or Province',
  110. required: false,
  111. type: 'text',
  112. placeholder: ''
  113. }"
  114. :validation="validation.state_or_province"
  115. @change="formData.state_or_province = $event"
  116. >
  117. </ElementInputNew></div>
  118. </td>
  119. </tr>
  120. <tr class="element">
  121. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  122. <div class="tw-flex tw-items-center">
  123. <label class="tw-font-normal ">
  124. <span>{{ $t("Country")}}</span>
  125. </label>
  126. </div>
  127. </td>
  128. <td width="99%">
  129. <div class="element tw-my-[10px]">
  130. <elementSelectNew
  131. :select="{
  132. id: 'Country',
  133. label: '',
  134. required: true,
  135. }"
  136. :isRow="true"
  137. :itemsCenter="true"
  138. :labelWidth="0"
  139. :selectWidth="200"
  140. :selectList="countryOptions"
  141. :default="formData.country"
  142. :validation="validation.country"
  143. @change="formData.country = $event"
  144. >
  145. </elementSelectNew></div>
  146. </td>
  147. </tr>
  148. <tr class="element">
  149. <td class="tw-pr-[20px]" style="white-space: nowrap;">
  150. <div class="tw-flex tw-items-center">
  151. <label class="tw-font-normal ">
  152. <span>{{ $t("Postal Code")}}</span>
  153. </label>
  154. </div>
  155. </td>
  156. <td width="99%">
  157. <div class="element tw-my-[10px]">
  158. <ElementInputNew
  159. :input="{
  160. id: 'Postal Code',
  161. required: false,
  162. type: 'text',
  163. placeholder: ''
  164. }"
  165. :maxlength="10"
  166. :validation="validation.postal_code"
  167. @change="formData.postal_code = $event"
  168. >
  169. </ElementInputNew></div>
  170. </td>
  171. </tr>
  172. </template>
  173. <template v-else>
  174. <tr class="element">
  175. <div class="tw-flex tw-items-center">
  176. <label class="tw-font-normal ">
  177. <span>{{ $t("Company Name")}}</span>
  178. </label>
  179. </div>
  180. </tr>
  181. <tr>
  182. <div class="element tw-my-[10px] tw-w-full">
  183. <ElementInputNew
  184. :input="{
  185. id: 'CompanyName',
  186. required: false,
  187. type: 'text',
  188. placeholder: ''
  189. }"
  190. :validation="validation.company_name"
  191. @change="formData.company_name = $event"
  192. ></ElementInputNew></div>
  193. </tr>
  194. <tr class="element">
  195. <div class="tw-flex tw-items-center">
  196. <label class="tw-font-normal ">
  197. <span>{{ $t("Unified Number")}}</span>
  198. </label>
  199. </div>
  200. </tr>
  201. <tr>
  202. <div class="element tw-my-[10px]">
  203. <ElementInputNew
  204. :input="{
  205. id: 'UnifiedBumber',
  206. required: false,
  207. type: 'text',
  208. placeholder: ''
  209. }"
  210. :validation="validation.unified_number"
  211. @change="formData.unified_number = $event"
  212. >
  213. </ElementInputNew></div>
  214. </tr>
  215. <tr class="element">
  216. <div class="tw-flex tw-items-center">
  217. <label class="tw-font-normal ">
  218. <span>{{ $t("Company Address")}}</span>
  219. </label>
  220. </div>
  221. </tr>
  222. <tr>
  223. <div class="element tw-my-[10px]">
  224. <ElementInputNew
  225. :input="{
  226. id: 'Company address',
  227. required: false,
  228. type: 'text',
  229. placeholder: ''
  230. }"
  231. :maxlength="500"
  232. :validation="validation.company_address"
  233. @change="formData.company_address = $event"
  234. >
  235. </ElementInputNew></div>
  236. </tr>
  237. <tr class="element">
  238. <div class="tw-flex tw-items-center">
  239. <label class="tw-font-normal ">
  240. <span>{{ $t("Company City")}}</span>
  241. </label>
  242. </div>
  243. </tr>
  244. <tr>
  245. <div class="element tw-my-[10px]">
  246. <ElementInputNew
  247. :input="{
  248. id: 'companyCity',
  249. required: false,
  250. type: 'text',
  251. placeholder: ''
  252. }"
  253. :validation="validation.city_"
  254. @change="formData.city_ = $event"
  255. >
  256. </ElementInputNew></div>
  257. </tr>
  258. <tr class="element">
  259. <div class="tw-flex tw-items-center">
  260. <label class="tw-font-normal ">
  261. <span>{{ $t("State or Province")}}</span>
  262. </label>
  263. </div>
  264. </tr>
  265. <tr>
  266. <div class="element tw-my-[10px]">
  267. <ElementInputNew
  268. :input="{
  269. id: 'State or Province',
  270. required: false,
  271. type: 'text',
  272. placeholder: ''
  273. }"
  274. :validation="validation.state_or_province"
  275. @change="formData.state_or_province = $event"
  276. >
  277. </ElementInputNew></div>
  278. </tr>
  279. <tr class="element">
  280. <div class="tw-flex tw-items-center">
  281. <label class="tw-font-normal ">
  282. <span>{{ $t("Country")}}</span>
  283. </label>
  284. </div>
  285. </tr>
  286. <tr>
  287. <div class="element tw-my-[10px]">
  288. <ElementInputNew
  289. :input="{
  290. id: 'Country',
  291. required: false,
  292. type: 'text',
  293. placeholder: ''
  294. }"
  295. :validation="validation.country"
  296. @change="formData.country = $event"
  297. >
  298. </ElementInputNew></div>
  299. </tr>
  300. <tr class="element">
  301. <div class="tw-flex tw-items-center">
  302. <label class="tw-font-normal ">
  303. <span>{{ $t("Postal Code")}}</span>
  304. </label>
  305. </div>
  306. </tr>
  307. <tr>
  308. <div class="element tw-my-[10px]">
  309. <ElementInputNew
  310. :input="{
  311. id: 'Postal Code',
  312. required: false,
  313. type: 'text',
  314. placeholder: ''
  315. }"
  316. :maxlength="10"
  317. :validation="validation.postal_code"
  318. @change="formData.postal_code = $event"
  319. >
  320. </ElementInputNew></div>
  321. </tr>
  322. </template>
  323. </table>
  324. </div>
  325. </template>
  326. <script>
  327. import ElementInputNew from "@/components/newComponent/form/ElementInputNew";
  328. import elementSelectNew from "@/components/newComponent/form/ElementSelectNew";
  329. import is from "is_js";
  330. export default {
  331. name: "Contact",
  332. components: {
  333. ElementInputNew,
  334. elementSelectNew,
  335. is,
  336. },
  337. props: {
  338. countryOptions: {
  339. type: Array,
  340. },
  341. },
  342. data() {
  343. return {
  344. formData: {
  345. company_name: "",
  346. unified_number: "",
  347. company_address: "",
  348. city_: "",
  349. state_or_province: "",
  350. country: "0",
  351. postal_code: "",
  352. },
  353. validation: {
  354. company_name: true,
  355. unified_number: true,
  356. company_address: true,
  357. city_: true,
  358. state_or_province: true,
  359. country: true,
  360. postal_code: true,
  361. },
  362. errors: null,
  363. windewWidth: null,
  364. };
  365. },
  366. mounted() {},
  367. created(){
  368. if (process.browser) {
  369. window.addEventListener("resize", this.handleResize);
  370. }
  371. this.handleResize();
  372. },
  373. destroyed() {
  374. if (process.browser) {
  375. window.removeEventListener("resize", this.handleResize);
  376. }
  377. },
  378. methods: {
  379. handleResize() {
  380. if (process.browser) {
  381. this.windewWidth = window.innerWidth;
  382. }
  383. },
  384. reset() {
  385. this.formData = {
  386. company_name: "",
  387. unified_number: "",
  388. company_address: "",
  389. city_: "",
  390. state_or_province: "",
  391. country: "0",
  392. postal_code: "",
  393. };
  394. },
  395. getFormData() {
  396. let formData = JSON.parse(JSON.stringify(this.formData));
  397. return formData;
  398. // this.validators();
  399. // if (this.validators()) {
  400. // const patchData = JSON.parse(JSON.stringify(this.formData));
  401. // // this.$axios
  402. // // .post(
  403. // // `/member/contacts?jwt=${
  404. // // this.$auth.$storage.getUniversal("jwt").token
  405. // // }`,
  406. // // patchData
  407. // // )
  408. // // .then((result) => {
  409. // // if (result.status == 200) {
  410. // // this.$emit("update", true);
  411. // // this.reset();
  412. // // this.$modal.hide("add-contact-modal");
  413. // // }
  414. // // })
  415. // // .catch((err) => {
  416. // // console.log(err);
  417. // // });
  418. // }
  419. },
  420. validators() {
  421. // if (is.empty(this.formData.first_name)) {
  422. // this.validation.first_name = false;
  423. // } else {
  424. // this.validation.first_name = true;
  425. // }
  426. // if (is.empty(this.formData.last_name)) {
  427. // this.validation.last_name = false;
  428. // } else {
  429. // this.validation.last_name = true;
  430. // }
  431. // if (is.empty(this.formData.email) || is.not.email(this.formData.email)) {
  432. // this.validation.email = false;
  433. // } else {
  434. // this.validation.email = true;
  435. // }
  436. // if (
  437. // is.empty(this.formData.phone_number) &&
  438. // is.number(this.formData.phone_number)
  439. // ) {
  440. // this.validation.phone_number = false;
  441. // } else {
  442. // this.validation.phone_number = true;
  443. // }
  444. // this.errors = Object.entries(this.validation).filter(
  445. // (e) => e[1] == false
  446. // );
  447. // if (this.errors.length > 0) {
  448. // return false;
  449. // } else {
  450. // return true;
  451. // }
  452. },
  453. },
  454. };
  455. </script>
  456. <style lang="scss" scoped>
  457. </style>