RED-10115: Refactoring of justifications
This commit is contained in:
parent
3d26a73b05
commit
bd35690f16
@ -375,7 +375,7 @@ export class AnnotationWrapper implements IListable {
|
||||
|
||||
static #getShortContent(annotationWrapper: AnnotationWrapper, legalBasisList: ILegalBasis[]) {
|
||||
if (annotationWrapper.legalBasis) {
|
||||
const lb = legalBasisList.find(lbm => lbm.reason?.toLowerCase().includes(annotationWrapper.legalBasis.toLowerCase()));
|
||||
const lb = legalBasisList.find(lbm => lbm.technicalName?.toLowerCase().includes(annotationWrapper.legalBasis.toLowerCase()));
|
||||
if (lb) {
|
||||
return lb.name;
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ export class ChangeLegalBasisDialogComponent extends BaseDialogComponent impleme
|
||||
|
||||
this.legalOptions = data
|
||||
.map<LegalBasisOption>(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
@ -60,14 +61,14 @@ export class ChangeLegalBasisDialogComponent extends BaseDialogComponent impleme
|
||||
.sort((a, b) => a.label.localeCompare(b.label));
|
||||
|
||||
this.form.patchValue({
|
||||
reason: this.legalOptions.find(option => option.legalBasis === this._data.annotations[0].legalBasis),
|
||||
reason: this.legalOptions.find(option => option.technicalName === this._data.annotations[0].legalBasis),
|
||||
});
|
||||
this.initialFormValue = this.form.getRawValue();
|
||||
}
|
||||
|
||||
save() {
|
||||
this._dialogRef.close({
|
||||
legalBasis: this.form.get('reason').value.legalBasis,
|
||||
legalBasis: this.form.get('reason').value.technicalName,
|
||||
section: this.form.get('section').value,
|
||||
comment: this.form.get('comment').value,
|
||||
value: this.form.get('classification').value,
|
||||
|
||||
@ -177,13 +177,14 @@ export class EditRedactionDialogComponent
|
||||
this.#setTypes();
|
||||
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId));
|
||||
this.legalOptions = data.map(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
}));
|
||||
|
||||
const reason = this.legalOptions.find(o => o.legalBasis === this.annotations[0].legalBasis);
|
||||
const sameLegalBasis = this.annotations.every(annotation => annotation.legalBasis === reason?.legalBasis);
|
||||
const reason = this.legalOptions.find(o => o.technicalName === this.annotations[0].legalBasis);
|
||||
const sameLegalBasis = this.annotations.every(annotation => annotation.legalBasis === reason?.technicalName);
|
||||
this.form.patchValue({
|
||||
reason: sameLegalBasis ? reason : null,
|
||||
});
|
||||
@ -213,7 +214,7 @@ export class EditRedactionDialogComponent
|
||||
save() {
|
||||
const value = this.form.value;
|
||||
const initialReason: LegalBasisOption = this.initialFormValue.reason;
|
||||
const initialLegalBasis = initialReason?.legalBasis ?? '';
|
||||
const initialLegalBasis = initialReason?.technicalName ?? '';
|
||||
const pageNumbers = parseSelectedPageNumbers(
|
||||
this.form.get('option').value?.additionalInput?.value,
|
||||
this.data.file,
|
||||
@ -222,7 +223,7 @@ export class EditRedactionDialogComponent
|
||||
const position = parseRectanglePosition(this.annotations[0]);
|
||||
|
||||
this.close({
|
||||
legalBasis: value.reason?.legalBasis ?? (this.isImage ? initialLegalBasis : ''),
|
||||
legalBasis: value.reason?.technicalName ?? (this.isImage ? initialLegalBasis : ''),
|
||||
section: value.section,
|
||||
comment: value.comment,
|
||||
type: value.type,
|
||||
|
||||
@ -110,6 +110,7 @@ export class ForceAnnotationDialogComponent
|
||||
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.data.dossier.dossierTemplateId));
|
||||
|
||||
this.legalOptions = data.map(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
@ -118,7 +119,7 @@ export class ForceAnnotationDialogComponent
|
||||
this.legalOptions.sort((a, b) => a.label.localeCompare(b.label));
|
||||
|
||||
// Set pre-existing reason if it exists
|
||||
const existingReason = this.legalOptions.find(option => option.legalBasis === this.data.annotations[0].legalBasis);
|
||||
const existingReason = this.legalOptions.find(option => option.technicalName === this.data.annotations[0].legalBasis);
|
||||
if (!this.data.hint && existingReason) {
|
||||
this.form.patchValue({ reason: existingReason }, { emitEvent: false });
|
||||
}
|
||||
@ -141,7 +142,7 @@ export class ForceAnnotationDialogComponent
|
||||
#createForceRedactionRequest(): ILegalBasisChangeRequest {
|
||||
const request: ILegalBasisChangeRequest = {};
|
||||
|
||||
request.legalBasis = !this.isDocumine ? this.form.get('reason').value.legalBasis : DOCUMINE_LEGAL_BASIS;
|
||||
request.legalBasis = !this.isDocumine ? this.form.get('reason').value.technicalName : DOCUMINE_LEGAL_BASIS;
|
||||
request.comment = this.form.get('comment').value;
|
||||
request.reason = this.form.get('reason').value.description;
|
||||
request.option = this.form.get('option').value?.value;
|
||||
|
||||
@ -100,6 +100,7 @@ export class RectangleAnnotationDialog
|
||||
async ngOnInit() {
|
||||
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId));
|
||||
this.legalOptions = data.map(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
@ -139,7 +140,7 @@ export class RectangleAnnotationDialog
|
||||
addRedactionRequest.type = SuperTypes.ManualRedaction;
|
||||
if (legalOption) {
|
||||
addRedactionRequest.reason = legalOption.description;
|
||||
addRedactionRequest.legalBasis = legalOption.legalBasis;
|
||||
addRedactionRequest.legalBasis = legalOption.technicalName;
|
||||
}
|
||||
|
||||
addRedactionRequest.addToDictionary = false;
|
||||
|
||||
@ -122,6 +122,7 @@ export class RedactRecommendationDialogComponent
|
||||
this.#setDictionaries();
|
||||
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId));
|
||||
this.legalOptions = data.map(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
|
||||
@ -145,6 +145,7 @@ export class RedactTextDialogComponent
|
||||
async ngOnInit(): Promise<void> {
|
||||
const data = await firstValueFrom(this._justificationsService.getForDossierTemplate(this.#dossier.dossierTemplateId));
|
||||
this.legalOptions = data.map(lbm => ({
|
||||
technicalName: lbm.technicalName,
|
||||
legalBasis: lbm.reason,
|
||||
description: lbm.description,
|
||||
label: lbm.name,
|
||||
|
||||
@ -51,6 +51,7 @@ export interface LegalBasisOption {
|
||||
label?: string;
|
||||
legalBasis?: string;
|
||||
description?: string;
|
||||
technicalName?: string;
|
||||
}
|
||||
|
||||
export interface RedactTextData {
|
||||
|
||||
@ -30,7 +30,7 @@ export const enhanceManualRedactionRequest = (addRedactionRequest: IAddRedaction
|
||||
const legalOption: LegalBasisOption = data.reason;
|
||||
if (legalOption) {
|
||||
addRedactionRequest.reason = legalOption.description;
|
||||
addRedactionRequest.legalBasis = legalOption.legalBasis;
|
||||
addRedactionRequest.legalBasis = legalOption.technicalName;
|
||||
}
|
||||
|
||||
const selectedType = data.dictionaries.find(d => d.type === addRedactionRequest.type);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"ADMIN_CONTACT_NAME": null,
|
||||
"ADMIN_CONTACT_URL": null,
|
||||
"API_URL": "https://dan1.iqser.cloud",
|
||||
"API_URL": "https://maverick2.iqser.cloud",
|
||||
"APP_NAME": "RedactManager",
|
||||
"IS_DOCUMINE": false,
|
||||
"RULE_EDITOR_DEV_ONLY": false,
|
||||
@ -13,7 +13,7 @@
|
||||
"MAX_RETRIES_ON_SERVER_ERROR": 3,
|
||||
"OAUTH_CLIENT_ID": "redaction",
|
||||
"OAUTH_IDP_HINT": null,
|
||||
"OAUTH_URL": "https://dan1.iqser.cloud/auth",
|
||||
"OAUTH_URL": "https://maverick2.iqser.cloud/auth",
|
||||
"RECENT_PERIOD_IN_HOURS": 24,
|
||||
"SELECTION_MODE": "structural",
|
||||
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user