Skip to content
Snippets Groups Projects
Commit 9a7a4618 authored by Hamza HRAMCHI's avatar Hamza HRAMCHI
Browse files

FIX #23278 TIME 1:45 fix signature positions for main documents

parent 16c1d37a
No related branches found
No related tags found
No related merge requests found
...@@ -256,6 +256,7 @@ export class IndexationComponent implements OnInit { ...@@ -256,6 +256,7 @@ export class IndexationComponent implements OnInit {
} }
formattedObj.push({ formattedObj.push({
docIndex: file.docIndex,
title: file.title, title: file.title,
reference: formattedReference, reference: formattedReference,
encodedDocument: file.content, encodedDocument: file.content,
...@@ -272,7 +273,7 @@ export class IndexationComponent implements OnInit { ...@@ -272,7 +273,7 @@ export class IndexationComponent implements OnInit {
userId: item.userId, userId: item.userId,
mode: this.authService.getWorkflowMode(item.role), mode: this.authService.getWorkflowMode(item.role),
signatureMode: this.authService.getSignatureMode(item.role), signatureMode: this.authService.getSignatureMode(item.role),
signaturePositions: item.signaturePositions !== undefined ? this.formatPositions(item.signaturePositions.filter((pos: any) => pos.mainDocument === file.mainDocument && file.signPos !== undefined)).map((itemFile: any) => ({ signaturePositions: item.signaturePositions !== undefined ? this.formatPositions(item.signaturePositions.filter((pos: any) => pos.mainDocument === file.mainDocument && file.signPos !== undefined && pos.docIndex === file.docIndex)).map((itemFile: any) => ({
page: itemFile.page, page: itemFile.page,
docIndex: itemFile.docIndex, docIndex: itemFile.docIndex,
positionX: itemFile.position.positionX, positionX: itemFile.position.positionX,
...@@ -313,7 +314,8 @@ export class IndexationComponent implements OnInit { ...@@ -313,7 +314,8 @@ export class IndexationComponent implements OnInit {
title: filename.substr(0, filename.lastIndexOf('.')), title: filename.substr(0, filename.lastIndexOf('.')),
reference: filename.substr(0, filename.lastIndexOf('.')).substr(0, 53), reference: filename.substr(0, filename.lastIndexOf('.')).substr(0, 53),
mainDocument: true, mainDocument: true,
content: '' content: '',
docIndex: index,
}; };
const reader = new FileReader(); const reader = new FileReader();
reader.readAsArrayBuffer(fileInput.target.files[index]); reader.readAsArrayBuffer(fileInput.target.files[index]);
...@@ -322,6 +324,7 @@ export class IndexationComponent implements OnInit { ...@@ -322,6 +324,7 @@ export class IndexationComponent implements OnInit {
file.reference = this.filesToUpload.length === 0 ? file.reference : ''; file.reference = this.filesToUpload.length === 0 ? file.reference : '';
file.content = this.getBase64Document(value.target.result); file.content = this.getBase64Document(value.target.result);
this.filesToUpload.push(file); this.filesToUpload.push(file);
this.setFilePosition();
if (this.filesToUpload.length === 1) { if (this.filesToUpload.length === 1) {
setTimeout(() => { setTimeout(() => {
this.menu.open('right-menu'); this.menu.open('right-menu');
...@@ -340,6 +343,11 @@ export class IndexationComponent implements OnInit { ...@@ -340,6 +343,11 @@ export class IndexationComponent implements OnInit {
}); });
} }
setFilePosition() {
this.filesToUpload.forEach((file: any, position: number) => {
file['docIndex'] = position;
});
}
isExtensionAllowed(files: any[]) { isExtensionAllowed(files: any[]) {
for (let index = 0; index < files.length; index++) { for (let index = 0; index < files.length; index++) {
...@@ -365,6 +373,7 @@ export class IndexationComponent implements OnInit { ...@@ -365,6 +373,7 @@ export class IndexationComponent implements OnInit {
element.signaturePositions = []; element.signaturePositions = [];
}); });
} }
this.setFilePosition();
} }
async signPos(index: number) { async signPos(index: number) {
......
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