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.

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