sf-i-events 1.0.846 → 1.0.847

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sf-i-events.js CHANGED
@@ -2431,7 +2431,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2431
2431
  html += '<div class="stream-events-container flex-grow" part="' + bgStatus + '">';
2432
2432
  html += '<div class="hidden-tags hide">' + JSON.stringify(event['tags']) + '</div>';
2433
2433
  html += '<div class="hidden-title hide"><table><thead><th part="badge-filtered"><i>not filtered</i></th></thead></table></div>';
2434
- html += '<div part="stream-events-event-title" class="stream-events-event-title d-flex align-center pl-5 pb-5">' + '<input id="button-select-' + mmdd.replace('/', '-') + '-' + itemNumber + '-' + (((event.makercheckers != null && (event.makercheckers).length > 0)) ? '1' : '0') + '-' + (((event.docs != null && (event.docs).length > 0)) ? '1' : '0') + '-' + event.entityid.replace(/-/g, '_') + '-' + event.locationid.replace(/-/g, '_') + '-' + event.id.replace(/-/g, '_') + '-' + event.duedate.split('/')[1] + '-' + event.duedate.split('/')[0] + '-' + event.duedate.split('/')[2] + '-' + partStatus.replace(/-/g, '_') + '-' + (((_a = event.isnotice) !== null && _a !== void 0 ? _a : false) ? 'isnotice' : 'isevent') + '-' + ((event.isbulk == null || event.isbulk == false) ? "" : "bulk") + '" class="button-select mr-10 ' + (((event.reportformat != null && event.reportformat.length > 0) || (event.isbulk != null && event.isbulk == true)) ? 'hide' : '') + '" type="checkbox"/>' + (event.isbulk != null && event.isbulk == true ? '<div class="lds-dual-ring1 bulk-loader mr-10"></div>' : '') + '<sf-i-elastic-text class="stream-event-title' + (event.isbulk == null || event.isbulk == false ? ' button-event-title' : '') + '" id="stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + itemNumber + '-' + (((_b = event.isnotice) !== null && _b !== void 0 ? _b : false) ? 'isnotice' : 'isevent') + '" text="' + event['obligationtitle'] + '" minLength="' + (event.reporters != null ? "100" : "60") + '"></sf-i-elastic-text>' + (event.reporters != null ? ('') : ('<div part="stream-event-location" class="stream-event-location ml-5">' + event.locationname.replace(/ *\([^)]*\) */g, "") + '</div><div part="stream-event-risk-' + event.risk[0].toLowerCase().replace(/ /g, '-') + '" class="stream-event-risk ml-5">' + event.risk[0] + '</div><button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + itemNumber + '" part="button-list-reporting" class="material-icons ml-10 button-list-reporting">edit_note</button>')) + ((event.reporters != null && lastUpdated.length > 0) ? ('&nbsp;&nbsp;<div part="event-last-updated-time" class="d-flex align-center">' + lastUpdated + '</div>') : "") + '</div>';
2434
+ html += '<div part="stream-events-event-title" class="stream-events-event-title d-flex align-center pl-5 pb-5">' + '<input id="button-select-' + mmdd.replace('/', '-') + '-' + itemNumber + '-' + (((event.makercheckers != null && (event.makercheckers).length > 0)) ? '1' : '0') + '-' + (((event.docs != null && (event.docs).length > 0)) ? '1' : '0') + '-' + event.entityid.replace(/-/g, '_') + '-' + event.locationid.replace(/-/g, '_') + '-' + event.id.replace(/-/g, '_') + '-' + event.duedate.split('/')[1] + '-' + event.duedate.split('/')[0] + '-' + event.duedate.split('/')[2] + '-' + partStatus.replace(/-/g, '_') + '-' + (((_a = event.module) !== null && _a !== void 0 ? _a : false) ? event.module : 'compliance') + '-' + ((event.isbulk == null || event.isbulk == false) ? "" : "bulk") + '" class="button-select mr-10 ' + (((event.reportformat != null && event.reportformat.length > 0) || (event.isbulk != null && event.isbulk == true)) ? 'hide' : '') + '" type="checkbox"/>' + (event.isbulk != null && event.isbulk == true ? '<div class="lds-dual-ring1 bulk-loader mr-10"></div>' : '') + '<sf-i-elastic-text class="stream-event-title' + (event.isbulk == null || event.isbulk == false ? ' button-event-title' : '') + '" id="stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + itemNumber + '-' + (((_b = event.module) !== null && _b !== void 0 ? _b : false) ? event.module : 'compliance') + '" text="' + event['obligationtitle'] + '" minLength="' + (event.reporters != null ? "100" : "60") + '"></sf-i-elastic-text>' + (event.reporters != null ? ('') : ('<div part="stream-event-location" class="stream-event-location ml-5">' + event.locationname.replace(/ *\([^)]*\) */g, "") + '</div><div part="stream-event-risk-' + event.risk[0].toLowerCase().replace(/ /g, '-') + '" class="stream-event-risk ml-5">' + event.risk[0] + '</div><button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + itemNumber + '" part="button-list-reporting" class="material-icons ml-10 button-list-reporting">edit_note</button>')) + ((event.reporters != null && lastUpdated.length > 0) ? ('&nbsp;&nbsp;<div part="event-last-updated-time" class="d-flex align-center">' + lastUpdated + '</div>') : "") + '</div>';
2435
2435
  if (event.reporters != null && remarks.length > 0) {
2436
2436
  html += '<div part="stream-events-event-subtitle" class="stream-events-event-subtitle">' + remarks + ', occurred on ' + occurrenceDate + '</div>';
2437
2437
  }
@@ -2547,7 +2547,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2547
2547
  html += '<tbody>';
2548
2548
  html += '<td id="td-expand-' + i + '" part="td-body">';
2549
2549
  if (event.isbulk == null || !event.isbulk) {
2550
- html += '<button id="button-unmapped-expand-' + mmdd.replace('/', '-') + '-' + j + '-' + (((_a = event.isnotice) !== null && _a !== void 0 ? _a : false) ? 'isnotice' : 'isevent') + '" part="button-icon-small" class="material-icons button-expand mr-10">open_in_new</button>';
2550
+ html += '<button id="button-unmapped-expand-' + mmdd.replace('/', '-') + '-' + j + '-' + (((_a = event.module) !== null && _a !== void 0 ? _a : false) ? event.module : 'compliance') + '" part="button-icon-small" class="material-icons button-expand mr-10">open_in_new</button>';
2551
2551
  }
2552
2552
  else {
2553
2553
  html += '<div class="lds-dual-ring1 bulk-loader"></div>';
@@ -3357,7 +3357,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3357
3357
  }
3358
3358
  let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title');
3359
3359
  for (let streamEventTitle of streamEventTitles) {
3360
- if (streamEventTitle.id == 'stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + (((_b = event.isnotice) !== null && _b !== void 0 ? _b : false) ? 'isnotice' : 'isevent')) {
3360
+ if (streamEventTitle.id == 'stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + (((_b = event.module) !== null && _b !== void 0 ? _b : false) ? event.module : 'compliance')) {
3361
3361
  streamEventTitle.setAttribute('part', 'stream-event-title-selected');
3362
3362
  }
3363
3363
  else {
@@ -3382,8 +3382,9 @@ let SfIEvents = class SfIEvents extends LitElement {
3382
3382
  }
3383
3383
  });
3384
3384
  (_f = listReportingContainer.querySelector('#button-auto-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
3385
+ var _a, _b;
3385
3386
  if (this.selectedItemIds.length <= 1) {
3386
- await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
3387
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "events");
3387
3388
  this.setSuccess('Auto-Approved successfully!');
3388
3389
  setTimeout(() => {
3389
3390
  this.clearMessages();
@@ -3412,7 +3413,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3412
3413
  "userid": this.userProfileId,
3413
3414
  "userrole": this.myRole,
3414
3415
  "year": this.calendarStartYYYY,
3415
- "module": event.isnotice != null ? "notices" : "events"
3416
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
3416
3417
  });
3417
3418
  }
3418
3419
  await this.uploadReviewsBulk(bulkBodyReview);
@@ -3432,6 +3433,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3432
3433
  });
3433
3434
  if (this.mode == "consumer" || this.mode == "next") {
3434
3435
  (_h = listReportingContainer.querySelector('#button-uploader-submit-approve')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async (ev) => {
3436
+ var _a, _b;
3435
3437
  let buttonClick = ev.target;
3436
3438
  buttonClick.innerHTML = "Saving...";
3437
3439
  const comments = listReportingContainer.querySelector('#input-approver-comments').value;
@@ -3453,7 +3455,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3453
3455
  let flagBulk = false;
3454
3456
  if (this.selectedItemIds.length <= 1) {
3455
3457
  console.log('selectedevent', JSON.stringify(event));
3456
- if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")) {
3458
+ if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "events")) {
3457
3459
  for (var p = 0; p < this.events[mmdd].length; p++) {
3458
3460
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3459
3461
  this.events[mmdd][p].approved = approved;
@@ -3494,7 +3496,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3494
3496
  "userid": this.userProfileId,
3495
3497
  "userrole": this.myRole,
3496
3498
  "year": this.calendarStartYYYY,
3497
- "module": event.isnotice != null ? "notices" : "events"
3499
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
3498
3500
  });
3499
3501
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
3500
3502
  // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
@@ -3544,6 +3546,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3544
3546
  }
3545
3547
  });
3546
3548
  (_j = listReportingContainer.querySelector('#button-uploader-submit-audit')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
3549
+ var _a, _b;
3547
3550
  let buttonClick = ev.target;
3548
3551
  buttonClick.innerHTML = "Saving...";
3549
3552
  const comments = listReportingContainer.querySelector('#input-auditor-comments').value;
@@ -3558,7 +3561,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3558
3561
  else {
3559
3562
  let flagBulk = false;
3560
3563
  if (this.selectedItemIds.length <= 1) {
3561
- if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")) {
3564
+ if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "events")) {
3562
3565
  for (var p = 0; p < this.events[mmdd].length; p++) {
3563
3566
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3564
3567
  this.events[mmdd][p].approved = approved;
@@ -3598,7 +3601,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3598
3601
  "userid": this.userProfileId,
3599
3602
  "userrole": this.myRole,
3600
3603
  "year": this.calendarStartYYYY,
3601
- "module": event.isnotice != null ? "notices" : "events"
3604
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
3602
3605
  });
3603
3606
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
3604
3607
  }
