RED-3800 - default sort for justifications

This commit is contained in:
Timo Bejan 2022-10-24 10:43:18 +03:00
parent 97ac6da843
commit 15f02b3db0

View File

@ -7,6 +7,7 @@ import {
ListingComponent,
listingProvidersFactory,
LoadingService,
SortingOrders,
TableColumnConfig,
} from '@iqser/common-ui';
import { DOSSIER_TEMPLATE_ID, Justification } from '@red/domain';
@ -31,8 +32,8 @@ export class JustificationsScreenComponent extends ListingComponent<Justificatio
readonly circleButtonTypes = CircleButtonTypes;
readonly tableHeaderLabel = _('justifications-listing.table-header');
readonly tableColumnConfigs: TableColumnConfig<Justification>[] = [
{ label: _('justifications-listing.table-col-names.name'), width: '2fr' },
{ label: _('justifications-listing.table-col-names.reason') },
{ label: _('justifications-listing.table-col-names.name'), width: '2fr', sortByKey: 'name' },
{ label: _('justifications-listing.table-col-names.reason'), sortByKey: 'reason' },
{ label: _('justifications-listing.table-col-names.description'), width: '2fr' },
];
readonly #currentUser = getCurrentUser();
@ -54,6 +55,10 @@ export class JustificationsScreenComponent extends ListingComponent<Justificatio
async ngOnInit(): Promise<void> {
this._loadingService.start();
await firstValueFrom(this._justificationService.loadAll(this.#dossierTemplateId));
this.sortingService.setSortingOption({
column: 'name',
order: SortingOrders.asc,
});
this._loadingService.stop();
}