tango-app-api-trax 3.7.70 → 3.7.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -8,4 +8,9 @@ Handlebars.registerHelper( 'neq', function( a, b, options ) {
|
|
|
8
8
|
return a !== b ? options.fn( this ) : options.inverse( this );
|
|
9
9
|
} );
|
|
10
10
|
|
|
11
|
+
Handlebars.registerHelper( 'includes', function( array, value ) {
|
|
12
|
+
if ( !Array.isArray( array ) ) return false;
|
|
13
|
+
return array.includes( value );
|
|
14
|
+
} );
|
|
15
|
+
|
|
11
16
|
export default Handlebars;
|
|
@@ -1380,7 +1380,6 @@ export async function insertTimeDelayFlags( req, res ) {
|
|
|
1380
1380
|
time: '--',
|
|
1381
1381
|
domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags`,
|
|
1382
1382
|
type: 'delay',
|
|
1383
|
-
answerType: [ 'yes/no', 'descriptive', 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown' ],
|
|
1384
1383
|
};
|
|
1385
1384
|
const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
|
|
1386
1385
|
const htmlContent = handlebars.compile( fileContent );
|
|
@@ -714,10 +714,13 @@ export async function sopMobileTaskQuestionValidator( req, res, next ) {
|
|
|
714
714
|
section.questions.forEach( ( question ) => {
|
|
715
715
|
question.answers.forEach( ( answer ) => {
|
|
716
716
|
let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qno == question.qno );
|
|
717
|
-
if (
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
717
|
+
if ( sectionQuestion[0] ) {
|
|
718
|
+
const multianswerEmpty = sectionQuestion[0].Multianswer == null || sectionQuestion[0].Multianswer == '' || !sectionQuestion[0].Multianswer?.length;
|
|
719
|
+
const answerEmpty = ( !sectionQuestion[0].linkType && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) || ( sectionQuestion[0].linkType && sectionQuestion[0].linkquestionenabled && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) );
|
|
720
|
+
const usesMultianswer = [ 'multiplechoicemultiple', 'multipleImage', 'image/video' ].includes( question.answerType ) || ( question.answerType == 'dropdown' && question.allowMultiple );
|
|
721
|
+
if ( usesMultianswer && multianswerEmpty ) {
|
|
722
|
+
validationCount++;
|
|
723
|
+
} else if ( !usesMultianswer && answerEmpty ) {
|
|
721
724
|
validationCount++;
|
|
722
725
|
}
|
|
723
726
|
}
|
|
@@ -1210,6 +1213,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1210
1213
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage || '';
|
|
1211
1214
|
structure.multiQuestionReferenceImage = qaAnswers[j].multiQuestionReferenceImage || [];
|
|
1212
1215
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1216
|
+
structure.compliance = qaAnswers[j]?.compliance;
|
|
1213
1217
|
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1214
1218
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1215
1219
|
if ( qaAnswers[j]?.taskId ) {
|
|
@@ -1267,6 +1271,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1267
1271
|
structure.multiQuestionReferenceImage = qaAnswers[j].multiQuestionReferenceImage || [];
|
|
1268
1272
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1269
1273
|
structure.allowMultiple = qaAnswers[j].allowMultiple;
|
|
1274
|
+
structure.compliance = qaAnswers[j]?.compliance;
|
|
1270
1275
|
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1271
1276
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1272
1277
|
if ( qaAnswers[j]?.taskId ) {
|
|
@@ -1328,6 +1333,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1328
1333
|
structure.multiQuestionReferenceImage = qaAnswers[j].multiQuestionReferenceImage || [];
|
|
1329
1334
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1330
1335
|
structure.allowMultiple = qaAnswers[j].allowMultiple;
|
|
1336
|
+
structure.compliance = qaAnswers[j]?.compliance;
|
|
1331
1337
|
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1332
1338
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1333
1339
|
if ( qaAnswers[j]?.taskId ) {
|
|
@@ -1398,6 +1404,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1398
1404
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage || '';
|
|
1399
1405
|
structure.multiQuestionReferenceImage = qaAnswers[j].multiQuestionReferenceImage || [];
|
|
1400
1406
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1407
|
+
structure.compliance = qaAnswers[j]?.compliance;
|
|
1401
1408
|
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1402
1409
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1403
1410
|
if ( qaAnswers[j]?.taskId ) {
|
|
@@ -1445,13 +1452,27 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1445
1452
|
if ( qaAnswers[j].answerType == 'date' ) {
|
|
1446
1453
|
ansstructure.dateRangeType = requestSection[i].dateRangeType || false;
|
|
1447
1454
|
if ( qaAnswers[j].compliance ) {
|
|
1448
|
-
|
|
1455
|
+
if ( qaAnswers[j].compliance ) {
|
|
1456
|
+
let ansArray = requestSection[i].answer.split( ',' );
|
|
1457
|
+
if ( ansArray.includes( '-' ) ) {
|
|
1458
|
+
ansArray = requestSection[i].answer.split( '-' );
|
|
1459
|
+
}
|
|
1460
|
+
if ( ansArray.length > 1 && ansArray.some( ( date ) => dayjs( date, 'DD MMM YYYY' ).format( 'DD-MM-YYYY' ) >= qaAnswers[j]?.answers[0]?.startDate || dayjs( date, 'DD MMM YYYY' ) <= qaAnswers[j]?.answers[0]?.endDate ) ) {
|
|
1461
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1462
|
+
} else if ( ansArray.length > 1 && ( dayjs( ansArray?.[0], 'DD MMM YYYY' ).format( 'DD-MM-YYYY' ) >= qaAnswers[j]?.answers[0]?.startDate || dayjs( ansArray?.[1], 'DD MMM YYYY' ).format( 'DD-MM-YYYY' ) <= qaAnswers[j]?.answers[0]?.endDate ) ) {
|
|
1463
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1464
|
+
} else if ( dayjs( requestSection[i].answer, 'DD MMM YYYY' ) >= qaAnswers[j]?.answers[0]?.startDate || dayjs( requestSection[i].answer, 'DD MMM YYYY' ) <= qaAnswers[j]?.answers[0]?.startDate ) {
|
|
1465
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1466
|
+
} else {
|
|
1467
|
+
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.notMatchedCount;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1449
1470
|
}
|
|
1450
1471
|
}
|
|
1451
1472
|
if ( qaAnswers[j].answerType == 'linearscale' ) {
|
|
1452
|
-
let linearAnswer = requestSection[i].answer.split( 'to' );
|
|
1453
1473
|
if ( qaAnswers[j].compliance ) {
|
|
1454
|
-
|
|
1474
|
+
let linearAnswer = requestSection[i].answer.split( 'to' );
|
|
1475
|
+
if ( parseInt( linearAnswer?.[0] ) >= qaAnswers[j]?.answers[0]?.minValue || parseInt( linearAnswer?.[1] ) <= qaAnswers[j]?.answers[0]?.maxValue ) {
|
|
1455
1476
|
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.matchedCount;
|
|
1456
1477
|
} else {
|
|
1457
1478
|
ansstructure.complianceScore = qaAnswers[j]?.answers[0]?.notMatchedCount;
|
|
@@ -1487,6 +1508,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1487
1508
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1488
1509
|
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1489
1510
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1511
|
+
structure.compliance = qaAnswers[j]?.compliance;
|
|
1490
1512
|
if ( qaAnswers[j]?.taskId ) {
|
|
1491
1513
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
1492
1514
|
structure.task = true;
|
|
@@ -1533,7 +1555,7 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
|
|
|
1533
1555
|
|
|
1534
1556
|
if ( requestData.submittype == 'submit' ) {
|
|
1535
1557
|
reqAnswers.forEach( ( reqA ) => {
|
|
1536
|
-
if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( reqA?.answerType ) ) {
|
|
1558
|
+
if ( ![ 'multiplechoicemultiple', 'multipleImage', 'image/video' ].includes( reqA?.answerType ) && !( reqA?.answerType == 'dropdown' && reqA?.allowMultiple ) ) {
|
|
1537
1559
|
if ( ( !reqA.linkType && ( reqA.answer == null || reqA.answer == '' ) ) || ( reqA.linkType && reqA.linkquestionenabled && ( reqA.answer == null || reqA.answer == '' ) ) ) {
|
|
1538
1560
|
return res.sendError( 'Please Fill All Fields', 400 );
|
|
1539
1561
|
}
|
|
@@ -1714,8 +1736,64 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
|
|
|
1714
1736
|
structure.redoComment = qaAnswers[j]?.redoComment;
|
|
1715
1737
|
};
|
|
1716
1738
|
newArray.push( structure );
|
|
1739
|
+
} else if ( qaAnswers[j].answerType == 'dropdown' && qaAnswers[j].allowMultiple ) {
|
|
1740
|
+
let qaans = qaAnswers[j].answers;
|
|
1741
|
+
let mcmo = [];
|
|
1742
|
+
for ( let k = 0; k < qaans.length; k++ ) {
|
|
1743
|
+
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
|
|
1744
|
+
if ( separatedArray && separatedArray.length ) {
|
|
1745
|
+
for ( let s = 0; s < separatedArray.length; s++ ) {
|
|
1746
|
+
if ( separatedArray[s].answer == qaans[k].answer ) {
|
|
1747
|
+
if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
|
|
1748
|
+
if ( separatedArray[s].validationAnswer ) {
|
|
1749
|
+
let validationAnswer = decodeURIComponent( separatedArray[s].validationAnswer.split( '?' )[0] );
|
|
1750
|
+
if ( validationAnswer.length ) {
|
|
1751
|
+
let splitImgUrl = validationAnswer.split( '/' );
|
|
1752
|
+
if ( splitImgUrl.length > 1 ) {
|
|
1753
|
+
splitImgUrl.splice( 0, 3 );
|
|
1754
|
+
qaans[k].validationAnswer = splitImgUrl.join( '/' ) || '';
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
} else {
|
|
1759
|
+
qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
|
|
1760
|
+
qaans[k].validationAnswer = separatedArray[s].validationAnswer || '';
|
|
1761
|
+
}
|
|
1762
|
+
mcmo.push( qaans[k] );
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
let structure = {};
|
|
1768
|
+
structure.qno = qaAnswers[j].qno;
|
|
1769
|
+
structure.qname = qaAnswers[j].qname;
|
|
1770
|
+
if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
|
|
1771
|
+
structure.qcomment = qaAnswers[j].qcomment;
|
|
1772
|
+
}
|
|
1773
|
+
structure.answerType = qaAnswers[j].answerType;
|
|
1774
|
+
structure.runAI = qaAnswers[j].runAI;
|
|
1775
|
+
structure.runAIDescription = qaAnswers[j].runAIDescription;
|
|
1776
|
+
structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
|
|
1777
|
+
structure.remarks = requestSection[i].remarks;
|
|
1778
|
+
structure.answers = qaAnswers[j].answers;
|
|
1779
|
+
structure.userAnswer = mcmo;
|
|
1780
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
1781
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
1782
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
1783
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1784
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1785
|
+
structure.allowMultiple = qaAnswers[j].allowMultiple;
|
|
1786
|
+
if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
|
|
1787
|
+
structure.redo = false;
|
|
1788
|
+
} else if ( requestData.submittype === 'draft' ) {
|
|
1789
|
+
structure.redo = qaAnswers[j]?.redo;
|
|
1790
|
+
}
|
|
1791
|
+
if ( qaAnswers[j]?.redoComment ) {
|
|
1792
|
+
structure.redoComment = qaAnswers[j]?.redoComment;
|
|
1793
|
+
};
|
|
1794
|
+
newArray.push( structure );
|
|
1717
1795
|
} else if ( qaAnswers[j].answerType == 'multipleImage' ) {
|
|
1718
|
-
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
|
|
1796
|
+
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : ( requestSection[i].Multianswer || [] );
|
|
1719
1797
|
let mcmi = [];
|
|
1720
1798
|
// for (let k = 0; k < qaans.length; k++) {
|
|
1721
1799
|
for ( let s = 0; s < separatedArray.length; s++ ) {
|
|
@@ -1773,6 +1851,69 @@ export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
|
|
|
1773
1851
|
structure.redoComment = qaAnswers[j]?.redoComment;
|
|
1774
1852
|
};
|
|
1775
1853
|
newArray.push( structure );
|
|
1854
|
+
} else if ( qaAnswers[j].answerType == 'image/video' ) {
|
|
1855
|
+
let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
|
|
1856
|
+
let mcmi = [];
|
|
1857
|
+
if ( separatedArray && separatedArray.length ) {
|
|
1858
|
+
for ( let s = 0; s < separatedArray.length; s++ ) {
|
|
1859
|
+
if ( separatedArray[s].answer && separatedArray[s].answer !='' ) {
|
|
1860
|
+
let newAnswer = {};
|
|
1861
|
+
let validationAnswer = decodeURIComponent( separatedArray[s].answer.split( '?' )[0] );
|
|
1862
|
+
if ( validationAnswer.length ) {
|
|
1863
|
+
let splitImgUrl = validationAnswer.split( '/' );
|
|
1864
|
+
if ( splitImgUrl.length > 1 ) {
|
|
1865
|
+
splitImgUrl.splice( 0, 3 );
|
|
1866
|
+
newAnswer.answer = splitImgUrl.join( '/' ) || '';
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
newAnswer.answeroptionNumber = 0;
|
|
1870
|
+
newAnswer.sopFlag = false;
|
|
1871
|
+
newAnswer.validation = false;
|
|
1872
|
+
newAnswer.validationType = '';
|
|
1873
|
+
newAnswer.referenceImage = '';
|
|
1874
|
+
newAnswer.allowUploadfromGallery = false;
|
|
1875
|
+
newAnswer.descriptivetype = '';
|
|
1876
|
+
newAnswer.showLinked = false;
|
|
1877
|
+
newAnswer.linkedQuestion = 0;
|
|
1878
|
+
newAnswer.nestedQuestion = [];
|
|
1879
|
+
newAnswer.index = s;
|
|
1880
|
+
newAnswer.runAI = qaAnswers[j].answers[0]?.runAI || false;
|
|
1881
|
+
newAnswer.runAIFeatures = qaAnswers[j].answers[0]?.runAIFeatures || [];
|
|
1882
|
+
newAnswer.runAIDescription = qaAnswers[j].answers[0]?.runAIDescription || '';
|
|
1883
|
+
if ( separatedArray[s].answerType ) {
|
|
1884
|
+
newAnswer.answerType = separatedArray[s].answerType;
|
|
1885
|
+
}
|
|
1886
|
+
mcmi.push( newAnswer );
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
let structure = {};
|
|
1891
|
+
structure.qno = qaAnswers[j].qno;
|
|
1892
|
+
structure.qname = qaAnswers[j].qname;
|
|
1893
|
+
if ( qaAnswers[j].qcomment && qaAnswers[j].qcomment!='' ) {
|
|
1894
|
+
structure.qcomment = qaAnswers[j].qcomment;
|
|
1895
|
+
}
|
|
1896
|
+
structure.answerType = qaAnswers[j].answerType;
|
|
1897
|
+
structure.runAI = qaAnswers[j].runAI;
|
|
1898
|
+
structure.runAIDescription = qaAnswers[j].runAIDescription;
|
|
1899
|
+
structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
|
|
1900
|
+
structure.remarks = requestSection[i].remarks;
|
|
1901
|
+
structure.answers = qaAnswers[j].answers;
|
|
1902
|
+
structure.userAnswer = mcmi;
|
|
1903
|
+
structure.linkType = qaAnswers[j].linkType;
|
|
1904
|
+
structure.linkquestionenabled = requestSection[i].linkquestionenabled;
|
|
1905
|
+
structure.parentanswer = requestSection[i].parentanswer;
|
|
1906
|
+
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1907
|
+
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1908
|
+
if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
|
|
1909
|
+
structure.redo = false;
|
|
1910
|
+
} else if ( requestData.submittype === 'draft' ) {
|
|
1911
|
+
structure.redo = qaAnswers[j]?.redo;
|
|
1912
|
+
}
|
|
1913
|
+
if ( qaAnswers[j]?.redoComment ) {
|
|
1914
|
+
structure.redoComment = qaAnswers[j]?.redoComment;
|
|
1915
|
+
};
|
|
1916
|
+
newArray.push( structure );
|
|
1776
1917
|
} else {
|
|
1777
1918
|
let des = [];
|
|
1778
1919
|
if ( requestSection[i].answer != 'null' && requestSection[i].answer != '' && requestSection[i].answer != null ) {
|
|
@@ -4564,7 +4705,7 @@ export async function downloadChecklist( req, res ) {
|
|
|
4564
4705
|
let requestData = req.body;
|
|
4565
4706
|
|
|
4566
4707
|
if ( !requestData.checklistId ) {
|
|
4567
|
-
res.sendError( 'checklistId is Required' );
|
|
4708
|
+
return res.sendError( 'checklistId is Required', 400 );
|
|
4568
4709
|
}
|
|
4569
4710
|
|
|
4570
4711
|
let checklistDetails;
|
|
@@ -4616,18 +4757,18 @@ export async function downloadChecklist( req, res ) {
|
|
|
4616
4757
|
if ( answer?.referenceImage?.trim() ) {
|
|
4617
4758
|
answer.referenceImage = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.referenceImage;
|
|
4618
4759
|
}
|
|
4619
|
-
if (
|
|
4760
|
+
if ( [ 'Capture Image', 'Capture Video' ].includes( answer.validationType ) && answer?.validationAnswer?.trim() ) {
|
|
4620
4761
|
answer.validationAnswer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.validationAnswer;
|
|
4621
4762
|
}
|
|
4622
|
-
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
|
|
4763
|
+
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video', 'video' ].includes( question.answerType ) ) {
|
|
4623
4764
|
answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
|
|
4624
|
-
if ( question.answerType == 'multipleImage' ) {
|
|
4625
|
-
}
|
|
4626
4765
|
}
|
|
4627
4766
|
} );
|
|
4628
4767
|
} );
|
|
4629
4768
|
} );
|
|
4630
4769
|
|
|
4770
|
+
checklistDetails['validateType']=[ 'yes/no', 'descriptive', 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown', 'date', 'linearscale', 'time' ];
|
|
4771
|
+
|
|
4631
4772
|
const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/template.hbs', 'utf8' );
|
|
4632
4773
|
const template = handlebars.compile( templateHtml );
|
|
4633
4774
|
const html = template( { data: checklistDetails } );
|
|
@@ -4680,6 +4821,6 @@ export async function downloadChecklist( req, res ) {
|
|
|
4680
4821
|
return res.end( pdfBuffer );
|
|
4681
4822
|
} catch ( e ) {
|
|
4682
4823
|
logger.error( { functionName: 'getChecklistQuestionAnswers', error: e } );
|
|
4683
|
-
return res.sendError( e );
|
|
4824
|
+
return res.sendError( e, 500 );
|
|
4684
4825
|
}
|
|
4685
4826
|
}
|
package/src/hbs/template.hbs
CHANGED
|
@@ -198,124 +198,130 @@
|
|
|
198
198
|
</div>
|
|
199
199
|
{{#each questions}}
|
|
200
200
|
<div style="padding-bottom:20px">
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
{{#
|
|
206
|
-
{{#
|
|
207
|
-
{{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
{{/neq}}
|
|
201
|
+
{{#if userAnswer.length}}
|
|
202
|
+
<span class="question">{{qno}}.</span> <span class="question">{{qname}}</span>
|
|
203
|
+
{{#each userAnswer}}
|
|
204
|
+
<div class="px-4 answer">
|
|
205
|
+
{{#if (includes ../../../data.validateType ../answerType)}}
|
|
206
|
+
{{#eq sopFlag true }}
|
|
207
|
+
<span id="agreed" style="color:red">{{answer}}</span><br>
|
|
208
|
+
{{/eq}}
|
|
209
|
+
{{#eq sopFlag false }}
|
|
210
|
+
<span id="agreed">{{answer}}</span><br>
|
|
211
|
+
{{/eq}}
|
|
212
|
+
{{#neq validationAnswer ''}}
|
|
213
|
+
{{#eq validationType 'Capture Image'}}
|
|
214
|
+
<img src = "{{validationAnswer}}" alt="test" width="200" height="180">
|
|
215
|
+
{{/eq}}
|
|
216
|
+
{{#eq validationType 'Capture Video'}}
|
|
217
|
+
<a href="{{validationAnswer}}" target="_blank" style="text-decoration: underline;color:#0085D2" id="agreed">{{validationAnswer}}</a><br>
|
|
218
|
+
{{/eq}}
|
|
219
|
+
{{#eq validationType 'Descriptive Answer'}}
|
|
220
|
+
{{validationAnswer}}
|
|
221
|
+
{{/eq}}
|
|
223
222
|
{{/neq}}
|
|
224
|
-
{{/
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
223
|
+
{{/if}}
|
|
224
|
+
{{#eq ../answerType 'video'}}
|
|
225
|
+
<a href="{{answer}}" target="_blank" style="text-decoration: underline;color:#0085D2"
|
|
226
|
+
id="agreed">{{answer}}</a><br>
|
|
227
|
+
{{/eq}}
|
|
228
|
+
{{#eq ../answerType 'image'}}
|
|
229
|
+
{{!-- {{#each ../answers}} --}}
|
|
230
|
+
<table style="width:100%">
|
|
231
|
+
<tr>
|
|
232
|
+
{{#neq referenceImage ''}}
|
|
233
|
+
<td style="width:50%">
|
|
234
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
235
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
236
|
+
</div>
|
|
237
|
+
</td>
|
|
238
|
+
{{/neq}}
|
|
235
239
|
<td style="width:50%">
|
|
236
|
-
<div class="Reference"><span>
|
|
237
|
-
<img src="{{
|
|
240
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
241
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
238
242
|
</div>
|
|
239
243
|
</td>
|
|
240
|
-
|
|
244
|
+
</tr>
|
|
245
|
+
</table>
|
|
246
|
+
{{!-- {{/each}} --}}
|
|
247
|
+
{{/eq}}
|
|
248
|
+
{{#eq ../answerType 'multipleImage'}}
|
|
249
|
+
{{!-- {{#each ../answers}} --}}
|
|
250
|
+
<table style="width:100%">
|
|
251
|
+
<tr>
|
|
252
|
+
{{#neq referenceImage ''}}
|
|
253
|
+
<td style="width:50%">
|
|
254
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
255
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
256
|
+
</div>
|
|
257
|
+
</td>
|
|
258
|
+
{{/neq}}
|
|
259
|
+
<td style="width:50%">
|
|
260
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
261
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
262
|
+
</div>
|
|
263
|
+
</td>
|
|
264
|
+
</tr>
|
|
265
|
+
</table>
|
|
266
|
+
{{!-- {{/each}} --}}
|
|
267
|
+
{{/eq}}
|
|
268
|
+
{{#eq ../answerType 'image/video'}}
|
|
269
|
+
{{!-- {{#each ../answers}} --}}
|
|
270
|
+
<table style="width:100%">
|
|
271
|
+
<tr>
|
|
272
|
+
{{#neq referenceImage ''}}
|
|
273
|
+
<td style="width:50%">
|
|
274
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
275
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
276
|
+
</div>
|
|
277
|
+
</td>
|
|
278
|
+
{{/neq}}
|
|
279
|
+
{{#eq answerType 'image'}}
|
|
241
280
|
<td style="width:50%">
|
|
242
281
|
<div class="Reference"><span>Uploaded Image</span><br>
|
|
243
282
|
<img src="{{answer}}" width="200" height="180" />
|
|
244
283
|
</div>
|
|
245
284
|
</td>
|
|
246
|
-
|
|
247
|
-
|
|
285
|
+
{{/eq}}
|
|
286
|
+
{{#eq answerType 'video'}}
|
|
287
|
+
<td style="width:50%">
|
|
288
|
+
<a href="{{answer}}" target="_blank" style="text-decoration: underline;color:#0085D2" id="agreed">{{answer}}</a><br>
|
|
289
|
+
</td>
|
|
290
|
+
{{/eq}}
|
|
291
|
+
</tr>
|
|
292
|
+
</table>
|
|
248
293
|
{{!-- {{/each}} --}}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
{{
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
</div>
|
|
279
|
-
</td>
|
|
280
|
-
{{/neq}}
|
|
281
|
-
<td style="width:50%">
|
|
282
|
-
<div class="Reference"><span>Uploaded Image</span><br>
|
|
283
|
-
<img src="{{answer}}" width="200" height="180" />
|
|
284
|
-
</div>
|
|
285
|
-
</td>
|
|
286
|
-
</tr>
|
|
287
|
-
</table>
|
|
288
|
-
{{!-- {{/each}} --}}
|
|
289
|
-
{{/eq}}
|
|
290
|
-
{{#eq ../answerType 'descriptiveImage'}}
|
|
291
|
-
{{!-- {{#each ../answers}} --}}
|
|
292
|
-
<table style="width:100%">
|
|
293
|
-
<tr>
|
|
294
|
-
{{#neq referenceImage ''}}
|
|
295
|
-
<td style="width:50%">
|
|
296
|
-
<div class="Reference"><span>Reference Image</span><br>
|
|
297
|
-
<img src="{{referenceImage}}" width="200" height="180" />
|
|
298
|
-
</div>
|
|
299
|
-
</td>
|
|
300
|
-
{{/neq}}
|
|
301
|
-
<td style="width:50%">
|
|
302
|
-
<div class="Reference"><span>Uploaded Image</span><br>
|
|
303
|
-
<img src="{{answer}}" width="200" height="180" />
|
|
304
|
-
</div>
|
|
305
|
-
</td>
|
|
306
|
-
</tr>
|
|
307
|
-
</table>
|
|
308
|
-
{{!-- {{/each}} --}}
|
|
309
|
-
{{/eq}}
|
|
310
|
-
</div>
|
|
311
|
-
{{/each}}
|
|
312
|
-
{{#neq answerType 'descriptive'}}
|
|
313
|
-
{{#neq remarks ''}}
|
|
314
|
-
<div class="mt-8">
|
|
315
|
-
<span id="remarks">Remarks: {{remarks}}</span><br>
|
|
316
|
-
</div>
|
|
294
|
+
{{/eq}}
|
|
295
|
+
{{#eq ../answerType 'descriptiveImage'}}
|
|
296
|
+
{{!-- {{#each ../answers}} --}}
|
|
297
|
+
<table style="width:100%">
|
|
298
|
+
<tr>
|
|
299
|
+
{{#neq referenceImage ''}}
|
|
300
|
+
<td style="width:50%">
|
|
301
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
302
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
303
|
+
</div>
|
|
304
|
+
</td>
|
|
305
|
+
{{/neq}}
|
|
306
|
+
<td style="width:50%">
|
|
307
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
308
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
309
|
+
</div>
|
|
310
|
+
</td>
|
|
311
|
+
</tr>
|
|
312
|
+
</table>
|
|
313
|
+
{{!-- {{/each}} --}}
|
|
314
|
+
{{/eq}}
|
|
315
|
+
</div>
|
|
316
|
+
{{/each}}
|
|
317
|
+
{{#neq answerType 'descriptive'}}
|
|
318
|
+
{{#neq remarks ''}}
|
|
319
|
+
<div class="mt-8">
|
|
320
|
+
<span id="remarks">Remarks: {{remarks}}</span><br>
|
|
321
|
+
</div>
|
|
322
|
+
{{/neq}}
|
|
317
323
|
{{/neq}}
|
|
318
|
-
{{/
|
|
324
|
+
{{/if}}
|
|
319
325
|
</div>
|
|
320
326
|
{{/each}}
|
|
321
327
|
</div>
|