@@ -3656,7 +3659,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3656
3659
  if (listReportingContainer.querySelector('#button-uploader-submit-report') != null) {
3657
3660
  listReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
3658
3661
  (_k = listReportingContainer.querySelector('#button-uploader-submit-report')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', async (ev) => {
3659
- var _a, _b;
3662
+ var _a, _b, _c, _f;
3660
3663
  let buttonClick = ev.target;
3661
3664
  buttonClick.innerHTML = "Saving...";
3662
3665
  const reportercomments = listReportingContainer.querySelector('#input-reporter-comments').value;
@@ -3724,7 +3727,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3724
3727
  else {
3725
3728
  let flagBulk = false;
3726
3729
  if (this.selectedItemIds.length <= 1) {
3727
- if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage, event.makercheckers)) {
3730
+ if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_c = event.module) !== null && _c !== void 0 ? _c : "events", percentage, event.makercheckers)) {
3728
3731
  console.log('this.events', this.events);
3729
3732
  if (this.mode != "next") {
3730
3733
  for (var p = 0; p < this.events[mmdd].length; p++) {
@@ -3735,7 +3738,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3735
3738
  }
3736
3739
  }
3737
3740
  if (event.makercheckers.length > 0) {
3738
- // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
3741
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
3739
3742
  for (var p = 0; p < this.events[mmdd].length; p++) {
3740
3743
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3741
3744
  this.events[mmdd][p].approved = true;
@@ -3786,7 +3789,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3786
3789
  // "userid": this.userProfileId,
3787
3790
  // "userrole": this.myRole,
3788
3791
  // "year": this.calendarStartYYYY,
3789
- // "module": event.isnotice != null ? "notices" : "events"
3792
+ // "module": event.module ?? "events"
3790
3793
  // } )
3791
3794
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
3792
3795
  // }else{
@@ -3808,7 +3811,7 @@ let SfIEvents = class SfIEvents extends LitElement {
3808
3811
  "userid": this.userProfileId,
3809
3812
  "userrole": this.myRole,
3810
3813
  "year": this.calendarStartYYYY,
3811
- "module": event.isnotice != null ? "notices" : "events",
3814
+ "module": (_f = event.module) !== null && _f !== void 0 ? _f : "events",
3812
3815
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
3813
3816
  });
3814
3817
  // }
@@ -4137,11 +4140,14 @@ let SfIEvents = class SfIEvents extends LitElement {
4137
4140
  const idArr = id.split("-");
4138
4141
  const mmdd = idArr[3] + "/" + idArr[4];
4139
4142
  const j = idArr[5];
4140
- const isnotice = idArr[6];
4143
+ const module = idArr[6];
4141
4144
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
4142
- if (isnotice === "isnotice") {
4145
+ if (module === "notice") {
4143
4146
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
4144
4147
  }
4148
+ else if (module === "agreement") {
4149
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
4150
+ }
4145
4151
  else {
4146
4152
  let found = false;
4147
4153
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -4167,11 +4173,14 @@ let SfIEvents = class SfIEvents extends LitElement {
4167
4173
  const idArr = id.split("-");
4168
4174
  const mmdd = idArr[3] + "/" + idArr[4];
4169
4175
  const j = idArr[5];
4170
- const isnotice = idArr[6];
4176
+ const module = idArr[6];
4171
4177
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
4172
- if (isnotice === "isnotice") {
4178
+ if (module === "notice") {
4173
4179
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
4174
4180
  }
4181
+ else if (module === "agreement") {
4182
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
4183
+ }
4175
4184
  else {
4176
4185
  let found = false;
4177
4186
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -4205,7 +4214,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4205
4214
  const j = idArr[4];
4206
4215
  // const makercheckers = idArr[5];
4207
4216
  const docs = idArr[6];
4208
- const isnotice = idArr[14];
4217
+ const module = idArr[14];
4209
4218
  if (ev.target.checked) {
4210
4219
  this.selectedItemIds.push(id);
4211
4220
  }
@@ -4216,7 +4225,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4216
4225
  listReportingContainer.innerHTML = '';
4217
4226
  let buttonListReporting = eventsContainer.querySelector('#button-list-reporting-' + mmdd.replace(/\//g, '-') + '-' + j);
4218
4227
  buttonListReporting.setAttribute('part', 'button-list-reporting');
4219
- let streamEventTitle = eventsContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + isnotice);
4228
+ let streamEventTitle = eventsContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + module);
4220
4229
  streamEventTitle.removeAttribute('part');
4221
4230
  }
4222
4231
  if (this.selectedItemIds.length === 0) {
@@ -4253,13 +4262,13 @@ let SfIEvents = class SfIEvents extends LitElement {
4253
4262
  const idArr1 = id1.split("-");
4254
4263
  const docs1 = idArr1[6];
4255
4264
  const status = idArr1[13].replace(/_/g, '-');
4256
- const isnotice1 = idArr1[14];
4265
+ const module1 = idArr1[14];
4257
4266
  const isbulk = idArr1[15] == "bulk";
4258
4267
  console.log('isBulk button-select', id1, isbulk);
4259
4268
  if (isbulk) {
4260
4269
  buttonSelect[k].style.display = 'none';
4261
4270
  }
4262
- if (docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
4271
+ if (docs == docs1 && status == this.selectedStatus && module == module1) {
4263
4272
  totalVisibleCount++;
4264
4273
  }
4265
4274
  else {
@@ -7566,11 +7575,14 @@ let SfIEvents = class SfIEvents extends LitElement {
7566
7575
  const idArr = id.split("-");
7567
7576
  const mmdd = idArr[3] + "/" + idArr[4];
7568
7577
  const j = idArr[5];
7569
- const isnotice = idArr[6];
7578
+ const module = idArr[6];
7570
7579
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
7571
- if (isnotice === "isnotice") {
7580
+ if (module === "notice") {
7572
7581
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
7573
7582
  }
7583
+ else if (module === "agreement") {
7584
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
7585
+ }
7574
7586
  else {
7575
7587
  let found = false;
7576
7588
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -7595,11 +7607,14 @@ let SfIEvents = class SfIEvents extends LitElement {
7595
7607
  const idArr = id.split("-");
7596
7608
  const mmdd = idArr[3] + "/" + idArr[4];
7597
7609
  const j = idArr[5];
7598
- const isnotice = idArr[6];
7610
+ const module = idArr[6];
7599
7611
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
7600
- if (isnotice === "isnotice") {
7612
+ if (module === "notice") {
7601
7613
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
7602
7614
  }
7615
+ else if (module === "agreement") {
7616
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
7617
+ }
7603
7618
  else {
7604
7619
  let found = false;
7605
7620
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -7632,7 +7647,7 @@ let SfIEvents = class SfIEvents extends LitElement {
7632
7647
  const j = idArr[4];
7633
7648
  // const makercheckers = idArr[5];
7634
7649
  const docs = idArr[6];
7635
- const isnotice = idArr[14];
7650
+ const module = idArr[14];
7636
7651
  if (ev.target.checked) {
7637
7652
  this.selectedItemIds.push(id);
7638
7653
  }
@@ -7643,7 +7658,7 @@ let SfIEvents = class SfIEvents extends LitElement {
7643
7658
  listReportingContainer.innerHTML = '';
7644
7659
  let buttonListReporting = this._SfThisContainer.querySelector('#button-list-reporting-' + mmdd.replace(/\//g, '-') + '-' + j);
7645
7660
  buttonListReporting.setAttribute('part', 'button-list-reporting');
7646
- let streamEventTitle = this._SfThisContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + isnotice);
7661
+ let streamEventTitle = this._SfThisContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + module);
7647
7662
  streamEventTitle.removeAttribute('part');
7648
7663
  }
7649
7664
  if (this.selectedItemIds.length === 0) {
@@ -7680,12 +7695,12 @@ let SfIEvents = class SfIEvents extends LitElement {
7680
7695
  const idArr1 = id1.split("-");
7681
7696
  const docs1 = idArr1[6];
7682
7697
  const status = idArr1[13].replace(/_/g, '-');
7683
- const isnotice1 = idArr1[14];
7698
+ const module1 = idArr1[14];
7684
7699
  const isbulk = idArr1[15] == "bulk";
7685
7700
  if (isbulk) {
7686
7701
  buttonSelect[k].style.display = 'none';
7687
7702
  }
7688
- if (docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
7703
+ if (docs == docs1 && status == this.selectedStatus && module == module1) {
7689
7704
  totalVisibleCount++;
7690
7705
  }
7691
7706
  else {
@@ -8047,11 +8062,14 @@ let SfIEvents = class SfIEvents extends LitElement {
8047
8062
  const idArr = id.split("-");
8048
8063
  const mmdd = idArr[3] + "/" + idArr[4];
8049
8064
  const j = idArr[5];
8050
- const isnotice = idArr[6];
8065
+ const module = idArr[6];
8051
8066
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
8052
- if (isnotice === "isnotice") {
8067
+ if (module === "notice") {
8053
8068
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
8054
8069
  }
8070
+ else if (module === "agreement") {
8071
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
8072
+ }
8055
8073
  else {
8056
8074
  let found = false;
8057
8075
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -8078,11 +8096,14 @@ let SfIEvents = class SfIEvents extends LitElement {
8078
8096
  const idArr = id.split("-");
8079
8097
  const mmdd = idArr[3] + "/" + idArr[4];
8080
8098
  const j = idArr[5];
8081
- const isnotice = idArr[6];
8099
+ const module = idArr[6];
8082
8100
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
8083
- if (isnotice === "isnotice") {
8101
+ if (module === "notice") {
8084
8102
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
8085
8103
  }
8104
+ else if (module === "agreement") {
8105
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy);
8106
+ }
8086
8107
  else {
8087
8108
  let found = false;
8088
8109
  for (var k = 0; k < this.selectedItemIds.length; k++) {
@@ -8115,7 +8136,7 @@ let SfIEvents = class SfIEvents extends LitElement {
8115
8136
  const j = idArr[4];
8116
8137
  // const makercheckers = idArr[5];
8117
8138
  const docs = idArr[6];
8118
- const isnotice = idArr[14];
8139
+ const module = idArr[14];
8119
8140
  if (ev.target.checked) {
8120
8141
  this.selectedItemIds.push(id);
8121
8142
  }
@@ -8126,7 +8147,7 @@ let SfIEvents = class SfIEvents extends LitElement {
8126
8147
  listReportingContainer.innerHTML = '';
8127
8148
  let buttonListReporting = this._SfStreamContainer.querySelector('#button-list-reporting-' + mmdd.replace(/\//g, '-') + '-' + j);
8128
8149
  buttonListReporting.setAttribute('part', 'button-list-reporting');
8129
- let streamEventTitle = this._SfStreamContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + isnotice);
8150
+ let streamEventTitle = this._SfStreamContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g, '-') + '-' + j + '-' + module);
8130
8151
  streamEventTitle.removeAttribute('part');
8131
8152
  }
8132
8153
  if (this.selectedItemIds.length === 0) {
@@ -8163,13 +8184,13 @@ let SfIEvents = class SfIEvents extends LitElement {
8163
8184
  const idArr1 = id1.split("-");
8164
8185
  const docs1 = idArr1[6];
8165
8186
  const status = idArr1[13].replace(/_/g, '-');
8166
- const isnotice1 = idArr1[14];
8187
+ const module1 = idArr1[14];
8167
8188
  const isbulk = idArr1[15] == "bulk";
8168
8189
  console.log('isBulk button-select', id1, isbulk);
8169
8190
  if (isbulk) {
8170
8191
  buttonSelect[k].style.display = 'none';
8171
8192
  }
8172
- if (docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
8193
+ if (docs == docs1 && status == this.selectedStatus && module == module1) {
8173
8194
  totalVisibleCount++;
8174
8195
  }
8175
8196
  else {
@@ -9024,18 +9045,719 @@ let SfIEvents = class SfIEvents extends LitElement {
9024
9045
  let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
9025
9046
  this.dispatchEvent(changeEvent);
9026
9047
  }
9027
- if (xhr.status === 404) {
9028
- this.showChosenProject();
9029
- this._SfTitleChosenProject.innerHTML = this._SfProject[0].querySelector('#sf-i-project').selectedTexts()[0];
9030
- this.renderChosenProject();
9048
+ if (xhr.status === 404) {
9049
+ this.showChosenProject();
9050
+ this._SfTitleChosenProject.innerHTML = this._SfProject[0].querySelector('#sf-i-project').selectedTexts()[0];
9051
+ this.renderChosenProject();
9052
+ }
9053
+ else {
9054
+ const jsonRespose = JSON.parse(xhr.responseText);
9055
+ this.setError(jsonRespose.error);
9056
+ }
9057
+ }
9058
+ };
9059
+ this.renderNoticeDetails = async (listEvent, mmddyyyy) => {
9060
+ var _a, _b, _c, _f, _g, _h;
9061
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9062
+ let entityId = listEvent.entityid;
9063
+ let locationId = listEvent.locationid;
9064
+ let comments = listEvent['comments'];
9065
+ let docs = listEvent['documents'] == null ? [] : listEvent['documents'] == null ? [] : (listEvent['documents']);
9066
+ let approved = listEvent['approved'] == null ? false : listEvent['approved'] == null ? false : listEvent['approved'];
9067
+ let makercheckers = listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'];
9068
+ let docsOptional = listEvent['docs'] == null ? [] : listEvent['docs'] == null ? [] : listEvent['docs'];
9069
+ let html = '';
9070
+ let documentType = listEvent['documenttype'] == null ? null : listEvent['documenttype'][0] == null ? null : listEvent['documenttype'][0].split(" ")[0];
9071
+ html += `
9072
+ <div part="compliance-detail-title" class="d-flex justify-between">
9073
+ <button part="button-icon" class="material-icons invisible">close</button>
9074
+ <h3 part="results-title" class="m-0">Notice Details</h3>
9075
+ <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
9076
+ </div>
9077
+ `;
9078
+ html += `
9079
+ <div class="box-large" id="shimmer-container-notices" part="shimmer-container-notices">
9080
+ </div>
9081
+ `;
9082
+ html += '<sf-i-reporting id="detail-reporting" class="hide" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-date:reporting-input-date, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head, reporting-uploader-extracted-text:reporting-reporting-uploader-extracted-text, reporting-uploader-sf-upload-message:reporting-reporting-uploader-sf-upload-message, reporting-uploader-sf-upload-submessage:reporting-reporting-uploader-sf-upload-submessage, reporting-uploader-extracted-text-chip:reporting-reporting-uploader-extracted-text-chip, reporting-uploader-extracted-text-chip-failed:reporting-reporting-uploader-extracted-text-chip-failed, reporting-uploader-doctype-verify-badge:reporting-reporting-uploader-doctype-verify-badge, reporting-span-submit-published:reporting-reporting-span-submit-published, reporting-span-submit-unpublished:reporting-reporting-span-submit-unpublished, reporting-reporting-container:reporting-reporting-reporting-container, reporting-button-icon:reporting-reporting-button-icon, reporting-uploader-button-icon:reporting-reporting-uploader-button-icon, reporting-sf-i-form-modal-container:reporting-reporting-sf-i-form-modal-container, reporting-next-calendar-date:reporting-reporting-next-calendar-date, reporting-last-calendar-date:reporting-reporting-last-calendar-date, reporting-input-publish-checkbox:reporting-reporting-input-publish-checkbox, reporting-button-icon-light:reporting-reporting-button-icon-light, reporting-button-icon-small:reporting-reporting-button-icon-small, reporting-uploader-input-label:reporting-reporting-uploader-input-label, reporting-input-radio:reporting-reporting-input-radio, reporting-radio-label:reporting-reporting-radio-label, reporting-input-textarea:reporting-reporting-input-textarea, reporting-input-date:reporting-reporting-input-date, reporting-input-select-single:reporting-reporting-input-select-single, reporting-textarea-container:reporting-reporting-textarea-container, reporting-section-body:reporting-reporting-section-body, reporting-section-container:reporting-reporting-section-container, reporting-date-container:reporting-reporting-date-container, reporting-input-sf-i-uploader:reporting-reporting-input-sf-i-uploader, reporting-published-container:reporting-reporting-published-container, reporting-selected-option:reporting-reporting-selected-option, reporting-input-select-multi-option:reporting-reporting-input-select-multi-option, reporting-select-option-label:reporting-reporting-select-option-label, reporting-input-sf-i-form:reporting-reporting-input-sf-i-form, reporting-input-sf-i-bricks:reporting-reporting-input-sf-i-bricks, reporting-uploader-input:reporting-reporting-uploader-input, reporting-form-container:reporting-reporting-form-container, reporting-published-container:reporting-reporting-published-container, reporting-form-container-published:reporting-reporting-form-container-published, reporting-subsection:reporting-reporting-subsection, reporting-results-title:reporting-reporting-results-title, reporting-td-head:reporting-reporting-td-head, reporting-td-action:reporting-reporting-td-action, reporting-td-body:reporting-reporting-td-body, reporting-td-body-2:reporting-reporting-td-body-2, reporting-add-button:reporting-reporting-add-button, reporting-uploader-button:reporting-reporting-uploader-button, reporting-section-head-collapsed:reporting-reporting-section-head-collapsed, reporting-section-title-expanded:reporting-reporting-section-title-expanded, reporting-section-title-collapsed:reporting-reporting-section-title-collapsed, reporting-section-head-expanded:reporting-reporting-section-head-expanded, reporting-progress-bar-finished:reporting-reporting-progress-bar-finished, reporting-progress-bar-complete:reporting-reporting-progress-bar-complete, reporting-progress-bar-incomplete:reporting-reporting-progress-bar-incomplete, reporting-section-success-icon:reporting-reporting-section-success-icon, reporting-section-body:reporting-reporting-section-body, reporting-title-section:reporting-reporting-title-section, reporting-button-lg:reporting-reporting-button-lg, reporting-uploader-detail-container:reporting-reporting-uploader-detail-container, reporting-textarea-label:reporting-reporting-textarea-label, reporting-date-label:reporting-reporting-date-label, reporting-commentbox:reporting-reporting-commentbox, reporting-comment-username:reporting-reporting-comment-username, reporting-detail-head:reporting-reporting-detail-head" name="Notice Details" apiiduploader="1peg5170d3" apiid="' + this.apiIdNotices + '" mode="admin" flow="details" projectid="' + this.projectId + '" projectname="' + this.projectName + '" editdisable="true" formviewclass="flex-wrap"></sf-i-reporting>';
9083
+ html += '<div part="reporting-view-container">';
9084
+ html += this.renderReporting(listEvent, mmddyyyy);
9085
+ html += "</div>";
9086
+ html += '<div class="d-flex justify-between m-20">';
9087
+ html += '<h3 part="results-title" class="m-0"><br />Comments</h3>';
9088
+ html += '</div>';
9089
+ html += '<div class="m-20">';
9090
+ html += '<div class="d-flex flex-col">';
9091
+ for (var i = 0; i < comments.length; i++) {
9092
+ html += '<div part="commentbox" class="d-flex commentbox ' + (comments[i].author + "").toLowerCase() + 'box">';
9093
+ html += '<div class="mr-20 d-flex flex-col align-end"><span part="comment-username">' + (comments[i].username != null ? comments[i].username : '') + '</span><span part="td-head">' + comments[i].author + '</span>' + ((i === (comments.length - 1) && this.enableDeleteLatestReport) ? '<br /><button class="mt-5 button-delete" part="button">Delete</button>' : '') + '</div>';
9094
+ const onlyCommentText = (comments[i].comment + "").replace(/ *\([^)]*\) */g, "").trim();
9095
+ try {
9096
+ const jsonComments = JSON.parse(onlyCommentText);
9097
+ if (Util.isInteger(jsonComments)) {
9098
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
9099
+ }
9100
+ else {
9101
+ //console.log('json comments', jsonComments);
9102
+ var htmlTable = '';
9103
+ for (var j = 0; j < Object.keys(jsonComments).length; j++) {
9104
+ htmlTable += '<div class="mb-20">';
9105
+ htmlTable += ('<div part="detail-head">' + Object.keys(jsonComments)[j] + '</div>');
9106
+ htmlTable += ('<sf-i-elastic-text text="' + jsonComments[Object.keys(jsonComments)[j]] + '" minLength="20"></sf-i-elastic-text>');
9107
+ htmlTable += '</div>';
9108
+ }
9109
+ html += '<div class="">' + htmlTable + '<small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
9110
+ }
9111
+ }
9112
+ catch (e) {
9113
+ //console.log('json comments exception', comments[i]);
9114
+ html += '<div class="">' + comments[i].comment + '<br /><small><span class="muted">' + Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime()) + '</span></small></div>';
9115
+ }
9116
+ html += '</div>';
9117
+ }
9118
+ if (comments.length === 0) {
9119
+ html += '<div><strong>No comments yet!</strong></div>';
9120
+ }
9121
+ html += '</div>';
9122
+ html += '</div>';
9123
+ this._SfDetailContainer.innerHTML = html;
9124
+ this._SfDetailContainer.style.display = 'block';
9125
+ let sfireporting = this._SfDetailContainer.querySelector('#detail-reporting');
9126
+ sfireporting.selectedItem = listEvent;
9127
+ sfireporting.loadMode();
9128
+ sfireporting.addEventListener('valueChanged', () => {
9129
+ sfireporting.classList.remove('hide');
9130
+ this._SfDetailContainer.querySelector('#shimmer-container-notices').classList.add('hide');
9131
+ });
9132
+ (_a = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
9133
+ this._SfDetailContainer.innerHTML = '';
9134
+ this._SfDetailContainer.style.display = 'none';
9135
+ });
9136
+ (_b = this._SfDetailContainer.querySelector('.button-delete')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', async () => {
9137
+ // await this.fetchDeleteReview(listEvent["id"], mmddyyyy, entityId, locationId);
9138
+ // this.setSuccess('Deleted successfully!')
9139
+ // setTimeout(() => {
9140
+ // this.clearMessages()
9141
+ // }, 3000);
9142
+ // //console.log('deleted', resultDelete);
9143
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9144
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9145
+ // } else {
9146
+ // if(currentColumnButton != null) {
9147
+ // currentColumnButton.click();
9148
+ // }
9149
+ // }
9150
+ console.log('delete review clicked');
9151
+ var clickEvent = new MouseEvent("click", {
9152
+ "view": window,
9153
+ "bubbles": true,
9154
+ "cancelable": false
9155
+ });
9156
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9157
+ });
9158
+ (_c = this._SfDetailContainer.querySelector('#button-auto-approve')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
9159
+ if (this.selectedItemIds.length === 0) {
9160
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true);
9161
+ // this.setSuccess('Auto-Approved successfully!')
9162
+ // setTimeout(() => {
9163
+ // this.clearMessages()
9164
+ // }, 3000);
9165
+ console.log('audto approve single');
9166
+ }
9167
+ else {
9168
+ // let bulkBodyReview = []
9169
+ // for(var k = 0; k < this.selectedItemIds.length; k++) {
9170
+ // const selectedId = this.selectedItemIds[k];
9171
+ // //console.log('selectedid', selectedId);
9172
+ // entityId = selectedId.split('-')[7].replace(/_/g, '-');
9173
+ // locationId = selectedId.split('-')[8].replace(/_/g, '-');
9174
+ // const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9175
+ // mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9176
+ // //console.log(entityId, locationId, eventId, mmddyyyy);
9177
+ // bulkBodyReview.push({
9178
+ // "mmddyyyy": mmddyyyy,
9179
+ // "projectid": this.projectId,
9180
+ // "type": "review",
9181
+ // "eventid": eventId,
9182
+ // "comments": "Auto approved",
9183
+ // "approved": true,
9184
+ // "entityid": entityId,
9185
+ // "locationid": locationId,
9186
+ // "username": this.userName,
9187
+ // "userid": this.userProfileId,
9188
+ // "userrole": this.myRole,
9189
+ // "year": this.calendarStartYYYY
9190
+ // })
9191
+ // }
9192
+ // await this.uploadReviewsBulk(bulkBodyReview);
9193
+ console.log('auto approve bulk');
9194
+ }
9195
+ //console.log('deleted', resultDelete);
9196
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
9197
+ this.processDateSelection(this._SfCustomContainer);
9198
+ }
9199
+ else {
9200
+ // if(currentColumnButton != null) {
9201
+ // currentColumnButton.click();
9202
+ // }
9203
+ }
9204
+ var clickEvent = new MouseEvent("click", {
9205
+ "view": window,
9206
+ "bubbles": true,
9207
+ "cancelable": false
9208
+ });
9209
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9210
+ });
9211
+ if (this.mode == "consumer" || this.mode == "next") {
9212
+ (_f = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async (ev) => {
9213
+ var _a, _b;
9214
+ let buttonClick = ev.target;
9215
+ buttonClick.innerHTML = "Saving...";
9216
+ const comments = this._SfDetailContainer.querySelector('#input-approver-comments').value;
9217
+ const approved = this._SfDetailContainer.querySelector('#input-approve-yes').checked;
9218
+ if (approved == listEvent.approved) {
9219
+ buttonClick.innerHTML = "Save";
9220
+ this.setError('Already Approved!');
9221
+ setTimeout(() => {
9222
+ this.clearMessages();
9223
+ }, 3000);
9224
+ return;
9225
+ }
9226
+ var clickEvent = new MouseEvent("click", {
9227
+ "view": window,
9228
+ "bubbles": true,
9229
+ "cancelable": false
9230
+ });
9231
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9232
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
9233
+ let flagBulk = false;
9234
+ if (this.selectedItemIds.length <= 1) {
9235
+ console.log('mmddyyyy', mmddyyyy);
9236
+ if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "events")) {
9237
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9238
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9239
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
9240
+ this.events[mmdd][p].lastupdated = new Date().toString();
9241
+ }
9242
+ }
9243
+ if (this.recentlyReported[mmdd] == null) {
9244
+ this.recentlyReported[mmdd] = [];
9245
+ }
9246
+ this.recentlyReported[mmdd].push(listEvent);
9247
+ console.log('review single');
9248
+ }
9249
+ }
9250
+ else {
9251
+ let bulkBodyReview = [];
9252
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9253
+ const selectedId = this.selectedItemIds[k];
9254
+ //console.log('selectedid', selectedId);
9255
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
9256
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
9257
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9258
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9259
+ //console.log(entityId, locationId, eventId, mmddyyyy);
9260
+ bulkBodyReview.push({
9261
+ "mmddyyyy": mmddyyyy,
9262
+ "projectid": this.projectId,
9263
+ "type": "review",
9264
+ "eventid": eventId,
9265
+ "comments": comments,
9266
+ "approved": approved,
9267
+ "entityid": entityId,
9268
+ "locationid": locationId,
9269
+ "username": this.userName,
9270
+ "userid": this.userProfileId,
9271
+ "userrole": this.myRole,
9272
+ "year": this.calendarStartYYYY,
9273
+ "module": (_b = listEvent.module) !== null && _b !== void 0 ? _b : "events"
9274
+ });
9275
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
9276
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
9277
+ // await this.sleep(2000);
9278
+ // this.clearMessages();
9279
+ }
9280
+ await this.uploadReviewsBulk(bulkBodyReview);
9281
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9282
+ const selectedId = this.selectedItemIds[k];
9283
+ //console.log('selectedid', selectedId);
9284
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
9285
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
9286
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9287
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9288
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9289
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9290
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9291
+ this.events[mmdd][p].isbulk = true;
9292
+ flagBulk = true;
9293
+ if (this.recentlyReported[mmdd] == null) {
9294
+ this.recentlyReported[mmdd] = [];
9295
+ }
9296
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
9297
+ }
9298
+ }
9299
+ }
9300
+ console.log('review bulk');
9301
+ }
9302
+ if (this.mode == "next") {
9303
+ // this.fetchNext(this.nextPage)
9304
+ this.renderRoleTabsNext(this.nextPage);
9305
+ }
9306
+ else {
9307
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9308
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9309
+ // } else
9310
+ if (this.getCurrentTab() == this.TAB_FIND) {
9311
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
9312
+ this.processFindSelection(this._SfFindContainer, searchString);
9313
+ }
9314
+ else {
9315
+ if (this.selectedItemIds.length > 0) {
9316
+ await this.fetchBulkReportingData();
9317
+ }
9318
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
9319
+ var clickEvent = new MouseEvent("click", {
9320
+ "view": window,
9321
+ "bubbles": true,
9322
+ "cancelable": false
9323
+ });
9324
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9325
+ // if(currentColumnButton != null) {
9326
+ // currentColumnButton.click();
9327
+ // }
9328
+ }
9329
+ }
9330
+ });
9331
+ (_g = this._SfDetailContainer.querySelector('#button-uploader-submit-audit')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async (ev) => {
9332
+ var _a, _b;
9333
+ let buttonClick = ev.target;
9334
+ buttonClick.innerHTML = "Saving...";
9335
+ const comments = this._SfDetailContainer.querySelector('#input-auditor-comments').value;
9336
+ const approved = this._SfDetailContainer.querySelector('#input-approve-yes').checked;
9337
+ if (approved == listEvent.approved) {
9338
+ buttonClick.innerHTML = "Save";
9339
+ this.setError('Already Approved!');
9340
+ setTimeout(() => {
9341
+ this.clearMessages();
9342
+ }, 3000);
9343
+ return;
9344
+ }
9345
+ if (comments.trim().length === 0) {
9346
+ buttonClick.innerHTML = "Save";
9347
+ this.setError('Comments cannot be blank!');
9348
+ setTimeout(() => {
9349
+ this.clearMessages();
9350
+ }, 3000);
9351
+ }
9352
+ else {
9353
+ let flagBulk = false;
9354
+ if (this.selectedItemIds.length <= 1) {
9355
+ if (await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "events")) {
9356
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9357
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9358
+ this.events[mmdd][p].approved = approved;
9359
+ this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
9360
+ this.events[mmdd][p].lastupdated = new Date().toString();
9361
+ }
9362
+ }
9363
+ if (this.recentlyReported[mmdd] == null) {
9364
+ this.recentlyReported[mmdd] = [];
9365
+ }
9366
+ this.recentlyReported[mmdd].push(listEvent);
9367
+ }
9368
+ console.log('uploadaudit single');
9369
+ }
9370
+ else {
9371
+ let bulkBodyAudit = [];
9372
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9373
+ const selectedId = this.selectedItemIds[k];
9374
+ //console.log('selectedid', selectedId);
9375
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
9376
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
9377
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9378
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9379
+ //console.log(entityId, locationId, eventId, mmddyyyy);
9380
+ bulkBodyAudit.push({
9381
+ "mmddyyyy": mmddyyyy,
9382
+ "projectid": this.projectId,
9383
+ "type": "audit",
9384
+ "eventid": eventId,
9385
+ "comments": comments,
9386
+ "approved": approved,
9387
+ "entityid": entityId,
9388
+ "locationid": locationId,
9389
+ "username": this.userName,
9390
+ "userid": this.userProfileId,
9391
+ "userrole": this.myRole,
9392
+ "year": this.calendarStartYYYY,
9393
+ "module": (_b = listEvent.module) !== null && _b !== void 0 ? _b : "events"
9394
+ });
9395
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
9396
+ }
9397
+ await this.uploadAuditsBulk(bulkBodyAudit);
9398
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9399
+ const selectedId = this.selectedItemIds[k];
9400
+ //console.log('selectedid', selectedId);
9401
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
9402
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
9403
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9404
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9405
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9406
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9407
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9408
+ this.events[mmdd][p].isbulk = true;
9409
+ flagBulk = true;
9410
+ if (this.recentlyReported[mmdd] == null) {
9411
+ this.recentlyReported[mmdd] = [];
9412
+ }
9413
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
9414
+ }
9415
+ }
9416
+ }
9417
+ console.log('uploadAudit bulk');
9418
+ }
9419
+ var clickEvent = new MouseEvent("click", {
9420
+ "view": window,
9421
+ "bubbles": true,
9422
+ "cancelable": false
9423
+ });
9424
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9425
+ if (this.mode == "next") {
9426
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
9427
+ }
9428
+ else {
9429
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9430
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9431
+ // } else
9432
+ if (this.getCurrentTab() == this.TAB_FIND) {
9433
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
9434
+ this.processFindSelection(this._SfFindContainer, searchString);
9435
+ }
9436
+ else {
9437
+ if (this.selectedItemIds.length > 0) {
9438
+ await this.fetchBulkReportingData();
9439
+ }
9440
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
9441
+ // if(currentColumnButton != null) {
9442
+ // currentColumnButton.click();
9443
+ // }
9444
+ }
9445
+ }
9446
+ }
9447
+ });
9448
+ if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
9449
+ if (approved) {
9450
+ if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
9451
+ this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'hidden';
9452
+ }
9453
+ }
9454
+ else {
9455
+ if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
9456
+ this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
9457
+ (_h = this._SfDetailContainer.querySelector('#button-uploader-submit-report')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async (ev) => {
9458
+ var _a, _b, _c;
9459
+ let buttonClick = ev.target;
9460
+ buttonClick.innerHTML = "Saving...";
9461
+ const reportercomments = this._SfDetailContainer.querySelector('#input-reporter-comments').value;
9462
+ //console.log('reporter comments 1', reportercomments);
9463
+ const reporterdoc = this._SfDetailContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(this._SfDetailContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
9464
+ let docs = [];
9465
+ //console.log('reporter comments 2', reportercomments);
9466
+ // if(docsOptional.length === 0) {
9467
+ docs = this._SfUploader[0].querySelector('#uploader').selectedValues();
9468
+ // }
9469
+ //console.log('docs', docs);
9470
+ let reportformatvalues = "";
9471
+ let reportformatschema = "";
9472
+ if (this._SfReporting[0] != null) {
9473
+ reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
9474
+ reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
9475
+ }
9476
+ let percentage = "100";
9477
+ if (this._SfDetailContainer.querySelector('#input-reporter-percentage') != null) {
9478
+ percentage = this._SfDetailContainer.querySelector('#input-reporter-percentage').value;
9479
+ }
9480
+ if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
9481
+ //console.log('reporter comments 3', reportercomments);
9482
+ buttonClick.innerHTML = "Save";
9483
+ this.setError('Invalid Percentage!');
9484
+ setTimeout(() => {
9485
+ this.clearMessages();
9486
+ }, 3000);
9487
+ }
9488
+ else {
9489
+ if (docs.length === 0 && docsOptional.length === 0) {
9490
+ //console.log('reporter comments 3', reportercomments);
9491
+ buttonClick.innerHTML = "Save";
9492
+ this.setError('No documents uploaded!');
9493
+ setTimeout(() => {
9494
+ this.clearMessages();
9495
+ }, 3000);
9496
+ }
9497
+ else {
9498
+ //console.log('reporterdoc', reporterdoc);
9499
+ if (reporterdoc.length === 0) {
9500
+ buttonClick.innerHTML = "Save";
9501
+ this.setError('Date of completion not selected!');
9502
+ setTimeout(() => {
9503
+ this.clearMessages();
9504
+ }, 3000);
9505
+ }
9506
+ else if (parseInt(reporterdoc) > new Date().getTime()) {
9507
+ buttonClick.innerHTML = "Save";
9508
+ this.setError('Date of completion cannot be in future!');
9509
+ setTimeout(() => {
9510
+ this.clearMessages();
9511
+ }, 3000);
9512
+ }
9513
+ else {
9514
+ //console.log('makerscheckers 1', reportercomments);
9515
+ if (reportercomments.trim().length === 0) {
9516
+ buttonClick.innerHTML = "Save";
9517
+ this.setError('Comments cannot be blank!');
9518
+ setTimeout(() => {
9519
+ this.clearMessages();
9520
+ }, 3000);
9521
+ }
9522
+ else {
9523
+ var clickEvent = new MouseEvent("click", {
9524
+ "view": window,
9525
+ "bubbles": true,
9526
+ "cancelable": false
9527
+ });
9528
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9529
+ let flagBulk = false;
9530
+ if (this.selectedItemIds.length <= 1) {
9531
+ if (await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, listEvent.module, percentage, makercheckers)) {
9532
+ console.log('this.events', this.events);
9533
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9534
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9535
+ this.events[mmdd][p].documents = docs;
9536
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
9537
+ this.events[mmdd][p].lastupdated = new Date().toString();
9538
+ }
9539
+ }
9540
+ console.log('uploadReport single');
9541
+ if (makercheckers.length > 0) {
9542
+ // await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
9543
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9544
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9545
+ this.events[mmdd][p].approved = true;
9546
+ // this.events[mmdd][p].documents = docs
9547
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
9548
+ this.events[mmdd][p].lastupdated = new Date().toString();
9549
+ }
9550
+ }
9551
+ console.log('upload report auto approve single');
9552
+ }
9553
+ if (this.recentlyReported[mmdd] == null) {
9554
+ this.recentlyReported[mmdd] = [];
9555
+ }
9556
+ this.recentlyReported[mmdd].push(listEvent);
9557
+ }
9558
+ }
9559
+ else {
9560
+ let bulkBody = [];
9561
+ let bulkBodyReview = [];
9562
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9563
+ const selectedId = this.selectedItemIds[k];
9564
+ //console.log('selectedid', selectedId);
9565
+ const makercheckersL = selectedId.split('-')[5];
9566
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
9567
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
9568
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9569
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9570
+ //console.log(entityId, locationId, eventId, mmddyyyy);
9571
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
9572
+ // if(parseInt(makercheckersL) > 0) {
9573
+ // bulkBodyReview.push({
9574
+ // "mmddyyyy": mmddyyyy,
9575
+ // "projectid": this.projectId,
9576
+ // "type": "report",
9577
+ // "eventid": eventId,
9578
+ // "comments": reportercomments,
9579
+ // "dateofcompletion": reporterdoc,
9580
+ // "percentage": percentage,
9581
+ // "entityid": entityId,
9582
+ // "locationid": locationId,
9583
+ // "event": null,
9584
+ // "docs": JSON.stringify(docs),
9585
+ // "approved": true,
9586
+ // "username": this.userName,
9587
+ // "reportformatvalues": reportformatvalues,
9588
+ // "reportformatschema": reportformatschema,
9589
+ // "userid": this.userProfileId,
9590
+ // "userrole": this.myRole,
9591
+ // "year": this.calendarStartYYYY,
9592
+ // "module": listEvent.module ?? "events"
9593
+ // } )
9594
+ // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
9595
+ // }else{
9596
+ bulkBody.push({
9597
+ "mmddyyyy": mmddyyyy,
9598
+ "projectid": this.projectId,
9599
+ "type": "report",
9600
+ "eventid": eventId,
9601
+ "comments": reportercomments,
9602
+ "dateofcompletion": reporterdoc,
9603
+ "percentage": percentage,
9604
+ "entityid": entityId,
9605
+ "locationid": locationId,
9606
+ "event": null,
9607
+ "docs": JSON.stringify(docs),
9608
+ "username": this.userName,
9609
+ "reportformatvalues": reportformatvalues,
9610
+ "reportformatschema": reportformatschema,
9611
+ "userid": this.userProfileId,
9612
+ "userrole": this.myRole,
9613
+ "year": this.calendarStartYYYY,
9614
+ "module": (_c = listEvent.module) !== null && _c !== void 0 ? _c : "events",
9615
+ "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
9616
+ });
9617
+ // }
9618
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
9619
+ // await this.sleep(2000);
9620
+ // this.clearMessages();
9621
+ }
9622
+ // await this.uploadReportsBulk(bulkBody);
9623
+ // await this.fetchBulkReportingData();
9624
+ if (bulkBody.length > 0) {
9625
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
9626
+ }
9627
+ // if(bulkBodyReview.length > 0){
9628
+ // await this.uploadReportsReviewsBulk(bulkBodyReview)
9629
+ // }
9630
+ await this.fetchBulkReportingData();
9631
+ console.log('uploadReport bulk');
9632
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9633
+ const selectedId = this.selectedItemIds[k];
9634
+ //console.log('selectedid', selectedId);
9635
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
9636
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
9637
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9638
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9639
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9640
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9641
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9642
+ this.events[mmdd][p].isbulk = true;
9643
+ flagBulk = true;
9644
+ if (this.recentlyReported[mmdd] == null) {
9645
+ this.recentlyReported[mmdd] = [];
9646
+ }
9647
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
9648
+ }
9649
+ }
9650
+ }
9651
+ }
9652
+ if (this.mode == "next") {
9653
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
9654
+ }
9655
+ else {
9656
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9657
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9658
+ // } else
9659
+ if (this.getCurrentTab() == this.TAB_FIND) {
9660
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
9661
+ this.processFindSelection(this._SfFindContainer, searchString);
9662
+ }
9663
+ else {
9664
+ if (this.selectedItemIds.length > 0) {
9665
+ await this.fetchBulkReportingData();
9666
+ }
9667
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
9668
+ // if(currentColumnButton != null) {
9669
+ // currentColumnButton.click();
9670
+ // }
9671
+ }
9672
+ }
9673
+ }
9674
+ }
9675
+ }
9676
+ }
9677
+ });
9678
+ }
9679
+ }
9680
+ }
9681
+ if (this._SfUploader[0] != null) {
9682
+ this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "none";
9683
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev) => {
9684
+ console.log('uploader analysisInProgress', _ev);
9685
+ this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "block";
9686
+ });
9687
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev) => {
9688
+ console.log('uploader analysisInProgress', _ev);
9689
+ this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "none";
9690
+ });
9691
+ //console.log('documentType checking', documentType);
9692
+ if (documentType != null) {
9693
+ this._SfUploader[0].querySelector('#uploader').docType = documentType;
9694
+ }
9695
+ this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify([]);
9696
+ console.log('uploader', this._SfUploader[0].querySelector('#uploader'));
9697
+ this._SfUploader[0].querySelector('#uploader').loadMode();
9698
+ if (docs.length > 0) {
9699
+ this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify(docs);
9700
+ this._SfUploader[0].querySelector('#uploader').loadMode();
9701
+ }
9702
+ if (this.myRole == this.TAB_APPROVER || approved) {
9703
+ this._SfUploader[0].querySelector('#uploader').readOnly = true;
9704
+ this._SfUploader[0].querySelector('#uploader').loadMode();
9705
+ }
9706
+ else {
9707
+ this._SfUploader[0].querySelector('#uploader').readOnly = false;
9708
+ this._SfUploader[0].querySelector('#uploader').loadMode();
9709
+ }
9710
+ const dataPassthrough = {
9711
+ projectId: this.projectId,
9712
+ countryId: this.countryId,
9713
+ entityId: listEvent.entityid,
9714
+ locationId: listEvent.locationid,
9715
+ mmddyyyy: mmddyyyy,
9716
+ complianceId: listEvent['id'],
9717
+ path: "uploadextract"
9718
+ };
9719
+ const callbackUrlHost = "8icpy39ru0.execute-api.us-east-1.amazonaws.com";
9720
+ const callbackUrlPath = "test/uploadextract";
9721
+ this._SfUploader[0].querySelector('#uploader').projectId = this.projectId;
9722
+ this._SfUploader[0].querySelector('#uploader').dataPassthrough = JSON.stringify(dataPassthrough);
9723
+ this._SfUploader[0].querySelector('#uploader').callbackUrlHost = callbackUrlHost;
9724
+ this._SfUploader[0].querySelector('#uploader').callbackUrlPath = callbackUrlPath;
9725
+ this._SfUploader[0].querySelector('#uploader').loadMode();
9031
9726
  }
