-
-
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): Table view for product variants
- Loading branch information
1 parent
8ecd2c3
commit 058749a
Showing
15 changed files
with
174 additions
and
39 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
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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
...i/src/app/catalog/components/product-variants-table/product-variants-table.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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<vdr-data-table [items]="variants"> | ||
<vdr-dt-column></vdr-dt-column> | ||
<vdr-dt-column>{{ 'common.name' | translate }}</vdr-dt-column> | ||
<vdr-dt-column>{{ 'catalog.sku' | translate }}</vdr-dt-column> | ||
<ng-container *ngFor="let optionGroup of optionGroups"> | ||
<vdr-dt-column>{{ optionGroup.name }}</vdr-dt-column> | ||
</ng-container> | ||
<vdr-dt-column>{{ 'catalog.price' | translate }}</vdr-dt-column> | ||
<vdr-dt-column>{{ 'catalog.stock-on-hand' | translate }}</vdr-dt-column> | ||
<ng-template let-variant="item" let-i="index"> | ||
<ng-container [formGroup]="formArray.at(i)"> | ||
<td class="left align-middle"> | ||
<div class="card-img"> | ||
<div class="featured-asset"> | ||
<img | ||
*ngIf="variant.featuredAsset" | ||
[src]="variant.featuredAsset!.preview + '?preset=tiny'" | ||
/> | ||
<div class="placeholder" *ngIf="!variant.featuredAsset"> | ||
<clr-icon shape="image" size="48"></clr-icon> | ||
</div> | ||
</div> | ||
</div> | ||
</td> | ||
<td class="left align-middle"> | ||
<clr-input-container> | ||
<input | ||
clrInput | ||
type="text" | ||
formControlName="name" | ||
[placeholder]="'common.name' | translate" | ||
/> | ||
</clr-input-container> | ||
</td> | ||
<td class="left align-middle"> | ||
<clr-input-container> | ||
<input | ||
clrInput | ||
type="text" | ||
formControlName="sku" | ||
[placeholder]="'catalog.sku' | translate" | ||
/> | ||
</clr-input-container> | ||
</td> | ||
<ng-container *ngFor="let option of variant.options"> | ||
<td class="left align-middle">{{ option.name }}</td> | ||
</ng-container> | ||
<td class="left align-middle price"> | ||
<clr-input-container> | ||
<vdr-currency-input | ||
clrInput | ||
[currencyCode]="variant.currencyCode" | ||
formControlName="price" | ||
></vdr-currency-input> | ||
</clr-input-container> | ||
</td> | ||
<td class="left align-middle stock"> | ||
<clr-input-container> | ||
<input clrInput type="number" min="0" step="1" formControlName="stockOnHand" /> | ||
</clr-input-container> | ||
</td> | ||
</ng-container> | ||
</ng-template> | ||
</vdr-data-table> |
15 changes: 15 additions & 0 deletions
15
...i/src/app/catalog/components/product-variants-table/product-variants-table.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@import "variables"; | ||
|
||
.placeholder { | ||
color: $color-grey-3; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
} | ||
|
||
.stock, .price { | ||
input { | ||
max-width: 96px; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...-ui/src/app/catalog/components/product-variants-table/product-variants-table.component.ts
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; | ||
import { FormArray } from '@angular/forms'; | ||
import { ProductWithVariants } from 'shared/generated-types'; | ||
|
||
@Component({ | ||
selector: 'vdr-product-variants-table', | ||
templateUrl: './product-variants-table.component.html', | ||
styleUrls: ['./product-variants-table.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class ProductVariantsTableComponent { | ||
@Input('productVariantsFormArray') formArray: FormArray; | ||
@Input() variants: ProductWithVariants.Variants[]; | ||
@Input() optionGroups: ProductWithVariants.OptionGroups[]; | ||
} |
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
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
5 changes: 5 additions & 0 deletions
5
admin-ui/src/app/shared/components/currency-input/currency-input.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,8 @@ | ||
:host { | ||
padding: 0; | ||
} | ||
|
||
input { | ||
width: 100%; | ||
max-width: 96px; | ||
} |
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
6 changes: 6 additions & 0 deletions
6
admin-ui/src/app/shared/components/data-table/data-table.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
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