remove type from
This commit is contained in:
parent
8a620eeb52
commit
7539b2a0f7
@ -1,10 +1,10 @@
|
||||
<div class="header-wrapper">
|
||||
<div class="heading">
|
||||
<div>{{ dossier.type?.label }}</div>
|
||||
<div>{{ dossierDictionary?.label }}</div>
|
||||
<div class="small-label stats-subtitle">
|
||||
<div>
|
||||
<mat-icon svgIcon="red:entries"></mat-icon>
|
||||
{{ 'edit-dossier-dialog.dictionary.entries' | translate: { length: (dossier.type?.entries || []).length } }}
|
||||
{{ 'edit-dossier-dialog.dictionary.entries' | translate: { length: (dossierDictionary?.entries || []).length } }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -19,13 +19,13 @@
|
||||
[placeholder]="'edit-dossier-dialog.dictionary.display-name.placeholder' | translate"
|
||||
[saveTooltip]="'edit-dossier-dialog.dictionary.display-name.save' | translate"
|
||||
[showPreview]="false"
|
||||
[value]="dossier.type?.label"
|
||||
[value]="dossierDictionary?.label"
|
||||
></iqser-editable-input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<redaction-dictionary-manager
|
||||
[canEdit]="canEdit"
|
||||
[initialEntries]="dossier.type?.entries || []"
|
||||
[initialEntries]="dossierDictionary?.entries || []"
|
||||
[withFloatingActions]="false"
|
||||
></redaction-dictionary-manager>
|
||||
|
||||
@ -18,6 +18,7 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
||||
@Output() readonly updateDossier = new EventEmitter();
|
||||
canEdit = false;
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
dossierDictionary: IDictionary;
|
||||
|
||||
@ViewChild(DictionaryManagerComponent, { static: false }) private readonly _dictionaryManager: DictionaryManagerComponent;
|
||||
|
||||
@ -40,16 +41,16 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
||||
async ngOnInit() {
|
||||
this._loadingService.start();
|
||||
this.canEdit = this._permissionsService.isDossierMember(this.dossier);
|
||||
await this._dossiersService.updateDossierDictionary(this.dossier.dossierTemplateId, this.dossier.id);
|
||||
await this._updateDossierDictionary();
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
async updateDisplayName(label: string) {
|
||||
const dictionary: IDictionary = { ...this.dossier.type, label };
|
||||
const dictionary: IDictionary = { ...this.dossierDictionary, label };
|
||||
await this._dictionaryService
|
||||
.updateDictionary(dictionary, this.dossier.dossierTemplateId, 'dossier_redaction', this.dossier.id)
|
||||
.toPromise();
|
||||
await this._dossiersService.updateDossierDictionary(this.dossier.dossierTemplateId, this.dossier.id);
|
||||
await this._updateDossierDictionary();
|
||||
this.updateDossier.emit();
|
||||
}
|
||||
|
||||
@ -64,11 +65,16 @@ export class EditDossierDictionaryComponent implements EditDossierSectionInterfa
|
||||
false,
|
||||
)
|
||||
.toPromise();
|
||||
await this._dossiersService.updateDossierDictionary(this.dossier.dossierTemplateId, this.dossier.id);
|
||||
await this._updateDossierDictionary();
|
||||
this.updateDossier.emit();
|
||||
}
|
||||
|
||||
revert() {
|
||||
this._dictionaryManager.revert();
|
||||
}
|
||||
|
||||
private async _updateDossierDictionary() {
|
||||
const { dossierId, dossierTemplateId } = this.dossier;
|
||||
this.dossierDictionary = await this._dictionaryService.getFor(dossierTemplateId, 'dossier_redaction', dossierId).toPromise();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,9 @@
|
||||
|
||||
<div>
|
||||
<mat-icon svgIcon="red:reanalyse"></mat-icon>
|
||||
<span>{{ 'dossier-overview.dossier-details.stats.processing-documents' | translate: { count: stats.numberOfProcessingFiles } }}</span>
|
||||
<span>{{
|
||||
'dossier-overview.dossier-details.stats.processing-documents' | translate: { count: stats.numberOfProcessingFiles }
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@ -35,7 +37,7 @@
|
||||
<span>{{ dossierTemplate(dossier).name }} </span>
|
||||
</div>
|
||||
|
||||
<div (click)="openDossierDictionaryDialog.emit()" *ngIf="dossier.type" class="link-property">
|
||||
<div (click)="openDossierDictionaryDialog.emit()" class="link-property">
|
||||
<mat-icon svgIcon="red:dictionary"></mat-icon>
|
||||
<span>{{ 'dossier-overview.dossier-details.dictionary' | translate }} </span>
|
||||
</div>
|
||||
|
||||
@ -4,7 +4,6 @@ import { Dossier, IDossier, IDossierRequest } from '@red/domain';
|
||||
import { catchError, filter, map, switchMap, tap } from 'rxjs/operators';
|
||||
import { BehaviorSubject, combineLatest, Observable, of, throwError } from 'rxjs';
|
||||
import { ActivationEnd, Router } from '@angular/router';
|
||||
import { DictionaryService } from '@shared/services/dictionary.service';
|
||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
import { currentComponentRoute } from '@utils/functions';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
@ -30,7 +29,6 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
private readonly _router: Router,
|
||||
private readonly _toaster: Toaster,
|
||||
protected readonly _injector: Injector,
|
||||
private readonly _dictionaryService: DictionaryService,
|
||||
private readonly _dossierStatsService: DossierStatsService,
|
||||
) {
|
||||
super(_injector, Dossier, 'dossier');
|
||||
@ -54,8 +52,6 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
}
|
||||
|
||||
this._activeDossierId$.next(dossierId);
|
||||
const dossier = this.find(dossierId);
|
||||
this.updateDossierDictionary(dossier.dossierTemplateId, dossierId).then();
|
||||
});
|
||||
}
|
||||
|
||||
@ -67,17 +63,6 @@ export class DossiersService extends EntitiesService<Dossier, IDossier> {
|
||||
return this._activeDossierId$.value;
|
||||
}
|
||||
|
||||
async updateDossierDictionary(dossierTemplateId: string, dossierId: string) {
|
||||
// dossier exists, load its dictionary
|
||||
const dossier = this.find(dossierId);
|
||||
try {
|
||||
dossier.type = await this._dictionaryService.getFor(dossierTemplateId, 'dossier_redaction', dossierId).toPromise();
|
||||
} catch (e) {
|
||||
dossier.type = null;
|
||||
}
|
||||
this.replace(dossier);
|
||||
}
|
||||
|
||||
@Validate()
|
||||
createOrUpdate(@RequiredParam() dossier: IDossierRequest): Observable<Dossier | undefined> {
|
||||
const showToast = (error: HttpErrorResponse) => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Dictionary, Dossier, DossierTemplate, File, IColors, IDossier } from '@red/domain';
|
||||
import { Dictionary, Dossier, DossierTemplate, File, IColors } from '@red/domain';
|
||||
import { ActivationEnd, Router } from '@angular/router';
|
||||
import { UserService } from '@services/user.service';
|
||||
import { forkJoin, Observable, of } from 'rxjs';
|
||||
@ -123,12 +123,9 @@ export class AppStateService {
|
||||
const dossierIds = dossiers.map(dossier => dossier.dossierId);
|
||||
await this._dossierStatsService.getFor(dossierIds).toPromise();
|
||||
|
||||
const mappedDossiers$ = dossiers.map(async p => {
|
||||
const oldDossier = this._dossiersService.find(p.dossierId);
|
||||
const type = oldDossier?.type ?? (await this._getDictionaryFor(p));
|
||||
this._dossiersService.replace(new Dossier(p, type));
|
||||
dossiers.forEach(dossier => {
|
||||
this._dossiersService.replace(new Dossier(dossier));
|
||||
});
|
||||
return Promise.all(mappedDossiers$);
|
||||
}
|
||||
|
||||
async reloadFile(dossierId: string, fileId: string) {
|
||||
@ -261,10 +258,6 @@ export class AppStateService {
|
||||
);
|
||||
}
|
||||
|
||||
private _getDictionaryFor(dossier: IDossier) {
|
||||
return this._dictionaryService.getFor(dossier.dossierTemplateId, 'dossier_redaction', dossier.dossierId).toPromise();
|
||||
}
|
||||
|
||||
private _getDictionaryDataForDossierTemplate$(dossierTemplateId: string): Observable<{ [key: string]: any }> {
|
||||
const dictionaryData: { [key: string]: any } = {};
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 1b75b12fbd97fecffa9736a66d0d408bd2dbc62f
|
||||
Subproject commit 74fcbf080b593622220bb2c7de08f69163acab04
|
||||
@ -2,7 +2,6 @@ import { IListable, List } from '@iqser/common-ui';
|
||||
import { IDossier } from './dossier';
|
||||
import { DossierStatus } from './types';
|
||||
import { DownloadFileType } from '../shared';
|
||||
import { IDictionary } from '../dictionaries';
|
||||
|
||||
export class Dossier implements IDossier, IListable {
|
||||
readonly dossierId: string;
|
||||
@ -24,7 +23,7 @@ export class Dossier implements IDossier, IListable {
|
||||
readonly watermarkPreviewEnabled: boolean;
|
||||
readonly hasReviewers: boolean;
|
||||
|
||||
constructor(dossier: IDossier, public type?: IDictionary) {
|
||||
constructor(dossier: IDossier) {
|
||||
this.dossierId = dossier.dossierId;
|
||||
this.approverIds = dossier.approverIds;
|
||||
this.date = dossier.date;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user