Refactor dossiers dialog service: dossier dictionary

This commit is contained in:
Adina Țeudan 2021-08-10 15:18:07 +03:00
parent dc810ae491
commit df54ab3fc2
2 changed files with 17 additions and 33 deletions

View File

@ -44,12 +44,9 @@ export class DossierOverviewScreenComponent
implements OnInit, OnDestroy, OnDetach, OnAttach
{
readonly itemSize = 80;
protected readonly _primaryKey = 'filename';
readonly circleButtonTypes = CircleButtonTypes;
readonly currentUser = this._userService.currentUser;
readonly tableHeaderLabel = _('dossier-overview.table-header.title');
private readonly _lastOpenedFileKey = 'Dossier-Recent-' + this.activeDossier.dossierId;
readonly actionConfigs: ActionConfig[] = [
{
label: this._translateService.instant('dossier-overview.header-actions.edit'),
@ -90,9 +87,10 @@ export class DossierOverviewScreenComponent
column: 'statusSort'
}
];
collapsedDetails = false;
dossierAttributes: DossierAttributeWithValue[] = [];
protected readonly _primaryKey = 'filename';
private readonly _lastOpenedFileKey = 'Dossier-Recent-' + this.activeDossier.dossierId;
@ViewChild(DossierDetailsComponent, { static: false })
private readonly _dossierDetailsComponent: DossierDetailsComponent;
private _lastScrollPosition: number;
@ -260,7 +258,7 @@ export class DossierOverviewScreenComponent
}
openDossierDictionaryDialog() {
this._dialogService.openDossierDictionaryDialog(null, this.activeDossier, () => {
this._dialogService.openDialog('dossierDictionary', null, this.activeDossier, () => {
this.reloadDossiers();
});
}

View File

@ -5,7 +5,6 @@ import { RemoveAnnotationsDialogComponent } from '../dialogs/remove-annotations-
import { ForceRedactionDialogComponent } from '../dialogs/force-redaction-dialog/force-redaction-dialog.component';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { ConfirmationDialogComponent } from '@shared/dialogs/confirmation-dialog/confirmation-dialog.component';
import { DossierWrapper } from '@state/model/dossier.wrapper';
import { DocumentInfoDialogComponent } from '../dialogs/document-info-dialog/document-info-dialog.component';
import { AppStateService } from '@state/app-state.service';
import { ManualRedactionEntryWrapper } from '@models/file/manual-redaction-entry.wrapper';
@ -28,7 +27,15 @@ const dialogConfig = {
// TODO: Continue refactor
type DialogType = 'confirm' | 'documentInfo' | 'editDossier' | 'addDossier' | 'assignFile' | 'recategorizeImage' | 'changeLegalBasis';
type DialogType =
| 'confirm'
| 'documentInfo'
| 'editDossier'
| 'addDossier'
| 'assignFile'
| 'recategorizeImage'
| 'changeLegalBasis'
| 'dossierDictionary';
type DossiersDialogConfig = {
[key in DialogType]: {
@ -53,11 +60,7 @@ export class DossiersDialogService extends DialogService<DialogType> {
},
addDossier: {
component: AddDossierDialogComponent,
dialogConfig: {
...dialogConfig,
width: '900px',
autoFocus: true
}
dialogConfig: { width: '900px', autoFocus: true }
},
assignFile: {
component: AssignReviewerApproverDialogComponent
@ -67,6 +70,10 @@ export class DossiersDialogService extends DialogService<DialogType> {
},
changeLegalBasis: {
component: ChangeLegalBasisDialogComponent
},
dossierDictionary: {
component: DossierDictionaryDialogComponent,
dialogConfig: { width: '90vw', height: '90vh' }
}
};
@ -126,25 +133,4 @@ export class DossiersDialogService extends DialogService<DialogType> {
});
return ref;
}
openDossierDictionaryDialog(
$event: MouseEvent,
dossier: DossierWrapper,
cb?: Function
): MatDialogRef<DossierDictionaryDialogComponent> {
$event?.stopPropagation();
const ref = this._dialog.open(DossierDictionaryDialogComponent, {
...dialogConfig,
width: '90vw',
height: '90vh',
autoFocus: false,
data: dossier
});
ref.afterClosed().subscribe(result => {
if (cb) {
cb(result);
}
});
return ref;
}
}