9032
- else {
9033
- const jsonRespose = JSON.parse(xhr.responseText);
9034
- this.setError(jsonRespose.error);
9727
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
9728
+ if (this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
9729
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
9730
+ if (listEvent["approved"] != null) {
9731
+ if (listEvent["approved"] === true) {
9732
+ //console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
9733
+ if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
9734
+ this._SfDetailContainer.querySelector('#input-approve-yes').checked = true;
9735
+ }
9736
+ if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
9737
+ this._SfDetailContainer.querySelector('#input-approve-no').checked = false;
9738
+ }
9739
+ }
9740
+ else {
9741
+ if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
9742
+ this._SfDetailContainer.querySelector('#input-approve-yes').checked = false;
9743
+ }
9744
+ if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
9745
+ this._SfDetailContainer.querySelector('#input-approve-no').checked = true;
9746
+ }
9747
+ }
9748
+ }
9749
+ else {
9750
+ if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
9751
+ this._SfDetailContainer.querySelector('#input-approve-yes').checked = false;
9752
+ }
9753
+ if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
9754
+ this._SfDetailContainer.querySelector('#input-approve-no').checked = true;
9755
+ }
9756
+ }
9035
9757
  }
9036
9758
  }
9037
9759
  };
9038
- this.renderNoticeDetails = async (listEvent, mmddyyyy) => {
9760
+ this.renderAgreementDetails = async (listEvent, mmddyyyy) => {
9039
9761
  var _a, _b, _c, _f, _g, _h;
9040
9762
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9041
9763
  let entityId = listEvent.entityid;
@@ -9050,15 +9772,15 @@ let SfIEvents = class SfIEvents extends LitElement {
9050
9772
  html += `
9051
9773
  <div part="compliance-detail-title" class="d-flex justify-between">
9052
9774
  <button part="button-icon" class="material-icons invisible">close</button>
9053
- <h3 part="results-title" class="m-0">Notice Details</h3>
9775
+ <h3 part="results-title" class="m-0">Agreement Details</h3>
9054
9776
  <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
9055
9777
  </div>
9056
9778
  `;
9057
9779
  html += `
9058
- <div class="box-large" id="shimmer-container-notices" part="shimmer-container-notices">
9780
+ <div class="box-large" id="shimmer-container-agreements" part="shimmer-container-agreements">
9059
9781
  </div>
9060
9782
  `;
9061
- html += '<sf-i-reporting id="detail-reporting" class="hide" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-date:reporting-input-date, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head, reporting-uploader-extracted-text:reporting-reporting-uploader-extracted-text, reporting-uploader-sf-upload-message:reporting-reporting-uploader-sf-upload-message, reporting-uploader-sf-upload-submessage:reporting-reporting-uploader-sf-upload-submessage, reporting-uploader-extracted-text-chip:reporting-reporting-uploader-extracted-text-chip, reporting-uploader-extracted-text-chip-failed:reporting-reporting-uploader-extracted-text-chip-failed, reporting-uploader-doctype-verify-badge:reporting-reporting-uploader-doctype-verify-badge, reporting-span-submit-published:reporting-reporting-span-submit-published, reporting-span-submit-unpublished:reporting-reporting-span-submit-unpublished, reporting-reporting-container:reporting-reporting-reporting-container, reporting-button-icon:reporting-reporting-button-icon, reporting-uploader-button-icon:reporting-reporting-uploader-button-icon, reporting-sf-i-form-modal-container:reporting-reporting-sf-i-form-modal-container, reporting-next-calendar-date:reporting-reporting-next-calendar-date, reporting-last-calendar-date:reporting-reporting-last-calendar-date, reporting-input-publish-checkbox:reporting-reporting-input-publish-checkbox, reporting-button-icon-light:reporting-reporting-button-icon-light, reporting-button-icon-small:reporting-reporting-button-icon-small, reporting-uploader-input-label:reporting-reporting-uploader-input-label, reporting-input-radio:reporting-reporting-input-radio, reporting-radio-label:reporting-reporting-radio-label, reporting-input-textarea:reporting-reporting-input-textarea, reporting-input-date:reporting-reporting-input-date, reporting-input-select-single:reporting-reporting-input-select-single, reporting-textarea-container:reporting-reporting-textarea-container, reporting-section-body:reporting-reporting-section-body, reporting-section-container:reporting-reporting-section-container, reporting-date-container:reporting-reporting-date-container, reporting-input-sf-i-uploader:reporting-reporting-input-sf-i-uploader, reporting-published-container:reporting-reporting-published-container, reporting-selected-option:reporting-reporting-selected-option, reporting-input-select-multi-option:reporting-reporting-input-select-multi-option, reporting-select-option-label:reporting-reporting-select-option-label, reporting-input-sf-i-form:reporting-reporting-input-sf-i-form, reporting-input-sf-i-bricks:reporting-reporting-input-sf-i-bricks, reporting-uploader-input:reporting-reporting-uploader-input, reporting-form-container:reporting-reporting-form-container, reporting-published-container:reporting-reporting-published-container, reporting-form-container-published:reporting-reporting-form-container-published, reporting-subsection:reporting-reporting-subsection, reporting-results-title:reporting-reporting-results-title, reporting-td-head:reporting-reporting-td-head, reporting-td-action:reporting-reporting-td-action, reporting-td-body:reporting-reporting-td-body, reporting-td-body-2:reporting-reporting-td-body-2, reporting-add-button:reporting-reporting-add-button, reporting-uploader-button:reporting-reporting-uploader-button, reporting-section-head-collapsed:reporting-reporting-section-head-collapsed, reporting-section-title-expanded:reporting-reporting-section-title-expanded, reporting-section-title-collapsed:reporting-reporting-section-title-collapsed, reporting-section-head-expanded:reporting-reporting-section-head-expanded, reporting-progress-bar-finished:reporting-reporting-progress-bar-finished, reporting-progress-bar-complete:reporting-reporting-progress-bar-complete, reporting-progress-bar-incomplete:reporting-reporting-progress-bar-incomplete, reporting-section-success-icon:reporting-reporting-section-success-icon, reporting-section-body:reporting-reporting-section-body, reporting-title-section:reporting-reporting-title-section, reporting-button-lg:reporting-reporting-button-lg, reporting-uploader-detail-container:reporting-reporting-uploader-detail-container, reporting-textarea-label:reporting-reporting-textarea-label, reporting-date-label:reporting-reporting-date-label, reporting-commentbox:reporting-reporting-commentbox, reporting-comment-username:reporting-reporting-comment-username, reporting-detail-head:reporting-reporting-detail-head" name="Notice Details" apiiduploader="1peg5170d3" apiid="' + this.apiIdNotices + '" mode="admin" flow="details" projectid="' + this.projectId + '" projectname="' + this.projectName + '" editdisable="true" formviewclass="flex-wrap"></sf-i-reporting>';
9783
+ html += '<sf-i-reporting id="detail-reporting" class="hide" exportparts="uploader-extracted-text:reporting-uploader-extracted-text, uploader-sf-upload-message:reporting-uploader-sf-upload-message, uploader-sf-upload-submessage:reporting-uploader-sf-upload-submessage, uploader-extracted-text-chip:reporting-uploader-extracted-text-chip, uploader-extracted-text-chip-failed:reporting-uploader-extracted-text-chip-failed, uploader-doctype-verify-badge:reporting-uploader-doctype-verify-badge,span-submit-published:reporting-span-submit-published, span-submit-unpublished:reporting-span-submit-unpublished, reporting-container:reporting-reporting-container, button-icon:reporting-button-icon, uploader-button-icon:reporting-uploader-button-icon, sf-i-form-modal-container:reporting-sf-i-form-modal-container, next-calendar-date:reporting-next-calendar-date, last-calendar-date:reporting-last-calendar-date, input-publish-checkbox:reporting-input-publish-checkbox, button-icon-light:reporting-button-icon-light, button-icon-small:reporting-button-icon-small, uploader-input-label:reporting-uploader-input-label, input-radio:reporting-input-radio, radio-label:reporting-radio-label, input-textarea:reporting-input-textarea, input-date:reporting-input-date, input-select-single:reporting-input-select-single, textarea-container:reporting-textarea-container, section-body:reporting-section-body, section-container:reporting-section-container, date-container:reporting-date-container, input-sf-i-uploader:reporting-input-sf-i-uploader, published-container:reporting-published-container, selected-option:reporting-selected-option, input-select-multi-option:reporting-input-select-multi-option, select-option-label:reporting-select-option-label, input-sf-i-form:reporting-input-sf-i-form, input-sf-i-bricks:reporting-input-sf-i-bricks, uploader-input:reporting-uploader-input, form-container:reporting-form-container, published-container:reporting-published-container, form-container-published:reporting-form-container-published, subsection:reporting-subsection, results-title:reporting-results-title, td-head:reporting-td-head, td-action:reporting-td-action, td-body:reporting-td-body, td-body-2:reporting-td-body-2, add-button:reporting-add-button, uploader-button:reporting-uploader-button, section-head-collapsed:reporting-section-head-collapsed, section-title-expanded:reporting-section-title-expanded, section-title-collapsed:reporting-section-title-collapsed, section-head-expanded:reporting-section-head-expanded, progress-bar-finished:reporting-progress-bar-finished, progress-bar-complete:reporting-progress-bar-complete, progress-bar-incomplete:reporting-progress-bar-incomplete, section-success-icon:reporting-section-success-icon, section-body:reporting-section-body, title-section:reporting-title-section, button-lg:reporting-button-lg, uploader-detail-container:reporting-uploader-detail-container, textarea-label:reporting-textarea-label, date-label:reporting-date-label, commentbox:reporting-commentbox, comment-username:reporting-comment-username, detail-head:reporting-detail-head, reporting-uploader-extracted-text:reporting-reporting-uploader-extracted-text, reporting-uploader-sf-upload-message:reporting-reporting-uploader-sf-upload-message, reporting-uploader-sf-upload-submessage:reporting-reporting-uploader-sf-upload-submessage, reporting-uploader-extracted-text-chip:reporting-reporting-uploader-extracted-text-chip, reporting-uploader-extracted-text-chip-failed:reporting-reporting-uploader-extracted-text-chip-failed, reporting-uploader-doctype-verify-badge:reporting-reporting-uploader-doctype-verify-badge, reporting-span-submit-published:reporting-reporting-span-submit-published, reporting-span-submit-unpublished:reporting-reporting-span-submit-unpublished, reporting-reporting-container:reporting-reporting-reporting-container, reporting-button-icon:reporting-reporting-button-icon, reporting-uploader-button-icon:reporting-reporting-uploader-button-icon, reporting-sf-i-form-modal-container:reporting-reporting-sf-i-form-modal-container, reporting-next-calendar-date:reporting-reporting-next-calendar-date, reporting-last-calendar-date:reporting-reporting-last-calendar-date, reporting-input-publish-checkbox:reporting-reporting-input-publish-checkbox, reporting-button-icon-light:reporting-reporting-button-icon-light, reporting-button-icon-small:reporting-reporting-button-icon-small, reporting-uploader-input-label:reporting-reporting-uploader-input-label, reporting-input-radio:reporting-reporting-input-radio, reporting-radio-label:reporting-reporting-radio-label, reporting-input-textarea:reporting-reporting-input-textarea, reporting-input-date:reporting-reporting-input-date, reporting-input-select-single:reporting-reporting-input-select-single, reporting-textarea-container:reporting-reporting-textarea-container, reporting-section-body:reporting-reporting-section-body, reporting-section-container:reporting-reporting-section-container, reporting-date-container:reporting-reporting-date-container, reporting-input-sf-i-uploader:reporting-reporting-input-sf-i-uploader, reporting-published-container:reporting-reporting-published-container, reporting-selected-option:reporting-reporting-selected-option, reporting-input-select-multi-option:reporting-reporting-input-select-multi-option, reporting-select-option-label:reporting-reporting-select-option-label, reporting-input-sf-i-form:reporting-reporting-input-sf-i-form, reporting-input-sf-i-bricks:reporting-reporting-input-sf-i-bricks, reporting-uploader-input:reporting-reporting-uploader-input, reporting-form-container:reporting-reporting-form-container, reporting-published-container:reporting-reporting-published-container, reporting-form-container-published:reporting-reporting-form-container-published, reporting-subsection:reporting-reporting-subsection, reporting-results-title:reporting-reporting-results-title, reporting-td-head:reporting-reporting-td-head, reporting-td-action:reporting-reporting-td-action, reporting-td-body:reporting-reporting-td-body, reporting-td-body-2:reporting-reporting-td-body-2, reporting-add-button:reporting-reporting-add-button, reporting-uploader-button:reporting-reporting-uploader-button, reporting-section-head-collapsed:reporting-reporting-section-head-collapsed, reporting-section-title-expanded:reporting-reporting-section-title-expanded, reporting-section-title-collapsed:reporting-reporting-section-title-collapsed, reporting-section-head-expanded:reporting-reporting-section-head-expanded, reporting-progress-bar-finished:reporting-reporting-progress-bar-finished, reporting-progress-bar-complete:reporting-reporting-progress-bar-complete, reporting-progress-bar-incomplete:reporting-reporting-progress-bar-incomplete, reporting-section-success-icon:reporting-reporting-section-success-icon, reporting-section-body:reporting-reporting-section-body, reporting-title-section:reporting-reporting-title-section, reporting-button-lg:reporting-reporting-button-lg, reporting-uploader-detail-container:reporting-reporting-uploader-detail-container, reporting-textarea-label:reporting-reporting-textarea-label, reporting-date-label:reporting-reporting-date-label, reporting-commentbox:reporting-reporting-commentbox, reporting-comment-username:reporting-reporting-comment-username, reporting-detail-head:reporting-reporting-detail-head" name="Notice Details" apiiduploader="1peg5170d3" apiid="' + this.apiIdAgreements + '" mode="admin" flow="details" projectid="' + this.projectId + '" projectname="' + this.projectName + '" editdisable="true" formviewclass="flex-wrap"></sf-i-reporting>';
9062
9784
  html += '<div part="reporting-view-container">';
9063
9785
  html += this.renderReporting(listEvent, mmddyyyy);
9064
9786
  html += "</div>";
@@ -9106,7 +9828,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9106
9828
  sfireporting.loadMode();
9107
9829
  sfireporting.addEventListener('valueChanged', () => {
9108
9830
  sfireporting.classList.remove('hide');
9109
- this._SfDetailContainer.querySelector('#shimmer-container-notices').classList.add('hide');
9831
+ this._SfDetailContainer.querySelector('#shimmer-container-agreements').classList.add('hide');
9110
9832
  });
9111
9833
  (_a = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', () => {
9112
9834
  this._SfDetailContainer.innerHTML = '';
@@ -9136,39 +9858,9 @@ let SfIEvents = class SfIEvents extends LitElement {
9136
9858
  });
9137
9859
  (_c = this._SfDetailContainer.querySelector('#button-auto-approve')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
9138
9860
  if (this.selectedItemIds.length === 0) {
9139
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true);
9140
- // this.setSuccess('Auto-Approved successfully!')
9141
- // setTimeout(() => {
9142
- // this.clearMessages()
9143
- // }, 3000);
9144
9861
  console.log('audto approve single');
9145
9862
  }
9146
9863
  else {
9147
- // let bulkBodyReview = []
9148
- // for(var k = 0; k < this.selectedItemIds.length; k++) {
9149
- // const selectedId = this.selectedItemIds[k];
9150
- // //console.log('selectedid', selectedId);
9151
- // entityId = selectedId.split('-')[7].replace(/_/g, '-');
9152
- // locationId = selectedId.split('-')[8].replace(/_/g, '-');
9153
- // const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9154
- // mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9155
- // //console.log(entityId, locationId, eventId, mmddyyyy);
9156
- // bulkBodyReview.push({
9157
- // "mmddyyyy": mmddyyyy,
9158
- // "projectid": this.projectId,
9159
- // "type": "review",
9160
- // "eventid": eventId,
9161
- // "comments": "Auto approved",
9162
- // "approved": true,
9163
- // "entityid": entityId,
9164
- // "locationid": locationId,
9165
- // "username": this.userName,
9166
- // "userid": this.userProfileId,
9167
- // "userrole": this.myRole,
9168
- // "year": this.calendarStartYYYY
9169
- // })
9170
- // }
9171
- // await this.uploadReviewsBulk(bulkBodyReview);
9172
9864
  console.log('auto approve bulk');
9173
9865
  }
9174
9866
  //console.log('deleted', resultDelete);
@@ -9189,6 +9881,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9189
9881
  });
9190
9882
  if (this.mode == "consumer" || this.mode == "next") {
9191
9883
  (_f = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async (ev) => {
9884
+ var _a, _b;
9192
9885
  let buttonClick = ev.target;
9193
9886
  buttonClick.innerHTML = "Saving...";
9194
9887
  const comments = this._SfDetailContainer.querySelector('#input-approver-comments').value;
@@ -9211,7 +9904,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9211
9904
  let flagBulk = false;
9212
9905
  if (this.selectedItemIds.length <= 1) {
9213
9906
  console.log('mmddyyyy', mmddyyyy);
9214
- if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.isnotice != null ? "notices" : "events")) {
9907
+ if (await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "events")) {
9215
9908
  for (var p = 0; p < this.events[mmdd].length; p++) {
9216
9909
  if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9217
9910
  this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
@@ -9248,7 +9941,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9248
9941
  "userid": this.userProfileId,
9249
9942
  "userrole": this.myRole,
9250
9943
  "year": this.calendarStartYYYY,
9251
- "module": listEvent.isnotice != null ? "notices" : "events"
9944
+ "module": (_b = listEvent.module) !== null && _b !== void 0 ? _b : "events"
9252
9945
  });
9253
9946
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
9254
9947
  // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
@@ -9307,6 +10000,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9307
10000
  }
9308
10001
  });
