Commit 66ee6c53 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FIX #17484 TIME 0:45 [REVERT] refactoring signature and date positions

parent 5b68f7b7
......@@ -15,6 +15,6 @@
<img src="assets/spinner.gif"/>
</div>
</app-root>
<script src="runtime-es2015.497d8eb67297abf47895.js" type="module"></script><script src="runtime-es5.497d8eb67297abf47895.js" nomodule defer></script><script src="polyfills-es5.c174c1516561194600a5.js" nomodule defer></script><script src="polyfills-es2015.b86be9c6fde12488a69f.js" type="module"></script><script src="scripts.b9f328a06b6423d59d32.js" defer></script><script src="main-es2015.6f92782e2c0269da438b.js" type="module"></script><script src="main-es5.6f92782e2c0269da438b.js" nomodule defer></script></body>
<script src="runtime-es2015.497d8eb67297abf47895.js" type="module"></script><script src="runtime-es5.497d8eb67297abf47895.js" nomodule defer></script><script src="polyfills-es5.c174c1516561194600a5.js" nomodule defer></script><script src="polyfills-es2015.b86be9c6fde12488a69f.js" type="module"></script><script src="scripts.b9f328a06b6423d59d32.js" defer></script><script src="main-es2015.c772f20e14e69afe7181.js" type="module"></script><script src="main-es5.c772f20e14e69afe7181.js" nomodule defer></script></body>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -76,8 +76,8 @@ export class MaarchParaphComponent implements OnInit {
'sequence': index,
'action': element.role === 'visa' ? 'visa' : 'sign',
'signatureMode': element.role,
'signaturePositions': element.signaturePositions !== undefined ? this.formatPositions(element.signaturePositions.filter((pos: any) => pos.resId === resource.resId && pos.mainDocument === resource.mainDocument)) : [],
'datePositions': element.datePositions !== undefined ? this.formatPositions(element.datePositions.filter((pos: any) => pos.resId === resource.resId && pos.mainDocument === resource.mainDocument)) : [],
'signaturePositions': resource.signaturePositions !== undefined ? resource.signaturePositions.filter((item: any) => item.sequence === index) : [],
'datePositions': resource.datePositions !== undefined ? resource.datePositions.filter((item: any) => item.sequence === index) : [],
}
);
});
......@@ -85,12 +85,6 @@ export class MaarchParaphComponent implements OnInit {
return formatedData;
}
formatPositions(position: any) {
delete position.mainDocument;
delete position.resId;
return position;
}
openSignaturePosition(resource: any) {
const dialogRef = this.dialog.open(SignaturePositionComponent, {
height: '99vh',
......@@ -104,7 +98,8 @@ export class MaarchParaphComponent implements OnInit {
dialogRef.afterClosed().pipe(
filter((res: any) => !this.functions.empty(res)),
tap((res: any) => {
this.appExternalVisaWorkflow.setPositionsWorkfow(resource, res);
this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['signaturePositions'] = res.signaturePositions;
this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['datePositions'] = res.datePositions;
}),
finalize(() => this.loading = false),
catchError((err: any) => {
......@@ -115,6 +110,12 @@ export class MaarchParaphComponent implements OnInit {
}
hasPositions(resource: any) {
return this.appExternalVisaWorkflow?.getDocumentsFromPositions().filter((document: any) => document.resId === resource.resId && document.mainDocument === resource.mainDocument).length > 0;
return (
this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['signaturePositions'] !== undefined &&
this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['signaturePositions'].length > 0)
||
(this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['datePositions'] !== undefined &&
this.resourcesToSign.filter((itemToSign: any) => itemToSign.resId === resource.resId && itemToSign.mainDocument === resource.mainDocument)[0]['datePositions'].length > 0);
}
}
......@@ -74,24 +74,13 @@ export class SignaturePositionComponent implements OnInit {
ngOnInit(): void {
this.currentPage = 1;
this.getPageAttachment();
this.getAllUnits();
}
getAllUnits() {
this.data.workflow.forEach((user: any, index: number) => {
if (user.signaturePositions?.length > 0) {
this.signList = this.signList.concat(user.signaturePositions.filter((pos: any) => pos.resId === this.data.resource.resId && pos.mainDocument === this.data.resource.mainDocument).map((pos: any) => ({
...pos,
sequence : index
})));
}
if (user.datePositions?.length > 0) {
this.dateList = this.dateList.concat(user.datePositions.filter((pos: any) => pos.resId === this.data.resource.resId && pos.mainDocument === this.data.resource.mainDocument).map((pos: any) => ({
...pos,
sequence : index
})));
}
});
if (this.data.resource.signaturePositions !== undefined) {
this.signList = this.data.resource.signaturePositions;
}
if (this.data.resource.datePositions !== undefined) {
this.dateList = this.data.resource.datePositions;
}
}
onSubmit() {
......
......@@ -336,9 +336,10 @@ export class ExternalVisaWorkflowComponent implements OnInit {
}
setPositionsWorkfow(resource: any, positions: any) {
if (this.visaWorkflow.items[0].signaturePositions === undefined) {
this.initPositionWorkflow();
}
this.clearPositionsFromResource(resource);
if (positions.signaturePositions !== undefined) {
Object.keys(positions.signaturePositions).forEach(key => {
const objPos = {
......@@ -365,17 +366,15 @@ export class ExternalVisaWorkflowComponent implements OnInit {
clearPositionsFromResource(resource: any) {
this.visaWorkflow.items.forEach((user: any) => {
if (user.signaturePositions === undefined) {
user.signaturePositions = [];
} else {
user.signaturePositions = user.signaturePositions.filter((pos: any) => pos.resId !== resource.resId && pos.mainDocument !== resource.mainDocument);
}
user.signaturePositions = user.signaturePositions.filter((pos: any) => pos.resId !== resource.resId && pos.mainDocument !== resource.mainDocument);
user.datePositions = user.datePositions.filter((pos: any) => pos.resId !== resource.resId && pos.mainDocument !== resource.mainDocument);
});
}
if (user.datePositions === undefined) {
user.datePositions = [];
} else {
user.datePositions = user.datePositions.filter((pos: any) => pos.resId !== resource.resId && pos.mainDocument !== resource.mainDocument);
}
initPositionWorkflow() {
this.visaWorkflow.items.forEach((user: any) => {
user.signaturePositions = [];
user.datePositions = [];
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment