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

FEAT #15550 TIME 0:30 fix duplicate signatures

parent eff8fefc
No related branches found
No related tags found
No related merge requests found
...@@ -251,6 +251,7 @@ export class DocumentComponent implements OnInit { ...@@ -251,6 +251,7 @@ export class DocumentComponent implements OnInit {
cssClass: 'my-custom-class', cssClass: 'my-custom-class',
componentProps: { componentProps: {
currentWorflow: this.mainDocument.workflow.filter((line: { current: boolean; }) => line.current === true)[0], currentWorflow: this.mainDocument.workflow.filter((line: { current: boolean; }) => line.current === true)[0],
posCurrentUser: this.mainDocument.workflow.indexOf(this.mainDocument.workflow.filter((item: { current: boolean; }) => item.current === true)[0])
} }
}); });
await modal.present(); await modal.present();
......
...@@ -19,6 +19,7 @@ import { SignaturePadPageComponent } from '../pad/pad.component'; ...@@ -19,6 +19,7 @@ import { SignaturePadPageComponent } from '../pad/pad.component';
export class SignaturesComponent implements OnInit { export class SignaturesComponent implements OnInit {
@Input() currentWorflow: any; @Input() currentWorflow: any;
@Input() posCurrentUser: number;
loading: boolean = true; loading: boolean = true;
scrolling: boolean = false; scrolling: boolean = false;
...@@ -127,22 +128,42 @@ export class SignaturesComponent implements OnInit { ...@@ -127,22 +128,42 @@ export class SignaturesComponent implements OnInit {
signature.positionX = signPosCurrentPage[0].positionX; signature.positionX = signPosCurrentPage[0].positionX;
signature.positionY = signPosCurrentPage[0].positionY; signature.positionY = signPosCurrentPage[0].positionY;
this.storeSignature(signature, this.signaturesService.currentPage); this.storeSignature(signature, this.signaturesService.currentPage);
}
let signaturePos = signPosOtherPage.filter((item: any) => item.sequence === this.posCurrentUser);
if (signaturePos.length > 0) {
signaturePos.forEach((element: { positionX: any; positionY: any; page: number; }) => {
signature.positionX = element.positionX;
signature.positionY = element.positionY;
this.storeSignature(signature, element.page);
});
} else {
signPosOtherPage.forEach((element: { positionX: any; positionY: any; page: number; }) => {
signature.positionX = element.positionX;
signature.positionY = element.positionY;
this.storeSignature(signature, element.page);
});
} }
this.currentWorflow.signaturePositions.forEach((element: { positionX: any; positionY: any; page: number; }) => {
signature.positionX = element.positionX;
signature.positionY = element.positionY;
this.storeSignature(signature, element.page);
});
if (this.currentWorflow.signaturePositions.length === 1) { if (this.currentWorflow.signaturePositions.length === 1) {
this.notificationService.success('lang.signatureInDocAddedAlt'); this.notificationService.success('lang.signatureInDocAddedAlt');
} else { } else {
this.translate.get('lang.signaturesInDocAdded', { 0: this.currentWorflow.signaturePositions.map((item: any) => item.page) }).subscribe((res: string) => { if (signaturePos.length > 0) {
this.notificationService.success(res); this.translate.get('lang.signaturesInDocAdded', { 0: signaturePos.map((item: any) => item.page) }).subscribe((res: string) => {
}); this.notificationService.success(res);
});
} else {
this.translate.get('lang.signaturesInDocAdded', { 0: this.currentWorflow.signaturePositions.map((item: any) => item.page) }).subscribe((res: string) => {
this.notificationService.success(res);
});
}
} }
if (signPosCurrentPage.length === 0 && signPosOtherPage.length > 0) { if (signPosCurrentPage.length === 0 && signPosOtherPage.length > 0) {
this.modalController.dismiss({ redirectPage: signPosOtherPage[0].page }); if (signaturePos.length > 0) {
this.modalController.dismiss({ redirectPage: signaturePos[0].page });
} else {
this.modalController.dismiss({ redirectPage: this.currentWorflow.signaturePositions[0].page });
}
} else { } else {
this.modalController.dismiss('success'); this.modalController.dismiss('success');
} }
......
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