sf-i-events 1.0.950 → 1.0.951

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.
@@ -1709,6 +1709,8 @@ export class SfIEvents extends LitElement {
1709
1709
  suspenseFlag: boolean = false;
1710
1710
 
1711
1711
  tablecols: string[] = []
1712
+
1713
+ reportedLocationsVals: any[] = []
1712
1714
  static override styles = css`
1713
1715
 
1714
1716
  .bg-white {
@@ -2261,6 +2263,10 @@ export class SfIEvents extends LitElement {
2261
2263
  margin-left: 10px;
2262
2264
  }
2263
2265
 
2266
+ .ml-10-m-0 {
2267
+ margin-left: 10px;
2268
+ }
2269
+
2264
2270
  .mt-20 {
2265
2271
  margin-top: 20px;
2266
2272
  }
@@ -2269,6 +2275,10 @@ export class SfIEvents extends LitElement {
2269
2275
  margin-left: 20px;
2270
2276
  }
2271
2277
 
2278
+ .ml-20-m-0 {
2279
+ margin-left: 20px;
2280
+ }
2281
+
2272
2282
  .mr-20 {
2273
2283
  margin-right: 20px;
2274
2284
  }
@@ -2431,6 +2441,14 @@ export class SfIEvents extends LitElement {
2431
2441
  .calendar-right-data {
2432
2442
  width: 100%;
2433
2443
  }
2444
+
2445
+ .ml-10-m-0 {
2446
+ margin-left: 0px;
2447
+ }
2448
+
2449
+ .ml-20-m-0 {
2450
+ margin-left: 0px;
2451
+ }
2434
2452
 
2435
2453
  }
2436
2454
 
@@ -4816,9 +4834,9 @@ export class SfIEvents extends LitElement {
4816
4834
  const eventIdSanitized = event.id.replace(/-/g, '_');
4817
4835
  const mmddSanitized = mmdd.replace(/\//g, '-');
4818
4836
  const dueDateParts = event.duedate.split('/');
4819
- const isReportedLocation = event.reportedlocationsflag == true
4820
- const isSuspense = event.suspense == true
4821
- const isReviewed = event.review == true
4837
+ const isReportedLocation = event.reportedlocationsflag == true
4838
+ const isSuspense = event.suspense == true
4839
+ const isReviewed = event.review == true
4822
4840
  const showCheckbox = !(hasReportFormat || isBulk || hasCustomReporting || isReportedLocation);
4823
4841
  // const showReportingButton = !hasReportFormat && !hasCustomReporting && event.reporters == null;
4824
4842
  const showReportingButton = !hasReportFormat && !hasCustomReporting && event.concise != null && !isReportedLocation;
@@ -5211,7 +5229,7 @@ export class SfIEvents extends LitElement {
5211
5229
  const configFlag = configHome.features != null && configHome.features.indexOf("understood") >= 0
5212
5230
  html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span>&nbsp;&nbsp;Mark Understood</button>')) : '') + '</div>';
5213
5231
  // }
5214
-
5232
+
5215
5233
  return html;
5216
5234
 
5217
5235
  }
@@ -5920,7 +5938,9 @@ export class SfIEvents extends LitElement {
5920
5938
  let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
5921
5939
  let docsOptional = event['docs'] == null ? [] : event['docs'];
5922
5940
  let uploadGuidance = event['uploadguidance'] ?? 0
5923
- console.log('rendering reporting', event, percentage)
5941
+ this.reportedLocationsVals = (event['reportedlocations'] != null) ? (Util.isJSONParsable(event['reportedlocations']) ? JSON.parse(event['reportedlocations']) : [event['reportedlocations']]) : ['']
5942
+ console.log('reportedLocations found', this.reportedLocationsVals)
5943
+ console.log('rendering reporting', event, percentage, this.reportedLocationsVals)
5924
5944
  if (this.selectedItemIds.length > 0) {
5925
5945
  html += `<div class="d-flex justify-between ">
5926
5946
  <h4 class="m-0 bulk-upload-label" part="bulk-upload-label">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
@@ -5952,19 +5972,39 @@ export class SfIEvents extends LitElement {
5952
5972
  if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
5953
5973
  html += '<label part="input-label">Date of Completion*</label>';
5954
5974
  html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
5955
- html += '<div class="d-flex justify-start align-center">';
5975
+ html += '<div class="d-flex justify-start align-center flex-wrap">';
5956
5976
  html += '<div class="d-flex flex-col flex-grow">';
5957
5977
  html += '<label part="input-label">Completion Percentage</label>';
5958
5978
  html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1" disabled/><br />';
5959
5979
  html += '</div>'
5960
- html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
5980
+ html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
5961
5981
  html += '<label part="input-label">Entity</label>';
5962
- html += '<select id="input-reporter-entity" part="input"></select><br />';
5982
+ html += '<select id="input-reporter-entity-0" part="input" disabled></select>';
5963
5983
  html += '</div>'
5964
- html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
5984
+ html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
5965
5985
  html += '<label part="input-label">Location</label>';
5966
- html += '<select id="input-reporter-location" part="input"></select><br />';
5986
+ html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input" disabled></select>';
5967
5987
  html += '</div>'
5988
+ // html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">' + (this.reportedLocationsVals.length >= 1 ? 'remove' : 'add') + '</button><br /></div>'
5989
+ if (this.reportedLocationsVals.length > 1) {
5990
+ let indexLocation = 1;
5991
+ while (indexLocation < this.reportedLocationsVals.length) {
5992
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
5993
+ html += '<div class="d-flex flex-col flex-grow">';
5994
+ html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
5995
+ html += '</div>'
5996
+ html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
5997
+ html += '<label part="input-label">Entity</label>';
5998
+ html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
5999
+ html += '</div>'
6000
+ html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
6001
+ html += '<label part="input-label">Location</label>';
6002
+ html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
6003
+ html += '</div>'
6004
+ // html += '<button id="button-reporter-location-add-' + indexLocation + '" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">' + (indexLocation < this.reportedLocationsVals.length - 1 ? 'remove' : 'add') + '</button><br /></div>'
6005
+ indexLocation++
6006
+ }
6007
+ }
5968
6008
  html += '</div>'
5969
6009
 
5970
6010
  }
@@ -6026,20 +6066,41 @@ export class SfIEvents extends LitElement {
6026
6066
  if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
6027
6067
  html += '<label part="input-label">Date of Completion*</label>';
6028
6068
  html += '<input id="input-reporter-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" max="' + (new Date().toISOString().substring(0, 10)) + '"/><br />';
6029
- html += '<div class="d-flex justify-start align-center">';
6069
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
6030
6070
  html += '<div class="d-flex flex-col flex-grow">';
6031
6071
  html += '<label part="input-label">Completion Percentage*</label>';
6032
- html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/><br />';
6072
+ html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/>';
6033
6073
  html += '</div>'
6034
- html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
6074
+ html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
6035
6075
  html += '<label part="input-label">Entity</label>';
6036
- html += '<select id="input-reporter-entity" part="input"></select><br />';
6076
+ html += '<select id="input-reporter-entity-0" part="input"></select>';
6037
6077
  html += '</div>'
6038
- html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
6078
+ html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
6039
6079
  html += '<label part="input-label">Location</label>';
6040
- html += '<select id="input-reporter-location" part="input"></select><br />';
6041
- html += '</div>'
6080
+ html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input"></select>';
6042
6081
  html += '</div>'
6082
+ html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">remove</button><br /></div>'
6083
+ if (this.reportedLocationsVals.length > 1) {
6084
+ let indexLocation = 1;
6085
+ while (indexLocation < this.reportedLocationsVals.length) {
6086
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
6087
+ html += '<div class="d-flex flex-col flex-grow">';
6088
+ html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
6089
+ html += '</div>'
6090
+ html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
6091
+ html += '<label part="input-label">Entity</label>';
6092
+ html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
6093
+ html += '</div>'
6094
+ html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
6095
+ html += '<label part="input-label">Location</label>';
6096
+ html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
6097
+ html += '</div>'
6098
+ html += '<button id="button-reporter-location-add-' + indexLocation + '" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">remove</button><br /></div>'
6099
+ indexLocation++
6100
+ }
6101
+ }
6102
+ html += '<div class="d-flex justify-end align-end mt-10" class="input-report-location-add-container">';
6103
+ html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10-m-0 hide">add</button><br /></div>'
6043
6104
  html += '<div part="input-reporter-percentage-message" class="input-reporter-percentage-message mb-20">For reporting full non-compliance, choose 0%. For reporting compliance with gaps, choose the appropriate % value.</div><br />'
6044
6105
 
6045
6106
  // if(docsOptional.length === 0) {
@@ -6264,7 +6325,11 @@ export class SfIEvents extends LitElement {
6264
6325
  listReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
6265
6326
  console.log('upload guidance clicked', event);
6266
6327
  let inputReportingPercentage = (listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
6267
- let selectReportedLocation = (listReportingContainer.querySelector('#input-reporter-location') as HTMLSelectElement)?.value ?? "";
6328
+ let selectReportedLocations = (listReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
6329
+ let selectReportedLocationValue = "[]";
6330
+ for (let selectReportedLocation of selectReportedLocations) {
6331
+ selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value])
6332
+ }
6268
6333
  let approvercomments = (listReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
6269
6334
  let reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
6270
6335
  let dateOfCompletion;
@@ -6278,97 +6343,161 @@ export class SfIEvents extends LitElement {
6278
6343
  dateOfCompletion = "";
6279
6344
  }
6280
6345
  console.log('dateOfCompletion', dateOfCompletion)
6281
- await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocation, documents, dateOfCompletion);
6346
+ await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
6282
6347
  })
6283
6348
  if (this.mode == "consumer" || this.mode == "next") {
6284
6349
  let inputReportingPercentage = listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
6285
6350
  let percentage = inputReportingPercentage.value
6286
-
6351
+ const entityContainers = listReportingContainer.querySelectorAll('.reporting-entity-container') as NodeListOf<HTMLDivElement>;
6352
+ const locationsContainers = listReportingContainer.querySelectorAll('.reporting-location-container') as NodeListOf<HTMLDivElement>;
6353
+ const addLocationButtons = listReportingContainer.querySelectorAll('.button-reporter-location-add') as NodeListOf<HTMLButtonElement>;
6287
6354
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
6288
- (listReportingContainer.querySelector('#reporting-entity-container') as HTMLDivElement).classList.remove('hide');
6289
- (listReportingContainer.querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
6355
+ entityContainers.forEach(container => container.classList.remove('hide'));
6356
+ locationsContainers.forEach(container => container.classList.remove('hide'));
6357
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
6290
6358
  } else {
6291
- (listReportingContainer.querySelector('#reporting-entity-container') as HTMLDivElement).classList.add('hide');
6292
- (listReportingContainer.querySelector('#reporting-location-container') as HTMLDivElement).classList.add('hide')
6359
+ entityContainers.forEach(container => container.classList.add('hide'));
6360
+ locationsContainers.forEach(container => container.classList.add('hide'));
6361
+ addLocationButtons.forEach(container => container.classList.add('hide'));
6293
6362
  }
6294
6363
  inputReportingPercentage?.addEventListener('change', () => {
6295
6364
  setTimeout(() => {
6296
6365
  let percentage = inputReportingPercentage.value
6297
- console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
6366
+ console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
6298
6367
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
6299
- (listReportingContainer.querySelector('#reporting-entity-container') as HTMLDivElement).classList.remove('hide');
6300
- (listReportingContainer.querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
6368
+ entityContainers.forEach(container => container.classList.remove('hide'));
6369
+ locationsContainers.forEach(container => container.classList.remove('hide'));
6370
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
6301
6371
  } else {
6302
- (listReportingContainer.querySelector('#reporting-entity-container') as HTMLDivElement).classList.add('hide');
6303
- (listReportingContainer.querySelector('#reporting-location-container') as HTMLDivElement).classList.add('hide')
6372
+ entityContainers.forEach(container => container.classList.add('hide'));
6373
+ locationsContainers.forEach(container => container.classList.add('hide'));
6374
+ addLocationButtons.forEach(container => container.classList.add('hide'));
6304
6375
  }
6305
6376
  if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
6306
6377
  (listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
6307
6378
  } else {
6308
6379
  (listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
6309
6380
  }
6381
+ if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
6382
+ event.percentage = percentage
6383
+ event.reportedlocations = JSON.stringify([""])
6384
+ event.reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
6385
+ event.dateofcompletion = (listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
6386
+ event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
6387
+ console.log('rendering list reporting', event.percentage, event.reportedlocations)
6388
+ this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
6389
+ }
6310
6390
  }, 200);
6311
6391
  })
6312
- let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity') as HTMLSelectElement;
6313
- let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location') as HTMLSelectElement;
6314
- selectReportingEntity.innerHTML = '';
6315
6392
  let projectUserMap = Util.getProjectUsermap()
6316
- for (let country of Object.keys(projectUserMap)) {
6317
- if (country == "roles") {
6318
- continue;
6319
- }
6320
- for (let entity of Object.keys(projectUserMap[country])) {
6321
- let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
6322
- let option = new Option(entityName, entity)
6323
- selectReportingEntity.add(option);
6324
- }
6325
- }
6326
- selectReportingEntity.addEventListener('change', (e: any) => {
6327
- selectReportingLocation.innerHTML = ''
6393
+ addLocationButtons.forEach((addLocationBtn) => {
6394
+ addLocationBtn.addEventListener('click', () => {
6395
+ let iconhtml = addLocationBtn.innerHTML
6396
+ let index = parseInt(addLocationBtn.id.split('-')[4])
6397
+ console.log('button clicked', iconhtml, addLocationBtn.id);
6398
+ if (iconhtml == "add") {
6399
+ console.log('this.reportedLocationsVals', this.reportedLocationsVals)
6400
+ this.reportedLocationsVals.push("");
6401
+ } else {
6402
+ this.reportedLocationsVals.splice(index, 1);
6403
+ }
6404
+ event.percentage = inputReportingPercentage.value;
6405
+ event.reportedlocations = JSON.stringify(this.reportedLocationsVals)
6406
+ if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
6407
+ event.percentage = "100";
6408
+ }
6409
+ console.log('rendering list reporting', event.percentage, event.reportedlocations)
6410
+ event.reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
6411
+ event.dateofcompletion = (listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
6412
+ event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
6413
+ this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
6414
+ })
6415
+ })
6416
+
6417
+ for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
6418
+ console.log('AddingEntities', indexRepLoc)
6419
+ let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc) as HTMLSelectElement;
6420
+ let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc) as HTMLSelectElement;
6421
+ selectReportingEntity.innerHTML = '';
6328
6422
  for (let country of Object.keys(projectUserMap)) {
6329
6423
  if (country == "roles") {
6330
6424
  continue;
6331
6425
  }
6332
6426
  for (let entity of Object.keys(projectUserMap[country])) {
6333
- if (entity.indexOf(e.target.value) < 0) {
6427
+ let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
6428
+ let option = new Option(entityName, entity)
6429
+ selectReportingEntity.add(option);
6430
+ }
6431
+ }
6432
+ selectReportingEntity.addEventListener('change', (e: any) => {
6433
+ selectReportingLocation.innerHTML = ''
6434
+ for (let country of Object.keys(projectUserMap)) {
6435
+ if (country == "roles") {
6436
+ continue;
6437
+ }
6438
+ for (let entity of Object.keys(projectUserMap[country])) {
6439
+ if (entity.indexOf(e.target.value) < 0) {
6440
+ continue;
6441
+ }
6442
+ for (let location of Object.keys(projectUserMap[country][entity])) {
6443
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
6444
+ let option = new Option(locationName, location)
6445
+ selectReportingLocation.add(option);
6446
+ }
6447
+ }
6448
+ }
6449
+ (listReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc) as HTMLDivElement).classList.remove('hide')
6450
+ selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
6451
+ })
6452
+ if(selectReportingLocation.innerHTML == ''){
6453
+ for (let country of Object.keys(projectUserMap)) {
6454
+ if (country == "roles") {
6334
6455
  continue;
6335
6456
  }
6336
- for (let location of Object.keys(projectUserMap[country][entity])) {
6337
- let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
6338
- let option = new Option(locationName, location)
6339
- selectReportingLocation.add(option);
6457
+ for (let entity of Object.keys(projectUserMap[country])) {
6458
+ for (let location of Object.keys(projectUserMap[country][entity])) {
6459
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
6460
+ let option = new Option(locationName, location)
6461
+ selectReportingLocation.add(option);
6462
+ break;
6463
+ }
6464
+ break;
6340
6465
  }
6466
+ break;
6341
6467
  }
6342
6468
  }
6343
- (listReportingContainer.querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
6344
- selectReportingLocation.value = event.reportedlocations ?? "";
6345
- })
6346
- if (event.reportedlocations != null && event.reportedlocations.length > 0) {
6347
- console.log('setting reportedlocations', event.reportedlocations)
6348
- for (let country of Object.keys(projectUserMap)) {
6349
- if (country == "roles") {
6350
- continue;
6351
- }
6352
- for (let entity of Object.keys(projectUserMap[country])) {
6353
- let flagSetVal = false;
6354
- for (let location of Object.keys(projectUserMap[country][entity])) {
6355
- if (event.reportedlocations.indexOf(location) >= 0) {
6356
- selectReportingEntity.value = entity;
6357
- const changeEvent = new Event('change', { bubbles: true });
6358
- selectReportingEntity.dispatchEvent(changeEvent)
6359
- selectReportingLocation.value = location;
6360
- flagSetVal = true;
6469
+ selectReportingLocation.addEventListener('change', (e: any) => {
6470
+ let index = parseInt(e.target.id.split('-')[3])
6471
+ this.reportedLocationsVals[index] = e.target.value
6472
+ })
6473
+ if (event.reportedlocations != null && event.reportedlocations.length > 0) {
6474
+ console.log('setting reportedlocations', event.reportedlocations)
6475
+ let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations
6476
+ for (let country of Object.keys(projectUserMap)) {
6477
+ if (country == "roles") {
6478
+ continue;
6479
+ }
6480
+ for (let entity of Object.keys(projectUserMap[country])) {
6481
+ let flagSetVal = false;
6482
+ for (let location of Object.keys(projectUserMap[country][entity])) {
6483
+ if (tempReportedLocation.indexOf(location) >= 0) {
6484
+ selectReportingEntity.value = entity;
6485
+ const changeEvent = new Event('change', { bubbles: true });
6486
+ selectReportingEntity.dispatchEvent(changeEvent)
6487
+ selectReportingLocation.value = location;
6488
+ flagSetVal = true;
6489
+ break;
6490
+ }
6491
+ }
6492
+ if (flagSetVal) {
6361
6493
  break;
6362
6494
  }
6363
6495
  }
6364
- if (flagSetVal) {
6365
- break;
6366
- }
6367
6496
  }
6497
+ } else {
6498
+ selectReportingEntity.value = "";
6499
+ selectReportingLocation.value = "";
6368
6500
  }
6369
- } else {
6370
- selectReportingEntity.value = "";
6371
- selectReportingLocation.value = "";
6372
6501
  }
6373
6502
 
6374
6503
  listReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
@@ -6744,7 +6873,14 @@ export class SfIEvents extends LitElement {
6744
6873
 
6745
6874
  } else {
6746
6875
  let flagBulk = false;
6747
- let reportedlocations = selectReportingLocation?.value ?? "";
6876
+ // let reportedlocations = selectReportingLocation?.value ?? "";
6877
+ let reportedlocations = "[]";
6878
+ if (parseInt(percentage) !== 100) {
6879
+ let selectReportedLocations = (listReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
6880
+ for (let selectReportedLocation of selectReportedLocations) {
6881
+ reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value])
6882
+ }
6883
+ }
6748
6884
  if (this.selectedItemIds.length <= 1) {
6749
6885
 
6750
6886
  if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, event.makercheckers, reportedlocations)) {
@@ -6753,6 +6889,8 @@ export class SfIEvents extends LitElement {
6753
6889
  for (var p = 0; p < this.events[mmdd].length; p++) {
6754
6890
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
6755
6891
  this.events[mmdd][p].documents = docs
6892
+ this.events[mmdd][p].percentage = percentage
6893
+ this.events[mmdd][p].reportedlocations = reportedlocations
6756
6894
  this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
6757
6895
  this.events[mmdd][p].lastupdated = new Date().toString()
6758
6896
  }
@@ -6779,6 +6917,8 @@ export class SfIEvents extends LitElement {
6779
6917
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
6780
6918
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
6781
6919
  this.nextEvents[this.nextTabRole][mmdd][p].documents = docs
6920
+ this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage
6921
+ this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations
6782
6922
  this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
6783
6923
  this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
6784
6924
  }
@@ -7070,7 +7210,6 @@ export class SfIEvents extends LitElement {
7070
7210
  let listReportingContainer = eventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
7071
7211
  // console.log('mmddyyyy', this.events[mmdd][j], listReportingContainer, '#list-reporting-container-'+mmdd.replace(/\//g,'-')+'-'+j);
7072
7212
  if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
7073
- 4
7074
7213
  this.renderListReporting(listReportingContainer, this.events[mmdd][j], mmdd + '/' + yyyy, eventsContainer)
7075
7214
  } else {
7076
7215
  listReportingContainer.innerHTML = '';
@@ -7098,11 +7237,11 @@ export class SfIEvents extends LitElement {
7098
7237
  const j = idArr[5];
7099
7238
  console.log('review clicked', mmdd, yyyy, j, this.events[mmdd][j], ev.target.checked);
7100
7239
  let eventKey = this.events[mmdd][j].entityid + ';' + this.events[mmdd][j].locationid + ';' + this.events[mmdd][j].id;
7101
- for(var p = 0; p < Object.keys(this.events).length; p++) {
7240
+ for (var p = 0; p < Object.keys(this.events).length; p++) {
7102
7241
  let tempMmDd = Object.keys(this.events)[p];
7103
- for(var q = 0; q < this.events[tempMmDd].length; q++) {
7242
+ for (var q = 0; q < this.events[tempMmDd].length; q++) {
7104
7243
  let tempEventKey = this.events[tempMmDd][q].entityid + ';' + this.events[tempMmDd][q].locationid + ';' + this.events[tempMmDd][q].id;
7105
- if(tempEventKey == eventKey) {
7244
+ if (tempEventKey == eventKey) {
7106
7245
  this.events[tempMmDd][q].review = ev.target.innerHTML.indexOf('flag_check') < 0
7107
7246
  }
7108
7247
  }
@@ -16910,7 +17049,7 @@ export class SfIEvents extends LitElement {
16910
17049
  this.setSuccess("Renewal successful");
16911
17050
  setTimeout(() => {
16912
17051
  this.clearMessages()
16913
- },3000)
17052
+ }, 3000)
16914
17053
  } else {
16915
17054
  if (xhr.status == 401) {
16916
17055
  let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
@@ -17141,8 +17280,8 @@ export class SfIEvents extends LitElement {
17141
17280
  reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
17142
17281
  }
17143
17282
  let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
17144
- console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues),comparedObj)
17145
- if(Object.keys(comparedObj).length > 0){
17283
+ console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj)
17284
+ if (Object.keys(comparedObj).length > 0) {
17146
17285
  await this.sendSuggestions(listEvent.id, comparedObj);
17147
17286
  }
17148
17287
  // return;
@@ -17841,12 +17980,12 @@ export class SfIEvents extends LitElement {
17841
17980
  console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
17842
17981
  console.log('previousid', previousId, 'nextid', nextId);
17843
17982
  console.log('confighome', Util.getProjectConfigHome())
17844
- let comments, docs, approved, /*dateOfCompletion,*/ makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any;
17983
+ let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
17845
17984
  let entityId: string = "";
17846
17985
  let locationId: string = "";
17847
17986
  let statuteName: string = "";
17848
17987
  let reportformatName: string = "";
17849
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
17988
+ // let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
17850
17989
  entityId = event.entityid;
17851
17990
  locationId = event.locationid;
17852
17991
  // let completeness = this.getCompletenessStatus(event);
@@ -17854,9 +17993,9 @@ export class SfIEvents extends LitElement {
17854
17993
  docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
17855
17994
  approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
17856
17995
  // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
17857
- makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
17858
- docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
17859
- documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
17996
+ // makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
17997
+ // docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
17998
+ // documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
17860
17999
 
17861
18000
  statuteName = event['statute'][0].trim();
17862
18001
  if (event['reportformat'] != null) {
@@ -18187,7 +18326,7 @@ export class SfIEvents extends LitElement {
18187
18326
 
18188
18327
  if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
18189
18328
  if (this.mode != "viewer") {
18190
- html += '<div part="reporting-view-container">'
18329
+ html += '<div part="reporting-view-container" id="reporting-view-container">'
18191
18330
  html += this.renderReporting(event, mmddyyyy);
18192
18331
  html += "</div>"
18193
18332
  }
@@ -18275,95 +18414,12 @@ export class SfIEvents extends LitElement {
18275
18414
 
18276
18415
  (this._SfDetailContainer as HTMLDivElement).innerHTML = html;
18277
18416
  (this._SfDetailContainer as HTMLDivElement).style.display = 'block';
18278
- // let attachmentUploaders = (this._SfDetailContainer as HTMLDivElement).querySelectorAll('.event-attachment') as NodeListOf<SfIUploader>
18279
- // for(let attachmentUploader of attachmentUploaders){
18280
- // attachmentUploader.loadMode();
18281
- // }
18282
18417
  if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
18283
18418
  let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
18284
18419
 
18285
18420
  let emailcontent = `<table border="0" cellspacing="0" style="color:#666666;border-radius:5px;border:solid 1px #efefef;width:100%; margin-top:20px"><tbody><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Compliance ID</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.id}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Country</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.countryname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Entity</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.entityname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Location</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.locationname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Statute</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.statute[0] ?? ""}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Subcategory</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.subcategory}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Reporter</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.reporters[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Approver</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.approvers[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Due Date</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${ddmmyyyy}</td></tr></tbody></table>`;
18286
18421
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader).emailcontent = emailcontent;
18287
18422
  }
18288
- (this._SfDetailContainer as HTMLDivElement).querySelector('.button-delete')?.addEventListener('click', async () => {
18289
-
18290
- await this.fetchDeleteReview(event["id"], mmddyyyy, entityId, locationId);
18291
- this.setSuccess('Deleted successfully!')
18292
- setTimeout(() => {
18293
- this.clearMessages()
18294
- }, 3000);
18295
- //console.log('deleted', resultDelete);
18296
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
18297
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
18298
- // } else {
18299
- if (currentColumnButton != null) {
18300
- currentColumnButton.click();
18301
- }
18302
- // }
18303
-
18304
- var clickEvent = new MouseEvent("click", {
18305
- "view": window,
18306
- "bubbles": true,
18307
- "cancelable": false
18308
- });
18309
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
18310
-
18311
- });
18312
- (this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
18313
- if (this.selectedItemIds.length <= 1) {
18314
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
18315
- this.setSuccess('Auto-Approved successfully!')
18316
- setTimeout(() => {
18317
- this.clearMessages()
18318
- }, 3000);
18319
- } else {
18320
- let bulkBodyReview = []
18321
- for (var k = 0; k < this.selectedItemIds.length; k++) {
18322
-
18323
- const selectedId = this.selectedItemIds[k];
18324
- //console.log('selectedid', selectedId);
18325
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
18326
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
18327
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18328
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18329
-
18330
- //console.log(entityId, locationId, eventId, mmddyyyy);
18331
- let yearStr = this.getFinancialYear(mmddyyyy)
18332
- bulkBodyReview.push({
18333
- "mmddyyyy": mmddyyyy,
18334
- "projectid": this.projectId,
18335
- "type": "review",
18336
- "eventid": eventId,
18337
- "comments": "Auto approved",
18338
- "approved": true,
18339
- "entityid": entityId,
18340
- "locationid": locationId,
18341
- "username": this.userName,
18342
- "userid": this.userProfileId,
18343
- "userrole": this.myRole,
18344
- "year": yearStr,
18345
- "module": event.module ?? "compliance"
18346
- })
18347
- }
18348
- await this.uploadReviewsBulk(bulkBodyReview);
18349
- }
18350
- //console.log('deleted', resultDelete);
18351
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
18352
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
18353
- // } else {
18354
- if (currentColumnButton != null) {
18355
- currentColumnButton.click();
18356
- }
18357
- // }
18358
-
18359
- var clickEvent = new MouseEvent("click", {
18360
- "view": window,
18361
- "bubbles": true,
18362
- "cancelable": false
18363
- });
18364
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
18365
-
18366
- });
18367
18423
 
18368
18424
  (this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close')?.addEventListener('click', () => {
18369
18425
 
@@ -18601,101 +18657,304 @@ export class SfIEvents extends LitElement {
18601
18657
  })
18602
18658
 
18603
18659
  if (this.mode == "consumer" || this.mode == "next") {
18604
- let inputReportingPercentage = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement;
18605
- let percentage = inputReportingPercentage.value
18660
+ let eventDetailReportingContainer = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-view-container') as HTMLDivElement
18661
+ if(eventDetailReportingContainer != null){
18662
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, (this._SfDetailContainer as HTMLDivElement))
18663
+ }
18664
+ }
18665
+
18666
+ this.fetchStatuteDefinitionDetails(statuteName);
18667
+ console.log('customreporting', event['customreporting'])
18668
+ if (event['customreporting'] != null) {
18669
+ let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
18670
+ if (reportingContainer.querySelector('#report-format-container') != null) {
18671
+ reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
18672
+ console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
18673
+ (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
18674
+ (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
18675
+ (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
18676
+ // if(reportformatvalues != ""){
18677
+ // (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
18678
+ // }
18679
+ (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
18680
+ }
18681
+ } else if (event['reportformat'] != null && event['reportformat'].length > 0) {
18682
+ this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
18683
+ }
18684
+ }
18685
+
18686
+ renderEventDetailReporting = (eventDetailReportingContainer: HTMLDivElement, event: any, mmddyyyy: any, eventDetailContainer: HTMLDivElement) => {
18687
+ console.log('detailreporting event', event, this.graphFilter);
18688
+ let html = ''
18689
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
18690
+
18691
+ let reportformatName: string = '';
18692
+ if (event['reportformat'] != null) {
18693
+ reportformatName = (event['reportformat'][0] ?? "").trim().replace('&amp;', '&');
18694
+ }
18695
+ let docs = event['documents'] == null ? [] : event['documents'];
18696
+ event.approved = event['approved'] == null ? false : event['approved'];
18697
+ event.dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
18698
+ event.makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
18699
+ event.docsOptional = event['docs'] == null ? [] : event['docs'];
18700
+ html = this.renderReporting(event, mmddyyyy);
18701
+ console.log('reporting html', html);
18702
+ let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
18703
+
18704
+ let emailcontent = `<table border="0" cellspacing="0" style="color:#666666;border-radius:5px;border:solid 1px #efefef;width:100%; margin-top:20px"><tbody><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Compliance ID</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.id}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Country</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.countryname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Entity</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.entityname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Location</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.locationname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Statute</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${(event.statute[0] ?? "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Subcategory</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.subcategory}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Reporter</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.reporters[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Approver</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.approvers[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Due Date</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${ddmmyyyy}</td></tr></tbody></table>`;
18705
+ eventDetailReportingContainer.innerHTML = html;
18706
+ if (this._SfUploader[0] != null) {
18707
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.emailcontent = emailcontent;
18708
+ }
18709
+ eventDetailReportingContainer.querySelector('.button-delete')?.addEventListener('click', async () => {
18710
+
18711
+ await this.fetchDeleteReview(event["id"], mmddyyyy, event.entityid, event.locationid);
18712
+ this.setSuccess('Deleted successfully!')
18713
+ setTimeout(() => {
18714
+ this.clearMessages()
18715
+ }, 3000);
18716
+ //console.log('deleted', resultDelete);
18717
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
18718
+ this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
18719
+ } else {
18720
+ // if(currentColumnButton != null) {
18721
+ // currentColumnButton.click();
18722
+ // }
18723
+ }
18606
18724
 
18725
+ });
18726
+ eventDetailReportingContainer.querySelector('#button-auto-approve')?.addEventListener('click', async () => {
18727
+ if (this.selectedItemIds.length <= 1) {
18728
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
18729
+ this.setSuccess('Auto-Approved successfully!')
18730
+ setTimeout(() => {
18731
+ this.clearMessages()
18732
+ }, 3000);
18733
+ } else {
18734
+ let bulkBodyReview = []
18735
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
18736
+
18737
+ const selectedId = this.selectedItemIds[k];
18738
+ //console.log('selectedid', selectedId);
18739
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
18740
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
18741
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18742
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18743
+
18744
+ //console.log(entityId, locationId, eventId, mmddyyyy);
18745
+ let yearStr = this.getFinancialYear(mmddyyyy)
18746
+ bulkBodyReview.push({
18747
+ "mmddyyyy": mmddyyyy,
18748
+ "projectid": this.projectId,
18749
+ "type": "review",
18750
+ "eventid": eventId,
18751
+ "comments": "Auto approved",
18752
+ "approved": true,
18753
+ "entityid": entityId,
18754
+ "locationid": locationId,
18755
+ "username": this.userName,
18756
+ "userid": this.userProfileId,
18757
+ "userrole": this.myRole,
18758
+ "year": yearStr,
18759
+ "module": event.module ?? "compliance"
18760
+ })
18761
+ }
18762
+ await this.uploadReviewsBulk(bulkBodyReview);
18763
+ }
18764
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
18765
+ this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
18766
+ } else {
18767
+ // if(currentColumnButton != null) {
18768
+ // currentColumnButton.click();
18769
+ // }
18770
+ }
18771
+
18772
+ });
18773
+ eventDetailReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
18774
+ console.log('upload guidance clicked', event);
18775
+ let inputReportingPercentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
18776
+ let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
18777
+ let selectReportedLocationValue = "[]";
18778
+ for (let selectReportedLocation of selectReportedLocations) {
18779
+ selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value])
18780
+ }
18781
+ let approvercomments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
18782
+ let reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
18783
+ let dateOfCompletion;
18784
+ if ((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement) != null) {
18785
+ dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "";
18786
+ } else {
18787
+ dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-approver-doc') as HTMLInputElement).value).getTime() + "";
18788
+ }
18789
+ let documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader).selectedValues()
18790
+ if (dateOfCompletion == "NaN") {
18791
+ dateOfCompletion = "";
18792
+ }
18793
+ console.log('dateOfCompletion', dateOfCompletion)
18794
+ await this.fetchEventDetails(event, mmddyyyy, null, eventDetailContainer, "", "", true, eventDetailReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
18795
+ })
18796
+ if (this.mode == "consumer" || this.mode == "next") {
18797
+ let inputReportingPercentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
18798
+ let percentage = inputReportingPercentage.value
18799
+ const entityContainers = eventDetailReportingContainer.querySelectorAll('.reporting-entity-container') as NodeListOf<HTMLDivElement>;
18800
+ const locationsContainers = eventDetailReportingContainer.querySelectorAll('.reporting-location-container') as NodeListOf<HTMLDivElement>;
18801
+ const addLocationButtons = eventDetailReportingContainer.querySelectorAll('.button-reporter-location-add') as NodeListOf<HTMLButtonElement>;
18607
18802
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
18608
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.remove('hide');
18609
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
18803
+ entityContainers.forEach(container => container.classList.remove('hide'));
18804
+ locationsContainers.forEach(container => container.classList.remove('hide'));
18805
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
18610
18806
  } else {
18611
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.add('hide');
18612
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.add('hide')
18807
+ entityContainers.forEach(container => container.classList.add('hide'));
18808
+ locationsContainers.forEach(container => container.classList.add('hide'));
18809
+ addLocationButtons.forEach(container => container.classList.add('hide'));
18613
18810
  }
18614
18811
  inputReportingPercentage?.addEventListener('change', () => {
18615
18812
  setTimeout(() => {
18616
18813
  let percentage = inputReportingPercentage.value
18617
- console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
18814
+ console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
18618
18815
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
18619
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.remove('hide');
18620
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
18816
+ entityContainers.forEach(container => container.classList.remove('hide'));
18817
+ locationsContainers.forEach(container => container.classList.remove('hide'));
18818
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
18621
18819
  } else {
18622
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.add('hide');
18623
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.add('hide')
18820
+ entityContainers.forEach(container => container.classList.add('hide'));
18821
+ locationsContainers.forEach(container => container.classList.add('hide'));
18822
+ addLocationButtons.forEach(container => container.classList.add('hide'));
18624
18823
  }
18625
- if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
18626
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
18824
+ if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
18825
+ (eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
18627
18826
  } else {
18628
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
18827
+ (eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
18828
+ }
18829
+ if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
18830
+ event.percentage = percentage
18831
+ event.reportedlocations = JSON.stringify([""])
18832
+ event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
18833
+ event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
18834
+ event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
18835
+ console.log('rendering list reporting', event.percentage, event.reportedlocations)
18836
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
18629
18837
  }
18630
18838
  }, 200);
18631
18839
  })
18632
- let selectReportingEntity = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-entity') as HTMLSelectElement;
18633
- let selectReportingLocation = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-location') as HTMLSelectElement;
18634
- selectReportingEntity.innerHTML = '';
18635
18840
  let projectUserMap = Util.getProjectUsermap()
18636
- for (let country of Object.keys(projectUserMap)) {
18637
- if (country == "roles") {
18638
- continue;
18639
- }
18640
- for (let entity of Object.keys(projectUserMap[country])) {
18641
- let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
18642
- let option = new Option(entityName, entity)
18643
- selectReportingEntity.add(option);
18644
- }
18645
- }
18646
- selectReportingEntity.addEventListener('change', (e: any) => {
18647
- selectReportingLocation.innerHTML = ''
18841
+ addLocationButtons.forEach((addLocationBtn) => {
18842
+ addLocationBtn.addEventListener('click', () => {
18843
+ let iconhtml = addLocationBtn.innerHTML
18844
+ let index = parseInt(addLocationBtn.id.split('-')[4])
18845
+ console.log('button clicked', iconhtml, addLocationBtn.id);
18846
+ if (iconhtml == "add") {
18847
+ console.log('this.reportedLocationsVals', this.reportedLocationsVals)
18848
+ this.reportedLocationsVals.push("");
18849
+ } else {
18850
+ this.reportedLocationsVals.splice(index, 1);
18851
+ }
18852
+ event.percentage = inputReportingPercentage.value;
18853
+ event.reportedlocations = JSON.stringify(this.reportedLocationsVals)
18854
+ if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
18855
+ event.percentage = "100";
18856
+ }
18857
+ console.log('rendering list reporting', event.percentage, event.reportedlocations)
18858
+ event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
18859
+ event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
18860
+ event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
18861
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
18862
+ })
18863
+ })
18864
+
18865
+ for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
18866
+ console.log('AddingEntities', indexRepLoc)
18867
+ let selectReportingEntity = eventDetailReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc) as HTMLSelectElement;
18868
+ let selectReportingLocation = eventDetailReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc) as HTMLSelectElement;
18869
+ selectReportingEntity.innerHTML = '';
18648
18870
  for (let country of Object.keys(projectUserMap)) {
18649
18871
  if (country == "roles") {
18650
18872
  continue;
18651
18873
  }
18652
18874
  for (let entity of Object.keys(projectUserMap[country])) {
18653
- if (entity.indexOf(e.target.value) < 0) {
18875
+ let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
18876
+ let option = new Option(entityName, entity)
18877
+ selectReportingEntity.add(option);
18878
+ }
18879
+ }
18880
+ selectReportingEntity.addEventListener('change', (e: any) => {
18881
+ selectReportingLocation.innerHTML = ''
18882
+ for (let country of Object.keys(projectUserMap)) {
18883
+ if (country == "roles") {
18654
18884
  continue;
18655
18885
  }
18656
- for (let location of Object.keys(projectUserMap[country][entity])) {
18657
- let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
18658
- let option = new Option(locationName, location)
18659
- selectReportingLocation.add(option);
18886
+ for (let entity of Object.keys(projectUserMap[country])) {
18887
+ if (entity.indexOf(e.target.value) < 0) {
18888
+ continue;
18889
+ }
18890
+ for (let location of Object.keys(projectUserMap[country][entity])) {
18891
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
18892
+ let option = new Option(locationName, location)
18893
+ selectReportingLocation.add(option);
18894
+ }
18660
18895
  }
18661
18896
  }
18662
- }
18663
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
18664
- selectReportingLocation.value = event.reportedlocations ?? "";
18665
- })
18666
- if (event.reportedlocations != null && event.reportedlocations.length > 0) {
18667
- console.log('setting reportedlocations', event.reportedlocations)
18668
- for (let country of Object.keys(projectUserMap)) {
18669
- if (country == "roles") {
18670
- continue;
18671
- }
18672
- for (let entity of Object.keys(projectUserMap[country])) {
18673
- let flagSetVal = false;
18674
- for (let location of Object.keys(projectUserMap[country][entity])) {
18675
- if (event.reportedlocations.indexOf(location) >= 0) {
18676
- selectReportingEntity.value = entity;
18677
- const changeEvent = new Event('change', { bubbles: true });
18678
- selectReportingEntity.dispatchEvent(changeEvent)
18679
- selectReportingLocation.value = location;
18680
- flagSetVal = true;
18897
+ (eventDetailReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc) as HTMLDivElement).classList.remove('hide')
18898
+ selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
18899
+ })
18900
+
18901
+ if(selectReportingLocation.innerHTML == ''){
18902
+ for (let country of Object.keys(projectUserMap)) {
18903
+ if (country == "roles") {
18904
+ continue;
18905
+ }
18906
+ for (let entity of Object.keys(projectUserMap[country])) {
18907
+ for (let location of Object.keys(projectUserMap[country][entity])) {
18908
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
18909
+ let option = new Option(locationName, location)
18910
+ selectReportingLocation.add(option);
18681
18911
  break;
18682
18912
  }
18683
- }
18684
- if (flagSetVal) {
18685
18913
  break;
18686
18914
  }
18915
+ break;
18687
18916
  }
18688
18917
  }
18689
- } else {
18690
- selectReportingEntity.value = "";
18691
- selectReportingLocation.value = "";
18918
+ selectReportingLocation.addEventListener('change', (e: any) => {
18919
+ let index = parseInt(e.target.id.split('-')[3])
18920
+ this.reportedLocationsVals[index] = e.target.value
18921
+ })
18922
+ if (event.reportedlocations != null && event.reportedlocations.length > 0) {
18923
+ console.log('setting reportedlocations', event.reportedlocations)
18924
+ let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations
18925
+ for (let country of Object.keys(projectUserMap)) {
18926
+ if (country == "roles") {
18927
+ continue;
18928
+ }
18929
+ for (let entity of Object.keys(projectUserMap[country])) {
18930
+ let flagSetVal = false;
18931
+ for (let location of Object.keys(projectUserMap[country][entity])) {
18932
+ if (tempReportedLocation.indexOf(location) >= 0) {
18933
+ selectReportingEntity.value = entity;
18934
+ const changeEvent = new Event('change', { bubbles: true });
18935
+ selectReportingEntity.dispatchEvent(changeEvent)
18936
+ selectReportingLocation.value = location;
18937
+ flagSetVal = true;
18938
+ break;
18939
+ }
18940
+ }
18941
+ if (flagSetVal) {
18942
+ break;
18943
+ }
18944
+ }
18945
+ }
18946
+ } else {
18947
+ selectReportingEntity.value = "";
18948
+ selectReportingLocation.value = "";
18949
+ }
18692
18950
  }
18693
18951
 
18694
- (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
18952
+ eventDetailReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
18695
18953
  let buttonClick = ev.target as HTMLButtonElement
18696
18954
  buttonClick.innerHTML = "Saving..."
18697
- const comments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approver-comments') as HTMLInputElement).value;
18698
- const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
18955
+ const comments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement).value;
18956
+ console.log('comments', comments, JSON.stringify(event.comments))
18957
+ const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
18699
18958
  let currStatus = this.getCompletenessStatus(event);
18700
18959
  let newEvent = { ...event };
18701
18960
  newEvent.comments = comments;
@@ -18709,24 +18968,19 @@ export class SfIEvents extends LitElement {
18709
18968
  }, 3000);
18710
18969
  return;
18711
18970
  }
18712
- var clickEvent = new MouseEvent("click", {
18713
- "view": window,
18714
- "bubbles": true,
18715
- "cancelable": false
18716
- });
18717
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
18718
-
18719
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
18720
18971
  let flagBulk = false;
18721
18972
  if (this.selectedItemIds.length <= 1) {
18722
- // console.log('mmddyyyy', mmddyyyy)
18723
- if (await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
18973
+ console.log('selectedevent', JSON.stringify(event));
18974
+ if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
18724
18975
  for (var p = 0; p < this.events[mmdd].length; p++) {
18725
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
18726
-
18976
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
18727
18977
  this.events[mmdd][p].approved = approved
18978
+ console.log('selected event', this.events[mmdd][p]);
18728
18979
  this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
18729
18980
  this.events[mmdd][p].lastupdated = new Date().toString()
18981
+ if (approved) {
18982
+ this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
18983
+ }
18730
18984
  }
18731
18985
  }
18732
18986
  if (this.recentlyReported[mmdd] == null) {
@@ -18740,8 +18994,8 @@ export class SfIEvents extends LitElement {
18740
18994
 
18741
18995
  const selectedId = this.selectedItemIds[k];
18742
18996
  //console.log('selectedid', selectedId);
18743
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
18744
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
18997
+ let entityid = selectedId.split('-')[7].replace(/_/g, '-');
18998
+ let locationid = selectedId.split('-')[8].replace(/_/g, '-');
18745
18999
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18746
19000
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18747
19001
 
@@ -18754,8 +19008,8 @@ export class SfIEvents extends LitElement {
18754
19008
  "eventid": eventId,
18755
19009
  "comments": comments,
18756
19010
  "approved": approved,
18757
- "entityid": entityId,
18758
- "locationid": locationId,
19011
+ "entityid": entityid,
19012
+ "locationid": locationid,
18759
19013
  "username": this.userName,
18760
19014
  "userid": this.userProfileId,
18761
19015
  "userrole": this.myRole,
@@ -18775,17 +19029,16 @@ export class SfIEvents extends LitElement {
18775
19029
 
18776
19030
  const selectedId = this.selectedItemIds[k];
18777
19031
  //console.log('selectedid', selectedId);
18778
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
18779
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
19032
+ let entityid = selectedId.split('-')[7].replace(/_/g, '-');
19033
+ let locationid = selectedId.split('-')[8].replace(/_/g, '-');
18780
19034
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18781
19035
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18782
19036
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
18783
19037
  if (this.mode == "next") {
18784
19038
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
18785
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
18786
-
18787
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
19039
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityid) {
18788
19040
  flagBulk = true;
19041
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
18789
19042
  if (this.recentlyReported[mmdd] == null) {
18790
19043
  this.recentlyReported[mmdd] = []
18791
19044
  }
@@ -18794,10 +19047,10 @@ export class SfIEvents extends LitElement {
18794
19047
  }
18795
19048
  } else {
18796
19049
  for (var p = 0; p < this.events[mmdd].length; p++) {
18797
- if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
19050
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
18798
19051
 
18799
19052
  this.events[mmdd][p].isbulk = true
18800
- flagBulk = true;
19053
+ flagBulk = true
18801
19054
  if (this.recentlyReported[mmdd] == null) {
18802
19055
  this.recentlyReported[mmdd] = []
18803
19056
  }
@@ -18811,7 +19064,7 @@ export class SfIEvents extends LitElement {
18811
19064
  if (this.mode == "next") {
18812
19065
  // this.fetchNext(this.nextPage)
18813
19066
  // this.renderRoleTabsNext(this.nextPage)
18814
- this.renderNextEvents(this.nextEvents, this.nextPage, this.myRole);
19067
+ this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
18815
19068
  } else {
18816
19069
  // if(this.getCurrentTab() == this.TAB_CUSTOM) {
18817
19070
  // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
@@ -18823,41 +19076,19 @@ export class SfIEvents extends LitElement {
18823
19076
  if (this.selectedItemIds.length > 0) {
18824
19077
  await this.fetchBulkReportingData();
18825
19078
  }
19079
+ console.log('events', this.events);
18826
19080
  this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
18827
- var clickEvent = new MouseEvent("click", {
18828
- "view": window,
18829
- "bubbles": true,
18830
- "cancelable": false
18831
- });
18832
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)?.dispatchEvent(clickEvent);
18833
-
18834
- // if(currentColumnButton != null) {
18835
- // currentColumnButton.click();
18836
- // }
18837
19081
  }
18838
19082
  }
18839
19083
 
18840
19084
  });
18841
19085
 
18842
- (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
19086
+ eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
18843
19087
  let buttonClick = ev.target as HTMLButtonElement
18844
19088
  buttonClick.innerHTML = "Saving..."
18845
- const comments: string = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-auditor-comments') as HTMLInputElement).value;
18846
- const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
18847
- let currStatus = this.getCompletenessStatus(event);
18848
- let newEvent = { ...event };
18849
- newEvent.comments = comments;
18850
- newEvent.approved = approved;
18851
- let newStatus = this.getCompletenessStatus(newEvent);
18852
- console.log('status', currStatus, newStatus)
18853
- if (currStatus == newStatus) {
18854
- buttonClick.innerHTML = "Save"
18855
- this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
18856
- setTimeout(() => {
18857
- this.clearMessages();
18858
- }, 3000);
18859
- return;
18860
- }
19089
+ const comments = (eventDetailReportingContainer.querySelector('#input-auditor-comments') as HTMLInputElement).value;
19090
+ const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
19091
+
18861
19092
  if (comments.trim().length === 0) {
18862
19093
  buttonClick.innerHTML = "Save"
18863
19094
  this.setError('Comments cannot be blank!');
@@ -18868,22 +19099,14 @@ export class SfIEvents extends LitElement {
18868
19099
  } else {
18869
19100
  let flagBulk = false;
18870
19101
  if (this.selectedItemIds.length <= 1) {
18871
-
18872
- if (await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
18873
- if (this.mode == "next") {
18874
- for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
18875
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
18876
- this.nextEvents[this.nextTabRole][mmdd][p].approved = approved
18877
- this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
18878
- this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
18879
- }
18880
- }
18881
- } else {
18882
- for (var p = 0; p < this.events[mmdd].length; p++) {
18883
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
18884
- this.events[mmdd][p].approved = approved
18885
- this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
18886
- this.events[mmdd][p].lastupdated = new Date().toString()
19102
+ if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
19103
+ for (var p = 0; p < this.events[mmdd].length; p++) {
19104
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
19105
+ this.events[mmdd][p].approved = approved
19106
+ this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
19107
+ this.events[mmdd][p].lastupdated = new Date().toString()
19108
+ if (approved) {
19109
+ this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
18887
19110
  }
18888
19111
  }
18889
19112
  }
@@ -18899,8 +19122,8 @@ export class SfIEvents extends LitElement {
18899
19122
  const selectedId = this.selectedItemIds[k];
18900
19123
  //console.log('selectedid', selectedId);
18901
19124
 
18902
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
18903
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
19125
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
19126
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
18904
19127
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18905
19128
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18906
19129
 
@@ -18929,21 +19152,20 @@ export class SfIEvents extends LitElement {
18929
19152
 
18930
19153
  const selectedId = this.selectedItemIds[k];
18931
19154
  //console.log('selectedid', selectedId);
18932
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
18933
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
19155
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
19156
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
18934
19157
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
18935
19158
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
18936
19159
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
18937
19160
  if (this.mode == "next") {
18938
19161
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
18939
19162
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
18940
-
18941
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
18942
19163
  flagBulk = true;
19164
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
18943
19165
  if (this.recentlyReported[mmdd] == null) {
18944
19166
  this.recentlyReported[mmdd] = []
18945
19167
  }
18946
- this.recentlyReported[mmdd].push(this.events[mmdd][p])
19168
+ this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p])
18947
19169
  }
18948
19170
  }
18949
19171
  } else {
@@ -18960,15 +19182,7 @@ export class SfIEvents extends LitElement {
18960
19182
  }
18961
19183
  }
18962
19184
  }
18963
-
18964
19185
  }
18965
-
18966
- var clickEvent = new MouseEvent("click", {
18967
- "view": window,
18968
- "bubbles": true,
18969
- "cancelable": false
18970
- });
18971
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
18972
19186
  if (this.mode == "next") {
18973
19187
  // this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
18974
19188
  this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
@@ -18997,42 +19211,42 @@ export class SfIEvents extends LitElement {
18997
19211
  });
18998
19212
 
18999
19213
  if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
19214
+ if (event.approved) {
19000
19215
 
19001
- if (approved) {
19002
-
19003
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
19004
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
19216
+ if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
19217
+ (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
19005
19218
  }
19006
19219
 
19007
19220
 
19008
19221
  } else {
19009
19222
 
19010
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
19223
+ if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
19011
19224
 
19012
19225
 
19013
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
19226
+ (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
19014
19227
 
19015
- (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev: any) => {
19228
+ eventDetailReportingContainer.querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev: any) => {
19016
19229
  let buttonClick = ev.target as HTMLButtonElement
19017
19230
  buttonClick.innerHTML = "Saving..."
19018
- const reportercomments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-comments') as HTMLInputElement).value;
19231
+ const reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
19019
19232
 
19020
19233
  //console.log('reporter comments 1', reportercomments);
19021
19234
 
19022
- const reporterdoc = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
19235
+ const reporterdoc = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
19023
19236
  let docs: any[] = [];
19024
19237
 
19025
19238
  //console.log('reporter comments 2', reportercomments);
19239
+
19240
+ // if(docsOptional.length === 0) {
19026
19241
  let percentage: string = "100";
19027
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement) != null) {
19028
- percentage = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement).value
19242
+ if ((eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement) != null) {
19243
+ percentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value
19029
19244
  }
19030
- // if(docsOptional.length === 0) {
19031
19245
  docs = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
19032
19246
  // }
19033
19247
  let flag = false;
19034
19248
  do {
19035
- if (docs.length > 0 && docsOptional != null && docsOptional.length === 0 && parseInt(percentage) > 0) {
19249
+ if (docs.length > 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
19036
19250
  for (let doc of docs) {
19037
19251
  if ((doc.jobId == null || doc.jobId.length === 0) && (doc.ext.toLowerCase() == 'pdf' || doc.ext.toLowerCase() == 'png' || doc.ext.toLowerCase() == 'jpeg' || doc.ext.toLowerCase() == 'jpg')) {
19038
19252
  flag = false
@@ -19057,7 +19271,7 @@ export class SfIEvents extends LitElement {
19057
19271
  reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
19058
19272
  }
19059
19273
 
19060
-
19274
+ console.log('percentage', percentage, (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value);
19061
19275
  if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
19062
19276
 
19063
19277
  //console.log('reporter comments 3', reportercomments);
@@ -19068,7 +19282,7 @@ export class SfIEvents extends LitElement {
19068
19282
  }, 3000);
19069
19283
 
19070
19284
  } else {
19071
- if (docs.length === 0 && docsOptional.length === 0 && parseInt(percentage) > 0) {
19285
+ if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
19072
19286
 
19073
19287
  //console.log('reporter comments 3', reportercomments);
19074
19288
  buttonClick.innerHTML = "Save"
@@ -19107,68 +19321,76 @@ export class SfIEvents extends LitElement {
19107
19321
  }, 3000);
19108
19322
 
19109
19323
  } else {
19324
+ let flagBulk = false;
19325
+ // let reportedlocations = selectReportingLocation?.value ?? "";
19326
+ let reportedlocations = "[]";
19327
+ if (parseInt(percentage) !== 100) {
19328
+ let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
19329
+ for (let selectReportedLocation of selectReportedLocations) {
19330
+ reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value])
19331
+ }
19332
+ }
19333
+ if (this.selectedItemIds.length <= 1) {
19110
19334
 
19335
+ if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, event.makercheckers, reportedlocations)) {
19111
19336
 
19112
- var clickEvent = new MouseEvent("click", {
19113
- "view": window,
19114
- "bubbles": true,
19115
- "cancelable": false
19116
- });
19337
+ if (this.mode != "next") {
19338
+ for (var p = 0; p < this.events[mmdd].length; p++) {
19339
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
19340
+ this.events[mmdd][p].documents = docs
19341
+ this.events[mmdd][p].percentage = percentage
19342
+ this.events[mmdd][p].reportedlocations = reportedlocations
19343
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
19344
+ this.events[mmdd][p].lastupdated = new Date().toString()
19345
+ }
19346
+ }
19117
19347
 
19118
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
19119
- let flagBulk = false;
19120
- let reportinglocation = selectReportingLocation.value;
19121
- if (this.selectedItemIds.length <= 1) {
19348
+ if (event.makercheckers.length > 0) {
19122
19349
 
19123
- //console.log('makerscheckers', makercheckers, reportercomments);
19124
- // console.log('reportformatvalues', reportformatvalues)
19125
- // console.log('reportformatschema',reportformatschema)
19126
- if (await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, makercheckers, reportinglocation)) {
19127
- if (this.mode == "next") {
19350
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
19351
+ for (var p = 0; p < this.events[mmdd].length; p++) {
19352
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
19353
+ this.events[mmdd][p].approved = true
19354
+ // this.events[mmdd][p].documents = docs
19355
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
19356
+ this.events[mmdd][p].lastupdated = new Date().toString()
19357
+ }
19358
+ }
19359
+ }
19360
+ if (this.recentlyReported[mmdd] == null) {
19361
+ this.recentlyReported[mmdd] = []
19362
+ }
19363
+ this.recentlyReported[mmdd].push(event)
19364
+ console.log('recently reported', this.recentlyReported)
19365
+ } else {
19128
19366
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
19129
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
19367
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
19130
19368
  this.nextEvents[this.nextTabRole][mmdd][p].documents = docs
19369
+ this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage
19370
+ this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations
19131
19371
  this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
19132
19372
  this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
19133
19373
  }
19134
19374
  }
19135
- } else {
19136
- console.log('this.events', this.events);
19137
- for (var p = 0; p < this.events[mmdd].length; p++) {
19138
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
19139
- this.events[mmdd][p].documents = docs
19140
- this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
19141
- this.events[mmdd][p].lastupdated = new Date().toString()
19142
- }
19143
- }
19144
- }
19145
- if (makercheckers.length > 0) {
19146
19375
 
19147
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
19148
- if (this.mode == "next") {
19376
+ if (event.makercheckers.length > 0) {
19377
+
19378
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
19149
19379
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
19150
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
19380
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
19151
19381
  this.nextEvents[this.nextTabRole][mmdd][p].approved = true
19152
19382
  // this.events[mmdd][p].documents = docs
19153
19383
  this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
19154
19384
  this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
19155
19385
  }
19156
19386
  }
19157
- } else {
19158
- for (var p = 0; p < this.events[mmdd].length; p++) {
19159
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
19160
- this.events[mmdd][p].approved = true
19161
- // this.events[mmdd][p].documents = docs
19162
- this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
19163
- this.events[mmdd][p].lastupdated = new Date().toString()
19164
- }
19165
- }
19166
19387
  }
19388
+ if (this.recentlyReported[mmdd] == null) {
19389
+ this.recentlyReported[mmdd] = []
19390
+ }
19391
+ this.recentlyReported[mmdd].push(event)
19392
+ console.log('recently reported', this.recentlyReported)
19167
19393
  }
19168
- if (this.recentlyReported[mmdd] == null) {
19169
- this.recentlyReported[mmdd] = []
19170
- }
19171
- this.recentlyReported[mmdd].push(event)
19172
19394
  }
19173
19395
  } else {
19174
19396
  let bulkBody = []
@@ -19179,31 +19401,13 @@ export class SfIEvents extends LitElement {
19179
19401
  //console.log('selectedid', selectedId);
19180
19402
 
19181
19403
  const makercheckersL = selectedId.split('-')[5];
19182
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
19183
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
19404
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
19405
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
19184
19406
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
19185
19407
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
19186
19408
 
19187
19409
  //console.log(entityId, locationId, eventId, mmddyyyy);
19188
- // bulkBody.push({
19189
- // "mmddyyyy": mmddyyyy,
19190
- // "projectid": this.projectId,
19191
- // "type": "report",
19192
- // "eventid": eventId,
19193
- // "comments": reportercomments,
19194
- // "dateofcompletion": reporterdoc,
19195
- // "entityid": entityId,
19196
- // "locationid": locationId,
19197
- // "event": null,
19198
- // "docs": JSON.stringify(docs),
19199
- // "username": this.userName,
19200
- // "reportformatvalues": reportformatvalues,
19201
- // "reportformatschema": reportformatschema,
19202
- // "userid": this.userProfileId,
19203
- // "userrole": this.myRole,
19204
- // "year": this.calendarStartYYYY,
19205
- // "module": event.module ?? "compliance"
19206
- // })
19410
+
19207
19411
  // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
19208
19412
  // if(parseInt(makercheckersL) > 0) {
19209
19413
  // bulkBodyReview.push({
@@ -19239,7 +19443,7 @@ export class SfIEvents extends LitElement {
19239
19443
  "comments": reportercomments,
19240
19444
  "dateofcompletion": reporterdoc,
19241
19445
  "percentage": percentage,
19242
- "reportinglocation": reportinglocation,
19446
+ "reportedlocations": reportedlocations,
19243
19447
  "entityid": entityId,
19244
19448
  "locationid": locationId,
19245
19449
  "event": null,
@@ -19260,11 +19464,13 @@ export class SfIEvents extends LitElement {
19260
19464
  // this.clearMessages();
19261
19465
 
19262
19466
  }
19467
+ // await this.uploadReportsBulk(bulkBody);
19263
19468
 
19469
+ // await this.fetchBulkReportingData();
19264
19470
  if (bulkBody.length > 0) {
19265
19471
  await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
19266
19472
  }
19267
- // await this.fetchBulkReportingData();
19473
+
19268
19474
  // if(bulkBodyReview.length > 0){
19269
19475
  // await this.uploadReportsReviewsBulk(bulkBodyReview)
19270
19476
  // }
@@ -19272,17 +19478,16 @@ export class SfIEvents extends LitElement {
19272
19478
 
19273
19479
  const selectedId = this.selectedItemIds[k];
19274
19480
  //console.log('selectedid', selectedId);
19275
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
19276
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
19481
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
19482
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
19277
19483
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
19278
19484
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
19279
19485
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
19280
19486
  if (this.mode == "next") {
19281
19487
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
19282
19488
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
19283
-
19284
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
19285
19489
  flagBulk = true;
19490
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
19286
19491
  if (this.recentlyReported[mmdd] == null) {
19287
19492
  this.recentlyReported[mmdd] = []
19288
19493
  }
@@ -19292,9 +19497,8 @@ export class SfIEvents extends LitElement {
19292
19497
  } else {
19293
19498
  for (var p = 0; p < this.events[mmdd].length; p++) {
19294
19499
  if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
19295
-
19296
- this.events[mmdd][p].isbulk = true
19297
19500
  flagBulk = true;
19501
+ this.events[mmdd][p].isbulk = true
19298
19502
  if (this.recentlyReported[mmdd] == null) {
19299
19503
  this.recentlyReported[mmdd] = []
19300
19504
  }
@@ -19303,7 +19507,6 @@ export class SfIEvents extends LitElement {
19303
19507
  }
19304
19508
  }
19305
19509
  }
19306
-
19307
19510
  }
19308
19511
 
19309
19512
  if (this.mode == "next") {
@@ -19326,10 +19529,7 @@ export class SfIEvents extends LitElement {
19326
19529
  // }
19327
19530
  }
19328
19531
  }
19329
-
19330
19532
  }
19331
-
19332
-
19333
19533
  }
19334
19534
  }
19335
19535
  }
@@ -19342,37 +19542,44 @@ export class SfIEvents extends LitElement {
19342
19542
  }
19343
19543
 
19344
19544
  if (this._SfUploader[0] != null) {
19345
- (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
19545
+ if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
19546
+ (eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
19547
+ }
19346
19548
  this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev: any) => {
19347
19549
  console.log('uploader analysisInProgress', _ev);
19348
- (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
19550
+
19551
+ if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
19552
+ (eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
19553
+ }
19349
19554
  });
19350
19555
  this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev: any) => {
19351
19556
  console.log('uploader analysisInProgress', _ev);
19352
- if ((this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
19353
- (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
19557
+ if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
19558
+ (eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
19354
19559
  }
19355
19560
  });
19356
19561
 
19357
19562
 
19358
19563
  //console.log('documentType checking', documentType);
19359
19564
 
19360
- if (documentType != null) {
19361
- (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = documentType;
19565
+ if (event.documentType != null) {
19566
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = event.documentType;
19362
19567
  } else {
19363
- (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = ""
19568
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = "";
19364
19569
  }
19365
19570
 
19366
19571
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify([]);
19367
19572
  console.log('uploader', (this._SfUploader[0].querySelector('#uploader') as SfIUploader));
19573
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = 0;
19368
19574
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
19369
19575
 
19370
19576
  if (docs.length > 0) {
19371
19577
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify(docs);
19578
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = docs.length;
19372
19579
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
19373
19580
  }
19374
19581
 
19375
- if (this.myRole == this.TAB_APPROVER || approved) {
19582
+ if (this.myRole == this.TAB_APPROVER || event.approved) {
19376
19583
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = true;
19377
19584
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
19378
19585
  } else {
@@ -19383,8 +19590,8 @@ export class SfIEvents extends LitElement {
19383
19590
  const dataPassthrough = {
19384
19591
  projectId: this.projectId,
19385
19592
  countryId: this.countryId,
19386
- entityId: entityId,
19387
- locationId: locationId,
19593
+ entityId: event.entityid,
19594
+ locationId: event.locationid,
19388
19595
  mmddyyyy: mmddyyyy,
19389
19596
  complianceId: event['id'],
19390
19597
  path: "uploadextract"
@@ -19398,6 +19605,7 @@ export class SfIEvents extends LitElement {
19398
19605
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlHost = callbackUrlHost;
19399
19606
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlPath = callbackUrlPath;
19400
19607
  (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
19608
+ console.log('uploader prepopulate', (this._SfUploader[0].querySelector('#uploader') as SfIUploader).prepopulatedInputArr, (this._SfUploader[0].querySelector('#uploader') as SfIUploader).extract)
19401
19609
 
19402
19610
  }
19403
19611
 
@@ -19409,50 +19617,32 @@ export class SfIEvents extends LitElement {
19409
19617
  if (event["approved"] != null) {
19410
19618
  if (event["approved"] === true) {
19411
19619
  //console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
19412
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
19413
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
19620
+ if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
19621
+ (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
19414
19622
  }
19415
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
19416
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = false;
19623
+ if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
19624
+ (eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = false;
19417
19625
  }
19418
19626
  } else {
19419
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
19420
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
19627
+ if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
19628
+ (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
19421
19629
  }
19422
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
19423
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
19630
+ if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
19631
+ (eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
19424
19632
  }
19425
19633
  }
19426
19634
  } else {
19427
- if ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement != null) {
19428
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
19635
+ if (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement != null) {
19636
+ (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
19429
19637
  }
19430
- if (((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
19431
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = true;
19638
+ if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
19639
+ (eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = true;
19432
19640
  }
19433
-
19434
19641
  }
19435
19642
  }
19436
-
19437
19643
  }
19438
-
19439
- this.fetchStatuteDefinitionDetails(statuteName);
19440
- console.log('customreporting', event['customreporting'])
19441
- if (event['customreporting'] != null) {
19442
- let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
19443
- if (reportingContainer.querySelector('#report-format-container') != null) {
19444
- reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
19445
- console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
19446
- (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
19447
- (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
19448
- (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
19449
- // if(reportformatvalues != ""){
19450
- // (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
19451
- // }
19452
- (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
19453
- }
19454
- } else if (event['reportformat'] != null && event['reportformat'].length > 0) {
19455
- this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
19644
+ if (event['reportformat'] != null && event['reportformat'].length > 0) {
19645
+ this.fetchReportFormat(eventDetailReportingContainer, reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
19456
19646
  }
19457
19647
  }
19458
19648
 
@@ -27884,7 +28074,7 @@ export class SfIEvents extends LitElement {
27884
28074
  }
27885
28075
  }
27886
28076
 
27887
- sendSuggestions = async (eventid: string, eventdelta:any) => {
28077
+ sendSuggestions = async (eventid: string, eventdelta: any) => {
27888
28078
  let url = "https://" + this.apiIdRCMResources + "/sendsuggestions";
27889
28079
 
27890
28080
  const body = {
@@ -29323,7 +29513,7 @@ export class SfIEvents extends LitElement {
29323
29513
  let url = "https://" + this.apiId + "/markreviewed";
29324
29514
 
29325
29515
  //console.log('fetch calendar url', url);
29326
- let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark" : review };
29516
+ let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark": review };
29327
29517
 
29328
29518
  //console.log('urlbody', urlBody);
29329
29519
 
@@ -31081,7 +31271,6 @@ export class SfIEvents extends LitElement {
31081
31271
  let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
31082
31272
  console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
31083
31273
  if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
31084
- 4
31085
31274
  this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer)
31086
31275
  } else {
31087
31276
  listReportingContainer.innerHTML = '';