Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x 1x 1x 1x 4x 4x 4x 4x 4x 4x 4x 4x | import { ChangeDetectionStrategy, Component, DestroyRef, OnInit, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Observable } from 'rxjs';
import { AccountFacade } from 'ish-core/facades/account.facade';
import { HttpError } from 'ish-core/models/http-error/http-error.model';
import { RecurringOrder } from 'ish-core/models/recurring-order/recurring-order.model';
import { RecurringOrderColumnsType } from './recurring-order-list/recurring-order-list.component';
@Component({
selector: 'ish-account-recurring-orders-page',
templateUrl: './account-recurring-orders-page.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AccountRecurringOrdersPageComponent implements OnInit {
recurringOrders$: Observable<RecurringOrder[]>;
recurringOrdersLoading$: Observable<boolean>;
recurringOrdersError$: Observable<HttpError>;
columnsToDisplay: RecurringOrderColumnsType[];
context: string;
private destroyRef = inject(DestroyRef);
constructor(private accountFacade: AccountFacade) {}
ngOnInit() {
this.recurringOrders$ = this.accountFacade.recurringOrders$();
this.recurringOrdersLoading$ = this.accountFacade.recurringOrdersLoading$;
this.recurringOrdersError$ = this.accountFacade.recurringOrdersError$;
this.accountFacade.recurringOrdersContext$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(context => {
this.context = context || 'MY';
context === 'ADMIN'
? (this.columnsToDisplay = [
'recurringOrderNo',
'frequency',
'lastOrderDate',
'nextOrderDate',
'buyer',
'orderTotal',
'actions',
])
: (this.columnsToDisplay = [
'recurringOrderNo',
'creationDate',
'frequency',
'lastOrderDate',
'nextOrderDate',
'orderTotal',
'actions',
]);
});
}
}
|