sf-i-events 1.0.846 → 1.0.848

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.
@@ -1241,6 +1241,9 @@ export class SfIEvents extends LitElement {
1241
1241
  @property()
1242
1242
  apiIdNotices!: string;
1243
1243
 
1244
+ @property()
1245
+ apiIdAgreements!: string;
1246
+
1244
1247
  @property()
1245
1248
  apiMethodList!: string;
1246
1249
 
@@ -4617,7 +4620,7 @@ export class SfIEvents extends LitElement {
4617
4620
  html += '<div class="stream-events-container flex-grow" part="' + bgStatus + '">';
4618
4621
  html += '<div class="hidden-tags hide">'+JSON.stringify(event['tags'])+'</div>'
4619
4622
  html += '<div class="hidden-title hide"><table><thead><th part="badge-filtered"><i>not filtered</i></th></thead></table></div>'
4620
- 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,'_') + '-' + ((event.isnotice ?? 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 + '-'+((event.isnotice ?? 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>';
4623
+ 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,'_') + '-' + ((event.module ?? 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 + '-'+((event.module ?? 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>';
4621
4624
  if(event.reporters != null && remarks.length > 0) {
4622
4625
  html += '<div part="stream-events-event-subtitle" class="stream-events-event-subtitle">'+remarks+', occurred on '+occurrenceDate+'</div>';
4623
4626
  }
@@ -4753,7 +4756,7 @@ export class SfIEvents extends LitElement {
4753
4756
  html += '<tbody>';
4754
4757
  html += '<td id="td-expand-'+i+'" part="td-body">';
4755
4758
  if(event.isbulk == null || !event.isbulk){
4756
- html += '<button id="button-unmapped-expand-'+mmdd.replace('/', '-')+'-'+j+'-'+((event.isnotice ?? false)?'isnotice':'isevent')+ '" part="button-icon-small" class="material-icons button-expand mr-10">open_in_new</button>'
4759
+ html += '<button id="button-unmapped-expand-'+mmdd.replace('/', '-')+'-'+j+'-'+((event.module ?? false)?event.module:'compliance')+ '" part="button-icon-small" class="material-icons button-expand mr-10">open_in_new</button>'
4757
4760
  }else{
4758
4761
  html += '<div class="lds-dual-ring1 bulk-loader"></div>';
4759
4762
  }
@@ -5693,7 +5696,7 @@ export class SfIEvents extends LitElement {
5693
5696
  }
5694
5697
  let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title') as NodeListOf<SfIElasticText>
5695
5698
  for(let streamEventTitle of streamEventTitles){
5696
- if(streamEventTitle.id == 'stream-event-title-'+mmdd.replace(/\//g, '-') + '-' + j + '-'+((event.isnotice ?? false)?'isnotice':'isevent')){
5699
+ if(streamEventTitle.id == 'stream-event-title-'+mmdd.replace(/\//g, '-') + '-' + j + '-'+((event.module ?? false)?event.module:'compliance')){
5697
5700
  streamEventTitle.setAttribute('part','stream-event-title-selected')
5698
5701
  }else{
5699
5702
  streamEventTitle.removeAttribute('part')
@@ -5719,7 +5722,7 @@ export class SfIEvents extends LitElement {
5719
5722
  });
5720
5723
  listReportingContainer.querySelector('#button-auto-approve')?.addEventListener('click', async () => {
5721
5724
  if(this.selectedItemIds.length <= 1){
5722
- await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
5725
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
5723
5726
  this.setSuccess('Auto-Approved successfully!')
5724
5727
  setTimeout(() => {
5725
5728
  this.clearMessages()
@@ -5749,7 +5752,7 @@ export class SfIEvents extends LitElement {
5749
5752
  "userid": this.userProfileId,
5750
5753
  "userrole": this.myRole,
5751
5754
  "year": this.calendarStartYYYY,
5752
- "module": event.isnotice != null ? "notices" : "events"
5755
+ "module": event.module ?? "events"
5753
5756
  })
5754
5757
  }
5755
5758
  await this.uploadReviewsBulk(bulkBodyReview);
@@ -5791,7 +5794,7 @@ export class SfIEvents extends LitElement {
5791
5794
  let flagBulk = false;
5792
5795
  if(this.selectedItemIds.length <= 1){
5793
5796
  console.log('selectedevent', JSON.stringify(event));
5794
- if(await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")){
5797
+ if(await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "events")){
5795
5798
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
5796
5799
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
5797
5800
  this.events[mmdd][p].approved = approved
@@ -5833,7 +5836,7 @@ export class SfIEvents extends LitElement {
5833
5836
  "userid": this.userProfileId,
5834
5837
  "userrole": this.myRole,
5835
5838
  "year": this.calendarStartYYYY,
5836
- "module": event.isnotice != null ? "notices" : "events"
5839
+ "module": event.module ?? "events"
5837
5840
  })
5838
5841
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
5839
5842
 
@@ -5904,7 +5907,7 @@ export class SfIEvents extends LitElement {
5904
5907
  } else {
5905
5908
  let flagBulk = false;
5906
5909
  if(this.selectedItemIds.length <= 1){
5907
- if(await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")){
5910
+ if(await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "events")){
5908
5911
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
5909
5912
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
5910
5913
  this.events[mmdd][p].approved = approved
@@ -5946,7 +5949,7 @@ export class SfIEvents extends LitElement {
5946
5949
  "userid": this.userProfileId,
5947
5950
  "userrole": this.myRole,
5948
5951
  "year": this.calendarStartYYYY,
5949
- "module": event.isnotice != null ? "notices" : "events"
5952
+ "module": event.module ?? "events"
5950
5953
  })
5951
5954
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
5952
5955
 
@@ -6097,7 +6100,7 @@ export class SfIEvents extends LitElement {
6097
6100
  let flagBulk = false;
6098
6101
  if(this.selectedItemIds.length <= 1){
6099
6102
 
6100
- 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)){
6103
+ if(await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "events", percentage, event.makercheckers)){
6101
6104
 
6102
6105
  console.log('this.events', this.events);
6103
6106
  if(this.mode != "next"){
@@ -6111,7 +6114,7 @@ export class SfIEvents extends LitElement {
6111
6114
 
6112
6115
  if(event.makercheckers.length > 0) {
6113
6116
 
6114
- // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
6117
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
6115
6118
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
6116
6119
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
6117
6120
  this.events[mmdd][p].approved = true
@@ -6165,7 +6168,7 @@ export class SfIEvents extends LitElement {
6165
6168
  // "userid": this.userProfileId,
6166
6169
  // "userrole": this.myRole,
6167
6170
  // "year": this.calendarStartYYYY,
6168
- // "module": event.isnotice != null ? "notices" : "events"
6171
+ // "module": event.module ?? "events"
6169
6172
  // } )
6170
6173
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
6171
6174
 
@@ -6188,7 +6191,7 @@ export class SfIEvents extends LitElement {
6188
6191
  "userid": this.userProfileId,
6189
6192
  "userrole": this.myRole,
6190
6193
  "year": this.calendarStartYYYY,
6191
- "module": event.isnotice != null ? "notices" : "events",
6194
+ "module": event.module ?? "events",
6192
6195
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
6193
6196
  })
6194
6197
  // }
@@ -6563,10 +6566,12 @@ export class SfIEvents extends LitElement {
6563
6566
  const idArr = id.split("-")
6564
6567
  const mmdd = idArr[3] + "/" + idArr[4];
6565
6568
  const j = idArr[5];
6566
- const isnotice = idArr[6];
6569
+ const module = idArr[6];
6567
6570
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
6568
- if(isnotice === "isnotice"){
6571
+ if(module === "notice"){
6569
6572
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6573
+ } else if(module === "agreement"){
6574
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6570
6575
  }else{
6571
6576
  let found = false;
6572
6577
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -6600,10 +6605,12 @@ export class SfIEvents extends LitElement {
6600
6605
  const idArr = id.split("-")
6601
6606
  const mmdd = idArr[3] + "/" + idArr[4];
6602
6607
  const j = idArr[5];
6603
- const isnotice = idArr[6];
6608
+ const module = idArr[6];
6604
6609
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
6605
- if(isnotice === "isnotice"){
6610
+ if(module === "notice"){
6606
6611
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6612
+ } else if(module === "agreement"){
6613
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
6607
6614
  }else{
6608
6615
  let found = false;
6609
6616
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -6646,7 +6653,7 @@ export class SfIEvents extends LitElement {
6646
6653
  const j = idArr[4];
6647
6654
  // const makercheckers = idArr[5];
6648
6655
  const docs = idArr[6];
6649
- const isnotice = idArr[14];
6656
+ const module = idArr[14];
6650
6657
 
6651
6658
  if((ev.target as HTMLInputElement).checked) {
6652
6659
  this.selectedItemIds.push(id);
@@ -6657,7 +6664,7 @@ export class SfIEvents extends LitElement {
6657
6664
  listReportingContainer.innerHTML = '';
6658
6665
  let buttonListReporting = eventsContainer.querySelector('#button-list-reporting-' + mmdd.replace(/\//g,'-') + '-' + j) as HTMLButtonElement
6659
6666
  buttonListReporting.setAttribute('part','button-list-reporting')
6660
- let streamEventTitle = eventsContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + isnotice) as SfIElasticText
6667
+ let streamEventTitle = eventsContainer.querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + module) as SfIElasticText
6661
6668
  streamEventTitle.removeAttribute('part')
6662
6669
  }
6663
6670
 
@@ -6704,13 +6711,13 @@ export class SfIEvents extends LitElement {
6704
6711
  const idArr1 = id1.split("-")
6705
6712
  const docs1 = idArr1[6];
6706
6713
  const status = idArr1[13].replace(/_/g, '-');
6707
- const isnotice1 = idArr1[14]
6714
+ const module1 = idArr1[14]
6708
6715
  const isbulk = idArr1[15] == "bulk"
6709
6716
  console.log('isBulk button-select', id1, isbulk)
6710
6717
  if(isbulk){
6711
6718
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
6712
6719
  }
6713
- if(docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
6720
+ if(docs == docs1 && status == this.selectedStatus && module == module1) {
6714
6721
  totalVisibleCount++
6715
6722
  } else {
6716
6723
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
@@ -10701,10 +10708,12 @@ export class SfIEvents extends LitElement {
10701
10708
  const idArr = id.split("-")
10702
10709
  const mmdd = idArr[3] + "/" + idArr[4];
10703
10710
  const j = idArr[5];
10704
- const isnotice = idArr[6];
10711
+ const module = idArr[6];
10705
10712
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
10706
- if(isnotice === "isnotice"){
10713
+ if(module === "notice"){
10707
10714
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10715
+ } else if(module === "agreement"){
10716
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10708
10717
  }else{
10709
10718
  let found = false;
10710
10719
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -10738,10 +10747,12 @@ export class SfIEvents extends LitElement {
10738
10747
  const idArr = id.split("-")
10739
10748
  const mmdd = idArr[3] + "/" + idArr[4];
10740
10749
  const j = idArr[5];
10741
- const isnotice = idArr[6];
10750
+ const module = idArr[6];
10742
10751
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
10743
- if(isnotice === "isnotice"){
10752
+ if(module === "notice"){
10744
10753
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10754
+ } else if(module === "agreement"){
10755
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
10745
10756
  }else{
10746
10757
  let found = false;
10747
10758
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -10783,7 +10794,7 @@ export class SfIEvents extends LitElement {
10783
10794
  const j = idArr[4];
10784
10795
  // const makercheckers = idArr[5];
10785
10796
  const docs = idArr[6];
10786
- const isnotice = idArr[14];
10797
+ const module = idArr[14];
10787
10798
 
10788
10799
  if((ev.target as HTMLInputElement).checked) {
10789
10800
  this.selectedItemIds.push(id);
@@ -10794,7 +10805,7 @@ export class SfIEvents extends LitElement {
10794
10805
  listReportingContainer.innerHTML = '';
10795
10806
  let buttonListReporting = (this._SfThisContainer as HTMLDivElement).querySelector('#button-list-reporting-' + mmdd.replace(/\//g,'-') + '-' + j) as HTMLButtonElement
10796
10807
  buttonListReporting.setAttribute('part','button-list-reporting')
10797
- let streamEventTitle = (this._SfThisContainer as HTMLDivElement).querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + isnotice) as SfIElasticText
10808
+ let streamEventTitle = (this._SfThisContainer as HTMLDivElement).querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + module) as SfIElasticText
10798
10809
  streamEventTitle.removeAttribute('part')
10799
10810
 
10800
10811
  }
@@ -10842,13 +10853,13 @@ export class SfIEvents extends LitElement {
10842
10853
  const idArr1 = id1.split("-")
10843
10854
  const docs1 = idArr1[6];
10844
10855
  const status = idArr1[13].replace(/_/g, '-');
10845
- const isnotice1 = idArr1[14]
10856
+ const module1 = idArr1[14]
10846
10857
  const isbulk = idArr1[15] == "bulk"
10847
10858
  if(isbulk){
10848
10859
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
10849
10860
  }
10850
10861
 
10851
- if(docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
10862
+ if(docs == docs1 && status == this.selectedStatus && module == module1) {
10852
10863
  totalVisibleCount++
10853
10864
  } else {
10854
10865
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
@@ -11287,10 +11298,12 @@ export class SfIEvents extends LitElement {
11287
11298
  const idArr = id.split("-")
11288
11299
  const mmdd = idArr[3] + "/" + idArr[4];
11289
11300
  const j = idArr[5];
11290
- const isnotice = idArr[6];
11301
+ const module = idArr[6];
11291
11302
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
11292
- if(isnotice === "isnotice"){
11303
+ if(module === "notice"){
11293
11304
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11305
+ } else if(module === "agreement"){
11306
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11294
11307
  }else{
11295
11308
  let found = false;
11296
11309
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -11328,10 +11341,12 @@ export class SfIEvents extends LitElement {
11328
11341
  const idArr = id.split("-")
11329
11342
  const mmdd = idArr[3] + "/" + idArr[4];
11330
11343
  const j = idArr[5];
11331
- const isnotice = idArr[6];
11344
+ const module = idArr[6];
11332
11345
  var yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
11333
- if(isnotice === "isnotice"){
11346
+ if(module === "notice"){
11334
11347
  this.renderNoticeDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11348
+ } else if(module === "agreement"){
11349
+ this.renderAgreementDetails(this.events[mmdd][j], mmdd + "/" + yyyy)
11335
11350
  }else{
11336
11351
  let found = false;
11337
11352
  for(var k = 0; k < this.selectedItemIds.length; k++) {
@@ -11374,7 +11389,7 @@ export class SfIEvents extends LitElement {
11374
11389
  const j = idArr[4];
11375
11390
  // const makercheckers = idArr[5];
11376
11391
  const docs = idArr[6];
11377
- const isnotice = idArr[14];
11392
+ const module = idArr[14];
11378
11393
  if((ev.target as HTMLInputElement).checked) {
11379
11394
  this.selectedItemIds.push(id);
11380
11395
  } else {
@@ -11384,7 +11399,7 @@ export class SfIEvents extends LitElement {
11384
11399
  listReportingContainer.innerHTML = '';
11385
11400
  let buttonListReporting = (this._SfStreamContainer as HTMLDivElement).querySelector('#button-list-reporting-' + mmdd.replace(/\//g,'-') + '-' + j) as HTMLButtonElement
11386
11401
  buttonListReporting.setAttribute('part','button-list-reporting')
11387
- let streamEventTitle = (this._SfStreamContainer as HTMLDivElement).querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + isnotice) as SfIElasticText
11402
+ let streamEventTitle = (this._SfStreamContainer as HTMLDivElement).querySelector('#stream-event-title-' + mmdd.replace(/\//g,'-') + '-' + j + '-' + module) as SfIElasticText
11388
11403
  streamEventTitle.removeAttribute('part')
11389
11404
  }
11390
11405
 
@@ -11429,14 +11444,14 @@ export class SfIEvents extends LitElement {
11429
11444
  const idArr1 = id1.split("-")
11430
11445
  const docs1 = idArr1[6];
11431
11446
  const status = idArr1[13].replace(/_/g, '-');
11432
- const isnotice1 = idArr1[14]
11447
+ const module1 = idArr1[14]
11433
11448
  const isbulk = idArr1[15] == "bulk"
11434
11449
  console.log('isBulk button-select', id1, isbulk)
11435
11450
  if(isbulk){
11436
11451
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
11437
11452
  }
11438
11453
 
11439
- if(docs == docs1 && status == this.selectedStatus && isnotice == isnotice1) {
11454
+ if(docs == docs1 && status == this.selectedStatus && module == module1) {
11440
11455
  totalVisibleCount++
11441
11456
  } else {
11442
11457
  (buttonSelect[k] as HTMLInputElement).style.display = 'none';
@@ -12576,7 +12591,7 @@ export class SfIEvents extends LitElement {
12576
12591
  <div class="box-large" id="shimmer-container-notices" part="shimmer-container-notices">
12577
12592
  </div>
12578
12593
  `
12579
- 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>';
12594
+ 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, reporting-input-sf-i-select:reporting-reporting-input-sf-i-select, select-input-select:reporting-select-input-select" 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>';
12580
12595
 
12581
12596
  html += '<div part="reporting-view-container">'
12582
12597
  html += this.renderReporting(listEvent, mmddyyyy);
@@ -12755,7 +12770,7 @@ export class SfIEvents extends LitElement {
12755
12770
  let flagBulk = false;
12756
12771
  if(this.selectedItemIds.length <= 1) {
12757
12772
  console.log('mmddyyyy', mmddyyyy)
12758
- if(await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.isnotice != null ? "notices" : "events")){
12773
+ if(await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")){
12759
12774
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
12760
12775
  if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12761
12776
 
@@ -12794,7 +12809,7 @@ export class SfIEvents extends LitElement {
12794
12809
  "userid": this.userProfileId,
12795
12810
  "userrole": this.myRole,
12796
12811
  "year": this.calendarStartYYYY,
12797
- "module": listEvent.isnotice != null ? "notices" : "events"
12812
+ "module": listEvent.module ?? "events"
12798
12813
  })
12799
12814
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
12800
12815
 
@@ -12883,7 +12898,7 @@ export class SfIEvents extends LitElement {
12883
12898
  let flagBulk = false;
12884
12899
  if(this.selectedItemIds.length <= 1) {
12885
12900
 
12886
- if(await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.isnotice != null ? "notices" : "events")){
12901
+ if(await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")){
12887
12902
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
12888
12903
  if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12889
12904
  this.events[mmdd][p].approved = approved
@@ -12923,7 +12938,7 @@ export class SfIEvents extends LitElement {
12923
12938
  "userid": this.userProfileId,
12924
12939
  "userrole": this.myRole,
12925
12940
  "year": this.calendarStartYYYY,
12926
- "module": listEvent.isnotice != null ? "notices" : "events"
12941
+ "module": listEvent.module ?? "events"
12927
12942
  })
12928
12943
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
12929
12944
 
@@ -13093,7 +13108,7 @@ export class SfIEvents extends LitElement {
13093
13108
  let flagBulk = false;
13094
13109
  if(this.selectedItemIds.length <= 1) {
13095
13110
 
13096
- if(await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices", percentage, makercheckers)){
13111
+ if(await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, listEvent.module, percentage, makercheckers)){
13097
13112
  console.log('this.events', this.events);
13098
13113
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
13099
13114
  if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
@@ -13158,7 +13173,7 @@ export class SfIEvents extends LitElement {
13158
13173
  // "userid": this.userProfileId,
13159
13174
  // "userrole": this.myRole,
13160
13175
  // "year": this.calendarStartYYYY,
13161
- // "module": listEvent.isnotice != null ? "notices" : "events"
13176
+ // "module": listEvent.module ?? "events"
13162
13177
  // } )
13163
13178
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
13164
13179
 
@@ -13181,7 +13196,7 @@ export class SfIEvents extends LitElement {
13181
13196
  "userid": this.userProfileId,
13182
13197
  "userrole": this.myRole,
13183
13198
  "year": this.calendarStartYYYY,
13184
- "module": listEvent.isnotice != null ? "notices" : "events",
13199
+ "module": listEvent.module ?? "events",
13185
13200
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
13186
13201
  })
13187
13202
  // }
@@ -13352,167 +13367,932 @@ export class SfIEvents extends LitElement {
13352
13367
 
13353
13368
  }
13354
13369
  }
13370
+ renderAgreementDetails = async (listEvent: any, mmddyyyy:string) => {
13371
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13372
+ let entityId = listEvent.entityid;
13373
+ let locationId = listEvent.locationid;
13374
+ let comments = listEvent['comments'];
13375
+ let docs = listEvent['documents'] == null ? [] : listEvent['documents'] == null ? [] : (listEvent['documents']);
13376
+ let approved = listEvent['approved'] == null ? false : listEvent['approved'] == null ? false : listEvent['approved'];
13377
+ let makercheckers = listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'] == null ? [] : listEvent['makercheckers'];
13378
+ let docsOptional = listEvent['docs'] == null ? [] : listEvent['docs'] == null ? [] : listEvent['docs'];let html:string = '';
13379
+ let documentType = listEvent['documenttype'] == null ? null : listEvent['documenttype'][0] == null ? null : listEvent['documenttype'][0].split(" ")[0];
13380
+ html += `
13381
+ <div part="compliance-detail-title" class="d-flex justify-between">
13382
+ <button part="button-icon" class="material-icons invisible">close</button>
13383
+ <h3 part="results-title" class="m-0">Agreement Details</h3>
13384
+ <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
13385
+ </div>
13386
+ `
13387
+ html += `
13388
+ <div class="box-large" id="shimmer-container-agreements" part="shimmer-container-agreements">
13389
+ </div>
13390
+ `
13391
+ 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>';
13355
13392
 
13356
- fetchEventDetails = async (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement, flagUploadGuidance: boolean = false, listEventContainer: HTMLDivElement | null = null) => {
13357
- console.log('listEvent', listEvent, listEvent.id)
13358
- let url = "https://"+this.apiId+"/getalleventdetails";
13359
-
13360
- //console.log('fetch calendar url', url);
13361
- let urlBody :any = {"projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "eventid": listEvent.id, "entityid": listEvent.entityid, "locationid": listEvent.locationid, "mmddyyyy": mmddyyyy, "year": this.getFinancialYear(mmddyyyy)};
13393
+ html += '<div part="reporting-view-container">'
13394
+ html += this.renderReporting(listEvent, mmddyyyy);
13395
+ html += "</div>"
13362
13396
 
13363
- //console.log('urlbody', urlBody);
13397
+ html += '<div class="d-flex justify-between m-20">';
13398
+ html += '<h3 part="results-title" class="m-0"><br />Comments</h3>';
13399
+ html += '</div>';
13400
+
13401
+ html += '<div class="m-20">';
13364
13402
 
13365
- const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
13366
- const xhr : any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
13367
- this._SfLoader.innerHTML = '';
13368
- if(xhr.status == 200) {
13403
+ html += '<div class="d-flex flex-col">';
13369
13404
 
13370
- const jsonRespose = JSON.parse(xhr.responseText);
13371
- console.log('jsonRespose', jsonRespose);
13372
- if(flagUploadGuidance){
13373
- if(listEventContainer != null){
13374
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13375
- if(this.events[mmdd] != null){
13376
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
13377
- if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == listEvent.locationid && this.events[mmdd][p].entityid == listEvent.entityid){
13378
- this.events[mmdd][p].uploadguidance = jsonRespose.data.uploadguidance
13405
+ for(var i = 0; i < comments.length; i++) {
13406
+ html += '<div part="commentbox" class="d-flex commentbox '+(comments[i].author + "").toLowerCase()+'box">';
13407
+ 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>';
13408
+
13409
+ const onlyCommentText = (comments[i].comment + "").replace(/ *\([^)]*\) */g, "").trim();
13410
+ try {
13411
+
13412
+ const jsonComments = JSON.parse(onlyCommentText);
13413
+
13414
+ if(Util.isInteger(jsonComments)) {
13415
+ html += '<div class="">'+comments[i].comment+'<br /><small><span class="muted">'+Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime())+'</span></small></div>';
13416
+ } else {
13417
+ //console.log('json comments', jsonComments);
13418
+ var htmlTable = '';
13419
+ for(var j = 0; j < Object.keys(jsonComments).length; j++) {
13420
+ htmlTable += '<div class="mb-20">';
13421
+ htmlTable += ('<div part="detail-head">' + Object.keys(jsonComments)[j] + '</div>');
13422
+ htmlTable += ('<sf-i-elastic-text text="'+jsonComments[Object.keys(jsonComments)[j]]+'" minLength="20"></sf-i-elastic-text>');
13423
+ htmlTable += '</div>';
13424
+ }
13425
+ html += '<div class="">'+htmlTable+'<small><span class="muted">'+Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime())+'</span></small></div>';
13379
13426
  }
13427
+
13428
+ } catch (e: any) {
13429
+ //console.log('json comments exception', comments[i]);
13430
+ html += '<div class="">'+comments[i].comment+'<br /><small><span class="muted">'+Util.getDateTimeStrings(new Date(comments[i].timestamp).getTime())+'</span></small></div>';
13380
13431
  }
13432
+
13433
+ html += '</div>';
13434
+ }
13435
+ if(comments.length === 0) {
13436
+ html += '<div><strong>No comments yet!</strong></div>';
13381
13437
  }
13382
- this.renderListReporting(listEventContainer, jsonRespose.data, mmddyyyy, eventsContainer)
13383
- }
13384
- }else{
13385
- this.renderEventDetail(jsonRespose.data,mmddyyyy, currentColumnButton, eventsContainer);
13386
- }
13387
13438
 
13388
- } else {
13389
- if(xhr.status == 401){
13390
- let changeEvent = new CustomEvent('tokenExpired',{bubbles:true});
13391
- this.dispatchEvent(changeEvent);
13392
- }
13393
- if(xhr.status === 404) {
13439
+ html += '</div>';
13394
13440
 
13395
- this.showChosenProject();
13396
- (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
13397
- this.renderChosenProject();
13441
+ html += '</div>';
13398
13442
 
13399
- } else {
13400
- const jsonRespose = JSON.parse(xhr.responseText);
13401
- this.setError(jsonRespose.error);
13402
- }
13443
+ (this._SfDetailContainer as HTMLDivElement).innerHTML = html;
13444
+ (this._SfDetailContainer as HTMLDivElement).style.display = 'block';
13403
13445
 
13404
- }
13405
- }
13446
+ let sfireporting = (this._SfDetailContainer as HTMLDivElement).querySelector('#detail-reporting') as SfIReporting
13447
+ sfireporting.selectedItem = listEvent;
13448
+ sfireporting.loadMode();
13449
+
13450
+ sfireporting.addEventListener('valueChanged',()=>{
13451
+ sfireporting.classList.remove('hide');
13452
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#shimmer-container-agreements') as HTMLDivElement).classList.add('hide');
13453
+ });
13406
13454
 
13407
- renderEventDetail = (event: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement) => {
13408
- console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
13455
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close')?.addEventListener('click', () => {
13409
13456
 
13410
- let comments, docs, approved, /*dateOfCompletion,*/ makercheckers: Array<string>, docsOptional, documentType;
13411
- let entityId: string = "";
13412
- let locationId: string = "";
13413
- let statuteName: string = "";
13414
- let reportformatName: string = "";
13415
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13416
- entityId = event.entityid;
13417
- locationId = event.locationid;
13418
- // let completeness = this.getCompletenessStatus(event);
13419
- comments = event['comments'] == null ? [] : (event['comments']);
13420
- docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
13421
- approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
13422
- // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
13423
- makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
13424
- docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
13425
- documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
13457
+ (this._SfDetailContainer as HTMLDivElement).innerHTML = '';
13458
+ (this._SfDetailContainer as HTMLDivElement).style.display = 'none';
13426
13459
 
13427
- statuteName = event['statute'][0].trim();
13428
- if(event['reportformat'] != null){
13429
- reportformatName = (event['reportformat'][0] ?? "").trim().replace('&amp;','&');
13430
- }
13460
+ });
13431
13461
 
13432
- console.log('event detail', event, statuteName);
13433
- //console.log('event detail comments', comments);
13434
- //console.log('event dateofcompletion', dateOfCompletion);
13435
- //console.log('event detail documenttype', documentType);
13436
- const basicFields = ['id', 'shortid', 'entityname', 'locationname','functions'];
13437
- const statuteFields = ['jurisdiction', 'country', 'state', 'category', 'subcategory', 'statute'];
13438
- const complianceFields = ['specificity', 'reference', 'obligation', 'penalty', 'authority', 'frequency', 'subfrequency', 'obligationtype', 'duedate', 'applicability', 'form', 'additionalurls', 'adhocquestion', 'adhocquestionschedule', 'adhocinstances', 'uploadguidance', 'attachment'];
13439
- const grcFields = ['internalcontrols', 'firstlineofdefence', 'secondlineofdefence', 'thirdlineofdefence', 'risk', 'riskarea'];
13462
+ (this._SfDetailContainer as HTMLDivElement).querySelector('.button-delete')?.addEventListener('click', async () => {
13440
13463
 
13441
- let listReportingContainers = eventsContainer.querySelectorAll('.list-reporting-container') as NodeListOf<HTMLDivElement>
13442
- for(let tempReportingContainer of listReportingContainers){
13443
- tempReportingContainer.style.display = 'none';
13444
- tempReportingContainer.innerHTML = '';
13445
- }
13446
- let buttonListReportings = eventsContainer.querySelectorAll('.button-list-reporting') as NodeListOf<HTMLButtonElement>
13447
- for(let buttonListReporting of buttonListReportings){
13448
- buttonListReporting.setAttribute('part','button-list-reporting')
13449
- }
13450
- let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title') as NodeListOf<SfIElasticText>
13451
- for(let streamEventTitle of streamEventTitles){
13452
- streamEventTitle.removeAttribute('part')
13453
- }
13454
- var html = `
13455
-
13456
- <div part="compliance-detail-title" class="d-flex justify-between">
13457
- <button part="button-icon" class="material-icons invisible">close</button>
13458
- <h3 part="results-title" class="m-0">Compliance Details</h3>
13459
- <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
13460
- </div>
13461
-
13462
- `;
13464
+ // await this.fetchDeleteReview(listEvent["id"], mmddyyyy, entityId, locationId);
13465
+ // this.setSuccess('Deleted successfully!')
13466
+ // setTimeout(() => {
13467
+ // this.clearMessages()
13468
+ // }, 3000);
13469
+ // //console.log('deleted', resultDelete);
13470
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
13471
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
13472
+ // } else {
13473
+ // if(currentColumnButton != null) {
13474
+ // currentColumnButton.click();
13475
+ // }
13476
+ // }
13463
13477
 
13464
- if(this.selectedItemIds.length > 1) {
13465
-
13466
- html += `
13467
-
13468
- <div class="d-flex justify-between m-20">
13469
- <h4 class="m-0">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
13470
- </div>
13471
-
13472
- `;
13478
+ console.log('delete review clicked')
13473
13479
 
13474
- }
13475
-
13476
- html += '<div class="accordian-container m-20 pb-20" part="accordian-container">';
13477
-
13478
- html += '<div part="detail-summary">';
13479
- html += ('<div part="detail-summary-title" class="pl-20 pr-20"><h1>'+event['obligationtitle']+'</h1></div>');
13480
- html += ('<div part="detail-summary-subtitle" class="pl-20 pr-20"><h3>'+event['obligation'].replace(/\n/g,'<br />')+'</h3></div>');
13481
- html += ('<div part="detail-summary-content" class="pl-20 pr-20">'+('<sf-i-elastic-text text="'+(event['internalcontrols'] + "").replace(/"/g, "").replace(/\n/g,'<br />')+'" minLength="80"></sf-i-elastic-text>')+'</div>');
13482
- html += '</div>';
13483
-
13484
- html += '<br />';
13480
+ var clickEvent = new MouseEvent("click", {
13481
+ "view": window,
13482
+ "bubbles": true,
13483
+ "cancelable": false
13484
+ });
13485
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13485
13486
 
13486
- html += '<div class="accordian-section section-basic pl-20 pr-20" part="accordian-section">';
13487
- html += '<div class="d-flex justify-between accordian-head head-basic cursor" part="accordian-head">';
13488
- html += '<h3>Basic Information</h3>'
13489
- html += '<h3 class="head-indicator-basic">-</h3>'
13490
- html += '</div>';
13491
- html += '<div class="d-flex flex-wrap accordian-body body-basic" part="accordian-body">';
13487
+ });
13488
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
13489
+ if(this.selectedItemIds.length === 0) {
13490
+ console.log('audto approve single')
13491
+ }else{
13492
+ console.log('auto approve bulk')
13493
+ }
13494
+ //console.log('deleted', resultDelete);
13495
+ if(this.getCurrentTab() == this.TAB_CUSTOM) {
13496
+ this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
13497
+ } else {
13498
+ // if(currentColumnButton != null) {
13499
+ // currentColumnButton.click();
13500
+ // }
13501
+ }
13492
13502
 
13493
- for(var i = 0; i < basicFields.length; i++) {
13494
-
13495
- if(!this.getEventPreviewFields().includes(basicFields[i])) {
13496
-
13497
- if(!this.getEventHideFields().includes(basicFields[i])) {
13503
+ var clickEvent = new MouseEvent("click", {
13504
+ "view": window,
13505
+ "bubbles": true,
13506
+ "cancelable": false
13507
+ });
13508
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13498
13509
 
13499
- console.log('basicFields', event[basicFields[i]] + "");
13500
- if((event[basicFields[i]] + "").indexOf("[") >= 0) {
13501
- html += '<div class="m-20">';
13502
- html += '<div part="detail-head"><strong>'+basicFields[i]+'</strong></div>'
13503
- html += this.getEventTexts(basicFields[i], JSON.parse(event[basicFields[i]]), event).replace(/ *\([^)]*\) */g, "").trim();
13504
- html += '</div>';
13505
- } else {
13506
- html += '<div class="m-20">';
13507
- html += '<div part="detail-head"><strong>'+basicFields[i]+'</strong></div>'
13508
- html += '<sf-i-elastic-text text="'+(event[basicFields[i]] + "").replace(/"/g, "").replace(/ *\([^)]*\) */g, "").trim().split(';')[0]+'" minLength="80"></sf-i-elastic-text>';
13509
- html += '</div>';
13510
- }
13510
+ });
13511
13511
 
13512
- }
13513
- }
13512
+ if(this.mode == "consumer" || this.mode == "next") {
13514
13513
 
13515
- }
13514
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
13515
+ let buttonClick = ev.target as HTMLButtonElement
13516
+ buttonClick.innerHTML = "Saving..."
13517
+ const comments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approver-comments') as HTMLInputElement).value;
13518
+ const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
13519
+ if(approved == listEvent.approved){
13520
+ buttonClick.innerHTML = "Save"
13521
+ this.setError('Already Approved!');
13522
+ setTimeout(() => {
13523
+ this.clearMessages();
13524
+ }, 3000);
13525
+ return;
13526
+ }
13527
+ var clickEvent = new MouseEvent("click", {
13528
+ "view": window,
13529
+ "bubbles": true,
13530
+ "cancelable": false
13531
+ });
13532
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13533
+
13534
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
13535
+ let flagBulk = false;
13536
+ if(this.selectedItemIds.length <= 1) {
13537
+ console.log('mmddyyyy', mmddyyyy)
13538
+ if(await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")){
13539
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13540
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13541
+
13542
+ this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString()})
13543
+ this.events[mmdd][p].lastupdated = new Date().toString()
13544
+ }
13545
+ }
13546
+ if(this.recentlyReported[mmdd] == null){
13547
+ this.recentlyReported[mmdd] = []
13548
+ }
13549
+ this.recentlyReported[mmdd].push(listEvent)
13550
+ console.log('review single')
13551
+ }
13552
+ } else {
13553
+ let bulkBodyReview = []
13554
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13555
+
13556
+ const selectedId = this.selectedItemIds[k];
13557
+ //console.log('selectedid', selectedId);
13558
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
13559
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
13560
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13561
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13562
+
13563
+ //console.log(entityId, locationId, eventId, mmddyyyy);
13564
+ bulkBodyReview.push({
13565
+ "mmddyyyy": mmddyyyy,
13566
+ "projectid": this.projectId,
13567
+ "type": "review",
13568
+ "eventid": eventId,
13569
+ "comments": comments,
13570
+ "approved": approved,
13571
+ "entityid": entityId,
13572
+ "locationid": locationId,
13573
+ "username": this.userName,
13574
+ "userid": this.userProfileId,
13575
+ "userrole": this.myRole,
13576
+ "year": this.calendarStartYYYY,
13577
+ "module": listEvent.module ?? "events"
13578
+ })
13579
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
13580
+
13581
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
13582
+ // await this.sleep(2000);
13583
+ // this.clearMessages();
13584
+
13585
+ }
13586
+ await this.uploadReviewsBulk(bulkBodyReview);
13587
+
13588
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13589
+
13590
+ const selectedId = this.selectedItemIds[k];
13591
+ //console.log('selectedid', selectedId);
13592
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
13593
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
13594
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13595
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13596
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13597
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13598
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13599
+
13600
+ this.events[mmdd][p].isbulk = true
13601
+ flagBulk = true;
13602
+ if(this.recentlyReported[mmdd] == null){
13603
+ this.recentlyReported[mmdd] = []
13604
+ }
13605
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
13606
+ }
13607
+ }
13608
+ }
13609
+ console.log('review bulk')
13610
+ }
13611
+
13612
+ if(this.mode == "next"){
13613
+ // this.fetchNext(this.nextPage)
13614
+ this.renderRoleTabsNext(this.nextPage)
13615
+ }else{
13616
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
13617
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
13618
+ // } else
13619
+ if(this.getCurrentTab() == this.TAB_FIND) {
13620
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
13621
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
13622
+ } else {
13623
+ if(this.selectedItemIds.length > 0) {
13624
+ await this.fetchBulkReportingData();
13625
+ }
13626
+ this.renderAppropriateStream(this.sdate,this.edate, true, flagBulk);
13627
+ var clickEvent = new MouseEvent("click", {
13628
+ "view": window,
13629
+ "bubbles": true,
13630
+ "cancelable": false
13631
+ });
13632
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13633
+
13634
+ // if(currentColumnButton != null) {
13635
+ // currentColumnButton.click();
13636
+ // }
13637
+ }
13638
+ }
13639
+
13640
+ });
13641
+
13642
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
13643
+ let buttonClick = ev.target as HTMLButtonElement
13644
+ buttonClick.innerHTML = "Saving..."
13645
+ const comments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-auditor-comments') as HTMLInputElement).value;
13646
+ const approved = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked;
13647
+ if(approved == listEvent.approved){
13648
+ buttonClick.innerHTML = "Save"
13649
+ this.setError('Already Approved!');
13650
+ setTimeout(() => {
13651
+ this.clearMessages();
13652
+ }, 3000);
13653
+ return;
13654
+ }
13655
+ if(comments.trim().length === 0) {
13656
+ buttonClick.innerHTML = "Save"
13657
+ this.setError('Comments cannot be blank!');
13658
+ setTimeout(() => {
13659
+ this.clearMessages();
13660
+ }, 3000);
13661
+
13662
+ } else {
13663
+ let flagBulk = false;
13664
+ if(this.selectedItemIds.length <= 1) {
13665
+
13666
+ if(await this.uploadAudit(entityId, locationId, mmddyyyy, listEvent["id"], comments, approved, listEvent.module ?? "events")){
13667
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13668
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13669
+ this.events[mmdd][p].approved = approved
13670
+ this.events[mmdd][p].comments.push({'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString()})
13671
+ this.events[mmdd][p].lastupdated = new Date().toString()
13672
+ }
13673
+ }
13674
+ if(this.recentlyReported[mmdd] == null){
13675
+ this.recentlyReported[mmdd] = []
13676
+ }
13677
+ this.recentlyReported[mmdd].push(listEvent)
13678
+ }
13679
+ console.log('uploadaudit single')
13680
+ } else {
13681
+ let bulkBodyAudit = []
13682
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13683
+
13684
+ const selectedId = this.selectedItemIds[k];
13685
+ //console.log('selectedid', selectedId);
13686
+
13687
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
13688
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
13689
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13690
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13691
+
13692
+ //console.log(entityId, locationId, eventId, mmddyyyy);
13693
+ bulkBodyAudit.push({
13694
+ "mmddyyyy": mmddyyyy,
13695
+ "projectid": this.projectId,
13696
+ "type": "audit",
13697
+ "eventid": eventId,
13698
+ "comments": comments,
13699
+ "approved": approved,
13700
+ "entityid": entityId,
13701
+ "locationid": locationId,
13702
+ "username": this.userName,
13703
+ "userid": this.userProfileId,
13704
+ "userrole": this.myRole,
13705
+ "year": this.calendarStartYYYY,
13706
+ "module": listEvent.module ?? "events"
13707
+ })
13708
+ // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
13709
+
13710
+ }
13711
+
13712
+ await this.uploadAuditsBulk(bulkBodyAudit);
13713
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13714
+
13715
+ const selectedId = this.selectedItemIds[k];
13716
+ //console.log('selectedid', selectedId);
13717
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
13718
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
13719
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13720
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13721
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13722
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13723
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13724
+
13725
+ this.events[mmdd][p].isbulk = true
13726
+ flagBulk = true;
13727
+ if(this.recentlyReported[mmdd] == null){
13728
+ this.recentlyReported[mmdd] = []
13729
+ }
13730
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
13731
+ }
13732
+ }
13733
+ }
13734
+
13735
+ console.log('uploadAudit bulk')
13736
+
13737
+ }
13738
+
13739
+ var clickEvent = new MouseEvent("click", {
13740
+ "view": window,
13741
+ "bubbles": true,
13742
+ "cancelable": false
13743
+ });
13744
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13745
+ if(this.mode == "next"){
13746
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
13747
+ }else{
13748
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
13749
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
13750
+ // } else
13751
+ if(this.getCurrentTab() == this.TAB_FIND) {
13752
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
13753
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
13754
+ } else {
13755
+ if(this.selectedItemIds.length > 0) {
13756
+ await this.fetchBulkReportingData();
13757
+ }
13758
+ this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk);
13759
+ // if(currentColumnButton != null) {
13760
+ // currentColumnButton.click();
13761
+ // }
13762
+ }
13763
+ }
13764
+
13765
+ }
13766
+
13767
+
13768
+
13769
+ });
13770
+
13771
+ if(this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
13772
+
13773
+ if(approved) {
13774
+
13775
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
13776
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
13777
+ }
13778
+
13779
+
13780
+ } else {
13781
+
13782
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
13783
+
13784
+
13785
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
13786
+
13787
+ (this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev:any) => {
13788
+ let buttonClick = ev.target as HTMLButtonElement
13789
+ buttonClick.innerHTML = "Saving..."
13790
+ const reportercomments = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-comments') as HTMLInputElement).value;
13791
+
13792
+ //console.log('reporter comments 1', reportercomments);
13793
+
13794
+ const reporterdoc = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
13795
+ let docs:any[] = [];
13796
+
13797
+ //console.log('reporter comments 2', reportercomments);
13798
+
13799
+ // if(docsOptional.length === 0) {
13800
+ docs = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
13801
+ // }
13802
+
13803
+ //console.log('docs', docs);
13804
+ let reportformatvalues:string = "";
13805
+ let reportformatschema:string = "";
13806
+ if(this._SfReporting[0] != null){
13807
+ reportformatvalues = JSON.stringify((this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.selectedValues()) ?? "";
13808
+ reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
13809
+ }
13810
+
13811
+ let percentage: string = "100";
13812
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement) != null){
13813
+ percentage = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement).value
13814
+ }
13815
+ if(Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
13816
+
13817
+ //console.log('reporter comments 3', reportercomments);
13818
+ buttonClick.innerHTML = "Save"
13819
+ this.setError('Invalid Percentage!');
13820
+ setTimeout(() => {
13821
+ this.clearMessages();
13822
+ }, 3000);
13823
+
13824
+ } else {
13825
+ if(docs.length === 0 && docsOptional.length === 0) {
13826
+
13827
+ //console.log('reporter comments 3', reportercomments);
13828
+ buttonClick.innerHTML = "Save"
13829
+ this.setError('No documents uploaded!');
13830
+ setTimeout(() => {
13831
+ this.clearMessages();
13832
+ }, 3000);
13833
+
13834
+ } else {
13835
+
13836
+ //console.log('reporterdoc', reporterdoc);
13837
+
13838
+ if(reporterdoc.length === 0) {
13839
+ buttonClick.innerHTML = "Save"
13840
+ this.setError('Date of completion not selected!');
13841
+ setTimeout(() => {
13842
+ this.clearMessages();
13843
+ }, 3000);
13844
+
13845
+ } else if(parseInt(reporterdoc) > new Date().getTime()) {
13846
+ buttonClick.innerHTML = "Save"
13847
+ this.setError('Date of completion cannot be in future!');
13848
+ setTimeout(() => {
13849
+ this.clearMessages();
13850
+ }, 3000);
13851
+
13852
+ } else {
13853
+
13854
+ //console.log('makerscheckers 1', reportercomments);
13855
+
13856
+ if(reportercomments.trim().length === 0) {
13857
+ buttonClick.innerHTML = "Save"
13858
+ this.setError('Comments cannot be blank!');
13859
+ setTimeout(() => {
13860
+ this.clearMessages();
13861
+ }, 3000);
13862
+
13863
+ } else {
13864
+
13865
+
13866
+ var clickEvent = new MouseEvent("click", {
13867
+ "view": window,
13868
+ "bubbles": true,
13869
+ "cancelable": false
13870
+ });
13871
+
13872
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
13873
+ let flagBulk = false;
13874
+ if(this.selectedItemIds.length <= 1) {
13875
+
13876
+ if(await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, listEvent.module, percentage, makercheckers)){
13877
+ console.log('this.events', this.events);
13878
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13879
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13880
+ this.events[mmdd][p].documents = docs
13881
+ this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
13882
+ this.events[mmdd][p].lastupdated = new Date().toString()
13883
+ }
13884
+ }
13885
+ console.log('uploadReport single')
13886
+ if(makercheckers.length > 0) {
13887
+
13888
+ // await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
13889
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13890
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13891
+ this.events[mmdd][p].approved = true
13892
+ // this.events[mmdd][p].documents = docs
13893
+ this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
13894
+ this.events[mmdd][p].lastupdated = new Date().toString()
13895
+ }
13896
+ }
13897
+ console.log('upload report auto approve single')
13898
+ }
13899
+ if(this.recentlyReported[mmdd] == null){
13900
+ this.recentlyReported[mmdd] = []
13901
+ }
13902
+ this.recentlyReported[mmdd].push(listEvent)
13903
+ }
13904
+ } else {
13905
+ let bulkBody = []
13906
+ let bulkBodyReview = []
13907
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13908
+
13909
+ const selectedId = this.selectedItemIds[k];
13910
+ //console.log('selectedid', selectedId);
13911
+
13912
+ const makercheckersL = selectedId.split('-')[5];
13913
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
13914
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
13915
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13916
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13917
+
13918
+ //console.log(entityId, locationId, eventId, mmddyyyy);
13919
+
13920
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
13921
+ // if(parseInt(makercheckersL) > 0) {
13922
+ // bulkBodyReview.push({
13923
+ // "mmddyyyy": mmddyyyy,
13924
+ // "projectid": this.projectId,
13925
+ // "type": "report",
13926
+ // "eventid": eventId,
13927
+ // "comments": reportercomments,
13928
+ // "dateofcompletion": reporterdoc,
13929
+ // "percentage": percentage,
13930
+ // "entityid": entityId,
13931
+ // "locationid": locationId,
13932
+ // "event": null,
13933
+ // "docs": JSON.stringify(docs),
13934
+ // "approved": true,
13935
+ // "username": this.userName,
13936
+ // "reportformatvalues": reportformatvalues,
13937
+ // "reportformatschema": reportformatschema,
13938
+ // "userid": this.userProfileId,
13939
+ // "userrole": this.myRole,
13940
+ // "year": this.calendarStartYYYY,
13941
+ // "module": listEvent.module ?? "events"
13942
+ // } )
13943
+ // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
13944
+
13945
+ // }else{
13946
+ bulkBody.push({
13947
+ "mmddyyyy": mmddyyyy,
13948
+ "projectid": this.projectId,
13949
+ "type": "report",
13950
+ "eventid": eventId,
13951
+ "comments": reportercomments,
13952
+ "dateofcompletion": reporterdoc,
13953
+ "percentage": percentage,
13954
+ "entityid": entityId,
13955
+ "locationid": locationId,
13956
+ "event": null,
13957
+ "docs": JSON.stringify(docs),
13958
+ "username": this.userName,
13959
+ "reportformatvalues": reportformatvalues,
13960
+ "reportformatschema": reportformatschema,
13961
+ "userid": this.userProfileId,
13962
+ "userrole": this.myRole,
13963
+ "year": this.calendarStartYYYY,
13964
+ "module": listEvent.module ?? "events",
13965
+ "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
13966
+ })
13967
+ // }
13968
+
13969
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
13970
+ // await this.sleep(2000);
13971
+ // this.clearMessages();
13972
+
13973
+ }
13974
+
13975
+ // await this.uploadReportsBulk(bulkBody);
13976
+ // await this.fetchBulkReportingData();
13977
+ if(bulkBody.length > 0){
13978
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
13979
+ }
13980
+
13981
+ // if(bulkBodyReview.length > 0){
13982
+ // await this.uploadReportsReviewsBulk(bulkBodyReview)
13983
+ // }
13984
+ await this.fetchBulkReportingData();
13985
+ console.log('uploadReport bulk')
13986
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13987
+
13988
+ const selectedId = this.selectedItemIds[k];
13989
+ //console.log('selectedid', selectedId);
13990
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
13991
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
13992
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13993
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13994
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13995
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13996
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13997
+
13998
+ this.events[mmdd][p].isbulk = true
13999
+ flagBulk = true;
14000
+ if(this.recentlyReported[mmdd] == null){
14001
+ this.recentlyReported[mmdd] = []
14002
+ }
14003
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
14004
+ }
14005
+ }
14006
+ }
14007
+
14008
+ }
14009
+
14010
+ if(this.mode == "next"){
14011
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
14012
+ }else{
14013
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14014
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14015
+ // } else
14016
+ if(this.getCurrentTab() == this.TAB_FIND) {
14017
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
14018
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
14019
+ } else {
14020
+ if(this.selectedItemIds.length > 0) {
14021
+ await this.fetchBulkReportingData();
14022
+ }
14023
+ this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
14024
+ // if(currentColumnButton != null) {
14025
+ // currentColumnButton.click();
14026
+ // }
14027
+ }
14028
+ }
14029
+
14030
+ }
14031
+
14032
+
14033
+ }
14034
+ }
14035
+ }
14036
+ });
14037
+
14038
+ }
14039
+
14040
+ }
14041
+
14042
+ }
14043
+
14044
+ if(this._SfUploader[0] != null) {
14045
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
14046
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev: any) => {
14047
+ console.log('uploader analysisInProgress', _ev);
14048
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
14049
+ });
14050
+ this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev: any) => {
14051
+ console.log('uploader analysisInProgress', _ev);
14052
+ (this._SfDetailContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
14053
+ });
14054
+
14055
+
14056
+ //console.log('documentType checking', documentType);
14057
+
14058
+ if(documentType != null) {
14059
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = documentType;
14060
+ }
14061
+
14062
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify([]);
14063
+ console.log('uploader', (this._SfUploader[0].querySelector('#uploader') as SfIUploader));
14064
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
14065
+
14066
+ if(docs.length > 0) {
14067
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify(docs);
14068
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
14069
+ }
14070
+
14071
+ if(this.myRole == this.TAB_APPROVER || approved) {
14072
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = true;
14073
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
14074
+ } else {
14075
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = false;
14076
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
14077
+ }
14078
+
14079
+ const dataPassthrough = {
14080
+ projectId: this.projectId,
14081
+ countryId: this.countryId,
14082
+ entityId: listEvent.entityid,
14083
+ locationId: listEvent.locationid,
14084
+ mmddyyyy: mmddyyyy,
14085
+ complianceId: listEvent['id'],
14086
+ path: "uploadextract"
14087
+ };
14088
+
14089
+ const callbackUrlHost = "8icpy39ru0.execute-api.us-east-1.amazonaws.com";
14090
+ const callbackUrlPath = "test/uploadextract";
14091
+
14092
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.projectId = this.projectId;
14093
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.dataPassthrough = JSON.stringify(dataPassthrough);
14094
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlHost = callbackUrlHost;
14095
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlPath = callbackUrlPath;
14096
+ (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
14097
+
14098
+ }
14099
+
14100
+
14101
+
14102
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
14103
+ if(this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
14104
+ //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
14105
+ if(listEvent["approved"] != null) {
14106
+ if(listEvent["approved"] === true) {
14107
+ //console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
14108
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
14109
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
14110
+ }
14111
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
14112
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = false;
14113
+ }
14114
+ } else {
14115
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement) != null) {
14116
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
14117
+ }
14118
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
14119
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
14120
+ }
14121
+ }
14122
+ } else {
14123
+ if((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement != null) {
14124
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
14125
+ }
14126
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement) != null) {
14127
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-approve-no') as HTMLInputElement).checked = true;
14128
+ }
14129
+
14130
+ }
14131
+ }
14132
+
14133
+ }
14134
+ }
14135
+
14136
+ fetchEventDetails = async (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement, flagUploadGuidance: boolean = false, listEventContainer: HTMLDivElement | null = null) => {
14137
+ console.log('listEvent', listEvent, listEvent.id)
14138
+ let url = "https://"+this.apiId+"/getalleventdetails";
14139
+
14140
+ //console.log('fetch calendar url', url);
14141
+ let urlBody :any = {"projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "eventid": listEvent.id, "entityid": listEvent.entityid, "locationid": listEvent.locationid, "mmddyyyy": mmddyyyy, "year": this.getFinancialYear(mmddyyyy)};
14142
+
14143
+ //console.log('urlbody', urlBody);
14144
+
14145
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
14146
+ const xhr : any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
14147
+ this._SfLoader.innerHTML = '';
14148
+ if(xhr.status == 200) {
14149
+
14150
+ const jsonRespose = JSON.parse(xhr.responseText);
14151
+ console.log('jsonRespose', jsonRespose);
14152
+ if(flagUploadGuidance){
14153
+ if(listEventContainer != null){
14154
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14155
+ if(this.events[mmdd] != null){
14156
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
14157
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == listEvent.locationid && this.events[mmdd][p].entityid == listEvent.entityid){
14158
+ this.events[mmdd][p].uploadguidance = jsonRespose.data.uploadguidance
14159
+ }
14160
+ }
14161
+ }
14162
+ this.renderListReporting(listEventContainer, jsonRespose.data, mmddyyyy, eventsContainer)
14163
+ }
14164
+ }else{
14165
+ this.renderEventDetail(jsonRespose.data,mmddyyyy, currentColumnButton, eventsContainer);
14166
+ }
14167
+
14168
+ } else {
14169
+ if(xhr.status == 401){
14170
+ let changeEvent = new CustomEvent('tokenExpired',{bubbles:true});
14171
+ this.dispatchEvent(changeEvent);
14172
+ }
14173
+ if(xhr.status === 404) {
14174
+
14175
+ this.showChosenProject();
14176
+ (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
14177
+ this.renderChosenProject();
14178
+
14179
+ } else {
14180
+ const jsonRespose = JSON.parse(xhr.responseText);
14181
+ this.setError(jsonRespose.error);
14182
+ }
14183
+
14184
+ }
14185
+ }
14186
+
14187
+ renderEventDetail = (event: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement) => {
14188
+ console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
14189
+
14190
+ let comments, docs, approved, /*dateOfCompletion,*/ makercheckers: Array<string>, docsOptional, documentType;
14191
+ let entityId: string = "";
14192
+ let locationId: string = "";
14193
+ let statuteName: string = "";
14194
+ let reportformatName: string = "";
14195
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14196
+ entityId = event.entityid;
14197
+ locationId = event.locationid;
14198
+ // let completeness = this.getCompletenessStatus(event);
14199
+ comments = event['comments'] == null ? [] : (event['comments']);
14200
+ docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
14201
+ approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
14202
+ // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
14203
+ makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
14204
+ docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
14205
+ documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
14206
+
14207
+ statuteName = event['statute'][0].trim();
14208
+ if(event['reportformat'] != null){
14209
+ reportformatName = (event['reportformat'][0] ?? "").trim().replace('&amp;','&');
14210
+ }
14211
+
14212
+ console.log('event detail', event, statuteName);
14213
+ //console.log('event detail comments', comments);
14214
+ //console.log('event dateofcompletion', dateOfCompletion);
14215
+ //console.log('event detail documenttype', documentType);
14216
+ const basicFields = ['id', 'shortid', 'entityname', 'locationname','functions'];
14217
+ const statuteFields = ['jurisdiction', 'country', 'state', 'category', 'subcategory', 'statute'];
14218
+ const complianceFields = ['specificity', 'reference', 'obligation', 'penalty', 'authority', 'frequency', 'subfrequency', 'obligationtype', 'duedate', 'applicability', 'form', 'additionalurls', 'adhocquestion', 'adhocquestionschedule', 'adhocinstances', 'uploadguidance', 'attachment'];
14219
+ const grcFields = ['internalcontrols', 'firstlineofdefence', 'secondlineofdefence', 'thirdlineofdefence', 'risk', 'riskarea'];
14220
+
14221
+ let listReportingContainers = eventsContainer.querySelectorAll('.list-reporting-container') as NodeListOf<HTMLDivElement>
14222
+ for(let tempReportingContainer of listReportingContainers){
14223
+ tempReportingContainer.style.display = 'none';
14224
+ tempReportingContainer.innerHTML = '';
14225
+ }
14226
+ let buttonListReportings = eventsContainer.querySelectorAll('.button-list-reporting') as NodeListOf<HTMLButtonElement>
14227
+ for(let buttonListReporting of buttonListReportings){
14228
+ buttonListReporting.setAttribute('part','button-list-reporting')
14229
+ }
14230
+ let streamEventTitles = eventsContainer.querySelectorAll('.stream-event-title') as NodeListOf<SfIElasticText>
14231
+ for(let streamEventTitle of streamEventTitles){
14232
+ streamEventTitle.removeAttribute('part')
14233
+ }
14234
+ var html = `
14235
+
14236
+ <div part="compliance-detail-title" class="d-flex justify-between">
14237
+ <button part="button-icon" class="material-icons invisible">close</button>
14238
+ <h3 part="results-title" class="m-0">Compliance Details</h3>
14239
+ <button id="button-detail-close" part="button-icon" class="material-icons">close</button>
14240
+ </div>
14241
+
14242
+ `;
14243
+
14244
+ if(this.selectedItemIds.length > 1) {
14245
+
14246
+ html += `
14247
+
14248
+ <div class="d-flex justify-between m-20">
14249
+ <h4 class="m-0">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
14250
+ </div>
14251
+
14252
+ `;
14253
+
14254
+ }
14255
+
14256
+ html += '<div class="accordian-container m-20 pb-20" part="accordian-container">';
14257
+
14258
+ html += '<div part="detail-summary">';
14259
+ html += ('<div part="detail-summary-title" class="pl-20 pr-20"><h1>'+event['obligationtitle']+'</h1></div>');
14260
+ html += ('<div part="detail-summary-subtitle" class="pl-20 pr-20"><h3>'+event['obligation'].replace(/\n/g,'<br />')+'</h3></div>');
14261
+ html += ('<div part="detail-summary-content" class="pl-20 pr-20">'+('<sf-i-elastic-text text="'+(event['internalcontrols'] + "").replace(/"/g, "").replace(/\n/g,'<br />')+'" minLength="80"></sf-i-elastic-text>')+'</div>');
14262
+ html += '</div>';
14263
+
14264
+ html += '<br />';
14265
+
14266
+ html += '<div class="accordian-section section-basic pl-20 pr-20" part="accordian-section">';
14267
+ html += '<div class="d-flex justify-between accordian-head head-basic cursor" part="accordian-head">';
14268
+ html += '<h3>Basic Information</h3>'
14269
+ html += '<h3 class="head-indicator-basic">-</h3>'
14270
+ html += '</div>';
14271
+ html += '<div class="d-flex flex-wrap accordian-body body-basic" part="accordian-body">';
14272
+
14273
+ for(var i = 0; i < basicFields.length; i++) {
14274
+
14275
+ if(!this.getEventPreviewFields().includes(basicFields[i])) {
14276
+
14277
+ if(!this.getEventHideFields().includes(basicFields[i])) {
14278
+
14279
+ console.log('basicFields', event[basicFields[i]] + "");
14280
+ if((event[basicFields[i]] + "").indexOf("[") >= 0) {
14281
+ html += '<div class="m-20">';
14282
+ html += '<div part="detail-head"><strong>'+basicFields[i]+'</strong></div>'
14283
+ html += this.getEventTexts(basicFields[i], JSON.parse(event[basicFields[i]]), event).replace(/ *\([^)]*\) */g, "").trim();
14284
+ html += '</div>';
14285
+ } else {
14286
+ html += '<div class="m-20">';
14287
+ html += '<div part="detail-head"><strong>'+basicFields[i]+'</strong></div>'
14288
+ html += '<sf-i-elastic-text text="'+(event[basicFields[i]] + "").replace(/"/g, "").replace(/ *\([^)]*\) */g, "").trim().split(';')[0]+'" minLength="80"></sf-i-elastic-text>';
14289
+ html += '</div>';
14290
+ }
14291
+
14292
+ }
14293
+ }
14294
+
14295
+ }
13516
14296
 
13517
14297
  if(this.mode == "consumer") {
13518
14298
  if(approved) {
@@ -13837,7 +14617,7 @@ export class SfIEvents extends LitElement {
13837
14617
  });
13838
14618
  (this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
13839
14619
  if(this.selectedItemIds.length <= 1) {
13840
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
14620
+ await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
13841
14621
  this.setSuccess('Auto-Approved successfully!')
13842
14622
  setTimeout(() => {
13843
14623
  this.clearMessages()
@@ -13867,7 +14647,7 @@ export class SfIEvents extends LitElement {
13867
14647
  "userid": this.userProfileId,
13868
14648
  "userrole": this.myRole,
13869
14649
  "year": this.calendarStartYYYY,
13870
- "module": event.isnotice != null ? "notices" : "events"
14650
+ "module": event.module ?? "events"
13871
14651
  })
13872
14652
  }
13873
14653
  await this.uploadReviewsBulk(bulkBodyReview);
@@ -14086,7 +14866,7 @@ export class SfIEvents extends LitElement {
14086
14866
  let flagBulk = false;
14087
14867
  if(this.selectedItemIds.length <= 1) {
14088
14868
  // console.log('mmddyyyy', mmddyyyy)
14089
- if(await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")){
14869
+ if(await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.module ?? "events")){
14090
14870
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
14091
14871
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14092
14872
 
@@ -14124,7 +14904,7 @@ export class SfIEvents extends LitElement {
14124
14904
  "userid": this.userProfileId,
14125
14905
  "userrole": this.myRole,
14126
14906
  "year": this.calendarStartYYYY,
14127
- "module": event.isnotice != null ? "notices" : "events"
14907
+ "module": event.module ?? "events"
14128
14908
  })
14129
14909
  // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, comments, approved)
14130
14910
 
@@ -14218,7 +14998,7 @@ export class SfIEvents extends LitElement {
14218
14998
  let flagBulk = false;
14219
14999
  if(this.selectedItemIds.length <= 1) {
14220
15000
 
14221
- if(await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.isnotice != null ? "notices" : "events")){
15001
+ if(await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, event.module ?? "events")){
14222
15002
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
14223
15003
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14224
15004
  this.events[mmdd][p].approved = approved
@@ -14257,7 +15037,7 @@ export class SfIEvents extends LitElement {
14257
15037
  "userid": this.userProfileId,
14258
15038
  "userrole": this.myRole,
14259
15039
  "year": this.calendarStartYYYY,
14260
- "module": event.isnotice != null ? "notices" : "events"
15040
+ "module": event.module ?? "events"
14261
15041
  })
14262
15042
  // await this.uploadAudit(entityId, locationId, mmddyyyy, eventId, comments, approved);
14263
15043
 
@@ -14428,7 +15208,7 @@ export class SfIEvents extends LitElement {
14428
15208
  //console.log('makerscheckers', makercheckers, reportercomments);
14429
15209
  // console.log('reportformatvalues', reportformatvalues)
14430
15210
  // console.log('reportformatschema',reportformatschema)
14431
- if(await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage, makercheckers)){
15211
+ if(await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "events", percentage, makercheckers)){
14432
15212
  console.log('this.events', this.events);
14433
15213
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
14434
15214
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
@@ -14439,7 +15219,7 @@ export class SfIEvents extends LitElement {
14439
15219
  }
14440
15220
  if(makercheckers.length > 0) {
14441
15221
 
14442
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
15222
+ // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "events");
14443
15223
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
14444
15224
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14445
15225
  this.events[mmdd][p].approved = true
@@ -14486,7 +15266,7 @@ export class SfIEvents extends LitElement {
14486
15266
  // "userid": this.userProfileId,
14487
15267
  // "userrole": this.myRole,
14488
15268
  // "year": this.calendarStartYYYY,
14489
- // "module": event.isnotice != null ? "notices" : "events"
15269
+ // "module": event.module ?? "events"
14490
15270
  // })
14491
15271
  // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
14492
15272
  // if(parseInt(makercheckersL) > 0) {
@@ -14509,7 +15289,7 @@ export class SfIEvents extends LitElement {
14509
15289
  // "userid": this.userProfileId,
14510
15290
  // "userrole": this.myRole,
14511
15291
  // "year": this.calendarStartYYYY,
14512
- // "module": event.isnotice != null ? "notices" : "events"
15292
+ // "module": event.module ?? "events"
14513
15293
  // } )
14514
15294
  // // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
14515
15295
 
@@ -14532,7 +15312,7 @@ export class SfIEvents extends LitElement {
14532
15312
  "userid": this.userProfileId,
14533
15313
  "userrole": this.myRole,
14534
15314
  "year": this.calendarStartYYYY,
14535
- "module": event.isnotice != null ? "notices" : "events",
15315
+ "module": event.module ?? "events",
14536
15316
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
14537
15317
  })
14538
15318
  // }
@@ -22607,7 +23387,7 @@ export class SfIEvents extends LitElement {
22607
23387
  }
22608
23388
 
22609
23389
  uploadAudit = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any, module: string = "events") => {
22610
- let url = "https://"+this.apiId+"/uploadaudit";
23390
+ let url = "https://"+this.apiId+"/uploadaudit1";
22611
23391
 
22612
23392
  const body = {
22613
23393
  "mmddyyyy": mmddyyyy,
@@ -22677,7 +23457,7 @@ export class SfIEvents extends LitElement {
22677
23457
  }
22678
23458
 
22679
23459
  uploadReview = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, approved: any, module: string = "events") => {
22680
- let url = "https://"+this.apiId+"/uploadreview";
23460
+ let url = "https://"+this.apiId+"/uploadreview1";
22681
23461
 
22682
23462
  const body = {
22683
23463
  "mmddyyyy": mmddyyyy,
@@ -22777,7 +23557,7 @@ export class SfIEvents extends LitElement {
22777
23557
  }
22778
23558
 
22779
23559
  uploadReport = async (entityId: string, locationId: string, mmddyyyy: string, eventid: string, comments: string, doc: string, docs: any, event: any, reportformatvalues: string = "", reportformatschema: string = "", module: string = "events", percentage: string = "100", makercheckers: any) => {
22780
- let url = "https://"+this.apiId+"/uploadreport";
23560
+ let url = "https://"+this.apiId+"/uploadreport1";
22781
23561
 
22782
23562
  let body = {
22783
23563
  "mmddyyyy": mmddyyyy,
@@ -24361,6 +25141,8 @@ export class SfIEvents extends LitElement {
24361
25141
  this.fetchAndYearlyRenderUserCalendar_2(startDate, endDate, searchString, list, month, year)
24362
25142
  }else if(this.selectedFeatures.indexOf('notices') >= 0){
24363
25143
  this.fetchAndRenderNotices(startDate, endDate, searchString, list, month, year);
25144
+ }else if(this.selectedFeatures.indexOf('agreements') >= 0){
25145
+ this.fetchAndRenderAgreements(startDate, endDate, searchString, list, month, year);
24364
25146
  }
24365
25147
  }
24366
25148
  fetchAndYearlyRenderUserCalendar_2 = async(startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
@@ -24581,6 +25363,85 @@ export class SfIEvents extends LitElement {
24581
25363
  }
24582
25364
 
24583
25365
  }
25366
+
25367
+ fetchAndRenderAgreements = async(startDate: string = "", endDate: string = "", searchString: string = "", list: string = "yes", month: string = "00", year: string = this.calendarStartYYYY) => {
25368
+
25369
+ let path = "", view = "";
25370
+ this.sdate = startDate;
25371
+ this.edate = endDate;
25372
+ if(this.tagId != null && this.tagId != "") {
25373
+ view = "tag";
25374
+ } else if(this.countryId != null && this.countryId != "") {
25375
+ view = "country";
25376
+ } else if(this.locationId != null && this.locationId != "") {
25377
+ view = "location";
25378
+ } else {
25379
+ view = "entity";
25380
+ }
25381
+
25382
+ path = "getallcountryobjects";
25383
+
25384
+ let sDate = "";
25385
+ let eDate = "";
25386
+
25387
+ //console.log('currenttab', this.getCurrentTab());
25388
+
25389
+ if(this.getCurrentTab() == this.TAB_YEAR) {
25390
+ sDate = "03/31/" + this.calendarStartYYYY;
25391
+ eDate = "04/01/" + (parseInt(this.calendarStartYYYY) + 1);
25392
+ } else {
25393
+ sDate = startDate;
25394
+ eDate = endDate;
25395
+ }
25396
+
25397
+
25398
+ let url = "https://"+this.apiIdAgreements+"/"+ path;
25399
+
25400
+ //console.log('fetch calendar url', url);
25401
+ let urlBody :any = {"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};
25402
+
25403
+ if(searchString.length > 0) {
25404
+ urlBody["searchstring"] = searchString;
25405
+ }
25406
+
25407
+ //console.log('urlbody', urlBody);
25408
+
25409
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25410
+ const xhr : any = (await this.prepareXhr(urlBody, url, this._SfLoader, authorization, 'Preparing')) as any;
25411
+ this._SfLoader.innerHTML = '';
25412
+ if(xhr.status == 200) {
25413
+
25414
+ const jsonRespose = JSON.parse(xhr.responseText);
25415
+ console.log('jsonRespose', jsonRespose);
25416
+ let agreements = (await this.fetchPresignedUrl(jsonRespose.signedUrlGet));
25417
+ await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
25418
+ this.lastupdated = Util.getDateTimeStrings(new Date().getTime())
25419
+ let tempEvents = this.events
25420
+ for(let mmddyyyy of Object.keys(agreements)){
25421
+ tempEvents[mmddyyyy] = [...(tempEvents[mmddyyyy] ?? []),...agreements[mmddyyyy]]
25422
+ }
25423
+ this.events = tempEvents;
25424
+ this.renderAppropriateStream(this.sdate,this.edate,true);
25425
+ console.log('agreements', agreements, tempEvents);
25426
+ } else {
25427
+ if(xhr.status == 401){
25428
+ let changeEvent = new CustomEvent('tokenExpired',{bubbles:true});
25429
+ this.dispatchEvent(changeEvent);
25430
+ }
25431
+ if(xhr.status === 404) {
25432
+
25433
+ this.showChosenProject();
25434
+ (this._SfTitleChosenProject as HTMLElement).innerHTML = (this._SfProject[0].querySelector('#sf-i-project') as SfIForm).selectedTexts()[0];
25435
+ this.renderChosenProject();
25436
+
25437
+ } else {
25438
+ const jsonRespose = JSON.parse(xhr.responseText);
25439
+ this.setError(jsonRespose.error);
25440
+ }
25441
+
25442
+ }
25443
+
25444
+ }
24584
25445
 
24585
25446
  fetchStatistics = async(startDate: string = "", endDate: string = "", filtercriteria: string, filterid: string, subfiltercriteria: string, subfilterid: string) => {
24586
25447
 
@@ -24609,6 +25470,8 @@ export class SfIEvents extends LitElement {
24609
25470
  url = "https://"+this.apiId+"/"+ path;
24610
25471
  }else if(this.selectedFeatures.indexOf('notices') >= 0){
24611
25472
  url = "https://"+this.apiIdNotices+"/"+ path;
25473
+ }else if(this.selectedFeatures.indexOf('agreements') >= 0){
25474
+ url = "https://"+this.apiIdAgreements+"/"+ path;
24612
25475
  }
24613
25476
 
24614
25477
  //console.log('fetch calendar url', url);