tango-app-api-trax 3.7.71 → 3.7.73
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 );
|
|
@@ -2182,7 +2182,7 @@ export async function submitChecklist( req, res ) {
|
|
|
2182
2182
|
flagCount: updateData.questionFlag,
|
|
2183
2183
|
checklistName: getchecklist[0].checkListName,
|
|
2184
2184
|
submittedBy: getchecklist[0].userName,
|
|
2185
|
-
time: updateData.
|
|
2185
|
+
time: updateData.submitTime_string,
|
|
2186
2186
|
domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags`,
|
|
2187
2187
|
};
|
|
2188
2188
|
const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
|
|
@@ -3826,6 +3826,7 @@ export async function taskQuestionList( req, res ) {
|
|
|
3826
3826
|
} else {
|
|
3827
3827
|
logger.info( `v5 => Task Continue => store Name: ${getchecklist[0].storeName}, User Email: ${getchecklist[0].userEmail}, Task Name: ${getchecklist[0].checkListName}` );
|
|
3828
3828
|
let bucket = JSON.parse( process.env.BUCKET );
|
|
3829
|
+
let cdnurl = JSON.parse( process.env.CDNURL );
|
|
3829
3830
|
for ( let [ secIndex, section ] of getchecklist[0].questionAnswers.entries() ) {
|
|
3830
3831
|
for ( let [ questionIndex, question ] of section.questions.entries() ) {
|
|
3831
3832
|
let Multianswer = [];
|
|
@@ -3910,7 +3911,7 @@ export async function taskQuestionList( req, res ) {
|
|
|
3910
3911
|
}
|
|
3911
3912
|
if ( question.answerType == 'multipleImage' || question.answerType == 'image/video' ) {
|
|
3912
3913
|
if ( userAns && userAns.answer && userAns.answer != '' ) {
|
|
3913
|
-
let manswer =
|
|
3914
|
+
let manswer = `${cdnurl.TraxAnswerCDN}${userAns.answer}`;
|
|
3914
3915
|
Multianswer.push( { 'answer': manswer, 'no': userAnsIndex, 'validationAnswer': '', ...( question.answerType == 'image/video' && { answerType: userAns?.answerType } ) } );
|
|
3915
3916
|
} else {
|
|
3916
3917
|
|
|
@@ -4705,7 +4706,7 @@ export async function downloadChecklist( req, res ) {
|
|
|
4705
4706
|
let requestData = req.body;
|
|
4706
4707
|
|
|
4707
4708
|
if ( !requestData.checklistId ) {
|
|
4708
|
-
res.sendError( 'checklistId is Required' );
|
|
4709
|
+
return res.sendError( 'checklistId is Required', 400 );
|
|
4709
4710
|
}
|
|
4710
4711
|
|
|
4711
4712
|
let checklistDetails;
|
|
@@ -4757,18 +4758,18 @@ export async function downloadChecklist( req, res ) {
|
|
|
4757
4758
|
if ( answer?.referenceImage?.trim() ) {
|
|
4758
4759
|
answer.referenceImage = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.referenceImage;
|
|
4759
4760
|
}
|
|
4760
|
-
if (
|
|
4761
|
+
if ( [ 'Capture Image', 'Capture Video' ].includes( answer.validationType ) && answer?.validationAnswer?.trim() ) {
|
|
4761
4762
|
answer.validationAnswer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.validationAnswer;
|
|
4762
4763
|
}
|
|
4763
|
-
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
|
|
4764
|
+
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video', 'video' ].includes( question.answerType ) ) {
|
|
4764
4765
|
answer.answer = 'https://d1r0hc2sskgmri.cloudfront.net/'+answer.answer;
|
|
4765
|
-
if ( question.answerType == 'multipleImage' ) {
|
|
4766
|
-
}
|
|
4767
4766
|
}
|
|
4768
4767
|
} );
|
|
4769
4768
|
} );
|
|
4770
4769
|
} );
|
|
4771
4770
|
|
|
4771
|
+
checklistDetails['validateType']=[ 'yes/no', 'descriptive', 'multiplechoicesingle', 'multiplechoicemultiple', 'dropdown', 'date', 'linearscale', 'time' ];
|
|
4772
|
+
|
|
4772
4773
|
const templateHtml = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/template.hbs', 'utf8' );
|
|
4773
4774
|
const template = handlebars.compile( templateHtml );
|
|
4774
4775
|
const html = template( { data: checklistDetails } );
|
|
@@ -4821,6 +4822,6 @@ export async function downloadChecklist( req, res ) {
|
|
|
4821
4822
|
return res.end( pdfBuffer );
|
|
4822
4823
|
} catch ( e ) {
|
|
4823
4824
|
logger.error( { functionName: 'getChecklistQuestionAnswers', error: e } );
|
|
4824
|
-
return res.sendError( e );
|
|
4825
|
+
return res.sendError( e, 500 );
|
|
4825
4826
|
}
|
|
4826
4827
|
}
|
package/src/hbs/template.hbs
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
<head>
|
|
5
5
|
<title>{{data.checkListName}}</title>
|
|
6
6
|
<style type="text/css">
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
font-family: Inter !important;
|
|
10
|
+
}
|
|
7
11
|
.pdffile {
|
|
8
12
|
position: relative;
|
|
9
13
|
font-family: Inter !important;
|
|
@@ -198,124 +202,130 @@
|
|
|
198
202
|
</div>
|
|
199
203
|
{{#each questions}}
|
|
200
204
|
<div style="padding-bottom:20px">
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
{{#
|
|
206
|
-
{{#
|
|
207
|
-
{{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{{
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
205
|
+
{{#if userAnswer.length}}
|
|
206
|
+
<span class="question">{{qno}}.</span> <span class="question">{{qname}}</span>
|
|
207
|
+
{{#each userAnswer}}
|
|
208
|
+
<div class="px-4 answer">
|
|
209
|
+
{{#if (includes ../../../data.validateType ../answerType)}}
|
|
210
|
+
{{#eq sopFlag true }}
|
|
211
|
+
<span id="agreed" style="color:red">{{answer}}</span><br>
|
|
212
|
+
{{/eq}}
|
|
213
|
+
{{#eq sopFlag false }}
|
|
214
|
+
<span id="agreed">{{answer}}</span><br>
|
|
215
|
+
{{/eq}}
|
|
216
|
+
{{#eq validation true}}
|
|
217
|
+
{{#eq validationType 'Capture Image'}}
|
|
218
|
+
<img src = "{{validationAnswer}}" alt="test" width="200" height="180">
|
|
219
|
+
{{/eq}}
|
|
220
|
+
{{#eq validationType 'Capture Video'}}
|
|
221
|
+
<a href="{{validationAnswer}}" target="_blank" style="text-decoration: underline;color:#0085D2" id="agreed">{{validationAnswer}}</a><br>
|
|
222
|
+
{{/eq}}
|
|
223
|
+
{{#eq validationType 'Descriptive Answer'}}
|
|
224
|
+
{{validationAnswer}}
|
|
225
|
+
{{/eq}}
|
|
226
|
+
{{/eq}}
|
|
227
|
+
{{/if}}
|
|
228
|
+
{{#eq ../answerType 'video'}}
|
|
229
|
+
<a href="{{answer}}" target="_blank" style="text-decoration: underline;color:#0085D2"
|
|
230
|
+
id="agreed">{{answer}}</a><br>
|
|
231
|
+
{{/eq}}
|
|
232
|
+
{{#eq ../answerType 'image'}}
|
|
233
|
+
{{!-- {{#each ../answers}} --}}
|
|
234
|
+
<table style="width:100%">
|
|
235
|
+
<tr>
|
|
236
|
+
{{#neq referenceImage ''}}
|
|
237
|
+
<td style="width:50%">
|
|
238
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
239
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
240
|
+
</div>
|
|
241
|
+
</td>
|
|
220
242
|
{{/neq}}
|
|
221
|
-
{{/neq}}
|
|
222
|
-
{{/neq}}
|
|
223
|
-
{{/neq}}
|
|
224
|
-
{{/neq}}
|
|
225
|
-
{{/neq}}
|
|
226
|
-
{{#eq ../answerType 'video'}}
|
|
227
|
-
<a href="{{answer}}" target="_blank" style="text-decoration: underline;color:#0085D2"
|
|
228
|
-
id="agreed">{{answer}}</a><br>
|
|
229
|
-
{{/eq}}
|
|
230
|
-
{{#eq ../answerType 'image'}}
|
|
231
|
-
{{!-- {{#each ../answers}} --}}
|
|
232
|
-
<table style="width:100%">
|
|
233
|
-
<tr>
|
|
234
|
-
{{#neq referenceImage ''}}
|
|
235
243
|
<td style="width:50%">
|
|
236
|
-
<div class="Reference"><span>
|
|
237
|
-
<img src="{{
|
|
244
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
245
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
238
246
|
</div>
|
|
239
247
|
</td>
|
|
240
|
-
|
|
248
|
+
</tr>
|
|
249
|
+
</table>
|
|
250
|
+
{{!-- {{/each}} --}}
|
|
251
|
+
{{/eq}}
|
|
252
|
+
{{#eq ../answerType 'multipleImage'}}
|
|
253
|
+
{{!-- {{#each ../answers}} --}}
|
|
254
|
+
<table style="width:100%">
|
|
255
|
+
<tr>
|
|
256
|
+
{{#neq referenceImage ''}}
|
|
257
|
+
<td style="width:50%">
|
|
258
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
259
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
260
|
+
</div>
|
|
261
|
+
</td>
|
|
262
|
+
{{/neq}}
|
|
263
|
+
<td style="width:50%">
|
|
264
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
265
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
266
|
+
</div>
|
|
267
|
+
</td>
|
|
268
|
+
</tr>
|
|
269
|
+
</table>
|
|
270
|
+
{{!-- {{/each}} --}}
|
|
271
|
+
{{/eq}}
|
|
272
|
+
{{#eq ../answerType 'image/video'}}
|
|
273
|
+
{{!-- {{#each ../answers}} --}}
|
|
274
|
+
<table style="width:100%">
|
|
275
|
+
<tr>
|
|
276
|
+
{{#neq referenceImage ''}}
|
|
277
|
+
<td style="width:50%">
|
|
278
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
279
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
280
|
+
</div>
|
|
281
|
+
</td>
|
|
282
|
+
{{/neq}}
|
|
283
|
+
{{#eq answerType 'image'}}
|
|
241
284
|
<td style="width:50%">
|
|
242
285
|
<div class="Reference"><span>Uploaded Image</span><br>
|
|
243
286
|
<img src="{{answer}}" width="200" height="180" />
|
|
244
287
|
</div>
|
|
245
288
|
</td>
|
|
246
|
-
|
|
247
|
-
|
|
289
|
+
{{/eq}}
|
|
290
|
+
{{#eq answerType 'video'}}
|
|
291
|
+
<td style="width:50%">
|
|
292
|
+
<a href="{{answer}}" target="_blank" style="text-decoration: underline;color:#0085D2" id="agreed">{{answer}}</a><br>
|
|
293
|
+
</td>
|
|
294
|
+
{{/eq}}
|
|
295
|
+
</tr>
|
|
296
|
+
</table>
|
|
248
297
|
{{!-- {{/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>
|
|
298
|
+
{{/eq}}
|
|
299
|
+
{{#eq ../answerType 'descriptiveImage'}}
|
|
300
|
+
{{!-- {{#each ../answers}} --}}
|
|
301
|
+
<table style="width:100%">
|
|
302
|
+
<tr>
|
|
303
|
+
{{#neq referenceImage ''}}
|
|
304
|
+
<td style="width:50%">
|
|
305
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
306
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
307
|
+
</div>
|
|
308
|
+
</td>
|
|
309
|
+
{{/neq}}
|
|
310
|
+
<td style="width:50%">
|
|
311
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
312
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
313
|
+
</div>
|
|
314
|
+
</td>
|
|
315
|
+
</tr>
|
|
316
|
+
</table>
|
|
317
|
+
{{!-- {{/each}} --}}
|
|
318
|
+
{{/eq}}
|
|
319
|
+
</div>
|
|
320
|
+
{{/each}}
|
|
321
|
+
{{#neq answerType 'descriptive'}}
|
|
322
|
+
{{#neq remarks ''}}
|
|
323
|
+
<div class="mt-8">
|
|
324
|
+
<span id="remarks">Remarks: {{remarks}}</span><br>
|
|
325
|
+
</div>
|
|
326
|
+
{{/neq}}
|
|
317
327
|
{{/neq}}
|
|
318
|
-
{{/
|
|
328
|
+
{{/if}}
|
|
319
329
|
</div>
|
|
320
330
|
{{/each}}
|
|
321
331
|
</div>
|