9309
10002
  (_g = this._SfDetailContainer.querySelector('#button-uploader-submit-audit')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async (ev) => {
10003
+ var _a, _b;
9310
10004
  let buttonClick = ev.target;
9311
10005
  buttonClick.innerHTML = "Saving...";
9312
10006
  const comments = this._SfDetailContainer.querySelector('#input-auditor-comments').value;
@@ -9329,7 +10023,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9329
10023
  else {
9330
10024
  let flagBulk = false;
9331
10025
  if (this.selectedItemIds.length <= 1) {
9332
- if (await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.isnotice != null ? "notices" : "events")) {
10026
+ if (await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, (_a = listEvent.module) !== null && _a !== void 0 ? _a : "events")) {
9333
10027
  for (var p = 0; p < this.events[mmdd].length; p++) {
9334
10028
  if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9335
10029
  this.events[mmdd][p].approved = approved;
@@ -9367,7 +10061,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9367
10061
  "userid": this.userProfileId,
9368
10062
  "userrole": this.myRole,
9369
10063
  "year": this.calendarStartYYYY,
9370
- "module": listEvent.isnotice != null ? "notices" : "events"
10064
+ "module": (_b = listEvent.module) !== null && _b !== void 0 ? _b : "events"
9371
10065
  });
9372
10066
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
9373
10067
  }
@@ -9432,7 +10126,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9432
10126
  if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
9433
10127
  this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
9434
10128
  (_h = this._SfDetailContainer.querySelector('#button-uploader-submit-report')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async (ev) => {
9435
- var _a, _b;
10129
+ var _a, _b, _c;
9436
10130
  let buttonClick = ev.target;
9437
10131
  buttonClick.innerHTML = "Saving...";
9438
10132
  const reportercomments = this._SfDetailContainer.querySelector('#input-reporter-comments').value;
@@ -9505,7 +10199,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9505
10199
  this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9506
10200
  let flagBulk = false;
9507
10201
  if (this.selectedItemIds.length <= 1) {
9508
- if (await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices", percentage, makercheckers)) {
10202
+ if (await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, listEvent.module, percentage, makercheckers)) {
9509
10203
  console.log('this.events', this.events);
9510
10204
  for (var p = 0; p < this.events[mmdd].length; p++) {
9511
10205
  if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
@@ -9566,7 +10260,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9566
10260
  // "userid": this.userProfileId,
9567
10261
  // "userrole": this.myRole,
9568
10262
  // "year": this.calendarStartYYYY,
9569
- // "module": listEvent.isnotice != null ? "notices" : "events"
10263
+ // "module": listEvent.module ?? "events"
9570
10264
  // } )
9571
10265
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
9572
10266
  // }else{
@@ -9588,7 +10282,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9588
10282
  "userid": this.userProfileId,
9589
10283
  "userrole": this.myRole,
9590
10284
  "year": this.calendarStartYYYY,
9591
- "module": listEvent.isnotice != null ? "notices" : "events",
10285
+ "module": (_c = listEvent.module) !== null && _c !== void 0 ? _c : "events",
9592
10286
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
9593
10287
  });
9594
10288
  // }
@@ -10135,8 +10829,9 @@ let SfIEvents = class SfIEvents extends LitElement {
10135
10829
  this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
10136
10830
  });
10137
10831
  (_c = this._SfDetailContainer.querySelector('#button-auto-approve')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
10832
+ var _a, _b;
10138
10833
  if (this.selectedItemIds.length <= 1) {
10139
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
10834
+ await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "events");
10140
10835
  this.setSuccess('Auto-Approved successfully!');
10141
10836
  setTimeout(() => {
10142
10837
  this.clearMessages();
@@ -10165,7 +10860,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10165
10860
  "userid": this.userProfileId,
10166
10861
  "userrole": this.myRole,
10167
10862
  "year": this.calendarStartYYYY,
10168
- "module": event.isnotice != null ? "notices" : "events"
10863
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
10169
10864
  });
10170
10865
  }
10171
10866
  await this.uploadReviewsBulk(bulkBodyReview);
@@ -10311,6 +11006,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10311
11006
  });
10312
11007
  if (this.mode == "consumer" || this.mode == "next") {
10313
11008
  (_s = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _s === void 0 ? void 0 : _s.addEventListener('click', async (ev) => {
11009
+ var _a, _b;
10314
11010
  let buttonClick = ev.target;
10315
11011
  buttonClick.innerHTML = "Saving...";
10316
11012
  const comments = this._SfDetailContainer.querySelector('#input-approver-comments').value;
@@ -10338,7 +11034,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10338
11034
  let flagBulk = false;
10339
11035
  if (this.selectedItemIds.length <= 1) {
10340
11036
  // console.log('mmddyyyy', mmddyyyy)
10341
- if (await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")) {
11037
+ if (await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "events")) {
10342
11038
  for (var p = 0; p < this.events[mmdd].length; p++) {
10343
11039
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10344
11040
  this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
@@ -10374,7 +11070,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10374
11070
  "userid": this.userProfileId,
10375
11071
  "userrole": this.myRole,
10376
11072
  "year": this.calendarStartYYYY,
10377
- "module": event.isnotice != null ? "notices" : "events"
11073
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
10378
11074
  });
10379
11075
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
10380
11076
  // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
@@ -10432,6 +11128,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10432
11128
  }
10433
11129
  });
10434
11130
  (_t = this._SfDetailContainer.querySelector('#button-uploader-submit-audit')) === null || _t === void 0 ? void 0 : _t.addEventListener('click', async (ev) => {
11131
+ var _a, _b;
10435
11132
  let buttonClick = ev.target;
10436
11133
  buttonClick.innerHTML = "Saving...";
10437
11134
  const comments = this._SfDetailContainer.querySelector('#input-auditor-comments').value;
@@ -10460,7 +11157,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10460
11157
  else {
10461
11158
  let flagBulk = false;
10462
11159
  if (this.selectedItemIds.length <= 1) {
10463
- if (await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")) {
11160
+ if (await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "events")) {
10464
11161
  for (var p = 0; p < this.events[mmdd].length; p++) {
10465
11162
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10466
11163
  this.events[mmdd][p].approved = approved;
@@ -10497,7 +11194,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10497
11194
  "userid": this.userProfileId,
10498
11195
  "userrole": this.myRole,
10499
11196
  "year": this.calendarStartYYYY,
10500
- "module": event.isnotice != null ? "notices" : "events"
11197
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "events"
10501
11198
  });
10502
11199
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
10503
11200
  }
@@ -10561,7 +11258,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10561
11258
  if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
10562
11259
  this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
10563
11260
  (_u = this._SfDetailContainer.querySelector('#button-uploader-submit-report')) === null || _u === void 0 ? void 0 : _u.addEventListener('click', async (ev) => {
10564
- var _a, _b;
11261
+ var _a, _b, _c, _f;
10565
11262
  let buttonClick = ev.target;
10566
11263
  buttonClick.innerHTML = "Saving...";
10567
11264
  const reportercomments = this._SfDetailContainer.querySelector('#input-reporter-comments').value;
@@ -10637,7 +11334,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10637
11334
  //console.log('makerscheckers', makercheckers, reportercomments);
10638
11335
  // console.log('reportformatvalues', reportformatvalues)
10639
11336
  // console.log('reportformatschema',reportformatschema)
10640
- if (await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage, makercheckers)) {
11337
+ if (await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_c = event.module) !== null && _c !== void 0 ? _c : "events", percentage, makercheckers)) {
10641
11338
  console.log('this.events', this.events);
10642
11339
  for (var p = 0; p < this.events[mmdd].length; p++) {
10643
11340
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
@@ -10647,7 +11344,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10647
11344
  }
10648
11345
  }
10649
11346
  if (makercheckers.length > 0) {
10650
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
11347
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
10651
11348
  for (var p = 0; p < this.events[mmdd].length; p++) {
10652
11349
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10653
11350
  this.events[mmdd][p].approved = true;
@@ -10692,7 +11389,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10692
11389
  // "userid": this.userProfileId,
10693
11390
  // "userrole": this.myRole,
10694
11391
  // "year": this.calendarStartYYYY,
10695
- // "module": event.isnotice != null ? "notices" : "events"
11392
+ // "module": event.module ?? "events"
10696
11393
  // })
10697
11394
  // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10698
11395
  // if(parseInt(makercheckersL) > 0) {
@@ -10715,7 +11412,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10715
11412
  // "userid": this.userProfileId,
10716
11413
  // "userrole": this.myRole,
10717
11414
  // "year": this.calendarStartYYYY,
10718
- // "module": event.isnotice != null ? "notices" : "events"
11415
+ // "module": event.module ?? "events"
10719
11416
  // } )
10720
11417
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10721
11418
  // }else{
@@ -10737,7 +11434,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10737
11434
  "userid": this.userProfileId,
10738
11435
  "userrole": this.myRole,
10739
11436
  "year": this.calendarStartYYYY,
10740
- "module": event.isnotice != null ? "notices" : "events",
11437
+ "module": (_f = event.module) !== null && _f !== void 0 ? _f : "events",
10741
11438
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
10742
11439
  });
10743
11440
  // }
@@ -17100,7 +17797,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17100
17797
  }
17101
17798
  };
17102
17799
  this.uploadAudit = async (entityId, locationId, mmddyyyy, eventid, comments, approved, module = "events") => {
17103
- let url = "https://" + this.apiId + "/uploadaudit";
17800
+ let url = "https://" + this.apiId + "/uploadaudit1";
17104
17801
  const body = {
17105
17802
  "mmddyyyy": mmddyyyy,
17106
17803
  "projectid": this.projectId,
@@ -17165,7 +17862,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17165
17862
  }
17166
17863
  };
17167
17864
  this.uploadReview = async (entityId, locationId, mmddyyyy, eventid, comments, approved, module = "events") => {
17168
- let url = "https://" + this.apiId + "/uploadreview";
17865
+ let url = "https://" + this.apiId + "/uploadreview1";
17169
17866
  const body = {
17170
17867
  "mmddyyyy": mmddyyyy,
17171
17868
  "projectid": this.projectId,
@@ -17260,7 +17957,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17260
17957
  }
17261
17958
  };
17262
17959
  this.uploadReport = async (entityId, locationId, mmddyyyy, eventid, comments, doc, docs, event, reportformatvalues = "", reportformatschema = "", module = "events", percentage = "100", makercheckers) => {
17263
- let url = "https://" + this.apiId + "/uploadreport";
17960
+ let url = "https://" + this.apiId + "/uploadreport1";
17264
17961
  let body = {
17265
17962
  "mmddyyyy": mmddyyyy,
17266
17963
  "projectid": this.projectId,
@@ -18464,6 +19161,9 @@ let SfIEvents = class SfIEvents extends LitElement {
18464
19161
  else if (this.selectedFeatures.indexOf('notices') >= 0) {
18465
19162
  this.fetchAndRenderNotices(startDate, endDate, searchString, list, month, year);
18466
19163
  }
19164
+ else if (this.selectedFeatures.indexOf('agreements') >= 0) {
19165
+ this.fetchAndRenderAgreements(startDate, endDate, searchString, list, month, year);
19166
+ }
18467
19167
  };
18468
19168
  this.fetchAndYearlyRenderUserCalendar_2 = async (startDate = "", endDate = "", searchString = "", list = "yes", month = "00", year = this.calendarStartYYYY) => {
18469
19169
  let path = "", view = "";
@@ -18640,6 +19340,75 @@ let SfIEvents = class SfIEvents extends LitElement {
18640
19340
  }
18641
19341
  }
18642
19342
  };
19343
+ this.fetchAndRenderAgreements = async (startDate = "", endDate = "", searchString = "", list = "yes", month = "00", year = this.calendarStartYYYY) => {
19344
+ var _a;
19345
+ let path = "", view = "";
19346
+ this.sdate = startDate;
19347
+ this.edate = endDate;
19348
+ if (this.tagId != null && this.tagId != "") {
19349
+ view = "tag";
19350
+ }
19351
+ else if (this.countryId != null && this.countryId != "") {
19352
+ view = "country";
19353
+ }
19354
+ else if (this.locationId != null && this.locationId != "") {
19355
+ view = "location";
19356
+ }
19357
+ else {
19358
+ view = "entity";
19359
+ }
19360
+ path = "getallcountryobjects";
19361
+ let sDate = "";
19362
+ let eDate = "";
19363
+ //console.log('currenttab', this.getCurrentTab());
19364
+ if (this.getCurrentTab() == this.TAB_YEAR) {
19365
+ sDate = "03/31/" + this.calendarStartYYYY;
19366
+ eDate = "04/01/" + (parseInt(this.calendarStartYYYY) + 1);
19367
+ }
19368
+ else {
19369
+ sDate = startDate;
19370
+ eDate = endDate;
19371
+ }
19372
+ let url = "https://" + this.apiIdAgreements + "/" + path;
19373
+ //console.log('fetch calendar url', url);
19374
+ let urlBody = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "entityid": this.entityId, "countryid": this.countryId, "functionid": this.functionId, "locationid": this.locationId, "tagid": this.tagId, "adhoc": "false", "exclusivestartkey": 0, "sdate": sDate, "edate": eDate, "view": view, "year": year, "list": list, "month": month };
19375
+ if (searchString.length > 0) {
19376
+ urlBody["searchstring"] = searchString;
19377
+ }
19378
+ //console.log('urlbody', urlBody);
19379
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
19380
+ const xhr = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing'));
19381
+ this._SfLoader.innerHTML = '';
19382
+ if (xhr.status == 200) {
19383
+ const jsonRespose = JSON.parse(xhr.responseText);
19384
+ console.log('jsonRespose', jsonRespose);
19385
+ let agreements = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
19386
+ await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
19387
+ this.lastupdated = Util.getDateTimeStrings(new Date().getTime());
19388
+ let tempEvents = this.events;
19389
+ for (let mmddyyyy of Object.keys(agreements)) {
19390
+ tempEvents[mmddyyyy] = [...((_a = tempEvents[mmddyyyy]) !== null && _a !== void 0 ? _a : []), ...agreements[mmddyyyy]];
19391
+ }
19392
+ this.events = tempEvents;
19393
+ this.renderAppropriateStream(this.sdate, this.edate, true);
19394
+ console.log('agreements', agreements, tempEvents);
19395
+ }
19396
+ else {
19397
+ if (xhr.status == 401) {
19398
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
19399
+ this.dispatchEvent(changeEvent);
19400
+ }
19401
+ if (xhr.status === 404) {
19402
+ this.showChosenProject();
19403
+ this._SfTitleChosenProject.innerHTML = this._SfProject[0].querySelector('#sf-i-project').selectedTexts()[0];
19404
+ this.renderChosenProject();
19405
+ }
19406
+ else {
19407
+ const jsonRespose = JSON.parse(xhr.responseText);
19408
+ this.setError(jsonRespose.error);
19409
+ }
19410
+ }
19411
+ };
18643
19412
  this.fetchStatistics = async (startDate = "", endDate = "", filtercriteria, filterid, subfiltercriteria, subfilterid) => {
18644
19413
  var _a;
18645
19414
  let path = "";
@@ -18664,6 +19433,9 @@ let SfIEvents = class SfIEvents extends LitElement {
18664
19433
  else if (this.selectedFeatures.indexOf('notices') >= 0) {
18665
19434
  url = "https://" + this.apiIdNotices + "/" + path;
18666
19435
  }
19436
+ else if (this.selectedFeatures.indexOf('agreements') >= 0) {
19437
+ url = "https://" + this.apiIdAgreements + "/" + path;
19438
+ }
18667
19439
  //console.log('fetch calendar url', url);
18668
19440
  let urlBody = { "projectid": this.projectId, "userid": this.userProfileId, "role": this.myRole, "sdate": sDate, "edate": eDate, "filtercriteria": filtercriteria, "subfiltercriteria": subfiltercriteria, "subfilterid": subfilterid };
18669
19441
  if (filtercriteria == 'function') {
@@ -21789,6 +22561,9 @@ __decorate([
21789
22561
  __decorate([
21790
22562
  property()
21791
22563
  ], SfIEvents.prototype, "apiIdNotices", void 0);
22564
+ __decorate([
22565
+ property()
22566
+ ], SfIEvents.prototype, "apiIdAgreements", void 0);
21792
22567
  __decorate([
21793
22568
  property()
21794
22569
  ], SfIEvents.prototype, "apiMethodList", void 0);