123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- <template>
- <div>
- <div v-if="filteredWeeks.length > 0">
- <table class="table table-striped table-responsive text-nowrap">
- <thead>
- <tr>
- <th scope="col">Ref</th>
- <th scope="col">Unit</th>
- <th scope="col">Module</th>
- <th scope="col">Arrival</th>
- <th scope="col">Departure</th>
- <th scope="col">Bedrooms</th>
- <th scope="col">Season</th>
- <th scope="col">Type</th>
- <th scope="col">Price Incl VAT</th>
- <th scope="col">Status</th>
- <th scope="col">Interested?</th>
- </tr>
- </thead>
- <tbody>
- <tr v-for="(item, i) in DisplayItems" :key="i">
- <td>#{{ item.id }}</td>
- <td>{{ item.unitNumber }}</td>
- <td>{{ item.module }}</td>
- <td
- v-if="
- item.arrivalDate === '0001-01-01T00:00:00' ||
- item.arrivalDate === '1753-01-01T00:00:00'
- "
- ></td>
- <td v-else>{{ item.arrivalDate | toDate }}</td>
- <td
- v-if="
- item.departureDate === '0001-01-01T00:00:00' ||
- item.departureDate === '1753-01-01T00:00:00'
- "
- ></td>
- <td v-else>{{ item.departureDate | toDate }}</td>
- <td>{{ item.bedrooms }}</td>
- <td>{{ item.season }}</td>
- <td>{{ item.weekType }}</td>
- <td>{{ item.sellPrice | toCurrency }}</td>
- <td v-if="item.status">{{ item.status.description }}</td>
- <!-- <td>{{ item.region ? item.region.regionName : "" }}</td>
- <td>{{ item.resort ? item.resort.resortName : "" }}</td>
-
- <td>{{ item.arrivalDate | toDate }}</td>
- <td>{{ item.departureDate | toDate }}</td>-->
-
- <!-- <td>{{item.status ? item.status.description : ''}}</td> -->
-
- <td>
- <button
- :disabled="checkStatus(item)"
- v-on:click="View(item)"
- :class="checkStatus(item) ? 'btn-disabled' : 'btn-white-border'"
- style="color: white;"
- >
- Yes
- </button>
- </td>
- <!-- <div class="col-md-12">
- <button type="button" class="btn btn-b-n" >View</button>
- </div>-->
- </tr>
- </tbody>
- </table>
- <div class="row">
- <div class="col-md-2">
- Items Per Page:
- <select
- class="form-control"
- v-model="visibleItemsPerPageCount"
- @change="onChangeItemsPerPage()"
- >
- <option v-for="(item, i) in visibleItemSelector" :key="i">
- {{ item }}
- </option>
- </select>
- </div>
- <div class="col-md-10 mt-4">
- <div style="float: right;">
- <BasePagination
- :currentPage="currentPage"
- :pageCount="PageCount"
- @nextPage="pageChangeHandle('next')"
- @previousPage="pageChangeHandle('previous')"
- @loadPage="pageChangeHandle"
- />
- </div>
- </div>
- </div>
- </div>
- <div v-else>
- <div class="row">
- <hr />
- <div class="col-md-12" v-if="status !== '' && status !== undefined">
- <b>{{ status }}</b>
- </div>
- <div class="col-md-12" v-if="status !== '' && status !== undefined">
- <img
- class="img-fluid"
- src="/img/kloader.gif"
- alt="UVProp logo"
- style="width: 128px; height: 128px;"
- />
- </div>
- <div v-else>No Results Found</div>
- <hr />
- </div>
- </div>
- </div>
- </template>
-
- <script>
- /* eslint-disable */
- import BasePagination from '../../shared/basePagination'
- import { mapState, mapActions, mapGetters } from 'vuex'
-
- export default {
- props: {
- resortCode: undefined,
- userId: undefined,
- currentPage: {
- default: 1,
- },
- },
- data() {
- return {
- visibleItemsPerPageCount: 8,
- visibleItemSelector: [5, 8, 10, 20, 50, 100],
- }
- },
- components: {
- BasePagination,
- },
- computed: {
- ...mapState('weekList', ['weeks', 'status']),
- ...mapGetters({
- filteredWeeks: 'weekList/filteredWeeks',
- getRegions: 'weekList/getRegions',
- }),
- DisplayItems() {
- const list = []
- this.filteredWeeks.forEach((week) => {
- if (week.publish) {
- list.push(week)
- }
- })
-
- const startSlice = (this.currentPage - 1) * this.visibleItemsPerPageCount
- let endSlice = this.currentPage * this.visibleItemsPerPageCount
- if (endSlice > list.length) {
- endSlice = list.length
- }
- return list.slice(startSlice, endSlice)
- },
- PageCount() {
- var list = []
- this.filteredWeeks.forEach((week) => {
- if (!week.isTender) {
- list.push(week)
- }
- })
- return this.visibleItemsPerPageCount !== 0
- ? Math.ceil(list.length / this.visibleItemsPerPageCount)
- : 1
- },
- },
- mounted() {
- //if (this.resortCode) {
- // this.applyResortFilter(this.resortCode);
- //}
- this.getByResortCode(this.$route.params.resortCode)
- //this.getWeeks();
- },
- methods: {
- ...mapActions('weekList', [
- 'getWeeks',
- 'applyResortFilter',
- 'getByResortCode',
- ]),
- View(item) {
- this.$router.push(`/resort/${item.resort.resortCode}/${item.unitNumber}`)
- },
- onChangeItemsPerPage() {
- if (this.currentPage !== 1) {
- this.currentPage = 1
- }
- },
- async pageChangeHandle(value) {
- switch (value) {
- case 'next':
- this.currentPage += 1
- break
- case 'previous':
- this.currentPage -= 1
- break
- default:
- this.currentPage = value
- }
- },
- checkStatus(item) {
- if (
- item.status.code === 'CIP' ||
- item.status.code === 'S' ||
- item.status.code === 'P'
- ) {
- return true
- } else {
- return false
- }
- },
- },
- }
- </script>
-
- <style lang="scss" scoped>
- .btn-disabled {
- font-family: 'Muli';
- font-size: 15px;
- letter-spacing: 1px;
- display: inline-block;
- padding: 10px 32px;
- border-radius: 2px;
- transition: 0.5s;
- margin: 10px;
- color: #fff;
- background: grey;
- border-color: black;
- color: black;
- cursor: not-allowed;
- }
- .btn-disabled :hover {
- background: grey;
- border-color: black;
- color: black;
- cursor: not-allowed;
- }
- </style>
|