tango-app-api-trax 3.2.0-beta.17 → 3.2.0-beta.19
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
|
@@ -357,23 +357,26 @@ export async function redoChecklist( req, res ) {
|
|
|
357
357
|
let findQuestion = question[sectionIndex].questions.findIndex( ( ele ) => ele.qno == req.body.payload.qno );
|
|
358
358
|
|
|
359
359
|
let data = { ...question[sectionIndex].questions[findQuestion], redo: true, redoComment: req.body.payload?.checklistDescription || '' };
|
|
360
|
-
if ( checklistDetails.client_id == '458' ) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
360
|
+
// if ( checklistDetails.client_id == '458' ) {
|
|
361
|
+
data.answers.forEach( ( item ) => {
|
|
362
|
+
if ( item.showLinked ) {
|
|
363
|
+
item.nestedQuestion.forEach( ( ele ) => {
|
|
364
|
+
let eleIndex = question[sectionIndex].questions.findIndex( ( qn ) => qn.qno == parseInt( ele ) );
|
|
365
|
+
let element = { ...question[sectionIndex].questions[eleIndex], redo: true, redoComment: '', linkquestionenabled: false };
|
|
366
|
+
question[sectionIndex].questions[eleIndex] = element;
|
|
367
|
+
question[sectionIndex].questions[eleIndex].userAnswer = [];
|
|
368
|
+
question[sectionIndex].questions[eleIndex].remarks = '';
|
|
369
|
+
} );
|
|
370
|
+
}
|
|
371
|
+
} );
|
|
372
|
+
// data.answers.forEach( ( item ) => {
|
|
373
|
+
// if ( item.showLinked ) {
|
|
374
|
+
// item.nestedQuestion = [];
|
|
375
|
+
// item.showLinked = false;
|
|
376
|
+
// item.linkedQuestion = 0;
|
|
377
|
+
// }
|
|
378
|
+
// } );
|
|
379
|
+
// }
|
|
377
380
|
let userAnswer = data.userAnswer;
|
|
378
381
|
|
|
379
382
|
question[sectionIndex].questions[findQuestion] = data;
|
|
@@ -2948,6 +2948,11 @@ export async function uploadAnswerImage( req, res ) {
|
|
|
2948
2948
|
let date = dayjs().format( 'YYYY-MM-DD' );
|
|
2949
2949
|
let folder;
|
|
2950
2950
|
|
|
2951
|
+
let getChecklistDetails = await processedchecklist.findOne( { _id: input.checklistId } );
|
|
2952
|
+
if ( getChecklistDetails ) {
|
|
2953
|
+
input.type = 'custom';
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2951
2956
|
if ( input.type == 'custom' ) {
|
|
2952
2957
|
folder = 'checklist-answers';
|
|
2953
2958
|
} else {
|
|
@@ -2042,7 +2042,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
|
|
|
2042
2042
|
tokenList.push( getToken.fcmToken );
|
|
2043
2043
|
}
|
|
2044
2044
|
if ( !element4?.sendNotification ) {
|
|
2045
|
-
notifyUserList.push( { token: getToken
|
|
2045
|
+
notifyUserList.push( { token: getToken?.fcmToken, storeName: element4.storeName, id: element4._id } );
|
|
2046
2046
|
}
|
|
2047
2047
|
if ( !getCLconfig?.allowedMultiSubmit ) {
|
|
2048
2048
|
let query;
|
|
@@ -2229,11 +2229,23 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
|
|
|
2229
2229
|
allQuestion = allQuestion.filter( ( item ) => typeof item._id == 'undefined' );
|
|
2230
2230
|
}
|
|
2231
2231
|
if ( allQuestion ) {
|
|
2232
|
-
if ( getCLconfig?.allowedMultiSubmit
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2232
|
+
if ( getCLconfig?.allowedMultiSubmit || processId ) {
|
|
2233
|
+
if ( processId ) {
|
|
2234
|
+
let processedDetails = await processedchecklist.findOne( { _id: processId } );
|
|
2235
|
+
if ( processedDetails ) {
|
|
2236
|
+
let submitUser = allQuestion.find( ( item ) => item.userId.toString() == processedDetails.userId.toString() && item.store_id == processedDetails.store_id );
|
|
2237
|
+
await processedchecklist.insertMany( submitUser );
|
|
2238
|
+
}
|
|
2239
|
+
} else {
|
|
2240
|
+
let deleteQuery = {
|
|
2241
|
+
date_string: insertdata.date_string,
|
|
2242
|
+
date_iso: insertdata.date_iso,
|
|
2243
|
+
client_id: insertdata.client_id,
|
|
2244
|
+
checkListId: updatedchecklist._id,
|
|
2245
|
+
checklistStatus: { $nin: [ 'submit' ] },
|
|
2246
|
+
};
|
|
2247
|
+
await processedchecklist.deleteMany( deleteQuery );
|
|
2248
|
+
await processedchecklist.insertMany( allQuestion );
|
|
2237
2249
|
}
|
|
2238
2250
|
} else {
|
|
2239
2251
|
let unAssignedList = allQuestion.reduce( ( acc, item ) => {
|
|
@@ -2255,6 +2267,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, currentdate, updatedche
|
|
|
2255
2267
|
}
|
|
2256
2268
|
}
|
|
2257
2269
|
|
|
2270
|
+
|
|
2258
2271
|
Promise.all( allQuestion.map( async ( ele ) => {
|
|
2259
2272
|
await processedchecklist.updateOne( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, userEmail: ele.userEmail, store_id: ele.store_id }, ele );
|
|
2260
2273
|
} ) );
|