RED-2114: sort & disable old files in trash

This commit is contained in:
Adina Țeudan 2021-09-16 00:49:15 +03:00
parent d8c4e04aa2
commit c975fc859f
2 changed files with 23 additions and 4 deletions

View File

@ -4,6 +4,7 @@
[itemSize]="50"
[noDataText]="'edit-dossier-dialog.deleted-documents.no-data.title' | translate"
[selectionEnabled]="true"
[tableItemClasses]="{ disabled: disabledFn }"
noDataIcon="red:document"
></iqser-table>
@ -40,8 +41,8 @@
</ng-template>
<ng-template #pagesTemplate let-file="entity">
<div class="cell small-label stats-subtitle">
<div>
<div class="cell stats-subtitle">
<div class="small-label">
<mat-icon svgIcon="red:pages"></mat-icon>
{{ file.numberOfPages }}
</div>
@ -49,7 +50,9 @@
</ng-template>
<ng-template #deletedDateTemplate let-file="entity">
<div class="cell small-label">{{ file.softDeleted | date: 'exactDate' }}</div>
<div class="cell">
<span class="small-label">{{ file.softDeleted | date: 'exactDate' }}</span>
</div>
</ng-template>
<ng-template #restoreDateTemplate let-file="entity">

View File

@ -1,7 +1,15 @@
import { Component, EventEmitter, forwardRef, Injector, Input, OnInit, Output, TemplateRef, ViewChild } from '@angular/core';
import { EditDossierSectionInterface } from '../edit-dossier-section.interface';
import { DossierWrapper } from '@state/model/dossier.wrapper';
import { CircleButtonTypes, DefaultListingServices, Listable, ListingComponent, LoadingService, TableColumnConfig } from '@iqser/common-ui';
import {
CircleButtonTypes,
DefaultListingServices,
Listable,
ListingComponent,
LoadingService,
SortingOrders,
TableColumnConfig
} from '@iqser/common-ui';
import { FileManagementControllerService, FileStatus, StatusControllerService } from '@redaction/red-ui-http';
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
import * as moment from 'moment';
@ -85,6 +93,10 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
this._loadingService.start();
const files = await this._statusController.getDeletedFileStatus(this.dossierWrapper.dossierId).toPromise();
this.entitiesService.setEntities(this._toListItems(files));
this.sortingService.setSortingOption({
column: 'softDeleted',
order: SortingOrders.desc
});
this._loadingService.stop();
}
@ -96,6 +108,8 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
this._loadingService.loadWhile(this._restore(files));
}
disabledFn = (file: FileListItem) => !file.canRestore;
private _configureTableColumns() {
this.tableColumnConfigs = [
{
@ -110,11 +124,13 @@ export class EditDossierDeletedDocumentsComponent extends ListingComponent<FileL
{
label: _('edit-dossier-dialog.deleted-documents.table-col-names.deleted-on'),
template: this.deletedDateTemplate,
sortByKey: 'softDeleted',
width: '2fr'
},
{
label: _('edit-dossier-dialog.deleted-documents.table-col-names.time-to-restore'),
template: this.restoreDateTemplate,
sortByKey: 'softDeleted',
width: '2fr'
}
];