tango-app-api-trax 3.7.71 → 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 );
|
|
@@ -4705,7 +4705,7 @@ export async function downloadChecklist( req, res ) {
|
|
|
4705
4705
|
let requestData = req.body;
|
|
4706
4706
|
|
|
4707
4707
|
if ( !requestData.checklistId ) {
|
|
4708
|
-
res.sendError( 'checklistId is Required' );
|
|
4708
|
+
return res.sendError( 'checklistId is Required', 400 );
|
|
4709
4709
|
}
|
|
4710
4710
|
|
|
4711
4711
|
let checklistDetails;
|
|
@@ -4757,18 +4757,18 @@ export async function downloadChecklist( req, res ) {
|
|
|
4757
4757
|
if ( answer?.referenceImage?.trim() ) {
|
|
4758
4758
|
answer.referenceImage = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.referenceImage;
|
|
4759
4759
|
}
|
|
4760
|
-
if (
|
|
4760
|
+
if ( [ 'Capture Image', 'Capture Video' ].includes( answer.validationType ) && answer?.validationAnswer?.trim() ) {
|
|
4761
4761
|
answer.validationAnswer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.validationAnswer;
|
|
4762
4762
|
}
|
|
4763
|
-
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 ) ) {
|
|
4764
4764
|
answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
|
|
4765
|
-
if ( question.answerType == 'multipleImage' ) {
|
|
4766
|
-
}
|
|
4767
4765
|
}
|
|
4768
4766
|
} );
|
|
4769
4767
|
} );
|
|
4770
4768
|
} );
|
|
4771
4769
|
|
|
4770
|
+
checklistDetails['validateType']=[ 'yes/no', 'descriptive', 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown', 'date', 'linearscale', 'time' ];
|
|
4771
|
+
|
|
4772
4772
|
const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/template.hbs', 'utf8' );
|
|
4773
4773
|
const template = handlebars.compile( templateHtml );
|
|
4774
4774
|
const html = template( { data: checklistDetails } );
|
|
@@ -4821,6 +4821,6 @@ export async function downloadChecklist( req, res ) {
|
|
|
4821
4821
|
return res.end( pdfBuffer );
|
|
4822
4822
|
} catch ( e ) {
|
|
4823
4823
|
logger.error( { functionName: 'getChecklistQuestionAnswers', error: e } );
|
|
4824
|
-
return res.sendError( e );
|
|
4824
|
+
return res.sendError( e, 500 );
|
|
4825
4825
|
}
|
|
4826
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>
|