tango-app-api-trax 3.3.1-beta-6 → 3.3.1-beta-8

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.3.1-beta-6",
3
+ "version": "3.3.1-beta-8",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -984,7 +984,6 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
984
984
  if ( requestData?.editSubmit && requestData?.editSubmit == 'true' ) {
985
985
  let sampleData = reqAnswers[0];
986
986
  CLQAnswers.forEach( ( section ) => {
987
- console.log( section, 'section' );
988
987
  let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.sectionName == section?.sectionOldName || reqSection.sectionName == section?.sectionName );
989
988
  if ( requestSection.length ) {
990
989
  requestSection.forEach( ( item ) => item.section_id = section.section_id );
@@ -995,6 +994,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
995
994
  data.answerType = question.answerType;
996
995
  data.qno = question.qno;
997
996
  data.qname = question.qname;
997
+ data.oldQname = question?.oldQname || question.qname;
998
998
  data.answer = 'null';
999
999
  data.remarks = '';
1000
1000
  data.validationAnswer = '';
@@ -1016,6 +1016,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1016
1016
  data.answerType = ele.answerType;
1017
1017
  data.qno = ele.qno;
1018
1018
  data.qname = ele.qname;
1019
+ data.oldQname = ele?.oldQname || ele.qname;
1019
1020
  data.answer = 'null';
1020
1021
  data.remarks = '';
1021
1022
  data.validationAnswer = '';
@@ -1049,7 +1050,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1049
1050
  let requestSection = reqAnswers.filter( ( item ) => item.section_id == section.id );
1050
1051
  for ( let i = 0; i < requestSection.length; i++ ) {
1051
1052
  for ( let j = 0; j < qaAnswers.length; j++ ) {
1052
- if ( requestSection[i].qname == qaAnswers[j].oldQname || requestSection[i].qname == qaAnswers[j].qname ) {
1053
+ if ( ( requestSection[i].qname == qaAnswers[j].oldQname || requestSection[i].qname == qaAnswers[j].qname ) && ( !qaAnswers[j]?.parentQuestion || ( qaAnswers[j]?.parentQuestion && requestSection[i]?.parentQuestion == qaAnswers[j]?.parentQuestion ) ) ) {
1053
1054
  if ( qaAnswers[j].answerType == 'yes/no' ) {
1054
1055
  let qaans = qaAnswers[j].answers;
1055
1056
  let yn = [];
@@ -1089,13 +1090,14 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1089
1090
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1090
1091
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1091
1092
  structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1093
+ structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1092
1094
  if ( qaAnswers[j]?.taskId ) {
1093
1095
  structure.taskId = qaAnswers[j]?.taskId;
1094
1096
  structure.task = true;
1095
1097
  }
1096
1098
  if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1097
1099
  structure.redo = false;
1098
- } else if ( requestData.submittype === 'draft' ) {
1100
+ } else if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'draft' ) {
1099
1101
  structure.redo = qaAnswers[j]?.redo;
1100
1102
  }
1101
1103
  if ( qaAnswers[j]?.redoComment ) {
@@ -1141,13 +1143,14 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1141
1143
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1142
1144
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1143
1145
  structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1146
+ structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1144
1147
  if ( qaAnswers[j]?.taskId ) {
1145
1148
  structure.taskId = qaAnswers[j]?.taskId;
1146
1149
  structure.task = true;
1147
1150
  }
1148
1151
  if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1149
1152
  structure.redo = false;
1150
- } else if ( requestData.submittype === 'draft' ) {
1153
+ } else if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'draft' ) {
1151
1154
  structure.redo = qaAnswers[j]?.redo;
1152
1155
  }
1153
1156
  if ( qaAnswers[j]?.redoComment ) {
@@ -1197,13 +1200,14 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1197
1200
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1198
1201
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1199
1202
  structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1203
+ structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1200
1204
  if ( qaAnswers[j]?.taskId ) {
1201
1205
  structure.taskId = qaAnswers[j]?.taskId;
1202
1206
  structure.task = true;
1203
1207
  }
1204
1208
  if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1205
1209
  structure.redo = false;
1206
- } else if ( requestData.submittype === 'draft' ) {
1210
+ } else if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'draft' ) {
1207
1211
  structure.redo = qaAnswers[j]?.redo;
1208
1212
  }
1209
1213
  if ( qaAnswers[j]?.redoComment ) {
@@ -1258,13 +1262,14 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1258
1262
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1259
1263
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1260
1264
  structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1265
+ structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1261
1266
  if ( qaAnswers[j]?.taskId ) {
1262
1267
  structure.taskId = qaAnswers[j]?.taskId;
1263
1268
  structure.task = true;
1264
1269
  }
1265
1270
  if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1266
1271
  structure.redo = false;
1267
- } else if ( requestData.submittype === 'draft' ) {
1272
+ } else if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'draft' ) {
1268
1273
  structure.redo = qaAnswers[j]?.redo;
1269
1274
  }
1270
1275
  if ( qaAnswers[j]?.redoComment ) {
@@ -1317,13 +1322,14 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
1317
1322
  structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
1318
1323
  structure.descriptivetype = qaAnswers[j].descriptivetype;
1319
1324
  structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
1325
+ structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
1320
1326
  if ( qaAnswers[j]?.taskId ) {
1321
1327
  structure.taskId = qaAnswers[j]?.taskId;
1322
1328
  structure.task = true;
1323
1329
  }
1324
1330
  if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'submit' ) {
1325
1331
  structure.redo = false;
1326
- } else if ( requestData.submittype === 'draft' ) {
1332
+ } else if ( typeof qaAnswers[j]?.redo === 'boolean' && requestData.submittype === 'draft' ) {
1327
1333
  structure.redo = qaAnswers[j]?.redo;
1328
1334
  }
1329
1335
  if ( qaAnswers[j]?.redoComment ) {
@@ -3340,3 +3346,24 @@ export async function clientConfig( req, res ) {
3340
3346
  return res.sendError( e, 500 );
3341
3347
  }
3342
3348
  }
3349
+
3350
+ export async function updatePlanoStatus( req, res ) {
3351
+ try {
3352
+ if ( !req.body.id ) {
3353
+ return res.sendError( 'Processed checklist id is required' );
3354
+ }
3355
+ if ( !req.body.status ) {
3356
+ return res.sendError( 'status is required' );
3357
+ }
3358
+ let processCheckDetails = await processedchecklist.findOne( { _id: req.body.id } );
3359
+ if ( !processCheckDetails ) {
3360
+ return res.sendError( 'No data found', 204 );
3361
+ }
3362
+ processCheckDetails.checklistStatus = req.body.status;
3363
+ processCheckDetails.save();
3364
+ return res.sendSuccess( 'Status updated Successfully' );
3365
+ } catch ( e ) {
3366
+ logger.error( { error: e, function: 'updatePlanoStatus' } );
3367
+ return res.sendError( e, 500 );
3368
+ }
3369
+ }
@@ -25,5 +25,6 @@ mobileRouter
25
25
  .post( '/verifylocation', isAllowedSessionHandler, mobileController.getStoreLocation, mobileController.location )
26
26
  .post( '/login', mobileController.login )
27
27
  .post( '/checkUpdateVersion', mobileController.checkVersion )
28
- .post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig );
28
+ .post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
29
+ .post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus );
29
30