@wikala/spmkt 2.11.0 → 2.12.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.
@@ -2,11 +2,13 @@
2
2
  <div :class="['cart-item', { 'ci-error': item.error }]">
3
3
  <div class="ci-product">
4
4
  <div class="ci-product-image">
5
- <a :href="item.slug"><img :src="item.image_url" class="image is-64x64" /></a>
5
+ <a :href="item.slug" :class="[{ 'is-link-passive': !item.storefront_visibility }]">
6
+ <img v-if="item.storefront_visibility && !item.image_url.includes('image_not_found')" :src="item.image_url" class="image is-64x64" />
7
+ </a>
6
8
  </div>
7
9
  <div class="ci-name">
8
10
  <div class="ci-product-name">
9
- <a :href="item.slug">{{ item.name }}</a>
11
+ <a :href="item.slug" :class="[{ 'is-link-passive': !item.storefront_visibility }]">{{ item.name }}</a>
10
12
  </div>
11
13
  </div>
12
14
  <div class="ci-price">
@@ -14,7 +16,7 @@
14
16
  <div>{{ formatMoney(item.price, { precision: 2 }) }}</div>
15
17
  </div>
16
18
  <div class="ci-qty">
17
- <quantity-input :value="item.qty" @input="changeQty($event, item.id)"></quantity-input>
19
+ <quantity-input :value="itemQty" @input="changeQty($event, item.id)"></quantity-input>
18
20
  </div>
19
21
  </div>
20
22
  <div v-if="item.error" :class="{ 'ci-error-msg': item.error }">
@@ -41,6 +43,12 @@ export default {
41
43
  item: Object
42
44
  },
43
45
 
46
+ data() {
47
+ return {
48
+ itemQty: 0
49
+ }
50
+ },
51
+
44
52
  computed: {
45
53
  ...mapState(['cart', 'activeStep', 'steps'])
46
54
  },
@@ -48,35 +56,14 @@ export default {
48
56
  methods: {
49
57
  ...mapMutations(['setCart']),
50
58
  formatMoney,
51
- /*
52
- cartItemRemoveHover(event) {
53
- if (event.target.classList.contains('has-text-danger')) {
54
- event.target.classList.remove('has-text-danger')
55
- } else {
56
- event.target.classList.add('has-text-danger')
57
- }
58
- },
59
-
60
- cartItemRemove(productId) {
61
- let irLoading = this.$buefy.loading.open({
62
- container: this.$el
63
- })
64
- Cart.update({ id: productId, qty: 0 })
65
- .then((response) => {
66
- irLoading.close()
67
- this.setCart(response.data)
68
- })
69
- .catch((error) => {
70
- irLoading.close()
71
- console.log(error)
72
- })
73
- },*/
74
59
 
75
60
  async changeQty(qty, productId) {
76
61
  const cqLoading = this.$buefy.loading.open({
77
62
  container: this.$el
78
63
  })
79
64
 
65
+ this.itemQty = parseInt(qty)
66
+
80
67
  let requestData = {
81
68
  id: productId,
82
69
  qty: qty
@@ -96,6 +83,10 @@ export default {
96
83
  }
97
84
  this.$bus.$emit('updateTotalQty', response.data.sumQty)
98
85
  cqLoading.close()
86
+ let responseItem = response.data.items.find(item => item.id === productId)
87
+ if(responseItem) {
88
+ this.itemQty = responseItem.qty
89
+ }
99
90
  this.setCart(response.data)
100
91
  } catch (error) {
101
92
  cqLoading.close()
@@ -128,6 +119,9 @@ export default {
128
119
  })
129
120
  }
130
121
  }
122
+ },
123
+ mounted() {
124
+ this.itemQty = this.item.qty
131
125
  }
132
126
  }
133
127
  </script>
@@ -18,7 +18,7 @@
18
18
  <div class="ci-qty has-text-right has-text-grey-light">{{ $t('global.quantity') }}</div>
19
19
  </div>
20
20
  <div class="cart-items">
21
- <CartItem v-for="item in cart.items" :key="item.id" :item="item"></CartItem>
21
+ <CartItem v-for="item in cart.items" :key="item.id+item.qty" :item="item"></CartItem>
22
22
  </div>
23
23
 
24
24
  <div v-if="cart.equivalent_qty > 0">
@@ -60,6 +60,15 @@
60
60
  </div>
61
61
  </div>
62
62
 
