@wikala/spmkt 2.29.0 → 2.29.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.
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <div>
3
- <div v-if="!cart.discount" class="pc-label">{{ $t('cart.haveACoupon') }}</div>
4
- <div v-if="!cart.discount" class="pc-input">
3
+ <div class="pc-label">{{ $t('cart.haveACoupon') }}</div>
4
+ <div class="pc-input" :class="{ 'mb-4': cart.discount }">
5
5
  <input @keyup.enter="applyCoupon" v-model="couponCode" class="input" type="text" name="coupon_code" :placeholder="$t('cart.enterCouponPlaceholder')" />
6
6
  <button name="enter_coupon" @click="applyCoupon" class="button is-small" :class="{ 'is-loading': acLoading }">{{ $t('cart.applyCoupon') }}</button>
7
7
  </div>
8
8
  <div v-if="cart.discount">
9
9
  <div class="applied-discounts has-text-weight-bold">
10
- <div class="has-text-success">{{ $t('cart.discountApplied') }}</div>
10
+ <div class="has-text-success">{{ $t('cart.discountApplied') }} [{{ cart.coupon_code }}]</div>
11
11
  <div v-if="cart.items.length === 1 || cart.discount === cart.order_discount" class="has-text-success">
12
12
  {{ $t('cart.youSaved') }} {{ formatMoney(cart.discount, { precision: 2 }) }}!
13
13
  </div>
@@ -279,20 +279,16 @@ export default {
279
279
  const productDiscountInfo = window.wkl_product_discount_info
280
280
 
281
281
  const variantDiscountInfo = productDiscountInfo.find(pdi => pdi.product_id == this.selectedVariant.id)
282
- console.log('variantDiscountInfo', variantDiscountInfo)
283
- /*
284
- @if($discountItem['coupon_applied'])
285
- U korpi će vam biti obračunat popust od {{ fmt_money($discountItem['discount_amount']) }} RSD
286
- @else
287
- Iskoristi promo kod {!! $discountItem['coupon_code'] !!} za popust od {{ fmt_money($discountItem['discount_amount']) }} RSD
288
- @endif
289
- */
282
+
290
283
  if(variantDiscountInfo) {
291
284
  discountInfoContainer.classList.remove('is-hidden')
292
285
  if(variantDiscountInfo.coupon_applied) {
293
286
  discountMessageContainer.textContent = `U korpi će vam biti obračunat popust od ${this.formatMoney(variantDiscountInfo.discount_amount)} RSD`
294
287
  } else {
295
- discountMessageContainer.textContent = `Iskoristi promo kod ${variantDiscountInfo.coupon_code} za popust od ${this.formatMoney(variantDiscountInfo.discount_amount)} RSD`
288
+ if(variantDiscountInfo.description.trim() !== '') {
289
+ discountMessageContainer.innerHTML = `<p>${variantDiscountInfo.description}</p><hr>`
290
+ }
291
+ discountMessageContainer.innerHTML += `Iskoristi promo kod ${variantDiscountInfo.coupon_code} za popust od ${this.formatMoney(variantDiscountInfo.discount_amount)} RSD`
296
292
  }
297
293
  }
298
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.29.0",
3
+ "version": "2.29.2",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {