@wikala/spmkt 2.31.1 → 3.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION_GUIDE.md +310 -0
- package/api/product.js +1 -0
- package/api/request.js +12 -6
- package/api/user.js +1 -1
- package/components/Account/AccountDashboard.vue +101 -101
- package/components/Account/AccountStore.js +57 -31
- package/components/Account/AffiliateReport.vue +56 -60
- package/components/Account/{OrderDetail.vue → Orders/OrderDetail.vue} +44 -30
- package/components/Account/Orders/Orders.vue +124 -0
- package/components/Account/{AccountSettings.vue → Settings/AccountSettings.vue} +4 -4
- package/components/Account/Settings/ChangeEmail.vue +136 -0
- package/components/Account/Settings/ChangeName.vue +82 -0
- package/components/Account/Settings/ChangePassword.vue +91 -0
- package/components/Address/Address.vue +38 -57
- package/components/Address/AddressBook.vue +77 -57
- package/components/Address/AddressSelect.vue +94 -87
- package/components/Address/Edit.vue +253 -265
- package/components/Address/PostalCode.vue +22 -21
- package/components/AgeGate.vue +11 -5
- package/components/Auth/Login.vue +62 -44
- package/components/Auth/Register.vue +82 -60
- package/components/Auth/ResetPassword.vue +45 -30
- package/components/Cart/AgeVerification/AgeChecker.vue +3 -3
- package/components/Cart/CartBadge.vue +15 -4
- package/components/Cart/CartBox.vue +19 -11
- package/components/Cart/CartItem.vue +3 -3
- package/components/Cart/CartMode.vue +6 -5
- package/components/Cart/CartPreview.vue +24 -18
- package/components/Cart/CreditCard/Everyware.vue +10 -10
- package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
- package/components/Cart/CreditCard/SquarePay.vue +18 -16
- package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
- package/components/Cart/Delivery/Delivery.vue +16 -12
- package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
- package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
- package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
- package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
- package/components/Cart/Delivery/ReservationSlots.vue +14 -8
- package/components/Cart/Disclaimer.vue +1 -1
- package/components/Cart/OrderConfirmation.vue +1 -1
- package/components/Cart/Payment/Payment.vue +37 -33
- package/components/Cart/Payment/PaymentMethods.vue +6 -4
- package/components/Cart/ReviewAndSubmit.vue +9 -7
- package/components/Cart/ShoppingCart.vue +42 -31
- package/components/Cart/Store/actions.js +1 -1
- package/components/Cart/Store/getters.js +2 -1
- package/components/Cart/Store/index.js +1 -1
- package/components/Cart/Store/mutations.js +9 -7
- package/components/Cart/Store/state.js +2 -2
- package/components/Cart/UserIdentity.vue +1 -1
- package/components/Category/CategoryFilter.vue +128 -114
- package/components/Category/CategorySort.vue +44 -32
- package/components/Category/LoadMore.vue +39 -23
- package/components/DeliverTo.vue +10 -15
- package/components/DeliveryNotice.vue +72 -68
- package/components/DobInput.vue +24 -24
- package/components/Gmaps/GmapsAutocomplete.vue +139 -78
- package/components/Gmaps/GmapsLocations.vue +1 -1
- package/components/Gmaps/GmapsSingleLocation.vue +121 -87
- package/components/MobileMenu/icons/LeftArrowIcon.vue +1 -1
- package/components/MobileMenu/icons/MenuIcon.vue +1 -1
- package/components/MobileMenu/icons/RightArrowIcon.vue +1 -1
- package/components/ModalContainer/ModalContainer.vue +20 -13
- package/components/ModalContainer/index.js +62 -18
- package/components/Product/AddToCart.vue +237 -221
- package/components/Product/BoxAddToCart.vue +114 -86
- package/components/Product/Compare.vue +91 -49
- package/components/Product/CompareBox.vue +128 -123
- package/components/Product/Lookup.vue +92 -65
- package/components/Product/Photo.vue +105 -66
- package/components/Product/Price.vue +64 -43
- package/components/Product/ProductAutocomplete.vue +52 -57
- package/components/Product/ProductBox.vue +61 -38
- package/components/Product/ProductImages.vue +83 -86
- package/components/Product/Quantity.vue +115 -53
- package/components/Product/QuickView.vue +52 -45
- package/components/Product/RelatedProducts.vue +88 -23
- package/components/Product/SKU.vue +27 -8
- package/components/Product/Variants.vue +336 -342
- package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
- package/components/Product/reviews-questions/ProductReviews.vue +122 -107
- package/components/Product/reviews-questions/Review.vue +54 -59
- package/components/Product/reviews-questions/ReviewForm.vue +222 -170
- package/components/Product/reviews-questions/ReviewImages.vue +197 -216
- package/components/Product/reviews-questions/Vote.vue +83 -57
- package/components/QuantityInput.vue +18 -8
- package/components/RangeInput.vue +15 -8
- package/components/Recaptcha.vue +8 -1
- package/components/SelectShippingCountry.vue +81 -62
- package/components/TimedOffer.vue +59 -74
- package/composables/globals.js +53 -0
- package/config.js +5 -2
- package/index.js +41 -10
- package/install.js +88 -0
- package/locales/en.json +2 -1
- package/locales/sr.json +2 -1
- package/package.json +49 -37
- package/utils/animate.css +50 -0
- package/utils/animate.js +1 -1
- package/utils/buefy.js +62 -0
- package/utils/directives.js +28 -45
- package/utils/event-bus.js +56 -0
- package/utils/filters.js +24 -7
- package/utils/format-date.js +17 -0
- package/utils/{gmaps.js → google/gmaps.js} +43 -10
- package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
- package/utils/random-id.js +10 -0
- package/babel.config.js +0 -5
- package/components/Account/ChangeEmail.vue +0 -133
- package/components/Account/ChangeName.vue +0 -92
- package/components/Account/ChangePassword.vue +0 -94
- package/components/Account/CreditCards.vue +0 -18
- package/components/Account/Orders.vue +0 -110
- package/components/Account/Settings.vue +0 -18
- package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
- package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
- package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
- package/components/Instagram.vue +0 -49
- package/components/ProductImageModal.vue +0 -41
- package/jest.config.js +0 -16
- package/test/e2e/.babelrc.js +0 -8
- package/test/e2e/.eslintrc.js +0 -11
- package/test/e2e/accAuth.spec.js +0 -64
- package/test/e2e/ageGate.spec.js +0 -26
- package/test/e2e/checkout.spec.js +0 -106
- package/test/e2e/compare.spec.js +0 -52
- package/test/e2e/config/data.js +0 -21
- package/test/e2e/config/routes.js +0 -11
- package/test/e2e/region.spec.js +0 -46
- package/test/e2e/search.spec.js +0 -32
- package/tests/vueBuefy.js +0 -4
- package/tsconfig.json +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div v-if="images.length" class="userimg-gallery">
|
|
3
3
|
<div v-if="images.length" class="columns userimg-cols is-multiline is-mobile is-flex">
|
|
4
|
-
<div v-for="(image, image_idx) in images.slice(0,
|
|
4
|
+
<div v-for="(image, image_idx) in images.slice(0, mq === 'mobile' ? 3 : 9)" class="column userimg-image is-2-desktop is-paddingless">
|
|
5
5
|
<img :key="image.id" :src="image.thumb_url" :alt="image.alt" @click="openModal(image.collection_idx, image.review_images_idx)" />
|
|
6
6
|
</div>
|
|
7
7
|
<div v-if="images.length > 9 || data.meta.last_page > 1" class="column userimg-viewall is-2 is-paddingless has-margin-right-sm has-margin-bottom-sm">
|
|
@@ -9,240 +9,221 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
</div>
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
<button type="button" class="modal-close is-large" style="" @click="allImagesModal = false"></button>
|
|
47
|
-
<div class="all-images-c">
|
|
48
|
-
<div class="columns is-multiline is-mobile all-images">
|
|
49
|
-
<template v-for="(review, c) in cumulativeData">
|
|
50
|
-
<template v-if="review.images.length">
|
|
51
|
-
<div v-for="(image, r) in review.images" class="column all-images-col">
|
|
52
|
-
<img :key="image.id" :src="image.thumb_url" :alt="image.alt" @click="openModal(c, r)" />
|
|
53
|
-
</div>
|
|
12
|
+
<!-- In body, out of the product page's stacking contexts (the fixed product nav covered it
|
|
13
|
+
on mobile); the wrapper keeps the theme's .userimg-gallery modal styles applying, and
|
|
14
|
+
display: contents keeps the theme's .userimg-gallery box rules off the empty wrapper -->
|
|
15
|
+
<Teleport to="body">
|
|
16
|
+
<div ref="modalsContainer" class="userimg-gallery userimg-gallery-modals" style="display: contents">
|
|
17
|
+
<b-modal v-model="carouselModal" :can-cancel="['escape']" :custom-class="bringToFrontClass" @close="bringToFrontClass = ''" scroll="clip">
|
|
18
|
+
<button type="button" class="modal-close is-large" style="" @click="carouselModal = false"></button>
|
|
19
|
+
<b-carousel
|
|
20
|
+
v-if="single"
|
|
21
|
+
v-model="collectionIndex"
|
|
22
|
+
@change="carouselChange($event)"
|
|
23
|
+
:repeat="false"
|
|
24
|
+
:arrow="true"
|
|
25
|
+
:arrow-hover="false"
|
|
26
|
+
:has-drag="true"
|
|
27
|
+
:autoplay="false"
|
|
28
|
+
:indicator="false"
|
|
29
|
+
>
|
|
30
|
+
<template v-for="(review, i) in cumulativeData" :key="review.id">
|
|
31
|
+
<b-carousel-item>
|
|
32
|
+
<div class="columns">
|
|
33
|
+
<div class="column is-6 img-full">
|
|
34
|
+
<img
|
|
35
|
+
v-if="review.images[reviewImageIndex]"
|
|
36
|
+
:src="review.images[reviewImageIndex].url"
|
|
37
|
+
:alt="review.images[reviewImageIndex].alt"
|
|
38
|
+
:id="'image-' + i"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="column is-6">
|
|
42
|
+
<Review :review="review" :active-image-index="reviewImageIndex" @update:modelValue="reviewImageIndex = $event" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</b-carousel-item>
|
|
54
46
|
</template>
|
|
55
|
-
</
|
|
56
|
-
</
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
</b-carousel>
|
|
48
|
+
</b-modal>
|
|
49
|
+
|
|
50
|
+
<b-modal v-model="allImagesModal" :can-cancel="['escape']" scroll="clip">
|
|
51
|
+
<button type="button" class="modal-close is-large" style="" @click="allImagesModal = false"></button>
|
|
52
|
+
<div class="all-images-c">
|
|
53
|
+
<div class="columns is-multiline is-mobile all-images">
|
|
54
|
+
<template v-for="(review, c) in cumulativeData">
|
|
55
|
+
<template v-if="review.images.length">
|
|
56
|
+
<div v-for="(image, r) in review.images" class="column all-images-col">
|
|
57
|
+
<img :key="image.id" :src="image.thumb_url" :alt="image.alt" @click="openModal(c, r)" />
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
</template>
|
|
61
|
+
</div>
|
|
62
|
+
<div style="margin: 2rem; display: flex; justify-content: center">
|
|
63
|
+
<button v-if="data.meta && cumulativeData.length < data.meta.total" class="button" @click="loadMore">{{ $t('review.loadMore') }}</button>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</b-modal>
|
|
60
67
|
</div>
|
|
61
|
-
</
|
|
68
|
+
</Teleport>
|
|
62
69
|
</div>
|
|
63
70
|
</template>
|
|
64
71
|
|
|
65
|
-
<script>
|
|
72
|
+
<script setup>
|
|
73
|
+
import { ref, computed, onMounted, nextTick } from 'vue'
|
|
74
|
+
import { useMq, useT } from '../../../composables/globals'
|
|
66
75
|
import _ from 'underscore'
|
|
67
|
-
|
|
68
76
|
import { ProductReviews } from '../../../api'
|
|
69
|
-
import
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
77
|
+
import { eventBus } from '../../../utils/event-bus'
|
|
78
|
+
import Review from './Review.vue'
|
|
79
|
+
|
|
80
|
+
// Access global properties
|
|
81
|
+
const { t: $t } = useT()
|
|
82
|
+
const mq = useMq()
|
|
83
|
+
|
|
84
|
+
// State
|
|
85
|
+
const single = ref(true)
|
|
86
|
+
const collectionIndex = ref(0)
|
|
87
|
+
const reviewImageIndex = ref(0)
|
|
88
|
+
const imageIndex = ref(0)
|
|
89
|
+
const carouselModal = ref(false)
|
|
90
|
+
const allImagesModal = ref(false)
|
|
91
|
+
const bringToFrontClass = ref('')
|
|
92
|
+
const modalsContainer = ref(null)
|
|
93
|
+
const filterParams = ref({
|
|
94
|
+
images: 1,
|
|
95
|
+
review_id: null,
|
|
96
|
+
previous: null,
|
|
97
|
+
next: null,
|
|
98
|
+
thumb_size: mq.value === 'mobile' ? '100x100' : '200x200',
|
|
99
|
+
per_page: 20,
|
|
100
|
+
page: 1
|
|
101
|
+
})
|
|
102
|
+
const cumulativeData = ref([])
|
|
103
|
+
const data = ref({
|
|
104
|
+
data: [],
|
|
105
|
+
meta: null
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
// Computed
|
|
109
|
+
const images = computed(() => {
|
|
110
|
+
let imagesList = []
|
|
111
|
+
if (!cumulativeData.value.length) {
|
|
112
|
+
return imagesList
|
|
113
|
+
}
|
|
114
|
+
cumulativeData.value.map((review, data_idx) => {
|
|
115
|
+
if (review.images.length > 0) {
|
|
116
|
+
review.images.forEach((reviewImage, idx) => {
|
|
117
|
+
imagesList.push({
|
|
118
|
+
id: reviewImage.id,
|
|
119
|
+
review_id: review.id,
|
|
120
|
+
review_images_idx: idx,
|
|
121
|
+
collection_idx: data_idx,
|
|
122
|
+
thumb_url: reviewImage.thumb_url,
|
|
123
|
+
alt: reviewImage.alt
|
|
124
|
+
})
|
|
125
|
+
})
|
|
97
126
|
}
|
|
98
|
-
}
|
|
127
|
+
})
|
|
128
|
+
return imagesList
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// Methods
|
|
132
|
+
async function getImages() {
|
|
133
|
+
const response = await ProductReviews.getList(window.wkl_product.id, filterParams.value)
|
|
134
|
+
data.value.data = response.data.data
|
|
135
|
+
if (response.data.meta) {
|
|
136
|
+
data.value.meta = response.data.meta
|
|
137
|
+
}
|
|
138
|
+
updateCumulativeData(response.data.data)
|
|
139
|
+
return response.data.data.length
|
|
140
|
+
}
|
|
99
141
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
142
|
+
function updateCumulativeData(reviews) {
|
|
143
|
+
reviews.forEach((review) => {
|
|
144
|
+
if (review.images.length) {
|
|
145
|
+
let exists = _.findIndex(cumulativeData.value, { id: review.id })
|
|
146
|
+
if (exists === -1) {
|
|
147
|
+
cumulativeData.value.push(review)
|
|
105
148
|
}
|
|
106
|
-
this.cumulativeData.map((review, data_idx) => {
|
|
107
|
-
if (review.images.length > 0) {
|
|
108
|
-
review.images.forEach((reviewImage, idx) => {
|
|
109
|
-
images.push({
|
|
110
|
-
id: reviewImage.id,
|
|
111
|
-
review_id: review.id,
|
|
112
|
-
review_images_idx: idx,
|
|
113
|
-
collection_idx: data_idx,
|
|
114
|
-
thumb_url: reviewImage.thumb_url,
|
|
115
|
-
alt: reviewImage.alt
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
return images
|
|
121
149
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
methods: {
|
|
125
|
-
async getImages() {
|
|
126
|
-
const { data } = await ProductReviews.getList(window.wkl_product.id, this.filterParams)
|
|
127
|
-
this.data.data = data.data
|
|
128
|
-
if (data.meta) {
|
|
129
|
-
this.data.meta = data.meta
|
|
130
|
-
}
|
|
131
|
-
this.updateCumulativeData(data.data)
|
|
132
|
-
return data.data.length
|
|
133
|
-
},
|
|
134
|
-
|
|
135
|
-
updateCumulativeData(data) {
|
|
136
|
-
data.forEach((review) => {
|
|
137
|
-
if (review.images.length) {
|
|
138
|
-
let exists = _.findIndex(this.cumulativeData, { id: review.id })
|
|
139
|
-
if (exists === -1) {
|
|
140
|
-
this.cumulativeData.push(review)
|
|
141
|
-
//console.log('Added ', review.id, 'to cumulativeData')
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
setArrowsVisibility(collectionIndex) {
|
|
148
|
-
let leftArrow = document.querySelector('.userimg-gallery div.carousel-arrow > span.icon.has-icons-left')
|
|
149
|
-
let rightArrow = document.querySelector('.userimg-gallery div.carousel-arrow > span.icon.has-icons-right')
|
|
150
|
-
if(!leftArrow || !rightArrow) {
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
if (collectionIndex === 0) {
|
|
154
|
-
leftArrow.style.visibility = 'hidden'
|
|
155
|
-
} else {
|
|
156
|
-
leftArrow.style.visibility = 'visible'
|
|
157
|
-
}
|
|
158
|
-
if (collectionIndex === this.cumulativeData.length - 1) {
|
|
159
|
-
rightArrow.style.visibility = 'hidden'
|
|
160
|
-
} else {
|
|
161
|
-
rightArrow.style.visibility = 'visible'
|
|
162
|
-
}
|
|
163
|
-
},
|
|
150
|
+
})
|
|
151
|
+
}
|
|
164
152
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
this.reviewImageIndex = 0
|
|
175
|
-
this.setArrowsVisibility(e)
|
|
176
|
-
if (this.cumulativeData.length < this.data.meta.total && (this.cumulativeData.length === 2 || this.cumulativeData.length - e <= 3)) {
|
|
177
|
-
//console.log('get next reviews with images ', this.cumulativeData.length)
|
|
178
|
-
this.filterParams.review_id = this.cumulativeData[this.collectionIndex]['id']
|
|
179
|
-
this.filterParams.previous = 5
|
|
180
|
-
await this.getImages()
|
|
181
|
-
this.$nextTick(() => {
|
|
182
|
-
this.setArrowsVisibility(this.collectionIndex)
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
|
|
187
|
-
openModal(collection_idx, image_idx) {
|
|
188
|
-
this.collectionIndex = collection_idx
|
|
189
|
-
this.reviewImageIndex = image_idx
|
|
190
|
-
this.bringToFrontClass = 'bring-to-front'
|
|
191
|
-
this.carouselModal = true
|
|
192
|
-
this.$nextTick(() => {
|
|
193
|
-
this.setArrowsVisibility(collection_idx)
|
|
194
|
-
this.attachModalToBody()
|
|
195
|
-
})
|
|
196
|
-
},
|
|
197
|
-
|
|
198
|
-
viewAll() {
|
|
199
|
-
this.allImagesModal = true
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
async loadMore() {
|
|
203
|
-
//console.log('Load more', this.cumulativeData[this.cumulativeData.length - 1]['id'])
|
|
204
|
-
//console.log(this.cumulativeData.length, this.data.meta.total)
|
|
205
|
-
this.filterParams.review_id = this.cumulativeData[this.cumulativeData.length - 1]['id']
|
|
206
|
-
this.filterParams.previous = 5
|
|
207
|
-
await this.getImages()
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
viewImage(e) {
|
|
211
|
-
console.log('ReviewImages.viewImage ', e)
|
|
153
|
+
function setArrowsVisibility(index) {
|
|
154
|
+
// The carousel is teleported to body, so look in its own wrapper, not the first .userimg-gallery
|
|
155
|
+
let leftArrow = modalsContainer.value?.querySelector('div.carousel-arrow > span.icon.has-icons-left')
|
|
156
|
+
let rightArrow = modalsContainer.value?.querySelector('div.carousel-arrow > span.icon.has-icons-right')
|
|
157
|
+
if (leftArrow && rightArrow) {
|
|
158
|
+
if (index === 0) {
|
|
159
|
+
leftArrow.style.visibility = 'hidden'
|
|
160
|
+
} else {
|
|
161
|
+
leftArrow.style.visibility = 'visible'
|
|
212
162
|
}
|
|
213
|
-
|
|
163
|
+
if (index === cumulativeData.value.length - 1) {
|
|
164
|
+
rightArrow.style.visibility = 'hidden'
|
|
165
|
+
} else {
|
|
166
|
+
rightArrow.style.visibility = 'visible'
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
214
170
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
171
|
+
async function carouselChange(e) {
|
|
172
|
+
collectionIndex.value = e
|
|
173
|
+
reviewImageIndex.value = 0
|
|
174
|
+
setArrowsVisibility(e)
|
|
175
|
+
if (cumulativeData.value.length < data.value.meta.total && (cumulativeData.value.length === 2 || cumulativeData.value.length - e <= 3)) {
|
|
176
|
+
filterParams.value.review_id = cumulativeData.value[collectionIndex.value]['id']
|
|
177
|
+
filterParams.value.previous = 5
|
|
178
|
+
await getImages()
|
|
179
|
+
nextTick(() => {
|
|
180
|
+
setArrowsVisibility(collectionIndex.value)
|
|
181
|
+
})
|
|
182
|
+
}
|
|
183
|
+
}
|
|
219
184
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
185
|
+
function openModal(collection_idx, image_idx) {
|
|
186
|
+
collectionIndex.value = collection_idx
|
|
187
|
+
reviewImageIndex.value = image_idx
|
|
188
|
+
bringToFrontClass.value = 'bring-to-front'
|
|
189
|
+
carouselModal.value = true
|
|
190
|
+
nextTick(() => {
|
|
191
|
+
setArrowsVisibility(collection_idx)
|
|
192
|
+
})
|
|
193
|
+
}
|
|
225
194
|
|
|
226
|
-
|
|
195
|
+
function viewAll() {
|
|
196
|
+
allImagesModal.value = true
|
|
197
|
+
}
|
|
227
198
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
//console.log('ReviewImages.onViewImage ', 'Review is not in cumulativeData', pl.review_id)
|
|
234
|
-
return false
|
|
235
|
-
}
|
|
236
|
-
this.reviewImageIndex = _.findIndex(this.cumulativeData[this.collectionIndex]['images'], { id: pl.image_id })
|
|
199
|
+
async function loadMore() {
|
|
200
|
+
filterParams.value.review_id = cumulativeData.value[cumulativeData.value.length - 1]['id']
|
|
201
|
+
filterParams.value.previous = 5
|
|
202
|
+
await getImages()
|
|
203
|
+
}
|
|
237
204
|
|
|
238
|
-
|
|
205
|
+
// Lifecycle
|
|
206
|
+
onMounted(async () => {
|
|
207
|
+
await getImages()
|
|
239
208
|
|
|
240
|
-
|
|
241
|
-
|
|
209
|
+
eventBus.on('viewImage', (pl) => {
|
|
210
|
+
if (!pl.review_id || !pl.image_id) {
|
|
211
|
+
return
|
|
212
|
+
}
|
|
242
213
|
|
|
243
|
-
|
|
244
|
-
|
|
214
|
+
collectionIndex.value = _.findIndex(cumulativeData.value, {
|
|
215
|
+
id: pl.review_id
|
|
245
216
|
})
|
|
246
|
-
|
|
247
|
-
|
|
217
|
+
if (collectionIndex.value === -1) {
|
|
218
|
+
return false
|
|
219
|
+
}
|
|
220
|
+
reviewImageIndex.value = _.findIndex(cumulativeData.value[collectionIndex.value]['images'], { id: pl.image_id })
|
|
221
|
+
|
|
222
|
+
openModal(collectionIndex.value, reviewImageIndex.value)
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
eventBus.on('addToCumulativeData', (reviews, page) => {
|
|
226
|
+
updateCumulativeData(reviews)
|
|
227
|
+
})
|
|
228
|
+
})
|
|
248
229
|
</script>
|
|
@@ -3,76 +3,102 @@
|
|
|
3
3
|
<div :class="['is-flex', 'vote-actions', { 'vote-actions-loading': loading }]">
|
|
4
4
|
<div class="vote-title">{{ title }}</div>
|
|
5
5
|
<div class="vote-action" @click="addVote(1)">
|
|
6
|
-
<i class="
|
|
6
|
+
<i class="fas fa-thumbs-up"></i><span> {{ upvotes }} </span>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="vote-action" @click="addVote(0)">
|
|
9
|
-
<i class="
|
|
9
|
+
<i class="fas fa-thumbs-down"></i><span> {{ downvotes }}</span>
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
</div>
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
|
-
<script>
|
|
16
|
-
export default {
|
|
17
|
-
name: 'Vote',
|
|
18
|
-
|
|
19
|
-
props: {
|
|
20
|
-
title: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: ''
|
|
23
|
-
},
|
|
24
|
-
item: {
|
|
25
|
-
type: Object
|
|
26
|
-
},
|
|
27
|
-
result: {
|
|
28
|
-
type: Object
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
15
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
loading: false
|
|
36
|
-
}
|
|
37
|
-
},
|
|
16
|
+
<script setup>
|
|
17
|
+
import { ref, computed, watch } from 'vue';
|
|
18
|
+
import { useBuefy } from '../../../composables/globals';
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} else {
|
|
44
|
-
return 0
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
downvotes() {
|
|
48
|
-
if (this.item.down_votes) {
|
|
49
|
-
return this.item.down_votes
|
|
50
|
-
} else {
|
|
51
|
-
return 0
|
|
52
|
-
}
|
|
53
|
-
}
|
|
20
|
+
const props = defineProps({
|
|
21
|
+
title: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: ''
|
|
54
24
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
result: function (newResult, oldResult) {
|
|
59
|
-
if (newResult && newResult.status === 1) {
|
|
60
|
-
this.$buefy.snackbar.open(newResult.msg)
|
|
61
|
-
this.item.up_votes = newResult.data.up_votes
|
|
62
|
-
this.item.down_votes = newResult.data.down_votes
|
|
63
|
-
this.submitted = true
|
|
64
|
-
} else {
|
|
65
|
-
this.$buefy.snackbar.open(newResult.msg)
|
|
66
|
-
}
|
|
67
|
-
this.loading = false
|
|
68
|
-
}
|
|
25
|
+
item: {
|
|
26
|
+
type: Object,
|
|
27
|
+
required: true
|
|
69
28
|
},
|
|
29
|
+
result: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: () => ({})
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const emit = defineEmits(['vote']);
|
|
36
|
+
|
|
37
|
+
const submitted = ref(false);
|
|
38
|
+
const loading = ref(false);
|
|
39
|
+
|
|
40
|
+
const upvotes = computed(() => props.item.up_votes ? props.item.up_votes : 0);
|
|
41
|
+
const downvotes = computed(() => props.item.down_votes ? props.item.down_votes : 0);
|
|
70
42
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
const $buefy = useBuefy();
|
|
44
|
+
|
|
45
|
+
watch(() => props.result, (newResult) => {
|
|
46
|
+
if (newResult && newResult.status === 1) {
|
|
47
|
+
$buefy.snackbar.open(newResult.msg);
|
|
48
|
+
if (newResult.data) {
|
|
49
|
+
props.item.up_votes = newResult.data.up_votes;
|
|
50
|
+
props.item.down_votes = newResult.data.down_votes;
|
|
75
51
|
}
|
|
52
|
+
submitted.value = true;
|
|
53
|
+
} else if (newResult && newResult.msg) {
|
|
54
|
+
$buefy.snackbar.open(newResult.msg);
|
|
76
55
|
}
|
|
56
|
+
loading.value = false;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
function addVote(vote) {
|
|
60
|
+
loading.value = true;
|
|
61
|
+
emit('vote', vote);
|
|
77
62
|
}
|
|
78
63
|
</script>
|
|
64
|
+
|
|
65
|
+
<style scoped>
|
|
66
|
+
.vote-actions {
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 1rem;
|
|
69
|
+
padding: 0.5rem 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vote-actions-loading {
|
|
73
|
+
opacity: 0.6;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.vote-title {
|
|
78
|
+
font-weight: 500;
|
|
79
|
+
margin-right: 0.5rem;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.vote-action {
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
85
|
+
gap: 0.25rem;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
padding: 0.25rem 0.5rem;
|
|
88
|
+
border-radius: 4px;
|
|
89
|
+
transition: background-color 0.2s;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.vote-action:hover {
|
|
93
|
+
background-color: #f5f5f5;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.vote-action i {
|
|
97
|
+
font-size: 1rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.vote-action span {
|
|
101
|
+
font-size: 0.9rem;
|
|
102
|
+
font-weight: 500;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div style="display: flex; justify-content: flex-end; flex-direction: column;">
|
|
3
3
|
<select data-test="cart-item-qty" class="select" v-if="showSelect" @change="qtySelectChange($event)" v-model="qty" style="text-align:center;">
|
|
4
|
-
<option v-for="
|
|
4
|
+
<option v-for="q in selectRange" :value="q" :key="q">{{ q }}</option>
|
|
5
5
|
<option value="smp">{{ selectMax + 1 }}+</option>
|
|
6
6
|
</select>
|
|
7
7
|
<form @submit.prevent="qtyUpdate" style="display:flex; flex-direction: column;">
|
|
@@ -16,8 +16,10 @@ import _ from 'underscore'
|
|
|
16
16
|
|
|
17
17
|
export default {
|
|
18
18
|
name: 'QuantityInput',
|
|
19
|
+
|
|
20
|
+
// Vue 3: Use modelValue instead of value for v-model
|
|
19
21
|
props: {
|
|
20
|
-
|
|
22
|
+
modelValue: {
|
|
21
23
|
type: Number,
|
|
22
24
|
required: false,
|
|
23
25
|
default: 0,
|
|
@@ -43,6 +45,9 @@ export default {
|
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
|
|
48
|
+
// Vue 3: Declare emitted events
|
|
49
|
+
emits: ['update:modelValue'],
|
|
50
|
+
|
|
46
51
|
data() {
|
|
47
52
|
return {
|
|
48
53
|
showSelect: true,
|
|
@@ -58,10 +63,13 @@ export default {
|
|
|
58
63
|
},
|
|
59
64
|
|
|
60
65
|
watch: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
66
|
+
modelValue: {
|
|
67
|
+
immediate: true,
|
|
68
|
+
handler(nv) {
|
|
69
|
+
this.qty = nv
|
|
70
|
+
if (this.qty > this.selectMax) {
|
|
71
|
+
this.showSelect = false
|
|
72
|
+
}
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
75
|
},
|
|
@@ -88,13 +96,15 @@ export default {
|
|
|
88
96
|
this.$refs.textInput.focus()
|
|
89
97
|
}, 100)
|
|
90
98
|
} else {
|
|
91
|
-
|
|
99
|
+
// Vue 3: emit update:modelValue instead of input
|
|
100
|
+
this.$emit('update:modelValue', parseInt(event.target.value))
|
|
92
101
|
}
|
|
93
102
|
},
|
|
94
103
|
|
|
95
104
|
qtyUpdate() {
|
|
96
105
|
this.showUpdateButton = false
|
|
97
|
-
|
|
106
|
+
// Vue 3: emit update:modelValue instead of input
|
|
107
|
+
this.$emit('update:modelValue', parseInt(this.qty))
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
110
|
}
|