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

FIX #10240 TIME 0:25 fix set sign and date block prepos

parent 4ab49dd2
No related branches found
No related tags found
No related merge requests found
...@@ -251,7 +251,6 @@ export class DocumentComponent implements OnInit { ...@@ -251,7 +251,6 @@ 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();
...@@ -376,9 +375,7 @@ export class DocumentComponent implements OnInit { ...@@ -376,9 +375,7 @@ export class DocumentComponent implements OnInit {
this.signaturesService.signaturesListSubstituted = []; this.signaturesService.signaturesListSubstituted = [];
} }
if (realUserWorkflow[0].datePositions.length > 0 && this.functionsService.empty(this.signaturesService.datesContent)) { if (realUserWorkflow[0].datePositions.length > 0 && this.functionsService.empty(this.signaturesService.datesContent)) {
const currentUser = this.mainDocument.workflow.indexOf(realUserWorkflow[0]); realUserWorkflow[0].datePositions.forEach((date: any) => {
const datePosUser = realUserWorkflow[0].datePositions.filter((item: any) => item.sequence === currentUser);
datePosUser.forEach((date: any) => {
if (!this.signaturesService.datesContent[date.page]) { if (!this.signaturesService.datesContent[date.page]) {
this.signaturesService.datesContent[date.page] = []; this.signaturesService.datesContent[date.page] = [];
} }
......
...@@ -19,7 +19,6 @@ import { SignaturePadPageComponent } from '../pad/pad.component'; ...@@ -19,7 +19,6 @@ 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;
...@@ -109,35 +108,32 @@ export class SignaturesComponent implements OnInit { ...@@ -109,35 +108,32 @@ export class SignaturesComponent implements OnInit {
} }
} }
mustPrePosSignature(signPosCurrentPage: any, signPosOtherPage: any) {
return !(!this.signPosMode || (signPosCurrentPage.length === 0 && signPosOtherPage.length === 0));
}
selectSignature(signature: any) { selectSignature(signature: any) {
const percentWidth = 25; const percentWidth = 25;
signature.width = percentWidth; signature.width = percentWidth;
const signPosCurrentPage = this.currentWorflow.signaturePositions.filter((item: any) => item.page === this.signaturesService.currentPage); const signPosCurrentPage = this.currentWorflow.signaturePositions.filter((item: any) => item.page === this.signaturesService.currentPage);
const signPosOtherPage = this.currentWorflow.signaturePositions.filter((item: any) => item.page !== this.signaturesService.currentPage); const signPosOtherPage = this.currentWorflow.signaturePositions.filter((item: any) => item.page !== this.signaturesService.currentPage);
if (!this.signPosMode || (signPosCurrentPage.length === 0 && signPosOtherPage.length === 0)) {
if (!this.mustPrePosSignature(signPosCurrentPage, signPosOtherPage)) {
signature.positionX = 60; signature.positionX = 60;
signature.positionY = 80; signature.positionY = 80;
this.storeSignature(signature, this.signaturesService.currentPage); this.storeSignature(signature, this.signaturesService.currentPage);
this.notificationService.success('lang.signatureInDocAdded'); this.notificationService.success('lang.signatureInDocAdded');
this.modalController.dismiss('success'); this.modalController.dismiss('success');
} else { } else {
let signaturePos = this.currentWorflow.signaturePositions.filter((item: any) => item.sequence === this.posCurrentUser); // set sign block in current page
if (signPosCurrentPage.length > 0 && signPosOtherPage.length === 0) { if (signPosCurrentPage.length > 0) {
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);
} else if (signPosCurrentPage.length > 0 && signPosOtherPage.length > 0) { }
signature.positionX = signaturePos[0].positionX;
signature.positionY = signaturePos[0].positionY; // set sign block in other page
this.storeSignature(signature, signaturePos[0].page); if (signPosOtherPage.length > 0) {
}
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; }) => { signPosOtherPage.forEach((element: { positionX: any; positionY: any; page: number; }) => {
signature.positionX = element.positionX; signature.positionX = element.positionX;
signature.positionY = element.positionY; signature.positionY = element.positionY;
...@@ -147,25 +143,15 @@ export class SignaturesComponent implements OnInit { ...@@ -147,25 +143,15 @@ export class SignaturesComponent implements OnInit {
if (this.currentWorflow.signaturePositions.length === 1) { if (this.currentWorflow.signaturePositions.length === 1) {
this.notificationService.success('lang.signatureInDocAddedAlt'); this.notificationService.success('lang.signatureInDocAddedAlt');
} else { } else {
if (signaturePos.length > 0) { this.translate.get('lang.signaturesInDocAdded', { 0: this.currentWorflow.signaturePositions.map((item: any) => item.page) }).subscribe((res: string) => {
this.translate.get('lang.signaturesInDocAdded', { 0: signaturePos.map((item: any) => item.page) }).subscribe((res: string) => { this.notificationService.success(res);
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 no sign in current page but have sign in other page
if (signaturePos.length > 0) { if (signPosCurrentPage.length === 0 && signPosOtherPage.length > 0) {
this.modalController.dismiss({ redirectPage: signaturePos[0].page }); // go to first page with signature block
} else { this.modalController.dismiss({ redirectPage: signPosOtherPage[0].page });
this.modalController.dismiss({ redirectPage: this.currentWorflow.signaturePositions[0].page }); } else {
}
} else if(signPosCurrentPage.length > 0 && signPosOtherPage.length > 0) {
this.modalController.dismiss({ redirectPage: signaturePos[0].page });
} else {
this.modalController.dismiss('success'); this.modalController.dismiss('success');
} }
} }
...@@ -184,7 +170,7 @@ export class SignaturesComponent implements OnInit { ...@@ -184,7 +170,7 @@ export class SignaturesComponent implements OnInit {
font: 'Arial', font: 'Arial',
size: 15, size: 15,
color: '#666', color: '#666',
format : 'd MMMM y' format: 'd MMMM y'
}; };
dateBlock.positionX = 60; dateBlock.positionX = 60;
...@@ -202,7 +188,7 @@ export class SignaturesComponent implements OnInit { ...@@ -202,7 +188,7 @@ export class SignaturesComponent implements OnInit {
font: 'Arial', font: 'Arial',
size: 15, size: 15,
color: '#666', color: '#666',
format : 'd MMMM y' format: 'd MMMM y'
}; };
this.storeDate(dateBlock, this.signaturesService.currentPage); this.storeDate(dateBlock, this.signaturesService.currentPage);
} }
...@@ -215,7 +201,7 @@ export class SignaturesComponent implements OnInit { ...@@ -215,7 +201,7 @@ export class SignaturesComponent implements OnInit {
font: 'Arial', font: 'Arial',
size: 15, size: 15,
color: '#666', color: '#666',
format : 'd MMMM y' format: 'd MMMM y'
}; };
this.storeDate(dateBlock, position.page); this.storeDate(dateBlock, position.page);
}); });
......
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