63
+ <div class="cart-accept-tos mt-6 mb-6" v-if="initialState.acceptTOSAtCheckout">
64
+ <b-checkbox name="accept_tos" v-model="acceptTOS" @input="acceptTOSChange">
65
+ <span v-html="$t('cart.acceptTOS')"></span>
66
+ </b-checkbox>
67
+ <p class="help is-danger" v-if="acceptTOSError">
68
+ {{ acceptTOSError }}
69
+ </p>
70
+ </div>
71
+
63
72
  <div class="cc-submit">
64
73
  <button type="button" @click="placeOrder" class="button is-primary is-large">{{ $t('cart.placeYourOrder') }}</button>
65
74
  </div>
@@ -75,6 +84,7 @@
75
84
 
76
85
  import { mapState, mapMutations, mapActions } from 'vuex'
77
86
  import _ from 'underscore'
87
+ import animateCSS from '../../../utils/animate'
78
88
 
79
89
  import { zsig } from '../../../utils/rc-token'
80
90
  import { Cart, Address as AddressRepository } from '../../../api'
@@ -121,7 +131,9 @@ export default {
121
131
  billing_address: {},
122
132
  validationErrors: {},
123
133
  paymentMethodError: false,
124
- recaptchaToken: ''
134
+ recaptchaToken: '',
135
+ acceptTOS: '',
136
+ acceptTOSError: ''
125
137
  }
126
138
  },
127
139
 
@@ -148,11 +160,16 @@ export default {
148
160
  statePaymentMethod: 'paymentMethod'
149
161
  })
150
162
  },
163
+
151
164
  methods: {
152
165
  ...mapMutations(['setActiveStep', 'setCreditCard', 'setCardToken', 'setBillingAddress', 'setRecaptchaToken', 'setIdempotencyKey', 'setPaymentMethod']),
153
166
 
154
167
  ...mapActions(['getAddresses']),
155
168
 
169
+ acceptTOSChange() {
170
+ this.acceptTOSError = ''
171
+ },
172
+
156
173
  onPaymentMethodsInput(pl) {
157
174
  this.paymentMethodError = false
158
175
  this.paymentMethod = _.findWhere(this.paymentMethods, {id: pl})
@@ -316,6 +333,16 @@ export default {
316
333
  this.paymentMethodError = true
317
334
  return
318
335
  }
336
+
337
+ if(this.initialState.acceptTOSAtCheckout) {
338
+ this.acceptTOSError = ''
339
+ if(!this.acceptTOS) {
340
+ animateCSS('.cart-accept-tos', 'pulse')
341
+ this.acceptTOSError = this.$t('cart.acceptTOSError')
342
+ return false
343
+ }
344
+ }
345
+
319
346
  if (this.statePaymentMethod.type === 'offline') {
320
347
  this.submitPayment()
321
348
  return
@@ -57,6 +57,12 @@ export default {
57
57
  }
58
58
  },
59
59
 
60
+ watch: {
61
+ value: function (nv, ov) {
62
+ this.qty = nv
63
+ }
64
+ },
65
+
60
66
  methods: {
61
67
  qtyInput(event) {
62
68
  if (event.target.value < 0) {
package/locales/en.json CHANGED
@@ -87,6 +87,8 @@
87
87
  "userIdentityPhoneErr": "Enter your mobile phone number"
88
88
  },
89
89
  "cart": {
90
+ "acceptTOS": "I accept TOS",
91
+ "acceptTOSError": "Accept TOS error",
90
92
  "acceptedPaymentMethods": "Accepted Payment Methods",
91
93
  "accountExistsError": "There is an existing account associated with this email address. Please sign in to continue or use a different email address.",
92
94
  "addToCart": "Add to cart",
package/locales/sr.json CHANGED
@@ -87,6 +87,8 @@
87
87
  "userIdentityPhoneErr": "Unesite broj telefona"
88
88
  },
89
89
  "cart": {
90
+ "acceptTOS": "Prihvatam <a href=\"/politika-privatnosti\" target=\"blank\">politiku privatnosti</a>, <a href=\"/uslovi-koriscenja\" target=\"blank\">uslove korišćenja</a> i <a href=\"/obavestenje-o-pravima-potrosaca\" target=\"blank\">obaveštenje o pravima potrošača</a>",
91
+ "acceptTOSError": "Da bi završili kupovinu neophodno je da prihvatite politiku privatnosti, uslove korišćenja i obaveštenje o pravima potrošača",
90
92
  "acceptedPaymentMethods": "Načini plaćanja",
91
93
  "accountExistsError": "Već postoji nalog sa unetom email adresom. Molimo vas da se ulogujete ili da unesete drugu email adresu.",
92
94
  "addToCart": "Dodaj u korpu",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.11.0",
3
+ "version": "2.12.1",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {