Browse Source

fix(admin-ui): Add custom field support to Customer list

Michael Bromley 2 years ago
parent
commit
298e90c92b

+ 1 - 0
packages/admin-ui/src/lib/customer/src/components/customer-list/customer-list.component.html

@@ -72,4 +72,5 @@
             {{ customer.emailAddress }}
         </ng-template>
     </vdr-dt2-column>
+    <vdr-dt2-custom-field-column *ngFor="let field of customFields" [customField]="field" [sorts]="sorts" />
 </vdr-data-table-2>

+ 3 - 0
packages/admin-ui/src/lib/customer/src/components/customer-list/customer-list.component.ts

@@ -37,6 +37,7 @@ export class CustomerListComponent
     extends TypedBaseListComponent<typeof CustomerListQueryDocument, 'customers'>
     implements OnInit
 {
+    readonly customFields = this.getCustomFieldConfig('Customer');
     readonly filters = this.createFilterCollection()
         .addIdFilter()
         .addDateFilters()
@@ -58,6 +59,7 @@ export class CustomerListComponent
             label: _('customer.email-address'),
             filterField: 'emailAddress',
         })
+        .addCustomFieldFilters(this.customFields)
         .connectToRoute(this.route);
 
     readonly sorts = this.createSortCollection()
@@ -66,6 +68,7 @@ export class CustomerListComponent
         .addSort({ name: 'updatedAt' })
         .addSort({ name: 'lastName' })
         .addSort({ name: 'emailAddress' })
+        .addCustomFieldSorts(this.customFields)
         .connectToRoute(this.route);
 
     constructor() {