@wikala/spmkt 2.28.0 → 2.28.2

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.
@@ -34,6 +34,7 @@
34
34
  <script>
35
35
  import _ from 'underscore'
36
36
  import { formatMoney } from '../../utils/filters'
37
+ import formatDate from 'intl-dateformat'
37
38
 
38
39
  const Pass = {
39
40
  name: 'Pass',
@@ -60,6 +61,14 @@ export default {
60
61
  },
61
62
  variantId: {
62
63
  type: Number
64
+ },
65
+ badgeSelector: {
66
+ type: String,
67
+ default: '.product-in-stock .discount.badge'
68
+ },
69
+ overridePriceNotificationSelector: {
70
+ type: String,
71
+ default: '.override-price-active'
63
72
  }
64
73
  },
65
74
 
@@ -214,7 +223,7 @@ export default {
214
223
  },
215
224
 
216
225
  updateDiscountBadge() {
217
- let badge = document.querySelector('.product-main .badge-discount')
226
+ let badge = document.querySelector(this.badgeSelector)
218
227
  if(!badge) {
219
228
  return
220
229
  }
@@ -230,6 +239,25 @@ export default {
230
239
  }
231
240
  },
232
241
 
242
+ updateOverridePriceNotification() {
243
+ let opActiveContainer = document.querySelector(this.overridePriceNotificationSelector)
244
+ if(!opActiveContainer) {
245
+ return
246
+ }
247
+ opActiveContainer.textContent = ''
248
+
249
+ if(!this.selectedVariant) {
250
+ return
251
+ }
252
+
253
+ if(this.selectedVariant.override_price_active) {
254
+ opActiveContainer.textContent = 'Trajanje akcije od ' +
255
+ formatDate(new Date(this.selectedVariant.override_start_at), 'DD.MM.YYYY HH:mm') +
256
+ ' do ' +
257
+ formatDate(new Date(this.selectedVariant.override_stop_at), 'DD.MM.YYYY HH:mm')
258
+ }
259
+ },
260
+
233
261
  getVariantByOption(optionId, optionValue) {
234
262
  if (this.productVariantOptions.length !== 1) {
235
263
  return {}
@@ -311,6 +339,7 @@ export default {
311
339
  this.$bus.$emit('updatePrice', this.selectedVariant.price, this.selectedVariant.compare_price)
312
340
  this.$bus.$emit('changePhoto', this.selectedVariant.default_image_id)
313
341
  this.$bus.$emit('updateSKU', this.selectedVariant.sku || this.selectedVariant.id)
342
+ this.updateOverridePriceNotification()
314
343
  }
315
344
  },
316
345
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.28.0",
3
+ "version": "2.28.2",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {