sf-i-events 1.0.803 → 1.0.805

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.
@@ -116,6 +116,8 @@ export class SfIEvents extends LitElement {
116
116
  COLOR_NOT_COMPLIED = "#C80036";
117
117
  COLOR_PARTIALLY_COMPLIED = "#F79256";
118
118
  COLOR_COMPLIED = "#50cf01";
119
+ COLOR_COMPLIED_WITH_GAPS = "#ffe505";
120
+ COLOR_REPORTED_NON_COMPLIANCE = "#840B0F";
119
121
  STATUS_NOT_STARTED = "not-started";
120
122
  STATUS_PENDING_APPROVAL = "pending-approval";
121
123
  STATUS_REJECTED = "rejected";
@@ -431,6 +433,12 @@ export class SfIEvents extends LitElement {
431
433
  .color-complied {
432
434
  color: #50cf01;
433
435
  }
436
+ .color-complied-with-gaps {
437
+ color: #ffe505;
438
+ }
439
+ .color-reported-non-compliance {
440
+ color: #840B0F;
441
+ }
434
442
  .color-scheduled {
435
443
  color: #888888;
436
444
  }
@@ -637,6 +645,12 @@ export class SfIEvents extends LitElement {
637
645
  .color-complied {
638
646
  color: #50cf01;
639
647
  }
648
+ .color-complied-with-gaps {
649
+ color: #ffe505;
650
+ }
651
+ .color-reported-non-compliance {
652
+ color: #840B0F;
653
+ }
640
654
  .color-scheduled {
641
655
  color: #888888;
642
656
  }
@@ -2121,6 +2135,12 @@ export class SfIEvents extends LitElement {
2121
2135
  .color-complied {
2122
2136
  color: #50cf01;
2123
2137
  }
2138
+ .color-complied-with-gaps {
2139
+ color: #ffe505;
2140
+ }
2141
+ .color-reported-non-compliance {
2142
+ color: #840B0F;
2143
+ }
2124
2144
  .color-scheduled {
2125
2145
  color: #888888;
2126
2146
  }
@@ -3896,6 +3916,12 @@ export class SfIEvents extends LitElement {
3896
3916
  if(arrComplianceData[name]["complied"] == null) {
3897
3917
  arrComplianceData[name]["complied"] = 0;
3898
3918
  }
3919
+ if(arrComplianceData[name]["complied-with-gaps"] == null) {
3920
+ arrComplianceData[name]["complied-with-gaps"] = 0;
3921
+ }
3922
+ if(arrComplianceData[name]["reported-non-compliance"] == null) {
3923
+ arrComplianceData[name]["reported-non-compliance"] = 0;
3924
+ }
3899
3925
 
3900
3926
  arrComplianceData[name][complianceStatus]++;
3901
3927
 
@@ -4190,7 +4216,7 @@ export class SfIEvents extends LitElement {
4190
4216
 
4191
4217
  }
4192
4218
 
4193
- getComplianceStatus = (completeness: string, timeliness: string) => {
4219
+ getComplianceStatus = (completeness: string, timeliness: string, percentage?: string) => {
4194
4220
 
4195
4221
  if(completeness == "not-started") {
4196
4222
 
@@ -4221,7 +4247,14 @@ export class SfIEvents extends LitElement {
4221
4247
  } else {
4222
4248
 
4223
4249
  if(timeliness == "in-time" || timeliness == "late-reported" || timeliness == "late-approved") {
4224
- return "complied";
4250
+ if(percentage != null && parseInt(percentage) == 0){
4251
+ console.log('reported non compliance')
4252
+ return "reported-non-compliance"
4253
+ }else if(percentage != null && parseInt(percentage) < 100){
4254
+ return "complied-with-gaps"
4255
+ }else{
4256
+ return "complied";
4257
+ }
4225
4258
  } else {
4226
4259
  return "not-complied";
4227
4260
  }
@@ -4406,6 +4439,8 @@ export class SfIEvents extends LitElement {
4406
4439
  html += '<div part="badge-dashboard" id="chip-compliance-1" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-icons color-not-complied">disabled_by_default</span>&nbsp;&nbsp;<span>Not Complied:</span>&nbsp;<span id="graph-not-complied">DASHBOARD_NOT_COMPLIED</span></div>';
4407
4440
  html += '<div part="badge-dashboard" id="chip-compliance-2" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-icons color-partially-complied">rule</span>&nbsp;&nbsp;<span>Partially Complied:</span>&nbsp;<span id="graph-partially-complied">DASHBOARD_PARTIALLY_COMPLIED</span></div>';
4408
4441
  html += '<div part="badge-dashboard" id="chip-compliance-3" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-complied">sweep</span>&nbsp;&nbsp;<span>Complied:</span>&nbsp;<span id="graph-complied">DASHBOARD_COMPLIED</span></div>';
4442
+ html += '<div part="badge-dashboard" id="chip-compliance-4" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-complied-with-gaps">rule</span>&nbsp;&nbsp;<span>Complied With Gaps:</span>&nbsp;<span id="graph-complied-with-gaps">DASHBOARD_COMPLIED_WITH_GAPS</span></div>';
4443
+ html += '<div part="badge-dashboard" id="chip-compliance-5" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-reported-non-compliance">rule</span>&nbsp;&nbsp;<span>Reported Non Compliance:</span>&nbsp;<span id="graph-reported-non-compliance">DASHBOARD_REPORTED_NON_COMPLIANCE</span></div>';
4409
4444
  html += '</div>';
4410
4445
 
4411
4446
  html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
@@ -4433,6 +4468,8 @@ export class SfIEvents extends LitElement {
4433
4468
  html += '<div part="badge-dashboard" id="chip-compliance-1" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-icons color-not-complied">disabled_by_default</span>&nbsp;&nbsp;<span>Not Complied:</span>&nbsp;<span id="graph-not-complied">DASHBOARD_NOT_COMPLIED</span></div>';
4434
4469
  html += '<div part="badge-dashboard" id="chip-compliance-2" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-icons color-partially-complied">rule</span>&nbsp;&nbsp;<span>Partially Complied:</span>&nbsp;<span id="graph-partially-complied">DASHBOARD_PARTIALLY_COMPLIED</span></div>';
4435
4470
  html += '<div part="badge-dashboard" id="chip-compliance-3" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-complied">sweep</span>&nbsp;&nbsp;<span>Complied:</span>&nbsp;<span id="graph-complied">DASHBOARD_COMPLIED</span></div>';
4471
+ html += '<div part="badge-dashboard" id="chip-compliance-4" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-complied-with-gaps">rule</span>&nbsp;&nbsp;<span>Complied With Gaps:</span>&nbsp;<span id="graph-complied-with-gaps">DASHBOARD_COMPLIED_WITH_GAPS</span></div>';
4472
+ html += '<div part="badge-dashboard" id="chip-compliance-5" class="chip stat-compliance justify-center align-center mr-10 mb-10 no-shrink compliance-statuses"><span class="material-symbols-outlined color-reported-non-compliance">rule</span>&nbsp;&nbsp;<span>Reported Non Compliance:</span>&nbsp;<span id="graph-reported-non-compliance">DASHBOARD_REPORTED_NON_COMPLIANCE</span></div>';
4436
4473
  html += '</div>';
4437
4474
 
4438
4475
  html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
@@ -4826,6 +4863,8 @@ export class SfIEvents extends LitElement {
4826
4863
  html += (complianceStatus == "not-complied" ? '<span class="material-symbols-outlined color-not-complied color-not-complied-item color-not-complied-item-'+i+'">disabled_by_default</span>' : '');
4827
4864
  html += (complianceStatus == "partially-complied" ? '<span class="material-symbols-outlined color-partially-complied color-partially-complied-item color-partially-complied-item-'+i+'">rule</span>' : '');
4828
4865
  html += (complianceStatus == "complied" ? '<span class="material-symbols-outlined color-complied color-complied-item color-complied-item-'+i+'">sweep</span>' : '');
4866
+ html += (complianceStatus == "complied-with-gaps" ? '<span class="material-symbols-outlined color-complied-with-gaps color-complied-with-gaps-item color-complied-with-gaps-item-'+i+'">rule</span>' : '');
4867
+ html += (complianceStatus == "reported-non-compliance" ? '<span class="material-symbols-outlined color-reported-non-compliance color-reported-non-compliance-item color-reported-non-compliance-item-'+i+'">rule</span>' : '');
4829
4868
 
4830
4869
  html += (partStatus == "not-started" ? '<span class="material-symbols-outlined color-not-started color-not-started-item color-not-started-item-'+i+'">schedule</span>' : '');
4831
4870
  html += (partStatus == "pending-approval" ? '<span class="material-symbols-outlined color-pending color-pending-item color-pending-item-'+i+'">pending</span>' : '');
@@ -4899,7 +4938,7 @@ export class SfIEvents extends LitElement {
4899
4938
  }
4900
4939
 
4901
4940
  renderEvents = (_firstDay: any, _endDay: any, iInit: number, iLast: number, showGraph: boolean, index: number, month: number, period: string, firstDate: any = null, parametersTitle: string, showBackgroundButton: boolean) => {
4902
- var total = 0, notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0, inTime = 0, pastDueDate = 0, lateExecuted = 0, lateApproved = 0, lateReported = 0, scheduled = 0, partiallyComplied = 0, notComplied = 0, complied = 0;
4941
+ var total = 0, notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0, inTime = 0, pastDueDate = 0, lateExecuted = 0, lateApproved = 0, lateReported = 0, scheduled = 0, partiallyComplied = 0, notComplied = 0, complied = 0, compliedWithGaps = 0, reportedNonCompliance = 0;
4903
4942
  var html = '';
4904
4943
  this.selectedItemIds = [];
4905
4944
  this.selectedItems = [];
@@ -4973,7 +5012,7 @@ export class SfIEvents extends LitElement {
4973
5012
 
4974
5013
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(this.events[mmdd][j])));
4975
5014
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(this.events[mmdd][j])), partStatus);
4976
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
5015
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(this.events[mmdd][j])).percentage);
4977
5016
  if(this.flowGraph == this.FLOW_GRAPH_TIMELINESS){
4978
5017
  bgStatus += lateStatus
4979
5018
  }else if(this.flowGraph == this.FLOW_GRAPH_COMPLIANCE){
@@ -4997,6 +5036,8 @@ export class SfIEvents extends LitElement {
4997
5036
  partiallyComplied = partiallyComplied + (complianceStatus == "partially-complied" ? 1 : 0);
4998
5037
  notComplied = notComplied + (complianceStatus == "not-complied" ? 1 : 0);
4999
5038
  complied = complied + (complianceStatus == "complied" ? 1 : 0);
5039
+ compliedWithGaps = compliedWithGaps + (complianceStatus == "complied-with-gaps" ? 1 : 0);
5040
+ reportedNonCompliance = reportedNonCompliance + (complianceStatus == "reported-non-compliance" ? 1 : 0);
5000
5041
 
5001
5042
  this.events[mmdd][j][this.FLOW_GRAPH_COMPLETENESS] = partStatus;
5002
5043
  this.events[mmdd][j][this.FLOW_GRAPH_TIMELINESS] = lateStatus;
@@ -5137,9 +5178,11 @@ export class SfIEvents extends LitElement {
5137
5178
  html = html.replace("DASHBOARD_NOT_COMPLIED", notComplied+"");
5138
5179
  html = html.replace("DASHBOARD_PARTIALLY_COMPLIED", partiallyComplied+"");
5139
5180
  html = html.replace("DASHBOARD_COMPLIED", complied+"");
5181
+ html = html.replace("DASHBOARD_COMPLIED_WITH_GAPS", compliedWithGaps+"");
5182
+ html = html.replace("DASHBOARD_REPORTED_NON_COMPLIANCE", reportedNonCompliance+"");
5140
5183
 
5141
- this.csvDataStats = 'Period,Total,Not Started,Approved,Pending Approval,Rejected,Past Due Date,Late Reported,Late Executed,Late Approved,Scheduled,Not Complied,Partially Complied,Complied\n';
5142
- this.csvDataStats += this.period + "," + total + "," + notStarted + "," + approved + "," + pendingApproval + "," + rejected + "," + pastDueDate + "," + lateReported + "," + lateExecuted + "," + lateApproved + "," + scheduled + "," + notComplied + "," + partiallyComplied + "," + complied;
5184
+ this.csvDataStats = 'Period,Total,Not Started,Approved,Pending Approval,Rejected,Past Due Date,Late Reported,Late Executed,Late Approved,Scheduled,Not Complied,Partially Complied,Complied,Complied With Gaps,Reported Non Compliance\n';
5185
+ this.csvDataStats += this.period + "," + total + "," + notStarted + "," + approved + "," + pendingApproval + "," + rejected + "," + pastDueDate + "," + lateReported + "," + lateExecuted + "," + lateApproved + "," + scheduled + "," + notComplied + "," + partiallyComplied + "," + complied+ "," + compliedWithGaps+ "," + reportedNonCompliance;
5143
5186
 
5144
5187
  this.htmlDataStats = 'Completeness<br /><br /><table class="w-100"><tr><th class="w-14">Total</th><th class="w-14">Not Started</th><th class="w-14">Approved</th><th class="w-14">Pending Approval</th><th class="w-14">Rejected</th><tr>';
5145
5188
  this.htmlDataStats += '<tr><td class="w-14 text-center td-odd">'+total+'</td><td class="w-14 text-center td-odd">'+notStarted+'</td><td class="w-14 text-center td-odd">'+approved+'</td><td class="w-14 text-center td-odd">'+pendingApproval+'</td><td class="w-14 text-center td-odd">'+rejected+'</td></table>'
@@ -5147,8 +5190,8 @@ export class SfIEvents extends LitElement {
5147
5190
  this.htmlDataStats += '<br /><br />Timeliness<br /><br /><table class="mt-20 w-100"><tr><th class="w-14">Total</th><th class="w-14">In Time</th><th class="w-14">Past Due Date</th><th class="w-14">Late Reported</th><th class="w-14">Late Executed</th><th class="w-14">Late Approved</th><tr>';
5148
5191
  this.htmlDataStats += '<tr><td class="w-14 text-center td-odd">'+total+'</td><td class="w-14 text-center td-odd">'+(total-(pastDueDate+lateApproved+lateExecuted))+'</td><td class="w-14 text-center td-odd">'+pastDueDate+'</td><td class="w-14 text-center td-odd">'+lateReported+'</td><td class="w-14 text-center td-odd">'+lateExecuted+'</td><td class="w-14 text-center td-odd">'+lateApproved+'</td><tr></table>'
5149
5192
 
5150
- this.htmlDataStats += '<br /><br />Compliance<br /><br /><table class="w-100"><tr><th class="w-14">Total</th><th class="w-14">Scheduled</th><th class="w-14">Not Complied</th><th class="w-14">Partially Complied</th><th class="w-14">Complied</th><tr>';
5151
- this.htmlDataStats += '<tr><td class="w-14 text-center td-odd">'+total+'</td><td class="w-14 text-center td-odd">'+scheduled+'</td><td class="w-14 text-center td-odd">'+notComplied+'</td><td class="w-14 text-center td-odd">'+partiallyComplied+'</td><td class="w-14 text-center td-odd">'+complied+'</td><tr></table>'
5193
+ this.htmlDataStats += '<br /><br />Compliance<br /><br /><table class="w-100"><tr><th class="w-14">Total</th><th class="w-14">Scheduled</th><th class="w-14">Not Complied</th><th class="w-14">Partially Complied</th><th class="w-14">Complied</th><th class="w-14">Complied With Gaps</th><th class="w-14">Reported Non Compliance</th><tr>';
5194
+ this.htmlDataStats += '<tr><td class="w-14 text-center td-odd">'+total+'</td><td class="w-14 text-center td-odd">'+scheduled+'</td><td class="w-14 text-center td-odd">'+notComplied+'</td><td class="w-14 text-center td-odd">'+partiallyComplied+'</td><td class="w-14 text-center td-odd">'+complied+'</td><td class="w-14 text-center td-odd">'+compliedWithGaps+'</td><td class="w-14 text-center td-odd">'+reportedNonCompliance+'</td><tr></table>'
5152
5195
 
5153
5196
  return html;
5154
5197
 
@@ -5397,13 +5440,16 @@ export class SfIEvents extends LitElement {
5397
5440
  return html;
5398
5441
  }
5399
5442
  renderReporting = (event: any, mmddyyyy: any) => {
5443
+
5400
5444
  let html = '';
5401
5445
  let completeness = this.getCompletenessStatus(event);
5402
5446
  let docs = event['documents'] == null ? [] : event['documents'];
5403
5447
  let approved = event['approved'] == null ? false : event['approved'];
5404
5448
  let dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
5449
+ let percentage = event['percentage'] == null ? '100' : event['percentage'];
5405
5450
  let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
5406
5451
  let docsOptional = event['docs'] == null ? [] : event['docs'];
5452
+ console.log('rendering reporting', event, percentage)
5407
5453
  if(this.selectedItemIds.length > 0){
5408
5454
  html += `<div class="d-flex justify-between ">
5409
5455
  <h4 class="m-0 bulk-upload-label" part="bulk-upload-label">${this.selectedItemIds.length - 1} other ` + ((this.selectedItemIds.length - 1) === 1 ? `item` : `items`) + ` also selected</h4>
@@ -5434,6 +5480,8 @@ export class SfIEvents extends LitElement {
5434
5480
  html += '<input id="input-approver-comments" type="text" part="input" value=""/><br />';
5435
5481
  html += '<label part="input-label">Date of Completion*</label>';
5436
5482
  html += '<input id="input-approver-doc" part="input" type="date" value="'+(dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0,10))+'" disabled/><br />';
5483
+ html += '<label part="input-label">Percentage</label>';
5484
+ html += '<input id="input-reporter-percentage" part="input" type="number" max="100" min="0" step="1" value="' + percentage + '" disabled/><br />';
5437
5485
  html += '<div>'
5438
5486
  html += '<label part="input-label">Approve?*</label><br />';
5439
5487
  html += '<div class="mt-5">'
@@ -5486,6 +5534,9 @@ export class SfIEvents extends LitElement {
5486
5534
  html += '<input id="input-reporter-comments" type="text" part="input" value=""/><br />';
5487
5535
  html += '<label part="input-label">Date of Completion*</label>';
5488
5536
  html += '<input id="input-reporter-doc" part="input" type="date" value="'+(dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0,10))+'" max="'+(new Date().toISOString().substring(0, 10))+'"/><br />';
5537
+ html += '<label part="input-label">Completion Percentage*</label>';
5538
+ html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/><br />';
5539
+ html += '<div part="input-reporter-percentage-message" class="input-reporter-percentage-message mb-20">For reporting full non-compliance, choose 0%. For reporting compliance with gaps, choose the appropriate % value.</div><br />'
5489
5540
  // if(docsOptional.length === 0) {
5490
5541
  html += '<label part="input-label">Supporting Documents' + ((docsOptional.length > 0) ? '' : '*') + '</label>';
5491
5542
 
@@ -5531,6 +5582,9 @@ export class SfIEvents extends LitElement {
5531
5582
  html += '<input id="input-auditor-comments" type="text" part="input" value=""/><br />';
5532
5583
  html += '<label part="input-label">Date of Completion</label>';
5533
5584
  html += '<input id="input-auditor-doc" part="input" type="date" value="'+(dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0,10))+'" max="'+(new Date().toISOString().substring(0, 10))+'" readonly/><br />';
5585
+ html += '<label part="input-label">Percentage</label>';
5586
+ html += '<input id="input-reporter-percentage" part="input" type="number" max="100" min="0" step="1" value="' + percentage + '" disabled/><br />';
5587
+ html += '<div part="input-reporter-percentage-message" class="input-reporter-percentage-message mb-20">For reporting full non-compliance, choose 0%. For reporting compliance with gaps, choose the appropriate % value.</div><br />'
5534
5588
  html += '<div>'
5535
5589
  html += '<label part="input-label">Approve?</label><br />';
5536
5590
  html += '<div class="mt-5">'
@@ -5940,194 +5994,208 @@ export class SfIEvents extends LitElement {
5940
5994
  reportformatvalues = JSON.stringify((this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.selectedValues()) ?? "";
5941
5995
  reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
5942
5996
  }
5943
-
5944
- console.log('docs', docs, 'docsOptional', event.docsOptional, this.graphFilter)
5945
- if(docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0) {
5997
+ let percentage: string = "100";
5998
+ if((listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement) != null){
5999
+ percentage = (listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value
6000
+ }
6001
+ console.log('percentage', percentage, (listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value);
6002
+ if(Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
5946
6003
 
5947
6004
  //console.log('reporter comments 3', reportercomments);
5948
6005
  buttonClick.innerHTML = "Save"
5949
- this.setError('No documents uploaded!');
6006
+ this.setError('Invalid Percentage!');
5950
6007
  setTimeout(() => {
5951
6008
  this.clearMessages();
5952
6009
  }, 3000);
5953
6010
 
5954
6011
  } else {
6012
+ if(docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0) {
5955
6013
 
5956
- //console.log('reporterdoc', reporterdoc);
5957
-
5958
- if(reporterdoc.length === 0) {
6014
+ //console.log('reporter comments 3', reportercomments);
5959
6015
  buttonClick.innerHTML = "Save"
5960
- this.setError('Date of completion not selected!');
6016
+ this.setError('No documents uploaded!');
5961
6017
  setTimeout(() => {
5962
6018
  this.clearMessages();
5963
6019
  }, 3000);
5964
6020
 
5965
6021
  } else {
5966
6022
 
5967
- //console.log('makerscheckers 1', reportercomments);
6023
+ //console.log('reporterdoc', reporterdoc);
5968
6024
 
5969
- if(reportercomments.trim().length === 0) {
6025
+ if(reporterdoc.length === 0) {
5970
6026
  buttonClick.innerHTML = "Save"
5971
- this.setError('Comments cannot be blank!');
6027
+ this.setError('Date of completion not selected!');
5972
6028
  setTimeout(() => {
5973
6029
  this.clearMessages();
5974
6030
  }, 3000);
5975
6031
 
5976
6032
  } else {
5977
- let flagBulk = false;
5978
- if(this.selectedItemIds.length == 0){
5979
-
5980
- await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events")
5981
-
5982
- console.log('this.events', this.events);
5983
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
5984
- if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
5985
- this.events[mmdd][p].documents = docs
5986
- this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
5987
- this.events[mmdd][p].lastupdated = new Date().toString()
5988
- }
5989
- }
5990
-
5991
- if(event.makercheckers.length > 0) {
5992
6033
 
5993
- await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
6034
+ //console.log('makerscheckers 1', reportercomments);
6035
+
6036
+ if(reportercomments.trim().length === 0) {
6037
+ buttonClick.innerHTML = "Save"
6038
+ this.setError('Comments cannot be blank!');
6039
+ setTimeout(() => {
6040
+ this.clearMessages();
6041
+ }, 3000);
6042
+
6043
+ } else {
6044
+ let flagBulk = false;
6045
+ if(this.selectedItemIds.length == 0){
6046
+
6047
+ await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage)
6048
+
6049
+ console.log('this.events', this.events);
5994
6050
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
5995
6051
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
5996
- this.events[mmdd][p].approved = true
5997
- // this.events[mmdd][p].documents = docs
5998
- this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
6052
+ this.events[mmdd][p].documents = docs
6053
+ this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
5999
6054
  this.events[mmdd][p].lastupdated = new Date().toString()
6000
6055
  }
6001
6056
  }
6002
- }
6003
- if(this.recentlyReported[mmdd] == null){
6004
- this.recentlyReported[mmdd] = []
6005
- }
6006
- this.recentlyReported[mmdd].push(event)
6007
- console.log('recently reported', this.recentlyReported)
6008
- }else{
6009
- let bulkBody = []
6010
- let bulkBodyReview = []
6011
- for(var k = 0; k < this.selectedItemIds.length; k++) {
6012
6057
 
6013
- const selectedId = this.selectedItemIds[k];
6014
- //console.log('selectedid', selectedId);
6058
+ if(event.makercheckers.length > 0) {
6059
+
6060
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
6061
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
6062
+ if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid){
6063
+ this.events[mmdd][p].approved = true
6064
+ // this.events[mmdd][p].documents = docs
6065
+ this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
6066
+ this.events[mmdd][p].lastupdated = new Date().toString()
6067
+ }
6068
+ }
6069
+ }
6070
+ if(this.recentlyReported[mmdd] == null){
6071
+ this.recentlyReported[mmdd] = []
6072
+ }
6073
+ this.recentlyReported[mmdd].push(event)
6074
+ console.log('recently reported', this.recentlyReported)
6075
+ }else{
6076
+ let bulkBody = []
6077
+ let bulkBodyReview = []
6078
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
6079
+
6080
+ const selectedId = this.selectedItemIds[k];
6081
+ //console.log('selectedid', selectedId);
6015
6082
 
6016
- const makercheckersL = selectedId.split('-')[5];
6017
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
6018
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
6019
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6020
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6083
+ const makercheckersL = selectedId.split('-')[5];
6084
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
6085
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
6086
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6087
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6021
6088
 
6022
- //console.log(entityId, locationId, eventId, mmddyyyy);
6023
-
6024
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
6025
- if(parseInt(makercheckersL) > 0) {
6026
- bulkBodyReview.push({
6027
- "mmddyyyy": mmddyyyy,
6028
- "projectid": this.projectId,
6029
- "type": "report",
6030
- "eventid": eventId,
6031
- "comments": reportercomments,
6032
- "dateofcompletion": reporterdoc,
6033
- "entityid": entityId,
6034
- "locationid": locationId,
6035
- "event": null,
6036
- "docs": JSON.stringify(docs),
6037
- "approved": true,
6038
- "username": this.userName,
6039
- "reportformatvalues": reportformatvalues,
6040
- "reportformatschema": reportformatschema,
6041
- "userid": this.userProfileId,
6042
- "userrole": this.myRole,
6043
- "year": this.calendarStartYYYY,
6044
- "module": event.isnotice != null ? "notices" : "events"
6045
- } )
6046
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
6047
-
6048
- }else{
6049
- bulkBody.push({
6050
- "mmddyyyy": mmddyyyy,
6051
- "projectid": this.projectId,
6052
- "type": "report",
6053
- "eventid": eventId,
6054
- "comments": reportercomments,
6055
- "dateofcompletion": reporterdoc,
6056
- "entityid": entityId,
6057
- "locationid": locationId,
6058
- "event": null,
6059
- "docs": JSON.stringify(docs),
6060
- "username": this.userName,
6061
- "reportformatvalues": reportformatvalues,
6062
- "reportformatschema": reportformatschema,
6063
- "userid": this.userProfileId,
6064
- "userrole": this.myRole,
6065
- "year": this.calendarStartYYYY,
6066
- "module": event.isnotice != null ? "notices" : "events"
6067
- })
6068
- }
6089
+ //console.log(entityId, locationId, eventId, mmddyyyy);
6090
+
6091
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
6092
+ if(parseInt(makercheckersL) > 0) {
6093
+ bulkBodyReview.push({
6094
+ "mmddyyyy": mmddyyyy,
6095
+ "projectid": this.projectId,
6096
+ "type": "report",
6097
+ "eventid": eventId,
6098
+ "comments": reportercomments,
6099
+ "dateofcompletion": reporterdoc,
6100
+ "percentage": percentage,
6101
+ "entityid": entityId,
6102
+ "locationid": locationId,
6103
+ "event": null,
6104
+ "docs": JSON.stringify(docs),
6105
+ "approved": true,
6106
+ "username": this.userName,
6107
+ "reportformatvalues": reportformatvalues,
6108
+ "reportformatschema": reportformatschema,
6109
+ "userid": this.userProfileId,
6110
+ "userrole": this.myRole,
6111
+ "year": this.calendarStartYYYY,
6112
+ "module": event.isnotice != null ? "notices" : "events"
6113
+ } )
6114
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
6115
+
6116
+ }else{
6117
+ bulkBody.push({
6118
+ "mmddyyyy": mmddyyyy,
6119
+ "projectid": this.projectId,
6120
+ "type": "report",
6121
+ "eventid": eventId,
6122
+ "comments": reportercomments,
6123
+ "dateofcompletion": reporterdoc,
6124
+ "percentage": percentage,
6125
+ "entityid": entityId,
6126
+ "locationid": locationId,
6127
+ "event": null,
6128
+ "docs": JSON.stringify(docs),
6129
+ "username": this.userName,
6130
+ "reportformatvalues": reportformatvalues,
6131
+ "reportformatschema": reportformatschema,
6132
+ "userid": this.userProfileId,
6133
+ "userrole": this.myRole,
6134
+ "year": this.calendarStartYYYY,
6135
+ "module": event.isnotice != null ? "notices" : "events"
6136
+ })
6137
+ }
6069
6138
 
6070
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
6071
- // await this.sleep(2000);
6072
- // this.clearMessages();
6139
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
6140
+ // await this.sleep(2000);
6141
+ // this.clearMessages();
6073
6142
 
6074
- }
6075
- // await this.uploadReportsBulk(bulkBody);
6076
-
6077
- // await this.fetchBulkReportingData();
6078
- if(bulkBody.length > 0){
6079
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
6080
- }
6081
-
6082
- if(bulkBodyReview.length > 0){
6083
- await this.uploadReportsReviewsBulk(bulkBodyReview)
6084
- }
6085
- for(var k = 0; k < this.selectedItemIds.length; k++) {
6086
-
6087
- const selectedId = this.selectedItemIds[k];
6088
- //console.log('selectedid', selectedId);
6089
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
6090
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
6091
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6092
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6093
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
6094
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
6095
- if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
6096
- flagBulk = true;
6097
- this.events[mmdd][p].isbulk = true
6098
- if(this.recentlyReported[mmdd] == null){
6099
- this.recentlyReported[mmdd] = []
6143
+ }
6144
+ // await this.uploadReportsBulk(bulkBody);
6145
+
6146
+ // await this.fetchBulkReportingData();
6147
+ if(bulkBody.length > 0){
6148
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
6149
+ }
6150
+
6151
+ if(bulkBodyReview.length > 0){
6152
+ await this.uploadReportsReviewsBulk(bulkBodyReview)
6153
+ }
6154
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
6155
+
6156
+ const selectedId = this.selectedItemIds[k];
6157
+ //console.log('selectedid', selectedId);
6158
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
6159
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
6160
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
6161
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
6162
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
6163
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
6164
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
6165
+ flagBulk = true;
6166
+ this.events[mmdd][p].isbulk = true
6167
+ if(this.recentlyReported[mmdd] == null){
6168
+ this.recentlyReported[mmdd] = []
6169
+ }
6170
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
6100
6171
  }
6101
- this.recentlyReported[mmdd].push(this.events[mmdd][p])
6102
6172
  }
6103
6173
  }
6104
6174
  }
6105
- }
6106
6175
 
6107
- if(this.mode == "next"){
6108
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
6109
- }else{
6110
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
6111
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
6112
- // } else
6113
- if(this.getCurrentTab() == this.TAB_FIND) {
6114
- const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
6115
- this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
6116
- } else {
6117
- if(this.selectedItemIds.length > 0) {
6118
- await this.fetchBulkReportingData();
6176
+ if(this.mode == "next"){
6177
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
6178
+ }else{
6179
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
6180
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
6181
+ // } else
6182
+ if(this.getCurrentTab() == this.TAB_FIND) {
6183
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
6184
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
6185
+ } else {
6186
+ if(this.selectedItemIds.length > 0) {
6187
+ await this.fetchBulkReportingData();
6188
+ }
6189
+ this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
6190
+ // if(currentColumnButton != null) {
6191
+ // currentColumnButton.click();
6192
+ // }
6119
6193
  }
6120
- this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
6121
- // if(currentColumnButton != null) {
6122
- // currentColumnButton.click();
6123
- // }
6124
6194
  }
6125
6195
  }
6126
-
6127
6196
  }
6128
6197
  }
6129
6198
  }
6130
-
6131
6199
  });
6132
6200
 
6133
6201
  }
@@ -11696,6 +11764,8 @@ export class SfIEvents extends LitElement {
11696
11764
  var dataScheduled = (divContainer.querySelector('#graph-scheduled') as HTMLSpanElement).innerHTML;
11697
11765
  var dataPartiallyComplied = (divContainer.querySelector('#graph-partially-complied') as HTMLSpanElement).innerHTML;
11698
11766
  var dataComplied = (divContainer.querySelector('#graph-complied') as HTMLSpanElement).innerHTML;
11767
+ var dataCompliedWithGaps = (divContainer.querySelector('#graph-complied-with-gaps') as HTMLSpanElement).innerHTML;
11768
+ var dataReportedNonComplaince = (divContainer.querySelector('#graph-reported-non-compliance') as HTMLSpanElement).innerHTML;
11699
11769
 
11700
11770
  const ctx = divContainer.querySelector('#myChart') as ChartItem;
11701
11771
  this.showGraph(divContainer, 1);
@@ -11704,22 +11774,24 @@ export class SfIEvents extends LitElement {
11704
11774
  this.clearGraph(divContainer, 4);
11705
11775
 
11706
11776
  const data = {
11707
- labels: ['Scheduled', 'Not Complied', 'Partially Complied', 'Complied'],
11777
+ labels: ['Scheduled', 'Not Complied', 'Partially Complied', 'Complied', 'Complied With Gaps','Reported Non Compliance'],
11708
11778
  datasets: [{
11709
11779
  label: 'Compliances',
11710
- data: [dataScheduled, dataNotComplied, dataPartiallyComplied, dataComplied],
11780
+ data: [dataScheduled, dataNotComplied, dataPartiallyComplied, dataComplied, dataCompliedWithGaps, dataReportedNonComplaince],
11711
11781
  borderWidth: 1,
11712
11782
  backgroundColor: [
11713
11783
  this.COLOR_SCHEDULED,
11714
11784
  this.COLOR_NOT_COMPLIED,
11715
11785
  this.COLOR_PARTIALLY_COMPLIED,
11716
- this.COLOR_COMPLIED
11786
+ this.COLOR_COMPLIED,
11787
+ this.COLOR_COMPLIED_WITH_GAPS,
11788
+ this.COLOR_REPORTED_NON_COMPLIANCE
11717
11789
  ]
11718
11790
  }]
11719
11791
  }
11720
11792
 
11721
- this.csvGraphStats += 'Compliance,Scheduled,Not Complied,Partially Complied,Complied,Total\n';
11722
- this.csvGraphStats += 'Count,'+parseInt(dataScheduled)+','+parseInt(dataNotComplied)+','+parseInt(dataPartiallyComplied)+','+parseInt(dataComplied)+','+parseInt(dataTotal)+'\n';
11793
+ this.csvGraphStats += 'Compliance,Scheduled,Not Complied,Partially Complied,Complied,Complied With Gaps,Reported Non Compliance,Total\n';
11794
+ this.csvGraphStats += 'Count,'+parseInt(dataScheduled)+','+parseInt(dataNotComplied)+','+parseInt(dataPartiallyComplied)+','+parseInt(dataComplied)+','+parseInt(dataCompliedWithGaps)+','+parseInt(dataReportedNonComplaince)+','+parseInt(dataTotal)+'\n';
11723
11795
 
11724
11796
  //console.log('rendering timeliness graph', this.csvGraphStats);
11725
11797
 
@@ -11986,6 +12058,8 @@ export class SfIEvents extends LitElement {
11986
12058
  dataBar2['datasets'].push({});
11987
12059
  dataBar2['datasets'].push({});
11988
12060
  dataBar2['datasets'].push({});
12061
+ dataBar2['datasets'].push({});
12062
+ dataBar2['datasets'].push({});
11989
12063
 
11990
12064
  dataBar2['datasets'][0]['label'] = 'Scheduled';
11991
12065
  dataBar2['datasets'][0]['data'] = [];
@@ -12015,6 +12089,20 @@ export class SfIEvents extends LitElement {
12015
12089
  }
12016
12090
  dataBar2['datasets'][3]['backgroundColor'] = this.COLOR_COMPLIED;
12017
12091
 
12092
+ dataBar2['datasets'][4]['label'] = 'Complied With Gaps';
12093
+ dataBar2['datasets'][4]['data'] = [];
12094
+ for(i = 0; i < Object.keys(complianceData).length; i++) {
12095
+ dataBar2['datasets'][4]['data'].push(complianceData[Object.keys(complianceData)[i]]['complied-with-gaps']);
12096
+ }
12097
+ dataBar2['datasets'][4]['backgroundColor'] = this.COLOR_COMPLIED_WITH_GAPS;
12098
+
12099
+ dataBar2['datasets'][5]['label'] = 'Reported Non Compliance';
12100
+ dataBar2['datasets'][5]['data'] = [];
12101
+ for(i = 0; i < Object.keys(complianceData).length; i++) {
12102
+ dataBar2['datasets'][5]['data'].push(complianceData[Object.keys(complianceData)[i]]['reported-non-compliance']);
12103
+ }
12104
+ dataBar2['datasets'][5]['backgroundColor'] = this.COLOR_REPORTED_NON_COMPLIANCE;
12105
+
12018
12106
  return dataBar2;
12019
12107
 
12020
12108
  }
@@ -12107,7 +12195,7 @@ export class SfIEvents extends LitElement {
12107
12195
 
12108
12196
  const dataBar3:any = this.populateGraphDataBarCompliance(complianceData);
12109
12197
 
12110
- //console.log('rendering compliance matrix', dataBar3);
12198
+ console.log('rendering compliance matrix', dataBar3);
12111
12199
 
12112
12200
  const ctx4 = divContainer.querySelector('#myChart4') as ChartItem;
12113
12201
  this.showGraph(divContainer, 4);
@@ -12797,208 +12885,223 @@ export class SfIEvents extends LitElement {
12797
12885
  reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
12798
12886
  }
12799
12887
 
12800
-
12801
- if(docs.length === 0 && docsOptional.length === 0) {
12888
+ let percentage: string = "100";
12889
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement) != null){
12890
+ percentage = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement).value
12891
+ }
12892
+ if(Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
12802
12893
 
12803
12894
  //console.log('reporter comments 3', reportercomments);
12804
12895
  buttonClick.innerHTML = "Save"
12805
- this.setError('No documents uploaded!');
12896
+ this.setError('Invalid Percentage!');
12806
12897
  setTimeout(() => {
12807
12898
  this.clearMessages();
12808
12899
  }, 3000);
12809
12900
 
12810
12901
  } else {
12902
+ if(docs.length === 0 && docsOptional.length === 0) {
12811
12903
 
12812
- //console.log('reporterdoc', reporterdoc);
12813
-
12814
- if(reporterdoc.length === 0) {
12904
+ //console.log('reporter comments 3', reportercomments);
12815
12905
  buttonClick.innerHTML = "Save"
12816
- this.setError('Date of completion not selected!');
12906
+ this.setError('No documents uploaded!');
12817
12907
  setTimeout(() => {
12818
12908
  this.clearMessages();
12819
12909
  }, 3000);
12820
12910
 
12821
12911
  } else {
12822
12912
 
12823
- //console.log('makerscheckers 1', reportercomments);
12913
+ //console.log('reporterdoc', reporterdoc);
12824
12914
 
12825
- if(reportercomments.trim().length === 0) {
12915
+ if(reporterdoc.length === 0) {
12826
12916
  buttonClick.innerHTML = "Save"
12827
- this.setError('Comments cannot be blank!');
12917
+ this.setError('Date of completion not selected!');
12828
12918
  setTimeout(() => {
12829
12919
  this.clearMessages();
12830
12920
  }, 3000);
12831
12921
 
12832
12922
  } else {
12833
12923
 
12924
+ //console.log('makerscheckers 1', reportercomments);
12834
12925
 
12835
- var clickEvent = new MouseEvent("click", {
12836
- "view": window,
12837
- "bubbles": true,
12838
- "cancelable": false
12839
- });
12926
+ if(reportercomments.trim().length === 0) {
12927
+ buttonClick.innerHTML = "Save"
12928
+ this.setError('Comments cannot be blank!');
12929
+ setTimeout(() => {
12930
+ this.clearMessages();
12931
+ }, 3000);
12840
12932
 
12841
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
12842
- let flagBulk = false;
12843
- if(this.selectedItemIds.length === 0) {
12933
+ } else {
12844
12934
 
12845
- await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices")
12846
- console.log('this.events', this.events);
12847
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
12848
- if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12849
- this.events[mmdd][p].documents = docs
12850
- this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
12851
- this.events[mmdd][p].lastupdated = new Date().toString()
12852
- }
12853
- }
12854
- console.log('uploadReport single')
12855
- if(makercheckers.length > 0) {
12856
12935
 
12857
- await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
12936
+ var clickEvent = new MouseEvent("click", {
12937
+ "view": window,
12938
+ "bubbles": true,
12939
+ "cancelable": false
12940
+ });
12941
+
12942
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
12943
+ let flagBulk = false;
12944
+ if(this.selectedItemIds.length === 0) {
12945
+
12946
+ await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices", percentage)
12947
+ console.log('this.events', this.events);
12858
12948
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
12859
12949
  if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12860
- this.events[mmdd][p].approved = true
12861
- // this.events[mmdd][p].documents = docs
12862
- this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
12950
+ this.events[mmdd][p].documents = docs
12951
+ this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
12863
12952
  this.events[mmdd][p].lastupdated = new Date().toString()
12864
12953
  }
12865
12954
  }
12866
- console.log('upload report auto approve single')
12867
- }
12868
- if(this.recentlyReported[mmdd] == null){
12869
- this.recentlyReported[mmdd] = []
12870
- }
12871
- this.recentlyReported[mmdd].push(event)
12955
+ console.log('uploadReport single')
12956
+ if(makercheckers.length > 0) {
12957
+
12958
+ await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
12959
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
12960
+ if(this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12961
+ this.events[mmdd][p].approved = true
12962
+ // this.events[mmdd][p].documents = docs
12963
+ this.events[mmdd][p].comments.push({'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
12964
+ this.events[mmdd][p].lastupdated = new Date().toString()
12965
+ }
12966
+ }
12967
+ console.log('upload report auto approve single')
12968
+ }
12969
+ if(this.recentlyReported[mmdd] == null){
12970
+ this.recentlyReported[mmdd] = []
12971
+ }
12972
+ this.recentlyReported[mmdd].push(event)
12872
12973
 
12873
- } else {
12874
- let bulkBody = []
12875
- let bulkBodyReview = []
12876
- for(var k = 0; k < this.selectedItemIds.length; k++) {
12877
-
12878
- const selectedId = this.selectedItemIds[k];
12879
- //console.log('selectedid', selectedId);
12974
+ } else {
12975
+ let bulkBody = []
12976
+ let bulkBodyReview = []
12977
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
12978
+
12979
+ const selectedId = this.selectedItemIds[k];
12980
+ //console.log('selectedid', selectedId);
12880
12981
 
12881
- const makercheckersL = selectedId.split('-')[5];
12882
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
12883
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
12884
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
12885
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
12982
+ const makercheckersL = selectedId.split('-')[5];
12983
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
12984
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
12985
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
12986
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
12886
12987
 
12887
- //console.log(entityId, locationId, eventId, mmddyyyy);
12888
-
12889
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
12890
- if(parseInt(makercheckersL) > 0) {
12891
- bulkBodyReview.push({
12892
- "mmddyyyy": mmddyyyy,
12893
- "projectid": this.projectId,
12894
- "type": "report",
12895
- "eventid": eventId,
12896
- "comments": reportercomments,
12897
- "dateofcompletion": reporterdoc,
12898
- "entityid": entityId,
12899
- "locationid": locationId,
12900
- "event": null,
12901
- "docs": JSON.stringify(docs),
12902
- "approved": true,
12903
- "username": this.userName,
12904
- "reportformatvalues": reportformatvalues,
12905
- "reportformatschema": reportformatschema,
12906
- "userid": this.userProfileId,
12907
- "userrole": this.myRole,
12908
- "year": this.calendarStartYYYY,
12909
- "module": listEvent.isnotice != null ? "notices" : "events"
12910
- } )
12911
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
12912
-
12913
- }else{
12914
- bulkBody.push({
12915
- "mmddyyyy": mmddyyyy,
12916
- "projectid": this.projectId,
12917
- "type": "report",
12918
- "eventid": eventId,
12919
- "comments": reportercomments,
12920
- "dateofcompletion": reporterdoc,
12921
- "entityid": entityId,
12922
- "locationid": locationId,
12923
- "event": null,
12924
- "docs": JSON.stringify(docs),
12925
- "username": this.userName,
12926
- "reportformatvalues": reportformatvalues,
12927
- "reportformatschema": reportformatschema,
12928
- "userid": this.userProfileId,
12929
- "userrole": this.myRole,
12930
- "year": this.calendarStartYYYY,
12931
- "module": listEvent.isnotice != null ? "notices" : "events"
12932
- })
12933
- }
12988
+ //console.log(entityId, locationId, eventId, mmddyyyy);
12989
+
12990
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
12991
+ if(parseInt(makercheckersL) > 0) {
12992
+ bulkBodyReview.push({
12993
+ "mmddyyyy": mmddyyyy,
12994
+ "projectid": this.projectId,
12995
+ "type": "report",
12996
+ "eventid": eventId,
12997
+ "comments": reportercomments,
12998
+ "dateofcompletion": reporterdoc,
12999
+ "percentage": percentage,
13000
+ "entityid": entityId,
13001
+ "locationid": locationId,
13002
+ "event": null,
13003
+ "docs": JSON.stringify(docs),
13004
+ "approved": true,
13005
+ "username": this.userName,
13006
+ "reportformatvalues": reportformatvalues,
13007
+ "reportformatschema": reportformatschema,
13008
+ "userid": this.userProfileId,
13009
+ "userrole": this.myRole,
13010
+ "year": this.calendarStartYYYY,
13011
+ "module": listEvent.isnotice != null ? "notices" : "events"
13012
+ } )
13013
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
13014
+
13015
+ }else{
13016
+ bulkBody.push({
13017
+ "mmddyyyy": mmddyyyy,
13018
+ "projectid": this.projectId,
13019
+ "type": "report",
13020
+ "eventid": eventId,
13021
+ "comments": reportercomments,
13022
+ "dateofcompletion": reporterdoc,
13023
+ "percentage": percentage,
13024
+ "entityid": entityId,
13025
+ "locationid": locationId,
13026
+ "event": null,
13027
+ "docs": JSON.stringify(docs),
13028
+ "username": this.userName,
13029
+ "reportformatvalues": reportformatvalues,
13030
+ "reportformatschema": reportformatschema,
13031
+ "userid": this.userProfileId,
13032
+ "userrole": this.myRole,
13033
+ "year": this.calendarStartYYYY,
13034
+ "module": listEvent.isnotice != null ? "notices" : "events"
13035
+ })
13036
+ }
12934
13037
 
12935
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
12936
- // await this.sleep(2000);
12937
- // this.clearMessages();
13038
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
13039
+ // await this.sleep(2000);
13040
+ // this.clearMessages();
12938
13041
 
12939
- }
13042
+ }
12940
13043
 
12941
- // await this.uploadReportsBulk(bulkBody);
12942
- // await this.fetchBulkReportingData();
12943
- if(bulkBody.length > 0){
12944
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
12945
- }
12946
-
12947
- if(bulkBodyReview.length > 0){
12948
- await this.uploadReportsReviewsBulk(bulkBodyReview)
12949
- }
12950
- await this.fetchBulkReportingData();
12951
- console.log('uploadReport bulk')
12952
- for(var k = 0; k < this.selectedItemIds.length; k++) {
12953
-
12954
- const selectedId = this.selectedItemIds[k];
12955
- //console.log('selectedid', selectedId);
12956
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
12957
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
12958
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
12959
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
12960
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
12961
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
12962
- if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
12963
-
12964
- this.events[mmdd][p].isbulk = true
12965
- flagBulk = true;
12966
- if(this.recentlyReported[mmdd] == null){
12967
- this.recentlyReported[mmdd] = []
13044
+ // await this.uploadReportsBulk(bulkBody);
13045
+ // await this.fetchBulkReportingData();
13046
+ if(bulkBody.length > 0){
13047
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
13048
+ }
13049
+
13050
+ if(bulkBodyReview.length > 0){
13051
+ await this.uploadReportsReviewsBulk(bulkBodyReview)
13052
+ }
13053
+ await this.fetchBulkReportingData();
13054
+ console.log('uploadReport bulk')
13055
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
13056
+
13057
+ const selectedId = this.selectedItemIds[k];
13058
+ //console.log('selectedid', selectedId);
13059
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
13060
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
13061
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
13062
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
13063
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13064
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
13065
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
13066
+
13067
+ this.events[mmdd][p].isbulk = true
13068
+ flagBulk = true;
13069
+ if(this.recentlyReported[mmdd] == null){
13070
+ this.recentlyReported[mmdd] = []
13071
+ }
13072
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
12968
13073
  }
12969
- this.recentlyReported[mmdd].push(this.events[mmdd][p])
12970
13074
  }
12971
13075
  }
12972
- }
12973
13076
 
12974
- }
13077
+ }
12975
13078
 
12976
- if(this.mode == "next"){
12977
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
12978
- }else{
12979
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
12980
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
12981
- // } else
12982
- if(this.getCurrentTab() == this.TAB_FIND) {
12983
- const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
12984
- this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
12985
- } else {
12986
- if(this.selectedItemIds.length > 0) {
12987
- await this.fetchBulkReportingData();
13079
+ if(this.mode == "next"){
13080
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
13081
+ }else{
13082
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
13083
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
13084
+ // } else
13085
+ if(this.getCurrentTab() == this.TAB_FIND) {
13086
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
13087
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
13088
+ } else {
13089
+ if(this.selectedItemIds.length > 0) {
13090
+ await this.fetchBulkReportingData();
13091
+ }
13092
+ this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
13093
+ // if(currentColumnButton != null) {
13094
+ // currentColumnButton.click();
13095
+ // }
12988
13096
  }
12989
- this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
12990
- // if(currentColumnButton != null) {
12991
- // currentColumnButton.click();
12992
- // }
12993
13097
  }
13098
+
12994
13099
  }
13100
+
12995
13101
 
12996
13102
  }
12997
-
12998
-
12999
13103
  }
13000
13104
  }
13001
-
13002
13105
  });
13003
13106
 
13004
13107
  }
@@ -13101,7 +13204,7 @@ export class SfIEvents extends LitElement {
13101
13204
 
13102
13205
  fetchEventDetails = async (listEvent: any, mmddyyyy: any, currentColumnButton: HTMLButtonElement | null, eventsContainer: HTMLDivElement) => {
13103
13206
  console.log('listEvent', listEvent, listEvent.id)
13104
- let url = "https://"+this.apiId+"/getalleventdetails";
13207
+ let url = "https://"+this.apiId+"/getalleventdetails1";
13105
13208
 
13106
13209
  //console.log('fetch calendar url', url);
13107
13210
  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.calendarStartYYYY};
@@ -14099,223 +14202,238 @@ export class SfIEvents extends LitElement {
14099
14202
  reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
14100
14203
  }
14101
14204
 
14102
-
14103
- if(docs.length === 0 && docsOptional.length === 0) {
14205
+ let percentage: string = "100";
14206
+ if(((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement) != null){
14207
+ percentage = ((this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-percentage') as HTMLInputElement).value
14208
+ }
14209
+ if(Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
14104
14210
 
14105
14211
  //console.log('reporter comments 3', reportercomments);
14106
14212
  buttonClick.innerHTML = "Save"
14107
- this.setError('No documents uploaded!');
14213
+ this.setError('Invalid Percentage!');
14108
14214
  setTimeout(() => {
14109
14215
  this.clearMessages();
14110
14216
  }, 3000);
14111
14217
 
14112
14218
  } else {
14219
+ if(docs.length === 0 && docsOptional.length === 0) {
14113
14220
 
14114
- //console.log('reporterdoc', reporterdoc);
14115
-
14116
- if(reporterdoc.length === 0) {
14221
+ //console.log('reporter comments 3', reportercomments);
14117
14222
  buttonClick.innerHTML = "Save"
14118
- this.setError('Date of completion not selected!');
14223
+ this.setError('No documents uploaded!');
14119
14224
  setTimeout(() => {
14120
14225
  this.clearMessages();
14121
14226
  }, 3000);
14122
14227
 
14123
14228
  } else {
14124
14229
 
14125
- //console.log('makerscheckers 1', reportercomments);
14230
+ //console.log('reporterdoc', reporterdoc);
14126
14231
 
14127
- if(reportercomments.trim().length === 0) {
14232
+ if(reporterdoc.length === 0) {
14128
14233
  buttonClick.innerHTML = "Save"
14129
- this.setError('Comments cannot be blank!');
14234
+ this.setError('Date of completion not selected!');
14130
14235
  setTimeout(() => {
14131
14236
  this.clearMessages();
14132
14237
  }, 3000);
14133
14238
 
14134
14239
  } else {
14135
14240
 
14241
+ //console.log('makerscheckers 1', reportercomments);
14136
14242
 
14137
- var clickEvent = new MouseEvent("click", {
14138
- "view": window,
14139
- "bubbles": true,
14140
- "cancelable": false
14141
- });
14142
-
14143
- ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
14144
- let flagBulk = false;
14145
- if(this.selectedItemIds.length === 0) {
14146
-
14147
- //console.log('makerscheckers', makercheckers, reportercomments);
14148
- // console.log('reportformatvalues', reportformatvalues)
14149
- // console.log('reportformatschema',reportformatschema)
14150
- await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events")
14151
- console.log('this.events', this.events);
14152
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
14153
- if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14154
- this.events[mmdd][p].documents = docs
14155
- this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
14156
- this.events[mmdd][p].lastupdated = new Date().toString()
14157
- }
14158
- }
14159
- if(makercheckers.length > 0) {
14243
+ if(reportercomments.trim().length === 0) {
14244
+ buttonClick.innerHTML = "Save"
14245
+ this.setError('Comments cannot be blank!');
14246
+ setTimeout(() => {
14247
+ this.clearMessages();
14248
+ }, 3000);
14249
+
14250
+ } else {
14251
+
14252
+
14253
+ var clickEvent = new MouseEvent("click", {
14254
+ "view": window,
14255
+ "bubbles": true,
14256
+ "cancelable": false
14257
+ });
14160
14258
 
14161
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
14259
+ ((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
14260
+ let flagBulk = false;
14261
+ if(this.selectedItemIds.length === 0) {
14262
+
14263
+ //console.log('makerscheckers', makercheckers, reportercomments);
14264
+ // console.log('reportformatvalues', reportformatvalues)
14265
+ // console.log('reportformatschema',reportformatschema)
14266
+ await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage)
14267
+ console.log('this.events', this.events);
14162
14268
  for( var p = 0 ; p < this.events[mmdd].length; p ++){
14163
14269
  if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14164
- this.events[mmdd][p].approved = true
14165
- // this.events[mmdd][p].documents = docs
14166
- this.events[mmdd][p].comments.push({'author': 'Auditor', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
14270
+ this.events[mmdd][p].documents = docs
14271
+ this.events[mmdd][p].comments.push({'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString()})
14167
14272
  this.events[mmdd][p].lastupdated = new Date().toString()
14168
14273
  }
14169
14274
  }
14170
- }
14171
- if(this.recentlyReported[mmdd] == null){
14172
- this.recentlyReported[mmdd] = []
14173
- }
14174
- this.recentlyReported[mmdd].push(event)
14175
-
14176
- } else {
14177
- let bulkBody = []
14178
- let bulkBodyReview = []
14179
- for(var k = 0; k < this.selectedItemIds.length; k++) {
14180
-
14181
- const selectedId = this.selectedItemIds[k];
14182
- //console.log('selectedid', selectedId);
14183
-
14184
- const makercheckersL = selectedId.split('-')[5];
14185
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14186
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
14187
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14188
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14189
-
14190
- //console.log(entityId, locationId, eventId, mmddyyyy);
14191
- // bulkBody.push({
14192
- // "mmddyyyy": mmddyyyy,
14193
- // "projectid": this.projectId,
14194
- // "type": "report",
14195
- // "eventid": eventId,
14196
- // "comments": reportercomments,
14197
- // "dateofcompletion": reporterdoc,
14198
- // "entityid": entityId,
14199
- // "locationid": locationId,
14200
- // "event": null,
14201
- // "docs": JSON.stringify(docs),
14202
- // "username": this.userName,
14203
- // "reportformatvalues": reportformatvalues,
14204
- // "reportformatschema": reportformatschema,
14205
- // "userid": this.userProfileId,
14206
- // "userrole": this.myRole,
14207
- // "year": this.calendarStartYYYY,
14208
- // "module": event.isnotice != null ? "notices" : "events"
14209
- // })
14210
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
14211
- if(parseInt(makercheckersL) > 0) {
14212
- bulkBodyReview.push({
14213
- "mmddyyyy": mmddyyyy,
14214
- "projectid": this.projectId,
14215
- "type": "report",
14216
- "eventid": eventId,
14217
- "comments": reportercomments,
14218
- "dateofcompletion": reporterdoc,
14219
- "entityid": entityId,
14220
- "locationid": locationId,
14221
- "event": null,
14222
- "docs": JSON.stringify(docs),
14223
- "approved": true,
14224
- "username": this.userName,
14225
- "reportformatvalues": reportformatvalues,
14226
- "reportformatschema": reportformatschema,
14227
- "userid": this.userProfileId,
14228
- "userrole": this.myRole,
14229
- "year": this.calendarStartYYYY,
14230
- "module": event.isnotice != null ? "notices" : "events"
14231
- } )
14232
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
14233
-
14234
- }else{
14235
- bulkBody.push({
14236
- "mmddyyyy": mmddyyyy,
14237
- "projectid": this.projectId,
14238
- "type": "report",
14239
- "eventid": eventId,
14240
- "comments": reportercomments,
14241
- "dateofcompletion": reporterdoc,
14242
- "entityid": entityId,
14243
- "locationid": locationId,
14244
- "event": null,
14245
- "docs": JSON.stringify(docs),
14246
- "username": this.userName,
14247
- "reportformatvalues": reportformatvalues,
14248
- "reportformatschema": reportformatschema,
14249
- "userid": this.userProfileId,
14250
- "userrole": this.myRole,
14251
- "year": this.calendarStartYYYY,
14252
- "module": event.isnotice != null ? "notices" : "events"
14253
- })
14275
+ if(makercheckers.length > 0) {
14276
+
14277
+ await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
14278
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
14279
+ if(this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14280
+ this.events[mmdd][p].approved = true
14281
+ // this.events[mmdd][p].documents = docs
14282
+ this.events[mmdd][p].comments.push({'author': 'Auditor', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString()})
14283
+ this.events[mmdd][p].lastupdated = new Date().toString()
14284
+ }
14285
+ }
14286
+ }
14287
+ if(this.recentlyReported[mmdd] == null){
14288
+ this.recentlyReported[mmdd] = []
14254
14289
  }
14290
+ this.recentlyReported[mmdd].push(event)
14255
14291
 
14256
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
14257
- // await this.sleep(2000);
14258
- // this.clearMessages();
14292
+ } else {
14293
+ let bulkBody = []
14294
+ let bulkBodyReview = []
14295
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
14296
+
14297
+ const selectedId = this.selectedItemIds[k];
14298
+ //console.log('selectedid', selectedId);
14299
+
14300
+ const makercheckersL = selectedId.split('-')[5];
14301
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
14302
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
14303
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14304
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14305
+
14306
+ //console.log(entityId, locationId, eventId, mmddyyyy);
14307
+ // bulkBody.push({
14308
+ // "mmddyyyy": mmddyyyy,
14309
+ // "projectid": this.projectId,
14310
+ // "type": "report",
14311
+ // "eventid": eventId,
14312
+ // "comments": reportercomments,
14313
+ // "dateofcompletion": reporterdoc,
14314
+ // "entityid": entityId,
14315
+ // "locationid": locationId,
14316
+ // "event": null,
14317
+ // "docs": JSON.stringify(docs),
14318
+ // "username": this.userName,
14319
+ // "reportformatvalues": reportformatvalues,
14320
+ // "reportformatschema": reportformatschema,
14321
+ // "userid": this.userProfileId,
14322
+ // "userrole": this.myRole,
14323
+ // "year": this.calendarStartYYYY,
14324
+ // "module": event.isnotice != null ? "notices" : "events"
14325
+ // })
14326
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
14327
+ if(parseInt(makercheckersL) > 0) {
14328
+ bulkBodyReview.push({
14329
+ "mmddyyyy": mmddyyyy,
14330
+ "projectid": this.projectId,
14331
+ "type": "report",
14332
+ "eventid": eventId,
14333
+ "comments": reportercomments,
14334
+ "dateofcompletion": reporterdoc,
14335
+ "percentage": percentage,
14336
+ "entityid": entityId,
14337
+ "locationid": locationId,
14338
+ "event": null,
14339
+ "docs": JSON.stringify(docs),
14340
+ "approved": true,
14341
+ "username": this.userName,
14342
+ "reportformatvalues": reportformatvalues,
14343
+ "reportformatschema": reportformatschema,
14344
+ "userid": this.userProfileId,
14345
+ "userrole": this.myRole,
14346
+ "year": this.calendarStartYYYY,
14347
+ "module": event.isnotice != null ? "notices" : "events"
14348
+ } )
14349
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
14350
+
14351
+ }else{
14352
+ bulkBody.push({
14353
+ "mmddyyyy": mmddyyyy,
14354
+ "projectid": this.projectId,
14355
+ "type": "report",
14356
+ "eventid": eventId,
14357
+ "comments": reportercomments,
14358
+ "dateofcompletion": reporterdoc,
14359
+ "percentage": percentage,
14360
+ "entityid": entityId,
14361
+ "locationid": locationId,
14362
+ "event": null,
14363
+ "docs": JSON.stringify(docs),
14364
+ "username": this.userName,
14365
+ "reportformatvalues": reportformatvalues,
14366
+ "reportformatschema": reportformatschema,
14367
+ "userid": this.userProfileId,
14368
+ "userrole": this.myRole,
14369
+ "year": this.calendarStartYYYY,
14370
+ "module": event.isnotice != null ? "notices" : "events"
14371
+ })
14372
+ }
14259
14373
 
14260
- }
14374
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
14375
+ // await this.sleep(2000);
14376
+ // this.clearMessages();
14261
14377
 
14262
- if(bulkBody.length > 0){
14263
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
14264
- }
14265
- // await this.fetchBulkReportingData();
14266
- if(bulkBodyReview.length > 0){
14267
- await this.uploadReportsReviewsBulk(bulkBodyReview)
14268
- }
14269
- for(var k = 0; k < this.selectedItemIds.length; k++) {
14270
-
14271
- const selectedId = this.selectedItemIds[k];
14272
- //console.log('selectedid', selectedId);
14273
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14274
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
14275
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14276
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14277
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14278
- for( var p = 0 ; p < this.events[mmdd].length; p ++){
14279
- if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14280
-
14281
- this.events[mmdd][p].isbulk = true
14282
- flagBulk = true;
14283
- if(this.recentlyReported[mmdd] == null){
14284
- this.recentlyReported[mmdd] = []
14378
+ }
14379
+
14380
+ if(bulkBody.length > 0){
14381
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
14382
+ }
14383
+ // await this.fetchBulkReportingData();
14384
+ if(bulkBodyReview.length > 0){
14385
+ await this.uploadReportsReviewsBulk(bulkBodyReview)
14386
+ }
14387
+ for(var k = 0; k < this.selectedItemIds.length; k++) {
14388
+
14389
+ const selectedId = this.selectedItemIds[k];
14390
+ //console.log('selectedid', selectedId);
14391
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
14392
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
14393
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14394
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14395
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
14396
+ for( var p = 0 ; p < this.events[mmdd].length; p ++){
14397
+ if(this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId){
14398
+
14399
+ this.events[mmdd][p].isbulk = true
14400
+ flagBulk = true;
14401
+ if(this.recentlyReported[mmdd] == null){
14402
+ this.recentlyReported[mmdd] = []
14403
+ }
14404
+ this.recentlyReported[mmdd].push(this.events[mmdd][p])
14285
14405
  }
14286
- this.recentlyReported[mmdd].push(this.events[mmdd][p])
14287
14406
  }
14288
14407
  }
14289
- }
14290
14408
 
14291
- }
14409
+ }
14292
14410
 
14293
- if(this.mode == "next"){
14294
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
14295
- }else{
14296
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14297
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14298
- // } else
14299
- if(this.getCurrentTab() == this.TAB_FIND) {
14300
- const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
14301
- this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
14302
- } else {
14303
- if(this.selectedItemIds.length > 0) {
14304
- await this.fetchBulkReportingData();
14411
+ if(this.mode == "next"){
14412
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
14413
+ }else{
14414
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14415
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14416
+ // } else
14417
+ if(this.getCurrentTab() == this.TAB_FIND) {
14418
+ const searchString = ((this._SfFindContainer as HTMLDivElement).querySelector('#stream-search') as HTMLInputElement).value;
14419
+ this.processFindSelection((this._SfFindContainer as HTMLDivElement), searchString);
14420
+ } else {
14421
+ if(this.selectedItemIds.length > 0) {
14422
+ await this.fetchBulkReportingData();
14423
+ }
14424
+ this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
14425
+ // if(currentColumnButton != null) {
14426
+ // currentColumnButton.click();
14427
+ // }
14305
14428
  }
14306
- this.renderAppropriateStream(this.sdate,this.edate,true, flagBulk)
14307
- // if(currentColumnButton != null) {
14308
- // currentColumnButton.click();
14309
- // }
14310
14429
  }
14430
+
14311
14431
  }
14432
+
14312
14433
 
14313
14434
  }
14314
-
14315
-
14316
14435
  }
14317
14436
  }
14318
-
14319
14437
  });
14320
14438
 
14321
14439
  }
@@ -19364,6 +19482,12 @@ export class SfIEvents extends LitElement {
19364
19482
  .color-complied {
19365
19483
  color: #50cf01;
19366
19484
  }
19485
+ .color-complied-with-gaps {
19486
+ color: #ffe505;
19487
+ }
19488
+ .color-reported-non-compliance {
19489
+ color: #840B0F;
19490
+ }
19367
19491
  .color-scheduled {
19368
19492
  color: #888888;
19369
19493
  }
@@ -20808,7 +20932,7 @@ export class SfIEvents extends LitElement {
20808
20932
  }, 10000);
20809
20933
  }
20810
20934
 
20811
-
20935
+
20812
20936
  for(var i = 0; i < divs.length; i++) {
20813
20937
 
20814
20938
  // console.log('processGraphFilter', graphparamnames1[i], (graphparamnames1[i] as HTMLDivElement).innerHTML.toLowerCase().replace('&amp;', '&').replace(/-/g, ' '), this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' '));
@@ -20818,6 +20942,9 @@ export class SfIEvents extends LitElement {
20818
20942
  let graphparamname1Arr = (graphparamnames1[i] as HTMLDivElement).innerHTML.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ').split(' • ');
20819
20943
  let filterFound = false;
20820
20944
  for(let tempFilterStr of graphparamname1Arr){
20945
+ if(clickedValue == "reported non compliance"){
20946
+ console.log('comparing filter', tempFilterStr, this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' '))
20947
+ }
20821
20948
  if(tempFilterStr == this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ') || this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ') == ""){
20822
20949
  filterFound = true;
20823
20950
  break;
@@ -22391,7 +22518,7 @@ export class SfIEvents extends LitElement {
22391
22518
  }
22392
22519
  }
22393
22520
  uploadReportsReviewsBulk = async (bulkBody: any) => {
22394
- let url = "https://"+this.apiId+"/uploadreportsreviewsbulk1";
22521
+ let url = "https://"+this.apiId+"/uploadreportsreviewsbulk2";
22395
22522
 
22396
22523
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22397
22524
  const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
@@ -22431,8 +22558,8 @@ export class SfIEvents extends LitElement {
22431
22558
  }
22432
22559
  }
22433
22560
 
22434
- 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") => {
22435
- let url = "https://"+this.apiId+"/uploadreport1";
22561
+ 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") => {
22562
+ let url = "https://"+this.apiId+"/uploadreport2";
22436
22563
 
22437
22564
  let body = {
22438
22565
  "mmddyyyy": mmddyyyy,
@@ -22441,6 +22568,7 @@ export class SfIEvents extends LitElement {
22441
22568
  "eventid": eventid,
22442
22569
  "comments": comments,
22443
22570
  "dateofcompletion": doc,
22571
+ "percentage": percentage,
22444
22572
  "entityid": entityId,
22445
22573
  "locationid": locationId,
22446
22574
  "event": event == null ? null : JSON.stringify(event),
@@ -22485,7 +22613,7 @@ export class SfIEvents extends LitElement {
22485
22613
  }
22486
22614
 
22487
22615
  uploadReportsBulk = async (bulkBody: any, showSuccess: boolean = true) => {
22488
- let url = "https://"+this.apiId+"/uploadreportsbulk1"
22616
+ let url = "https://"+this.apiId+"/uploadreportsbulk2"
22489
22617
 
22490
22618
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22491
22619
  const xhr : any = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization)) as any;
@@ -24258,7 +24386,7 @@ export class SfIEvents extends LitElement {
24258
24386
  view = "entity";
24259
24387
  }
24260
24388
 
24261
- path = "getallcountryevents2";
24389
+ path = "getallcountryevents3";
24262
24390
 
24263
24391
  let sDate = "";
24264
24392
  let eDate = "";
@@ -25301,7 +25429,7 @@ export class SfIEvents extends LitElement {
25301
25429
  console.log('eventsData', eventsData)
25302
25430
  console.log('role', role)
25303
25431
  // if(Object.keys(eventsData[role]).length > 0){
25304
- var notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0, inTime = 0, pastDueDate = 0, lateExecuted = 0, lateApproved = 0, lateReported = 0, scheduled = 0, partiallyComplied = 0, notComplied = 0, complied = 0;
25432
+ var notStarted = 0, approved = 0, pendingApproval = 0, rejected = 0, inTime = 0, pastDueDate = 0, lateExecuted = 0, lateApproved = 0, lateReported = 0, scheduled = 0, partiallyComplied = 0, notComplied = 0, complied = 0, compliedWithGaps = 0, reportedNonCompliance = 0;
25305
25433
  var html = '';
25306
25434
  this.selectedItemIds = [];
25307
25435
  this.selectedStatus = "";
@@ -25334,7 +25462,7 @@ export class SfIEvents extends LitElement {
25334
25462
  var complianceStatus = "";
25335
25463
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(eventsData[role][mmdd][j])));
25336
25464
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(eventsData[role][mmdd][j])), partStatus);
25337
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
25465
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(eventsData[role][mmdd][j])).percentage);
25338
25466
  notStarted = notStarted + (partStatus == "not-started" ? 1 : 0);
25339
25467
  pendingApproval = pendingApproval + (partStatus == "pending-approval" ? 1 : 0);
25340
25468
  rejected = rejected + (partStatus == "rejected" ? 1 : 0);
@@ -25348,6 +25476,8 @@ export class SfIEvents extends LitElement {
25348
25476
  partiallyComplied = partiallyComplied + (complianceStatus == "partially-complied" ? 1 : 0);
25349
25477
  notComplied = notComplied + (complianceStatus == "not-complied" ? 1 : 0);
25350
25478
  complied = complied + (complianceStatus == "complied" ? 1 : 0);
25479
+ compliedWithGaps = compliedWithGaps + (complianceStatus == "complied-with-gaps" ? 1 : 0);
25480
+ reportedNonCompliance = reportedNonCompliance + (complianceStatus == "reported-non-compliance" ? 1 : 0);
25351
25481
 
25352
25482
  eventsData[role][mmdd][j][this.FLOW_GRAPH_COMPLETENESS] = partStatus;
25353
25483
  eventsData[role][mmdd][j][this.FLOW_GRAPH_TIMELINESS] = lateStatus;
@@ -25907,7 +26037,7 @@ export class SfIEvents extends LitElement {
25907
26037
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(eventsData[mmdd][j])));
25908
26038
  if(partStatus != "not-started"){ continue; }
25909
26039
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(eventsData[mmdd][j])), partStatus);
25910
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
26040
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(eventsData[mmdd][j])).percentage);
25911
26041
  // notStarted = notStarted + (partStatus == "not-started" ? 1 : 0);
25912
26042
  // pendingApproval = pendingApproval + (partStatus == "pending-approval" ? 1 : 0);
25913
26043
  // rejected = rejected + (partStatus == "rejected" ? 1 : 0);