瀏覽代碼

fix(admin-ui): Improve feedback on attempting to create variant

Closes #2210
Michael Bromley 2 年之前
父節點
當前提交
e50b27154c

+ 16 - 16
packages/admin-ui/i18n-coverage.json

@@ -1,69 +1,69 @@
 {
-  "generatedOn": "2023-06-09T09:28:06.112Z",
-  "lastCommit": "dae3e93af527fd2696214700896ba577566ae12a",
+  "generatedOn": "2023-06-12T08:53:10.773Z",
+  "lastCommit": "00381181bd682df9ce0bec9453afd3b559d0ce95",
   "translationStatus": {
     "cs": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 544,
       "percentage": 74
     },
     "de": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 538,
       "percentage": 73
     },
     "en": {
-      "tokenCount": 736,
-      "translatedCount": 735,
+      "tokenCount": 737,
+      "translatedCount": 736,
       "percentage": 100
     },
     "es": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 569,
       "percentage": 77
     },
     "fr": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 564,
       "percentage": 77
     },
     "it": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 568,
       "percentage": 77
     },
     "pl": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 378,
       "percentage": 51
     },
     "pt_BR": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 542,
       "percentage": 74
     },
     "pt_PT": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 577,
       "percentage": 78
     },
     "ru": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 567,
       "percentage": 77
     },
     "uk": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 567,
       "percentage": 77
     },
     "zh_Hans": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 513,
       "percentage": 70
     },
     "zh_Hant": {
-      "tokenCount": 736,
+      "tokenCount": 737,
       "translatedCount": 358,
       "percentage": 49
     }

+ 16 - 2
packages/admin-ui/src/lib/catalog/src/components/create-product-variant-dialog/create-product-variant-dialog.component.html

@@ -13,12 +13,26 @@
             >
             </ng-select>
         </vdr-form-field>
+        <clr-alert
+            *ngIf="product.optionGroups.length === 0"
+            clrAlertType="warning"
+            [clrAlertClosable]="false"
+            class="form-grid-span"
+        >
+            <clr-alert-item>
+                <span class="alert-text">
+                    {{ 'catalog.cannot-create-variants-without-options' | translate }}
+                </span>
+            </clr-alert-item>
+        </clr-alert>
     </div>
     <div *ngIf="existingVariant" class="mt-2">
         <clr-alert clrAlertType="warning" [clrAlertClosable]="false" class="">
             <clr-alert-item>
                 <span class="alert-text">
-                    {{ 'catalog.product-variant-exists' | translate }}: {{ existingVariant.name }} ({{ existingVariant.sku }})
+                    {{ 'catalog.product-variant-exists' | translate }}: {{ existingVariant.name }} ({{
+                        existingVariant.sku
+                    }})
                 </span>
             </clr-alert-item>
         </clr-alert>
@@ -38,7 +52,7 @@
         type="submit"
         (click)="confirm()"
         class="btn btn-primary"
-        [disabled]="form.invalid || existingVariant"
+        [disabled]="form.invalid || existingVariant || product.optionGroups.length === 0"
     >
         {{ 'common.confirm' | translate }}
     </button>

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/cs.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Přiřadit varianty do kanálu",
     "auto-update-option-variant-name": "Automaticky aktualizovat jména variant pomocí této",
     "auto-update-product-variant-name": "Automaticky aktualizovat jména variant",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Náhled ceny v kanálu",
     "collection": "",
     "collection-contents": "Obsah kolekce",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/de.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Produktvarianten Kanälen zuweisen",
     "auto-update-option-variant-name": "Automatisch Namen der Optionsvariante aktualisieren",
     "auto-update-product-variant-name": "Automatisch Namen der Produktvariante aktualisieren",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Kanal-Preisvorschau",
     "collection": "Sammlung",
     "collection-contents": "Inhalt der Sammlung",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/en.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Assign product variants to channel",
     "auto-update-option-variant-name": "Automatically update the names of ProductVariants using this option",
     "auto-update-product-variant-name": "Automatically update the names of ProductVariants",
+    "cannot-create-variants-without-options": "Product variants cannot be created until an option group with at least two product options has been defined",
     "channel-price-preview": "Channel price preview",
     "collection": "Collection",
     "collection-contents": "Collection contents",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/es.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Asignar variantes de producto a canal de ventas",
     "auto-update-option-variant-name": "Actualiza los nombres de las variantes de producto automáticamente usando esta opción",
     "auto-update-product-variant-name": "Actualiza los nombres de las variantes de producto automáticamente",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Vista previa de precio para el canal de ventas",
     "collection": "",
     "collection-contents": "Contenidos de la colección",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/fr.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Attribuer une variation du produit au canal",
     "auto-update-option-variant-name": "Mettre à jour automatiquement les noms de variations du produit en utilisant cette option",
     "auto-update-product-variant-name": "Mettre à jour automatiquement les noms de variations du produit ",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Prévisualisation du prix du canal",
     "collection": "",
     "collection-contents": "Contenu de la Collection",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/it.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Assegna varianti al canale",
     "auto-update-option-variant-name": "Aggiorna automaticamente i nomi delle Varianti utilizzando questa opzione",
     "auto-update-product-variant-name": "Aggiorna automaticamente i nomi delle Varianti",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Anteprima prezzo canale",
     "collection": "",
     "collection-contents": "Contenuti della Collezione",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/pl.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "",
     "auto-update-option-variant-name": "",
     "auto-update-product-variant-name": "",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Podgląd cen kanału",
     "collection": "",
     "collection-contents": "Zawartość kolekcji",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/pt_BR.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Atribuir variação ao canal",
     "auto-update-option-variant-name": "Atualizar automaticamente os nomes das variações do produto usando esta opção",
     "auto-update-product-variant-name": "Atualizar automaticamente os nomes das variações do produto",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Visualizar preço do canal",
     "collection": "",
     "collection-contents": "Conteúdo da categoria",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/pt_PT.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Atribuir variante ao canal",
     "auto-update-option-variant-name": "Utilizar esta opção para actualizar automaticamente os nomes das variantes",
     "auto-update-product-variant-name": "Actualizar automaticamente os nomes das variantes do produto",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Visualizar preço do canal",
     "collection": "",
     "collection-contents": "Conteúdo da categoria",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/ru.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Добавить варианты товара в канал",
     "auto-update-option-variant-name": "Автоматически обновлять названия вариантов товара с помощью этой опции",
     "auto-update-product-variant-name": "Автоматически обновлять названия вариантов товара",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Предварительный просмотр цен канала",
     "collection": "",
     "collection-contents": "Содержание коллекции",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/uk.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "Додати варіанти товару в канал",
     "auto-update-option-variant-name": "Автоматично оновлювати назви варіантів товару, використовуючи цю опцію",
     "auto-update-product-variant-name": "Автоматично оновлювати назви варіантів товару",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "Попередній перегляд цін каналу",
     "collection": "",
     "collection-contents": "Зміст колекції",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/zh_Hans.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "添加到销售渠道",
     "auto-update-option-variant-name": "此选项自动更新不同商品变体名称",
     "auto-update-product-variant-name": "自动更新不同商品变体名称",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "渠道价格预览",
     "collection": "",
     "collection-contents": "系列产品",

+ 1 - 0
packages/admin-ui/src/lib/static/i18n-messages/zh_Hant.json

@@ -72,6 +72,7 @@
     "assign-variants-to-channel": "",
     "auto-update-option-variant-name": "",
     "auto-update-product-variant-name": "",
+    "cannot-create-variants-without-options": "",
     "channel-price-preview": "渠道價格覽",
     "collection": "",
     "collection-contents": "系列產品",