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.

176 lines
5.1 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
  1. <template>
  2. <div class="myBooking xl:tw-max-w-[1246px] xl:tw-mx-auto">
  3. <div class="xl:tw-flex xl:tw-justify-between xl:tw-items-start">
  4. <userSidebar
  5. :userData="userData"
  6. :firstName="firstName"
  7. :lastName="lastName"
  8. class="tw-hidden xl:tw-block"
  9. >
  10. </userSidebar>
  11. <!-- <div class="xl:tw-hidden"></div> -->
  12. <div
  13. class="tw-bg-transparent xl:tw-bg-white xl:tw-p-[30px] xl:tw-rounded-[20px] xl:tw-min-w-[900px] xl:tw-max-w-[900px]"
  14. >
  15. <div
  16. class="tw-flex tw-flex-col md:tw-flex-row md:tw-justify-between md:tw-items-center tw-mb-[20px] md:tw-mb-[34px]"
  17. >
  18. <div
  19. class="tw-text-[20px] tw-font-bold tw-text-base-primary tw-mb-[20px] md:t24 md:tw-mb-0"
  20. >
  21. <two-dots class="tw-mr-[30px]"></two-dots>{{ $t("My Bookings") }}
  22. </div>
  23. </div>
  24. <bookingListContent
  25. :width="width"
  26. :userData="userData"
  27. ></bookingListContent>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import TwoDots from "@/components/TwoDots";
  34. import bookingListContent from "@/components/user/bookingListContent.vue";
  35. import userSidebar from "@/components/user/userSidebar.vue";
  36. export default {
  37. name: "myBooking",
  38. layout: "profile_gray",
  39. components: {
  40. TwoDots,
  41. bookingListContent,
  42. userSidebar,
  43. },
  44. data() {
  45. return {
  46. firstName: "",
  47. lastName: "",
  48. userData: {},
  49. width: 0,
  50. youMightLikeList: [],
  51. countrycode: [],
  52. regionName: [],
  53. };
  54. },
  55. created() {
  56. this.fetchUserData();
  57. // this.getLocationName();
  58. // this.getYouMightLikeData();
  59. if (process.browser) {
  60. window.addEventListener("resize", this.handleResize);
  61. }
  62. this.handleResize();
  63. },
  64. mounted() {
  65. this.$nextTick(() => {
  66. window.addEventListener("resize", this.onResize);
  67. });
  68. },
  69. destroyed() {
  70. if (process.browser) {
  71. window.removeEventListener("resize", this.handleResize);
  72. }
  73. },
  74. methods: {
  75. patchUserData() {
  76. // if (this.width < 1366) {
  77. // this.isEditInfoDialogActive = !this.isEditInfoDialogActive;
  78. // }
  79. this.validators();
  80. // if (this.validators()) {
  81. // this.userData.prefer_country = JSON.stringify(this.languageSelect);
  82. // if (this.$vuetify.breakpoint.name !== "xs") {
  83. // this.userData.birth_date =
  84. // this.yearSelect + "-" + this.monthSelect + "-" + this.daySelect;
  85. // if (this.userData.birth_date.length < 10) {
  86. // this.userData.birth_date = null;
  87. // }
  88. // }
  89. const patchData = JSON.parse(JSON.stringify(this.userData));
  90. this.$axios
  91. .post(
  92. `/trending/api/Members/Member`, patchData
  93. )
  94. .then((response) => {
  95. //console.log(JSON.stringify(response));
  96. if (response.status == 200) {
  97. this.successUpdate = !this.successUpdate;
  98. setTimeout(() => {
  99. this.successUpdate = !this.successUpdate;
  100. }, 1000);
  101. }
  102. this.fetchUserData();
  103. })
  104. .catch((error) => {
  105. console.log(error);
  106. });
  107. },
  108. fetchUserData() {
  109. this.$axios
  110. .get(
  111. `/trending/api/Members/Info`
  112. )
  113. .then((response) => {
  114. //console.log(JSON.stringify(response));
  115. if(response && response.data && response.data.DATA && response.data.DATA.rel){
  116. let data = response.data.DATA.rel
  117. if(data){
  118. this.userData = data;
  119. this.firstName = this.userData.FirstName;
  120. this.lastName = this.userData.LastName;
  121. }
  122. }
  123. })
  124. .catch((error) => {
  125. console.log(error);
  126. });
  127. },
  128. logout() {
  129. this.$auth.$storage.removeUniversal("jwt");
  130. this.$auth.$storage.removeUniversal("userPicture");
  131. this.$auth.$storage.removeUniversal("userLastName");
  132. this.$auth.$storage.removeUniversal("userBeforePath");
  133. if (width < 1024) {
  134. this.$router.push(this.localePath("/"));
  135. } else {
  136. this.$router.push(this.localePath("/user"));
  137. }
  138. this.$auth.logout();
  139. },
  140. // async getLocationName() {
  141. // this.$axios
  142. // .get(
  143. // `/t/exhibitions/locations?lang=${this.$i18n.localeProperties["langQuery"]}&sort=False`
  144. // )
  145. // .then((response) => {
  146. // this.regionName = response.data.region_ori;
  147. // this.countrycode = response.data.country_ori;
  148. // })
  149. // .catch((error) => console.log(error));
  150. // },
  151. // async getYouMightLikeData() {
  152. // this.$axios
  153. // .get(
  154. // `https://dev-api-console.showeasy.com/user-services/advertisements?region=0&country=0&city=0&expo=0&counts=3&lang_code=${this.$i18n.localeProperties["langQuery"]}`
  155. // )
  156. // .then((res) => {
  157. // this.youMightLikeList = res.data;
  158. // })
  159. // .catch((error) => console.log(error));
  160. // },
  161. handleResize() {
  162. if (process.browser) {
  163. this.width = window.innerWidth;
  164. }
  165. },
  166. },
  167. };
  168. </script>
  169. <style scoped lang="scss"></style>