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.
package/sf-i-events.js CHANGED
@@ -113,6 +113,8 @@ let SfIEvents = class SfIEvents extends LitElement {
113
113
  this.COLOR_NOT_COMPLIED = "#C80036";
114
114
  this.COLOR_PARTIALLY_COMPLIED = "#F79256";
115
115
  this.COLOR_COMPLIED = "#50cf01";
116
+ this.COLOR_COMPLIED_WITH_GAPS = "#ffe505";
117
+ this.COLOR_REPORTED_NON_COMPLIANCE = "#840B0F";
116
118
  this.STATUS_NOT_STARTED = "not-started";
117
119
  this.STATUS_PENDING_APPROVAL = "pending-approval";
118
120
  this.STATUS_REJECTED = "rejected";
@@ -427,6 +429,12 @@ let SfIEvents = class SfIEvents extends LitElement {
427
429
  .color-complied {
428
430
  color: #50cf01;
429
431
  }
432
+ .color-complied-with-gaps {
433
+ color: #ffe505;
434
+ }
435
+ .color-reported-non-compliance {
436
+ color: #840B0F;
437
+ }
430
438
  .color-scheduled {
431
439
  color: #888888;
432
440
  }
@@ -632,6 +640,12 @@ let SfIEvents = class SfIEvents extends LitElement {
632
640
  .color-complied {
633
641
  color: #50cf01;
634
642
  }
643
+ .color-complied-with-gaps {
644
+ color: #ffe505;
645
+ }
646
+ .color-reported-non-compliance {
647
+ color: #840B0F;
648
+ }
635
649
  .color-scheduled {
636
650
  color: #888888;
637
651
  }
@@ -1845,6 +1859,12 @@ let SfIEvents = class SfIEvents extends LitElement {
1845
1859
  if (arrComplianceData[name]["complied"] == null) {
1846
1860
  arrComplianceData[name]["complied"] = 0;
1847
1861
  }
1862
+ if (arrComplianceData[name]["complied-with-gaps"] == null) {
1863
+ arrComplianceData[name]["complied-with-gaps"] = 0;
1864
+ }
1865
+ if (arrComplianceData[name]["reported-non-compliance"] == null) {
1866
+ arrComplianceData[name]["reported-non-compliance"] = 0;
1867
+ }
1848
1868
  arrComplianceData[name][complianceStatus]++;
1849
1869
  }
1850
1870
  return { arrData: arrData, arrPartData: arrPartData, arrLateData: arrLateData, arrComplianceData: arrComplianceData };
@@ -2082,7 +2102,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2082
2102
  }
2083
2103
  }
2084
2104
  };
