sf-i-events 1.0.949 → 1.0.951

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/sf-i-events.js CHANGED
@@ -153,6 +153,7 @@ let SfIEvents = class SfIEvents extends LitElement {
153
153
  padding-left: 20px;
154
154
  padding-right: 20px;
155
155
  border-radius: 10px;
156
+ position: relative;
156
157
  }
157
158
  .certificate-section h1 {
158
159
  font-family: Belanosima;
@@ -276,11 +277,24 @@ let SfIEvents = class SfIEvents extends LitElement {
276
277
  .color-late-reported {
277
278
  color: #Ef9C66;
278
279
  }
280
+ .watermark {
281
+ background-image: url(https://flagggrc-images.s3.amazonaws.com/logo.png);
282
+ background-position: center;
283
+ background-repeat: repeat;
284
+ background-size: 20%;
285
+ opacity: 5%;
286
+ left: 0;
287
+ right: 0;
288
+ top: 0;
289
+ bottom: 0;
290
+ position: absolute;
291
+ }
279
292
  </style>
280
293
  </head>
281
294
  <body>
282
295
  <div class="certificate-section">
283
296
  <h1 class="text-center">Certificate</h1>
297
+ <div class="watermark"></div>
284
298
  <p>I, PERSON_NAME, working as <span class="person-designation">PERSON_DESIGNATION</span> in PERSON_COMPANY, hereby declare that I am entrusted with the responsibility of ensuring compliance with various laws applicable to the company in the administration of business and the affairs of the company</p>
285
299
  <p>After having examined and considered all relevant information and based on the information furnished by the concerned officers, I, do hereby certify that the Finance / Technical / Administration / Legal wings / department of PERSON_COMPANY for the period PERSON_PERIOD, has in the conduct of business:</p>
286
300
  <ol>
@@ -302,6 +316,7 @@ let SfIEvents = class SfIEvents extends LitElement {
302
316
  </div>
303
317
  </div>
304
318
  <br /><br />
319
+ <div class="watermark"></div>
305
320
  <h3>Compliance Status</h3>
306
321
  PERSON_COMPLIANCE_STATUS
307
322
  <br /><br />
@@ -1259,6 +1274,7 @@ let SfIEvents = class SfIEvents extends LitElement {
1259
1274
  this.registerFilters = {};
1260
1275
  this.suspenseFlag = false;
1261
1276
  this.tablecols = [];
1277
+ this.reportedLocationsVals = [];
1262
1278
  this.isSelectedLegend = (value) => {
1263
1279
  return this.chartSelectedLegend.includes(value);
1264
1280
  };
@@ -3564,7 +3580,9 @@ let SfIEvents = class SfIEvents extends LitElement {
3564
3580
  let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
3565
3581
  let docsOptional = event['docs'] == null ? [] : event['docs'];
3566
3582
  let uploadGuidance = (_a = event['uploadguidance']) !== null && _a !== void 0 ? _a : 0;
3567
- console.log('rendering reporting', event, percentage);
3583
+ this.reportedLocationsVals = (event['reportedlocations'] != null) ? (Util.isJSONParsable(event['reportedlocations']) ? JSON.parse(event['reportedlocations']) : [event['reportedlocations']]) : [''];
3584
+ console.log('reportedLocations found', this.reportedLocationsVals);
3585
+ console.log('rendering reporting', event, percentage, this.reportedLocationsVals);
3568
3586
  if (this.selectedItemIds.length > 0) {
3569
3587
  html += `<div class="d-flex justify-between ">
3570
3588
  <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>
@@ -3593,19 +3611,39 @@ let SfIEvents = class SfIEvents extends LitElement {
3593
3611
  if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
3594
3612
  html += '<label part="input-label">Date of Completion*</label>';
3595
3613
  html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
3596
- html += '<div class="d-flex justify-start align-center">';
3614
+ html += '<div class="d-flex justify-start align-center flex-wrap">';
3597
3615
  html += '<div class="d-flex flex-col flex-grow">';
3598
3616
  html += '<label part="input-label">Completion Percentage</label>';
3599
3617
  html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1" disabled/><br />';
3600
3618
  html += '</div>';
3601
- html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
3619
+ html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3602
3620
  html += '<label part="input-label">Entity</label>';
3603
- html += '<select id="input-reporter-entity" part="input"></select><br />';
3621
+ html += '<select id="input-reporter-entity-0" part="input" disabled></select>';
3604
3622
  html += '</div>';
3605
- html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
3623
+ html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3606
3624
  html += '<label part="input-label">Location</label>';
3607
- html += '<select id="input-reporter-location" part="input"></select><br />';
3625
+ html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input" disabled></select>';
3608
3626
  html += '</div>';
3627
+ // html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">' + (this.reportedLocationsVals.length >= 1 ? 'remove' : 'add') + '</button><br /></div>'
3628
+ if (this.reportedLocationsVals.length > 1) {
3629
+ let indexLocation = 1;
3630
+ while (indexLocation < this.reportedLocationsVals.length) {
3631
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
3632
+ html += '<div class="d-flex flex-col flex-grow">';
3633
+ html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
3634
+ html += '</div>';
3635
+ html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
3636
+ html += '<label part="input-label">Entity</label>';
3637
+ html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
3638
+ html += '</div>';
3639
+ html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
3640
+ html += '<label part="input-label">Location</label>';
3641
+ html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
3642
+ html += '</div>';
3643
+ // html += '<button id="button-reporter-location-add-' + indexLocation + '" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">' + (indexLocation < this.reportedLocationsVals.length - 1 ? 'remove' : 'add') + '</button><br /></div>'
3644
+ indexLocation++;
3645
+ }
3646
+ }
3609
3647
  html += '</div>';
3610
3648
  }
3611
3649
  html += '<div>';
@@ -3654,20 +3692,41 @@ let SfIEvents = class SfIEvents extends LitElement {
3654
3692
  if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
3655
3693
  html += '<label part="input-label">Date of Completion*</label>';
3656
3694
  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 />';
3657
- html += '<div class="d-flex justify-start align-center">';
3695
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
3658
3696
  html += '<div class="d-flex flex-col flex-grow">';
3659
3697
  html += '<label part="input-label">Completion Percentage*</label>';
3660
- html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/><br />';
3698
+ html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/>';
3661
3699
  html += '</div>';
3662
- html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
3700
+ html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3663
3701
  html += '<label part="input-label">Entity</label>';
3664
- html += '<select id="input-reporter-entity" part="input"></select><br />';
3702
+ html += '<select id="input-reporter-entity-0" part="input"></select>';
3665
3703
  html += '</div>';
3666
- html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
3704
+ html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3667
3705
  html += '<label part="input-label">Location</label>';
3668
- html += '<select id="input-reporter-location" part="input"></select><br />';
3669
- html += '</div>';
3706
+ html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input"></select>';
3670
3707
  html += '</div>';
3708
+ html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">remove</button><br /></div>';
3709
+ if (this.reportedLocationsVals.length > 1) {
3710
+ let indexLocation = 1;
3711
+ while (indexLocation < this.reportedLocationsVals.length) {
3712
+ html += '<div class="d-flex justify-start align-end flex-wrap">';
3713
+ html += '<div class="d-flex flex-col flex-grow">';
3714
+ html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
3715
+ html += '</div>';
3716
+ html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3717
+ html += '<label part="input-label">Entity</label>';
3718
+ html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
3719
+ html += '</div>';
3720
+ html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
3721
+ html += '<label part="input-label">Location</label>';
3722
+ html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
3723
+ html += '</div>';
3724
+ html += '<button id="button-reporter-location-add-' + indexLocation + '" part="button-icon-small" class="button-reporter-location-add material-icons ml-10 hide">remove</button><br /></div>';
3725
+ indexLocation++;
3726
+ }
3727
+ }
3728
+ html += '<div class="d-flex justify-end align-end mt-10" class="input-report-location-add-container">';
3729
+ html += '<button id="button-reporter-location-add-0" part="button-icon-small" class="button-reporter-location-add material-icons ml-10-m-0 hide">add</button><br /></div>';
3671
3730
  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 />';
3672
3731
  // if(docsOptional.length === 0) {
3673
3732
  html += '<label id="input-label-docs" part="input-label">Supporting Documents' + ((docsOptional.length > 0) ? '' : '*') + '</label>';
@@ -3876,12 +3935,16 @@ let SfIEvents = class SfIEvents extends LitElement {
3876
3935
  }
3877
3936
  });
3878
3937
  (_h = listReportingContainer.querySelector('#upload-guidance-button')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async () => {
3879
- var _a, _b, _c, _f, _g, _h, _j, _k;
3938
+ var _a, _b, _c, _f, _g, _h;
3880
3939
  console.log('upload guidance clicked', event);
3881
3940
  let inputReportingPercentage = (_b = (_a = listReportingContainer.querySelector('#input-reporter-percentage')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "100";
3882
- let selectReportedLocation = (_f = (_c = listReportingContainer.querySelector('#input-reporter-location')) === null || _c === void 0 ? void 0 : _c.value) !== null && _f !== void 0 ? _f : "";
3883
- let approvercomments = (_h = (_g = listReportingContainer.querySelector('#input-approver-comments')) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : "";
3884
- let reportercomments = (_k = (_j = listReportingContainer.querySelector('#input-reporter-comments')) === null || _j === void 0 ? void 0 : _j.value) !== null && _k !== void 0 ? _k : "";
3941
+ let selectReportedLocations = listReportingContainer.querySelectorAll('.input-reporter-location');
3942
+ let selectReportedLocationValue = "[]";
3943
+ for (let selectReportedLocation of selectReportedLocations) {
3944
+ selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value]);
3945
+ }
3946
+ let approvercomments = (_f = (_c = listReportingContainer.querySelector('#input-approver-comments')) === null || _c === void 0 ? void 0 : _c.value) !== null && _f !== void 0 ? _f : "";
3947
+ let reportercomments = (_h = (_g = listReportingContainer.querySelector('#input-reporter-comments')) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : "";
3885
3948
  let dateOfCompletion;
3886
3949
  if (listReportingContainer.querySelector('#input-reporter-doc') != null) {
3887
3950
  dateOfCompletion = new Date(listReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "";
@@ -3894,30 +3957,37 @@ let SfIEvents = class SfIEvents extends LitElement {
3894
3957
  dateOfCompletion = "";
3895
3958
  }
3896
3959
  console.log('dateOfCompletion', dateOfCompletion);
3897
- await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocation, documents, dateOfCompletion);
3960
+ await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
3898
3961
  });
3899
3962
  if (this.mode == "consumer" || this.mode == "next") {
3900
3963
  let inputReportingPercentage = listReportingContainer.querySelector('#input-reporter-percentage');
3901
3964
  let percentage = inputReportingPercentage.value;
3965
+ const entityContainers = listReportingContainer.querySelectorAll('.reporting-entity-container');
3966
+ const locationsContainers = listReportingContainer.querySelectorAll('.reporting-location-container');
3967
+ const addLocationButtons = listReportingContainer.querySelectorAll('.button-reporter-location-add');
3902
3968
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
3903
- listReportingContainer.querySelector('#reporting-entity-container').classList.remove('hide');
3904
- listReportingContainer.querySelector('#reporting-location-container').classList.remove('hide');
3969
+ entityContainers.forEach(container => container.classList.remove('hide'));
3970
+ locationsContainers.forEach(container => container.classList.remove('hide'));
3971
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
3905
3972
  }
3906
3973
  else {
3907
- listReportingContainer.querySelector('#reporting-entity-container').classList.add('hide');
3908
- listReportingContainer.querySelector('#reporting-location-container').classList.add('hide');
3974
+ entityContainers.forEach(container => container.classList.add('hide'));
3975
+ locationsContainers.forEach(container => container.classList.add('hide'));
3976
+ addLocationButtons.forEach(container => container.classList.add('hide'));
3909
3977
  }
3910
3978
  inputReportingPercentage === null || inputReportingPercentage === void 0 ? void 0 : inputReportingPercentage.addEventListener('change', () => {
3911
3979
  setTimeout(() => {
3912
3980
  let percentage = inputReportingPercentage.value;
3913
- console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
3981
+ console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
3914
3982
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
3915
- listReportingContainer.querySelector('#reporting-entity-container').classList.remove('hide');
3916
- listReportingContainer.querySelector('#reporting-location-container').classList.remove('hide');
3983
+ entityContainers.forEach(container => container.classList.remove('hide'));
3984
+ locationsContainers.forEach(container => container.classList.remove('hide'));
3985
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
3917
3986
  }
3918
3987
  else {
3919
- listReportingContainer.querySelector('#reporting-entity-container').classList.add('hide');
3920
- listReportingContainer.querySelector('#reporting-location-container').classList.add('hide');
3988
+ entityContainers.forEach(container => container.classList.add('hide'));
3989
+ locationsContainers.forEach(container => container.classList.add('hide'));
3990
+ addLocationButtons.forEach(container => container.classList.add('hide'));
3921
3991
  }
3922
3992
  if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
3923
3993
  listReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
@@ -3925,70 +3995,127 @@ let SfIEvents = class SfIEvents extends LitElement {
3925
3995
  else {
3926
3996
  listReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents*';
3927
3997
  }
3998
+ if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
3999
+ event.percentage = percentage;
4000
+ event.reportedlocations = JSON.stringify([""]);
4001
+ event.reportercomments = listReportingContainer.querySelector('#input-reporter-comments').value;
4002
+ event.dateofcompletion = listReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(listReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
4003
+ event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
4004
+ console.log('rendering list reporting', event.percentage, event.reportedlocations);
4005
+ this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
4006
+ }
3928
4007
  }, 200);
3929
4008
  });
3930
- let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity');
3931
- let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location');
3932
- selectReportingEntity.innerHTML = '';
3933
4009
  let projectUserMap = Util.getProjectUsermap();
3934
- for (let country of Object.keys(projectUserMap)) {
3935
- if (country == "roles") {
3936
- continue;
3937
- }
3938
- for (let entity of Object.keys(projectUserMap[country])) {
3939
- let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "");
3940
- let option = new Option(entityName, entity);
3941
- selectReportingEntity.add(option);
3942
- }
3943
- }
3944
- selectReportingEntity.addEventListener('change', (e) => {
3945
- var _a;
3946
- selectReportingLocation.innerHTML = '';
4010
+ addLocationButtons.forEach((addLocationBtn) => {
4011
+ addLocationBtn.addEventListener('click', () => {
4012
+ let iconhtml = addLocationBtn.innerHTML;
4013
+ let index = parseInt(addLocationBtn.id.split('-')[4]);
4014
+ console.log('button clicked', iconhtml, addLocationBtn.id);
4015
+ if (iconhtml == "add") {
4016
+ console.log('this.reportedLocationsVals', this.reportedLocationsVals);
4017
+ this.reportedLocationsVals.push("");
4018
+ }
4019
+ else {
4020
+ this.reportedLocationsVals.splice(index, 1);
4021
+ }
4022
+ event.percentage = inputReportingPercentage.value;
4023
+ event.reportedlocations = JSON.stringify(this.reportedLocationsVals);
4024
+ if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
4025
+ event.percentage = "100";
4026
+ }
4027
+ console.log('rendering list reporting', event.percentage, event.reportedlocations);
4028
+ event.reportercomments = listReportingContainer.querySelector('#input-reporter-comments').value;
4029
+ event.dateofcompletion = listReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(listReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
4030
+ event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
4031
+ this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
4032
+ });
4033
+ });
4034
+ for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
4035
+ console.log('AddingEntities', indexRepLoc);
4036
+ let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc);
4037
+ let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc);
4038
+ selectReportingEntity.innerHTML = '';
3947
4039
  for (let country of Object.keys(projectUserMap)) {
3948
4040
  if (country == "roles") {
3949
4041
  continue;
3950
4042
  }
3951
4043
  for (let entity of Object.keys(projectUserMap[country])) {
3952
- if (entity.indexOf(e.target.value) < 0) {
4044
+ let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "");
4045
+ let option = new Option(entityName, entity);
4046
+ selectReportingEntity.add(option);
4047
+ }
4048
+ }
4049
+ selectReportingEntity.addEventListener('change', (e) => {
4050
+ selectReportingLocation.innerHTML = '';
4051
+ for (let country of Object.keys(projectUserMap)) {
4052
+ if (country == "roles") {
4053
+ continue;
4054
+ }
4055
+ for (let entity of Object.keys(projectUserMap[country])) {
4056
+ if (entity.indexOf(e.target.value) < 0) {
4057
+ continue;
4058
+ }
4059
+ for (let location of Object.keys(projectUserMap[country][entity])) {
4060
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
4061
+ let option = new Option(locationName, location);
4062
+ selectReportingLocation.add(option);
4063
+ }
4064
+ }
4065
+ }
4066
+ listReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc).classList.remove('hide');
4067
+ selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
4068
+ });
4069
+ if (selectReportingLocation.innerHTML == '') {
4070
+ for (let country of Object.keys(projectUserMap)) {
4071
+ if (country == "roles") {
3953
4072
  continue;
3954
4073
  }
3955
- for (let location of Object.keys(projectUserMap[country][entity])) {
3956
- let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
3957
- let option = new Option(locationName, location);
3958
- selectReportingLocation.add(option);
4074
+ for (let entity of Object.keys(projectUserMap[country])) {
4075
+ for (let location of Object.keys(projectUserMap[country][entity])) {
4076
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
4077
+ let option = new Option(locationName, location);
4078
+ selectReportingLocation.add(option);
4079
+ break;
4080
+ }
4081
+ break;
3959
4082
  }
4083
+ break;
3960
4084
  }
3961
4085
  }
3962
- listReportingContainer.querySelector('#reporting-location-container').classList.remove('hide');
3963
- selectReportingLocation.value = (_a = event.reportedlocations) !== null && _a !== void 0 ? _a : "";
3964
- });
3965
- if (event.reportedlocations != null && event.reportedlocations.length > 0) {
3966
- console.log('setting reportedlocations', event.reportedlocations);
3967
- for (let country of Object.keys(projectUserMap)) {
3968
- if (country == "roles") {
3969
- continue;
3970
- }
3971
- for (let entity of Object.keys(projectUserMap[country])) {
3972
- let flagSetVal = false;
3973
- for (let location of Object.keys(projectUserMap[country][entity])) {
3974
- if (event.reportedlocations.indexOf(location) >= 0) {
3975
- selectReportingEntity.value = entity;
3976
- const changeEvent = new Event('change', { bubbles: true });
3977
- selectReportingEntity.dispatchEvent(changeEvent);
3978
- selectReportingLocation.value = location;
3979
- flagSetVal = true;
4086
+ selectReportingLocation.addEventListener('change', (e) => {
4087
+ let index = parseInt(e.target.id.split('-')[3]);
4088
+ this.reportedLocationsVals[index] = e.target.value;
4089
+ });
4090
+ if (event.reportedlocations != null && event.reportedlocations.length > 0) {
4091
+ console.log('setting reportedlocations', event.reportedlocations);
4092
+ let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations;
4093
+ for (let country of Object.keys(projectUserMap)) {
4094
+ if (country == "roles") {
4095
+ continue;
4096
+ }
4097
+ for (let entity of Object.keys(projectUserMap[country])) {
4098
+ let flagSetVal = false;
4099
+ for (let location of Object.keys(projectUserMap[country][entity])) {
4100
+ if (tempReportedLocation.indexOf(location) >= 0) {
4101
+ selectReportingEntity.value = entity;
4102
+ const changeEvent = new Event('change', { bubbles: true });
4103
+ selectReportingEntity.dispatchEvent(changeEvent);
4104
+ selectReportingLocation.value = location;
4105
+ flagSetVal = true;
4106
+ break;
4107
+ }
4108
+ }
4109
+ if (flagSetVal) {
3980
4110
  break;
3981
4111
  }
3982
4112
  }
3983
- if (flagSetVal) {
3984
- break;
3985
- }
3986
4113
  }
3987
4114
  }
3988
- }
3989
- else {
3990
- selectReportingEntity.value = "";
3991
- selectReportingLocation.value = "";
4115
+ else {
4116
+ selectReportingEntity.value = "";
4117
+ selectReportingLocation.value = "";
4118
+ }
3992
4119
  }
3993
4120
  (_j = listReportingContainer.querySelector('#button-uploader-submit-approve')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
3994
4121
  var _a, _b;
@@ -4248,7 +4375,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4248
4375
  if (listReportingContainer.querySelector('#button-uploader-submit-report') != null) {
4249
4376
  listReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
4250
4377
  (_l = listReportingContainer.querySelector('#button-uploader-submit-report')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', async (ev) => {
4251
- var _a, _b, _c, _f, _g;
4378
+ var _a, _b, _c, _f;
4252
4379
  let buttonClick = ev.target;
4253
4380
  buttonClick.innerHTML = "Saving...";
4254
4381
  const reportercomments = listReportingContainer.querySelector('#input-reporter-comments').value;
@@ -4336,13 +4463,22 @@ let SfIEvents = class SfIEvents extends LitElement {
4336
4463
  }
4337
4464
  else {
4338
4465
  let flagBulk = false;
4339
- let reportedlocations = (_c = selectReportingLocation === null || selectReportingLocation === void 0 ? void 0 : selectReportingLocation.value) !== null && _c !== void 0 ? _c : "";
4466
+ // let reportedlocations = selectReportingLocation?.value ?? "";
4467
+ let reportedlocations = "[]";
4468
+ if (parseInt(percentage) !== 100) {
4469
+ let selectReportedLocations = listReportingContainer.querySelectorAll('.input-reporter-location');
4470
+ for (let selectReportedLocation of selectReportedLocations) {
4471
+ reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value]);
4472
+ }
4473
+ }
4340
4474
  if (this.selectedItemIds.length <= 1) {
4341
- if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_f = event.module) !== null && _f !== void 0 ? _f : "compliance", percentage, event.makercheckers, reportedlocations)) {
4475
+ if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_c = event.module) !== null && _c !== void 0 ? _c : "compliance", percentage, event.makercheckers, reportedlocations)) {
4342
4476
  if (this.mode != "next") {
4343
4477
  for (var p = 0; p < this.events[mmdd].length; p++) {
4344
4478
  if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
4345
4479
  this.events[mmdd][p].documents = docs;
4480
+ this.events[mmdd][p].percentage = percentage;
4481
+ this.events[mmdd][p].reportedlocations = reportedlocations;
4346
4482
  this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
4347
4483
  this.events[mmdd][p].lastupdated = new Date().toString();
4348
4484
  }
@@ -4368,6 +4504,8 @@ let SfIEvents = class SfIEvents extends LitElement {
4368
4504
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
4369
4505
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
4370
4506
  this.nextEvents[this.nextTabRole][mmdd][p].documents = docs;
4507
+ this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage;
4508
+ this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations;
4371
4509
  this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
4372
4510
  this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
4373
4511
  }
@@ -4448,7 +4586,7 @@ let SfIEvents = class SfIEvents extends LitElement {
4448
4586
  "userid": this.userProfileId,
4449
4587
  "userrole": this.myRole,
4450
4588
  "year": yearStr,
4451
- "module": (_g = event.module) !== null && _g !== void 0 ? _g : "compliance",
4589
+ "module": (_f = event.module) !== null && _f !== void 0 ? _f : "compliance",
4452
4590
  "makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
4453
4591
  });
4454
4592
  // }
@@ -4635,7 +4773,6 @@ let SfIEvents = class SfIEvents extends LitElement {
4635
4773
  let listReportingContainer = eventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
4636
4774
  // console.log('mmddyyyy', this.events[mmdd][j], listReportingContainer, '#list-reporting-container-'+mmdd.replace(/\//g,'-')+'-'+j);
4637
4775
  if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
4638
- 4;
4639
4776
  this.renderListReporting(listReportingContainer, this.events[mmdd][j], mmdd + '/' + yyyy, eventsContainer);
4640
4777
  }
4641
4778
  else {
@@ -13891,16 +14028,16 @@ let SfIEvents = class SfIEvents extends LitElement {
13891
14028
  }
13892
14029
  };
13893
14030
  this.renderEventDetail = (event, mmddyyyy, currentColumnButton, eventsContainer, previousId, nextId) => {
13894
- var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
14031
+ var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
13895
14032
  console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
13896
14033
  console.log('previousid', previousId, 'nextid', nextId);
13897
14034
  console.log('confighome', Util.getProjectConfigHome());
13898
- let comments, docs, approved, /*dateOfCompletion,*/ makercheckers, docsOptional, documentType;
14035
+ let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
13899
14036
  let entityId = "";
13900
14037
  let locationId = "";
13901
14038
  let statuteName = "";
13902
14039
  let reportformatName = "";
13903
- let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
14040
+ // let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
13904
14041
  entityId = event.entityid;
13905
14042
  locationId = event.locationid;
13906
14043
  // let completeness = this.getCompletenessStatus(event);
@@ -13908,9 +14045,9 @@ let SfIEvents = class SfIEvents extends LitElement {
13908
14045
  docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
13909
14046
  approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
13910
14047
  // dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
13911
- makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
13912
- docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
13913
- documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
14048
+ // makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
14049
+ // docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
14050
+ // documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
13914
14051
  statuteName = event['statute'][0].trim();
13915
14052
  if (event['reportformat'] != null) {
13916
14053
  reportformatName = ((_a = event['reportformat'][0]) !== null && _a !== void 0 ? _a : "").trim().replace('&amp;', '&');
@@ -14190,7 +14327,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14190
14327
  html += '</div>';
14191
14328
  if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
14192
14329
  if (this.mode != "viewer") {
14193
- html += '<div part="reporting-view-container">';
14330
+ html += '<div part="reporting-view-container" id="reporting-view-container">';
14194
14331
  html += this.renderReporting(event, mmddyyyy);
14195
14332
  html += "</div>";
14196
14333
  }
@@ -14257,94 +14394,16 @@ let SfIEvents = class SfIEvents extends LitElement {
14257
14394
  }
14258
14395
  this._SfDetailContainer.innerHTML = html;
14259
14396
  this._SfDetailContainer.style.display = 'block';
14260
- // let attachmentUploaders = (this._SfDetailContainer as HTMLDivElement).querySelectorAll('.event-attachment') as NodeListOf<SfIUploader>
14261
- // for(let attachmentUploader of attachmentUploaders){
14262
- // attachmentUploader.loadMode();
14263
- // }
14264
14397
  if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
14265
14398
  let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
14266
14399
  let emailcontent = `<table border="0" cellspacing="0" style="color:#666666;border-radius:5px;border:solid 1px #efefef;width:100%; margin-top:20px"><tbody><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Compliance ID</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.id}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Country</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.countryname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Entity</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.entityname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Location</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.locationname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Statute</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${(_b = event.statute[0]) !== null && _b !== void 0 ? _b : ""}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Subcategory</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.subcategory}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Reporter</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.reporters[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Approver</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.approvers[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Due Date</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${ddmmyyyy}</td></tr></tbody></table>`;
14267
14400
  this._SfUploader[0].querySelector('#uploader').emailcontent = emailcontent;
14268
14401
  }
14269
- (_c = this._SfDetailContainer.querySelector('.button-delete')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
14270
- await this.fetchDeleteReview(event["id"], mmddyyyy, entityId, locationId);
14271
- this.setSuccess('Deleted successfully!');
14272
- setTimeout(() => {
14273
- this.clearMessages();
14274
- }, 3000);
14275
- //console.log('deleted', resultDelete);
14276
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14277
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14278
- // } else {
14279
- if (currentColumnButton != null) {
14280
- currentColumnButton.click();
14281
- }
14282
- // }
14283
- var clickEvent = new MouseEvent("click", {
14284
- "view": window,
14285
- "bubbles": true,
14286
- "cancelable": false
14287
- });
14288
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
14289
- });
14290
- (_f = this._SfDetailContainer.querySelector('#button-auto-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
14291
- var _a, _b;
14292
- if (this.selectedItemIds.length <= 1) {
14293
- await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance");
14294
- this.setSuccess('Auto-Approved successfully!');
14295
- setTimeout(() => {
14296
- this.clearMessages();
14297
- }, 3000);
14298
- }
14299
- else {
14300
- let bulkBodyReview = [];
14301
- for (var k = 0; k < this.selectedItemIds.length; k++) {
14302
- const selectedId = this.selectedItemIds[k];
14303
- //console.log('selectedid', selectedId);
14304
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14305
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
14306
- const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14307
- mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14308
- //console.log(entityId, locationId, eventId, mmddyyyy);
14309
- let yearStr = this.getFinancialYear(mmddyyyy);
14310
- bulkBodyReview.push({
14311
- "mmddyyyy": mmddyyyy,
14312
- "projectid": this.projectId,
14313
- "type": "review",
14314
- "eventid": eventId,
14315
- "comments": "Auto approved",
14316
- "approved": true,
14317
- "entityid": entityId,
14318
- "locationid": locationId,
14319
- "username": this.userName,
14320
- "userid": this.userProfileId,
14321
- "userrole": this.myRole,
14322
- "year": yearStr,
14323
- "module": (_b = event.module) !== null && _b !== void 0 ? _b : "compliance"
14324
- });
14325
- }
14326
- await this.uploadReviewsBulk(bulkBodyReview);
14327
- }
14328
- //console.log('deleted', resultDelete);
14329
- // if(this.getCurrentTab() == this.TAB_CUSTOM) {
14330
- // this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
14331
- // } else {
14332
- if (currentColumnButton != null) {
14333
- currentColumnButton.click();
14334
- }
14335
- // }
14336
- var clickEvent = new MouseEvent("click", {
14337
- "view": window,
14338
- "bubbles": true,
14339
- "cancelable": false
14340
- });
14341
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
14342
- });
14343
- (_g = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', () => {
14402
+ (_c = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', () => {
14344
14403
  this._SfDetailContainer.innerHTML = '';
14345
14404
  this._SfDetailContainer.style.display = 'none';
14346
14405
  });
14347
- (_h = this._SfDetailContainer.querySelector('#button-detail-previous')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', () => {
14406
+ (_f = this._SfDetailContainer.querySelector('#button-detail-previous')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', () => {
14348
14407
  var _a;
14349
14408
  var clickEvent = new MouseEvent("click", {
14350
14409
  "view": window,
@@ -14353,7 +14412,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14353
14412
  });
14354
14413
  (_a = eventsContainer.querySelector('#' + previousId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
14355
14414
  });
14356
- (_j = this._SfDetailContainer.querySelector('#button-detail-next')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', () => {
14415
+ (_g = this._SfDetailContainer.querySelector('#button-detail-next')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', () => {
14357
14416
  var _a;
14358
14417
  var clickEvent = new MouseEvent("click", {
14359
14418
  "view": window,
@@ -14362,7 +14421,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14362
14421
  });
14363
14422
  (_a = eventsContainer.querySelector('#' + nextId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
14364
14423
  });
14365
- (_k = this._SfDetailContainer.querySelector('.head-basic')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', () => {
14424
+ (_h = this._SfDetailContainer.querySelector('.head-basic')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', () => {
14366
14425
  //console.log('head basic clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-basic') as HTMLDivElement).style.display);
14367
14426
  if (this._SfDetailContainer.querySelector('.body-basic').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-basic').style.display == '') {
14368
14427
  this._SfDetailContainer.querySelector('.body-basic').style.display = 'none';
@@ -14373,7 +14432,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14373
14432
  this._SfDetailContainer.querySelector('.head-indicator-basic').innerHTML = '-';
14374
14433
  }
14375
14434
  });
14376
- (_l = this._SfDetailContainer.querySelector('.head-statute')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', () => {
14435
+ (_j = this._SfDetailContainer.querySelector('.head-statute')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', () => {
14377
14436
  //console.log('head statute clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-statute') as HTMLDivElement).style.display);
14378
14437
  if (this._SfDetailContainer.querySelector('.body-statute').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-statute').style.display == '') {
14379
14438
  this._SfDetailContainer.querySelector('.body-statute').style.display = 'none';
@@ -14384,7 +14443,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14384
14443
  this._SfDetailContainer.querySelector('.head-indicator-statute').innerHTML = '-';
14385
14444
  }
14386
14445
  });
14387
- (_m = this._SfDetailContainer.querySelector('.head-compliance')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', () => {
14446
+ (_k = this._SfDetailContainer.querySelector('.head-compliance')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', () => {
14388
14447
  if (this._SfDetailContainer.querySelector('.body-compliance').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-compliance').style.display == '') {
14389
14448
  this._SfDetailContainer.querySelector('.body-compliance').style.display = 'none';
14390
14449
  this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '+';
@@ -14394,7 +14453,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14394
14453
  this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '-';
14395
14454
  }
14396
14455
  });
14397
- (_o = this._SfDetailContainer.querySelector('.head-grc')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', () => {
14456
+ (_l = this._SfDetailContainer.querySelector('.head-grc')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', () => {
14398
14457
  if (this._SfDetailContainer.querySelector('.body-grc').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-grc').style.display == '') {
14399
14458
  this._SfDetailContainer.querySelector('.body-grc').style.display = 'none';
14400
14459
  this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '+';
@@ -14404,7 +14463,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14404
14463
  this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '-';
14405
14464
  }
14406
14465
  });
14407
- (_p = this._SfDetailContainer.querySelector('.head-feedback')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', () => {
14466
+ (_m = this._SfDetailContainer.querySelector('.head-feedback')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', () => {
14408
14467
  if (this._SfDetailContainer.querySelector('.body-feedback').style.display == 'flex') {
14409
14468
  this._SfDetailContainer.querySelector('.body-feedback').style.display = 'none';
14410
14469
  this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '+';
@@ -14414,11 +14473,11 @@ let SfIEvents = class SfIEvents extends LitElement {
14414
14473
  this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '-';
14415
14474
  }
14416
14475
  });
14417
- (_q = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', () => {
14476
+ (_o = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', () => {
14418
14477
  this._SfDetailContainer.innerHTML = '';
14419
14478
  this._SfDetailContainer.style.display = 'none';
14420
14479
  });
14421
- (_r = this._SfDetailContainer.querySelector('#button-feedback')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', () => {
14480
+ (_p = this._SfDetailContainer.querySelector('#button-feedback')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', () => {
14422
14481
  const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
14423
14482
  const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
14424
14483
  const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
@@ -14454,7 +14513,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14454
14513
  // }
14455
14514
  // console.log(body);
14456
14515
  });
14457
- (_s = this._SfDetailContainer.querySelector('#button-feedback-cancel')) === null || _s === void 0 ? void 0 : _s.addEventListener('click', () => {
14516
+ (_q = this._SfDetailContainer.querySelector('#button-feedback-cancel')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', () => {
14458
14517
  const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
14459
14518
  const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
14460
14519
  const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
@@ -14485,7 +14544,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14485
14544
  buttonFeedback.classList.remove('hide');
14486
14545
  }
14487
14546
  });
14488
- (_t = this._SfDetailContainer.querySelector('#button-feedback-confirm')) === null || _t === void 0 ? void 0 : _t.addEventListener('click', async () => {
14547
+ (_r = this._SfDetailContainer.querySelector('#button-feedback-confirm')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', async () => {
14489
14548
  var _a, _b, _c;
14490
14549
  const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
14491
14550
  const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
@@ -14525,112 +14584,313 @@ let SfIEvents = class SfIEvents extends LitElement {
14525
14584
  buttonClose.click();
14526
14585
  }
14527
14586
  });
14528
- (_u = this._SfDetailContainer.querySelector('#feedback-message')) === null || _u === void 0 ? void 0 : _u.addEventListener('keyup', (e) => {
14587
+ (_s = this._SfDetailContainer.querySelector('#feedback-message')) === null || _s === void 0 ? void 0 : _s.addEventListener('keyup', (e) => {
14529
14588
  if (e.code == "Enter") {
14530
14589
  const buttonConfirm = this._SfDetailContainer.querySelector('#button-feedback-confirm');
14531
14590
  buttonConfirm.click();
14532
14591
  }
14533
14592
  });
14534
14593
  if (this.mode == "consumer" || this.mode == "next") {
14535
- let inputReportingPercentage = this._SfDetailContainer.querySelector('#input-reporter-percentage');
14594
+ let eventDetailReportingContainer = this._SfDetailContainer.querySelector('#reporting-view-container');
14595
+ if (eventDetailReportingContainer != null) {
14596
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, this._SfDetailContainer);
14597
+ }
14598
+ }
14599
+ this.fetchStatuteDefinitionDetails(statuteName);
14600
+ console.log('customreporting', event['customreporting']);
14601
+ if (event['customreporting'] != null) {
14602
+ let reportingContainer = this._SfDetailContainer;
14603
+ if (reportingContainer.querySelector('#report-format-container') != null) {
14604
+ reportingContainer.querySelector('#report-format-container').innerHTML = `<slot name="reporting"></slot>`;
14605
+ console.log('innerhtml', reportingContainer.querySelector('#report-format-container').innerHTML);
14606
+ this._SfReporting[0].querySelector('#reporting-format').name = event.obligationtitle;
14607
+ this._SfReporting[0].querySelector('#reporting-format').mode = "edit";
14608
+ this._SfReporting[0].querySelector('#reporting-format').configjson = event['customreporting'];
14609
+ // if(reportformatvalues != ""){
14610
+ // (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
14611
+ // }
14612
+ this._SfReporting[0].querySelector('#reporting-format').loadMode();
14613
+ }
14614
+ }
14615
+ else if (event['reportformat'] != null && event['reportformat'].length > 0) {
14616
+ this.fetchReportFormat(this._SfDetailContainer, reportformatName, (_t = event['reportformatschema']) !== null && _t !== void 0 ? _t : "", (_u = event['reportformatvalues']) !== null && _u !== void 0 ? _u : "");
14617
+ }
14618
+ };
14619
+ this.renderEventDetailReporting = (eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer) => {
14620
+ var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m;
14621
+ console.log('detailreporting event', event, this.graphFilter);
14622
+ let html = '';
14623
+ let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
14624
+ let reportformatName = '';
14625
+ if (event['reportformat'] != null) {
14626
+ reportformatName = ((_a = event['reportformat'][0]) !== null && _a !== void 0 ? _a : "").trim().replace('&amp;', '&');
14627
+ }
14628
+ let docs = event['documents'] == null ? [] : event['documents'];
14629
+ event.approved = event['approved'] == null ? false : event['approved'];
14630
+ event.dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
14631
+ event.makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
14632
+ event.docsOptional = event['docs'] == null ? [] : event['docs'];
14633
+ html = this.renderReporting(event, mmddyyyy);
14634
+ console.log('reporting html', html);
14635
+ let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
14636
+ let emailcontent = `<table border="0" cellspacing="0" style="color:#666666;border-radius:5px;border:solid 1px #efefef;width:100%; margin-top:20px"><tbody><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Compliance ID</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.id}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Country</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.countryname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Entity</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${event.entityname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Location</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.locationname.replace(/ *\([^)]*\) */g, "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%;font-weight:bold">Statute</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#fbfbfb;font-size:110%">${((_b = event.statute[0]) !== null && _b !== void 0 ? _b : "")}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Subcategory</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.subcategory}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Reporter</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.reporters[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Approver</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${event.approvers[0].split(';')[0]}</td></tr><tr><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%;font-weight:bold">Due Date</td><td style="padding:10px;padding-top:10px;padding-bottom:10px;vertical-align:top;background-color:#f5f5f5;font-size:110%">${ddmmyyyy}</td></tr></tbody></table>`;
14637
+ eventDetailReportingContainer.innerHTML = html;
14638
+ if (this._SfUploader[0] != null) {
14639
+ this._SfUploader[0].querySelector('#uploader').emailcontent = emailcontent;
14640
+ }
14641
+ (_c = eventDetailReportingContainer.querySelector('.button-delete')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
14642
+ await this.fetchDeleteReview(event["id"], mmddyyyy, event.entityid, event.locationid);
14643
+ this.setSuccess('Deleted successfully!');
14644
+ setTimeout(() => {
14645
+ this.clearMessages();
14646
+ }, 3000);
14647
+ //console.log('deleted', resultDelete);
14648
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
14649
+ this.processDateSelection(this._SfCustomContainer);
14650
+ }
14651
+ else {
14652
+ // if(currentColumnButton != null) {
14653
+ // currentColumnButton.click();
14654
+ // }
14655
+ }
14656
+ });
14657
+ (_f = eventDetailReportingContainer.querySelector('#button-auto-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
14658
+ var _a, _b;
14659
+ if (this.selectedItemIds.length <= 1) {
14660
+ await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance");
14661
+ this.setSuccess('Auto-Approved successfully!');
14662
+ setTimeout(() => {
14663
+ this.clearMessages();
14664
+ }, 3000);
14665
+ }
14666
+ else {
14667
+ let bulkBodyReview = [];
14668
+ for (var k = 0; k < this.selectedItemIds.length; k++) {
14669
+ const selectedId = this.selectedItemIds[k];
14670
+ //console.log('selectedid', selectedId);
14671
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
14672
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
14673
+ const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14674
+ mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14675
+ //console.log(entityId, locationId, eventId, mmddyyyy);
14676
+ let yearStr = this.getFinancialYear(mmddyyyy);
14677
+ bulkBodyReview.push({
14678
+ "mmddyyyy": mmddyyyy,
14679
+ "projectid": this.projectId,
14680
+ "type": "review",
14681
+ "eventid": eventId,
14682
+ "comments": "Auto approved",
14683
+ "approved": true,
14684
+ "entityid": entityId,
14685
+ "locationid": locationId,
14686
+ "username": this.userName,
14687
+ "userid": this.userProfileId,
14688
+ "userrole": this.myRole,
14689
+ "year": yearStr,
14690
+ "module": (_b = event.module) !== null && _b !== void 0 ? _b : "compliance"
14691
+ });
14692
+ }
14693
+ await this.uploadReviewsBulk(bulkBodyReview);
14694
+ }
14695
+ if (this.getCurrentTab() == this.TAB_CUSTOM) {
14696
+ this.processDateSelection(this._SfCustomContainer);
14697
+ }
14698
+ else {
14699
+ // if(currentColumnButton != null) {
14700
+ // currentColumnButton.click();
14701
+ // }
14702
+ }
14703
+ });
14704
+ (_g = eventDetailReportingContainer.querySelector('#upload-guidance-button')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async () => {
14705
+ var _a, _b, _c, _f, _g, _h;
14706
+ console.log('upload guidance clicked', event);
14707
+ let inputReportingPercentage = (_b = (_a = eventDetailReportingContainer.querySelector('#input-reporter-percentage')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "100";
14708
+ let selectReportedLocations = eventDetailReportingContainer.querySelectorAll('.input-reporter-location');
14709
+ let selectReportedLocationValue = "[]";
14710
+ for (let selectReportedLocation of selectReportedLocations) {
14711
+ selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value]);
14712
+ }
14713
+ let approvercomments = (_f = (_c = eventDetailReportingContainer.querySelector('#input-approver-comments')) === null || _c === void 0 ? void 0 : _c.value) !== null && _f !== void 0 ? _f : "";
14714
+ let reportercomments = (_h = (_g = eventDetailReportingContainer.querySelector('#input-reporter-comments')) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : "";
14715
+ let dateOfCompletion;
14716
+ if (eventDetailReportingContainer.querySelector('#input-reporter-doc') != null) {
14717
+ dateOfCompletion = new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "";
14718
+ }
14719
+ else {
14720
+ dateOfCompletion = new Date(eventDetailReportingContainer.querySelector('#input-approver-doc').value).getTime() + "";
14721
+ }
14722
+ let documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
14723
+ if (dateOfCompletion == "NaN") {
14724
+ dateOfCompletion = "";
14725
+ }
14726
+ console.log('dateOfCompletion', dateOfCompletion);
14727
+ await this.fetchEventDetails(event, mmddyyyy, null, eventDetailContainer, "", "", true, eventDetailReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
14728
+ });
14729
+ if (this.mode == "consumer" || this.mode == "next") {
14730
+ let inputReportingPercentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage');
14536
14731
  let percentage = inputReportingPercentage.value;
14732
+ const entityContainers = eventDetailReportingContainer.querySelectorAll('.reporting-entity-container');
14733
+ const locationsContainers = eventDetailReportingContainer.querySelectorAll('.reporting-location-container');
14734
+ const addLocationButtons = eventDetailReportingContainer.querySelectorAll('.button-reporter-location-add');
14537
14735
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
14538
- this._SfDetailContainer.querySelector('#reporting-entity-container').classList.remove('hide');
14539
- this._SfDetailContainer.querySelector('#reporting-location-container').classList.remove('hide');
14736
+ entityContainers.forEach(container => container.classList.remove('hide'));
14737
+ locationsContainers.forEach(container => container.classList.remove('hide'));
14738
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
14540
14739
  }
14541
14740
  else {
14542
- this._SfDetailContainer.querySelector('#reporting-entity-container').classList.add('hide');
14543
- this._SfDetailContainer.querySelector('#reporting-location-container').classList.add('hide');
14741
+ entityContainers.forEach(container => container.classList.add('hide'));
14742
+ locationsContainers.forEach(container => container.classList.add('hide'));
14743
+ addLocationButtons.forEach(container => container.classList.add('hide'));
14544
14744
  }
14545
14745
  inputReportingPercentage === null || inputReportingPercentage === void 0 ? void 0 : inputReportingPercentage.addEventListener('change', () => {
14546
14746
  setTimeout(() => {
14547
14747
  let percentage = inputReportingPercentage.value;
14548
- console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
14748
+ console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
14549
14749
  if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
14550
- this._SfDetailContainer.querySelector('#reporting-entity-container').classList.remove('hide');
14551
- this._SfDetailContainer.querySelector('#reporting-location-container').classList.remove('hide');
14750
+ entityContainers.forEach(container => container.classList.remove('hide'));
14751
+ locationsContainers.forEach(container => container.classList.remove('hide'));
14752
+ addLocationButtons.forEach(container => container.classList.remove('hide'));
14552
14753
  }
14553
14754
  else {
14554
- this._SfDetailContainer.querySelector('#reporting-entity-container').classList.add('hide');
14555
- this._SfDetailContainer.querySelector('#reporting-location-container').classList.add('hide');
14755
+ entityContainers.forEach(container => container.classList.add('hide'));
14756
+ locationsContainers.forEach(container => container.classList.add('hide'));
14757
+ addLocationButtons.forEach(container => container.classList.add('hide'));
14556
14758
  }
14557
- if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
14558
- this._SfDetailContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
14759
+ if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
14760
+ eventDetailReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
14559
14761
  }
14560
14762
  else {
14561
- this._SfDetailContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents*';
14763
+ eventDetailReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents*';
14764
+ }
14765
+ if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
14766
+ event.percentage = percentage;
14767
+ event.reportedlocations = JSON.stringify([""]);
14768
+ event.reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
14769
+ event.dateofcompletion = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
14770
+ event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
14771
+ console.log('rendering list reporting', event.percentage, event.reportedlocations);
14772
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
14562
14773
  }
14563
14774
  }, 200);
14564
14775
  });
14565
- let selectReportingEntity = this._SfDetailContainer.querySelector('#input-reporter-entity');
14566
- let selectReportingLocation = this._SfDetailContainer.querySelector('#input-reporter-location');
14567
- selectReportingEntity.innerHTML = '';
14568
14776
  let projectUserMap = Util.getProjectUsermap();
14569
- for (let country of Object.keys(projectUserMap)) {
14570
- if (country == "roles") {
14571
- continue;
14572
- }
14573
- for (let entity of Object.keys(projectUserMap[country])) {
14574
- let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "");
14575
- let option = new Option(entityName, entity);
14576
- selectReportingEntity.add(option);
14577
- }
14578
- }
14579
- selectReportingEntity.addEventListener('change', (e) => {
14580
- var _a;
14581
- selectReportingLocation.innerHTML = '';
14777
+ addLocationButtons.forEach((addLocationBtn) => {
14778
+ addLocationBtn.addEventListener('click', () => {
14779
+ let iconhtml = addLocationBtn.innerHTML;
14780
+ let index = parseInt(addLocationBtn.id.split('-')[4]);
14781
+ console.log('button clicked', iconhtml, addLocationBtn.id);
14782
+ if (iconhtml == "add") {
14783
+ console.log('this.reportedLocationsVals', this.reportedLocationsVals);
14784
+ this.reportedLocationsVals.push("");
14785
+ }
14786
+ else {
14787
+ this.reportedLocationsVals.splice(index, 1);
14788
+ }
14789
+ event.percentage = inputReportingPercentage.value;
14790
+ event.reportedlocations = JSON.stringify(this.reportedLocationsVals);
14791
+ if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
14792
+ event.percentage = "100";
14793
+ }
14794
+ console.log('rendering list reporting', event.percentage, event.reportedlocations);
14795
+ event.reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
14796
+ event.dateofcompletion = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
14797
+ event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
14798
+ this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
14799
+ });
14800
+ });
14801
+ for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
14802
+ console.log('AddingEntities', indexRepLoc);
14803
+ let selectReportingEntity = eventDetailReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc);
14804
+ let selectReportingLocation = eventDetailReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc);
14805
+ selectReportingEntity.innerHTML = '';
14582
14806
  for (let country of Object.keys(projectUserMap)) {
14583
14807
  if (country == "roles") {
14584
14808
  continue;
14585
14809
  }
14586
14810
  for (let entity of Object.keys(projectUserMap[country])) {
14587
- if (entity.indexOf(e.target.value) < 0) {
14811
+ let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "");
14812
+ let option = new Option(entityName, entity);
14813
+ selectReportingEntity.add(option);
14814
+ }
14815
+ }
14816
+ selectReportingEntity.addEventListener('change', (e) => {
14817
+ selectReportingLocation.innerHTML = '';
14818
+ for (let country of Object.keys(projectUserMap)) {
14819
+ if (country == "roles") {
14588
14820
  continue;
14589
14821
  }
14590
- for (let location of Object.keys(projectUserMap[country][entity])) {
14591
- let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
14592
- let option = new Option(locationName, location);
14593
- selectReportingLocation.add(option);
14822
+ for (let entity of Object.keys(projectUserMap[country])) {
14823
+ if (entity.indexOf(e.target.value) < 0) {
14824
+ continue;
14825
+ }
14826
+ for (let location of Object.keys(projectUserMap[country][entity])) {
14827
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
14828
+ let option = new Option(locationName, location);
14829
+ selectReportingLocation.add(option);
14830
+ }
14594
14831
  }
14595
14832
  }
14596
- }
14597
- this._SfDetailContainer.querySelector('#reporting-location-container').classList.remove('hide');
14598
- selectReportingLocation.value = (_a = event.reportedlocations) !== null && _a !== void 0 ? _a : "";
14599
- });
14600
- if (event.reportedlocations != null && event.reportedlocations.length > 0) {
14601
- console.log('setting reportedlocations', event.reportedlocations);
14602
- for (let country of Object.keys(projectUserMap)) {
14603
- if (country == "roles") {
14604
- continue;
14605
- }
14606
- for (let entity of Object.keys(projectUserMap[country])) {
14607
- let flagSetVal = false;
14608
- for (let location of Object.keys(projectUserMap[country][entity])) {
14609
- if (event.reportedlocations.indexOf(location) >= 0) {
14610
- selectReportingEntity.value = entity;
14611
- const changeEvent = new Event('change', { bubbles: true });
14612
- selectReportingEntity.dispatchEvent(changeEvent);
14613
- selectReportingLocation.value = location;
14614
- flagSetVal = true;
14833
+ eventDetailReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc).classList.remove('hide');
14834
+ selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
14835
+ });
14836
+ if (selectReportingLocation.innerHTML == '') {
14837
+ for (let country of Object.keys(projectUserMap)) {
14838
+ if (country == "roles") {
14839
+ continue;
14840
+ }
14841
+ for (let entity of Object.keys(projectUserMap[country])) {
14842
+ for (let location of Object.keys(projectUserMap[country][entity])) {
14843
+ let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
14844
+ let option = new Option(locationName, location);
14845
+ selectReportingLocation.add(option);
14615
14846
  break;
14616
14847
  }
14617
- }
14618
- if (flagSetVal) {
14619
14848
  break;
14620
14849
  }
14850
+ break;
14621
14851
  }
14622
14852
  }
14853
+ selectReportingLocation.addEventListener('change', (e) => {
14854
+ let index = parseInt(e.target.id.split('-')[3]);
14855
+ this.reportedLocationsVals[index] = e.target.value;
14856
+ });
14857
+ if (event.reportedlocations != null && event.reportedlocations.length > 0) {
14858
+ console.log('setting reportedlocations', event.reportedlocations);
14859
+ let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations;
14860
+ for (let country of Object.keys(projectUserMap)) {
14861
+ if (country == "roles") {
14862
+ continue;
14863
+ }
14864
+ for (let entity of Object.keys(projectUserMap[country])) {
14865
+ let flagSetVal = false;
14866
+ for (let location of Object.keys(projectUserMap[country][entity])) {
14867
+ if (tempReportedLocation.indexOf(location) >= 0) {
14868
+ selectReportingEntity.value = entity;
14869
+ const changeEvent = new Event('change', { bubbles: true });
14870
+ selectReportingEntity.dispatchEvent(changeEvent);
14871
+ selectReportingLocation.value = location;
14872
+ flagSetVal = true;
14873
+ break;
14874
+ }
14875
+ }
14876
+ if (flagSetVal) {
14877
+ break;
14878
+ }
14879
+ }
14880
+ }
14881
+ }
14882
+ else {
14883
+ selectReportingEntity.value = "";
14884
+ selectReportingLocation.value = "";
14885
+ }
14623
14886
  }
14624
- else {
14625
- selectReportingEntity.value = "";
14626
- selectReportingLocation.value = "";
14627
- }
14628
- (_v = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', async (ev) => {
14629
- var _a, _b, _c;
14887
+ (_h = eventDetailReportingContainer.querySelector('#button-uploader-submit-approve')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async (ev) => {
14888
+ var _a, _b;
14630
14889
  let buttonClick = ev.target;
14631
14890
  buttonClick.innerHTML = "Saving...";
14632
- const comments = this._SfDetailContainer.querySelector('#input-approver-comments').value;
14633
- const approved = this._SfDetailContainer.querySelector('#input-approve-yes').checked;
14891
+ const comments = eventDetailReportingContainer.querySelector('#input-approver-comments').value;
14892
+ console.log('comments', comments, JSON.stringify(event.comments));
14893
+ const approved = eventDetailReportingContainer.querySelector('#input-approve-yes').checked;
14634
14894
  let currStatus = this.getCompletenessStatus(event);
14635
14895
  let newEvent = { ...event };
14636
14896
  newEvent.comments = comments;
@@ -14644,22 +14904,19 @@ let SfIEvents = class SfIEvents extends LitElement {
14644
14904
  }, 3000);
14645
14905
  return;
14646
14906
  }
14647
- var clickEvent = new MouseEvent("click", {
14648
- "view": window,
14649
- "bubbles": true,
14650
- "cancelable": false
14651
- });
14652
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
14653
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
14654
14907
  let flagBulk = false;
14655
14908
  if (this.selectedItemIds.length <= 1) {
14656
- // console.log('mmddyyyy', mmddyyyy)
14657
- if (await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
14909
+ console.log('selectedevent', JSON.stringify(event));
14910
+ if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
14658
14911
  for (var p = 0; p < this.events[mmdd].length; p++) {
14659
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
14912
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
14660
14913
  this.events[mmdd][p].approved = approved;
14914
+ console.log('selected event', this.events[mmdd][p]);
14661
14915
  this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
14662
14916
  this.events[mmdd][p].lastupdated = new Date().toString();
14917
+ if (approved) {
14918
+ this.events[mmdd][p].dateofcompletion = new Date().getTime() + "";
14919
+ }
14663
14920
  }
14664
14921
  }
14665
14922
  if (this.recentlyReported[mmdd] == null) {
@@ -14673,8 +14930,8 @@ let SfIEvents = class SfIEvents extends LitElement {
14673
14930
  for (var k = 0; k < this.selectedItemIds.length; k++) {
14674
14931
  const selectedId = this.selectedItemIds[k];
14675
14932
  //console.log('selectedid', selectedId);
14676
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14677
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
14933
+ let entityid = selectedId.split('-')[7].replace(/_/g, '-');
14934
+ let locationid = selectedId.split('-')[8].replace(/_/g, '-');
14678
14935
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14679
14936
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14680
14937
  //console.log(entityId, locationId, eventId, mmddyyyy);
@@ -14686,8 +14943,8 @@ let SfIEvents = class SfIEvents extends LitElement {
14686
14943
  "eventid": eventId,
14687
14944
  "comments": comments,
14688
14945
  "approved": approved,
14689
- "entityid": entityId,
14690
- "locationid": locationId,
14946
+ "entityid": entityid,
14947
+ "locationid": locationid,
14691
14948
  "username": this.userName,
14692
14949
  "userid": this.userProfileId,
14693
14950
  "userrole": this.myRole,
@@ -14703,16 +14960,16 @@ let SfIEvents = class SfIEvents extends LitElement {
14703
14960
  for (var k = 0; k < this.selectedItemIds.length; k++) {
14704
14961
  const selectedId = this.selectedItemIds[k];
14705
14962
  //console.log('selectedid', selectedId);
14706
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14707
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
14963
+ let entityid = selectedId.split('-')[7].replace(/_/g, '-');
14964
+ let locationid = selectedId.split('-')[8].replace(/_/g, '-');
14708
14965
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14709
14966
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14710
14967
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
14711
14968
  if (this.mode == "next") {
14712
14969
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
14713
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
14714
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
14970
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityid) {
14715
14971
  flagBulk = true;
14972
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
14716
14973
  if (this.recentlyReported[mmdd] == null) {
14717
14974
  this.recentlyReported[mmdd] = [];
14718
14975
  }
@@ -14722,7 +14979,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14722
14979
  }
14723
14980
  else {
14724
14981
  for (var p = 0; p < this.events[mmdd].length; p++) {
14725
- if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
14982
+ if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
14726
14983
  this.events[mmdd][p].isbulk = true;
14727
14984
  flagBulk = true;
14728
14985
  if (this.recentlyReported[mmdd] == null) {
@@ -14737,7 +14994,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14737
14994
  if (this.mode == "next") {
14738
14995
  // this.fetchNext(this.nextPage)
14739
14996
  // this.renderRoleTabsNext(this.nextPage)
14740
- this.renderNextEvents(this.nextEvents, this.nextPage, this.myRole);
14997
+ this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
14741
14998
  }
14742
14999
  else {
14743
15000
  // if(this.getCurrentTab() == this.TAB_CUSTOM) {
@@ -14751,39 +15008,17 @@ let SfIEvents = class SfIEvents extends LitElement {
14751
15008
  if (this.selectedItemIds.length > 0) {
14752
15009
  await this.fetchBulkReportingData();
14753
15010
  }
15011
+ console.log('events', this.events);
14754
15012
  this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
14755
- var clickEvent = new MouseEvent("click", {
14756
- "view": window,
14757
- "bubbles": true,
14758
- "cancelable": false
14759
- });
14760
- (_c = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _c === void 0 ? void 0 : _c.dispatchEvent(clickEvent);
14761
- // if(currentColumnButton != null) {
14762
- // currentColumnButton.click();
14763
- // }
14764
15013
  }
14765
15014
  }
14766
15015
  });
14767
- (_w = this._SfDetailContainer.querySelector('#button-uploader-submit-audit')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', async (ev) => {
15016
+ (_j = eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
14768
15017
  var _a, _b;
14769
15018
  let buttonClick = ev.target;
14770
15019
  buttonClick.innerHTML = "Saving...";
14771
- const comments = this._SfDetailContainer.querySelector('#input-auditor-comments').value;
14772
- const approved = this._SfDetailContainer.querySelector('#input-approve-yes').checked;
14773
- let currStatus = this.getCompletenessStatus(event);
14774
- let newEvent = { ...event };
14775
- newEvent.comments = comments;
14776
- newEvent.approved = approved;
14777
- let newStatus = this.getCompletenessStatus(newEvent);
14778
- console.log('status', currStatus, newStatus);
14779
- if (currStatus == newStatus) {
14780
- buttonClick.innerHTML = "Save";
14781
- this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
14782
- setTimeout(() => {
14783
- this.clearMessages();
14784
- }, 3000);
14785
- return;
14786
- }
15020
+ const comments = eventDetailReportingContainer.querySelector('#input-auditor-comments').value;
15021
+ const approved = eventDetailReportingContainer.querySelector('#input-approve-yes').checked;
14787
15022
  if (comments.trim().length === 0) {
14788
15023
  buttonClick.innerHTML = "Save";
14789
15024
  this.setError('Comments cannot be blank!');
@@ -14794,22 +15029,14 @@ let SfIEvents = class SfIEvents extends LitElement {
14794
15029
  else {
14795
15030
  let flagBulk = false;
14796
15031
  if (this.selectedItemIds.length <= 1) {
14797
- if (await this.uploadAudit(entityId, locationId, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
14798
- if (this.mode == "next") {
14799
- for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
14800
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
14801
- this.nextEvents[this.nextTabRole][mmdd][p].approved = approved;
14802
- this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
14803
- this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
14804
- }
14805
- }
14806
- }
14807
- else {
14808
- for (var p = 0; p < this.events[mmdd].length; p++) {
14809
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
14810
- this.events[mmdd][p].approved = approved;
14811
- this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
14812
- this.events[mmdd][p].lastupdated = new Date().toString();
15032
+ if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
15033
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15034
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
15035
+ this.events[mmdd][p].approved = approved;
15036
+ this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
15037
+ this.events[mmdd][p].lastupdated = new Date().toString();
15038
+ if (approved) {
15039
+ this.events[mmdd][p].dateofcompletion = new Date().getTime() + "";
14813
15040
  }
14814
15041
  }
14815
15042
  }
@@ -14824,8 +15051,8 @@ let SfIEvents = class SfIEvents extends LitElement {
14824
15051
  for (var k = 0; k < this.selectedItemIds.length; k++) {
14825
15052
  const selectedId = this.selectedItemIds[k];
14826
15053
  //console.log('selectedid', selectedId);
14827
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14828
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
15054
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15055
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
14829
15056
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14830
15057
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14831
15058
  //console.log(entityId, locationId, eventId, mmddyyyy);
@@ -14850,20 +15077,20 @@ let SfIEvents = class SfIEvents extends LitElement {
14850
15077
  for (var k = 0; k < this.selectedItemIds.length; k++) {
14851
15078
  const selectedId = this.selectedItemIds[k];
14852
15079
  //console.log('selectedid', selectedId);
14853
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
14854
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
15080
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15081
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
14855
15082
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
14856
15083
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
14857
15084
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
14858
15085
  if (this.mode == "next") {
14859
15086
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
14860
15087
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
14861
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
14862
15088
  flagBulk = true;
15089
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
14863
15090
  if (this.recentlyReported[mmdd] == null) {
14864
15091
  this.recentlyReported[mmdd] = [];
14865
15092
  }
14866
- this.recentlyReported[mmdd].push(this.events[mmdd][p]);
15093
+ this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p]);
14867
15094
  }
14868
15095
  }
14869
15096
  }
@@ -14881,12 +15108,6 @@ let SfIEvents = class SfIEvents extends LitElement {
14881
15108
  }
14882
15109
  }
14883
15110
  }
14884
- var clickEvent = new MouseEvent("click", {
14885
- "view": window,
14886
- "bubbles": true,
14887
- "cancelable": false
14888
- });
14889
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
14890
15111
  if (this.mode == "next") {
14891
15112
  // this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
14892
15113
  this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
@@ -14912,33 +15133,33 @@ let SfIEvents = class SfIEvents extends LitElement {
14912
15133
  }
14913
15134
  });
14914
15135
  if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
14915
- if (approved) {
14916
- if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
14917
- this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'hidden';
15136
+ if (event.approved) {
15137
+ if (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') != null) {
15138
+ eventDetailReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'hidden';
14918
15139
  }
14919
15140
  }
14920
15141
  else {
14921
- if (this._SfDetailContainer.querySelector('#button-uploader-submit-report') != null) {
14922
- this._SfDetailContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
14923
- (_x = this._SfDetailContainer.querySelector('#button-uploader-submit-report')) === null || _x === void 0 ? void 0 : _x.addEventListener('click', async (ev) => {
15142
+ if (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') != null) {
15143
+ eventDetailReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
15144
+ (_k = eventDetailReportingContainer.querySelector('#button-uploader-submit-report')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', async (ev) => {
14924
15145
  var _a, _b, _c, _f;
14925
15146
  let buttonClick = ev.target;
14926
15147
  buttonClick.innerHTML = "Saving...";
14927
- const reportercomments = this._SfDetailContainer.querySelector('#input-reporter-comments').value;
15148
+ const reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
14928
15149
  //console.log('reporter comments 1', reportercomments);
14929
- const reporterdoc = this._SfDetailContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(this._SfDetailContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
15150
+ const reporterdoc = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
14930
15151
  let docs = [];
14931
15152
  //console.log('reporter comments 2', reportercomments);
15153
+ // if(docsOptional.length === 0) {
14932
15154
  let percentage = "100";
14933
- if (this._SfDetailContainer.querySelector('#input-reporter-percentage') != null) {
14934
- percentage = this._SfDetailContainer.querySelector('#input-reporter-percentage').value;
15155
+ if (eventDetailReportingContainer.querySelector('#input-reporter-percentage') != null) {
15156
+ percentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage').value;
14935
15157
  }
14936
- // if(docsOptional.length === 0) {
14937
15158
  docs = this._SfUploader[0].querySelector('#uploader').selectedValues();
14938
15159
  // }
14939
15160
  let flag = false;
14940
15161
  do {
14941
- if (docs.length > 0 && docsOptional != null && docsOptional.length === 0 && parseInt(percentage) > 0) {
15162
+ if (docs.length > 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
14942
15163
  for (let doc of docs) {
14943
15164
  if ((doc.jobId == null || doc.jobId.length === 0) && (doc.ext.toLowerCase() == 'pdf' || doc.ext.toLowerCase() == 'png' || doc.ext.toLowerCase() == 'jpeg' || doc.ext.toLowerCase() == 'jpg')) {
14944
15165
  flag = false;
@@ -14964,6 +15185,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14964
15185
  reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
14965
15186
  reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
14966
15187
  }
15188
+ console.log('percentage', percentage, eventDetailReportingContainer.querySelector('#input-reporter-percentage').value);
14967
15189
  if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
14968
15190
  //console.log('reporter comments 3', reportercomments);
14969
15191
  buttonClick.innerHTML = "Save";
@@ -14973,7 +15195,7 @@ let SfIEvents = class SfIEvents extends LitElement {
14973
15195
  }, 3000);
14974
15196
  }
14975
15197
  else {
14976
- if (docs.length === 0 && docsOptional.length === 0 && parseInt(percentage) > 0) {
15198
+ if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
14977
15199
  //console.log('reporter comments 3', reportercomments);
14978
15200
  buttonClick.innerHTML = "Save";
14979
15201
  this.setError('No documents uploaded!');
@@ -15007,43 +15229,58 @@ let SfIEvents = class SfIEvents extends LitElement {
15007
15229
  }, 3000);
15008
15230
  }
15009
15231
  else {
15010
- var clickEvent = new MouseEvent("click", {
15011
- "view": window,
15012
- "bubbles": true,
15013
- "cancelable": false
15014
- });
15015
- this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
15016
15232
  let flagBulk = false;
15017
- let reportinglocation = selectReportingLocation.value;
15233
+ // let reportedlocations = selectReportingLocation?.value ?? "";
15234
+ let reportedlocations = "[]";
15235
+ if (parseInt(percentage) !== 100) {
15236
+ let selectReportedLocations = eventDetailReportingContainer.querySelectorAll('.input-reporter-location');
15237
+ for (let selectReportedLocation of selectReportedLocations) {
15238
+ reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value]);
15239
+ }
15240
+ }
15018
15241
  if (this.selectedItemIds.length <= 1) {
15019
- //console.log('makerscheckers', makercheckers, reportercomments);
15020
- // console.log('reportformatvalues', reportformatvalues)
15021
- // console.log('reportformatschema',reportformatschema)
15022
- if (await this.uploadReport(entityId, locationId, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_c = event.module) !== null && _c !== void 0 ? _c : "compliance", percentage, makercheckers, reportinglocation)) {
15023
- if (this.mode == "next") {
15024
- for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
15025
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
15026
- this.nextEvents[this.nextTabRole][mmdd][p].documents = docs;
15027
- this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
15028
- this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
15029
- }
15030
- }
15031
- }
15032
- else {
15033
- console.log('this.events', this.events);
15242
+ if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (_c = event.module) !== null && _c !== void 0 ? _c : "compliance", percentage, event.makercheckers, reportedlocations)) {
15243
+ if (this.mode != "next") {
15034
15244
  for (var p = 0; p < this.events[mmdd].length; p++) {
15035
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15245
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
15036
15246
  this.events[mmdd][p].documents = docs;
15247
+ this.events[mmdd][p].percentage = percentage;
15248
+ this.events[mmdd][p].reportedlocations = reportedlocations;
15037
15249
  this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
15038
15250
  this.events[mmdd][p].lastupdated = new Date().toString();
15039
15251
  }
15040
15252
  }
15253
+ if (event.makercheckers.length > 0) {
15254
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
15255
+ for (var p = 0; p < this.events[mmdd].length; p++) {
15256
+ if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
15257
+ this.events[mmdd][p].approved = true;
15258
+ // this.events[mmdd][p].documents = docs
15259
+ this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
15260
+ this.events[mmdd][p].lastupdated = new Date().toString();
15261
+ }
15262
+ }
15263
+ }
15264
+ if (this.recentlyReported[mmdd] == null) {
15265
+ this.recentlyReported[mmdd] = [];
15266
+ }
15267
+ this.recentlyReported[mmdd].push(event);
15268
+ console.log('recently reported', this.recentlyReported);
15041
15269
  }
15042
- if (makercheckers.length > 0) {
15043
- // await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
15044
- if (this.mode == "next") {
15270
+ else {
15271
+ for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
15272
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
15273
+ this.nextEvents[this.nextTabRole][mmdd][p].documents = docs;
15274
+ this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage;
15275
+ this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations;
15276
+ this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
15277
+ this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
15278
+ }
15279
+ }
15280
+ if (event.makercheckers.length > 0) {
15281
+ // await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
15045
15282
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
15046
- if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
15283
+ if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid == event.locationid && this.nextEvents[this.nextTabRole][mmdd][p].entityid == event.entityid) {
15047
15284
  this.nextEvents[this.nextTabRole][mmdd][p].approved = true;
15048
15285
  // this.events[mmdd][p].documents = docs
15049
15286
  this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
@@ -15051,21 +15288,12 @@ let SfIEvents = class SfIEvents extends LitElement {
15051
15288
  }
15052
15289
  }
15053
15290
  }
15054
- else {
15055
- for (var p = 0; p < this.events[mmdd].length; p++) {
15056
- if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15057
- this.events[mmdd][p].approved = true;
15058
- // this.events[mmdd][p].documents = docs
15059
- this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
15060
- this.events[mmdd][p].lastupdated = new Date().toString();
15061
- }
15062
- }
15291
+ if (this.recentlyReported[mmdd] == null) {
15292
+ this.recentlyReported[mmdd] = [];
15063
15293
  }
15294
+ this.recentlyReported[mmdd].push(event);
15295
+ console.log('recently reported', this.recentlyReported);
15064
15296
  }
15065
- if (this.recentlyReported[mmdd] == null) {
15066
- this.recentlyReported[mmdd] = [];
15067
- }
15068
- this.recentlyReported[mmdd].push(event);
15069
15297
  }
15070
15298
  }
15071
15299
  else {
@@ -15075,30 +15303,11 @@ let SfIEvents = class SfIEvents extends LitElement {
15075
15303
  const selectedId = this.selectedItemIds[k];
15076
15304
  //console.log('selectedid', selectedId);
15077
15305
  const makercheckersL = selectedId.split('-')[5];
15078
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
15079
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
15306
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15307
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
15080
15308
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15081
15309
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15082
15310
  //console.log(entityId, locationId, eventId, mmddyyyy);
15083
- // bulkBody.push({
15084
- // "mmddyyyy": mmddyyyy,
15085
- // "projectid": this.projectId,
15086
- // "type": "report",
15087
- // "eventid": eventId,
15088
- // "comments": reportercomments,
15089
- // "dateofcompletion": reporterdoc,
15090
- // "entityid": entityId,
15091
- // "locationid": locationId,
15092
- // "event": null,
15093
- // "docs": JSON.stringify(docs),
15094
- // "username": this.userName,
15095
- // "reportformatvalues": reportformatvalues,
15096
- // "reportformatschema": reportformatschema,
15097
- // "userid": this.userProfileId,
15098
- // "userrole": this.myRole,
15099
- // "year": this.calendarStartYYYY,
15100
- // "module": event.module ?? "compliance"
15101
- // })
15102
15311
  // await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
15103
15312
  // if(parseInt(makercheckersL) > 0) {
15104
15313
  // bulkBodyReview.push({
@@ -15133,7 +15342,7 @@ let SfIEvents = class SfIEvents extends LitElement {
15133
15342
  "comments": reportercomments,
15134
15343
  "dateofcompletion": reporterdoc,
15135
15344
  "percentage": percentage,
15136
- "reportinglocation": reportinglocation,
15345
+ "reportedlocations": reportedlocations,
15137
15346
  "entityid": entityId,
15138
15347
  "locationid": locationId,
15139
15348
  "event": null,
@@ -15152,26 +15361,27 @@ let SfIEvents = class SfIEvents extends LitElement {
15152
15361
  // await this.sleep(2000);
15153
15362
  // this.clearMessages();
15154
15363
  }
15364
+ // await this.uploadReportsBulk(bulkBody);
15365
+ // await this.fetchBulkReportingData();
15155
15366
  if (bulkBody.length > 0) {
15156
15367
  await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
15157
15368
  }
15158
- // await this.fetchBulkReportingData();
15159
15369
  // if(bulkBodyReview.length > 0){
15160
15370
  // await this.uploadReportsReviewsBulk(bulkBodyReview)
15161
15371
  // }
15162
15372
  for (var k = 0; k < this.selectedItemIds.length; k++) {
15163
15373
  const selectedId = this.selectedItemIds[k];
15164
15374
  //console.log('selectedid', selectedId);
15165
- entityId = selectedId.split('-')[7].replace(/_/g, '-');
15166
- locationId = selectedId.split('-')[8].replace(/_/g, '-');
15375
+ let entityId = selectedId.split('-')[7].replace(/_/g, '-');
15376
+ let locationId = selectedId.split('-')[8].replace(/_/g, '-');
15167
15377
  const eventId = selectedId.split('-')[9].replace(/_/g, '-');
15168
15378
  mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
15169
15379
  let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
15170
15380
  if (this.mode == "next") {
15171
15381
  for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
15172
15382
  if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid == locationId && this.nextEvents[this.nextTabRole][mmdd][p].entityid == entityId) {
15173
- this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
15174
15383
  flagBulk = true;
15384
+ this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
15175
15385
  if (this.recentlyReported[mmdd] == null) {
15176
15386
  this.recentlyReported[mmdd] = [];
15177
15387
  }
@@ -15182,8 +15392,8 @@ let SfIEvents = class SfIEvents extends LitElement {
15182
15392
  else {
15183
15393
  for (var p = 0; p < this.events[mmdd].length; p++) {
15184
15394
  if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
15185
- this.events[mmdd][p].isbulk = true;
15186
15395
  flagBulk = true;
15396
+ this.events[mmdd][p].isbulk = true;
15187
15397
  if (this.recentlyReported[mmdd] == null) {
15188
15398
  this.recentlyReported[mmdd] = [];
15189
15399
  }
@@ -15224,32 +15434,38 @@ let SfIEvents = class SfIEvents extends LitElement {
15224
15434
  }
15225
15435
  }
15226
15436
  if (this._SfUploader[0] != null) {
15227
- this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "none";
15437
+ if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
15438
+ eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
15439
+ }
15228
15440
  this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev) => {
15229
15441
  console.log('uploader analysisInProgress', _ev);
15230
- this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "block";
15442
+ if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
15443
+ eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "block";
15444
+ }
15231
15445
  });
15232
15446
  this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev) => {
15233
15447
  console.log('uploader analysisInProgress', _ev);
15234
- if (this._SfDetailContainer.querySelector('.uploader-analysis-message') != null) {
15235
- this._SfDetailContainer.querySelector('.uploader-analysis-message').style.display = "none";
15448
+ if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
15449
+ eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
15236
15450
  }
15237
15451
  });
15238
15452
  //console.log('documentType checking', documentType);
15239
- if (documentType != null) {
15240
- this._SfUploader[0].querySelector('#uploader').docType = documentType;
15453
+ if (event.documentType != null) {
15454
+ this._SfUploader[0].querySelector('#uploader').docType = event.documentType;
15241
15455
  }
15242
15456
  else {
15243
15457
  this._SfUploader[0].querySelector('#uploader').docType = "";
15244
15458
  }
15245
15459
  this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify([]);
15246
15460
  console.log('uploader', this._SfUploader[0].querySelector('#uploader'));
15461
+ this._SfUploader[0].querySelector('#uploader').current = 0;
15247
15462
  this._SfUploader[0].querySelector('#uploader').loadMode();
15248
15463
  if (docs.length > 0) {
15249
15464
  this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify(docs);
15465
+ this._SfUploader[0].querySelector('#uploader').current = docs.length;
15250
15466
  this._SfUploader[0].querySelector('#uploader').loadMode();
15251
15467
  }
15252
- if (this.myRole == this.TAB_APPROVER || approved) {
15468
+ if (this.myRole == this.TAB_APPROVER || event.approved) {
15253
15469
  this._SfUploader[0].querySelector('#uploader').readOnly = true;
15254
15470
  this._SfUploader[0].querySelector('#uploader').loadMode();
15255
15471
  }
@@ -15260,8 +15476,8 @@ let SfIEvents = class SfIEvents extends LitElement {
15260
15476
  const dataPassthrough = {
15261
15477
  projectId: this.projectId,
15262
15478
  countryId: this.countryId,
15263
- entityId: entityId,
15264
- locationId: locationId,
15479
+ entityId: event.entityid,
15480
+ locationId: event.locationid,
15265
15481
  mmddyyyy: mmddyyyy,
15266
15482
  complianceId: event['id'],
15267
15483
  path: "uploadextract"
@@ -15273,6 +15489,7 @@ let SfIEvents = class SfIEvents extends LitElement {
15273
15489
  this._SfUploader[0].querySelector('#uploader').callbackUrlHost = callbackUrlHost;
15274
15490
  this._SfUploader[0].querySelector('#uploader').callbackUrlPath = callbackUrlPath;
15275
15491
  this._SfUploader[0].querySelector('#uploader').loadMode();
15492
+ console.log('uploader prepopulate', this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr, this._SfUploader[0].querySelector('#uploader').extract);
15276
15493
  }
15277
15494
  //console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
15278
15495
  if (this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
@@ -15280,50 +15497,34 @@ let SfIEvents = class SfIEvents extends LitElement {
15280
15497
  if (event["approved"] != null) {
15281
15498
  if (event["approved"] === true) {
15282
15499
  //console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
15283
- if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
15284
- this._SfDetailContainer.querySelector('#input-approve-yes').checked = true;
15500
+ if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
15501
+ eventDetailReportingContainer.querySelector('#input-approve-yes').checked = true;
15285
15502
  }
15286
- if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
15287
- this._SfDetailContainer.querySelector('#input-approve-no').checked = false;
15503
+ if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
15504
+ eventDetailReportingContainer.querySelector('#input-approve-no').checked = false;
15288
15505
  }
15289
15506
  }
15290
15507
  else {
15291
- if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
15292
- this._SfDetailContainer.querySelector('#input-approve-yes').checked = false;
15508
+ if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
15509
+ eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
15293
15510
  }
15294
- if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
15295
- this._SfDetailContainer.querySelector('#input-approve-no').checked = true;
15511
+ if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
15512
+ eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
15296
15513
  }
15297
15514
  }
15298
15515
  }
15299
15516
  else {
15300
- if (this._SfDetailContainer.querySelector('#input-approve-yes') != null) {
15301
- this._SfDetailContainer.querySelector('#input-approve-yes').checked = false;
15517
+ if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
15518
+ eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
15302
15519
  }
15303
- if (this._SfDetailContainer.querySelector('#input-approve-no') != null) {
15304
- this._SfDetailContainer.querySelector('#input-approve-no').checked = true;
15520
+ if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
15521
+ eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
15305
15522
  }
15306
15523
  }
15307
15524
  }
15308
15525
  }
15309
- this.fetchStatuteDefinitionDetails(statuteName);
15310
- console.log('customreporting', event['customreporting']);
15311
- if (event['customreporting'] != null) {
15312
- let reportingContainer = this._SfDetailContainer;
15313
- if (reportingContainer.querySelector('#report-format-container') != null) {
15314
- reportingContainer.querySelector('#report-format-container').innerHTML = `<slot name="reporting"></slot>`;
15315
- console.log('innerhtml', reportingContainer.querySelector('#report-format-container').innerHTML);
15316
- this._SfReporting[0].querySelector('#reporting-format').name = event.obligationtitle;
15317
- this._SfReporting[0].querySelector('#reporting-format').mode = "edit";
15318
- this._SfReporting[0].querySelector('#reporting-format').configjson = event['customreporting'];
15319
- // if(reportformatvalues != ""){
15320
- // (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
15321
- // }
15322
- this._SfReporting[0].querySelector('#reporting-format').loadMode();
15323
- }
15324
- }
15325
- else if (event['reportformat'] != null && event['reportformat'].length > 0) {
15326
- this.fetchReportFormat(this._SfDetailContainer, reportformatName, (_y = event['reportformatschema']) !== null && _y !== void 0 ? _y : "", (_z = event['reportformatvalues']) !== null && _z !== void 0 ? _z : "");
15526
+ if (event['reportformat'] != null && event['reportformat'].length > 0) {
15527
+ this.fetchReportFormat(eventDetailReportingContainer, reportformatName, (_l = event['reportformatschema']) !== null && _l !== void 0 ? _l : "", (_m = event['reportformatvalues']) !== null && _m !== void 0 ? _m : "");
15327
15528
  }
15328
15529
  };
15329
15530
  this.renderCalendar = () => {
@@ -23295,7 +23496,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23295
23496
  let path = "", view = "";
23296
23497
  this.sdate = startDate;
23297
23498
  this.edate = endDate;
23298
- this.suspenseCount = 0;
23499
+ this.suspenseCount = this.suspenseFlag ? this.suspenseCount : 0;
23299
23500
  if (this.tagId != null && this.tagId != "") {
23300
23501
  view = "tag";
23301
23502
  }
@@ -23343,7 +23544,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23343
23544
  await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete);
23344
23545
  if (JSON.stringify(urlBody) == this.getallcountryevetsParams) {
23345
23546
  this.lastupdated = Util.getDateTimeStrings(new Date().getTime());
23346
- this.suspenseCount = (_a = jsonRespose.suspensecount) !== null && _a !== void 0 ? _a : 0;
23547
+ this.suspenseCount = this.suspenseFlag ? this.suspenseCount : ((_a = jsonRespose.suspensecount) !== null && _a !== void 0 ? _a : 0);
23347
23548
  console.log('rendering appropriate string', list, this.selectedTab);
23348
23549
  this.renderAppropriateStream(startDate, endDate, true);
23349
23550
  this.fetchBulkReportingData();
@@ -24615,7 +24816,6 @@ let SfIEvents = class SfIEvents extends LitElement {
24615
24816
  let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
24616
24817
  console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
24617
24818
  if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
24618
- 4;
24619
24819
  this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer);
24620
24820
  }
24621
24821
  else {
@@ -26363,6 +26563,10 @@ SfIEvents.styles = css `
26363
26563
  margin-left: 10px;
26364
26564
  }
26365
26565
 
26566
+ .ml-10-m-0 {
26567
+ margin-left: 10px;
26568
+ }
26569
+
26366
26570
  .mt-20 {
26367
26571
  margin-top: 20px;
26368
26572
  }
@@ -26371,6 +26575,10 @@ SfIEvents.styles = css `
26371
26575
  margin-left: 20px;
26372
26576
  }
26373
26577
 
26578
+ .ml-20-m-0 {
26579
+ margin-left: 20px;
26580
+ }
26581
+
26374
26582
  .mr-20 {
26375
26583
  margin-right: 20px;
26376
26584
  }
@@ -26533,6 +26741,14 @@ SfIEvents.styles = css `
26533
26741
  .calendar-right-data {
26534
26742
  width: 100%;
26535
26743
  }
26744
+
26745
+ .ml-10-m-0 {
26746
+ margin-left: 0px;
26747
+ }
26748
+
26749
+ .ml-20-m-0 {
26750
+ margin-left: 0px;
26751
+ }
26536
26752
 
26537
26753
  }
26538
26754