tango-app-api-store-builder 1.0.0-beta-127 → 1.0.0-beta-128
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
|
@@ -1329,16 +1329,18 @@ export async function getVmDetails( req, res ) {
|
|
|
1329
1329
|
getVmDetails = getVmDetails.toObject();
|
|
1330
1330
|
getVmDetails.templateCount = 0;
|
|
1331
1331
|
let templateDetails = await fixtureTemplateService.find( { 'vmConfig.vmId': { $in: req.query.vmId } } );
|
|
1332
|
-
if (
|
|
1333
|
-
getVmDetails.templateCount = templateDetails.length;
|
|
1332
|
+
if ( getVmDetails.status != 'draft' ) {
|
|
1334
1333
|
getVmDetails.status = 'inactive';
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
let
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1334
|
+
if ( templateDetails.length ) {
|
|
1335
|
+
getVmDetails.templateCount = templateDetails.length;
|
|
1336
|
+
let fixtureDetails = await storeFixtureService.find( { 'vmConfig.vmId': { $in: req.query.vmId } }, { planoId: 1 } );
|
|
1337
|
+
if ( fixtureDetails.length ) {
|
|
1338
|
+
let planoList = fixtureDetails.map( ( ele ) => ele.planoId );
|
|
1339
|
+
let planoDetails = await planoService.find( { _id: { $in: planoList } }, { status: 1 } );
|
|
1340
|
+
planoDetails = planoDetails.map( ( ele ) => ele.status );
|
|
1341
|
+
if ( planoDetails.includes( 'completed' ) ) {
|
|
1342
|
+
getVmDetails.status = 'active';
|
|
1343
|
+
}
|
|
1342
1344
|
}
|
|
1343
1345
|
}
|
|
1344
1346
|
}
|
|
@@ -3217,7 +3217,7 @@ export async function planoList( req, res ) {
|
|
|
3217
3217
|
},
|
|
3218
3218
|
{
|
|
3219
3219
|
$group: {
|
|
3220
|
-
_id: { store: '$storeName', type: '$planoType' },
|
|
3220
|
+
_id: { store: '$storeName', floorId: '$floorId', type: '$planoType' },
|
|
3221
3221
|
planoId: { $last: '$planoId' },
|
|
3222
3222
|
checklistStatus: { $last: '$checklistStatus' },
|
|
3223
3223
|
taskId: { $last: '$_id' },
|
|
@@ -3235,6 +3235,7 @@ export async function planoList( req, res ) {
|
|
|
3235
3235
|
planoId: 1,
|
|
3236
3236
|
checklistStatus: 1,
|
|
3237
3237
|
taskId: 1,
|
|
3238
|
+
floorId: '$_id.floorId',
|
|
3238
3239
|
},
|
|
3239
3240
|
},
|
|
3240
3241
|
];
|
|
@@ -3315,7 +3316,7 @@ export async function planoList( req, res ) {
|
|
|
3315
3316
|
},
|
|
3316
3317
|
{
|
|
3317
3318
|
$group: {
|
|
3318
|
-
_id: '$planoType',
|
|
3319
|
+
_id: { type: '$planoType', floorId: '$floorId' },
|
|
3319
3320
|
dateString: { $last: '$date_string' },
|
|
3320
3321
|
checklistStatus: { $last: '$checklistStatus' },
|
|
3321
3322
|
taskId: { $last: '$_id' },
|
|
@@ -3326,9 +3327,10 @@ export async function planoList( req, res ) {
|
|
|
3326
3327
|
_id: null,
|
|
3327
3328
|
taskStatus: {
|
|
3328
3329
|
$push: {
|
|
3329
|
-
type: '$_id',
|
|
3330
|
+
type: '$_id.type',
|
|
3330
3331
|
status: '$checklistStatus',
|
|
3331
3332
|
date: '$dateString',
|
|
3333
|
+
floorId: '$_id.floorId',
|
|
3332
3334
|
},
|
|
3333
3335
|
},
|
|
3334
3336
|
taskIds: { $push: '$taskId' },
|
|
@@ -3360,7 +3362,7 @@ export async function planoList( req, res ) {
|
|
|
3360
3362
|
{ $sort: { _id: -1 } },
|
|
3361
3363
|
{
|
|
3362
3364
|
$group: {
|
|
3363
|
-
_id: '$
|
|
3365
|
+
_id: '$floorId',
|
|
3364
3366
|
layoutCount: {
|
|
3365
3367
|
$sum: {
|
|
3366
3368
|
$cond: {
|
|
@@ -3539,6 +3541,35 @@ export async function planoList( req, res ) {
|
|
|
3539
3541
|
},
|
|
3540
3542
|
},
|
|
3541
3543
|
},
|
|
3544
|
+
{
|
|
3545
|
+
$group: {
|
|
3546
|
+
_id: null,
|
|
3547
|
+
layoutCount: { $sum: '$layoutCount' },
|
|
3548
|
+
fixtureCount: { $sum: '$fixtureCount' },
|
|
3549
|
+
vmCount: { $sum: '$vmCount' },
|
|
3550
|
+
completeLayout: {
|
|
3551
|
+
$sum: {
|
|
3552
|
+
$cond: {
|
|
3553
|
+
if: {
|
|
3554
|
+
$and: [
|
|
3555
|
+
{ '$gt': [ '$layoutCount', 0 ] },
|
|
3556
|
+
{ '$gt': [ '$layoutPending', 0 ] },
|
|
3557
|
+
{ '$gt': [ '$fixtureCount', 0 ] },
|
|
3558
|
+
{ '$gt': [ '$fixturePending', 0 ] },
|
|
3559
|
+
{ '$gt': [ '$vmCount', 0 ] },
|
|
3560
|
+
{ '$gt': [ '$fixturePending', 0 ] },
|
|
3561
|
+
],
|
|
3562
|
+
},
|
|
3563
|
+
then: 1,
|
|
3564
|
+
else: 0,
|
|
3565
|
+
},
|
|
3566
|
+
},
|
|
3567
|
+
},
|
|
3568
|
+
layoutPending: { $sum: '$layoutPending' },
|
|
3569
|
+
fixturePending: { $sum: '$fixturePending' },
|
|
3570
|
+
vmPending: { $sum: '$vmPending' },
|
|
3571
|
+
},
|
|
3572
|
+
},
|
|
3542
3573
|
{
|
|
3543
3574
|
$project: {
|
|
3544
3575
|
_id: 0,
|
|
@@ -3636,6 +3667,7 @@ export async function planoList( req, res ) {
|
|
|
3636
3667
|
layoutCount: 1,
|
|
3637
3668
|
fixtureCount: 1,
|
|
3638
3669
|
vmCount: 1,
|
|
3670
|
+
completeLayout: 1,
|
|
3639
3671
|
},
|
|
3640
3672
|
},
|
|
3641
3673
|
],
|
|
@@ -290,17 +290,17 @@ export async function createTask( req, res ) {
|
|
|
290
290
|
taskData.userName = userDetails.userName;
|
|
291
291
|
taskData.userEmail = userDetails.email;
|
|
292
292
|
taskData.planoId = planoDetails?._id;
|
|
293
|
-
for ( let
|
|
293
|
+
for ( let j=0; j<req.body.days; j++ ) {
|
|
294
294
|
let planoProgress = req.body.checkListName == 'Fixture Verification' ? 50 : req.body.checkListName == 'VM Verification' ? 75 : 25;
|
|
295
295
|
if ( req.body?.checkListName && req.body.checkListName == 'Layout Verification' ) {
|
|
296
|
-
let taskIdList = await planoTaskService.find( { planoId: planoDetails?._id, floorId:
|
|
296
|
+
let taskIdList = await planoTaskService.find( { planoId: planoDetails?._id, floorId: taskData.floorId } );
|
|
297
297
|
taskIdList = taskIdList.map( ( ele ) => ele.taskId );
|
|
298
|
-
await planoTaskService.deleteMany( { planoId: planoDetails?._id, floorId:
|
|
298
|
+
await planoTaskService.deleteMany( { planoId: planoDetails?._id, floorId: taskData.floorId } );
|
|
299
299
|
planoProgress = 25;
|
|
300
300
|
await processedService.deleteMany( { _id: taskIdList } );
|
|
301
301
|
}
|
|
302
302
|
await planoService.updateOne( { _id: planoDetails?._id }, { $set: { planoProgress } } );
|
|
303
|
-
let currDate = dayjs().add(
|
|
303
|
+
let currDate = dayjs().add( j, 'day' );
|
|
304
304
|
let insertData = { ...taskData, date_string: currDate.format( 'YYYY-MM-DD' ), date_iso: new Date( currDate.format( 'YYYY-MM-DD' ) ), scheduleStartTime_iso: dayjs.utc( `${currDate.format( 'YYYY-MM-DD' )} 12:00 AM`, 'YYYY-MM-DD hh:mm A' ).format() };
|
|
305
305
|
await processedService.updateOne( { date_string: currDate.format( 'YYYY-MM-DD' ), store_id: insertData.store_id, userEmail: insertData.userEmail, planoId: insertData.planoId, sourceCheckList_id: task._id, ...( taskData?.floorId ) ? { floorId: taskData.floorId }:{} }, insertData );
|
|
306
306
|
}
|