Skip to content

Commit

Permalink
feat(admin-ui): Add enabled/disabled toggle to ProductVariants
Browse files Browse the repository at this point in the history
Relates to #62
  • Loading branch information
michaelbromley committed Apr 24, 2019
1 parent a117bbe commit 406ab28
Show file tree
Hide file tree
Showing 9 changed files with 1,326 additions and 1,309 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { VariantAssetChange } from '../product-variants-list/product-variants-li

export type TabName = 'details' | 'variants';
export interface VariantFormValue {
enabled: boolean;
sku: string;
name: string;
price: number;
Expand Down Expand Up @@ -359,6 +360,7 @@ export class ProductDetailComponent extends BaseDetailComponent<ProductWithVaria
const variantTranslation = variant.translations.find(t => t.languageCode === languageCode);
const facetValueIds = variant.facetValues.map(fv => fv.id);
const group: VariantFormValue = {
enabled: variant.enabled,
sku: variant.sku,
name: variantTranslation ? variantTranslation.name : '',
price: variant.price,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<td class="left align-middle">
{{ groupByProduct ? result.productName : result.productVariantName }}
</td>
<td>
<td class="align-middle">
<vdr-chip *ngIf="!result.enabled">{{ 'common.disabled' | translate }}</vdr-chip>
</td>
<td class="right align-middle">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@
</div>
</div>
<div class="flex-spacer"></div>
<div>
<clr-toggle-wrapper>
<input
type="checkbox"
clrToggle
name="enabled"
[formControl]="formArray.get([i, 'enabled'])"
/>
<label>{{ 'common.enabled' | translate }}</label>
</clr-toggle-wrapper>
</div>
</div>
<div class="card-block">
<div class="row">
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/app/data/definitions/product-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const ASSET_FRAGMENT = gql`
export const PRODUCT_VARIANT_FRAGMENT = gql`
fragment ProductVariant on ProductVariant {
id
enabled
languageCode
name
price
Expand Down
1 change: 1 addition & 0 deletions admin-ui/src/app/data/providers/product-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export class ProductDataService {
input: variants.map(
pick([
'id',
'enabled',
'translations',
'sku',
'price',
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/generated-shop-types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// tslint:disable
// Generated in 2019-04-24T17:04:25+02:00
// Generated in 2019-04-24T20:30:12+02:00
export type Maybe<T> = T | null;

export interface OrderListOptions {
Expand Down
Loading

0 comments on commit 406ab28

Please sign in to comment.