|
|
@@ -19,22 +19,20 @@
|
|
|
<label>{{ 'catalog.option-values' | translate }}</label>
|
|
|
<vdr-option-value-input
|
|
|
#optionValueInputComponent
|
|
|
- [(ngModel)]="group.values"
|
|
|
- (ngModelChange)="generateVariants()"
|
|
|
+ [options]="group.values"
|
|
|
[groupName]="group.name"
|
|
|
[disabled]="group.name === ''"
|
|
|
+ (add)="addOption(group.id, $event.name)"
|
|
|
+ (remove)="removeOption(group.id, $event.id)"
|
|
|
></vdr-option-value-input>
|
|
|
</div>
|
|
|
<div>
|
|
|
- <button *ngIf="group.isNew" class="btn btn-icon btn-danger-outline mt5" (click)="removeOption(group)">
|
|
|
+ <button *ngIf="group.isNew" class="btn btn-icon btn-danger-outline mt5" (click)="removeOptionGroup(group)">
|
|
|
<clr-icon shape="trash"></clr-icon>
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
-<button
|
|
|
- class="btn btn-primary-outline btn-sm"
|
|
|
- (click)="addOption()"
|
|
|
->
|
|
|
+<button class="btn btn-primary-outline btn-sm" (click)="addOptionGroup()">
|
|
|
<clr-icon shape="plus"></clr-icon>
|
|
|
{{ 'catalog.add-option' | translate }}
|
|
|
</button>
|
|
|
@@ -43,7 +41,7 @@
|
|
|
<table class="table">
|
|
|
<thead>
|
|
|
<tr>
|
|
|
- <th>{{ 'common.create' | translate }}</th>
|
|
|
+ <th></th>
|
|
|
<th>{{ 'catalog.variant' | translate }}</th>
|
|
|
<th>{{ 'catalog.sku' | translate }}</th>
|
|
|
<th>{{ 'catalog.price' | translate }}</th>
|
|
|
@@ -52,58 +50,66 @@
|
|
|
</tr>
|
|
|
</thead>
|
|
|
<tr *ngFor="let variant of generatedVariants" [class.disabled]="!variant.enabled || variant.existing">
|
|
|
- <td>
|
|
|
- <input
|
|
|
- type="checkbox"
|
|
|
- *ngIf="!variant.existing"
|
|
|
- [(ngModel)]="variant.enabled"
|
|
|
- name="enabled"
|
|
|
- clrCheckbox
|
|
|
- (ngModelChange)="formValueChanged = true"
|
|
|
- />
|
|
|
+ <td class="left">
|
|
|
+ <clr-checkbox-wrapper *ngIf="!variant.existing">
|
|
|
+ <input
|
|
|
+ type="checkbox"
|
|
|
+ [(ngModel)]="variant.enabled"
|
|
|
+ name="enabled"
|
|
|
+ clrCheckbox
|
|
|
+ (ngModelChange)="formValueChanged = true"
|
|
|
+ />
|
|
|
+ <label>{{ 'common.create' | translate }}</label>
|
|
|
+ </clr-checkbox-wrapper>
|
|
|
</td>
|
|
|
<td>
|
|
|
{{ getVariantName(variant) | translate }}
|
|
|
</td>
|
|
|
<td>
|
|
|
- <clr-input-container *ngIf="!variant.existing">
|
|
|
- <input
|
|
|
- clrInput
|
|
|
- type="text"
|
|
|
- [(ngModel)]="variant.sku"
|
|
|
- [placeholder]="'catalog.sku' | translate"
|
|
|
- name="sku"
|
|
|
- required
|
|
|
- (ngModelChange)="onFormChanged(variant)"
|
|
|
- />
|
|
|
- </clr-input-container>
|
|
|
- <span *ngIf="variant.existing">{{ variant.sku }}</span>
|
|
|
+ <div class="flex center">
|
|
|
+ <clr-input-container *ngIf="!variant.existing">
|
|
|
+ <input
|
|
|
+ clrInput
|
|
|
+ type="text"
|
|
|
+ [(ngModel)]="variant.sku"
|
|
|
+ [placeholder]="'catalog.sku' | translate"
|
|
|
+ name="sku"
|
|
|
+ required
|
|
|
+ (ngModelChange)="onFormChanged(variant)"
|
|
|
+ />
|
|
|
+ </clr-input-container>
|
|
|
+ <span *ngIf="variant.existing">{{ variant.sku }}</span>
|
|
|
+ </div>
|
|
|
</td>
|
|
|
<td>
|
|
|
- <clr-input-container *ngIf="!variant.existing">
|
|
|
- <vdr-currency-input
|
|
|
- clrInput
|
|
|
- [(ngModel)]="variant.price"
|
|
|
- name="price"
|
|
|
- [currencyCode]="currencyCode"
|
|
|
- (ngModelChange)="onFormChanged(variant)"
|
|
|
- ></vdr-currency-input>
|
|
|
- </clr-input-container>
|
|
|
- <span *ngIf="variant.existing">{{ variant.price | localeCurrency: currencyCode }}</span>
|
|
|
+ <div class="flex center">
|
|
|
+ <clr-input-container *ngIf="!variant.existing">
|
|
|
+ <vdr-currency-input
|
|
|
+ clrInput
|
|
|
+ [(ngModel)]="variant.price"
|
|
|
+ name="price"
|
|
|
+ [currencyCode]="currencyCode"
|
|
|
+ (ngModelChange)="onFormChanged(variant)"
|
|
|
+ ></vdr-currency-input>
|
|
|
+ </clr-input-container>
|
|
|
+ <span *ngIf="variant.existing">{{ variant.price | localeCurrency: currencyCode }}</span>
|
|
|
+ </div>
|
|
|
</td>
|
|
|
<td>
|
|
|
- <clr-input-container *ngIf="!variant.existing">
|
|
|
- <input
|
|
|
- clrInput
|
|
|
- type="number"
|
|
|
- [(ngModel)]="variant.stock"
|
|
|
- name="stock"
|
|
|
- min="0"
|
|
|
- step="1"
|
|
|
- (ngModelChange)="onFormChanged(variant)"
|
|
|
- />
|
|
|
- </clr-input-container>
|
|
|
- <span *ngIf="variant.existing">{{ variant.stock }}</span>
|
|
|
+ <div class="flex center">
|
|
|
+ <clr-input-container *ngIf="!variant.existing">
|
|
|
+ <input
|
|
|
+ clrInput
|
|
|
+ type="number"
|
|
|
+ [(ngModel)]="variant.stock"
|
|
|
+ name="stock"
|
|
|
+ min="0"
|
|
|
+ step="1"
|
|
|
+ (ngModelChange)="onFormChanged(variant)"
|
|
|
+ />
|
|
|
+ </clr-input-container>
|
|
|
+ <span *ngIf="variant.existing">{{ variant.stock }}</span>
|
|
|
+ </div>
|
|
|
</td>
|
|
|
<td>
|
|
|
<vdr-dropdown *ngIf="variant.productVariantId as productVariantId">
|