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.

875 lines
24 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
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
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. class="tw-px-[30px] tw-mb-[60px] md:tw-mb-[100px] xl:tw-px-[60px] xl:tw-max-w-screen-xl xl:tw-mx-auto xl:tw-grid xl:tw-grid-cols-[380px_auto] xl:tw-gap-[30px]">
  4. <section class="xl:tw-col-span-2 tw-mb-5 md:tw-mb-0">
  5. <centerMode :list="ads" v-if="ads.length"></centerMode>
  6. </section>
  7. <section class="xl:tw-col-span-2 tw-mb-[40px] xl:tw-mb-[10px]">
  8. <Breadcrumbs class="tw-py-[7px] md:tw-py-[10px] xl:tw-py-[13px] tw-mb-4 md:tw-mb-6 xl:tw-mb-0"></Breadcrumbs>
  9. <sort :results="result" :sortType="sortType" :sortBy="sortBy" @sort="updateSortBy($event)"
  10. @filter="$modal.show(`sidebar-filter-modal`)"></sort>
  11. </section>
  12. <section class="tw-grid tw-grid-cols-1 tw-gap-[30px] tw-auto-rows-min">
  13. <div class="tw-max-h-min" v-if="$vuetify.breakpoint.xl">
  14. <DateCard @update="updateDateFilter" :modalChecked="selectedDates" />
  15. </div>
  16. <div v-if="$vuetify.breakpoint.xl">
  17. <oneLevel :label="'exhibition.Show Status'" :list="statuses" @update="updateStatusFilter"></oneLevel>
  18. </div>
  19. <div v-if="$vuetify.breakpoint.xl">
  20. <multipleLevel :label="'Categories'" :placeholder="'Find Categories...'" :list="categories"
  21. :queryItem="categoryQueryFilter" @update="updateCategoryFilter"></multipleLevel>
  22. </div>
  23. <div v-if="$vuetify.breakpoint.xl">
  24. <multipleLevel :label="'Location'" :placeholder="'Find country/city ...'" :list="locations"
  25. :queryItem="locationQueryFilter" @update="updateLocationFilter"></multipleLevel>
  26. </div>
  27. <div v-if="$vuetify.breakpoint.xl">
  28. <!-- <rating></rating> -->
  29. </div>
  30. </section>
  31. <!-- <section class="">
  32. <ExhibitionListCard v-for="(item, index) in renderList" :key="index" :item="item"
  33. @toggle-favorite="onToggleFavorite"></ExhibitionListCard>
  34. <div class="tw-mt-[34px] tw-flex tw-justify-end">
  35. <pagination :pageLength="pageLength" @update="updatePage"></pagination>
  36. </div>
  37. </section> -->
  38. <section class="">
  39. <ExhibitionListCard v-for="(item, index) in exhibitionList" :key="index" :item="item"></ExhibitionListCard>
  40. <div class="tw-mt-[34px] tw-flex tw-justify-end">
  41. <pagination :pageLength="pageLength" @update="updatePage"></pagination>
  42. </div>
  43. </section>
  44. <div v-if="!$vuetify.breakpoint.xl">
  45. <ShowSidebarFilterModal :statusList="statuses" :locationList="locations" :categoryList="categories"
  46. :statusChecked="selectedStatus" :locationChecked="locationChecked" :categoryChecked="categoryChecked"
  47. :datesChecked="selectedDates" @updateCategoryFilter="updateCategoryFilter"
  48. @updateLocationFilter="updateLocationFilter" @updateStatusFilter="updateStatusFilter"
  49. @updateDateFilter="updateDateFilter"></ShowSidebarFilterModal>
  50. </div>
  51. <loading :isLoading="isPageLoading"></loading>
  52. </div>
  53. </template>
  54. <script>
  55. import Breadcrumbs from "~/components/Breadcrumbs.vue";
  56. import centerMode from "@/components/swiper/centerMode";
  57. import ExhibitionListCard from "~/components/exhibition/ExhibitionListCard.vue";
  58. import DateCard from "~/components/exhibition/DateCard.vue";
  59. import sort from "@/components/newComponent/sort/sort";
  60. import multipleLevel from "@/components/newComponent/filter/multipleLevel";
  61. import oneLevel from "@/components/newComponent/filter/oneLevel";
  62. import rating from "@/components/newComponent/filter/rating.vue";
  63. import pagination from "@/components/newComponent/pagination/pagination.vue";
  64. import ShowSidebarFilterModal from "@/components/exhibition/ShowSidebarFilterModal.vue";
  65. import { XIcon } from "vue-feather-icons";
  66. import loading from "@/components/newComponent/loading/loading.vue";
  67. export default {
  68. name: "ExhibitionView",
  69. auth: false,
  70. meta: {
  71. name: "Exhibition",
  72. },
  73. components: {
  74. centerMode,
  75. Breadcrumbs,
  76. DateCard,
  77. ExhibitionListCard,
  78. XIcon,
  79. sort,
  80. multipleLevel,
  81. oneLevel,
  82. rating,
  83. pagination,
  84. ShowSidebarFilterModal,
  85. loading,
  86. },
  87. async asyncData({ route, $auth, $axios, i18n }) {
  88. // get URL link prarm
  89. // created
  90. let isPageLoading = true;
  91. let langQuery = "?lang=" + i18n.localeProperties["langQuery"];
  92. let keyword = route.query.q;
  93. let data;
  94. // ({ data } = await $axios.get("/exhibitions/filters" + langQuery));
  95. let statuses;
  96. if (data) {
  97. statuses = data.filters.statuses.map((item) => {
  98. return {
  99. key: item.Key,
  100. title: item.Value,
  101. };
  102. });
  103. }
  104. // ({ data } = await $axios.get(
  105. // `/t/exhibitions/locations${langQuery}&sort=true`
  106. // ));
  107. let locations;
  108. if (data) {
  109. locations = data.sort_results.map((item) => {
  110. item.country_list = item.country_list.map((country) => {
  111. country.city_list = country.city_list.map((city) => {
  112. return {
  113. title: city.city_name,
  114. key: city.city_name,
  115. };
  116. });
  117. return {
  118. title: country.country_name,
  119. key: country.country_name,
  120. children: country.city_list,
  121. };
  122. });
  123. return {
  124. title: item.region_name,
  125. key: item.region_name,
  126. children: item.country_list,
  127. };
  128. });
  129. }
  130. // ({ data } = await $axios.get(
  131. // `/t/exhibitions/categories${langQuery}&sort=true`
  132. // ));
  133. let categories;
  134. if (data) {
  135. categories = data.sort_results.map((item) => {
  136. item.subcategories_list = item.subcategories_list.map((children) => {
  137. return {
  138. title: children.subcategory_name,
  139. key: children.subcategory_name,
  140. };
  141. });
  142. return {
  143. title: item.category_name,
  144. key: item.category_name,
  145. children: item.subcategories_list,
  146. };
  147. });
  148. }
  149. if (keyword) {
  150. langQuery = langQuery + "&q=" + keyword;
  151. }
  152. try {
  153. data = {
  154. exhibitions: [],
  155. ads: [],
  156. };
  157. // ({ data } = await $axios
  158. // .get("/exhibitions" + langQuery)
  159. // .then()
  160. // .catch((err) => {
  161. // console.log(err);
  162. // }));
  163. } catch (e) {
  164. data = {
  165. exhibitions: [],
  166. ads: [],
  167. };
  168. console.log(e);
  169. }
  170. // console.log(data.exhibitions);
  171. // let exhibitionList = data.exhibitions; // exhibitionApi2CardType();
  172. let userSavedList = [];
  173. if ($auth.loggedIn) {
  174. // await $axios
  175. // .get(
  176. // `/member/users/${$auth.$storage.getUniversal("jwt").user_id}?jwt=${
  177. // $auth.$storage.getUniversal("jwt").token
  178. // }`
  179. // )
  180. // .then((res) => {
  181. // userSavedList = res.data.UserExhibition; //.map(item=>item.exhibition_id)
  182. // })
  183. // .catch((err) => {
  184. // console.log(err);
  185. // });
  186. }
  187. // userSavedList = userSavedList.map((item) => item.exhibition_id);
  188. // for (let i = 0; i < exhibitionList.length; i++) {
  189. // if (userSavedList.includes(exhibitionList[i].id)) {
  190. // exhibitionList[i].saved = true;
  191. // } else {
  192. // exhibitionList[i].saved = false;
  193. // }
  194. // }
  195. let ads = data.ads;
  196. return {
  197. statuses: statuses,
  198. // categories: categories,
  199. // locations: locations,
  200. // rating: rating,
  201. isPageLoading: isPageLoading,
  202. // exhibitionList: exhibitionList,
  203. ads: ads,
  204. langQuery: langQuery,
  205. };
  206. },
  207. data: () => ({
  208. page: 1,
  209. perPageItems: 10,
  210. currentPage: 1,
  211. total: 0,
  212. adList: [],
  213. exhibitionList: [],
  214. categoryChecked: [],
  215. locationChecked: [],
  216. ratingChecked: [],
  217. locations: [],
  218. selectedDates: [],
  219. selectedStatus: [],
  220. statusMap: new Map(),
  221. regionMap: new Map(),
  222. countryMap: new Map(),
  223. cityMap: new Map(),
  224. mainCategoryMap: new Map(),
  225. subCategoryMap: new Map(),
  226. selectedMainCategory: [],
  227. selectedSubCategory: [],
  228. selectedRegion: [],
  229. selectedCountry: [],
  230. selectedCity: [],
  231. favoriteSet: new Set(),
  232. categories: [],
  233. categoryQueryFilter: "",
  234. locationQueryFilter: "",
  235. width: undefined,
  236. sortType: [
  237. { name: "exhibition.Recommended", value: "Recommended" },
  238. { name: "exhibition.ShowDate", value: "ShowDate" },
  239. { name: "exhibition.ExhibitorCount", value: "ExhibitorCount" },
  240. { name: "exhibition.VisitorCount", value: "VisitorCount" },
  241. ],
  242. sortBy: "ShowDate",
  243. query: ""
  244. }),
  245. async created() {
  246. console.log("created");
  247. // to Fred
  248. // addjust async/sync orders
  249. this.isPageLoading = true;
  250. // this.getAdList();
  251. await this.getStatusList();
  252. await this.getLocationList();
  253. await this.getCategoryList();
  254. await this.getFavorite();
  255. await this.getQuery();
  256. // await this.getExhibitionCard();
  257. // this.getQuery();
  258. // await this.getUnsortLocationList();
  259. // await this.getUnsortCategoryList();
  260. // await this.getQuery();
  261. // if (this.$route.query.hasOwnProperty("q")) {
  262. // this.sortType.splice(0, 0, {
  263. // name: "ShowEasy Recommended",
  264. // value: "ShowEasy Recommended",
  265. // });
  266. // this.sortBy = "ShowEasy Recommended";
  267. // }
  268. // let userSavedList = [];
  269. // if (this.$auth.loggedIn) {
  270. // // await this.$axios
  271. // // .get(
  272. // // `/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
  273. // // }?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
  274. // // )
  275. // // .then((res) => {
  276. // // userSavedList = res.data.UserExhibition;
  277. // // })
  278. // // .catch((err) => {
  279. // // console.log(err);
  280. // // });
  281. // // this.$store.dispatch("updatePicture");
  282. // // this.$nextTick(() => {
  283. // // this.$forceUpdate();
  284. // // });
  285. // }
  286. // userSavedList = userSavedList.map((item) => item.exhibition_id);
  287. // for (let i = 0; i < this.exhibitionList.length; i++) {
  288. // if (userSavedList.includes(this.exhibitionList[i].id)) {
  289. // this.exhibitionList[i].saved = true;
  290. // } else {
  291. // this.exhibitionList[i].saved = false;
  292. // }
  293. // }
  294. if (process.client) {
  295. this.width = window.innerWidth;
  296. }
  297. this.$nextTick(() => {
  298. this.isPageLoading = false;
  299. });
  300. },
  301. async mounted() {
  302. console.log("mounted");
  303. // let userSavedList = [];
  304. // if (this.$auth.loggedIn) {
  305. // // await this.$axios
  306. // // .get(
  307. // // `/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
  308. // // }?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
  309. // // )
  310. // // .then((res) => {
  311. // // userSavedList = res.data.UserExhibition;
  312. // // })
  313. // // .catch((err) => {
  314. // // console.log(err);
  315. // // });
  316. // // this.$store.dispatch("updatePicture");
  317. // // this.$nextTick(() => {
  318. // // this.$forceUpdate();
  319. // // });
  320. // }
  321. // userSavedList = userSavedList.map((item) => item.exhibition_id);
  322. // for (let i = 0; i < this.exhibitionList.length; i++) {
  323. // if (userSavedList.includes(this.exhibitionList[i].id)) {
  324. // this.exhibitionList[i].saved = true;
  325. // } else {
  326. // this.exhibitionList[i].saved = false;
  327. // }
  328. // }
  329. this.$nextTick(() => {
  330. window.addEventListener("resize", this.onResize);
  331. });
  332. },
  333. beforeDestroy() {
  334. window.removeEventListener("resize", this.onResize);
  335. this.fetchUser();
  336. },
  337. computed: {
  338. // result() {
  339. // // return this.exhibitionsFilter.length;
  340. // return this.exhibitionList.length;
  341. // },
  342. // pageLength() {
  343. // return Math.ceil(this.totalPages / this.perPage);
  344. // },
  345. // renderList() {
  346. // return this.sliceRenderList(this.exhibitionsFilter);
  347. // },
  348. result() {
  349. return this.total;
  350. },
  351. pageLength() {
  352. return Math.ceil(this.result / this.perPageItems);
  353. },
  354. },
  355. watch: {
  356. page() {
  357. // window.scrollTo(0, 0);
  358. },
  359. $route() {
  360. // console.log("route");
  361. this.getQuery();
  362. },
  363. },
  364. methods: {
  365. onResize() {
  366. if (process.client) {
  367. this.width = window.innerWidth;
  368. }
  369. },
  370. async fetchUser() {
  371. let userSavedList = [];
  372. if (this.$auth.loggedIn) {
  373. // await this.$axios
  374. // .get(
  375. // `/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
  376. // }?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
  377. // )
  378. // .then((res) => {
  379. // userSavedList = res.data.UserExhibition;
  380. // })
  381. // .catch((err) => {
  382. // console.log(err);
  383. // });
  384. }
  385. userSavedList = userSavedList.map((item) => item.exhibition_id);
  386. for (let i = 0; i < this.exhibitionList.length; i++) {
  387. if (userSavedList.includes(this.exhibitionList[i].id)) {
  388. this.exhibitionList[i].saved = true;
  389. } else {
  390. this.exhibitionList[i].saved = false;
  391. }
  392. }
  393. },
  394. getAdList() {
  395. this.ads = [
  396. {
  397. id: 'banner_1',
  398. image: require('/assets/img/banner/banner_1.png'),
  399. url: '/service?taiwan=taiwan'
  400. },
  401. {
  402. id: 'banner_2',
  403. image: require('/assets/img/banner/banner_2.png'),
  404. url: 'javascript:void(0);'
  405. },
  406. {
  407. id: 'banner_3',
  408. image: require('/assets/img/banner/banner_3.png'),
  409. url: 'javascript:void(0);'
  410. },
  411. {
  412. id: 'banner_4',
  413. image: require('/assets/img/banner/banner_4.png'),
  414. url: 'javascript:void(0);'
  415. },
  416. {
  417. id: 'banner_5',
  418. image: require('/assets/img/banner/banner_5.png'),
  419. url: 'javascript:void(0);'
  420. }
  421. ]
  422. },
  423. async getStatusList() {
  424. await this.$axios
  425. .get(
  426. `/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`
  427. )
  428. .then((result) => {
  429. if (result.data.DATA.rel) {
  430. this.statuses = result.data.DATA.rel;
  431. this.statuses = this.statuses.map((item => {
  432. this.statusMap.set(item.Key, item.Value);
  433. return {
  434. title: item.Value,
  435. key: item.Key,
  436. };
  437. }));
  438. }
  439. })
  440. .catch((err) => {
  441. console.log(err);
  442. });
  443. },
  444. async getCategoryList() {
  445. await this.$axios
  446. .get(
  447. `/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}`
  448. )
  449. .then((result) => {
  450. if (result.data.DATA.rel) {
  451. this.categories = result.data.DATA.rel;
  452. this.categories = this.categories.map((item) => {
  453. this.mainCategoryMap.set(item.CategoryID, item);
  454. item.SubCategoryList = item.SubCategoryList.map(
  455. (children) => {
  456. this.subCategoryMap.set(children.CategoryID, children);
  457. return {
  458. title: children.CategoryName,
  459. key: children.CategoryID,
  460. };
  461. }
  462. );
  463. return {
  464. title: item.CategoryName,
  465. key: item.CategoryID,
  466. children: item.SubCategoryList,
  467. };
  468. });
  469. }
  470. })
  471. .catch((err) => {
  472. console.log(err);
  473. });
  474. },
  475. async getLocationList() {
  476. await this.$axios
  477. .get(
  478. `/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}`
  479. )
  480. .then((result) => {
  481. if (result.data.DATA.rel) {
  482. var vm = this;
  483. vm.locations = result.data.DATA.rel;
  484. vm.locations = vm.locations.map((region) => {
  485. this.regionMap.set(region.RegionID, region);
  486. region.CountryList = region.CountryList.map((country) => {
  487. this.countryMap.set(country.CountryID, country);
  488. country.CityList = country.CityList.map((city) => {
  489. this.cityMap.set(city.CityID, city);
  490. return {
  491. title: city.CityName,
  492. key: city.CityID,
  493. };
  494. });
  495. return {
  496. title: country.CountryName,
  497. key: country.CountryID,
  498. children: country.CityList,
  499. };
  500. });
  501. return {
  502. title: region.RegionName,
  503. key: region.RegionID,
  504. children: region.CountryList,
  505. };
  506. });
  507. return result.data.DATA.rel;
  508. }
  509. })
  510. .catch((err) => {
  511. console.log(err);
  512. });
  513. },
  514. async getExhibitionCard() {
  515. // this.query = this.query + "工具機";
  516. // console.log("getExhibitionCard"+": "+this.query)
  517. await this.$axios
  518. .get(
  519. `/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` +
  520. `&PageIndex=${this.currentPage}` +
  521. `&PageSize=${this.perPageItems}` +
  522. `&RegionIDs=${JSON.stringify(this.selectedRegion)}` +
  523. `&CountryIDs=${JSON.stringify(this.selectedCountry)}` +
  524. `&CityIDs=${JSON.stringify(this.selectedCity)}` +
  525. `&MainCategoryIDs=${JSON.stringify(this.selectedMainCategory)}` +
  526. `&SubCategoryIDs=${JSON.stringify(this.selectedSubCategory)}` +
  527. `&Status=${JSON.stringify(this.selectedStatus)}` +
  528. `&Date=${JSON.stringify(this.selectedDates)}` +
  529. `&Sort=${this.sortBy}` +
  530. `&Query=${this.query}`
  531. )
  532. .then((result) => {
  533. console.table(result);
  534. if(result && result.data && result.data.DATA && result.data.DATA.rel){
  535. let data = result.data.DATA.rel
  536. if(data.DataList.length>0){
  537. this.total = data.Total;
  538. this.exhibitionList = data.DataList;
  539. this.setFavorite();
  540. }
  541. }
  542. })
  543. .catch((err) => {
  544. console.log(err);
  545. this.exhibitionList = [];
  546. });
  547. },
  548. async getFavorite() {
  549. this.favoriteSet.clear();
  550. if (this.$auth.loggedIn) {
  551. await this.$axios
  552. .get(
  553. `/trending/api/Favorite/Favorites?Type=Exhibition`
  554. )
  555. .then((result) => {
  556. if (result.data.DATA.rel) {
  557. let favoriteList = [];
  558. favoriteList = result.data.DATA.rel;
  559. favoriteList.forEach(item => {
  560. this.favoriteSet.add(item.ParentID);
  561. })
  562. }
  563. })
  564. .catch((err) => {
  565. console.log(err);
  566. });
  567. }
  568. },
  569. setFavorite() {
  570. if (this.exhibitionList.length > 0 && this.$auth.loggedIn) {
  571. for (let i = 0; i < this.exhibitionList.length; i++) {
  572. if (this.favoriteSet.has(this.exhibitionList[i].ExhibitionID)) {
  573. this.exhibitionList[i].IsFavorite = "Y";
  574. }
  575. }
  576. }
  577. },
  578. updateSortBy(data) {
  579. this.query = "";
  580. this.sortBy = data;
  581. this.getExhibitionCard();
  582. },
  583. updatePage(value) {
  584. this.currentPage = value;
  585. this.getExhibitionCard();
  586. },
  587. updateCategoryFilter(value) {
  588. this.query = "";
  589. this.selectedMainCategory = [];
  590. this.selectedSubCategory = [];
  591. value.forEach(key => {
  592. if (this.mainCategoryMap.has(key)) {
  593. this.selectedMainCategory.push(key);
  594. }
  595. if (this.subCategoryMap.has(key)) {
  596. this.selectedSubCategory.push(key);
  597. }
  598. });
  599. this.getExhibitionCard();
  600. },
  601. updateLocationFilter(value) {
  602. this.query = "";
  603. this.selectedRegion = [];
  604. this.selectedCountry = [];
  605. this.selectedCity = [];
  606. value.forEach(key => {
  607. if (this.regionMap.has(key)) {
  608. this.selectedRegion.push(key);
  609. }
  610. if (this.countryMap.has(key)) {
  611. this.selectedCountry.push(key);
  612. }
  613. if (this.cityMap.has(key)) {
  614. this.selectedCity.push(key);
  615. }
  616. });
  617. this.getExhibitionCard();
  618. },
  619. updateStatusFilter(value) {
  620. this.query = "";
  621. this.selectedStatus = [];
  622. value.forEach(key => {
  623. if (this.statusMap.has(key)) {
  624. this.selectedStatus.push(key);
  625. }
  626. });
  627. this.getExhibitionCard();
  628. },
  629. updateDateFilter(value) {
  630. this.query = "";
  631. this.selectedDates = value;
  632. this.getExhibitionCard();
  633. },
  634. async getQuery() {
  635. let vm = this;
  636. this.selectedMainCategory = [];
  637. this.selectedSubCategory = [];
  638. this.selectedCountry = [];
  639. this.selectedCity = [];
  640. this.query = "";
  641. if (this.$route.query.category) {
  642. vm.categoryQueryFilter = vm.$route.query.category;
  643. this.selectedMainCategory.push(vm.$route.query.category);
  644. }
  645. if (this.$route.query.subcategory) {
  646. vm.categoryQueryFilter = vm.$route.query.subcategory;
  647. this.selectedSubCategory.push(vm.$route.query.subcategory);
  648. }
  649. if (this.$route.query.country) {
  650. vm.locationQueryFilter = vm.$route.query.country;
  651. this.selectedCountry.push(vm.$route.query.country);
  652. }
  653. if (this.$route.query.city) {
  654. vm.locationQueryFilter = vm.$route.query.city;
  655. this.selectedCity.push(vm.$route.query.city);
  656. }
  657. if (this.$route.query.q) {
  658. this.query = vm.$route.query.q;
  659. }
  660. this.getExhibitionCard();
  661. },
  662. sortServiceList(data) {
  663. switch (this.sortBy) {
  664. case "ShowEasy Recommended":
  665. return data;
  666. case "Exhibitor Numbers":
  667. function Exhibitors(a, b) {
  668. if (
  669. Number(a.exhibitors ? a.exhibitors.replace(/[^0-9]/gi, "") : "") <
  670. Number(b.exhibitors ? b.exhibitors.replace(/[^0-9]/gi, "") : "")
  671. )
  672. return 1;
  673. if (
  674. Number(a.exhibitors ? a.exhibitors.replace(/[^0-9]/gi, "") : "") >
  675. Number(b.exhibitors ? b.exhibitors.replace(/[^0-9]/gi, "") : "")
  676. )
  677. return -1;
  678. return 0;
  679. }
  680. return data.sort(Exhibitors);
  681. case "Visitor Numbers":
  682. function Visitor(a, b) {
  683. if (
  684. Number(a.visitors ? a.visitors.replace(/[^0-9]/gi, "") : "") <
  685. Number(b.visitors ? b.visitors.replace(/[^0-9]/gi, "") : "")
  686. )
  687. return 1;
  688. if (
  689. Number(a.visitors ? a.visitors.replace(/[^0-9]/gi, "") : "") >
  690. Number(b.visitors ? b.visitors.replace(/[^0-9]/gi, "") : "")
  691. )
  692. return -1;
  693. return 0;
  694. }
  695. return data.sort(Visitor);
  696. case "Show Dates":
  697. function Date(a, b) {
  698. if (a.startdate.replace(/-/g, "") < b.startdate.replace(/-/g, ""))
  699. return 1;
  700. if (a.startdate.replace(/-/g, "") > b.startdate.replace(/-/g, ""))
  701. return -1;
  702. return 0;
  703. }
  704. return data.sort(Date);
  705. default:
  706. return data;
  707. }
  708. },
  709. sliceRenderList(data) {
  710. return data.slice(
  711. (this.page - 1) * this.perPage,
  712. this.page * this.perPage
  713. );
  714. },
  715. },
  716. };
  717. </script>
  718. <style scoped lang="scss">
  719. .sort-by-text {
  720. max-width: 142px;
  721. >h3 {
  722. border-right: 1px solid #e5e5e5;
  723. }
  724. }
  725. .sort-by-text-sm {
  726. max-width: 112px;
  727. >h3 {
  728. border-right: 1px solid #e5e5e5;
  729. }
  730. }
  731. </style>
  732. <style lang="scss">
  733. .filter-zindex {
  734. z-index: 499 !important;
  735. }
  736. .exhibition-pagination {
  737. .v-pagination {
  738. justify-content: flex-end;
  739. }
  740. .v-pagination__navigation,
  741. .v-pagination__item {
  742. box-shadow: none;
  743. margin: 0;
  744. min-width: 28px;
  745. &.v-pagination__item--active {
  746. color: $primary-orange !important;
  747. }
  748. }
  749. }
  750. .v-breadcrumbs {
  751. padding: 0px;
  752. }
  753. .v-application ul {
  754. padding-left: 0px;
  755. }
  756. </style>