Skip to content

Commit

Permalink
feat(admin-ui): Display warnings if Channel lacks default zones
Browse files Browse the repository at this point in the history
Relates to #323
  • Loading branch information
michaelbromley committed Apr 22, 2020
1 parent 4c5f6a7 commit e80fcf8
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
formControlName="defaultLanguageCode"
[vdrDisabled]="!('SuperAdmin' | hasPermission)"
>
<option *ngFor="let languageCode of availableLanguageCodes$ | async" [value]="languageCode">{{ 'lang.' + languageCode | translate }} ({{ languageCode | uppercase }})</option>
<option *ngFor="let languageCode of availableLanguageCodes$ | async" [value]="languageCode"
>{{ 'lang.' + languageCode | translate }} ({{ languageCode | uppercase }})</option
>
</select>
</vdr-form-field>
<vdr-form-field [label]="'settings.prices-include-tax' | translate" for="pricesIncludeTax">
Expand All @@ -74,6 +76,14 @@
<option *ngFor="let zone of zones$ | async" [value]="zone.id">{{ zone.name }}</option>
</select>
</vdr-form-field>
<clr-alert *ngIf="detailForm.value.code && !detailForm.value.defaultTaxZoneId" clrAlertType="danger" [clrAlertClosable]="false">
<clr-alert-item>
<span class="alert-text">
{{ 'error.no-default-tax-zone-set' | translate }}
</span>
</clr-alert-item>
</clr-alert>

<vdr-form-field [label]="'settings.default-shipping-zone' | translate" for="defaultShippingZoneId">
<select
clrSelect
Expand All @@ -84,4 +94,11 @@
<option *ngFor="let zone of zones$ | async" [value]="zone.id">{{ zone.name }}</option>
</select>
</vdr-form-field>
<clr-alert *ngIf="detailForm.value.code && !detailForm.value.defaultShippingZoneId" clrAlertType="warning" [clrAlertClosable]="false">
<clr-alert-item>
<span class="alert-text">
{{ 'error.no-default-shipping-zone-set' | translate }}
</span>
</clr-alert-item>
</clr-alert>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
clr-alert {
max-width: 30rem;
margin-bottom: 12px;
}
2 changes: 2 additions & 0 deletions packages/admin-ui/src/lib/static/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@
"403-forbidden": "You are not currently authorized to access \"{ path }\". Either you lack permissions, or your session has expired.",
"could-not-connect-to-server": "Could not connect to the Vendure server at { url }",
"facet-value-form-values-do-not-match": "The number of values in the facet form does not match the actual number of values",
"no-default-shipping-zone-set": "This channel has no default shipping zone. This may cause errors when calculating order shipping charges.",
"no-default-tax-zone-set": "This channel has no default tax zone, which will cause errors when calculating prices. Please create or select a zone.",
"product-variant-form-values-do-not-match": "The number of variants in the product form does not match the actual number of variants"
},
"lang": {
Expand Down

0 comments on commit e80fcf8

Please sign in to comment.