Skip to content
Snippets Groups Projects
Commit c57d1f6e authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #15570 TIME 1 add control no doc in indexation + fix undefined resId visa model

parent d790b9c0
No related branches found
No related tags found
No related merge requests found
......@@ -38,10 +38,10 @@
</li>
</ul>
</div>
<app-visa-workflow *ngIf="data.resIds.length <= 1 || (!noResourceToProcess && data.resIds.length > 1)"
<app-visa-workflow *ngIf="!noResourceToProcess"
[adminMode]="true" #appVisaWorkflow>
</app-visa-workflow>
<div style="padding-top: 10px;">
<div *ngIf="!noResourceToProcess" style="padding-top: 10px;">
<app-note-editor #noteEditor [resIds]="data.resIds"></app-note-editor>
</div>
</mat-sidenav-content>
......@@ -58,4 +58,4 @@
(click)="onSubmit()">{{lang.validate}}</button>
<button mat-raised-button mat-button [disabled]="loading" [mat-dialog-close]="">{{lang.cancel}}</button>
</div>
</div>
\ No newline at end of file
</div>
......@@ -29,7 +29,7 @@ export class SendSignatureBookActionComponent implements AfterViewInit {
}
};
@ViewChild('noteEditor', { static: true }) noteEditor: NoteEditorComponent;
@ViewChild('noteEditor', { static: false }) noteEditor: NoteEditorComponent;
@ViewChild('appVisaWorkflow', { static: false }) appVisaWorkflow: VisaWorkflowComponent;
constructor(
......@@ -40,8 +40,19 @@ export class SendSignatureBookActionComponent implements AfterViewInit {
public functions: FunctionsService) { }
async ngAfterViewInit(): Promise<void> {
if (this.data.resIds.length === 0 && !this.functions.empty(this.data.resource.destination)) {
await this.appVisaWorkflow.loadListModel(this.data.resource.destination);
if (this.data.resIds.length === 0) {
if (this.data.resource.encodedFile === null) {
this.noResourceToProcess = true;
this.resourcesError = [
{
alt_identifier : this.lang.currentIndexingMail,
reason : 'noDocumentToSend'
}
];
} else if (!this.functions.empty(this.data.resource.destination)) {
this.noResourceToProcess = false;
await this.appVisaWorkflow.loadListModel(this.data.resource.destination);
}
this.loading = false;
} else if (this.data.resIds.length > 0) {
await this.checkSignatureBook();
......@@ -157,7 +168,7 @@ export class SendSignatureBookActionComponent implements AfterViewInit {
this.http.put(this.data.indexActionRoute, { resource: resId, note: this.noteEditor.getNote() }).pipe(
tap((data: any) => {
if (!data) {
this.dialogRef.close('success');
this.dialogRef.close(this.data.resIds);
}
if (data && data.errors != null) {
this.notify.error(data.errors);
......
......@@ -170,7 +170,7 @@ export class VisaWorkflowComponent implements OnInit {
}
async loadVisaModelList() {
if (this.resId !== null) {
if (!this.functions.empty(this.resId)) {
await this.loadDefaultModel();
}
......@@ -424,6 +424,7 @@ export class VisaWorkflowComponent implements OnInit {
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
resolve(false);
return of(false);
})
).subscribe();
......@@ -442,6 +443,7 @@ export class VisaWorkflowComponent implements OnInit {
}),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
resolve(false);
return of(false);
})
).subscribe();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment