@techninja/staticart 0.1.10 → 0.1.11
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/package.json +1 -1
- package/src/components/molecules/product-card/product-card.js +2 -2
- package/src/pages/product-detail/product-detail-view.js +1 -1
- package/src/utils/productVariants.js +4 -2
- package/vendor/components/molecules/product-card/product-card.js +2 -2
- package/vendor/icons.json +2 -1
- package/vendor/pages/product-detail/product-detail-view.js +1 -1
- package/vendor/utils/productVariants.js +4 -2
package/package.json
CHANGED
|
@@ -74,7 +74,7 @@ export default define({
|
|
|
74
74
|
class="btn btn-primary btn-sm"
|
|
75
75
|
data-vid="${v.id}"
|
|
76
76
|
onclick="${handlePick}"
|
|
77
|
-
disabled="${v.stock
|
|
77
|
+
disabled="${v.stock === 0}"
|
|
78
78
|
>
|
|
79
79
|
${v.label}
|
|
80
80
|
</button>
|
|
@@ -87,7 +87,7 @@ export default define({
|
|
|
87
87
|
<button
|
|
88
88
|
class="btn btn-primary product-card__add"
|
|
89
89
|
onclick="${handleAdd}"
|
|
90
|
-
disabled="${stock
|
|
90
|
+
disabled="${stock === 0}"
|
|
91
91
|
>
|
|
92
92
|
${t('cart.add')}
|
|
93
93
|
</button>
|
|
@@ -115,7 +115,7 @@ export default define({
|
|
|
115
115
|
<button
|
|
116
116
|
class="btn btn-primary"
|
|
117
117
|
onclick="${handleAdd}"
|
|
118
|
-
disabled="${stock
|
|
118
|
+
disabled="${stock === 0 || (variants.length > 0 && !selectedVariant)}"
|
|
119
119
|
>
|
|
120
120
|
<app-icon name="cart" size="sm"></app-icon> ${t('cart.add')}
|
|
121
121
|
</button>
|
|
@@ -20,14 +20,16 @@ export function effectiveStock(p, vid) {
|
|
|
20
20
|
|
|
21
21
|
/** @param {number} stock */
|
|
22
22
|
export function stockLabel(stock) {
|
|
23
|
-
if (stock
|
|
23
|
+
if (stock < 0) return t('product.inStock');
|
|
24
|
+
if (stock === 0) return t('product.outOfStock');
|
|
24
25
|
if (stock <= 5) return t('product.lowStock');
|
|
25
26
|
return t('product.inStock');
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/** @param {number} stock */
|
|
29
30
|
export function stockColor(stock) {
|
|
30
|
-
if (stock
|
|
31
|
+
if (stock < 0) return 'success';
|
|
32
|
+
if (stock === 0) return 'danger';
|
|
31
33
|
if (stock <= 5) return 'warning';
|
|
32
34
|
return 'success';
|
|
33
35
|
}
|
|
@@ -74,7 +74,7 @@ export default define({
|
|
|
74
74
|
class="btn btn-primary btn-sm"
|
|
75
75
|
data-vid="${v.id}"
|
|
76
76
|
onclick="${handlePick}"
|
|
77
|
-
disabled="${v.stock
|
|
77
|
+
disabled="${v.stock === 0}"
|
|
78
78
|
>
|
|
79
79
|
${v.label}
|
|
80
80
|
</button>
|
|
@@ -87,7 +87,7 @@ export default define({
|
|
|
87
87
|
<button
|
|
88
88
|
class="btn btn-primary product-card__add"
|
|
89
89
|
onclick="${handleAdd}"
|
|
90
|
-
disabled="${stock
|
|
90
|
+
disabled="${stock === 0}"
|
|
91
91
|
>
|
|
92
92
|
${t('cart.add')}
|
|
93
93
|
</button>
|
package/vendor/icons.json
CHANGED
|
@@ -115,7 +115,7 @@ export default define({
|
|
|
115
115
|
<button
|
|
116
116
|
class="btn btn-primary"
|
|
117
117
|
onclick="${handleAdd}"
|
|
118
|
-
disabled="${stock
|
|
118
|
+
disabled="${stock === 0 || (variants.length > 0 && !selectedVariant)}"
|
|
119
119
|
>
|
|
120
120
|
<app-icon name="cart" size="sm"></app-icon> ${t('cart.add')}
|
|
121
121
|
</button>
|
|
@@ -20,14 +20,16 @@ export function effectiveStock(p, vid) {
|
|
|
20
20
|
|
|
21
21
|
/** @param {number} stock */
|
|
22
22
|
export function stockLabel(stock) {
|
|
23
|
-
if (stock
|
|
23
|
+
if (stock < 0) return t('product.inStock');
|
|
24
|
+
if (stock === 0) return t('product.outOfStock');
|
|
24
25
|
if (stock <= 5) return t('product.lowStock');
|
|
25
26
|
return t('product.inStock');
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
/** @param {number} stock */
|
|
29
30
|
export function stockColor(stock) {
|
|
30
|
-
if (stock
|
|
31
|
+
if (stock < 0) return 'success';
|
|
32
|
+
if (stock === 0) return 'danger';
|
|
31
33
|
if (stock <= 5) return 'warning';
|
|
32
34
|
return 'success';
|
|
33
35
|
}
|