tango-app-api-trax 3.9.43 → 3.9.45

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.9.43",
3
+ "version": "3.9.45",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1264,7 +1264,7 @@ async function insertData( requestData ) {
1264
1264
  client_id: getCLconfig.client_id,
1265
1265
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => store.store_id ) : [],
1266
1266
  };
1267
- if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring' ].includes( getCLconfig.checkListType ) ) {
1267
+ if ( [ 'storeopenandclose', 'mobileusagedetection', 'uniformdetection', 'customerunattended', 'staffleftinthemiddle', 'scrum', 'cleaning', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'employeemonitoring', 'activitymonitoring' ].includes( getCLconfig.checkListType ) ) {
1268
1268
  let processData = {
1269
1269
  aiStoreList: allQuestion.length ? allQuestion.map( ( store ) => {
1270
1270
  return { storeName: store.storeName, storeId: store.store_id, events: store.events };
@@ -3684,12 +3684,12 @@ export async function runAIFlag( req, res ) {
3684
3684
  let date = dayjs().format( 'YYYY-MM-DD' );
3685
3685
  if ( checklistDetails.length ) {
3686
3686
  await Promise.all( checklistDetails.map( async ( ele ) => {
3687
- let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date, $or: [ { timeFlag: { $gt: 0 } }, { questionFlag: { $gt: 0 } }, { runAIFlag: { $gt: 0 } } ] }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1 } );
3687
+ let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date, $or: [ { timeFlag: { $gt: 0 } }, { questionFlag: { $gt: 0 } }, { runAIFlag: { $gt: 0 } } ] }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1, coverage: 1, scheduleEndTime: 1 } );
3688
3688
  let emailList = ele?.notifyFlags?.notifyType.includes( 'approver' ) ? ele.approver.map( ( approver ) => approver?.value ): [];
3689
3689
  emailList = [ ...emailList, ...ele?.notifyFlags?.users?.map( ( user ) => user?.value ) ];
3690
3690
  await Promise.all( submitDetails.map( ( store ) => {
3691
3691
  let data = {
3692
- storeName: store.storeName,
3692
+ storeName: store.coverage == 'store' ? store?.storeName : store.userName,
3693
3693
  flagCount: store.timeFlag ? 1 : store?.runAIFlag + store?.questionFlag,
3694
3694
  runAIFlag: store?.runAIFlag,
3695
3695
  questionFlag: store?.questionFlag,
@@ -3698,6 +3698,8 @@ export async function runAIFlag( req, res ) {
3698
3698
  time: store.timeFlag ? '--' : store?.submitTime_string,
3699
3699
  domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags?date=${dayjs().format( 'YYYY-MM-DD' )}`,
3700
3700
  status: store.checklistStatus,
3701
+ coverage: store.coverage,
3702
+ scheduleEndTime: `${store.scheduleEndTime}, ${dayjs().format( 'DD MMM YYYY' )}`,
3701
3703
  };
3702
3704
  const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
3703
3705
  const htmlContent = handlebars.compile( fileContent );
@@ -473,7 +473,7 @@ export const getConfigDetails = async ( req, res ) => {
473
473
  isdeleted: false,
474
474
  };
475
475
 
476
- if ( [ 'storeopenandclose', 'uniformdetection', 'mobileusagedetection', 'lossprevention', 'opertaionchecklist', 'dailystorechecklist', 'storehygiene' ].includes( type ) ) {
476
+ if ( [ 'storeopenandclose', 'uniformdetection', 'mobileusagedetection', 'lossprevention', 'opertaionchecklist', 'dailystorechecklist', 'storehygiene', 'scrum', 'customerunattended' ].includes( type ) ) {
477
477
  query.checkListType = type;
478
478
  query.client_id = { $exists: false };
479
479
  }
@@ -619,6 +619,8 @@ export const zoneList = async ( req, res ) => {
619
619
  'Unattended Detection',
620
620
  'Employee Monitoring',
621
621
  'Customer Unattended',
622
+ 'Store Huddle Adherence Checklist',
623
+ 'Activity Monitoring',
622
624
 
623
625
 
624
626
  ];
@@ -4142,7 +4144,7 @@ async function updateOpenSearch( user, data ) {
4142
4144
  export const aiChecklist = async ( req, res ) => {
4143
4145
  try {
4144
4146
  let storeDetails = await storeService.count( { clientId: req.query.clientId, status: 'active' } );
4145
- let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'occupancydetection', 'employeemonitoring' ];
4147
+ let aiList = [ 'mobileusagedetection', 'storeopenandclose', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'eyetest', 'remoteoptometrist', 'storehygienemonitoring', 'cleaning', 'scrum', 'suspiciousactivity', 'suspiciousfootfall', 'drinking', 'bagdetection', 'inventorycount', 'carsattended', 'numberplateinfo', 'vehicle_check_in', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'occupancydetection', 'employeemonitoring', 'activitymonitoring' ];
4146
4148
  let checklistDetails = [];
4147
4149
  let publishList = [];
4148
4150
  let unpublishList = [];
@@ -4155,7 +4157,7 @@ export const aiChecklist = async ( req, res ) => {
4155
4157
  checklistDetails = [ ...publishList, ...unpublishList ];
4156
4158
 
4157
4159
  checklistDetails.forEach( ( item ) => {
4158
- if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'storehygienemonitoring', 'employeemonitoring' ].includes( item.checkListType ) ) {
4160
+ if ( ![ 'mobileusagedetection', 'storeopenandclose', 'cleaning', 'scrum', 'uniformdetection', 'staffleftinthemiddle', 'customerunattended', 'outsidebusinesshoursqueuetracking', 'halfshutter', 'tvcompliance', 'cameratampering', 'queuealert', 'staffgrouping', 'boxalert', 'employeeCount', 'unattendeddetection', 'storehygienemonitoring', 'employeemonitoring', 'activitymonitoring' ].includes( item.checkListType ) ) {
4159
4161
  item.storeCount = storeDetails;
4160
4162
  }
4161
4163
  } );
package/src/hbs/flag.hbs CHANGED
@@ -132,9 +132,15 @@
132
132
  <span class="o_heading o_text-dark o_mb-xxs"
133
133
  style="font-weight: 400;margin-top: 0px;margin-bottom: 4px;color: #121A26;line-height: 140%;">
134
134
  Hi,<br />
135
+ {{#eq data.status 'submit'}}
135
136
  Flag has been detected based on the response submitted in a recently completed
136
- checklist for Store {{data.storeName}}. Review
137
+ checklist for {{#eq data.coverage 'store'}} Store{{/eq}} {{#eq data.coverage 'user'}} User{{/eq}} {{data.storeName}}. Review
137
138
  the flagged item and take the necessary action from the dashboard.
139
+ {{/eq}}
140
+ {{#neq data.status 'submit'}}
141
+ The scheduled checklist for {{#eq data.coverage 'store'}} Store{{/eq}} {{#eq data.coverage 'user'}} User{{/eq}} {{data.storeName}} has not been submitted within the expected time. Review the pending checklist
142
+ and take the necessary action from the dashboard
143
+ {{/neq}}
138
144
  </span>
139
145
  </div>
140
146
  </td>
@@ -159,7 +165,7 @@
159
165
  <table align="center" bgcolor="#ffffff" border="0" cellpadding="0" cellspacing="0" width="100%"
160
166
  style="max-width: 680px;">
161
167
  <tr bgcolor="#ffffff" style="border:none;margin-top:0px;">
162
- <td class="flagText" style="padding-left:30px; line-height: 24px;color:#000000">Store Name :
168
+ <td class="flagText" style="padding-left:30px; line-height: 24px;color:#000000">{{#eq data.coverage 'store'}}Store Name {{/eq}}{{#neq data.coverage 'store'}}User Name {{/neq}} :
163
169
  </td>
164
170
  <td></td>
165
171
  <td></td>
@@ -171,25 +177,40 @@
171
177
  <td></td>
172
178
  <td class="flagText">{{data.checklistName}}</td>
173
179
  </tr>
174
-
175
- <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
176
- <td class="flagText" style="padding-left:30px; line-height: 24px;">No of Flags :</td>
177
- <td></td>
178
- <td></td>
179
- <td class="flagText">{{data.flagCount}}{{#eq data.status 'submit'}}(RunAIFlag:{{data.runAIFlag}},QuestionFlag:{{data.questionFlag}}){{/eq}}</td>
180
- </tr>
181
- <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
182
- <td class="flagText" style="padding-left:30px; line-height: 24px;">Submitted By :</td>
183
- <td></td>
184
- <td></td>
185
- <td class="flagText">{{data.submittedBy}}</td>
186
- </tr>
187
- <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
188
- <td class="flagText" style="padding-left:30px; line-height: 24px;">Date & Time :</td>
189
- <td></td>
190
- <td></td>
191
- <td class="flagText">{{data.time}}</td>
192
- </tr>
180
+ {{#eq data.status 'submit'}}
181
+ <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
182
+ <td class="flagText" style="padding-left:30px; line-height: 24px;">No of Flags :</td>
183
+ <td></td>
184
+ <td></td>
185
+ <td class="flagText">{{data.flagCount}}{{#eq data.status 'submit'}}(RunAIFlag:{{data.runAIFlag}},QuestionFlag:{{data.questionFlag}}){{/eq}}</td>
186
+ </tr>
187
+ <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
188
+ <td class="flagText" style="padding-left:30px; line-height: 24px;">Submitted By :</td>
189
+ <td></td>
190
+ <td></td>
191
+ <td class="flagText">{{data.submittedBy}}</td>
192
+ </tr>
193
+ <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
194
+ <td class="flagText" style="padding-left:30px; line-height: 24px;">Date & Time :</td>
195
+ <td></td>
196
+ <td></td>
197
+ <td class="flagText">{{data.time}}</td>
198
+ </tr>
199
+ {{/eq}}
200
+ {{#neq data.status 'submit'}}
201
+ <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
202
+ <td class="flagText" style="padding-left:30px; line-height: 24px;">Scheduled Date & Time:</td>
203
+ <td></td>
204
+ <td></td>
205
+ <td class="flagText">{{data.scheduleEndTime}}</td>
206
+ </tr>
207
+ <tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
208
+ <td class="flagText" style="padding-left:30px; line-height: 24px;">Flag Type :</td>
209
+ <td></td>
210
+ <td></td>
211
+ <td class="flagText">Not Submitted</td>
212
+ </tr>
213
+ {{/neq}}
193
214
  </table>
194
215
  </td>
195
216
  </tr>