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.

97 lines
3.6 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
  1. <template>
  2. <!-- close-contact-info -->
  3. <div>
  4. <div class="xl:tw-grid tw-gap-[15px] tw-grid-cols-[100px_100px_160px_200px_142px] tw-hidden tw-mb-[30px]">
  5. <div class="tw-text-neutrals-500 tw-body-4">{{ $t("First Name") }}</div>
  6. <div class="tw-text-neutrals-500 tw-body-4">{{ $t("Last Name") }}</div>
  7. <div class="tw-text-neutrals-500 tw-body-4">{{ $t("Phone") }}</div>
  8. <div class="tw-text-neutrals-500 tw-body-4">{{ $t("Email") }}</div>
  9. </div>
  10. <div v-for="(item, index) in contacts" :key="index"
  11. class="tw-flex tw-place-content-between tw-border-solid tw-border-neutral-200 tw-rounded-[10px] xl:tw-border-none xl:tw-px-0 tw-bg-white tw-py-[10px] tw-px-5 tw-mb-5 tw-mt-[30px] last:tw-mb-0">
  12. <!-- 手機板 -->
  13. <div class="xl:tw-hidden">
  14. <div class="tw-pb-[6px] tw-text-[14px] tw-font-medium tw-text-base-primary">
  15. {{ item.FirstName + " " + item.LastName }}
  16. </div>
  17. <div class="tw-pb-[6px] tw-text-[12px]">
  18. {{ "+" + item.PhoneCountryCode + item.PhoneNo }}
  19. </div>
  20. <div class="tw-text-[12px]">{{ item.Email }}</div>
  21. </div>
  22. <div class="tw-grid tw-grid-cols-1 tw-gap-[20px] md:tw-grid-cols-2 md:tw-gap-[15px] xl:tw-hidden">
  23. <button @click="editItem(index)" type="button">
  24. <img :src="editImg" alt="" class="tw-h-[28px] tw-w-[28px]" />
  25. </button>
  26. <button @click="deleteItem(index)" type="button">
  27. <img :src="deleteImg" alt="" class="tw-h-[28px] tw-w-[28px]" />
  28. </button>
  29. </div>
  30. <!-- 電腦版 -->
  31. <div class="tw-hidden xl:tw-block">
  32. <div class="xl:tw-flex xl:tw-flex-row">
  33. <div class="xl:tw-grid tw-gap-[15px] tw-grid-cols-[100px_100px_160px_200px_142px] tw-mr-[10px]">
  34. <div>{{ item.FirstName }}</div>
  35. <div>{{ item.LastName }}</div>
  36. <div>{{ item.PhoneNo }}</div>
  37. <div>{{ item.Email }}</div>
  38. <!-- <div>{{ item.passport_number }}</div> -->
  39. </div>
  40. <div class="tw-flex tw-flex-row">
  41. <button @click="editItem(index)" type="button">
  42. <img :src="editImg" alt="" class="tw-h-[28px] tw-w-[28px] tw-mr-[15px]" />
  43. </button>
  44. <button @click="deleteItem(index)" type="button">
  45. <img :src="deleteImg" alt="" class="tw-h-[28px] tw-w-[28px]" />
  46. </button>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. <EditContactModal :contact="item" @update="$emit('refetch-contact-info')"></EditContactModal>
  52. <DeleteContactModal :contactId="itemId" :contactName="itemName" @update="$emit('refetch-contact-info')">
  53. </DeleteContactModal>
  54. </div>
  55. </template>
  56. <script>
  57. import EditContactModal from "../newComponent/modal/UserEditContactModal.vue";
  58. import DeleteContactModal from "../newComponent/modal/UserDeleteContactModal.vue";
  59. export default {
  60. name: "ContactInfoContent",
  61. components: {
  62. EditContactModal,
  63. DeleteContactModal,
  64. },
  65. props: {
  66. contacts: {
  67. type: Array,
  68. default: () => [],
  69. },
  70. },
  71. data() {
  72. return {
  73. editImg: require("~/assets/svg/edit.svg"),
  74. deleteImg: require("~/assets/svg/delete.svg"),
  75. item: {},
  76. itemId: "",
  77. itemName: "",
  78. };
  79. },
  80. methods: {
  81. editItem(index) {
  82. this.item = JSON.parse(JSON.stringify(this.contacts[index]));
  83. this.$modal.show("edit-contact-modal");
  84. },
  85. deleteItem(index) {
  86. this.itemId = this.contacts[index].ContactID;
  87. this.itemName =
  88. this.contacts[index].FirstName + " " + this.contacts[index].LastName;
  89. this.$modal.show("delete-contact-modal");
  90. },
  91. },
  92. };
  93. </script>
  94. <style scoped lang="scss">
  95. </style>