sf-i-events 1.0.950 → 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/dev/index.html +4 -4
- package/package.json +1 -1
- package/sf-i-events.d.ts +2 -0
- package/sf-i-events.js +634 -433
- package/src/sf-i-events.ts +637 -448
- package/src/util.ts +1 -0
package/sf-i-events.js
CHANGED
|
@@ -1274,6 +1274,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
1274
1274
|
this.registerFilters = {};
|
|
1275
1275
|
this.suspenseFlag = false;
|
|
1276
1276
|
this.tablecols = [];
|
|
1277
|
+
this.reportedLocationsVals = [];
|
|
1277
1278
|
this.isSelectedLegend = (value) => {
|
|
1278
1279
|
return this.chartSelectedLegend.includes(value);
|
|
1279
1280
|
};
|
|
@@ -3579,7 +3580,9 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3579
3580
|
let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
3580
3581
|
let docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
3581
3582
|
let uploadGuidance = (_a = event['uploadguidance']) !== null && _a !== void 0 ? _a : 0;
|
|
3582
|
-
|
|
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);
|
|
3583
3586
|
if (this.selectedItemIds.length > 0) {
|
|
3584
3587
|
html += `<div class="d-flex justify-between ">
|
|
3585
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>
|
|
@@ -3608,19 +3611,39 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3608
3611
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
3609
3612
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
3610
3613
|
html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
|
|
3611
|
-
html += '<div class="d-flex justify-start align-center">';
|
|
3614
|
+
html += '<div class="d-flex justify-start align-center flex-wrap">';
|
|
3612
3615
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
3613
3616
|
html += '<label part="input-label">Completion Percentage</label>';
|
|
3614
3617
|
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1" disabled/><br />';
|
|
3615
3618
|
html += '</div>';
|
|
3616
|
-
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">';
|
|
3617
3620
|
html += '<label part="input-label">Entity</label>';
|
|
3618
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
3621
|
+
html += '<select id="input-reporter-entity-0" part="input" disabled></select>';
|
|
3619
3622
|
html += '</div>';
|
|
3620
|
-
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">';
|
|
3621
3624
|
html += '<label part="input-label">Location</label>';
|
|
3622
|
-
html += '<select id="input-reporter-location" part="input"></select
|
|
3625
|
+
html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input" disabled></select>';
|
|
3623
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
|
+
}
|
|
3624
3647
|
html += '</div>';
|
|
3625
3648
|
}
|
|
3626
3649
|
html += '<div>';
|
|
@@ -3669,20 +3692,41 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3669
3692
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
3670
3693
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
3671
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 />';
|
|
3672
|
-
html += '<div class="d-flex justify-start align-
|
|
3695
|
+
html += '<div class="d-flex justify-start align-end flex-wrap">';
|
|
3673
3696
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
3674
3697
|
html += '<label part="input-label">Completion Percentage*</label>';
|
|
3675
|
-
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"
|
|
3698
|
+
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/>';
|
|
3676
3699
|
html += '</div>';
|
|
3677
|
-
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">';
|
|
3678
3701
|
html += '<label part="input-label">Entity</label>';
|
|
3679
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
3702
|
+
html += '<select id="input-reporter-entity-0" part="input"></select>';
|
|
3680
3703
|
html += '</div>';
|
|
3681
|
-
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">';
|
|
3682
3705
|
html += '<label part="input-label">Location</label>';
|
|
3683
|
-
html += '<select id="input-reporter-location" part="input"></select
|
|
3684
|
-
html += '</div>';
|
|
3706
|
+
html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input"></select>';
|
|
3685
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>';
|
|
3686
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 />';
|
|
3687
3731
|
// if(docsOptional.length === 0) {
|
|
3688
3732
|
html += '<label id="input-label-docs" part="input-label">Supporting Documents' + ((docsOptional.length > 0) ? '' : '*') + '</label>';
|
|
@@ -3891,12 +3935,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3891
3935
|
}
|
|
3892
3936
|
});
|
|
3893
3937
|
(_h = listReportingContainer.querySelector('#upload-guidance-button')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async () => {
|
|
3894
|
-
var _a, _b, _c, _f, _g, _h
|
|
3938
|
+
var _a, _b, _c, _f, _g, _h;
|
|
3895
3939
|
console.log('upload guidance clicked', event);
|
|
3896
3940
|
let inputReportingPercentage = (_b = (_a = listReportingContainer.querySelector('#input-reporter-percentage')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "100";
|
|
3897
|
-
let
|
|
3898
|
-
let
|
|
3899
|
-
|
|
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 : "";
|
|
3900
3948
|
let dateOfCompletion;
|
|
3901
3949
|
if (listReportingContainer.querySelector('#input-reporter-doc') != null) {
|
|
3902
3950
|
dateOfCompletion = new Date(listReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "";
|
|
@@ -3909,30 +3957,37 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3909
3957
|
dateOfCompletion = "";
|
|
3910
3958
|
}
|
|
3911
3959
|
console.log('dateOfCompletion', dateOfCompletion);
|
|
3912
|
-
await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage,
|
|
3960
|
+
await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
|
|
3913
3961
|
});
|
|
3914
3962
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
3915
3963
|
let inputReportingPercentage = listReportingContainer.querySelector('#input-reporter-percentage');
|
|
3916
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');
|
|
3917
3968
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
3918
|
-
|
|
3919
|
-
|
|
3969
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
3970
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
3971
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
3920
3972
|
}
|
|
3921
3973
|
else {
|
|
3922
|
-
|
|
3923
|
-
|
|
3974
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
3975
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
3976
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
3924
3977
|
}
|
|
3925
3978
|
inputReportingPercentage === null || inputReportingPercentage === void 0 ? void 0 : inputReportingPercentage.addEventListener('change', () => {
|
|
3926
3979
|
setTimeout(() => {
|
|
3927
3980
|
let percentage = inputReportingPercentage.value;
|
|
3928
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
3981
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
3929
3982
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
3930
|
-
|
|
3931
|
-
|
|
3983
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
3984
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
3985
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
3932
3986
|
}
|
|
3933
3987
|
else {
|
|
3934
|
-
|
|
3935
|
-
|
|
3988
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
3989
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
3990
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
3936
3991
|
}
|
|
3937
3992
|
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
3938
3993
|
listReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
|
|
@@ -3940,70 +3995,127 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
3940
3995
|
else {
|
|
3941
3996
|
listReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents*';
|
|
3942
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
|
+
}
|
|
3943
4007
|
}, 200);
|
|
3944
4008
|
});
|
|
3945
|
-
let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity');
|
|
3946
|
-
let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location');
|
|
3947
|
-
selectReportingEntity.innerHTML = '';
|
|
3948
4009
|
let projectUserMap = Util.getProjectUsermap();
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
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 = '';
|
|
3962
4039
|
for (let country of Object.keys(projectUserMap)) {
|
|
3963
4040
|
if (country == "roles") {
|
|
3964
4041
|
continue;
|
|
3965
4042
|
}
|
|
3966
4043
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
3967
|
-
|
|
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") {
|
|
3968
4053
|
continue;
|
|
3969
4054
|
}
|
|
3970
|
-
for (let
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
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
|
+
}
|
|
3974
4064
|
}
|
|
3975
4065
|
}
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
if (event.reportedlocations.indexOf(location) >= 0) {
|
|
3990
|
-
selectReportingEntity.value = entity;
|
|
3991
|
-
const changeEvent = new Event('change', { bubbles: true });
|
|
3992
|
-
selectReportingEntity.dispatchEvent(changeEvent);
|
|
3993
|
-
selectReportingLocation.value = location;
|
|
3994
|
-
flagSetVal = true;
|
|
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") {
|
|
4072
|
+
continue;
|
|
4073
|
+
}
|
|
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);
|
|
3995
4079
|
break;
|
|
3996
4080
|
}
|
|
3997
|
-
}
|
|
3998
|
-
if (flagSetVal) {
|
|
3999
4081
|
break;
|
|
4000
4082
|
}
|
|
4083
|
+
break;
|
|
4001
4084
|
}
|
|
4002
4085
|
}
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
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) {
|
|
4110
|
+
break;
|
|
4111
|
+
}
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4114
|
+
}
|
|
4115
|
+
else {
|
|
4116
|
+
selectReportingEntity.value = "";
|
|
4117
|
+
selectReportingLocation.value = "";
|
|
4118
|
+
}
|
|
4007
4119
|
}
|
|
4008
4120
|
(_j = listReportingContainer.querySelector('#button-uploader-submit-approve')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
|
|
4009
4121
|
var _a, _b;
|
|
@@ -4263,7 +4375,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4263
4375
|
if (listReportingContainer.querySelector('#button-uploader-submit-report') != null) {
|
|
4264
4376
|
listReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
|
|
4265
4377
|
(_l = listReportingContainer.querySelector('#button-uploader-submit-report')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', async (ev) => {
|
|
4266
|
-
var _a, _b, _c, _f
|
|
4378
|
+
var _a, _b, _c, _f;
|
|
4267
4379
|
let buttonClick = ev.target;
|
|
4268
4380
|
buttonClick.innerHTML = "Saving...";
|
|
4269
4381
|
const reportercomments = listReportingContainer.querySelector('#input-reporter-comments').value;
|
|
@@ -4351,13 +4463,22 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4351
4463
|
}
|
|
4352
4464
|
else {
|
|
4353
4465
|
let flagBulk = false;
|
|
4354
|
-
let reportedlocations =
|
|
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
|
+
}
|
|
4355
4474
|
if (this.selectedItemIds.length <= 1) {
|
|
4356
|
-
if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, (
|
|
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)) {
|
|
4357
4476
|
if (this.mode != "next") {
|
|
4358
4477
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
4359
4478
|
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
4360
4479
|
this.events[mmdd][p].documents = docs;
|
|
4480
|
+
this.events[mmdd][p].percentage = percentage;
|
|
4481
|
+
this.events[mmdd][p].reportedlocations = reportedlocations;
|
|
4361
4482
|
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
4362
4483
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
4363
4484
|
}
|
|
@@ -4383,6 +4504,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4383
4504
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
4384
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) {
|
|
4385
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;
|
|
4386
4509
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
4387
4510
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
|
|
4388
4511
|
}
|
|
@@ -4463,7 +4586,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4463
4586
|
"userid": this.userProfileId,
|
|
4464
4587
|
"userrole": this.myRole,
|
|
4465
4588
|
"year": yearStr,
|
|
4466
|
-
"module": (
|
|
4589
|
+
"module": (_f = event.module) !== null && _f !== void 0 ? _f : "compliance",
|
|
4467
4590
|
"makercheckers": (parseInt(makercheckersL) > 0) ? ["makercheckers"] : null
|
|
4468
4591
|
});
|
|
4469
4592
|
// }
|
|
@@ -4650,7 +4773,6 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
4650
4773
|
let listReportingContainer = eventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
4651
4774
|
// console.log('mmddyyyy', this.events[mmdd][j], listReportingContainer, '#list-reporting-container-'+mmdd.replace(/\//g,'-')+'-'+j);
|
|
4652
4775
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
4653
|
-
4;
|
|
4654
4776
|
this.renderListReporting(listReportingContainer, this.events[mmdd][j], mmdd + '/' + yyyy, eventsContainer);
|
|
4655
4777
|
}
|
|
4656
4778
|
else {
|
|
@@ -13906,16 +14028,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13906
14028
|
}
|
|
13907
14029
|
};
|
|
13908
14030
|
this.renderEventDetail = (event, mmddyyyy, currentColumnButton, eventsContainer, previousId, nextId) => {
|
|
13909
|
-
var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u
|
|
14031
|
+
var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
13910
14032
|
console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
|
|
13911
14033
|
console.log('previousid', previousId, 'nextid', nextId);
|
|
13912
14034
|
console.log('confighome', Util.getProjectConfigHome());
|
|
13913
|
-
let comments, docs, approved
|
|
14035
|
+
let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
|
|
13914
14036
|
let entityId = "";
|
|
13915
14037
|
let locationId = "";
|
|
13916
14038
|
let statuteName = "";
|
|
13917
14039
|
let reportformatName = "";
|
|
13918
|
-
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
14040
|
+
// let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
13919
14041
|
entityId = event.entityid;
|
|
13920
14042
|
locationId = event.locationid;
|
|
13921
14043
|
// let completeness = this.getCompletenessStatus(event);
|
|
@@ -13923,9 +14045,9 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13923
14045
|
docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
|
|
13924
14046
|
approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
|
|
13925
14047
|
// dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
13926
|
-
makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
13927
|
-
docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
13928
|
-
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];
|
|
13929
14051
|
statuteName = event['statute'][0].trim();
|
|
13930
14052
|
if (event['reportformat'] != null) {
|
|
13931
14053
|
reportformatName = ((_a = event['reportformat'][0]) !== null && _a !== void 0 ? _a : "").trim().replace('&', '&');
|
|
@@ -14205,7 +14327,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14205
14327
|
html += '</div>';
|
|
14206
14328
|
if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
|
|
14207
14329
|
if (this.mode != "viewer") {
|
|
14208
|
-
html += '<div part="reporting-view-container">';
|
|
14330
|
+
html += '<div part="reporting-view-container" id="reporting-view-container">';
|
|
14209
14331
|
html += this.renderReporting(event, mmddyyyy);
|
|
14210
14332
|
html += "</div>";
|
|
14211
14333
|
}
|
|
@@ -14272,94 +14394,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14272
14394
|
}
|
|
14273
14395
|
this._SfDetailContainer.innerHTML = html;
|
|
14274
14396
|
this._SfDetailContainer.style.display = 'block';
|
|
14275
|
-
// let attachmentUploaders = (this._SfDetailContainer as HTMLDivElement).querySelectorAll('.event-attachment') as NodeListOf<SfIUploader>
|
|
14276
|
-
// for(let attachmentUploader of attachmentUploaders){
|
|
14277
|
-
// attachmentUploader.loadMode();
|
|
14278
|
-
// }
|
|
14279
14397
|
if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
|
|
14280
14398
|
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
14281
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>`;
|
|
14282
14400
|
this._SfUploader[0].querySelector('#uploader').emailcontent = emailcontent;
|
|
14283
14401
|
}
|
|
14284
|
-
(_c = this._SfDetailContainer.querySelector('
|
|
14285
|
-
await this.fetchDeleteReview(event["id"], mmddyyyy, entityId, locationId);
|
|
14286
|
-
this.setSuccess('Deleted successfully!');
|
|
14287
|
-
setTimeout(() => {
|
|
14288
|
-
this.clearMessages();
|
|
14289
|
-
}, 3000);
|
|
14290
|
-
//console.log('deleted', resultDelete);
|
|
14291
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
14292
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
14293
|
-
// } else {
|
|
14294
|
-
if (currentColumnButton != null) {
|
|
14295
|
-
currentColumnButton.click();
|
|
14296
|
-
}
|
|
14297
|
-
// }
|
|
14298
|
-
var clickEvent = new MouseEvent("click", {
|
|
14299
|
-
"view": window,
|
|
14300
|
-
"bubbles": true,
|
|
14301
|
-
"cancelable": false
|
|
14302
|
-
});
|
|
14303
|
-
this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
|
|
14304
|
-
});
|
|
14305
|
-
(_f = this._SfDetailContainer.querySelector('#button-auto-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
|
|
14306
|
-
var _a, _b;
|
|
14307
|
-
if (this.selectedItemIds.length <= 1) {
|
|
14308
|
-
await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance");
|
|
14309
|
-
this.setSuccess('Auto-Approved successfully!');
|
|
14310
|
-
setTimeout(() => {
|
|
14311
|
-
this.clearMessages();
|
|
14312
|
-
}, 3000);
|
|
14313
|
-
}
|
|
14314
|
-
else {
|
|
14315
|
-
let bulkBodyReview = [];
|
|
14316
|
-
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14317
|
-
const selectedId = this.selectedItemIds[k];
|
|
14318
|
-
//console.log('selectedid', selectedId);
|
|
14319
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14320
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14321
|
-
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14322
|
-
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14323
|
-
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
14324
|
-
let yearStr = this.getFinancialYear(mmddyyyy);
|
|
14325
|
-
bulkBodyReview.push({
|
|
14326
|
-
"mmddyyyy": mmddyyyy,
|
|
14327
|
-
"projectid": this.projectId,
|
|
14328
|
-
"type": "review",
|
|
14329
|
-
"eventid": eventId,
|
|
14330
|
-
"comments": "Auto approved",
|
|
14331
|
-
"approved": true,
|
|
14332
|
-
"entityid": entityId,
|
|
14333
|
-
"locationid": locationId,
|
|
14334
|
-
"username": this.userName,
|
|
14335
|
-
"userid": this.userProfileId,
|
|
14336
|
-
"userrole": this.myRole,
|
|
14337
|
-
"year": yearStr,
|
|
14338
|
-
"module": (_b = event.module) !== null && _b !== void 0 ? _b : "compliance"
|
|
14339
|
-
});
|
|
14340
|
-
}
|
|
14341
|
-
await this.uploadReviewsBulk(bulkBodyReview);
|
|
14342
|
-
}
|
|
14343
|
-
//console.log('deleted', resultDelete);
|
|
14344
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
14345
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
14346
|
-
// } else {
|
|
14347
|
-
if (currentColumnButton != null) {
|
|
14348
|
-
currentColumnButton.click();
|
|
14349
|
-
}
|
|
14350
|
-
// }
|
|
14351
|
-
var clickEvent = new MouseEvent("click", {
|
|
14352
|
-
"view": window,
|
|
14353
|
-
"bubbles": true,
|
|
14354
|
-
"cancelable": false
|
|
14355
|
-
});
|
|
14356
|
-
this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
|
|
14357
|
-
});
|
|
14358
|
-
(_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', () => {
|
|
14359
14403
|
this._SfDetailContainer.innerHTML = '';
|
|
14360
14404
|
this._SfDetailContainer.style.display = 'none';
|
|
14361
14405
|
});
|
|
14362
|
-
(
|
|
14406
|
+
(_f = this._SfDetailContainer.querySelector('#button-detail-previous')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', () => {
|
|
14363
14407
|
var _a;
|
|
14364
14408
|
var clickEvent = new MouseEvent("click", {
|
|
14365
14409
|
"view": window,
|
|
@@ -14368,7 +14412,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14368
14412
|
});
|
|
14369
14413
|
(_a = eventsContainer.querySelector('#' + previousId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
|
|
14370
14414
|
});
|
|
14371
|
-
(
|
|
14415
|
+
(_g = this._SfDetailContainer.querySelector('#button-detail-next')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', () => {
|
|
14372
14416
|
var _a;
|
|
14373
14417
|
var clickEvent = new MouseEvent("click", {
|
|
14374
14418
|
"view": window,
|
|
@@ -14377,7 +14421,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14377
14421
|
});
|
|
14378
14422
|
(_a = eventsContainer.querySelector('#' + nextId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
|
|
14379
14423
|
});
|
|
14380
|
-
(
|
|
14424
|
+
(_h = this._SfDetailContainer.querySelector('.head-basic')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', () => {
|
|
14381
14425
|
//console.log('head basic clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-basic') as HTMLDivElement).style.display);
|
|
14382
14426
|
if (this._SfDetailContainer.querySelector('.body-basic').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-basic').style.display == '') {
|
|
14383
14427
|
this._SfDetailContainer.querySelector('.body-basic').style.display = 'none';
|
|
@@ -14388,7 +14432,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14388
14432
|
this._SfDetailContainer.querySelector('.head-indicator-basic').innerHTML = '-';
|
|
14389
14433
|
}
|
|
14390
14434
|
});
|
|
14391
|
-
(
|
|
14435
|
+
(_j = this._SfDetailContainer.querySelector('.head-statute')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', () => {
|
|
14392
14436
|
//console.log('head statute clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-statute') as HTMLDivElement).style.display);
|
|
14393
14437
|
if (this._SfDetailContainer.querySelector('.body-statute').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-statute').style.display == '') {
|
|
14394
14438
|
this._SfDetailContainer.querySelector('.body-statute').style.display = 'none';
|
|
@@ -14399,7 +14443,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14399
14443
|
this._SfDetailContainer.querySelector('.head-indicator-statute').innerHTML = '-';
|
|
14400
14444
|
}
|
|
14401
14445
|
});
|
|
14402
|
-
(
|
|
14446
|
+
(_k = this._SfDetailContainer.querySelector('.head-compliance')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', () => {
|
|
14403
14447
|
if (this._SfDetailContainer.querySelector('.body-compliance').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-compliance').style.display == '') {
|
|
14404
14448
|
this._SfDetailContainer.querySelector('.body-compliance').style.display = 'none';
|
|
14405
14449
|
this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '+';
|
|
@@ -14409,7 +14453,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14409
14453
|
this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '-';
|
|
14410
14454
|
}
|
|
14411
14455
|
});
|
|
14412
|
-
(
|
|
14456
|
+
(_l = this._SfDetailContainer.querySelector('.head-grc')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', () => {
|
|
14413
14457
|
if (this._SfDetailContainer.querySelector('.body-grc').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-grc').style.display == '') {
|
|
14414
14458
|
this._SfDetailContainer.querySelector('.body-grc').style.display = 'none';
|
|
14415
14459
|
this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '+';
|
|
@@ -14419,7 +14463,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14419
14463
|
this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '-';
|
|
14420
14464
|
}
|
|
14421
14465
|
});
|
|
14422
|
-
(
|
|
14466
|
+
(_m = this._SfDetailContainer.querySelector('.head-feedback')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', () => {
|
|
14423
14467
|
if (this._SfDetailContainer.querySelector('.body-feedback').style.display == 'flex') {
|
|
14424
14468
|
this._SfDetailContainer.querySelector('.body-feedback').style.display = 'none';
|
|
14425
14469
|
this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '+';
|
|
@@ -14429,11 +14473,11 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14429
14473
|
this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '-';
|
|
14430
14474
|
}
|
|
14431
14475
|
});
|
|
14432
|
-
(
|
|
14476
|
+
(_o = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', () => {
|
|
14433
14477
|
this._SfDetailContainer.innerHTML = '';
|
|
14434
14478
|
this._SfDetailContainer.style.display = 'none';
|
|
14435
14479
|
});
|
|
14436
|
-
(
|
|
14480
|
+
(_p = this._SfDetailContainer.querySelector('#button-feedback')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', () => {
|
|
14437
14481
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14438
14482
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
14439
14483
|
const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
|
|
@@ -14469,7 +14513,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14469
14513
|
// }
|
|
14470
14514
|
// console.log(body);
|
|
14471
14515
|
});
|
|
14472
|
-
(
|
|
14516
|
+
(_q = this._SfDetailContainer.querySelector('#button-feedback-cancel')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', () => {
|
|
14473
14517
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14474
14518
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
14475
14519
|
const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
|
|
@@ -14500,7 +14544,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14500
14544
|
buttonFeedback.classList.remove('hide');
|
|
14501
14545
|
}
|
|
14502
14546
|
});
|
|
14503
|
-
(
|
|
14547
|
+
(_r = this._SfDetailContainer.querySelector('#button-feedback-confirm')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', async () => {
|
|
14504
14548
|
var _a, _b, _c;
|
|
14505
14549
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14506
14550
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
@@ -14540,112 +14584,313 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14540
14584
|
buttonClose.click();
|
|
14541
14585
|
}
|
|
14542
14586
|
});
|
|
14543
|
-
(
|
|
14587
|
+
(_s = this._SfDetailContainer.querySelector('#feedback-message')) === null || _s === void 0 ? void 0 : _s.addEventListener('keyup', (e) => {
|
|
14544
14588
|
if (e.code == "Enter") {
|
|
14545
14589
|
const buttonConfirm = this._SfDetailContainer.querySelector('#button-feedback-confirm');
|
|
14546
14590
|
buttonConfirm.click();
|
|
14547
14591
|
}
|
|
14548
14592
|
});
|
|
14549
14593
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
14550
|
-
let
|
|
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('&', '&');
|
|
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');
|
|
14551
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');
|
|
14552
14735
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
14553
|
-
|
|
14554
|
-
|
|
14736
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
14737
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
14738
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
14555
14739
|
}
|
|
14556
14740
|
else {
|
|
14557
|
-
|
|
14558
|
-
|
|
14741
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
14742
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
14743
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
14559
14744
|
}
|
|
14560
14745
|
inputReportingPercentage === null || inputReportingPercentage === void 0 ? void 0 : inputReportingPercentage.addEventListener('change', () => {
|
|
14561
14746
|
setTimeout(() => {
|
|
14562
14747
|
let percentage = inputReportingPercentage.value;
|
|
14563
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
14748
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
14564
14749
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
14565
|
-
|
|
14566
|
-
|
|
14750
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
14751
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
14752
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
14567
14753
|
}
|
|
14568
14754
|
else {
|
|
14569
|
-
|
|
14570
|
-
|
|
14755
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
14756
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
14757
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
14571
14758
|
}
|
|
14572
|
-
if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
|
|
14573
|
-
|
|
14759
|
+
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
14760
|
+
eventDetailReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
|
|
14574
14761
|
}
|
|
14575
14762
|
else {
|
|
14576
|
-
|
|
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);
|
|
14577
14773
|
}
|
|
14578
14774
|
}, 200);
|
|
14579
14775
|
});
|
|
14580
|
-
let selectReportingEntity = this._SfDetailContainer.querySelector('#input-reporter-entity');
|
|
14581
|
-
let selectReportingLocation = this._SfDetailContainer.querySelector('#input-reporter-location');
|
|
14582
|
-
selectReportingEntity.innerHTML = '';
|
|
14583
14776
|
let projectUserMap = Util.getProjectUsermap();
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
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 = '';
|
|
14597
14806
|
for (let country of Object.keys(projectUserMap)) {
|
|
14598
14807
|
if (country == "roles") {
|
|
14599
14808
|
continue;
|
|
14600
14809
|
}
|
|
14601
14810
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
14602
|
-
|
|
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") {
|
|
14603
14820
|
continue;
|
|
14604
14821
|
}
|
|
14605
|
-
for (let
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
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
|
+
}
|
|
14609
14831
|
}
|
|
14610
14832
|
}
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
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);
|
|
14846
|
+
break;
|
|
14847
|
+
}
|
|
14848
|
+
break;
|
|
14849
|
+
}
|
|
14850
|
+
break;
|
|
14620
14851
|
}
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14629
|
-
|
|
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) {
|
|
14630
14877
|
break;
|
|
14631
14878
|
}
|
|
14632
14879
|
}
|
|
14633
|
-
if (flagSetVal) {
|
|
14634
|
-
break;
|
|
14635
|
-
}
|
|
14636
14880
|
}
|
|
14637
14881
|
}
|
|
14882
|
+
else {
|
|
14883
|
+
selectReportingEntity.value = "";
|
|
14884
|
+
selectReportingLocation.value = "";
|
|
14885
|
+
}
|
|
14638
14886
|
}
|
|
14639
|
-
|
|
14640
|
-
|
|
14641
|
-
selectReportingLocation.value = "";
|
|
14642
|
-
}
|
|
14643
|
-
(_v = this._SfDetailContainer.querySelector('#button-uploader-submit-approve')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', async (ev) => {
|
|
14644
|
-
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;
|
|
14645
14889
|
let buttonClick = ev.target;
|
|
14646
14890
|
buttonClick.innerHTML = "Saving...";
|
|
14647
|
-
const comments =
|
|
14648
|
-
|
|
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;
|
|
14649
14894
|
let currStatus = this.getCompletenessStatus(event);
|
|
14650
14895
|
let newEvent = { ...event };
|
|
14651
14896
|
newEvent.comments = comments;
|
|
@@ -14659,22 +14904,19 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14659
14904
|
}, 3000);
|
|
14660
14905
|
return;
|
|
14661
14906
|
}
|
|
14662
|
-
var clickEvent = new MouseEvent("click", {
|
|
14663
|
-
"view": window,
|
|
14664
|
-
"bubbles": true,
|
|
14665
|
-
"cancelable": false
|
|
14666
|
-
});
|
|
14667
|
-
this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
|
|
14668
|
-
// await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
|
|
14669
14907
|
let flagBulk = false;
|
|
14670
14908
|
if (this.selectedItemIds.length <= 1) {
|
|
14671
|
-
|
|
14672
|
-
if (await this.uploadReview(
|
|
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")) {
|
|
14673
14911
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
14674
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
14912
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
14675
14913
|
this.events[mmdd][p].approved = approved;
|
|
14914
|
+
console.log('selected event', this.events[mmdd][p]);
|
|
14676
14915
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
|
|
14677
14916
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
14917
|
+
if (approved) {
|
|
14918
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + "";
|
|
14919
|
+
}
|
|
14678
14920
|
}
|
|
14679
14921
|
}
|
|
14680
14922
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -14688,8 +14930,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14688
14930
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14689
14931
|
const selectedId = this.selectedItemIds[k];
|
|
14690
14932
|
//console.log('selectedid', selectedId);
|
|
14691
|
-
|
|
14692
|
-
|
|
14933
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14934
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14693
14935
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14694
14936
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14695
14937
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
@@ -14701,8 +14943,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14701
14943
|
"eventid": eventId,
|
|
14702
14944
|
"comments": comments,
|
|
14703
14945
|
"approved": approved,
|
|
14704
|
-
"entityid":
|
|
14705
|
-
"locationid":
|
|
14946
|
+
"entityid": entityid,
|
|
14947
|
+
"locationid": locationid,
|
|
14706
14948
|
"username": this.userName,
|
|
14707
14949
|
"userid": this.userProfileId,
|
|
14708
14950
|
"userrole": this.myRole,
|
|
@@ -14718,16 +14960,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14718
14960
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14719
14961
|
const selectedId = this.selectedItemIds[k];
|
|
14720
14962
|
//console.log('selectedid', selectedId);
|
|
14721
|
-
|
|
14722
|
-
|
|
14963
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14964
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14723
14965
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14724
14966
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14725
14967
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
14726
14968
|
if (this.mode == "next") {
|
|
14727
14969
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
14728
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
14729
|
-
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) {
|
|
14730
14971
|
flagBulk = true;
|
|
14972
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
14731
14973
|
if (this.recentlyReported[mmdd] == null) {
|
|
14732
14974
|
this.recentlyReported[mmdd] = [];
|
|
14733
14975
|
}
|
|
@@ -14737,7 +14979,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14737
14979
|
}
|
|
14738
14980
|
else {
|
|
14739
14981
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
14740
|
-
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid ==
|
|
14982
|
+
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
|
|
14741
14983
|
this.events[mmdd][p].isbulk = true;
|
|
14742
14984
|
flagBulk = true;
|
|
14743
14985
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -14752,7 +14994,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14752
14994
|
if (this.mode == "next") {
|
|
14753
14995
|
// this.fetchNext(this.nextPage)
|
|
14754
14996
|
// this.renderRoleTabsNext(this.nextPage)
|
|
14755
|
-
this.renderNextEvents(this.nextEvents, this.nextPage, this.
|
|
14997
|
+
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
|
|
14756
14998
|
}
|
|
14757
14999
|
else {
|
|
14758
15000
|
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
@@ -14766,39 +15008,17 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14766
15008
|
if (this.selectedItemIds.length > 0) {
|
|
14767
15009
|
await this.fetchBulkReportingData();
|
|
14768
15010
|
}
|
|
15011
|
+
console.log('events', this.events);
|
|
14769
15012
|
this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
|
|
14770
|
-
var clickEvent = new MouseEvent("click", {
|
|
14771
|
-
"view": window,
|
|
14772
|
-
"bubbles": true,
|
|
14773
|
-
"cancelable": false
|
|
14774
|
-
});
|
|
14775
|
-
(_c = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _c === void 0 ? void 0 : _c.dispatchEvent(clickEvent);
|
|
14776
|
-
// if(currentColumnButton != null) {
|
|
14777
|
-
// currentColumnButton.click();
|
|
14778
|
-
// }
|
|
14779
15013
|
}
|
|
14780
15014
|
}
|
|
14781
15015
|
});
|
|
14782
|
-
(
|
|
15016
|
+
(_j = eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
|
|
14783
15017
|
var _a, _b;
|
|
14784
15018
|
let buttonClick = ev.target;
|
|
14785
15019
|
buttonClick.innerHTML = "Saving...";
|
|
14786
|
-
const comments =
|
|
14787
|
-
const approved =
|
|
14788
|
-
let currStatus = this.getCompletenessStatus(event);
|
|
14789
|
-
let newEvent = { ...event };
|
|
14790
|
-
newEvent.comments = comments;
|
|
14791
|
-
newEvent.approved = approved;
|
|
14792
|
-
let newStatus = this.getCompletenessStatus(newEvent);
|
|
14793
|
-
console.log('status', currStatus, newStatus);
|
|
14794
|
-
if (currStatus == newStatus) {
|
|
14795
|
-
buttonClick.innerHTML = "Save";
|
|
14796
|
-
this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
|
|
14797
|
-
setTimeout(() => {
|
|
14798
|
-
this.clearMessages();
|
|
14799
|
-
}, 3000);
|
|
14800
|
-
return;
|
|
14801
|
-
}
|
|
15020
|
+
const comments = eventDetailReportingContainer.querySelector('#input-auditor-comments').value;
|
|
15021
|
+
const approved = eventDetailReportingContainer.querySelector('#input-approve-yes').checked;
|
|
14802
15022
|
if (comments.trim().length === 0) {
|
|
14803
15023
|
buttonClick.innerHTML = "Save";
|
|
14804
15024
|
this.setError('Comments cannot be blank!');
|
|
@@ -14809,22 +15029,14 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14809
15029
|
else {
|
|
14810
15030
|
let flagBulk = false;
|
|
14811
15031
|
if (this.selectedItemIds.length <= 1) {
|
|
14812
|
-
if (await this.uploadAudit(
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
}
|
|
14821
|
-
}
|
|
14822
|
-
else {
|
|
14823
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
14824
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
14825
|
-
this.events[mmdd][p].approved = approved;
|
|
14826
|
-
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
|
|
14827
|
-
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() + "";
|
|
14828
15040
|
}
|
|
14829
15041
|
}
|
|
14830
15042
|
}
|
|
@@ -14839,8 +15051,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14839
15051
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14840
15052
|
const selectedId = this.selectedItemIds[k];
|
|
14841
15053
|
//console.log('selectedid', selectedId);
|
|
14842
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14843
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15054
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15055
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14844
15056
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14845
15057
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14846
15058
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
@@ -14865,20 +15077,20 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14865
15077
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14866
15078
|
const selectedId = this.selectedItemIds[k];
|
|
14867
15079
|
//console.log('selectedid', selectedId);
|
|
14868
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14869
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15080
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15081
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14870
15082
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14871
15083
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14872
15084
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
14873
15085
|
if (this.mode == "next") {
|
|
14874
15086
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
14875
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) {
|
|
14876
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
14877
15088
|
flagBulk = true;
|
|
15089
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
14878
15090
|
if (this.recentlyReported[mmdd] == null) {
|
|
14879
15091
|
this.recentlyReported[mmdd] = [];
|
|
14880
15092
|
}
|
|
14881
|
-
this.recentlyReported[mmdd].push(this.
|
|
15093
|
+
this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p]);
|
|
14882
15094
|
}
|
|
14883
15095
|
}
|
|
14884
15096
|
}
|
|
@@ -14896,12 +15108,6 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14896
15108
|
}
|
|
14897
15109
|
}
|
|
14898
15110
|
}
|
|
14899
|
-
var clickEvent = new MouseEvent("click", {
|
|
14900
|
-
"view": window,
|
|
14901
|
-
"bubbles": true,
|
|
14902
|
-
"cancelable": false
|
|
14903
|
-
});
|
|
14904
|
-
this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
|
|
14905
15111
|
if (this.mode == "next") {
|
|
14906
15112
|
// this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
|
|
14907
15113
|
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
|
|
@@ -14927,33 +15133,33 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14927
15133
|
}
|
|
14928
15134
|
});
|
|
14929
15135
|
if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
14930
|
-
if (approved) {
|
|
14931
|
-
if (
|
|
14932
|
-
|
|
15136
|
+
if (event.approved) {
|
|
15137
|
+
if (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') != null) {
|
|
15138
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'hidden';
|
|
14933
15139
|
}
|
|
14934
15140
|
}
|
|
14935
15141
|
else {
|
|
14936
|
-
if (
|
|
14937
|
-
|
|
14938
|
-
(
|
|
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) => {
|
|
14939
15145
|
var _a, _b, _c, _f;
|
|
14940
15146
|
let buttonClick = ev.target;
|
|
14941
15147
|
buttonClick.innerHTML = "Saving...";
|
|
14942
|
-
const reportercomments =
|
|
15148
|
+
const reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
|
|
14943
15149
|
//console.log('reporter comments 1', reportercomments);
|
|
14944
|
-
const reporterdoc =
|
|
15150
|
+
const reporterdoc = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
|
|
14945
15151
|
let docs = [];
|
|
14946
15152
|
//console.log('reporter comments 2', reportercomments);
|
|
15153
|
+
// if(docsOptional.length === 0) {
|
|
14947
15154
|
let percentage = "100";
|
|
14948
|
-
if (
|
|
14949
|
-
percentage =
|
|
15155
|
+
if (eventDetailReportingContainer.querySelector('#input-reporter-percentage') != null) {
|
|
15156
|
+
percentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage').value;
|
|
14950
15157
|
}
|
|
14951
|
-
// if(docsOptional.length === 0) {
|
|
14952
15158
|
docs = this._SfUploader[0].querySelector('#uploader').selectedValues();
|
|
14953
15159
|
// }
|
|
14954
15160
|
let flag = false;
|
|
14955
15161
|
do {
|
|
14956
|
-
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) {
|
|
14957
15163
|
for (let doc of docs) {
|
|
14958
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')) {
|
|
14959
15165
|
flag = false;
|
|
@@ -14979,6 +15185,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14979
15185
|
reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
|
|
14980
15186
|
reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
|
|
14981
15187
|
}
|
|
15188
|
+
console.log('percentage', percentage, eventDetailReportingContainer.querySelector('#input-reporter-percentage').value);
|
|
14982
15189
|
if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
|
|
14983
15190
|
//console.log('reporter comments 3', reportercomments);
|
|
14984
15191
|
buttonClick.innerHTML = "Save";
|
|
@@ -14988,7 +15195,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14988
15195
|
}, 3000);
|
|
14989
15196
|
}
|
|
14990
15197
|
else {
|
|
14991
|
-
if (docs.length
|
|
15198
|
+
if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
14992
15199
|
//console.log('reporter comments 3', reportercomments);
|
|
14993
15200
|
buttonClick.innerHTML = "Save";
|
|
14994
15201
|
this.setError('No documents uploaded!');
|
|
@@ -15022,43 +15229,58 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15022
15229
|
}, 3000);
|
|
15023
15230
|
}
|
|
15024
15231
|
else {
|
|
15025
|
-
var clickEvent = new MouseEvent("click", {
|
|
15026
|
-
"view": window,
|
|
15027
|
-
"bubbles": true,
|
|
15028
|
-
"cancelable": false
|
|
15029
|
-
});
|
|
15030
|
-
this._SfDetailContainer.querySelector('#button-detail-close').dispatchEvent(clickEvent);
|
|
15031
15232
|
let flagBulk = false;
|
|
15032
|
-
let
|
|
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
|
+
}
|
|
15033
15241
|
if (this.selectedItemIds.length <= 1) {
|
|
15034
|
-
|
|
15035
|
-
|
|
15036
|
-
// console.log('reportformatschema',reportformatschema)
|
|
15037
|
-
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)) {
|
|
15038
|
-
if (this.mode == "next") {
|
|
15039
|
-
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
15040
|
-
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) {
|
|
15041
|
-
this.nextEvents[this.nextTabRole][mmdd][p].documents = docs;
|
|
15042
|
-
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
15043
|
-
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
|
|
15044
|
-
}
|
|
15045
|
-
}
|
|
15046
|
-
}
|
|
15047
|
-
else {
|
|
15048
|
-
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") {
|
|
15049
15244
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15050
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
15245
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
15051
15246
|
this.events[mmdd][p].documents = docs;
|
|
15247
|
+
this.events[mmdd][p].percentage = percentage;
|
|
15248
|
+
this.events[mmdd][p].reportedlocations = reportedlocations;
|
|
15052
15249
|
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
15053
15250
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
15054
15251
|
}
|
|
15055
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);
|
|
15056
15269
|
}
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
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");
|
|
15060
15282
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
15061
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
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) {
|
|
15062
15284
|
this.nextEvents[this.nextTabRole][mmdd][p].approved = true;
|
|
15063
15285
|
// this.events[mmdd][p].documents = docs
|
|
15064
15286
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
|
|
@@ -15066,21 +15288,12 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15066
15288
|
}
|
|
15067
15289
|
}
|
|
15068
15290
|
}
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
15072
|
-
this.events[mmdd][p].approved = true;
|
|
15073
|
-
// this.events[mmdd][p].documents = docs
|
|
15074
|
-
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
|
|
15075
|
-
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
15076
|
-
}
|
|
15077
|
-
}
|
|
15291
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
15292
|
+
this.recentlyReported[mmdd] = [];
|
|
15078
15293
|
}
|
|
15294
|
+
this.recentlyReported[mmdd].push(event);
|
|
15295
|
+
console.log('recently reported', this.recentlyReported);
|
|
15079
15296
|
}
|
|
15080
|
-
if (this.recentlyReported[mmdd] == null) {
|
|
15081
|
-
this.recentlyReported[mmdd] = [];
|
|
15082
|
-
}
|
|
15083
|
-
this.recentlyReported[mmdd].push(event);
|
|
15084
15297
|
}
|
|
15085
15298
|
}
|
|
15086
15299
|
else {
|
|
@@ -15090,30 +15303,11 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15090
15303
|
const selectedId = this.selectedItemIds[k];
|
|
15091
15304
|
//console.log('selectedid', selectedId);
|
|
15092
15305
|
const makercheckersL = selectedId.split('-')[5];
|
|
15093
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15094
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15306
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15307
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15095
15308
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
15096
15309
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
15097
15310
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
15098
|
-
// bulkBody.push({
|
|
15099
|
-
// "mmddyyyy": mmddyyyy,
|
|
15100
|
-
// "projectid": this.projectId,
|
|
15101
|
-
// "type": "report",
|
|
15102
|
-
// "eventid": eventId,
|
|
15103
|
-
// "comments": reportercomments,
|
|
15104
|
-
// "dateofcompletion": reporterdoc,
|
|
15105
|
-
// "entityid": entityId,
|
|
15106
|
-
// "locationid": locationId,
|
|
15107
|
-
// "event": null,
|
|
15108
|
-
// "docs": JSON.stringify(docs),
|
|
15109
|
-
// "username": this.userName,
|
|
15110
|
-
// "reportformatvalues": reportformatvalues,
|
|
15111
|
-
// "reportformatschema": reportformatschema,
|
|
15112
|
-
// "userid": this.userProfileId,
|
|
15113
|
-
// "userrole": this.myRole,
|
|
15114
|
-
// "year": this.calendarStartYYYY,
|
|
15115
|
-
// "module": event.module ?? "compliance"
|
|
15116
|
-
// })
|
|
15117
15311
|
// await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
|
|
15118
15312
|
// if(parseInt(makercheckersL) > 0) {
|
|
15119
15313
|
// bulkBodyReview.push({
|
|
@@ -15148,7 +15342,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15148
15342
|
"comments": reportercomments,
|
|
15149
15343
|
"dateofcompletion": reporterdoc,
|
|
15150
15344
|
"percentage": percentage,
|
|
15151
|
-
"
|
|
15345
|
+
"reportedlocations": reportedlocations,
|
|
15152
15346
|
"entityid": entityId,
|
|
15153
15347
|
"locationid": locationId,
|
|
15154
15348
|
"event": null,
|
|
@@ -15167,26 +15361,27 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15167
15361
|
// await this.sleep(2000);
|
|
15168
15362
|
// this.clearMessages();
|
|
15169
15363
|
}
|
|
15364
|
+
// await this.uploadReportsBulk(bulkBody);
|
|
15365
|
+
// await this.fetchBulkReportingData();
|
|
15170
15366
|
if (bulkBody.length > 0) {
|
|
15171
15367
|
await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
|
|
15172
15368
|
}
|
|
15173
|
-
// await this.fetchBulkReportingData();
|
|
15174
15369
|
// if(bulkBodyReview.length > 0){
|
|
15175
15370
|
// await this.uploadReportsReviewsBulk(bulkBodyReview)
|
|
15176
15371
|
// }
|
|
15177
15372
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
15178
15373
|
const selectedId = this.selectedItemIds[k];
|
|
15179
15374
|
//console.log('selectedid', selectedId);
|
|
15180
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15181
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15375
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15376
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15182
15377
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
15183
15378
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
15184
15379
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
15185
15380
|
if (this.mode == "next") {
|
|
15186
15381
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
15187
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) {
|
|
15188
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
15189
15383
|
flagBulk = true;
|
|
15384
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
15190
15385
|
if (this.recentlyReported[mmdd] == null) {
|
|
15191
15386
|
this.recentlyReported[mmdd] = [];
|
|
15192
15387
|
}
|
|
@@ -15197,8 +15392,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15197
15392
|
else {
|
|
15198
15393
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15199
15394
|
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
15200
|
-
this.events[mmdd][p].isbulk = true;
|
|
15201
15395
|
flagBulk = true;
|
|
15396
|
+
this.events[mmdd][p].isbulk = true;
|
|
15202
15397
|
if (this.recentlyReported[mmdd] == null) {
|
|
15203
15398
|
this.recentlyReported[mmdd] = [];
|
|
15204
15399
|
}
|
|
@@ -15239,32 +15434,38 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15239
15434
|
}
|
|
15240
15435
|
}
|
|
15241
15436
|
if (this._SfUploader[0] != null) {
|
|
15242
|
-
|
|
15437
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15438
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
|
|
15439
|
+
}
|
|
15243
15440
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev) => {
|
|
15244
15441
|
console.log('uploader analysisInProgress', _ev);
|
|
15245
|
-
|
|
15442
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15443
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "block";
|
|
15444
|
+
}
|
|
15246
15445
|
});
|
|
15247
15446
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev) => {
|
|
15248
15447
|
console.log('uploader analysisInProgress', _ev);
|
|
15249
|
-
if (
|
|
15250
|
-
|
|
15448
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15449
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
|
|
15251
15450
|
}
|
|
15252
15451
|
});
|
|
15253
15452
|
//console.log('documentType checking', documentType);
|
|
15254
|
-
if (documentType != null) {
|
|
15255
|
-
this._SfUploader[0].querySelector('#uploader').docType = documentType;
|
|
15453
|
+
if (event.documentType != null) {
|
|
15454
|
+
this._SfUploader[0].querySelector('#uploader').docType = event.documentType;
|
|
15256
15455
|
}
|
|
15257
15456
|
else {
|
|
15258
15457
|
this._SfUploader[0].querySelector('#uploader').docType = "";
|
|
15259
15458
|
}
|
|
15260
15459
|
this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify([]);
|
|
15261
15460
|
console.log('uploader', this._SfUploader[0].querySelector('#uploader'));
|
|
15461
|
+
this._SfUploader[0].querySelector('#uploader').current = 0;
|
|
15262
15462
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15263
15463
|
if (docs.length > 0) {
|
|
15264
15464
|
this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify(docs);
|
|
15465
|
+
this._SfUploader[0].querySelector('#uploader').current = docs.length;
|
|
15265
15466
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15266
15467
|
}
|
|
15267
|
-
if (this.myRole == this.TAB_APPROVER || approved) {
|
|
15468
|
+
if (this.myRole == this.TAB_APPROVER || event.approved) {
|
|
15268
15469
|
this._SfUploader[0].querySelector('#uploader').readOnly = true;
|
|
15269
15470
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15270
15471
|
}
|
|
@@ -15275,8 +15476,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15275
15476
|
const dataPassthrough = {
|
|
15276
15477
|
projectId: this.projectId,
|
|
15277
15478
|
countryId: this.countryId,
|
|
15278
|
-
entityId:
|
|
15279
|
-
locationId:
|
|
15479
|
+
entityId: event.entityid,
|
|
15480
|
+
locationId: event.locationid,
|
|
15280
15481
|
mmddyyyy: mmddyyyy,
|
|
15281
15482
|
complianceId: event['id'],
|
|
15282
15483
|
path: "uploadextract"
|
|
@@ -15288,6 +15489,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15288
15489
|
this._SfUploader[0].querySelector('#uploader').callbackUrlHost = callbackUrlHost;
|
|
15289
15490
|
this._SfUploader[0].querySelector('#uploader').callbackUrlPath = callbackUrlPath;
|
|
15290
15491
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15492
|
+
console.log('uploader prepopulate', this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr, this._SfUploader[0].querySelector('#uploader').extract);
|
|
15291
15493
|
}
|
|
15292
15494
|
//console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
15293
15495
|
if (this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
@@ -15295,50 +15497,34 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15295
15497
|
if (event["approved"] != null) {
|
|
15296
15498
|
if (event["approved"] === true) {
|
|
15297
15499
|
//console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
15298
|
-
if (
|
|
15299
|
-
|
|
15500
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15501
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = true;
|
|
15300
15502
|
}
|
|
15301
|
-
if (
|
|
15302
|
-
|
|
15503
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15504
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = false;
|
|
15303
15505
|
}
|
|
15304
15506
|
}
|
|
15305
15507
|
else {
|
|
15306
|
-
if (
|
|
15307
|
-
|
|
15508
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15509
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
|
|
15308
15510
|
}
|
|
15309
|
-
if (
|
|
15310
|
-
|
|
15511
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15512
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
|
|
15311
15513
|
}
|
|
15312
15514
|
}
|
|
15313
15515
|
}
|
|
15314
15516
|
else {
|
|
15315
|
-
if (
|
|
15316
|
-
|
|
15517
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15518
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
|
|
15317
15519
|
}
|
|
15318
|
-
if (
|
|
15319
|
-
|
|
15520
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15521
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
|
|
15320
15522
|
}
|
|
15321
15523
|
}
|
|
15322
15524
|
}
|
|
15323
15525
|
}
|
|
15324
|
-
|
|
15325
|
-
|
|
15326
|
-
if (event['customreporting'] != null) {
|
|
15327
|
-
let reportingContainer = this._SfDetailContainer;
|
|
15328
|
-
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
15329
|
-
reportingContainer.querySelector('#report-format-container').innerHTML = `<slot name="reporting"></slot>`;
|
|
15330
|
-
console.log('innerhtml', reportingContainer.querySelector('#report-format-container').innerHTML);
|
|
15331
|
-
this._SfReporting[0].querySelector('#reporting-format').name = event.obligationtitle;
|
|
15332
|
-
this._SfReporting[0].querySelector('#reporting-format').mode = "edit";
|
|
15333
|
-
this._SfReporting[0].querySelector('#reporting-format').configjson = event['customreporting'];
|
|
15334
|
-
// if(reportformatvalues != ""){
|
|
15335
|
-
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
15336
|
-
// }
|
|
15337
|
-
this._SfReporting[0].querySelector('#reporting-format').loadMode();
|
|
15338
|
-
}
|
|
15339
|
-
}
|
|
15340
|
-
else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
15341
|
-
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 : "");
|
|
15342
15528
|
}
|
|
15343
15529
|
};
|
|
15344
15530
|
this.renderCalendar = () => {
|
|
@@ -24630,7 +24816,6 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
24630
24816
|
let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
24631
24817
|
console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
24632
24818
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
24633
|
-
4;
|
|
24634
24819
|
this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer);
|
|
24635
24820
|
}
|
|
24636
24821
|
else {
|
|
@@ -26378,6 +26563,10 @@ SfIEvents.styles = css `
|
|
|
26378
26563
|
margin-left: 10px;
|
|
26379
26564
|
}
|
|
26380
26565
|
|
|
26566
|
+
.ml-10-m-0 {
|
|
26567
|
+
margin-left: 10px;
|
|
26568
|
+
}
|
|
26569
|
+
|
|
26381
26570
|
.mt-20 {
|
|
26382
26571
|
margin-top: 20px;
|
|
26383
26572
|
}
|
|
@@ -26386,6 +26575,10 @@ SfIEvents.styles = css `
|
|
|
26386
26575
|
margin-left: 20px;
|
|
26387
26576
|
}
|
|
26388
26577
|
|
|
26578
|
+
.ml-20-m-0 {
|
|
26579
|
+
margin-left: 20px;
|
|
26580
|
+
}
|
|
26581
|
+
|
|
26389
26582
|
.mr-20 {
|
|
26390
26583
|
margin-right: 20px;
|
|
26391
26584
|
}
|
|
@@ -26548,6 +26741,14 @@ SfIEvents.styles = css `
|
|
|
26548
26741
|
.calendar-right-data {
|
|
26549
26742
|
width: 100%;
|
|
26550
26743
|
}
|
|
26744
|
+
|
|
26745
|
+
.ml-10-m-0 {
|
|
26746
|
+
margin-left: 0px;
|
|
26747
|
+
}
|
|
26748
|
+
|
|
26749
|
+
.ml-20-m-0 {
|
|
26750
|
+
margin-left: 0px;
|
|
26751
|
+
}
|
|
26551
26752
|
|
|
26552
26753
|
}
|
|
26553
26754
|
|