2085
- this.getComplianceStatus = (completeness, timeliness) => {
2105
+ this.getComplianceStatus = (completeness, timeliness, percentage) => {
2086
2106
  if (completeness == "not-started") {
2087
2107
  if (timeliness == "in-time") {
2088
2108
  return "scheduled";
@@ -2112,7 +2132,16 @@ let SfIEvents = class SfIEvents extends LitElement {
2112
2132
  }
2113
2133
  else {
2114
2134
  if (timeliness == "in-time" || timeliness == "late-reported" || timeliness == "late-approved") {
2115
- return "complied";
2135
+ if (percentage != null && parseInt(percentage) == 0) {
2136
+ console.log('reported non compliance');
2137
+ return "reported-non-compliance";
2138
+ }
2139
+ else if (percentage != null && parseInt(percentage) < 100) {
2140
+ return "complied-with-gaps";
2141
+ }
2142
+ else {
2143
+ return "complied";
2144
+ }
2116
2145
  }
2117
2146
  else {
2118
2147
  return "not-complied";
@@ -2269,6 +2298,8 @@ let SfIEvents = class SfIEvents extends LitElement {
2269
2298
  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>';
2270
2299
  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>';
2271
2300
  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>';
2301
+ 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>';
2302
+ 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>';
2272
2303
  html += '</div>';
2273
2304
  html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
2274
2305
  return html;
@@ -2290,6 +2321,8 @@ let SfIEvents = class SfIEvents extends LitElement {
2290
2321
  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>';
2291
2322
  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>';
2292
2323
  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>';
2324
+ 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>';
2325
+ 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>';
2293
2326
  html += '</div>';
2294
2327
  html += '<div id="stream-event-filter" part="stream-event-total" class="d-flex flex-wrap"></div>';
2295
2328
  return html;
@@ -2619,6 +2652,8 @@ let SfIEvents = class SfIEvents extends LitElement {
2619
2652
  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>' : '');
2620
2653
  html += (complianceStatus == "partially-complied" ? '<span class="material-symbols-outlined color-partially-complied color-partially-complied-item color-partially-complied-item-' + i + '">rule</span>' : '');
2621
2654
  html += (complianceStatus == "complied" ? '<span class="material-symbols-outlined color-complied color-complied-item color-complied-item-' + i + '">sweep</span>' : '');
2655
+ 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>' : '');
2656
+ 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>' : '');
2622
2657
  html += (partStatus == "not-started" ? '<span class="material-symbols-outlined color-not-started color-not-started-item color-not-started-item-' + i + '">schedule</span>' : '');
2623
2658
  html += (partStatus == "pending-approval" ? '<span class="material-symbols-outlined color-pending color-pending-item color-pending-item-' + i + '">pending</span>' : '');
2624
2659
  html += (partStatus == "rejected" ? '<span class="material-symbols-outlined color-rejected color-rejected-item color-rejected-item-' + i + '">block</span>' : '');
@@ -2674,7 +2709,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2674
2709
  return html;
2675
2710
  };
2676
2711
  this.renderEvents = (_firstDay, _endDay, iInit, iLast, showGraph, index, month, period, firstDate = null, parametersTitle, showBackgroundButton) => {
2677
- 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;
2712
+ 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;
2678
2713
  var html = '';
2679
2714
  this.selectedItemIds = [];
2680
2715
  this.selectedItems = [];
@@ -2730,7 +2765,7 @@ let SfIEvents = class SfIEvents extends LitElement {
2730
2765
  // //console.log('eventlog1', tempEvents1['06/30'][7].comments, mmdd, j);
2731
2766
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(this.events[mmdd][j])));
2732
2767
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(this.events[mmdd][j])), partStatus);
2733
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
2768
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(this.events[mmdd][j])).percentage);
2734
2769
  if (this.flowGraph == this.FLOW_GRAPH_TIMELINESS) {
2735
2770
  bgStatus += lateStatus;
2736
2771
  }
@@ -2755,6 +2790,8 @@ let SfIEvents = class SfIEvents extends LitElement {
2755
2790
  partiallyComplied = partiallyComplied + (complianceStatus == "partially-complied" ? 1 : 0);
2756
2791
  notComplied = notComplied + (complianceStatus == "not-complied" ? 1 : 0);
2757
2792
  complied = complied + (complianceStatus == "complied" ? 1 : 0);
2793
+ compliedWithGaps = compliedWithGaps + (complianceStatus == "complied-with-gaps" ? 1 : 0);
2794
+ reportedNonCompliance = reportedNonCompliance + (complianceStatus == "reported-non-compliance" ? 1 : 0);
2758
2795
  this.events[mmdd][j][this.FLOW_GRAPH_COMPLETENESS] = partStatus;
2759
2796
  this.events[mmdd][j][this.FLOW_GRAPH_TIMELINESS] = lateStatus;
2760
2797
  this.events[mmdd][j][this.FLOW_GRAPH_COMPLIANCE] = complianceStatus;
@@ -2876,14 +2913,16 @@ let SfIEvents = class SfIEvents extends LitElement {
2876
2913
  html = html.replace("DASHBOARD_NOT_COMPLIED", notComplied + "");
2877
2914
  html = html.replace("DASHBOARD_PARTIALLY_COMPLIED", partiallyComplied + "");
2878
2915
  html = html.replace("DASHBOARD_COMPLIED", complied + "");
2879
- 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';
2880
- this.csvDataStats += this.period + "," + total + "," + notStarted + "," + approved + "," + pendingApproval + "," + rejected + "," + pastDueDate + "," + lateReported + "," + lateExecuted + "," + lateApproved + "," + scheduled + "," + notComplied + "," + partiallyComplied + "," + complied;
2916
+ html = html.replace("DASHBOARD_COMPLIED_WITH_GAPS", compliedWithGaps + "");
2917
+ html = html.replace("DASHBOARD_REPORTED_NON_COMPLIANCE", reportedNonCompliance + "");
2918
+ 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';
2919
+ this.csvDataStats += this.period + "," + total + "," + notStarted + "," + approved + "," + pendingApproval + "," + rejected + "," + pastDueDate + "," + lateReported + "," + lateExecuted + "," + lateApproved + "," + scheduled + "," + notComplied + "," + partiallyComplied + "," + complied + "," + compliedWithGaps + "," + reportedNonCompliance;
2881
2920
  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>';
2882
2921
  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>';
2883
2922
  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>';
2884
2923
  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>';
2885
- 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>';
2886
- 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>';
2924
+ 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>';
2925
+ 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>';
2887
2926
  return html;
2888
2927
  };
2889
2928
  this.renderStatistics = (_firstDay, _endDay, iInit, iLast, showGraph, index, month, period, firstDate = null, parametersTitle) => {
@@ -3099,8 +3138,10 @@ let SfIEvents = class SfIEvents extends LitElement {
3099
3138
  let docs = event['documents'] == null ? [] : event['documents'];
3100
3139
  let approved = event['approved'] == null ? false : event['approved'];
3101
3140
  let dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
3141
+ let percentage = event['percentage'] == null ? '100' : event['percentage'];
3102
3142
  let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
3103
3143
  let docsOptional = event['docs'] == null ? [] : event['docs'];
3144
+ console.log('rendering reporting', event, percentage);
3104
3145
  if (this.selectedItemIds.length > 0) {
3105
3146
  html += `<div class="d-flex justify-between ">
3106
3147
  <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>
@@ -3128,6 +3169,8 @@ let SfIEvents = class SfIEvents extends LitElement {
3128
3169
  html += '<input id="input-approver-comments" type="text" part="input" value=""/><br />';
3129
3170
  html += '<label part="input-label">Date of Completion*</label>';
3130
3171
  html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
3172
+ html += '<label part="input-label">Percentage</label>';
3173
+ html += '<input id="input-reporter-percentage" part="input" type="number" max="100" min="0" step="1" value="' + percentage + '" disabled/><br />';
3131
3174
  html += '<div>';
3132
3175
  html += '<label part="input-label">Approve?*</label><br />';
3133
3176
  html += '<div class="mt-5">';
@@ -3167,6 +3210,9 @@ let SfIEvents = class SfIEvents extends LitElement {
3167
3210
  html += '<input id="input-reporter-comments" type="text" part="input" value=""/><br />';
3168
3211
  html += '<label part="input-label">Date of Completion*</label>';
3169
3212
  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 />';
3213
+ html += '<label part="input-label">Completion Percentage*</label>';
3214
+ html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/><br />';
3215
+ 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 />';
3170
3216
  // if(docsOptional.length === 0) {
3171
3217
  html += '<label part="input-label">Supporting Documents' + ((docsOptional.length > 0) ? '' : '*') + '</label>';
3172
3218
  if (event['uploadguidance'] != null && event['uploadguidance'].length > 0) {
@@ -3204,6 +3250,9 @@ let SfIEvents = class SfIEvents extends LitElement {
3204
3250
  html += '<input id="input-auditor-comments" type="text" part="input" value=""/><br />';
3205
3251
  html += '<label part="input-label">Date of Completion</label>';
3206
3252
  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 />';
3253
+ html += '<label part="input-label">Percentage</label>';
3254
+ html += '<input id="input-reporter-percentage" part="input" type="number" max="100" min="0" step="1" value="' + percentage + '" disabled/><br />';
3255
+ 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 />';
3207
3256
  html += '<div>';
3208
3257
  html += '<label part="input-label">Approve?</label><br />';
3209
3258
  html += '<div class="mt-5">';
@@ -3577,170 +3626,186 @@ let SfIEvents = class SfIEvents extends LitElement {
3577
3626
  reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
3578
3627
  reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
3579
3628
  }
3580
- console.log('docs', docs, 'docsOptional', event.docsOptional, this.graphFilter);
3581
- if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0) {
3629
+ let percentage = "100";
3630
+ if (listReportingContainer.querySelector('#input-reporter-percentage') != null) {
3631
+ percentage = listReportingContainer.querySelector('#input-reporter-percentage').value;
3632
+ }
3633
+ console.log('percentage', percentage, listReportingContainer.querySelector('#input-reporter-percentage').value);
3634
+ if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
3582
3635
  //console.log('reporter comments 3', reportercomments);
3583
3636
  buttonClick.innerHTML = "Save";
3584
- this.setError('No documents uploaded!');
3637
+ this.setError('Invalid Percentage!');
3585
3638
  setTimeout(() => {
3586
3639
  this.clearMessages();
3587
3640
  }, 3000);
3588
3641
  }
3589
3642
  else {
3590
- //console.log('reporterdoc', reporterdoc);
3591
- if (reporterdoc.length === 0) {
3643
+ if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0) {
3644
+ //console.log('reporter comments 3', reportercomments);
3592
3645
  buttonClick.innerHTML = "Save";
3593
- this.setError('Date of completion not selected!');
3646
+ this.setError('No documents uploaded!');
3594
3647
  setTimeout(() => {
3595
3648
  this.clearMessages();
3596
3649
  }, 3000);
3597
3650
  }
3598
3651
  else {
3599
- //console.log('makerscheckers 1', reportercomments);
3600
- if (reportercomments.trim().length === 0) {
3652
+ //console.log('reporterdoc', reporterdoc);
3653
+ if (reporterdoc.length === 0) {
3601
3654
  buttonClick.innerHTML = "Save";
3602
- this.setError('Comments cannot be blank!');
3655
+ this.setError('Date of completion not selected!');
3603
3656
  setTimeout(() => {
3604
3657
  this.clearMessages();
3605
3658
  }, 3000);
3606
3659
  }
3607
3660
  else {
3608
- let flagBulk = false;
3609
- if (this.selectedItemIds.length == 0) {
3610
- await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events");
3611
- console.log('this.events', this.events);
3612
- for (var p = 0; p < this.events[mmdd].length; p++) {
3613
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3614
- this.events[mmdd][p].documents = docs;
3615
- this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
3616
- this.events[mmdd][p].lastupdated = new Date().toString();
3617
- }
3618
- }
3619
- if (event.makercheckers.length > 0) {
3620
- await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
3661
+ //console.log('makerscheckers 1', reportercomments);
3662
+ if (reportercomments.trim().length === 0) {
3663
+ buttonClick.innerHTML = "Save";
3664
+ this.setError('Comments cannot be blank!');
3665
+ setTimeout(() => {
3666
+ this.clearMessages();
3667
+ }, 3000);
3668
+ }
3669
+ else {
3670
+ let flagBulk = false;
3671
+ if (this.selectedItemIds.length == 0) {
3672
+ await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage);
3673
+ console.log('this.events', this.events);
3621
3674
  for (var p = 0; p < this.events[mmdd].length; p++) {
3622
3675
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3623
- this.events[mmdd][p].approved = true;
3624
- // this.events[mmdd][p].documents = docs
3625
- this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
3676
+ this.events[mmdd][p].documents = docs;
3677
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
3626
3678
  this.events[mmdd][p].lastupdated = new Date().toString();
3627
3679
  }
3628
3680
  }
3629
- }
3630
- if (this.recentlyReported[mmdd] == null) {
3631
- this.recentlyReported[mmdd] = [];
3632
- }
3633
- this.recentlyReported[mmdd].push(event);
3634
- console.log('recently reported', this.recentlyReported);
3635
- }
3636
- else {
3637
- let bulkBody = [];
3638
- let bulkBodyReview = [];
3639
- for (var k = 0; k < this.selectedItemIds.length; k++) {
3640
- const selectedId = this.selectedItemIds[k];
3641
- //console.log('selectedid', selectedId);
3642
- const makercheckersL = selectedId.split('-')[5];
3643
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
3644
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
3645
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
3646
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
3647
- //console.log(entityId, locationId, eventId, mmddyyyy);
3648
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
3649
- if (parseInt(makercheckersL) > 0) {
3650
- bulkBodyReview.push({
3651
- "mmddyyyy": mmddyyyy,
3652
- "projectid": this.projectId,
3653
- "type": "report",
3654
- "eventid": eventId,
3655
- "comments": reportercomments,
3656
- "dateofcompletion": reporterdoc,
3657
- "entityid": entityId,
3658
- "locationid": locationId,
3659
- "event": null,
3660
- "docs": JSON.stringify(docs),
3661
- "approved": true,
3662
- "username": this.userName,
3663
- "reportformatvalues": reportformatvalues,
3664
- "reportformatschema": reportformatschema,
3665
- "userid": this.userProfileId,
3666
- "userrole": this.myRole,
3667
- "year": this.calendarStartYYYY,
3668
- "module": event.isnotice != null ? "notices" : "events"
3669
- });
3670
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
3681
+ if (event.makercheckers.length > 0) {
3682
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
3683
+ for (var p = 0; p < this.events[mmdd].length; p++) {
3684
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
3685
+ this.events[mmdd][p].approved = true;
3686
+ // this.events[mmdd][p].documents = docs
3687
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
3688
+ this.events[mmdd][p].lastupdated = new Date().toString();
3689
+ }
3690
+ }
3671
3691
  }
3672
- else {
3673
- bulkBody.push({
3674
- "mmddyyyy": mmddyyyy,
3675
- "projectid": this.projectId,
3676
- "type": "report",
3677
- "eventid": eventId,
3678
- "comments": reportercomments,
3679
- "dateofcompletion": reporterdoc,
3680
- "entityid": entityId,
3681
- "locationid": locationId,
3682
- "event": null,
3683
- "docs": JSON.stringify(docs),
3684
- "username": this.userName,
3685
- "reportformatvalues": reportformatvalues,
3686
- "reportformatschema": reportformatschema,
3687
- "userid": this.userProfileId,
3688
- "userrole": this.myRole,
3689
- "year": this.calendarStartYYYY,
3690
- "module": event.isnotice != null ? "notices" : "events"
3691
- });
3692
+ if (this.recentlyReported[mmdd] == null) {
3693
+ this.recentlyReported[mmdd] = [];
3692
3694
  }
3693
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
3694
- // await this.sleep(2000);
3695
- // this.clearMessages();
3696
- }
3697
- // await this.uploadReportsBulk(bulkBody);
3698
- // await this.fetchBulkReportingData();
3699
- if (bulkBody.length > 0) {
3700
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
3695
+ this.recentlyReported[mmdd].push(event);
3696
+ console.log('recently reported', this.recentlyReported);
3701
3697
  }
3702
- if (bulkBodyReview.length > 0) {
3703
- await this.uploadReportsReviewsBulk(bulkBodyReview);
3704
- }
3705
- for (var k = 0; k < this.selectedItemIds.length; k++) {
3706
- const selectedId = this.selectedItemIds[k];
3707
- //console.log('selectedid', selectedId);
3708
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
3709
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
3710
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
3711
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
3712
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
3713
- for (var p = 0; p < this.events[mmdd].length; p++) {
3714
- if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
3715
- flagBulk = true;
3716
- this.events[mmdd][p].isbulk = true;
3717
- if (this.recentlyReported[mmdd] == null) {
3718
- this.recentlyReported[mmdd] = [];
3698
+ else {
3699
+ let bulkBody = [];
3700
+ let bulkBodyReview = [];
3701
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
3702
+ const selectedId = this.selectedItemIds[k];
3703
+ //console.log('selectedid', selectedId);
3704
+ const makercheckersL = selectedId.split('-')[5];
3705
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
3706
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
3707
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
3708
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
3709
+ //console.log(entityId, locationId, eventId, mmddyyyy);
3710
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
3711
+ if (parseInt(makercheckersL) > 0) {
3712
+ bulkBodyReview.push({
3713
+ "mmddyyyy": mmddyyyy,
3714
+ "projectid": this.projectId,
3715
+ "type": "report",
3716
+ "eventid": eventId,
3717
+ "comments": reportercomments,
3718
+ "dateofcompletion": reporterdoc,
3719
+ "percentage": percentage,
3720
+ "entityid": entityId,
3721
+ "locationid": locationId,
3722
+ "event": null,
3723
+ "docs": JSON.stringify(docs),
3724
+ "approved": true,
3725
+ "username": this.userName,
3726
+ "reportformatvalues": reportformatvalues,
3727
+ "reportformatschema": reportformatschema,
3728
+ "userid": this.userProfileId,
3729
+ "userrole": this.myRole,
3730
+ "year": this.calendarStartYYYY,
3731
+ "module": event.isnotice != null ? "notices" : "events"
3732
+ });
3733
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
3734
+ }
3735
+ else {
3736
+ bulkBody.push({
3737
+ "mmddyyyy": mmddyyyy,
3738
+ "projectid": this.projectId,
3739
+ "type": "report",
3740
+ "eventid": eventId,
3741
+ "comments": reportercomments,
3742
+ "dateofcompletion": reporterdoc,
3743
+ "percentage": percentage,
3744
+ "entityid": entityId,
3745
+ "locationid": locationId,
3746
+ "event": null,
3747
+ "docs": JSON.stringify(docs),
3748
+ "username": this.userName,
3749
+ "reportformatvalues": reportformatvalues,
3750
+ "reportformatschema": reportformatschema,
3751
+ "userid": this.userProfileId,
3752
+ "userrole": this.myRole,
3753
+ "year": this.calendarStartYYYY,
3754
+ "module": event.isnotice != null ? "notices" : "events"
3755
+ });
3756
+ }
3757
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
3758
+ // await this.sleep(2000);
3759
+ // this.clearMessages();
3760
+ }
3761
+ // await this.uploadReportsBulk(bulkBody);
3762
+ // await this.fetchBulkReportingData();
3763
+ if (bulkBody.length > 0) {
3764
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
3765
+ }
3766
+ if (bulkBodyReview.length > 0) {
3767
+ await this.uploadReportsReviewsBulk(bulkBodyReview);
3768
+ }
3769
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
3770
+ const selectedId = this.selectedItemIds[k];
3771
+ //console.log('selectedid', selectedId);
3772
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
3773
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
3774
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
3775
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
3776
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
3777
+ for (var p = 0; p < this.events[mmdd].length; p++) {
3778
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
3779
+ flagBulk = true;
3780
+ this.events[mmdd][p].isbulk = true;
3781
+ if (this.recentlyReported[mmdd] == null) {
3782
+ this.recentlyReported[mmdd] = [];
3783
+ }
3784
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
3719
3785
  }
3720
- this.recentlyReported[mmdd].push(this.events[mmdd][p]);
3721
3786
  }
3722
3787
  }
3723
3788
  }
3724
- }
3725
- if (this.mode == "next") {
3726
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
3727
- }
3728
- else {
3729
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
3730
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
3731
- // } else
3732
- if (this.getCurrentTab() == this.TAB_FIND) {
3733
- const searchString = this._SfFindContainer.querySelector('#stream-search').value;
3734
- this.processFindSelection(this._SfFindContainer, searchString);
3789
+ if (this.mode == "next") {
3790
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
3735
3791
  }
3736
3792
  else {
3737
- if (this.selectedItemIds.length > 0) {
3738
- await this.fetchBulkReportingData();
3793
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
3794
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
3795
+ // } else
3796
+ if (this.getCurrentTab() == this.TAB_FIND) {
3797
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
3798
+ this.processFindSelection(this._SfFindContainer, searchString);
3799
+ }
3800
+ else {
3801
+ if (this.selectedItemIds.length > 0) {
3802
+ await this.fetchBulkReportingData();
3803
+ }
3804
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
3805
+ // if(currentColumnButton != null) {
3806
+ // currentColumnButton.click();
3807
+ // }
3739
3808
  }
3740
- this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
3741
- // if(currentColumnButton != null) {
3742
- // currentColumnButton.click();
3743
- // }
3744
3809
  }
3745
3810
  }
3746
3811
  }
@@ -8346,27 +8411,31 @@ let SfIEvents = class SfIEvents extends LitElement {
8346
8411
  var dataScheduled = divContainer.querySelector('#graph-scheduled').innerHTML;
8347
8412
  var dataPartiallyComplied = divContainer.querySelector('#graph-partially-complied').innerHTML;
8348
8413
  var dataComplied = divContainer.querySelector('#graph-complied').innerHTML;
8414
+ var dataCompliedWithGaps = divContainer.querySelector('#graph-complied-with-gaps').innerHTML;
8415
+ var dataReportedNonComplaince = divContainer.querySelector('#graph-reported-non-compliance').innerHTML;
8349
8416
  const ctx = divContainer.querySelector('#myChart');
8350
8417
  this.showGraph(divContainer, 1);
8351
8418
  this.clearGraph(divContainer, 2);
8352
8419
  this.clearGraph(divContainer, 3);
8353
8420
  this.clearGraph(divContainer, 4);
8354
8421
  const data = {
8355
- labels: ['Scheduled', 'Not Complied', 'Partially Complied', 'Complied'],
8422
+ labels: ['Scheduled', 'Not Complied', 'Partially Complied', 'Complied', 'Complied With Gaps', 'Reported Non Compliance'],
8356
8423
  datasets: [{
8357
8424
  label: 'Compliances',
8358
- data: [dataScheduled, dataNotComplied, dataPartiallyComplied, dataComplied],
8425
+ data: [dataScheduled, dataNotComplied, dataPartiallyComplied, dataComplied, dataCompliedWithGaps, dataReportedNonComplaince],
8359
8426
  borderWidth: 1,
8360
8427
  backgroundColor: [
8361
8428
  this.COLOR_SCHEDULED,
8362
8429
  this.COLOR_NOT_COMPLIED,
8363
8430
  this.COLOR_PARTIALLY_COMPLIED,
8364
- this.COLOR_COMPLIED
8431
+ this.COLOR_COMPLIED,
8432
+ this.COLOR_COMPLIED_WITH_GAPS,
8433
+ this.COLOR_REPORTED_NON_COMPLIANCE
8365
8434
  ]
8366
8435
  }]
8367
8436
  };
8368
- this.csvGraphStats += 'Compliance,Scheduled,Not Complied,Partially Complied,Complied,Total\n';
8369
- this.csvGraphStats += 'Count,' + parseInt(dataScheduled) + ',' + parseInt(dataNotComplied) + ',' + parseInt(dataPartiallyComplied) + ',' + parseInt(dataComplied) + ',' + parseInt(dataTotal) + '\n';
8437
+ this.csvGraphStats += 'Compliance,Scheduled,Not Complied,Partially Complied,Complied,Complied With Gaps,Reported Non Compliance,Total\n';
8438
+ this.csvGraphStats += 'Count,' + parseInt(dataScheduled) + ',' + parseInt(dataNotComplied) + ',' + parseInt(dataPartiallyComplied) + ',' + parseInt(dataComplied) + ',' + parseInt(dataCompliedWithGaps) + ',' + parseInt(dataReportedNonComplaince) + ',' + parseInt(dataTotal) + '\n';
8370
8439
  //console.log('rendering timeliness graph', this.csvGraphStats);
8371
8440
  const itemsTimeliness = divContainer.querySelectorAll('.stat-timeliness');
8372
8441
  for (var i = 0; i < itemsTimeliness.length; i++) {
@@ -8572,6 +8641,8 @@ let SfIEvents = class SfIEvents extends LitElement {
8572
8641
  dataBar2['datasets'].push({});
8573
8642
  dataBar2['datasets'].push({});
8574
8643
  dataBar2['datasets'].push({});
8644
+ dataBar2['datasets'].push({});
8645
+ dataBar2['datasets'].push({});
8575
8646
  dataBar2['datasets'][0]['label'] = 'Scheduled';
8576
8647
  dataBar2['datasets'][0]['data'] = [];
8577
8648
  for (i = 0; i < Object.keys(complianceData).length; i++) {
@@ -8596,6 +8667,18 @@ let SfIEvents = class SfIEvents extends LitElement {
8596
8667
  dataBar2['datasets'][3]['data'].push(complianceData[Object.keys(complianceData)[i]]['complied']);
8597
8668
  }
8598
8669
  dataBar2['datasets'][3]['backgroundColor'] = this.COLOR_COMPLIED;
8670
+ dataBar2['datasets'][4]['label'] = 'Complied With Gaps';
8671
+ dataBar2['datasets'][4]['data'] = [];
8672
+ for (i = 0; i < Object.keys(complianceData).length; i++) {
8673
+ dataBar2['datasets'][4]['data'].push(complianceData[Object.keys(complianceData)[i]]['complied-with-gaps']);
8674
+ }
8675
+ dataBar2['datasets'][4]['backgroundColor'] = this.COLOR_COMPLIED_WITH_GAPS;
8676
+ dataBar2['datasets'][5]['label'] = 'Reported Non Compliance';
8677
+ dataBar2['datasets'][5]['data'] = [];
8678
+ for (i = 0; i < Object.keys(complianceData).length; i++) {
8679
+ dataBar2['datasets'][5]['data'].push(complianceData[Object.keys(complianceData)[i]]['reported-non-compliance']);
8680
+ }
8681
+ dataBar2['datasets'][5]['backgroundColor'] = this.COLOR_REPORTED_NON_COMPLIANCE;
8599
8682
  return dataBar2;
8600
8683
  };
8601
8684
  this.populateGraphDataPie = (pieData) => {
@@ -8665,7 +8748,7 @@ let SfIEvents = class SfIEvents extends LitElement {
8665
8748
  // 4
8666
8749
  //console.log('rendering compliance matrix', complianceData);
8667
8750
  const dataBar3 = this.populateGraphDataBarCompliance(complianceData);
8668
- //console.log('rendering compliance matrix', dataBar3);
8751
+ console.log('rendering compliance matrix', dataBar3);
8669
8752
  const ctx4 = divContainer.querySelector('#myChart4');
8670
8753
  this.showGraph(divContainer, 4);
8671
8754
  this.renderChart4(ctx4, 'bar', dataBar3, param + " vs Compliance");
@@ -9231,178 +9314,194 @@ let SfIEvents = class SfIEvents extends LitElement {
9231
9314
  reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
9232
9315
  reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
9233
9316
  }
9234
- if (docs.length === 0 && docsOptional.length === 0) {
9317
+ let percentage = "100";
9318
+ if (this._SfDetailContainer.querySelector('#input-reporter-percentage') != null) {
9319
+ percentage = this._SfDetailContainer.querySelector('#input-reporter-percentage').value;
9320
+ }
9321
+ if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
9235
9322
  //console.log('reporter comments 3', reportercomments);
9236
9323
  buttonClick.innerHTML = "Save";
9237
- this.setError('No documents uploaded!');
9324
+ this.setError('Invalid Percentage!');
9238
9325
  setTimeout(() => {
9239
9326
  this.clearMessages();
9240
9327
  }, 3000);
9241
9328
  }
9242
9329
  else {
9243
- //console.log('reporterdoc', reporterdoc);
9244
- if (reporterdoc.length === 0) {
9330
+ if (docs.length === 0 && docsOptional.length === 0) {
9331
+ //console.log('reporter comments 3', reportercomments);
9245
9332
  buttonClick.innerHTML = "Save";
9246
- this.setError('Date of completion not selected!');
9333
+ this.setError('No documents uploaded!');
9247
9334
  setTimeout(() => {
9248
9335
  this.clearMessages();
9249
9336
  }, 3000);
9250
9337
  }
9251
9338
  else {
9252
- //console.log('makerscheckers 1', reportercomments);
9253
- if (reportercomments.trim().length === 0) {
9339
+ //console.log('reporterdoc', reporterdoc);
9340
+ if (reporterdoc.length === 0) {
9254
9341
  buttonClick.innerHTML = "Save";
9255
- this.setError('Comments cannot be blank!');
9342
+ this.setError('Date of completion not selected!');
9256
9343
  setTimeout(() => {
9257
9344
  this.clearMessages();
9258
9345
  }, 3000);
9259
9346
  }
9260
9347
  else {
9261
- var clickEvent = new MouseEvent("click", {
9262
- "view": window,
9263
- "bubbles": true,
9264
- "cancelable": false
9265
- });
9266
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9267
- let flagBulk = false;
9268
- if (this.selectedItemIds.length === 0) {
9269
- await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices");
9270
- console.log('this.events', this.events);
9271
- for (var p = 0; p < this.events[mmdd].length; p++) {
9272
- if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9273
- this.events[mmdd][p].documents = docs;
9274
- this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
9275
- this.events[mmdd][p].lastupdated = new Date().toString();
9276
- }
9277
- }
9278
- console.log('uploadReport single');
9279
- if (makercheckers.length > 0) {
9280
- await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
9348
+ //console.log('makerscheckers 1', reportercomments);
9349
+ if (reportercomments.trim().length === 0) {
9350
+ buttonClick.innerHTML = "Save";
9351
+ this.setError('Comments cannot be blank!');
9352
+ setTimeout(() => {
9353
+ this.clearMessages();
9354
+ }, 3000);
9355
+ }
9356
+ else {
9357
+ var clickEvent = new MouseEvent("click", {
9358
+ "view": window,
9359
+ "bubbles": true,
9360
+ "cancelable": false
9361
+ });
9362
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
9363
+ let flagBulk = false;
9364
+ if (this.selectedItemIds.length === 0) {
9365
+ await this.uploadReport(entityId, locationId, mmddyyyy, listEvent["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, "notices", percentage);
9366
+ console.log('this.events', this.events);
9281
9367
  for (var p = 0; p < this.events[mmdd].length; p++) {
9282
9368
  if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9283
- this.events[mmdd][p].approved = true;
9284
- // this.events[mmdd][p].documents = docs
9285
- this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
9369
+ this.events[mmdd][p].documents = docs;
9370
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
9286
9371
  this.events[mmdd][p].lastupdated = new Date().toString();
9287
9372
  }
9288
9373
  }
9289
- console.log('upload report auto approve single');
9290
- }
9291
- if (this.recentlyReported[mmdd] == null) {
9292
- this.recentlyReported[mmdd] = [];
9293
- }
9294
- this.recentlyReported[mmdd].push(event);
9295
- }
9296
- else {
9297
- let bulkBody = [];
9298
- let bulkBodyReview = [];
9299
- for (var k = 0; k < this.selectedItemIds.length; k++) {
9300
- const selectedId = this.selectedItemIds[k];
9301
- //console.log('selectedid', selectedId);
9302
- const makercheckersL = selectedId.split('-')[5];
9303
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
9304
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
9305
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9306
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9307
- //console.log(entityId, locationId, eventId, mmddyyyy);
9308
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
9309
- if (parseInt(makercheckersL) > 0) {
9310
- bulkBodyReview.push({
9311
- "mmddyyyy": mmddyyyy,
9312
- "projectid": this.projectId,
9313
- "type": "report",
9314
- "eventid": eventId,
9315
- "comments": reportercomments,
9316
- "dateofcompletion": reporterdoc,
9317
- "entityid": entityId,
9318
- "locationid": locationId,
9319
- "event": null,
9320
- "docs": JSON.stringify(docs),
9321
- "approved": true,
9322
- "username": this.userName,
9323
- "reportformatvalues": reportformatvalues,
9324
- "reportformatschema": reportformatschema,
9325
- "userid": this.userProfileId,
9326
- "userrole": this.myRole,
9327
- "year": this.calendarStartYYYY,
9328
- "module": listEvent.isnotice != null ? "notices" : "events"
9329
- });
9330
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
9374
+ console.log('uploadReport single');
9375
+ if (makercheckers.length > 0) {
9376
+ await this.uploadReview(entityId, locationId, mmddyyyy, listEvent["id"], "Auto approved", true, "notices");
9377
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9378
+ if (this.events[mmdd][p].id == listEvent.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9379
+ this.events[mmdd][p].approved = true;
9380
+ // this.events[mmdd][p].documents = docs
9381
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
9382
+ this.events[mmdd][p].lastupdated = new Date().toString();
9383
+ }
9384
+ }
9385
+ console.log('upload report auto approve single');
9331
9386
  }
9332
- else {
9333
- bulkBody.push({
9334
- "mmddyyyy": mmddyyyy,
9335
- "projectid": this.projectId,
9336
- "type": "report",
9337
- "eventid": eventId,
9338
- "comments": reportercomments,
9339
- "dateofcompletion": reporterdoc,
9340
- "entityid": entityId,
9341
- "locationid": locationId,
9342
- "event": null,
9343
- "docs": JSON.stringify(docs),
9344
- "username": this.userName,
9345
- "reportformatvalues": reportformatvalues,
9346
- "reportformatschema": reportformatschema,
9347
- "userid": this.userProfileId,
9348
- "userrole": this.myRole,
9349
- "year": this.calendarStartYYYY,
9350
- "module": listEvent.isnotice != null ? "notices" : "events"
9351
- });
9387
+ if (this.recentlyReported[mmdd] == null) {
9388
+ this.recentlyReported[mmdd] = [];
9352
9389
  }
9353
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
9354
- // await this.sleep(2000);
9355
- // this.clearMessages();
9356
- }
9357
- // await this.uploadReportsBulk(bulkBody);
9358
- // await this.fetchBulkReportingData();
9359
- if (bulkBody.length > 0) {
9360
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
9390
+ this.recentlyReported[mmdd].push(event);
9361
9391
  }
9362
- if (bulkBodyReview.length > 0) {
9363
- await this.uploadReportsReviewsBulk(bulkBodyReview);
9364
- }
9365
- await this.fetchBulkReportingData();
9366
- console.log('uploadReport bulk');
9367
- for (var k = 0; k < this.selectedItemIds.length; k++) {
9368
- const selectedId = this.selectedItemIds[k];
9369
- //console.log('selectedid', selectedId);
9370
- let entityId = selectedId.split('-')[7].replace(/_/g, '-');
9371
- let locationId = selectedId.split('-')[8].replace(/_/g, '-');
9372
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9373
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9374
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9375
- for (var p = 0; p < this.events[mmdd].length; p++) {
9376
- if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9377
- this.events[mmdd][p].isbulk = true;
9378
- flagBulk = true;
9379
- if (this.recentlyReported[mmdd] == null) {
9380
- this.recentlyReported[mmdd] = [];
9392
+ else {
9393
+ let bulkBody = [];
9394
+ let bulkBodyReview = [];
9395
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9396
+ const selectedId = this.selectedItemIds[k];
9397
+ //console.log('selectedid', selectedId);
9398
+ const makercheckersL = selectedId.split('-')[5];
9399
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
9400
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
9401
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9402
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9403
+ //console.log(entityId, locationId, eventId, mmddyyyy);
9404
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
9405
+ if (parseInt(makercheckersL) > 0) {
9406
+ bulkBodyReview.push({
9407
+ "mmddyyyy": mmddyyyy,
9408
+ "projectid": this.projectId,
9409
+ "type": "report",
9410
+ "eventid": eventId,
9411
+ "comments": reportercomments,
9412
+ "dateofcompletion": reporterdoc,
9413
+ "percentage": percentage,
9414
+ "entityid": entityId,
9415
+ "locationid": locationId,
9416
+ "event": null,
9417
+ "docs": JSON.stringify(docs),
9418
+ "approved": true,
9419
+ "username": this.userName,
9420
+ "reportformatvalues": reportformatvalues,
9421
+ "reportformatschema": reportformatschema,
9422
+ "userid": this.userProfileId,
9423
+ "userrole": this.myRole,
9424
+ "year": this.calendarStartYYYY,
9425
+ "module": listEvent.isnotice != null ? "notices" : "events"
9426
+ });
9427
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
9428
+ }
9429
+ else {
9430
+ bulkBody.push({
9431
+ "mmddyyyy": mmddyyyy,
9432
+ "projectid": this.projectId,
9433
+ "type": "report",
9434
+ "eventid": eventId,
9435
+ "comments": reportercomments,
9436
+ "dateofcompletion": reporterdoc,
9437
+ "percentage": percentage,
9438
+ "entityid": entityId,
9439
+ "locationid": locationId,
9440
+ "event": null,
9441
+ "docs": JSON.stringify(docs),
9442
+ "username": this.userName,
9443
+ "reportformatvalues": reportformatvalues,
9444
+ "reportformatschema": reportformatschema,
9445
+ "userid": this.userProfileId,
9446
+ "userrole": this.myRole,
9447
+ "year": this.calendarStartYYYY,
9448
+ "module": listEvent.isnotice != null ? "notices" : "events"
9449
+ });
9450
+ }
9451
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
9452
+ // await this.sleep(2000);
9453
+ // this.clearMessages();
9454
+ }
9455
+ // await this.uploadReportsBulk(bulkBody);
9456
+ // await this.fetchBulkReportingData();
9457
+ if (bulkBody.length > 0) {
9458
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
9459
+ }
9460
+ if (bulkBodyReview.length > 0) {
9461
+ await this.uploadReportsReviewsBulk(bulkBodyReview);
9462
+ }
9463
+ await this.fetchBulkReportingData();
9464
+ console.log('uploadReport bulk');
9465
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
9466
+ const selectedId = this.selectedItemIds[k];
9467
+ //console.log('selectedid', selectedId);
9468
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
9469
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
9470
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
9471
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
9472
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
9473
+ for (var p = 0; p < this.events[mmdd].length; p++) {
9474
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
9475
+ this.events[mmdd][p].isbulk = true;
9476
+ flagBulk = true;
9477
+ if (this.recentlyReported[mmdd] == null) {
9478
+ this.recentlyReported[mmdd] = [];
9479
+ }
9480
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
9381
9481
  }
9382
- this.recentlyReported[mmdd].push(this.events[mmdd][p]);
9383
9482
  }
9384
9483
  }
9385
9484
  }
9386
- }
9387
- if (this.mode == "next") {
9388
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
9389
- }
9390
- else {
9391
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9392
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9393
- // } else
9394
- if (this.getCurrentTab() == this.TAB_FIND) {
9395
- const searchString = this._SfFindContainer.querySelector('#stream-search').value;
9396
- this.processFindSelection(this._SfFindContainer, searchString);
9485
+ if (this.mode == "next") {
9486
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
9397
9487
  }
9398
9488
  else {
9399
- if (this.selectedItemIds.length > 0) {
9400
- await this.fetchBulkReportingData();
9489
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
9490
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
9491
+ // } else
9492
+ if (this.getCurrentTab() == this.TAB_FIND) {
9493
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
9494
+ this.processFindSelection(this._SfFindContainer, searchString);
9495
+ }
9496
+ else {
9497
+ if (this.selectedItemIds.length > 0) {
9498
+ await this.fetchBulkReportingData();
9499
+ }
9500
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
9501
+ // if(currentColumnButton != null) {
9502
+ // currentColumnButton.click();
9503
+ // }
9401
9504
  }
9402
- this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
9403
- // if(currentColumnButton != null) {
9404
- // currentColumnButton.click();
9405
- // }
9406
9505
  }
9407
9506
  }
9408
9507
  }
@@ -9493,7 +9592,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9493
9592
  };
9494
9593
  this.fetchEventDetails = async (listEvent, mmddyyyy, currentColumnButton, eventsContainer) => {
9495
9594
  console.log('listEvent', listEvent, listEvent.id);
9496
- let url = "https://" + this.apiId + "/getalleventdetails";
9595
+ let url = "https://" + this.apiId + "/getalleventdetails1";
9497
9596
  //console.log('fetch calendar url', url);
9498
9597
  let urlBody = { "projectid": this.projectId, "userprofileid": this.userProfileId, "role": this.myRole, "eventid": listEvent.id, "entityid": listEvent.entityid, "locationid": listEvent.locationid, "mmddyyyy": mmddyyyy, "year": this.calendarStartYYYY };
9499
9598
  //console.log('urlbody', urlBody);
@@ -10351,195 +10450,211 @@ let SfIEvents = class SfIEvents extends LitElement {
10351
10450
  reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
10352
10451
  reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
10353
10452
  }
10354
- if (docs.length === 0 && docsOptional.length === 0) {
10453
+ let percentage = "100";
10454
+ if (this._SfDetailContainer.querySelector('#input-reporter-percentage') != null) {
10455
+ percentage = this._SfDetailContainer.querySelector('#input-reporter-percentage').value;
10456
+ }
10457
+ if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
10355
10458
  //console.log('reporter comments 3', reportercomments);
10356
10459
  buttonClick.innerHTML = "Save";
10357
- this.setError('No documents uploaded!');
10460
+ this.setError('Invalid Percentage!');
10358
10461
  setTimeout(() => {
10359
10462
  this.clearMessages();
10360
10463
  }, 3000);
10361
10464
  }
10362
10465
  else {
10363
- //console.log('reporterdoc', reporterdoc);
10364
- if (reporterdoc.length === 0) {
10466
+ if (docs.length === 0 && docsOptional.length === 0) {
10467
+ //console.log('reporter comments 3', reportercomments);
10365
10468
  buttonClick.innerHTML = "Save";
10366
- this.setError('Date of completion not selected!');
10469
+ this.setError('No documents uploaded!');
10367
10470
  setTimeout(() => {
10368
10471
  this.clearMessages();
10369
10472
  }, 3000);
10370
10473
  }
10371
10474
  else {
10372
- //console.log('makerscheckers 1', reportercomments);
10373
- if (reportercomments.trim().length === 0) {
10475
+ //console.log('reporterdoc', reporterdoc);
10476
+ if (reporterdoc.length === 0) {
10374
10477
  buttonClick.innerHTML = "Save";
10375
- this.setError('Comments cannot be blank!');
10478
+ this.setError('Date of completion not selected!');
10376
10479
  setTimeout(() => {
10377
10480
  this.clearMessages();
10378
10481
  }, 3000);
10379
10482
  }
10380
10483
  else {
10381
- var clickEvent = new MouseEvent("click", {
10382
- "view": window,
10383
- "bubbles": true,
10384
- "cancelable": false
10385
- });
10386
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
10387
- let flagBulk = false;
10388
- if (this.selectedItemIds.length === 0) {
10389
- //console.log('makerscheckers', makercheckers, reportercomments);
10390
- // console.log('reportformatvalues', reportformatvalues)
10391
- // console.log('reportformatschema',reportformatschema)
10392
- await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events");
10393
- console.log('this.events', this.events);
10394
- for (var p = 0; p < this.events[mmdd].length; p++) {
10395
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10396
- this.events[mmdd][p].documents = docs;
10397
- this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
10398
- this.events[mmdd][p].lastupdated = new Date().toString();
10399
- }
10400
- }
10401
- if (makercheckers.length > 0) {
10402
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
10484
+ //console.log('makerscheckers 1', reportercomments);
10485
+ if (reportercomments.trim().length === 0) {
10486
+ buttonClick.innerHTML = "Save";
10487
+ this.setError('Comments cannot be blank!');
10488
+ setTimeout(() => {
10489
+ this.clearMessages();
10490
+ }, 3000);
10491
+ }
10492
+ else {
10493
+ var clickEvent = new MouseEvent("click", {
10494
+ "view": window,
10495
+ "bubbles": true,
10496
+ "cancelable": false
10497
+ });
10498
+ this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
10499
+ let flagBulk = false;
10500
+ if (this.selectedItemIds.length === 0) {
10501
+ //console.log('makerscheckers', makercheckers, reportercomments);
10502
+ // console.log('reportformatvalues', reportformatvalues)
10503
+ // console.log('reportformatschema',reportformatschema)
10504
+ await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.isnotice != null ? "notices" : "events", percentage);
10505
+ console.log('this.events', this.events);
10403
10506
  for (var p = 0; p < this.events[mmdd].length; p++) {
10404
10507
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10405
- this.events[mmdd][p].approved = true;
10406
- // this.events[mmdd][p].documents = docs
10407
- this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
10508
+ this.events[mmdd][p].documents = docs;
10509
+ this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
10408
10510
  this.events[mmdd][p].lastupdated = new Date().toString();
10409
10511
  }
10410
10512
  }
10411
- }
10412
- if (this.recentlyReported[mmdd] == null) {
10413
- this.recentlyReported[mmdd] = [];
10414
- }
10415
- this.recentlyReported[mmdd].push(event);
10416
- }
10417
- else {
10418
- let bulkBody = [];
10419
- let bulkBodyReview = [];
10420
- for (var k = 0; k < this.selectedItemIds.length; k++) {
10421
- const selectedId = this.selectedItemIds[k];
10422
- //console.log('selectedid', selectedId);
10423
- const makercheckersL = selectedId.split('-')[5];
10424
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
10425
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
10426
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
10427
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10428
- //console.log(entityId, locationId, eventId, mmddyyyy);
10429
- // bulkBody.push({
10430
- // "mmddyyyy": mmddyyyy,
10431
- // "projectid": this.projectId,
10432
- // "type": "report",
10433
- // "eventid": eventId,
10434
- // "comments": reportercomments,
10435
- // "dateofcompletion": reporterdoc,
10436
- // "entityid": entityId,
10437
- // "locationid": locationId,
10438
- // "event": null,
10439
- // "docs": JSON.stringify(docs),
10440
- // "username": this.userName,
10441
- // "reportformatvalues": reportformatvalues,
10442
- // "reportformatschema": reportformatschema,
10443
- // "userid": this.userProfileId,
10444
- // "userrole": this.myRole,
10445
- // "year": this.calendarStartYYYY,
10446
- // "module": event.isnotice != null ? "notices" : "events"
10447
- // })
10448
- // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10449
- if (parseInt(makercheckersL) > 0) {
10450
- bulkBodyReview.push({
10451
- "mmddyyyy": mmddyyyy,
10452
- "projectid": this.projectId,
10453
- "type": "report",
10454
- "eventid": eventId,
10455
- "comments": reportercomments,
10456
- "dateofcompletion": reporterdoc,
10457
- "entityid": entityId,
10458
- "locationid": locationId,
10459
- "event": null,
10460
- "docs": JSON.stringify(docs),
10461
- "approved": true,
10462
- "username": this.userName,
10463
- "reportformatvalues": reportformatvalues,
10464
- "reportformatschema": reportformatschema,
10465
- "userid": this.userProfileId,
10466
- "userrole": this.myRole,
10467
- "year": this.calendarStartYYYY,
10468
- "module": event.isnotice != null ? "notices" : "events"
10469
- });
10470
- // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10513
+ if (makercheckers.length > 0) {
10514
+ await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.isnotice != null ? "notices" : "events");
10515
+ for (var p = 0; p < this.events[mmdd].length; p++) {
10516
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10517
+ this.events[mmdd][p].approved = true;
10518
+ // this.events[mmdd][p].documents = docs
10519
+ this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
10520
+ this.events[mmdd][p].lastupdated = new Date().toString();
10521
+ }
10522
+ }
10471
10523
  }
10472
- else {
10473
- bulkBody.push({
10474
- "mmddyyyy": mmddyyyy,
10475
- "projectid": this.projectId,
10476
- "type": "report",
10477
- "eventid": eventId,
10478
- "comments": reportercomments,
10479
- "dateofcompletion": reporterdoc,
10480
- "entityid": entityId,
10481
- "locationid": locationId,
10482
- "event": null,
10483
- "docs": JSON.stringify(docs),
10484
- "username": this.userName,
10485
- "reportformatvalues": reportformatvalues,
10486
- "reportformatschema": reportformatschema,
10487
- "userid": this.userProfileId,
10488
- "userrole": this.myRole,
10489
- "year": this.calendarStartYYYY,
10490
- "module": event.isnotice != null ? "notices" : "events"
10491
- });
10524
+ if (this.recentlyReported[mmdd] == null) {
10525
+ this.recentlyReported[mmdd] = [];
10492
10526
  }
10493
- // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10494
- // await this.sleep(2000);
10495
- // this.clearMessages();
10496
- }
10497
- if (bulkBody.length > 0) {
10498
- await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
10527
+ this.recentlyReported[mmdd].push(event);
10499
10528
  }
10500
- // await this.fetchBulkReportingData();
10501
- if (bulkBodyReview.length > 0) {
10502
- await this.uploadReportsReviewsBulk(bulkBodyReview);
10503
- }
10504
- for (var k = 0; k < this.selectedItemIds.length; k++) {
10505
- const selectedId = this.selectedItemIds[k];
10506
- //console.log('selectedid', selectedId);
10507
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
10508
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
10509
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
10510
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10511
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
10512
- for (var p = 0; p < this.events[mmdd].length; p++) {
10513
- if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10514
- this.events[mmdd][p].isbulk = true;
10515
- flagBulk = true;
10516
- if (this.recentlyReported[mmdd] == null) {
10517
- this.recentlyReported[mmdd] = [];
10529
+ else {
10530
+ let bulkBody = [];
10531
+ let bulkBodyReview = [];
10532
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
10533
+ const selectedId = this.selectedItemIds[k];
10534
+ //console.log('selectedid', selectedId);
10535
+ const makercheckersL = selectedId.split('-')[5];
10536
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
10537
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
10538
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
10539
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10540
+ //console.log(entityId, locationId, eventId, mmddyyyy);
10541
+ // bulkBody.push({
10542
+ // "mmddyyyy": mmddyyyy,
10543
+ // "projectid": this.projectId,
10544
+ // "type": "report",
10545
+ // "eventid": eventId,
10546
+ // "comments": reportercomments,
10547
+ // "dateofcompletion": reporterdoc,
10548
+ // "entityid": entityId,
10549
+ // "locationid": locationId,
10550
+ // "event": null,
10551
+ // "docs": JSON.stringify(docs),
10552
+ // "username": this.userName,
10553
+ // "reportformatvalues": reportformatvalues,
10554
+ // "reportformatschema": reportformatschema,
10555
+ // "userid": this.userProfileId,
10556
+ // "userrole": this.myRole,
10557
+ // "year": this.calendarStartYYYY,
10558
+ // "module": event.isnotice != null ? "notices" : "events"
10559
+ // })
10560
+ // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
10561
+ if (parseInt(makercheckersL) > 0) {
10562
+ bulkBodyReview.push({
10563
+ "mmddyyyy": mmddyyyy,
10564
+ "projectid": this.projectId,
10565
+ "type": "report",
10566
+ "eventid": eventId,
10567
+ "comments": reportercomments,
10568
+ "dateofcompletion": reporterdoc,
10569
+ "percentage": percentage,
10570
+ "entityid": entityId,
10571
+ "locationid": locationId,
10572
+ "event": null,
10573
+ "docs": JSON.stringify(docs),
10574
+ "approved": true,
10575
+ "username": this.userName,
10576
+ "reportformatvalues": reportformatvalues,
10577
+ "reportformatschema": reportformatschema,
10578
+ "userid": this.userProfileId,
10579
+ "userrole": this.myRole,
10580
+ "year": this.calendarStartYYYY,
10581
+ "module": event.isnotice != null ? "notices" : "events"
10582
+ });
10583
+ // await this.uploadReview(entityId, locationId, mmddyyyy, eventId, "Auto approved", true);
10584
+ }
10585
+ else {
10586
+ bulkBody.push({
10587
+ "mmddyyyy": mmddyyyy,
10588
+ "projectid": this.projectId,
10589
+ "type": "report",
10590
+ "eventid": eventId,
10591
+ "comments": reportercomments,
10592
+ "dateofcompletion": reporterdoc,
10593
+ "percentage": percentage,
10594
+ "entityid": entityId,
10595
+ "locationid": locationId,
10596
+ "event": null,
10597
+ "docs": JSON.stringify(docs),
10598
+ "username": this.userName,
10599
+ "reportformatvalues": reportformatvalues,
10600
+ "reportformatschema": reportformatschema,
10601
+ "userid": this.userProfileId,
10602
+ "userrole": this.myRole,
10603
+ "year": this.calendarStartYYYY,
10604
+ "module": event.isnotice != null ? "notices" : "events"
10605
+ });
10606
+ }
10607
+ // this.setSuccess("Updating " + (k + 1) + "/" + this.selectedItemIds.length + ", please wait...");
10608
+ // await this.sleep(2000);
10609
+ // this.clearMessages();
10610
+ }
10611
+ if (bulkBody.length > 0) {
10612
+ await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
10613
+ }
10614
+ // await this.fetchBulkReportingData();
10615
+ if (bulkBodyReview.length > 0) {
10616
+ await this.uploadReportsReviewsBulk(bulkBodyReview);
10617
+ }
10618
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
10619
+ const selectedId = this.selectedItemIds[k];
10620
+ //console.log('selectedid', selectedId);
10621
+ entityId = selectedId.split('-')[7].replace(/_/g, '-');
10622
+ locationId = selectedId.split('-')[8].replace(/_/g, '-');
10623
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
10624
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
10625
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
10626
+ for (var p = 0; p < this.events[mmdd].length; p++) {
10627
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
10628
+ this.events[mmdd][p].isbulk = true;
10629
+ flagBulk = true;
10630
+ if (this.recentlyReported[mmdd] == null) {
10631
+ this.recentlyReported[mmdd] = [];
10632
+ }
10633
+ this.recentlyReported[mmdd].push(this.events[mmdd][p]);
10518
10634
  }
10519
- this.recentlyReported[mmdd].push(this.events[mmdd][p]);
10520
10635
  }
10521
10636
  }
10522
10637
  }
10523
- }
10524
- if (this.mode == "next") {
10525
- this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
10526
- }
10527
- else {
10528
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
10529
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
10530
- // } else
10531
- if (this.getCurrentTab() == this.TAB_FIND) {
10532
- const searchString = this._SfFindContainer.querySelector('#stream-search').value;
10533
- this.processFindSelection(this._SfFindContainer, searchString);
10638
+ if (this.mode == "next") {
10639
+ this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus);
10534
10640
  }
10535
10641
  else {
10536
- if (this.selectedItemIds.length > 0) {
10537
- await this.fetchBulkReportingData();
10642
+ // if(this.getCurrentTab() == this.TAB_CUSTOM) {
10643
+ // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
10644
+ // } else
10645
+ if (this.getCurrentTab() == this.TAB_FIND) {
10646
+ const searchString = this._SfFindContainer.querySelector('#stream-search').value;
10647
+ this.processFindSelection(this._SfFindContainer, searchString);
10648
+ }
10649
+ else {
10650
+ if (this.selectedItemIds.length > 0) {
10651
+ await this.fetchBulkReportingData();
10652
+ }
10653
+ this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
10654
+ // if(currentColumnButton != null) {
10655
+ // currentColumnButton.click();
10656
+ // }
10538
10657
  }
10539
- this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
10540
- // if(currentColumnButton != null) {
10541
- // currentColumnButton.click();
10542
- // }
10543
10658
  }
10544
10659
  }
10545
10660
  }
@@ -14397,6 +14512,12 @@ let SfIEvents = class SfIEvents extends LitElement {
14397
14512
  .color-complied {
14398
14513
  color: #50cf01;
14399
14514
  }
14515
+ .color-complied-with-gaps {
14516
+ color: #ffe505;
14517
+ }
14518
+ .color-reported-non-compliance {
14519
+ color: #840B0F;
14520
+ }
14400
14521
  .color-scheduled {
14401
14522
  color: #888888;
14402
14523
  }
@@ -15639,6 +15760,9 @@ let SfIEvents = class SfIEvents extends LitElement {
15639
15760
  let graphparamname1Arr = graphparamnames1[i].innerHTML.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ').split(' • ');
15640
15761
  let filterFound = false;
15641
15762
  for (let tempFilterStr of graphparamname1Arr) {
15763
+ if (clickedValue == "reported non compliance") {
15764
+ console.log('comparing filter', tempFilterStr, this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' '));
15765
+ }
15642
15766
  if (tempFilterStr == this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ') || this.graphParam.toLowerCase().replace('&amp;', '&').replace(/-/g, ' ') == "") {
15643
15767
  filterFound = true;
15644
15768
  break;
@@ -16906,7 +17030,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16906
17030
  }
16907
17031
  };
16908
17032
  this.uploadReportsReviewsBulk = async (bulkBody) => {
16909
- let url = "https://" + this.apiId + "/uploadreportsreviewsbulk1";
17033
+ let url = "https://" + this.apiId + "/uploadreportsreviewsbulk2";
16910
17034
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
16911
17035
  const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
16912
17036
  this._SfLoader.innerHTML = '';
@@ -16943,8 +17067,8 @@ let SfIEvents = class SfIEvents extends LitElement {
16943
17067
  }, 3000);
16944
17068
  }
16945
17069
  };
16946
- this.uploadReport = async (entityId, locationId, mmddyyyy, eventid, comments, doc, docs, event, reportformatvalues = "", reportformatschema = "", module = "events") => {
16947
- let url = "https://" + this.apiId + "/uploadreport1";
17070
+ this.uploadReport = async (entityId, locationId, mmddyyyy, eventid, comments, doc, docs, event, reportformatvalues = "", reportformatschema = "", module = "events", percentage = "100") => {
17071
+ let url = "https://" + this.apiId + "/uploadreport2";
16948
17072
  let body = {
16949
17073
  "mmddyyyy": mmddyyyy,
16950
17074
  "projectid": this.projectId,
@@ -16952,6 +17076,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16952
17076
  "eventid": eventid,
16953
17077
  "comments": comments,
16954
17078
  "dateofcompletion": doc,
17079
+ "percentage": percentage,
16955
17080
  "entityid": entityId,
16956
17081
  "locationid": locationId,
16957
17082
  "event": event == null ? null : JSON.stringify(event),
@@ -16992,7 +17117,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16992
17117
  }
16993
17118
  };
16994
17119
  this.uploadReportsBulk = async (bulkBody, showSuccess = true) => {
16995
- let url = "https://" + this.apiId + "/uploadreportsbulk1";
17120
+ let url = "https://" + this.apiId + "/uploadreportsbulk2";
16996
17121
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
16997
17122
  const xhr = (await this.prepareXhr(bulkBody, url, this._SfLoader, authorization));
16998
17123
  if (showSuccess) {
@@ -18252,7 +18377,7 @@ let SfIEvents = class SfIEvents extends LitElement {
18252
18377
  else {
18253
18378
  view = "entity";
18254
18379
  }
18255
- path = "getallcountryevents2";
18380
+ path = "getallcountryevents3";
18256
18381
  let sDate = "";
18257
18382
  let eDate = "";
18258
18383
  //console.log('currenttab', this.getCurrentTab());
@@ -19095,7 +19220,7 @@ let SfIEvents = class SfIEvents extends LitElement {
19095
19220
  console.log('eventsData', eventsData);
19096
19221
  console.log('role', role);
19097
19222
  // if(Object.keys(eventsData[role]).length > 0){
19098
- 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;
19223
+ 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;
19099
19224
  var html = '';
19100
19225
  this.selectedItemIds = [];
19101
19226
  this.selectedStatus = "";
@@ -19121,7 +19246,7 @@ let SfIEvents = class SfIEvents extends LitElement {
19121
19246
  var complianceStatus = "";
19122
19247
  partStatus = this.getCompletenessStatus(JSON.parse(JSON.stringify(eventsData[role][mmdd][j])));
19123
19248
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(eventsData[role][mmdd][j])), partStatus);
19124
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
19249
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(eventsData[role][mmdd][j])).percentage);
19125
19250
  notStarted = notStarted + (partStatus == "not-started" ? 1 : 0);
19126
19251
  pendingApproval = pendingApproval + (partStatus == "pending-approval" ? 1 : 0);
19127
19252
  rejected = rejected + (partStatus == "rejected" ? 1 : 0);
@@ -19135,6 +19260,8 @@ let SfIEvents = class SfIEvents extends LitElement {
19135
19260
  partiallyComplied = partiallyComplied + (complianceStatus == "partially-complied" ? 1 : 0);
19136
19261
  notComplied = notComplied + (complianceStatus == "not-complied" ? 1 : 0);
19137
19262
  complied = complied + (complianceStatus == "complied" ? 1 : 0);
19263
+ compliedWithGaps = compliedWithGaps + (complianceStatus == "complied-with-gaps" ? 1 : 0);
19264
+ reportedNonCompliance = reportedNonCompliance + (complianceStatus == "reported-non-compliance" ? 1 : 0);
19138
19265
  eventsData[role][mmdd][j][this.FLOW_GRAPH_COMPLETENESS] = partStatus;
19139
19266
  eventsData[role][mmdd][j][this.FLOW_GRAPH_TIMELINESS] = lateStatus;
19140
19267
  eventsData[role][mmdd][j][this.FLOW_GRAPH_COMPLIANCE] = complianceStatus;
@@ -19623,7 +19750,7 @@ let SfIEvents = class SfIEvents extends LitElement {
19623
19750
  continue;
19624
19751
  }
19625
19752
  lateStatus = this.getTimelinessStatus(mmdd, JSON.parse(JSON.stringify(eventsData[mmdd][j])), partStatus);
19626
- complianceStatus = this.getComplianceStatus(partStatus, lateStatus);
19753
+ complianceStatus = this.getComplianceStatus(partStatus, lateStatus, JSON.parse(JSON.stringify(eventsData[mmdd][j])).percentage);
19627
19754
  // notStarted = notStarted + (partStatus == "not-started" ? 1 : 0);
19628
19755
  // pendingApproval = pendingApproval + (partStatus == "pending-approval" ? 1 : 0);
19629
19756
  // rejected = rejected + (partStatus == "rejected" ? 1 : 0);
@@ -20778,6 +20905,12 @@ SfIEvents.styles = css `
20778
20905
  .color-complied {
20779
20906
  color: #50cf01;
20780
20907
  }
20908
+ .color-complied-with-gaps {
20909
+ color: #ffe505;
20910
+ }
20911
+ .color-reported-non-compliance {
20912
+ color: #840B0F;
20913
+ }
20781
20914
  .color-scheduled {
20782
20915
  color: #888888;
20783
20916
  }