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.

215 lines
6.3 KiB

2 years ago
  1. <template>
  2. <v-dialog
  3. fullscreen
  4. v-model="dialogActive"
  5. @click:outside="$emit('close-saved-exhibition')"
  6. >
  7. <v-card>
  8. <v-spacer class="pt-15 pa-7">
  9. <v-spacer :class="$vuetify.breakpoint.smAndUp ? 'd-flex align-center pt-10' : 'd-flex align-center pt-10'">
  10. <div class="circle-decoration me-2"></div>
  11. <div class="circle-decoration me-2"></div>
  12. <span class="font-weight-bold text-size-20 ms-7 text-height-26">{{ $t("userProfile.savedExhibitions") }}</span>
  13. </v-spacer>
  14. <v-spacer class="mb-2 mt-7">
  15. <span class="filter-title-font">{{ $t("userProfile.savedExhibitionsFilter") }}</span>
  16. </v-spacer>
  17. <v-spacer class="d-flex">
  18. <div class="input-country-wrap me-5">
  19. <v-autocomplete
  20. class="input-border"
  21. solo flat
  22. hide-details
  23. dense
  24. :items="countryOptions"
  25. item-text="name"
  26. item-value="id"
  27. v-model="countrySelect"
  28. ></v-autocomplete>
  29. </div>
  30. <!-- <div class="input-status-wrap">
  31. <v-select
  32. outlined
  33. hide-details
  34. dense
  35. :items="statusOptions"
  36. item-text="status"
  37. item-value="id"
  38. v-model="statusSelect"
  39. ></v-select>
  40. </div> -->
  41. </v-spacer>
  42. <v-spacer class="d-flex justify-center mb-7">
  43. <div v-if="userVisibleExhibitionList.length === 0" class="no-picture-wrap">
  44. <v-img
  45. :src="require('~/assets/img/savedExhibitionEmpty.png')"
  46. contain
  47. max-width="210px"
  48. max-height="153px"
  49. ></v-img>
  50. <div class="d-flex justify-center">
  51. <span class="empty-exhibitions-font">{{ $t("userProfile.noSavedExhibitions") }}</span>
  52. </div>
  53. </div>
  54. <v-spacer v-else class="mt-7">
  55. <div v-if="$vuetify.breakpoint.smAndUp">
  56. <ExhibitionListCard
  57. v-for="(exhibition,index) in userVisibleExhibitionList.slice((this.page-1)*6,this.page*6)" :key="index"
  58. :item="exhibition"
  59. @toggle-favorite="removeExhibitionRelation(index)"
  60. ></ExhibitionListCard>
  61. </div>
  62. <!-- <div v-if="$vuetify.breakpoint.xsOnly">
  63. <ExhibitionListCardMobile
  64. v-for="(exhibition,index) in userVisibleExhibitionList.slice((this.page-1)*6,this.page*6)" :key="index"
  65. class="mb-5"
  66. :item="exhibition"
  67. @toggle-favorite="removeExhibitionRelation(index)"
  68. ></ExhibitionListCardMobile>
  69. </div> -->
  70. </v-spacer>
  71. </v-spacer>
  72. <v-spacer
  73. class="d-flex justify-center no-picture-btn pt-5"
  74. v-if="userVisibleExhibitionList.length === 0"
  75. >
  76. <v-btn
  77. class="border-radius-12"
  78. color="primary"
  79. :to="localePath('/')"
  80. >
  81. {{ $t("Explore with ShowEasy") }}
  82. </v-btn>
  83. </v-spacer>
  84. <v-spacer
  85. v-else
  86. class="d-flex justify-end pb-15 me-7"
  87. >
  88. <v-pagination
  89. v-model="page"
  90. class="mt-15"
  91. :length="pageLength"
  92. ></v-pagination>
  93. </v-spacer>
  94. </v-spacer>
  95. </v-card>
  96. </v-dialog>
  97. </template>
  98. <script>
  99. import ExhibitionListCard from "~/components/exhibition/ExhibitionListCard.vue";
  100. // import ExhibitionListCardMobile from "~/components/exhibition/ExhibitionListCardMobile.vue";
  101. export default {
  102. components: {
  103. ExhibitionListCard,
  104. // ExhibitionListCardMobile
  105. },
  106. props: {
  107. dialogActive: {
  108. type: Boolean,
  109. required: true,
  110. default: false
  111. },
  112. userVisibleExhibitionList: {
  113. type: Array,
  114. required: true,
  115. default: []
  116. },
  117. pageLength: {
  118. type: Number,
  119. required: true,
  120. default: 0
  121. }
  122. },
  123. data() {
  124. return {
  125. countryOptions: [],
  126. countrySelect: 999,
  127. statusOptions: [],
  128. statusSelect: 100,
  129. page: 1
  130. }
  131. },
  132. created() {
  133. // this.$axios.get(`users/countries?lang=${this.$i18n.locale.replace('-','')}`)
  134. // .then((result) => {
  135. // const initial = {
  136. // name: this.$t('userProfile.allCountries'),
  137. // id: 999
  138. // }
  139. // this.countryOptions = result.data.result
  140. // this.countryOptions.splice(0,0,initial)
  141. // }).catch((err) => {
  142. // console.log(err)
  143. // });
  144. // this.$axios.get(`exhibitions/filters?lang=${this.$i18n.locale.replace('-','')}`)
  145. // .then((result) => {
  146. // this.statusOptions = result.data.filters.statuses
  147. // }).catch((err) => {
  148. // console.log(err)
  149. // });
  150. },
  151. methods: {
  152. removeExhibitionRelation(index) {
  153. this.$axios.put(`/member/exhibitions?jwt=${this.$auth.$storage.getUniversal('jwt') ? this.$auth.$storage.getUniversal('jwt').token : ''}&exhibition_id=${this.userVisibleExhibitionList[index].id}&delete=true`)
  154. .then((result) => {
  155. if (this.countrySelect.toString() !== '999') {
  156. this.countrySelect = 999
  157. }
  158. this.$emit('refetch-user')
  159. this.$emit('reload-page')
  160. this.$emit('close-saved-exhibition')
  161. }).catch((err) => {
  162. console.log(err)
  163. });
  164. }
  165. },
  166. watch: {
  167. countrySelect: {
  168. handler:function() {
  169. if (this.countrySelect) {
  170. this.$emit('filter-list',this.countrySelect.toString())
  171. }
  172. }
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss" scoped>
  178. .filter-title-font {
  179. font-weight: 700;
  180. font-size: 16px;
  181. line-height: 21px;
  182. letter-spacing: 0.02em;
  183. }
  184. .input-country-wrap {
  185. @media screen and (max-width: 600px) {
  186. width: 142px;
  187. }
  188. @media screen and (min-width: 600px) and (max-width: 960px) {
  189. width: 160px;
  190. }
  191. }
  192. .input-status-wrap {
  193. @media screen and (max-width: 600px) {
  194. width: 125px;
  195. }
  196. @media screen and (min-width: 600px) and (max-width: 960px) {
  197. width: 142px;
  198. }
  199. }
  200. .no-picture-wrap {
  201. @media screen and (max-width: 600px) {
  202. margin-top: 80px;
  203. }
  204. @media screen and (min-width: 600px) and (max-width: 960px) {
  205. margin-top: 90px;
  206. }
  207. }
  208. // .v-input {
  209. // font-size: 14px;
  210. // }
  211. .no-picture-btn {
  212. padding-bottom: 75px;
  213. }
  214. </style>