-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin-ui): Implement integrated ProductVariant creation
Relates to #124
- Loading branch information
1 parent
5f6bef3
commit 58dad1d
Showing
29 changed files
with
558 additions
and
673 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 0 additions & 21 deletions
21
...p/catalog/components/create-option-group-dialog/create-option-group-dialog.component.html
This file was deleted.
Oops, something went wrong.
Empty file.
27 changes: 0 additions & 27 deletions
27
...app/catalog/components/create-option-group-dialog/create-option-group-dialog.component.ts
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...c/app/catalog/components/create-option-group-form/create-option-group-form.component.html
This file was deleted.
Oops, something went wrong.
Empty file.
28 changes: 0 additions & 28 deletions
28
...pp/catalog/components/create-option-group-form/create-option-group-form.component.spec.ts
This file was deleted.
Oops, something went wrong.
82 changes: 0 additions & 82 deletions
82
...src/app/catalog/components/create-option-group-form/create-option-group-form.component.ts
This file was deleted.
Oops, something went wrong.
112 changes: 97 additions & 15 deletions
112
...app/catalog/components/generate-product-variants/generate-product-variants.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,99 @@ | ||
<vdr-dropdown> | ||
<button type="button" class="btn btn-primary" vdrDropdownTrigger> | ||
<clr-icon shape="add"></clr-icon> | ||
{{ 'catalog.generate-product-variants' | translate }} | ||
<clr-icon shape="caret down"></clr-icon> | ||
</button> | ||
<vdr-dropdown-menu vdrPosition="bottom-right"> | ||
<button type="button" vdrDropdownItem (click)="generateProductVariants()"> | ||
{{ 'catalog.generate-variants-default-only' | translate }} | ||
<div *ngFor="let group of optionGroups" class="option-groups"> | ||
<div class="name"> | ||
<label>{{ 'catalog.option' | translate }}</label> | ||
<input | ||
placeholder="e.g. Size" | ||
clrInput | ||
[(ngModel)]="group.name" | ||
name="name" | ||
required | ||
(keydown.enter)="handleEnter($event, optionValueInputComponent)" | ||
/> | ||
</div> | ||
<div class="values"> | ||
<label>{{ 'catalog.option-values' | translate }}</label> | ||
<vdr-option-value-input | ||
#optionValueInputComponent | ||
[(ngModel)]="group.values" | ||
(ngModelChange)="generateVariants()" | ||
[groupName]="group.name" | ||
[disabled]="group.name === ''" | ||
></vdr-option-value-input> | ||
</div> | ||
<div class="remove-group"> | ||
<button | ||
class="btn btn-icon btn-warning-outline" | ||
[title]="'catalog.remove-option' | translate" | ||
(click)="removeOption(group.name)" | ||
> | ||
<clr-icon shape="trash"></clr-icon> | ||
</button> | ||
<button type="button" vdrDropdownItem (click)="startProductVariantsWizard()"> | ||
{{ 'catalog.generate-variants-with-options' | translate }} | ||
</button> | ||
</vdr-dropdown-menu> | ||
</vdr-dropdown> | ||
</div> | ||
</div> | ||
<button class="btn btn-primary-outline btn-sm" (click)="addOption()"> | ||
<clr-icon shape="plus"></clr-icon> | ||
{{ 'catalog.add-option' | translate }} | ||
</button> | ||
|
||
<vdr-product-variants-wizard #productVariantsWizard [product]="product"></vdr-product-variants-wizard> | ||
<div class="variants-preview"> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th *ngIf="1 < variants.length">{{ 'common.create' | translate }}</th> | ||
<th *ngIf="1 < variants.length">{{ 'catalog.variant' | translate }}</th> | ||
<th>{{ 'catalog.sku' | translate }}</th> | ||
<th>{{ 'catalog.price' | translate }}</th> | ||
<th>{{ 'catalog.stock-on-hand' | translate }}</th> | ||
</tr> | ||
</thead> | ||
<tr | ||
*ngFor="let variant of variants; trackBy: trackByFn" | ||
[class.disabled]="!variantFormValues[variant.id].enabled" | ||
> | ||
<td *ngIf="1 < variants.length"> | ||
<input | ||
type="checkbox" | ||
(change)="onFormChange()" | ||
[(ngModel)]="variantFormValues[variant.id].enabled" | ||
clrCheckbox | ||
/> | ||
</td> | ||
<td *ngIf="1 < variants.length"> | ||
{{ variant.values.join(' ') }} | ||
</td> | ||
<td> | ||
<clr-input-container> | ||
<input | ||
clrInput | ||
type="text" | ||
(change)="onFormChange()" | ||
[(ngModel)]="variantFormValues[variant.id].sku" | ||
[placeholder]="'catalog.sku' | translate" | ||
/> | ||
</clr-input-container> | ||
</td> | ||
<td> | ||
<clr-input-container> | ||
<vdr-currency-input | ||
clrInput | ||
[(ngModel)]="variantFormValues[variant.id].price" | ||
(ngModelChange)="onFormChange()" | ||
[currencyCode]="currencyCode" | ||
></vdr-currency-input> | ||
</clr-input-container> | ||
</td> | ||
<td> | ||
<clr-input-container> | ||
<input | ||
clrInput | ||
type="number" | ||
[(ngModel)]="variantFormValues[variant.id].stock" | ||
(change)="onFormChange()" | ||
min="0" | ||
step="1" | ||
/> | ||
</clr-input-container> | ||
</td> | ||
</tr> | ||
</table> | ||
</div> |
29 changes: 29 additions & 0 deletions
29
...app/catalog/components/generate-product-variants/generate-product-variants.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,32 @@ | ||
@import "variables"; | ||
|
||
:host { | ||
display: block; | ||
margin-bottom: 120px; | ||
} | ||
|
||
.option-groups { | ||
display: flex; | ||
} | ||
|
||
::ng-deep ng-dropdown-panel { | ||
display: none; | ||
} | ||
|
||
.values { | ||
flex: 1; | ||
margin: 0 6px; | ||
} | ||
|
||
.remove-group { | ||
padding-top: 18px; | ||
} | ||
|
||
.variants-preview { | ||
tr.disabled { | ||
td { | ||
background-color: $color-grey-100; | ||
color: $color-grey-400; | ||
} | ||
} | ||
} |
Oops, something went wrong.