tango-app-api-trax 3.7.53 → 3.7.54
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
|
@@ -3237,6 +3237,7 @@ export async function questionList( req, res ) {
|
|
|
3237
3237
|
startTime: { $ifNull: [ '$startTime', '' ] },
|
|
3238
3238
|
submitTime: { $ifNull: [ '$submitTime', '' ] },
|
|
3239
3239
|
allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
|
|
3240
|
+
sourceCheckList_id: 1,
|
|
3240
3241
|
// allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
|
|
3241
3242
|
allowedStoreLocation: {
|
|
3242
3243
|
$cond: {
|
|
@@ -3292,7 +3293,7 @@ export async function questionList( req, res ) {
|
|
|
3292
3293
|
}
|
|
3293
3294
|
|
|
3294
3295
|
for ( let [ ansIndex, answer ] of question.answers.entries() ) {
|
|
3295
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3296
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3296
3297
|
let checkvalidation = null;
|
|
3297
3298
|
if ( answer.validationAnswer && answer.validationAnswer !='' ) {
|
|
3298
3299
|
if ( answer.validationType != 'Descriptive Answer' ) {
|
|
@@ -3346,7 +3347,7 @@ export async function questionList( req, res ) {
|
|
|
3346
3347
|
getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].multiReferenceImage = userAns.multiReferenceImage;
|
|
3347
3348
|
}
|
|
3348
3349
|
|
|
3349
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3350
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3350
3351
|
let ansIndex = Multianswer.findIndex( ( item ) => item.answer == userAns.answer );
|
|
3351
3352
|
if ( ansIndex ) {
|
|
3352
3353
|
Multianswer[ansIndex].validationAnswer = userAns.validationAnswer;
|
|
@@ -3363,7 +3364,7 @@ export async function questionList( req, res ) {
|
|
|
3363
3364
|
}
|
|
3364
3365
|
}
|
|
3365
3366
|
}
|
|
3366
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
3367
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
3367
3368
|
Multianswer.forEach( ( item ) => {
|
|
3368
3369
|
if ( item.validationAnswer == null ) {
|
|
3369
3370
|
item.answer = null;
|
|
@@ -3424,6 +3425,11 @@ export async function questionList( req, res ) {
|
|
|
3424
3425
|
}
|
|
3425
3426
|
}
|
|
3426
3427
|
|
|
3428
|
+
let checklisDetails = await checklistService.findOne( { _id: getchecklist?.[0]?.sourceCheckList_id }, { export: 1 } );
|
|
3429
|
+
if ( checklisDetails ) {
|
|
3430
|
+
getchecklist[0]['export'] = checklisDetails.export;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3427
3433
|
return res.sendSuccess( getchecklist );
|
|
3428
3434
|
}
|
|
3429
3435
|
} catch ( e ) {
|
|
@@ -4245,6 +4251,7 @@ export async function questionListV1( req, res ) {
|
|
|
4245
4251
|
startTime: { $ifNull: [ '$startTime', '' ] },
|
|
4246
4252
|
submitTime: { $ifNull: [ '$submitTime', '' ] },
|
|
4247
4253
|
allowedOverTime: { $ifNull: [ '$allowedOverTime', '' ] },
|
|
4254
|
+
sourceCheckList_id: { $ifNull: [ '$sourceCheckList_id', '' ] },
|
|
4248
4255
|
// allowedStoreLocation: { $ifNull: [ '$allowedStoreLocation', '' ] },
|
|
4249
4256
|
allowedStoreLocation: {
|
|
4250
4257
|
$cond: {
|
|
@@ -4300,7 +4307,7 @@ export async function questionListV1( req, res ) {
|
|
|
4300
4307
|
}
|
|
4301
4308
|
|
|
4302
4309
|
for ( let [ ansIndex, answer ] of question.answers.entries() ) {
|
|
4303
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
4310
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
4304
4311
|
let checkvalidation = null;
|
|
4305
4312
|
if ( answer.validationAnswer && answer.validationAnswer !='' ) {
|
|
4306
4313
|
if ( answer.validationType != 'Descriptive Answer' ) {
|
|
@@ -4352,7 +4359,7 @@ export async function questionListV1( req, res ) {
|
|
|
4352
4359
|
|
|
4353
4360
|
getchecklist[0].questionAnswers[secIndex].questions[questionIndex].userAnswer[userAnsIndex].multiReferenceImage = userAns.multiReferenceImage;
|
|
4354
4361
|
}
|
|
4355
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
4362
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
4356
4363
|
let ansIndex = Multianswer.findIndex( ( item ) => item.answer == userAns.answer );
|
|
4357
4364
|
if ( ansIndex ) {
|
|
4358
4365
|
Multianswer[ansIndex].validationAnswer = userAns.validationAnswer;
|
|
@@ -4368,7 +4375,7 @@ export async function questionListV1( req, res ) {
|
|
|
4368
4375
|
}
|
|
4369
4376
|
}
|
|
4370
4377
|
}
|
|
4371
|
-
if ( question.answerType == 'multiplechoicemultiple' ) {
|
|
4378
|
+
if ( question.answerType == 'multiplechoicemultiple' || ( question.answerType == 'dropdown' && question.allowMultiple ) ) {
|
|
4372
4379
|
Multianswer.forEach( ( item ) => {
|
|
4373
4380
|
if ( item.validationAnswer == null ) {
|
|
4374
4381
|
item.answer = null;
|
|
@@ -4429,6 +4436,11 @@ export async function questionListV1( req, res ) {
|
|
|
4429
4436
|
}
|
|
4430
4437
|
}
|
|
4431
4438
|
|
|
4439
|
+
let checklisDetails = await checklistService.findOne( { _id: getchecklist?.[0]?.sourceCheckList_id }, { export: 1 } );
|
|
4440
|
+
if ( checklisDetails ) {
|
|
4441
|
+
getchecklist[0]['export'] = checklisDetails.export;
|
|
4442
|
+
}
|
|
4443
|
+
|
|
4432
4444
|
return res.sendSuccess( getchecklist );
|
|
4433
4445
|
}
|
|
4434
4446
|
} catch ( e ) {
|
|
@@ -4508,6 +4520,10 @@ export async function downloadChecklist( req, res ) {
|
|
|
4508
4520
|
checklistDetails = await processedTask.findOne( { _id: requestData.checklistId, checklistStatus: 'submit' } );
|
|
4509
4521
|
}
|
|
4510
4522
|
|
|
4523
|
+
if ( !checklistDetails ) {
|
|
4524
|
+
return res.sendError( 'No data found', 204 );
|
|
4525
|
+
}
|
|
4526
|
+
|
|
4511
4527
|
let storeDetails = await storeService.findOne( { storeId: checklistDetails.store_id }, { storeProfile: 1 } );
|
|
4512
4528
|
if ( !storeDetails ) {
|
|
4513
4529
|
return res.sendError( 'No data found', 204 );
|
|
@@ -4521,31 +4537,29 @@ export async function downloadChecklist( req, res ) {
|
|
|
4521
4537
|
|
|
4522
4538
|
checklistDetails = { ...checklistDetails.toObject(), ...storeDetails?.toObject()?.storeProfile };
|
|
4523
4539
|
|
|
4524
|
-
console.log( checklistDetails );
|
|
4525
4540
|
|
|
4526
4541
|
let scheduleDateTime = dayjs( checklistDetails.submitTime );
|
|
4527
4542
|
checklistDetails.submitDate = scheduleDateTime.format( 'DD MMM, YYYY' );
|
|
4528
4543
|
checklistDetails.submitTime = scheduleDateTime.format( 'hh:mm A' );
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
// checklistDetails.brandName = checklistDetails.brandDetails.brandName;
|
|
4544
|
+
if ( clientDetails?.profileDetails?.logo ) {
|
|
4545
|
+
let bucketpath = checklistDetails.client_id + '/logo';
|
|
4546
|
+
|
|
4547
|
+
let params = {
|
|
4548
|
+
Bucket: JSON.parse( process.env.BUCKET )?.assets,
|
|
4549
|
+
file_path: `${bucketpath}/${clientDetails?.profileDetails?.logo}`,
|
|
4550
|
+
};
|
|
4551
|
+
let url = await signedUrl( params );
|
|
4552
|
+
let brandImage = await convertUrltoBase64( url );
|
|
4553
|
+
if ( brandImage ) {
|
|
4554
|
+
checklistDetails['brandLogo'] = brandImage;
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
checklistDetails['brandName'] = clientDetails?.clientName;
|
|
4544
4558
|
for ( let section of checklistDetails.questionAnswers ) {
|
|
4545
4559
|
for ( let question of section.questions ) {
|
|
4546
4560
|
question.remarks = question.remarks == null || question.remarks == 'null' ? '' : question.remarks;
|
|
4547
4561
|
for ( let answer of question.userAnswer ) {
|
|
4548
|
-
if ( answer
|
|
4562
|
+
if ( answer?.referenceImage?.trim() ) {
|
|
4549
4563
|
let inputData = {
|
|
4550
4564
|
Bucket: JSON.parse( process.env.BUCKET )?.sop,
|
|
4551
4565
|
file_path: answer.referenceImage,
|
|
@@ -4556,7 +4570,7 @@ export async function downloadChecklist( req, res ) {
|
|
|
4556
4570
|
answer.referenceImage = base64Image;
|
|
4557
4571
|
}
|
|
4558
4572
|
}
|
|
4559
|
-
if ( answer.validationType == 'Capture Image' && answer
|
|
4573
|
+
if ( answer.validationType == 'Capture Image' && answer?.validationAnswer?.trim() ) {
|
|
4560
4574
|
let inputData = {
|
|
4561
4575
|
Bucket: JSON.parse( process.env.BUCKET )?.sop,
|
|
4562
4576
|
file_path: answer.validationAnswer,
|
|
@@ -4567,7 +4581,7 @@ export async function downloadChecklist( req, res ) {
|
|
|
4567
4581
|
answer.validationAnswer = base64Image;
|
|
4568
4582
|
}
|
|
4569
4583
|
}
|
|
4570
|
-
if ( answer
|
|
4584
|
+
if ( answer?.answer?.trim() && [ 'image', 'descriptiveImage', 'multipleImage', 'image/video' ].includes( question.answerType ) ) {
|
|
4571
4585
|
let inputData = {
|
|
4572
4586
|
Bucket: JSON.parse( process.env.BUCKET )?.sop,
|
|
4573
4587
|
file_path: answer.answer,
|
|
@@ -4093,7 +4093,7 @@ async function updateOpenSearch( user, data ) {
|
|
|
4093
4093
|
export const aiChecklist = async ( req, res ) => {
|
|
4094
4094
|
try {
|
|
4095
4095
|
let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
|
|
4096
|
-
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ];
|
|
4096
|
+
let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'boxalert', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ];
|
|
4097
4097
|
let checklistDetails = [];
|
|
4098
4098
|
let publishList = [];
|
|
4099
4099
|
let unpublishList = [];
|
|
@@ -4106,7 +4106,7 @@ export const aiChecklist = async ( req, res ) => {
|
|
|
4106
4106
|
checklistDetails = [ ...publishList, ...unpublishList ];
|
|
4107
4107
|
|
|
4108
4108
|
checklistDetails.forEach( ( item ) => {
|
|
4109
|
-
if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering','queuealert' ].includes( item.checkListType ) ) {
|
|
4109
|
+
if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert' ].includes( item.checkListType ) ) {
|
|
4110
4110
|
item.storeCount = storeDetails;
|
|
4111
4111
|
}
|
|
4112
4112
|
} );
|
package/src/hbs/template.hbs
CHANGED
|
@@ -204,18 +204,20 @@
|
|
|
204
204
|
{{#neq ../answerType 'video'}}
|
|
205
205
|
{{#neq ../answerType 'image'}}
|
|
206
206
|
{{#neq ../answerType 'descriptiveImage'}}
|
|
207
|
-
{{#
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
{{#eq sopFlag false }}
|
|
211
|
-
<span id="agreed">{{answer}}</span><br>
|
|
212
|
-
{{/eq}}
|
|
213
|
-
{{#neq validationAnswer ''}}
|
|
214
|
-
{{#eq validationType 'Capture Image'}}
|
|
215
|
-
<img src = "{{validationAnswer}}" alt="test" width="200" height="180">
|
|
207
|
+
{{#neq ../answerType 'multipleImage'}}
|
|
208
|
+
{{#eq sopFlag true }}
|
|
209
|
+
<span id="agreed" style="color:red">{{answer}}</span><br>
|
|
216
210
|
{{/eq}}
|
|
217
|
-
{{#
|
|
218
|
-
{{
|
|
211
|
+
{{#eq sopFlag false }}
|
|
212
|
+
<span id="agreed">{{answer}}</span><br>
|
|
213
|
+
{{/eq}}
|
|
214
|
+
{{#neq validationAnswer ''}}
|
|
215
|
+
{{#eq validationType 'Capture Image'}}
|
|
216
|
+
<img src = "{{validationAnswer}}" alt="test" width="200" height="180">
|
|
217
|
+
{{/eq}}
|
|
218
|
+
{{#neq validationType 'Capture Image'}}
|
|
219
|
+
{{validationAnswer}}
|
|
220
|
+
{{/neq}}
|
|
219
221
|
{{/neq}}
|
|
220
222
|
{{/neq}}
|
|
221
223
|
{{/neq}}
|
|
@@ -245,6 +247,46 @@
|
|
|
245
247
|
</table>
|
|
246
248
|
{{!-- {{/each}} --}}
|
|
247
249
|
{{/eq}}
|
|
250
|
+
{{#eq ../answerType 'multipleImage'}}
|
|
251
|
+
{{!-- {{#each ../answers}} --}}
|
|
252
|
+
<table style="width:100%">
|
|
253
|
+
<tr>
|
|
254
|
+
{{#neq referenceImage ''}}
|
|
255
|
+
<td style="width:50%">
|
|
256
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
257
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
258
|
+
</div>
|
|
259
|
+
</td>
|
|
260
|
+
{{/neq}}
|
|
261
|
+
<td style="width:50%">
|
|
262
|
+
<div class="Reference"><span>Uploaded Image</span><br>
|
|
263
|
+
<img src="{{answer}}" width="200" height="180" />
|
|
264
|
+
</div>
|
|
265
|
+
</td>
|
|
266
|
+
</tr>
|
|
267
|
+
</table>
|
|
268
|
+
{{!-- {{/each}} --}}
|
|
269
|
+
{{/eq}}
|
|
270
|
+
{{#eq ../answerType 'image/video'}}
|
|
271
|
+
{{!-- {{#each ../answers}} --}}
|
|
272
|
+
<table style="width:100%">
|
|
273
|
+
<tr>
|
|
274
|
+
{{#neq referenceImage ''}}
|
|
275
|
+
<td style="width:50%">
|
|
276
|
+
<div class="Reference"><span>Reference Image</span><br>
|
|
277
|
+
<img src="{{referenceImage}}" width="200" height="180" />
|
|
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}}
|
|
248
290
|
{{#eq ../answerType 'descriptiveImage'}}
|
|
249
291
|
{{!-- {{#each ../answers}} --}}
|
|
250
292
|
<table style="width:100%">
|