From 0df7c71b800b0601803c1f146888330f835b37b3 Mon Sep 17 00:00:00 2001 From: Michael Bromley Date: Thu, 19 Nov 2020 14:43:20 +0100 Subject: [PATCH] feat(admin-ui): Add "allocated" and "saleable" values to Variant form Closes #554 --- packages/admin-ui/i18n-coverage.json | 34 ++++++------ .../product-variants-list.component.html | 52 ++++++++++++++++--- .../product-variants-list.component.ts | 7 +++ .../src/lib/static/i18n-messages/cs.json | 7 ++- .../src/lib/static/i18n-messages/de.json | 5 ++ .../src/lib/static/i18n-messages/en.json | 5 ++ .../src/lib/static/i18n-messages/es.json | 5 ++ .../src/lib/static/i18n-messages/pl.json | 5 ++ .../src/lib/static/i18n-messages/pt_BR.json | 5 ++ .../src/lib/static/i18n-messages/zh_Hans.json | 5 ++ .../src/lib/static/i18n-messages/zh_Hant.json | 5 ++ 11 files changed, 110 insertions(+), 25 deletions(-) diff --git a/packages/admin-ui/i18n-coverage.json b/packages/admin-ui/i18n-coverage.json index 8beeca38a4..a32f6cf1b4 100644 --- a/packages/admin-ui/i18n-coverage.json +++ b/packages/admin-ui/i18n-coverage.json @@ -1,46 +1,46 @@ { - "generatedOn": "2020-11-18T10:02:11.129Z", - "lastCommit": "078de4094b9eaa486e8337fc90c575302a91b590", + "generatedOn": "2020-11-19T13:33:04.322Z", + "lastCommit": "7a9ba233b74b9eaae0f100a19f7e84e2b7c35a0f", "translationStatus": { "cs": { - "tokenCount": 688, - "translatedCount": 687, - "percentage": 100 + "tokenCount": 693, + "translatedCount": 688, + "percentage": 99 }, "de": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 597, - "percentage": 87 + "percentage": 86 }, "en": { - "tokenCount": 688, - "translatedCount": 687, - "percentage": 100 + "tokenCount": 693, + "translatedCount": 688, + "percentage": 99 }, "es": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 455, "percentage": 66 }, "pl": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 552, "percentage": 80 }, "pt_BR": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 643, "percentage": 93 }, "zh_Hans": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 536, - "percentage": 78 + "percentage": 77 }, "zh_Hant": { - "tokenCount": 688, + "tokenCount": 693, "translatedCount": 536, - "percentage": 78 + "percentage": 77 } } } \ No newline at end of file diff --git a/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.html b/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.html index a57d3f9709..52777984f9 100644 --- a/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.html +++ b/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.html @@ -67,7 +67,7 @@ + }}
{{ getTaxCategoryName(formGroup) }}
@@ -94,7 +94,7 @@
- + +
+ +
+ {{ variant.stockAllocated }} +
+
+
+ +
+ {{ getSaleableStockLevel(variant) }} +
+
+
-
+
diff --git a/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.ts b/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.ts index 36de01a607..1b3b328ba9 100644 --- a/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.ts +++ b/packages/admin-ui/src/lib/catalog/src/components/product-variants-list/product-variants-list.component.ts @@ -137,6 +137,13 @@ export class ProductVariantsListComponent implements OnChanges, OnInit, OnDestro return ''; } + getSaleableStockLevel(variant: ProductWithVariants.Variants) { + const effectiveOutOfStockThreshold = variant.useGlobalOutOfStockThreshold + ? this.globalOutOfStockThreshold + : variant.outOfStockThreshold; + return variant.stockOnHand - variant.stockAllocated - effectiveOutOfStockThreshold; + } + areAllSelected(): boolean { return !!this.variants && this.selectedVariantIds.length === this.variants.length; } diff --git a/packages/admin-ui/src/lib/static/i18n-messages/cs.json b/packages/admin-ui/src/lib/static/i18n-messages/cs.json index 89e317db6d..7d55144e4d 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/cs.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/cs.json @@ -125,7 +125,12 @@ "sku": "SKU", "slug": "Odkaz", "slug-pattern-error": "Špatný formát odkazu", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "Sklad", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "Skupina daní", "taxes": "Daně", "track-inventory": "Dopočítávat sklad", @@ -719,4 +724,4 @@ "job-result": "Výsledek úlohy", "job-state": "Stav úlohy" } -} +} \ No newline at end of file diff --git a/packages/admin-ui/src/lib/static/i18n-messages/de.json b/packages/admin-ui/src/lib/static/i18n-messages/de.json index 3c7242ce52..19f2347fd1 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/de.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/de.json @@ -125,7 +125,12 @@ "sku": "Artikelnummer", "slug": "Slug", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "Bestand", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "Steuerkategorie", "taxes": "Steuern", "track-inventory": "Bestand verfolgen", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/en.json b/packages/admin-ui/src/lib/static/i18n-messages/en.json index 891b0d5cad..9ed0d096b6 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/en.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/en.json @@ -125,7 +125,12 @@ "sku": "SKU", "slug": "Slug", "slug-pattern-error": "Slug is invalid", + "stock-allocated": "Allocated", + "stock-allocated-tooltip": "The number of units allocated to Orders which have checked out but not yet been fulfilled", "stock-on-hand": "Stock", + "stock-on-hand-tooltip": "Stock on hand - the number of physical units available in stock", + "stock-saleable": "Saleable", + "stock-saleable-tooltip": "The number of saleable units, comprising the stock on hand - allocated, taking into account the out-of-stock threshold", "tax-category": "Tax category", "taxes": "Taxes", "track-inventory": "Track inventory", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/es.json b/packages/admin-ui/src/lib/static/i18n-messages/es.json index d928109474..f0255c7716 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/es.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/es.json @@ -125,7 +125,12 @@ "sku": "SKU", "slug": "Slug", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "Inventario disponible", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "Categoría de impuestos", "taxes": "Impuestos", "track-inventory": "", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/pl.json b/packages/admin-ui/src/lib/static/i18n-messages/pl.json index 5f762ba43d..e91923470b 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/pl.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/pl.json @@ -125,7 +125,12 @@ "sku": "SKU", "slug": "Slug", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "Stan magazynowy", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "Kategoria podatkowa", "taxes": "Podatki", "track-inventory": "Śledź magazyn", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json b/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json index be2b682c25..72771adee5 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json @@ -125,7 +125,12 @@ "sku": "SKU", "slug": "Slug", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "Estoque", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "Categoria de impostos", "taxes": "Impostos", "track-inventory": "Rastrear inventário", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json index 8c3a94d67c..f7c08a966b 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json @@ -125,7 +125,12 @@ "sku": "商品库存编码", "slug": "名称缩写", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "库存", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "税表分类", "taxes": "价格(含税)", "track-inventory": "跟踪库存", diff --git a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json index 7eb873ea80..014abbb6c4 100644 --- a/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json +++ b/packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json @@ -125,7 +125,12 @@ "sku": "商品庫存編碼", "slug": "名稱缩写", "slug-pattern-error": "", + "stock-allocated": "", + "stock-allocated-tooltip": "", "stock-on-hand": "庫存", + "stock-on-hand-tooltip": "", + "stock-saleable": "", + "stock-saleable-tooltip": "", "tax-category": "税表分類", "taxes": "價格(連税)", "track-inventory": "跟踪庫存",