tango-app-api-trax 3.2.0-beta.1 → 3.2.0-beta.10

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.0-beta.10",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -27,7 +27,7 @@
27
27
  "nodemon": "^3.1.4",
28
28
  "path": "^0.12.7",
29
29
  "tango-api-schema": "^2.2.16",
30
- "tango-app-api-middleware": "^3.1.48",
30
+ "tango-app-api-middleware": "^3.1.50",
31
31
  "url": "^0.11.4",
32
32
  "winston": "^3.13.1",
33
33
  "winston-daily-rotate-file": "^5.0.0"
@@ -371,6 +371,13 @@ export async function redoChecklist( req, res ) {
371
371
 
372
372
  let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
373
373
  if ( response.modifiedCount || response.matchedCount ) {
374
+ let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
375
+ let currentDateTime;
376
+ if ( storeTimeZone?.storeProfile?.timeZone ) {
377
+ currentDateTime = dayjs().tz( storeTimeZone?.storeProfile?.timeZone );
378
+ } else {
379
+ currentDateTime = dayjs();
380
+ }
374
381
  data = {
375
382
  checklistId: checklistDetails.sourceCheckList_id,
376
383
  checkListName: checklistDetails.checkListName,
@@ -386,7 +393,7 @@ export async function redoChecklist( req, res ) {
386
393
  type: checklistDetails.checkListType,
387
394
  userAnswer: userAnswer,
388
395
  initiatedBy: req.user.userName,
389
- initiatedTime: dayjs().format(),
396
+ initiatedTime: dayjs.utc( currentDateTime.format( 'hh:mm:ss A, DD MMM YYYY' ), 'hh:mm:ss A, DD MMM YYYY' ).format(),
390
397
  answerType: question[sectionIndex].questions[req.body.payload.qno - 1].answerType,
391
398
  submitedBy: checklistDetails.userName,
392
399
  submitTime: checklistDetails.submitTime,
@@ -11,6 +11,7 @@ import * as storeService from '../services/store.service.js';
11
11
  import * as userService from '../services/user.service.js';
12
12
  import * as clientService from '../services/clients.services.js';
13
13
  import * as processedTaskService from '../services/processedTaskList.service.js';
14
+ import * as taskService from '../services/taskConfig.service.js';
14
15
  import dayjs from 'dayjs';
15
16
  import customParseFormat from 'dayjs/plugin/customParseFormat.js';
16
17
  import timeZone from 'dayjs/plugin/timezone.js';
@@ -299,7 +300,7 @@ async function insertData( requestData ) {
299
300
  },
300
301
  } );
301
302
  let getSections = await CLquestions.aggregate( sectionQuery );
302
- if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle' ].includes( getCLconfig.checkListType ) ) {
303
+ if ( getSections.length || [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring' ].includes( getCLconfig.checkListType ) ) {
303
304
  if ( getSections.length ) {
304
305
  for ( let element3 of getSections ) {
305
306
  let collectQuestions = {};
@@ -441,7 +442,7 @@ async function insertData( requestData ) {
441
442
  // }
442
443
  }
443
444
  } else {
444
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle' ].includes( getCLconfig.checkListType ) ) {
445
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring' ].includes( getCLconfig.checkListType ) ) {
445
446
  let storeDetails = await storeService.find( { clientId: getCLconfig.client_id, status: 'active' }, { storeId: 1 } );
446
447
  let data = {
447
448
  checkListId: updatedchecklist._id,
@@ -1280,7 +1281,7 @@ export async function taskPushNotification( req, res ) {
1280
1281
  let query = [ {
1281
1282
  $match: {
1282
1283
  date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
1283
- $expr: { $gt: [ { $size: '$remainder' }, 0 ] },
1284
+ // $expr: { $gt: [ { $size: '$remainder' }, 0 ] },
1284
1285
  checklistStatus: { $ne: 'submit' },
1285
1286
  },
1286
1287
  } ];
@@ -1306,6 +1307,7 @@ export async function taskPushNotification( req, res ) {
1306
1307
  scheduleEndTime: 1,
1307
1308
  remainder: 1,
1308
1309
  checkListType: 1,
1310
+ sourceCheckList_id: 1,
1309
1311
  },
1310
1312
  } );
1311
1313
 
@@ -1326,6 +1328,12 @@ export async function taskPushNotification( req, res ) {
1326
1328
  async function checkTimeZone( ele ) {
1327
1329
  return Promise.all(
1328
1330
  ele.map( async ( data ) => {
1331
+ let taskChecklistName='';
1332
+ let checkLinkedTask = await taskService.findOne( { _id: data.sourceCheckList_id }, { referenceCheckListId: 1 } );
1333
+ if ( checkLinkedTask?.referenceCheckListId ) {
1334
+ let checklistDetails = await CLconfig.findOne( { _id: checkLinkedTask?.referenceCheckListId }, { checkListName: 1 } );
1335
+ taskChecklistName = checklistDetails.checkListName;
1336
+ }
1329
1337
  let getStoreZone = await storeService.findOne(
1330
1338
  { storeId: data.store_id, clientId: data.client_id },
1331
1339
  { storeProfile: 1 },
@@ -1333,14 +1341,14 @@ export async function taskPushNotification( req, res ) {
1333
1341
  if ( getStoreZone ) {
1334
1342
  let taskDate = dayjs( dayjs.utc( data.scheduleEndTime_iso ) ).tz( getStoreZone.storeProfile.timeZone, true );
1335
1343
  let date = dayjs( dayjs().format( 'hh:mm A' ), 'hh:mm A' ).tz( getStoreZone.storeProfile.timeZone );
1336
- if ( data?.remainder?.length && data.remainder.includes( taskDate.diff( date, 'minute' ) || taskDate.diff( date, 'minute' ) == 30 ) ) {
1344
+ if ( ( data?.remainder?.length && data.remainder.includes( taskDate.diff( date, 'minute' ) ) ) || taskDate.diff( date, 'minute' ) == 30 ) {
1337
1345
  let getToken = await userService.findOne( { _id: data.userId }, { fcmToken: 1 } );
1338
1346
  if ( getToken?.fcmToken ) {
1339
1347
  let existCheck = taskDetails.findIndex( ( item ) => item.checklistName == data.checkListName );
1340
1348
  if ( existCheck != -1 ) {
1341
1349
  taskDetails[existCheck].token.push( { token: getToken.fcmToken, store: data.storeName } );
1342
1350
  } else {
1343
- taskDetails.push( { checklistName: data.checkListName, token: [ { token: getToken.fcmToken, store: data.storeName } ], time: taskDate.diff( date, 'minute' ), checkListType: data.checkListType } );
1351
+ taskDetails.push( { checklistName: data.checkListName, token: [ { token: getToken.fcmToken, store: data.storeName } ], time: taskDate.diff( date, 'minute' ), taskChecklistName: taskChecklistName, checkListType: data.checkListType } );
1344
1352
  }
1345
1353
  }
1346
1354
  }
@@ -1365,13 +1373,15 @@ export async function taskPushNotification( req, res ) {
1365
1373
  data.token.map( async ( item ) => {
1366
1374
  let title = '';
1367
1375
  let description = '';
1368
-
1369
- if ( item.checkListType === 'checklistTask' ) {
1370
- title = `Task Due Alert ${item.store}`;
1371
- description = `Today is the due date for ${data.checklistName}. Please complete the task by the end of the day to ensure compliance.`;
1372
- } else if ( item.checkListType === 'CCTV' ) {
1376
+ if ( data.checkListType === 'checklistTask' ) {
1377
+ title = `Task Due Alert ${data.taskChecklistName}`;
1378
+ description = `The task created from the response for ${item.store} is due today.`;
1379
+ } else if ( data.checkListType === 'CCTV' ) {
1373
1380
  title = `Task Due Alert ${data.checklistName}`;
1374
1381
  description = `The task created from the live view for ${item.store} is due today.`;
1382
+ } else {
1383
+ title = `Task Due Alert ${item.store}`;
1384
+ description = `Today is the due date for ${data.checklistName}. Please complete the task by the end of the day to ensure compliance.`;
1375
1385
  }
1376
1386
 
1377
1387
  const fcmToken = item.token;
@@ -490,6 +490,76 @@ export async function sopMobilechecklistQuestionValidator( req, res, next ) {
490
490
  }
491
491
  };
492
492
 
493
+ export async function sopMobilechecklistQuestionValidatorv1( req, res, next ) {
494
+ try {
495
+ let requestData = req.body;
496
+
497
+ logger.error( { function: 'CheckEmptyQA', error: requestData } );
498
+
499
+ requestData.questionAnswers = typeof requestData.questionAnswers == 'string' ? JSON.parse( requestData.questionAnswers ) : requestData.questionAnswers;
500
+ let getChecklistQA = await processedchecklist.findOne( { _id: new ObjectId( requestData.processedcheckListId ) }, { questionAnswers: 1, sourceCheckList_id: 1 } );
501
+ if ( !getChecklistQA ) {
502
+ return res.sendError( 'Check List Got Edited Please Fill Again', 422 );
503
+ }
504
+
505
+ if ( getChecklistQA && requestData.submittype == 'submit' ) {
506
+ let checkChecklistStatus = await checklistService.findOne( { _id: getChecklistQA.sourceCheckList_id }, { publish: 1 } );
507
+ if ( !checkChecklistStatus.publish ) {
508
+ return res.sendError( 'Checklist got edited.please contact admin', 400 );
509
+ }
510
+ }
511
+
512
+ if ( !requestData.questionAnswers.length ) {
513
+ return res.sendError( 'Please Fill all Required Fields', 400 );
514
+ }
515
+
516
+ if ( requestData.submittype == 'submit' ) {
517
+ let reqAnswers = requestData.questionAnswers;
518
+ logger.error( { functionName: 'payload', message: reqAnswers } );
519
+ let CLQAnswers = getChecklistQA.questionAnswers;
520
+ logger.error( { functionName: 'CLQAnswers', message: CLQAnswers } );
521
+ let validationCount= 0;
522
+ let errorCount = 0;
523
+ CLQAnswers.forEach( ( section ) => {
524
+ let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.sectionName == section?.sectionOldName || reqSection.sectionName == section?.sectionName );
525
+ if ( requestSection.length ) {
526
+ requestSection.forEach( ( item ) => item.section_id = section.section_id );
527
+ section.questions.forEach( ( question ) => {
528
+ // question.answers.forEach( ( answer ) => {
529
+ let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qname == question.oldQname || secQuestion.qname == question.qname );
530
+ if ( sectionQuestion.length ) {
531
+ if ( question.answerType == 'multiplechoicemultiple' && ( sectionQuestion[0].Multianswer == null || sectionQuestion[0].Multianswer == '' || !sectionQuestion[0].Multianswer.length ) ) {
532
+ validationCount++;
533
+ } else {
534
+ if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( question.answerType ) && ( ( !sectionQuestion[0].linkType && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) || ( sectionQuestion[0].linkType && sectionQuestion[0].linkquestionenabled && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) ) ) {
535
+ validationCount++;
536
+ }
537
+ }
538
+ } else {
539
+ errorCount++;
540
+ }
541
+ // } );
542
+ } );
543
+ } else {
544
+ errorCount++;
545
+ }
546
+ } );
547
+ if ( validationCount ) {
548
+ return res.sendError( 'Please Fill all Required Fields', 400 );
549
+ } else if ( errorCount ) {
550
+ return res.sendError( 'Checklist got edited.please contact admin', 400 );
551
+ } else {
552
+ next();
553
+ }
554
+ } else {
555
+ next();
556
+ }
557
+ } catch ( e ) {
558
+ logger.error( { function: 'sopMobilechecklistQuestionValidator', error: e, body: req.body } );
559
+ return res.sendError( e, 500 );
560
+ }
561
+ };
562
+
493
563
  export async function sopMobileTaskQuestionValidator( req, res, next ) {
494
564
  try {
495
565
  let requestData = req.body;
@@ -503,7 +573,7 @@ export async function sopMobileTaskQuestionValidator( req, res, next ) {
503
573
  let CLQAnswers = getChecklistQA.questionAnswers;
504
574
  let validationCount= 0;
505
575
  CLQAnswers.forEach( ( section ) => {
506
- let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.section_id == section.section_id );
576
+ let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.sectionName == section?.sectionOldName || reqSection.sectionName == section.sectionName );
507
577
  section.questions.forEach( ( question ) => {
508
578
  question.answers.forEach( ( answer ) => {
509
579
  let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qno == question.qno );
@@ -844,6 +914,372 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
844
914
  }
845
915
  };
846
916
 
917
+ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next ) {
918
+ try {
919
+ let requestData = req.body;
920
+ requestData.questionAnswers = typeof requestData.questionAnswers == 'string' ? JSON.parse( requestData.questionAnswers ) : requestData.questionAnswers;
921
+ let getChecklistQA = await processedchecklist.findOne( { _id: new ObjectId( requestData.processedcheckListId ) }, { questionAnswers: 1 } );
922
+ let reqAnswers = requestData.questionAnswers;
923
+ logger.error( { functionName: 'updatedPayload', message: reqAnswers } );
924
+ let CLQAnswers = getChecklistQA.questionAnswers;
925
+
926
+ if ( requestData.submittype == 'submit' ) {
927
+ reqAnswers.forEach( ( reqA ) => {
928
+ if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( reqA?.answerType ) ) {
929
+ if ( ( !reqA.linkType && ( reqA.answer == null || reqA.answer == '' ) ) || ( reqA.linkType && reqA.linkquestionenabled && ( reqA.answer == null || reqA.answer == '' ) ) ) {
930
+ return res.sendError( 'Please Fill All Fields', 400 );
931
+ }
932
+ }
933
+ } );
934
+ }
935
+
936
+ if ( requestData?.editSubmit && requestData?.editSubmit == 'true' ) {
937
+ let sampleData = reqAnswers[0];
938
+ CLQAnswers.forEach( ( section ) => {
939
+ console.log( section, 'section' );
940
+ let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.sectionName == section?.sectionOldName || reqSection.sectionName == section?.sectionName );
941
+ if ( requestSection.length ) {
942
+ requestSection.forEach( ( item ) => item.section_id = section.section_id );
943
+ section.questions.forEach( ( question ) => {
944
+ let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qname == question.oldQname || secQuestion.qname == question.qname );
945
+ if ( !sectionQuestion.length ) {
946
+ let data = { ...requestSection[0] };
947
+ data.answerType = question.answerType;
948
+ data.qno = question.qno;
949
+ data.qname = question.qname;
950
+ data.answer = 'null';
951
+ data.remarks = '';
952
+ data.validationAnswer = '';
953
+ data.Multianswer = [];
954
+ data.linkType = question.linkType;
955
+ data.linkquestionenabled = question.linkType;
956
+ data.linkedQuestion = null;
957
+ data.showLinked = null;
958
+ data.parentanswer = '';
959
+ data.dateRangeType = false;
960
+ reqAnswers.push( data );
961
+ }
962
+ } );
963
+ } else {
964
+ section.questions.forEach( ( ele ) => {
965
+ let data = { ...sampleData };
966
+ data.section_id = section.section_id;
967
+ data.sectionName = section.sectionName;
968
+ data.answerType = ele.answerType;
969
+ data.qno = ele.qno;
970
+ data.qname = ele.qname;
971
+ data.answer = 'null';
972
+ data.remarks = '';
973
+ data.validationAnswer = '';
974
+ data.Multianswer = [];
975
+ data.linkType = ele.linkType;
976
+ data.linkquestionenabled = ele.linkType;
977
+ data.linkedQuestion = null;
978
+ data.showLinked = null;
979
+ data.parentanswer = '';
980
+ data.dateRangeType = false;
981
+ reqAnswers.push( data );
982
+ } );
983
+ }
984
+ } );
985
+ }
986
+
987
+ let sectionFormat = [];
988
+ let uniqueSections = {};
989
+ reqAnswers.forEach( ( item ) => {
990
+ const key = `${item.section_id}-${item.sectionName}`;
991
+ if ( !uniqueSections[key] ) {
992
+ uniqueSections[key] = { id: item.section_id, name: item.sectionName };
993
+ }
994
+ } );
995
+ const uniqueArray = Object.values( uniqueSections );
996
+ for ( let section of uniqueArray ) {
997
+ let CLQSection = CLQAnswers.find( ( item ) => item.section_id.toString() == section.id.toString() );
998
+ if ( CLQSection ) {
999
+ let newArray = [];
1000
+ let qaAnswers = CLQSection.questions;
1001
+ let requestSection = reqAnswers.filter( ( item ) => item.section_id == section.id );
1002
+ for ( let i = 0; i < requestSection.length; i++ ) {
1003
+ for ( let j = 0; j < qaAnswers.length; j++ ) {
1004
+ if ( requestSection[i].qname == qaAnswers[j].oldQname || requestSection[i].qname == qaAnswers[j].qname ) {
1005
+ if ( qaAnswers[j].answerType == 'yes/no' ) {
1006
+ let qaans = qaAnswers[j].answers;
1007
+ let yn = [];
1008
+ for ( let k = 0; k < qaans.length; k++ ) {
1009
+ if ( requestSection[i].answer == qaans[k].answer ) {
1010
+ if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
1011
+ if ( requestSection[i].validationAnswer ) {
1012
+ let validateAns = decodeURIComponent( requestSection[i].validationAnswer.split( '?' )[0] );
1013
+ if ( validateAns.length ) {
1014
+ let splitImgUrl = validateAns.split( '/' );
1015
+ if ( splitImgUrl.length > 1 ) {
1016
+ splitImgUrl.splice( 0, 3 );
1017
+ qaans[k].validationAnswer = splitImgUrl.join( '/' ) || '';
1018
+ }
1019
+ }
1020
+ }
1021
+ } else {
1022
+ qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
1023
+ qaans[k].validationAnswer = requestSection[i].validationAnswer || '';
1024
+ }
1025
+ yn.push( qaans[k] );
1026
+ }
1027
+ }
1028
+ let structure = {};
1029
+ structure.qno = qaAnswers[j].qno;
1030
+ structure.qname = qaAnswers[j].qname;
1031
+ structure.answerType = qaAnswers[j].answerType;
1032
+ structure.runAI = qaAnswers[j].runAI;
1033
+ structure.runAIDescription = qaAnswers[j].runAIDescription;
1034
+ structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
1035
+ structure.remarks = requestSection[i].remarks;
1036
+ structure.answers = qaAnswers[j].answers;
1037
+ structure.userAnswer = yn;
1038
+ structure.linkType = qaAnswers[j].linkType;
1039
+ structure.linkquestionenabled = requestSection[i].linkquestionenabled;
1040
+ structure.parentanswer = requestSection[i].parentanswer;
1041
+ structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1042
+ structure.descriptivetype = qaAnswers[j].descriptivetype;
1043
+ if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1044
+ structure.redo = false;
1045
+ } else if ( requestData.submittype === 'draft' ) {
1046
+ structure.redo = qaAnswers[j]?.redo;
1047
+ }
1048
+ if ( qaAnswers[j]?.redoComment ) {
1049
+ structure.redoComment = qaAnswers[j]?.redoComment;
1050
+ };
1051
+ newArray.push( structure );
1052
+ } else if ( qaAnswers[j].answerType == 'multiplechoicesingle' ) {
1053
+ let qaans = qaAnswers[j].answers;
1054
+ let ms = [];
1055
+ for ( let k = 0; k < qaans.length; k++ ) {
1056
+ if ( requestSection[i].answer == qaans[k].answer ) {
1057
+ if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
1058
+ if ( requestSection[i].validationAnswer ) {
1059
+ let validationAnswer = decodeURIComponent( requestSection[i].validationAnswer.split( '?' )[0] );
1060
+ if ( validationAnswer.length ) {
1061
+ let splitImgUrl = validationAnswer.split( '/' );
1062
+ if ( splitImgUrl.length > 1 ) {
1063
+ splitImgUrl.splice( 0, 3 );
1064
+ qaans[k].validationAnswer = splitImgUrl.join( '/' ) || '';
1065
+ }
1066
+ }
1067
+ }
1068
+ } else {
1069
+ qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
1070
+ qaans[k].validationAnswer = requestSection[i].validationAnswer || '';
1071
+ }
1072
+ ms.push( qaans[k] );
1073
+ }
1074
+ }
1075
+ let structure = {};
1076
+ structure.qno = qaAnswers[j].qno;
1077
+ structure.qname = qaAnswers[j].qname;
1078
+ structure.answerType = qaAnswers[j].answerType;
1079
+ structure.runAI = qaAnswers[j].runAI;
1080
+ structure.runAIDescription = qaAnswers[j].runAIDescription;
1081
+ structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
1082
+ structure.remarks = requestSection[i].remarks;
1083
+ structure.answers = qaAnswers[j].answers;
1084
+ structure.userAnswer = ms;
1085
+ structure.linkType = qaAnswers[j].linkType;
1086
+ structure.linkquestionenabled = requestSection[i].linkquestionenabled;
1087
+ structure.parentanswer = requestSection[i].parentanswer;
1088
+ structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1089
+ structure.descriptivetype = qaAnswers[j].descriptivetype;
1090
+ if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1091
+ structure.redo = false;
1092
+ } else if ( requestData.submittype === 'draft' ) {
1093
+ structure.redo = qaAnswers[j]?.redo;
1094
+ }
1095
+ if ( qaAnswers[j]?.redoComment ) {
1096
+ structure.redoComment = qaAnswers[j]?.redoComment;
1097
+ };
1098
+ newArray.push( structure );
1099
+ } else if ( qaAnswers[j].answerType == 'multiplechoicemultiple' ) {
1100
+ let qaans = qaAnswers[j].answers;
1101
+ let mcmo = [];
1102
+ for ( let k = 0; k < qaans.length; k++ ) {
1103
+ let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
1104
+ for ( let s = 0; s < separatedArray.length; s++ ) {
1105
+ if ( separatedArray[s].answer == qaans[k].answer ) {
1106
+ if ( qaans[k].validationType == 'Capture Image' || qaans[k].validationType == 'Capture Video' ) {
1107
+ if ( separatedArray[s].validationAnswer ) {
1108
+ let validationAnswer = decodeURIComponent( separatedArray[s].validationAnswer.split( '?' )[0] );
1109
+ if ( validationAnswer.length ) {
1110
+ let splitImgUrl = validationAnswer.split( '/' );
1111
+ if ( splitImgUrl.length > 1 ) {
1112
+ splitImgUrl.splice( 0, 3 );
1113
+ qaans[k].validationAnswer = splitImgUrl.join( '/' ) || '';
1114
+ }
1115
+ }
1116
+ }
1117
+ } else {
1118
+ qaans[k].descriptivetype = qaAnswers[j].descriptivetype || '';
1119
+ qaans[k].validationAnswer = separatedArray[s].validationAnswer || '';
1120
+ }
1121
+
1122
+ mcmo.push( qaans[k] );
1123
+ }
1124
+ }
1125
+ }
1126
+ let structure = {};
1127
+ structure.qno = qaAnswers[j].qno;
1128
+ structure.qname = qaAnswers[j].qname;
1129
+ structure.answerType = qaAnswers[j].answerType;
1130
+ structure.runAI = qaAnswers[j].runAI;
1131
+ structure.runAIDescription = qaAnswers[j].runAIDescription;
1132
+ structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
1133
+ structure.remarks = requestSection[i].remarks;
1134
+ structure.answers = qaAnswers[j].answers;
1135
+ structure.userAnswer = mcmo;
1136
+ structure.linkType = qaAnswers[j].linkType;
1137
+ structure.linkquestionenabled = requestSection[i].linkquestionenabled;
1138
+ structure.parentanswer = requestSection[i].parentanswer;
1139
+ structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1140
+ structure.descriptivetype = qaAnswers[j].descriptivetype;
1141
+ if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1142
+ structure.redo = false;
1143
+ } else if ( requestData.submittype === 'draft' ) {
1144
+ structure.redo = qaAnswers[j]?.redo;
1145
+ }
1146
+ if ( qaAnswers[j]?.redoComment ) {
1147
+ structure.redoComment = qaAnswers[j]?.redoComment;
1148
+ };
1149
+ newArray.push( structure );
1150
+ } else if ( qaAnswers[j].answerType == 'multipleImage' ) {
1151
+ let separatedArray = typeof requestSection[i].Multianswer == 'string' ? JSON.parse( requestSection[i].Multianswer ) : requestSection[i].Multianswer;
1152
+ let mcmi = [];
1153
+ // for (let k = 0; k < qaans.length; k++) {
1154
+ for ( let s = 0; s < separatedArray.length; s++ ) {
1155
+ if ( separatedArray[s].answer && separatedArray[s].answer !='' ) {
1156
+ let newAnswer = {};
1157
+ let validationAnswer = decodeURIComponent( separatedArray[s].answer.split( '?' )[0] );
1158
+ if ( validationAnswer.length ) {
1159
+ let splitImgUrl = validationAnswer.split( '/' );
1160
+ if ( splitImgUrl.length > 1 ) {
1161
+ splitImgUrl.splice( 0, 3 );
1162
+ newAnswer.answer = splitImgUrl.join( '/' ) || '';
1163
+ }
1164
+ }
1165
+
1166
+ newAnswer.answeroptionNumber = 0;
1167
+ newAnswer.sopFlag = false;
1168
+ newAnswer.validation = false;
1169
+ newAnswer.validationType = '';
1170
+ newAnswer.referenceImage = '';
1171
+ newAnswer.allowUploadfromGallery = false;
1172
+ newAnswer.runAI = false;
1173
+ newAnswer.descriptivetype = '';
1174
+ newAnswer.showLinked = false;
1175
+ newAnswer.linkedQuestion = 0;
1176
+ newAnswer.nestedQuestion = [];
1177
+ newAnswer.index = s;
1178
+ mcmi.push( newAnswer );
1179
+ }
1180
+ }
1181
+ // }
1182
+ let structure = {};
1183
+ structure.qno = qaAnswers[j].qno;
1184
+ structure.qname = qaAnswers[j].qname;
1185
+ structure.answerType = qaAnswers[j].answerType;
1186
+ structure.runAI = qaAnswers[j].runAI;
1187
+ structure.runAIDescription = qaAnswers[j].runAIDescription;
1188
+ structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
1189
+ structure.remarks = requestSection[i].remarks;
1190
+ structure.answers = qaAnswers[j].answers;
1191
+ structure.userAnswer = mcmi;
1192
+ structure.linkType = qaAnswers[j].linkType;
1193
+ structure.linkquestionenabled = requestSection[i].linkquestionenabled;
1194
+ structure.parentanswer = requestSection[i].parentanswer;
1195
+ structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1196
+ structure.descriptivetype = qaAnswers[j].descriptivetype;
1197
+ if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1198
+ structure.redo = false;
1199
+ } else if ( requestData.submittype === 'draft' ) {
1200
+ structure.redo = qaAnswers[j]?.redo;
1201
+ }
1202
+ if ( qaAnswers[j]?.redoComment ) {
1203
+ structure.redoComment = qaAnswers[j]?.redoComment;
1204
+ };
1205
+ newArray.push( structure );
1206
+ } else {
1207
+ let des = [];
1208
+ if ( requestSection[i].answer != 'null' && requestSection[i].answer != '' && requestSection[i].answer != null ) {
1209
+ let validationAnswer = '';
1210
+ if ( requestSection[i].answer.split( '?' ).length > 1 ) {
1211
+ validationAnswer = decodeURIComponent( requestSection[i].answer.split( '?' )[0] );
1212
+ }
1213
+ if ( validationAnswer.length ) {
1214
+ let splitImgUrl = validationAnswer.split( '/' );
1215
+ if ( splitImgUrl.length > 1 ) {
1216
+ splitImgUrl.splice( 0, 3 );
1217
+ requestSection[i].answer = splitImgUrl.join( '/' );
1218
+ }
1219
+ }
1220
+ let ansstructure = {
1221
+ answer: requestSection[i].answer,
1222
+ answeroptionNumber: 1,
1223
+ sopFlag: false,
1224
+ validation: false,
1225
+ validationType: '',
1226
+ validationAnswer: '',
1227
+ referenceImage: qaAnswers[j].answers[0].referenceImage,
1228
+ showLinked: qaAnswers[j].answers[0].showLinked,
1229
+ linkedQuestion: qaAnswers[j].answers[0].linkedQuestion,
1230
+ };
1231
+ if ( qaAnswers[j].answerType == 'date' ) {
1232
+ ansstructure.dateRangeType = requestSection[i].dateRangeType || false;
1233
+ }
1234
+ des.push( ansstructure );
1235
+ }
1236
+ let structure = {};
1237
+ structure.qno = qaAnswers[j].qno;
1238
+ structure.qname = qaAnswers[j].qname;
1239
+ structure.answerType = qaAnswers[j].answerType;
1240
+ structure.runAI = qaAnswers[j].runAI;
1241
+ structure.runAIDescription = qaAnswers[j].runAIDescription;
1242
+ structure.allowUploadfromGallery = qaAnswers[j].allowUploadfromGallery;
1243
+ structure.remarks = requestSection[i].remarks;
1244
+ structure.answers = qaAnswers[j].answers;
1245
+ structure.userAnswer = des;
1246
+ structure.linkType = qaAnswers[j].linkType;
1247
+ structure.linkquestionenabled = requestSection[i].linkquestionenabled;
1248
+ structure.parentanswer = requestSection[i].parentanswer;
1249
+ structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1250
+ structure.descriptivetype = qaAnswers[j].descriptivetype;
1251
+ if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1252
+ structure.redo = false;
1253
+ } else if ( requestData.submittype === 'draft' ) {
1254
+ structure.redo = qaAnswers[j]?.redo;
1255
+ }
1256
+ if ( qaAnswers[j]?.redoComment ) {
1257
+ structure.redoComment = qaAnswers[j]?.redoComment;
1258
+ };
1259
+ newArray.push( structure );
1260
+ }
1261
+ }
1262
+ }
1263
+ }
1264
+ let sectionData = {
1265
+ 'section_id': section.id,
1266
+ 'sectionName': section.name,
1267
+ 'questions': newArray,
1268
+ };
1269
+ sectionFormat.push( sectionData );
1270
+ }
1271
+ }
1272
+
1273
+
1274
+ requestData.questionAnswers = sectionFormat;
1275
+ logger.error( { message: requestData.questionAnswers, error: 'QuestionanswersPayload' } );
1276
+ next();
1277
+ } catch ( error ) {
1278
+ logger.error( { function: 'sopMobilechecklistMultiSectionFormatter', error: error, body: req.body } );
1279
+ return res.sendError( error, 500 );
1280
+ }
1281
+ };
1282
+
847
1283
  export async function sopMobileTaskMultiSectionFormatter( req, res, next ) {
848
1284
  try {
849
1285
  let requestData = req.body;
@@ -609,7 +609,14 @@ export const flagCardsV1 = async ( req, res ) => {
609
609
  if ( data.questionFlag ) flagCards.questionFlag.count = data.questionFlag;
610
610
  if ( data.delayInSubmission ) flagCards.delayInSubmission.count = data.delayInSubmission;
611
611
 
612
- const publishedAiChecklists = await checklistconfigService.find( { client_id: clientId, publish: true, checkListType: { $ne: 'custom' } }, { checkListType: 1 } );
612
+ const publishedAiChecklists = await checklistconfigService.find(
613
+ {
614
+ client_id: clientId,
615
+ publish: true,
616
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] },
617
+ },
618
+ { checkListType: 1 },
619
+ );
613
620
 
614
621
  if ( !publishedAiChecklists?.length ) {
615
622
  return res.sendError( { error: 'No Data Found' }, 204 );
@@ -623,7 +630,9 @@ export const flagCardsV1 = async ( req, res ) => {
623
630
 
624
631
  if ( resultData && resultData.status_code === '200' ) {
625
632
  published.forEach( ( item ) => {
626
- flagCards.detectionFlag.count += resultData[item];
633
+ if ( resultData[item] ) {
634
+ flagCards.detectionFlag.count += resultData[item];
635
+ }
627
636
  } );
628
637
  flagCards.totalFlag = flagCards.detectionFlag.count;
629
638
  }
@@ -737,8 +746,14 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
737
746
 
738
747
  console.log( dayjs( toDate ).startOf( 'day' ).subtract( 1, 'day' ).format( 'YYYY-MM-DD' ), 'new start of' );
739
748
 
740
- const publishedAiChecklists = await checklistconfigService.find( { client_id: requestData.clientId, publish: true, checkListType: { $ne: 'custom' } }, { checkListType: 1 } );
741
-
749
+ const publishedAiChecklists = await checklistconfigService.find(
750
+ {
751
+ client_id: requestData.clientId,
752
+ publish: true,
753
+ checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] },
754
+ },
755
+ { checkListType: 1 },
756
+ );
742
757
  if ( !publishedAiChecklists?.length ) {
743
758
  return 0;
744
759
  }
@@ -750,7 +765,11 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
750
765
 
751
766
  if ( resultData?.status_code === '200' ) {
752
767
  let result = 0;
753
- published.forEach( ( item ) => result += resultData[item] );
768
+ published.forEach( ( item ) => {
769
+ if ( resultData[item] ) {
770
+ result += resultData[item];
771
+ }
772
+ } );
754
773
  return result;
755
774
  }
756
775
  return 0;
@@ -804,7 +823,7 @@ export const flagTablesV1 = async ( req, res ) => {
804
823
  );
805
824
 
806
825
  if ( requestData?.filter === 'all' ) {
807
- findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $ne: 'custom' } } ] } );
826
+ findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
808
827
  } else if ( requestData?.filter === 'question' ) {
809
828
  findAndQuery.push( { checkListType: 'custom' } );
810
829
  findAndQuery.push( { questionFlag: { $gte: 1 } } );
@@ -812,7 +831,7 @@ export const flagTablesV1 = async ( req, res ) => {
812
831
  findAndQuery.push( { checkListType: 'custom' } );
813
832
  findAndQuery.push( { timeFlag: { $gte: 1 } } );
814
833
  } else if ( requestData?.filter === 'detection' ) {
815
- findAndQuery.push( { checkListType: { $ne: 'custom' } } );
834
+ findAndQuery.push( { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } );
816
835
  }
817
836
 
818
837
  findQuery.push( { $match: { $and: findAndQuery } } );
@@ -2629,7 +2648,7 @@ export const checklistDropdownV1 = async ( req, res ) => {
2629
2648
  $or: [
2630
2649
  { questionFlag: { $gte: 1 } },
2631
2650
  { timeFlag: { $gte: 1 } },
2632
- { checkListType: { $ne: 'custom' } },
2651
+ { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } },
2633
2652
  ],
2634
2653
  },
2635
2654
  ] } },
@@ -468,6 +468,78 @@ async function createUser( data ) {
468
468
  role: 'user',
469
469
  password: '5dqFKAJj29PsV6P+kL+3Dw==',
470
470
  isActive: true,
471
+ userType: 'client',
472
+ rolespermission: [
473
+ {
474
+ featureName: 'Global',
475
+ modules: [
476
+ {
477
+ name: 'Store',
478
+ isAdd: false,
479
+ isEdit: false,
480
+
481
+ },
482
+ {
483
+ name: 'User',
484
+ isAdd: false,
485
+ isEdit: false,
486
+
487
+ },
488
+ {
489
+ name: 'Camera',
490
+ isAdd: false,
491
+ isEdit: false,
492
+
493
+ },
494
+ {
495
+ name: 'Configuration',
496
+ isAdd: false,
497
+ isEdit: false,
498
+
499
+ },
500
+ {
501
+ name: 'Subscription',
502
+ isAdd: false,
503
+ isEdit: false,
504
+
505
+ },
506
+ {
507
+ name: 'Billing',
508
+ isAdd: false,
509
+ isEdit: false,
510
+
511
+ },
512
+ ],
513
+ },
514
+ {
515
+ featurName: 'TangoEye',
516
+ modules: [
517
+ {
518
+ name: 'ZoneTag',
519
+ isAdd: false,
520
+ isEdit: false,
521
+
522
+ },
523
+ ],
524
+ },
525
+ {
526
+ featurName: 'TangoTrax',
527
+ modules: [
528
+ {
529
+ name: 'checklist',
530
+ isAdd: false,
531
+ isEdit: false,
532
+
533
+ },
534
+ {
535
+ name: 'Task',
536
+ isAdd: false,
537
+ isEdit: false,
538
+
539
+ },
540
+ ],
541
+ },
542
+ ],
471
543
  };
472
544
  let response = await userService.create( params );
473
545
  return response._id;
@@ -562,6 +634,7 @@ export const duplicateChecklist = async ( req, res ) => {
562
634
  let userDetails = { ...userList[i]._doc };
563
635
  userDetails.checkListId = data._id;
564
636
  userDetails.checkListName = data.checkListName;
637
+ userDetails.sendNotification = false;
565
638
  delete userDetails['_id'];
566
639
  users.push( userDetails );
567
640
  }
@@ -935,7 +1008,11 @@ export const updateConfigure =async ( req, res ) => {
935
1008
  return res.sendError( 'no data found', 204 );
936
1009
  }
937
1010
 
938
- if ( inputBody.submitType == 'publish' && inputBody?.showEdit && typeof inputBody?.editSubmit == 'undefined' ) {
1011
+ let currentDate = dayjs.utc().format();
1012
+ let updatedscheduleEndTimeISO = dayjs.utc( inputBody?.checkListDetails?.scheduleStartTime, 'hh:mm A' ).format( 'HH:mm:ss' );
1013
+ let newUpdatedDate = dayjs.utc( updatedscheduleEndTimeISO, 'HH:mm:ss' ).format();
1014
+
1015
+ if ( inputBody.submitType == 'publish' && inputBody?.showEdit && typeof inputBody?.editSubmit == 'undefined' && newUpdatedDate > currentDate ) {
939
1016
  let checkSubmitDetails = await processedchecklist.findOne( { sourceCheckList_id: inputBody.checkListDetails._id, date_string: dayjs().format( 'YYYY-MM-DD' ), checklistStatus: 'submit' } );
940
1017
  if ( checkSubmitDetails ) {
941
1018
  return res.sendError( 'Checklist got submitted', 400 );
@@ -1253,7 +1330,7 @@ export const updatePublish = async ( req, res ) => {
1253
1330
  { scheduleEndTime_iso: { $gt: currentDate } },
1254
1331
  ],
1255
1332
  };
1256
- deleteQuery.$and.push( { checklistStatus: { $ne: 'submit' } } );
1333
+ deleteQuery.$and.push( { checklistStatus: { $eq: 'open' } } );
1257
1334
  let PClicklist = await processedchecklist.deleteMany( deleteQuery );
1258
1335
  logger.info( { function: 'updatePublish', query: deleteQuery } );
1259
1336
  logger.info( `Deleted Checklist Before Insert => Checklist Name: ${getCheckDetails.checkListName}, PChecklist Count: ${PClicklist.deletedCount}` );
@@ -1276,8 +1353,8 @@ export const updatePublish = async ( req, res ) => {
1276
1353
  { scheduleEndTime_iso: { $gt: currentDate } },
1277
1354
  ],
1278
1355
  };
1279
- await processedchecklistConfig.deleteMany( deleteQuery );
1280
- deleteQuery.$and.push( { checklistStatus: { $ne: 'submit' } } );
1356
+ // await processedchecklistConfig.deleteMany( deleteQuery );
1357
+ deleteQuery.$and.push( { checklistStatus: { $eq: 'open' } } );
1281
1358
  await processedchecklist.deleteMany( deleteQuery );
1282
1359
  logger.info( { function: 'updatePublish', query: deleteQuery } );
1283
1360
 
@@ -1466,9 +1543,9 @@ export const validateUser = async ( req, res ) => {
1466
1543
  if ( !storeExists.length ) {
1467
1544
  storeId.push( { store: item.storeName, message: '' } );
1468
1545
  }
1469
- if ( storeExists.length && !storeExists[0]?.storeProfile?.city && !item.city ) {
1470
- storeId.push( { store: item.storeName, message: 'city is required' } );
1471
- }
1546
+ // if ( storeExists.length && !storeExists[0]?.storeProfile?.city && !item.city ) {
1547
+ // storeId.push( { store: item.storeName, message: 'city is required' } );
1548
+ // }
1472
1549
  if ( storeExists.length && storeExists[0].status != 'active' ) {
1473
1550
  storeId.push( { store: item.storeName, message: 'store is inactive' } );
1474
1551
  }
@@ -1957,7 +2034,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
1957
2034
  let userIdList = [];
1958
2035
  let tokenList = [];
1959
2036
  let notifyUserList = [];
1960
- let status = [ { checklistStatus: { $nin: 'open' } } ];
2037
+ let status = [ { checklistStatus: { $ne: 'open' } } ];
1961
2038
 
1962
2039
  for ( let element4 of allQuestion ) {
1963
2040
  let getToken = await userService.findOne( { _id: element4.userId }, { fcmToken: 1 } );
@@ -2045,9 +2122,11 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
2045
2122
  if ( getsubmitDetails[0].checkListDescription != getCLconfig.checkListDescription ) {
2046
2123
  getsubmitDetails[0].checkListDescription = getCLconfig.checkListDescription;
2047
2124
  }
2125
+ let sectionList = [];
2048
2126
  for ( let [ index, section ] of questionList.entries() ) {
2049
- let checkExists = getsubmitDetails[0].questionAnswers.findIndex( ( sec ) => sec.sectionName == section.sectionOldName );
2127
+ let checkExists = getsubmitDetails[0].questionAnswers.findIndex( ( sec ) => sec.sectionName == section?.sectionOldName || sec.sectionName == section.sectionName );
2050
2128
  if ( checkExists != -1 ) {
2129
+ getsubmitDetails[0].questionAnswers[index].section_id = section.section_id;
2051
2130
  getsubmitDetails[0].questionAnswers[index].sectionName = section.sectionName;
2052
2131
  let question = [];
2053
2132
  section.questions.forEach( ( qns ) => {
@@ -2085,13 +2164,17 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
2085
2164
  }
2086
2165
  } );
2087
2166
  getsubmitDetails[0].questionAnswers[index].questions = question;
2167
+ sectionList.push( getsubmitDetails[0].questionAnswers[index] );
2088
2168
  } else {
2089
2169
  modifiedCount++;
2090
- getsubmitDetails[0].questionAnswers.push( section );
2170
+ sectionList.push( section );
2091
2171
  }
2092
2172
  }
2173
+ getsubmitDetails[0].questionAnswers = sectionList;
2093
2174
  if ( modifiedCount ) {
2094
2175
  getsubmitDetails[0].checklistStatus = 'inprogress';
2176
+ getsubmitDetails[0].date_string = dayjs( currentdate ).format( 'YYYY-MM-DD' );
2177
+ getsubmitDetails[0].date_iso = new Date( date );
2095
2178
  }
2096
2179
  let data = { ...getsubmitDetails[0]._doc };
2097
2180
  await processedchecklist.updateOne( { _id: getsubmitDetails[0]._id }, data );
@@ -2189,7 +2272,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
2189
2272
  export const aiChecklist = async ( req, res ) => {
2190
2273
  try {
2191
2274
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
2192
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended' ];
2275
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring' ];
2193
2276
  let checklistDetails = [];
2194
2277
  let publishList = [];
2195
2278
  let unpublishList = [];
@@ -3619,10 +3619,10 @@ export async function sendAlert( req, res ) {
3619
3619
  data.token.map( async ( item ) => {
3620
3620
  let title = '';
3621
3621
  let description = '';
3622
- if ( item.checklistStatus === 'open' ) {
3622
+ if ( data.checklistStatus === 'open' ) {
3623
3623
  title = `${item.store} Checklist Open`;
3624
3624
  description = `The ${data.checklistName} checklist is currently open. Complete now to avoid compliance.`;
3625
- } else if ( item.checklistStatus === 'inprogress' ) {
3625
+ } else if ( data.checklistStatus === 'inprogress' ) {
3626
3626
  title = `${item.store} Checklist In-progress`;
3627
3627
  description = `The ${data.checklistName} checklist is currently in progress. Complete now to avoid compliance.`;
3628
3628
  }
@@ -11,6 +11,7 @@ mobileRouter
11
11
  .post( '/startCheckList', isAllowedSessionHandler, validate( startValidation ), mobileController.startChecklist )
12
12
  .post( '/startTask', isAllowedSessionHandler, validate( startValidation ), mobileController.startTask )
13
13
  .post( '/submitCheckList', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidator, mobileController.sopMobilechecklistMultiSectionFormatter, mobileController.submitChecklist )
14
+ .post( '/submitCheckListv5', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobilechecklistQuestionValidatorv1, mobileController.sopMobilechecklistMultiSectionFormatterv1, mobileController.submitChecklist )
14
15
  .post( '/submitTask', isAllowedSessionHandler, mobileController.sopMobilechecklistValidater, mobileController.sopMobileTaskQuestionValidator, mobileController.sopMobileTaskMultiSectionFormatter, mobileController.submitTask )
15
16
  .get( '/dashboard', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboard )
16
17
  .get( '/dashboardv1', isAllowedSessionHandler, validate( dashboardValidation ), mobileController.dashboardv1 )