RED-3311: Put documents back into status "new"

This commit is contained in:
Adina Țeudan 2022-03-09 19:44:38 +02:00
parent 36424e9dad
commit 14bf225916
14 changed files with 176 additions and 66 deletions

View File

@ -60,12 +60,19 @@ export class DossierAttributesListingScreenComponent extends ListingComponent<Do
}
async openConfirmDeleteAttributeDialog($event: MouseEvent, attributes: DossierAttributeConfig[] = this.listingService.selected) {
await this._dialogService.deleteAttributes(attributes, this.#dossierTemplateId, this.impactedTemplatesRef, $event, async () => {
this._loadingService.start();
const ids = attributes.map(a => a.id);
await firstValueFrom(this._dossierAttributesService.delete(ids, this.#dossierTemplateId));
await this._loadData();
});
await this._dialogService.deleteAttributes(
attributes,
this.#dossierTemplateId,
this.impactedTemplatesRef,
'dossier',
$event,
async () => {
this._loadingService.start();
const ids = attributes.map(a => a.id);
await firstValueFrom(this._dossierAttributesService.delete(ids, this.#dossierTemplateId));
await this._loadData();
},
);
}
openAddEditAttributeDialog($event: MouseEvent, dossierAttribute?: IDossierAttributeConfig) {

View File

@ -108,13 +108,20 @@ export class FileAttributesListingScreenComponent extends ListingComponent<FileA
$event: MouseEvent,
attributes: FileAttributeConfig[] = this.listingService.selected,
): Promise<void> {
await this._dialogService.deleteAttributes(attributes, this.#dossierTemplateId, this.impactedTemplatesRef, $event, async () => {
this._loadingService.start();
const ids = attributes.map(a => a.id);
await firstValueFrom(this._fileAttributesService.deleteFileAttributes(ids, this.#dossierTemplateId));
await firstValueFrom(this._dossierTemplatesService.refreshDossierTemplate(this.#dossierTemplateId));
await this._loadData();
});
await this._dialogService.deleteAttributes(
attributes,
this.#dossierTemplateId,
this.impactedTemplatesRef,
'file',
$event,
async () => {
this._loadingService.start();
const ids = attributes.map(a => a.id);
await firstValueFrom(this._fileAttributesService.deleteFileAttributes(ids, this.#dossierTemplateId));
await firstValueFrom(this._dossierTemplatesService.refreshDossierTemplate(this.#dossierTemplateId));
await this._loadData();
},
);
}
importCSV(files: FileList | File[]) {

View File

@ -136,8 +136,9 @@ export class AdminDialogService extends DialogService<DialogType> {
attributes: IFileAttributeConfig[] | IDossierAttributeConfig[],
dossierTemplateId: string,
impactedTemplatesRef: TemplateRef<unknown>,
$event?: MouseEvent,
cb?: () => Promise<void> | void,
type: 'dossier' | 'file',
$event: MouseEvent,
cb: () => Promise<void> | void,
): Promise<void> {
this._loadingService.start();
const templates$ = attributes
@ -149,25 +150,34 @@ export class AdminDialogService extends DialogService<DialogType> {
this._loadingService.stop();
const data = new ConfirmationDialogInput({
title: _('confirm-delete-file-attribute.title'),
question: _('confirm-delete-file-attribute.warning'),
confirmationText: _('confirm-delete-file-attribute.delete'),
denyText: _('confirm-delete-file-attribute.cancel'),
title: _('confirm-delete-attribute.title'),
question: _('confirm-delete-attribute.warning'),
confirmationText: _('confirm-delete-attribute.delete'),
denyText: _('confirm-delete-attribute.cancel'),
titleColor: TitleColors.WARN,
checkboxes: [
{
value: false,
label: 'confirm-delete-file-attribute.file-impacted-documents',
label:
type === 'dossier'
? _('confirm-delete-attribute.dossier-impacted-documents')
: _('confirm-delete-attribute.file-impacted-documents'),
},
{
value: false,
label:
type === 'dossier'
? _('confirm-delete-attribute.dossier-lost-details')
: _('confirm-delete-attribute.file-lost-details'),
},
{ value: false, label: 'confirm-delete-file-attribute.file-lost-details' },
],
toastMessage: _('confirm-delete-file-attribute.toast-error'),
toastMessage: _('confirm-delete-attribute.toast-error'),
translateParams: { reportsCount: uniqueTemplates.length, count: attributes.length, name: attributes[0].label },
});
if (templates.length) {
data.checkboxes.push({
value: false,
label: _('confirm-delete-file-attribute.impacted-report'),
label: _('confirm-delete-attribute.impacted-report'),
extraContent: impactedTemplatesRef,
extraContentData: { templates: uniqueTemplates },
});

View File

@ -29,6 +29,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
#canDisableAutoAnalysis: boolean;
#canEnableAutoAnalysis: boolean;
#canOcr: boolean;
#canSetToNew: boolean;
#canSetToUnderReview: boolean;
#canSetToUnderApproval: boolean;
#isReadyForApproval: boolean;
@ -70,6 +71,13 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
icon: 'red:assign-me',
show: this.#canAssignToSelf,
},
{
type: ActionTypes.circleBtn,
action: () => this._bulkActionsService.setToNew(this.selectedFiles),
tooltip: _('dossier-overview.back-to-new'),
icon: 'red:undo',
show: this.#canSetToNew,
},
{
type: ActionTypes.circleBtn,
action: () => this._bulkActionsService.setToUnderApproval(this.selectedFiles),
@ -184,6 +192,8 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
this.#canOcr = this._permissionsService.canOcrFile(this.selectedFiles);
this.#canSetToNew = this._permissionsService.canSetToNew(this.selectedFiles) && !isWorkflow;
this.#canSetToUnderReview = this._permissionsService.canSetUnderReview(this.selectedFiles) && !isWorkflow;
this.#canSetToUnderApproval = this._permissionsService.canSetUnderApproval(this.selectedFiles) && !isWorkflow;

View File

@ -58,8 +58,8 @@ export class ConfigService {
{
label: workflowFileStatusTranslations[WorkflowFileStatuses.NEW],
key: WorkflowFileStatuses.NEW,
enterFn: noop,
enterPredicate: () => false,
enterFn: (files: File[]) => this._bulkActionsService.setToNew(files),
enterPredicate: (files: File[]) => this._permissionsService.canSetToNew(files),
color: '#D3D5DA',
entities: new BehaviorSubject([]),
},

View File

@ -86,6 +86,12 @@ export class BulkActionsService {
this._loadingService.stop();
}
async setToNew(files: File[]): Promise<void> {
this._loadingService.start();
await firstValueFrom(this._filesService.setToNewFor(files, files[0].dossierId));
this._loadingService.stop();
}
async approve(files: File[]): Promise<void> {
const foundAnalysisRequiredFile = files.find(file => file.analysisRequired);
const foundUpdatedFile = files.find(file => file.hasUpdates);

View File

@ -62,6 +62,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
assignTooltip?: string;
buttonType?: CircleButtonType;
showSetToNew = false;
showUndoApproval = false;
showAssignToSelf = false;
showImportRedactions = false;
@ -179,6 +180,13 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
icon: 'red:exclude-pages',
show: !!this._excludedPagesService && !this.file.excluded,
},
{
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setToNew($event),
tooltip: _('dossier-overview.back-to-new'),
icon: 'red:undo',
show: this.showSetToNew,
},
{
type: ActionTypes.circleBtn,
action: ($event: MouseEvent) => this._setFileUnderApproval($event),
@ -410,6 +418,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
this.buttonType = this.isFilePreview ? CircleButtonTypes.default : CircleButtonTypes.dark;
this.toggleTooltip = this._toggleTooltip;
this.showSetToNew = this._permissionsService.canSetToNew(this.file) && !this.isDossierOverviewWorkflow;
this.showUndoApproval = this._permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow;
this.showUnderReview = this._permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow;
this.showUnderApproval = this._permissionsService.canSetUnderApproval(this.file) && !this.isDossierOverviewWorkflow;
@ -447,4 +456,11 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
await firstValueFrom(this._filesService.setApprovedFor([this.file], this.file.dossierId));
this._loadingService.stop();
}
private async _setToNew($event: MouseEvent) {
$event.stopPropagation();
this._loadingService.start();
await firstValueFrom(this._filesService.setToNewFor([this.file], this.file.dossierId));
this._loadingService.stop();
}
}

View File

@ -45,6 +45,14 @@ export class FilesService extends EntitiesService<File, IFile> {
return this._post<unknown>(fileIds, url).pipe(switchMap(() => this.loadAll(dossierId, routerPath)));
}
@Validate()
setToNewFor(@RequiredParam() files: List<IRouterPath>, @RequiredParam() dossierId: string) {
const url = `${this._defaultModelPath}/new/${dossierId}/bulk`;
const fileIds = files.map(f => f.id);
const routerPath: string = files[0].routerPath;
return this._post<unknown>(fileIds, url).pipe(switchMap(() => this.loadAll(dossierId, routerPath)));
}
@Validate()
setUnderApprovalFor(@RequiredParam() files: List<IRouterPath>, @RequiredParam() dossierId: string, assigneeId: string) {
const url = `${this._defaultModelPath}/under-approval/${dossierId}/bulk`;

View File

@ -106,6 +106,11 @@ export class PermissionsService {
return files.reduce((acc, _file) => this._canUnassignUser(_file, dossier) && acc, true);
}
canSetToNew(file: File | File[]): boolean {
const files = file instanceof File ? [file] : file;
return files.reduce((acc, _file) => this._canSetToNew(_file) && acc, true);
}
canSetUnderReview(file: File | File[]): boolean {
const files = file instanceof File ? [file] : file;
const dossier = this._getDossier(files[0]);
@ -299,6 +304,10 @@ export class PermissionsService {
);
}
private _canSetToNew(file: File): boolean {
return this._isActive(file) && file.isUnderReview;
}
private _canSetUnderReview(file: File): boolean {
return this._isActive(file) && file.isUnderApproval;
}

View File

@ -1,7 +1,7 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://dev-08.iqser.cloud/redaction-gateway-v1",
"API_URL": "https://dev-05.iqser.cloud/redaction-gateway-v1",
"APP_NAME": "RedactManager",
"AUTO_READ_TIME": 3,
"BACKEND_APP_VERSION": "4.4.40",
@ -17,7 +17,7 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://dev-08.iqser.cloud/auth/realms/redaction",
"OAUTH_URL": "https://dev-05.iqser.cloud/auth/realms/redaction",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview"

View File

@ -315,6 +315,23 @@
"text-highlight": ""
},
"annotations": "Anmerkungen",
"archived-dossiers-listing": {
"no-data": {
"title": ""
},
"no-match": {
"title": ""
},
"table-col-names": {
"dossier-status": "",
"last-modified": "",
"name": "",
"owner": ""
},
"table-header": {
"title": ""
}
},
"assign-dossier-owner": {
"dialog": {
"approvers": "Genehmiger",
@ -411,6 +428,29 @@
}
},
"configurations": "Einstellungen",
"confirm-archive-dossier": {
"archive": "",
"cancel": "",
"checkbox": {
"documents": ""
},
"details": "",
"title": "",
"toast-error": "",
"warning": ""
},
"confirm-delete-attribute": {
"cancel": "{count, plural, one{Attribut} other{Attribute}} behalten",
"delete": "{count, plural, one{Attribut} other{Attribute}} löschen",
"dossier-impacted-documents": "",
"dossier-lost-details": "",
"file-impacted-documents": "",
"file-lost-details": "",
"impacted-report": "{reportsCount}",
"title": "{count, plural, one{{name}} other{Datei-Attribute}} löschen",
"toast-error": "Bitte bestätigen Sie, dass Ihnen die Konsequenzen dieser Aktion bewusst sind!",
"warning": "Achtung: Diese Aktion kann nicht rückgängig gemacht werden!"
},
"confirm-delete-dossier-state": {
"cancel": "",
"delete": "",
@ -423,18 +463,6 @@
"title": "",
"warning": ""
},
"confirm-delete-file-attribute": {
"cancel": "{count, plural, one{Attribut} other{Attribute}} behalten",
"delete": "{count, plural, one{Attribut} other{Attribute}} löschen",
"file-impacted-documents": "Alle Dokumente {count, plural, one{ist} other{sind}} betroffen",
"dossier-impacted-documents": "",
"file-lost-details": "Alle in die Dokumente eingegebenen Daten gehen verloren",
"dossier-lost-details": "",
"title": "{count, plural, one{{name}} other{Datei-Attribute}} löschen",
"toast-error": "Bitte bestätigen Sie, dass Ihnen die Konsequenzen dieser Aktion bewusst sind!",
"warning": "Achtung: Diese Aktion kann nicht rückgängig gemacht werden!",
"impacted-report": "{reportsCount}"
},
"confirm-delete-users": {
"cancel": "{usersCount, plural, one{Benutzer} other{Benutzer}} behalten",
"delete": "{usersCount, plural, one{Benutzer} other{Benutzer}} löschen",
@ -692,6 +720,11 @@
},
"dossier-listing": {
"add-new": "Neues Dossier",
"archive": {
"action": "",
"archive-failed": "",
"archive-succeeded": ""
},
"delete": {
"action": "Dossier löschen",
"delete-failed": "Das Dossier {dossierName} konnte nicht gelöscht werden"
@ -747,6 +780,7 @@
"assign-approver": "Genehmiger zuordnen",
"assign-me": "Mir zuteilen",
"assign-reviewer": "Überprüfer zuordnen",
"back-to-new": "",
"bulk": {
"delete": "Dokumente löschen",
"reanalyse": "Dokumente analysieren"
@ -1601,6 +1635,7 @@
"processing": ""
},
"readonly": "Lesemodus",
"readonly-archived": "",
"recategorize-image-dialog": {
"actions": {
"cancel": "Abbrechen",
@ -1741,6 +1776,7 @@
},
"search": {
"active-dossiers": "ganze Plattform",
"all-dossiers": "",
"placeholder": "Nach Dokumenten oder Dokumenteninhalt suchen",
"this-dossier": "in diesem Dossier"
},
@ -1769,6 +1805,7 @@
},
"top-bar": {
"navigation-items": {
"archived-dossiers": "",
"back": "Zurück",
"dossiers": "Aktives Dossier",
"my-account": {

View File

@ -439,6 +439,18 @@
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Are you sure you want to archive the dossier?"
},
"confirm-delete-attribute": {
"cancel": "Keep {count, plural, one{Attribute} other{Attributes}}",
"delete": "Delete {count, plural, one{Attribute} other{Attributes}}",
"dossier-impacted-documents": "All dossiers based on this template will be affected",
"dossier-lost-details": "All values for this attribute will be lost",
"file-impacted-documents": "All documents {count, plural, one{it is} other{they are}} used on will be impacted",
"file-lost-details": "All inputted details on the documents will be lost",
"impacted-report": "{reportsCount} reports use the placeholder for this attribute and need to be adjusted",
"title": "Delete {count, plural, one{{name}} other{File Attributes}}",
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Warning: this cannot be undone!"
},
"confirm-delete-dossier-state": {
"cancel": "Cancel",
"delete": "Delete",
@ -451,18 +463,6 @@
"title": "Delete Dossier Status",
"warning": "The {name} status is assigned to {count} {count, plural, one{Dossier} other{Dossiers}}."
},
"confirm-delete-file-attribute": {
"cancel": "Keep {count, plural, one{Attribute} other{Attributes}}",
"delete": "Delete {count, plural, one{Attribute} other{Attributes}}",
"dossier-impacted-documents": "All dossiers based on this template will be affected",
"dossier-lost-details": "All values for this attribute will be lost",
"file-impacted-documents": "All documents {count, plural, one{it is} other{they are}} used on will be impacted",
"file-lost-details": "All inputted details on the documents will be lost",
"impacted-report": "{reportsCount} reports use the placeholder for this attribute and need to be adjusted",
"title": "Delete {count, plural, one{{name}} other{File Attributes}}",
"toast-error": "Please confirm that you understand the ramifications of your action!",
"warning": "Warning: this cannot be undone!"
},
"confirm-delete-users": {
"cancel": "Keep {usersCount, plural, one{User} other{Users}}",
"delete": "Delete {usersCount, plural, one{User} other{Users}}",
@ -780,6 +780,7 @@
"assign-approver": "Assign Approver",
"assign-me": "Assign To Me",
"assign-reviewer": "Assign User",
"back-to-new": "Back to New",
"bulk": {
"delete": "Delete Documents",
"reanalyse": "Analyze Documents"
@ -1259,7 +1260,6 @@
"reanalyse-notification": "This document was not processed with the latest rule/dictionary set. Analyze now to get updated annotations.",
"redacted": "Preview",
"redacted-tooltip": "Redaction preview shows only redactions. Consider this a preview for the final redacted version. This view is only available if the file has no pending changes & doesn't require a reanalysis",
"reset-filters": "",
"standard": "Standard",
"standard-tooltip": "Standard Workload view shows all hints, redactions, recommendations & suggestions. This view allows editing.",
"tabs": {

View File

@ -934,31 +934,31 @@
<source>Configurations</source>
<target>Einstellungen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.cancel">
<trans-unit id="confirm-delete-attribute.cancel">
<source>Keep {type, select, single{Attribute} bulk{Attributes} other{}}</source>
<target>{type, select, single{Attribut} bulk{Attribute} other{}} behalten</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.delete">
<trans-unit id="confirm-delete-attribute.delete">
<source>Delete {type, select, single{Attribute} bulk{Attributes} other{}}</source>
<target>{type, select, single{Attribut} bulk{Attribute} other{}} löschen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.impacted-documents">
<trans-unit id="confirm-delete-attribute.impacted-documents">
<source>All documents {type, select, single{it is} bulk{they are} other{}} used on will be impacted</source>
<target>Alle Dokumente {type, select, single{ist} bulk{sind} other{}} betroffen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.lost-details">
<trans-unit id="confirm-delete-attribute.lost-details">
<source>All inputted details on the documents will be lost</source>
<target>Alle in die Dokumente eingegebenen Daten gehen verloren</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.title">
<trans-unit id="confirm-delete-attribute.title">
<source>Delete {type, select, single{{name}} bulk{File Attributes} other{}}</source>
<target>{type, select, single{{name}} bulk{Datei-Attribute} other{}} löschen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.toast-error">
<trans-unit id="confirm-delete-attribute.toast-error">
<source>Please confirm that you understand the ramifications of your action!</source>
<target>Bitte bestätigen Sie, dass Ihnen die Konsequenzen dieser Aktion bewusst sind!</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.warning">
<trans-unit id="confirm-delete-attribute.warning">
<source>Warning: this cannot be undone!</source>
<target>Achtung: Diese Aktion kann nicht rückgängig gemacht werden!</target>
</trans-unit>

View File

@ -934,31 +934,31 @@ Bitte aus der Liste unten auswählen.</target>
<source>Configurations</source>
<target>Einstellungen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.cancel">
<trans-unit id="confirm-delete-attribute.cancel">
<source>Keep {type, select, single{Attribute} bulk{Attributes} other{}}</source>
<target>{type, select, single{Attribut} bulk{Attribute} other{}} behalten</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.delete">
<trans-unit id="confirm-delete-attribute.delete">
<source>Delete {type, select, single{Attribute} bulk{Attributes} other{}}</source>
<target>{type, select, single{Attribut} bulk{Attribute} other{}} löschen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.impacted-documents">
<trans-unit id="confirm-delete-attribute.impacted-documents">
<source>All documents {type, select, single{it is} bulk{they are} other{}} used on will be impacted</source>
<target>Alle Dokumente {type, select, single{ist} bulk{sind} other{}} betroffen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.lost-details">
<trans-unit id="confirm-delete-attribute.lost-details">
<source>All inputted details on the documents will be lost</source>
<target>Alle in die Dokumente eingegebenen Daten gehen verloren</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.title">
<trans-unit id="confirm-delete-attribute.title">
<source>Delete {type, select, single{{name}} bulk{File Attributes} other{}}</source>
<target>{type, select, single{{name}} bulk{Datei-Attribute} other{}} löschen</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.toast-error">
<trans-unit id="confirm-delete-attribute.toast-error">
<source>Please confirm that you understand the ramifications of your action!</source>
<target>Bitte bestätigen Sie, dass Ihnen die Konsequenzen dieser Aktion bewusst sind!</target>
</trans-unit>
<trans-unit id="confirm-delete-file-attribute.warning">
<trans-unit id="confirm-delete-attribute.warning">
<source>Warning: this cannot be undone!</source>
<target>Achtung: Diese Aktion kann nicht rückgängig gemacht werden!</target>
</trans-unit>