sf-i-events 1.0.950 → 1.0.952
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 +3 -0
- package/sf-i-events.js +672 -433
- package/src/sf-i-events.ts +682 -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 {
|
|
@@ -5848,6 +5970,9 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
5848
5970
|
var html = '';
|
|
5849
5971
|
this.csvDataRegisters = '';
|
|
5850
5972
|
let flagUpdateFilters = Object.keys(this.registerFilters).length == 0;
|
|
5973
|
+
html += '<div class="d-flex flex-col align-end">';
|
|
5974
|
+
html += '<button id="button-export" part="button" class="d-flex justify-center align-center mr-10"><span class="material-symbols-outlined">download</span> <span>Export Register</span></button>';
|
|
5975
|
+
html += '</div>';
|
|
5851
5976
|
html += '<div class="d-flex scroll-x w-100p">';
|
|
5852
5977
|
for (var i = 0; i < Object.keys(events).length; i++) {
|
|
5853
5978
|
const country = Object.keys(events)[i];
|
|
@@ -6052,6 +6177,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
6052
6177
|
divRegisterList.innerHTML = html;
|
|
6053
6178
|
console.log('registerFilters', flagUpdateFilters, this.registerFilters, html.indexOf('input-select-filter-0-0'));
|
|
6054
6179
|
// console.log('csvdataregisters', this.csvDataRegisters);
|
|
6180
|
+
let buttonExportRegister = this._SfRegisterContainer.querySelector('.calendar-right-data-register').querySelector('#button-export');
|
|
6181
|
+
buttonExportRegister === null || buttonExportRegister === void 0 ? void 0 : buttonExportRegister.addEventListener('click', () => {
|
|
6182
|
+
this.exportRegister();
|
|
6183
|
+
});
|
|
6055
6184
|
if (this.selectedRegisterIndex >= 0) {
|
|
6056
6185
|
const divFilterString = this._SfRegisterContainer.querySelector('.calendar-right-data-register').querySelector('#filter-string');
|
|
6057
6186
|
let filterString = "";
|
|
@@ -13906,16 +14035,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13906
14035
|
}
|
|
13907
14036
|
};
|
|
13908
14037
|
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
|
|
14038
|
+
var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
13910
14039
|
console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
|
|
13911
14040
|
console.log('previousid', previousId, 'nextid', nextId);
|
|
13912
14041
|
console.log('confighome', Util.getProjectConfigHome());
|
|
13913
|
-
let comments, docs, approved
|
|
14042
|
+
let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
|
|
13914
14043
|
let entityId = "";
|
|
13915
14044
|
let locationId = "";
|
|
13916
14045
|
let statuteName = "";
|
|
13917
14046
|
let reportformatName = "";
|
|
13918
|
-
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
14047
|
+
// let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
13919
14048
|
entityId = event.entityid;
|
|
13920
14049
|
locationId = event.locationid;
|
|
13921
14050
|
// let completeness = this.getCompletenessStatus(event);
|
|
@@ -13923,9 +14052,9 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13923
14052
|
docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
|
|
13924
14053
|
approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
|
|
13925
14054
|
// 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];
|
|
14055
|
+
// makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
14056
|
+
// docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
14057
|
+
// documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
|
|
13929
14058
|
statuteName = event['statute'][0].trim();
|
|
13930
14059
|
if (event['reportformat'] != null) {
|
|
13931
14060
|
reportformatName = ((_a = event['reportformat'][0]) !== null && _a !== void 0 ? _a : "").trim().replace('&', '&');
|
|
@@ -14205,7 +14334,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14205
14334
|
html += '</div>';
|
|
14206
14335
|
if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
|
|
14207
14336
|
if (this.mode != "viewer") {
|
|
14208
|
-
html += '<div part="reporting-view-container">';
|
|
14337
|
+
html += '<div part="reporting-view-container" id="reporting-view-container">';
|
|
14209
14338
|
html += this.renderReporting(event, mmddyyyy);
|
|
14210
14339
|
html += "</div>";
|
|
14211
14340
|
}
|
|
@@ -14272,94 +14401,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14272
14401
|
}
|
|
14273
14402
|
this._SfDetailContainer.innerHTML = html;
|
|
14274
14403
|
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
14404
|
if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
|
|
14280
14405
|
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
14281
14406
|
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
14407
|
this._SfUploader[0].querySelector('#uploader').emailcontent = emailcontent;
|
|
14283
14408
|
}
|
|
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', () => {
|
|
14409
|
+
(_c = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', () => {
|
|
14359
14410
|
this._SfDetailContainer.innerHTML = '';
|
|
14360
14411
|
this._SfDetailContainer.style.display = 'none';
|
|
14361
14412
|
});
|
|
14362
|
-
(
|
|
14413
|
+
(_f = this._SfDetailContainer.querySelector('#button-detail-previous')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', () => {
|
|
14363
14414
|
var _a;
|
|
14364
14415
|
var clickEvent = new MouseEvent("click", {
|
|
14365
14416
|
"view": window,
|
|
@@ -14368,7 +14419,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14368
14419
|
});
|
|
14369
14420
|
(_a = eventsContainer.querySelector('#' + previousId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
|
|
14370
14421
|
});
|
|
14371
|
-
(
|
|
14422
|
+
(_g = this._SfDetailContainer.querySelector('#button-detail-next')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', () => {
|
|
14372
14423
|
var _a;
|
|
14373
14424
|
var clickEvent = new MouseEvent("click", {
|
|
14374
14425
|
"view": window,
|
|
@@ -14377,7 +14428,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14377
14428
|
});
|
|
14378
14429
|
(_a = eventsContainer.querySelector('#' + nextId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(clickEvent);
|
|
14379
14430
|
});
|
|
14380
|
-
(
|
|
14431
|
+
(_h = this._SfDetailContainer.querySelector('.head-basic')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', () => {
|
|
14381
14432
|
//console.log('head basic clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-basic') as HTMLDivElement).style.display);
|
|
14382
14433
|
if (this._SfDetailContainer.querySelector('.body-basic').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-basic').style.display == '') {
|
|
14383
14434
|
this._SfDetailContainer.querySelector('.body-basic').style.display = 'none';
|
|
@@ -14388,7 +14439,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14388
14439
|
this._SfDetailContainer.querySelector('.head-indicator-basic').innerHTML = '-';
|
|
14389
14440
|
}
|
|
14390
14441
|
});
|
|
14391
|
-
(
|
|
14442
|
+
(_j = this._SfDetailContainer.querySelector('.head-statute')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', () => {
|
|
14392
14443
|
//console.log('head statute clicked', ((this._SfDetailContainer as HTMLDivElement).querySelector('.body-statute') as HTMLDivElement).style.display);
|
|
14393
14444
|
if (this._SfDetailContainer.querySelector('.body-statute').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-statute').style.display == '') {
|
|
14394
14445
|
this._SfDetailContainer.querySelector('.body-statute').style.display = 'none';
|
|
@@ -14399,7 +14450,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14399
14450
|
this._SfDetailContainer.querySelector('.head-indicator-statute').innerHTML = '-';
|
|
14400
14451
|
}
|
|
14401
14452
|
});
|
|
14402
|
-
(
|
|
14453
|
+
(_k = this._SfDetailContainer.querySelector('.head-compliance')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', () => {
|
|
14403
14454
|
if (this._SfDetailContainer.querySelector('.body-compliance').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-compliance').style.display == '') {
|
|
14404
14455
|
this._SfDetailContainer.querySelector('.body-compliance').style.display = 'none';
|
|
14405
14456
|
this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '+';
|
|
@@ -14409,7 +14460,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14409
14460
|
this._SfDetailContainer.querySelector('.head-indicator-compliance').innerHTML = '-';
|
|
14410
14461
|
}
|
|
14411
14462
|
});
|
|
14412
|
-
(
|
|
14463
|
+
(_l = this._SfDetailContainer.querySelector('.head-grc')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', () => {
|
|
14413
14464
|
if (this._SfDetailContainer.querySelector('.body-grc').style.display == 'flex' || this._SfDetailContainer.querySelector('.body-grc').style.display == '') {
|
|
14414
14465
|
this._SfDetailContainer.querySelector('.body-grc').style.display = 'none';
|
|
14415
14466
|
this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '+';
|
|
@@ -14419,7 +14470,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14419
14470
|
this._SfDetailContainer.querySelector('.head-indicator-grc').innerHTML = '-';
|
|
14420
14471
|
}
|
|
14421
14472
|
});
|
|
14422
|
-
(
|
|
14473
|
+
(_m = this._SfDetailContainer.querySelector('.head-feedback')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', () => {
|
|
14423
14474
|
if (this._SfDetailContainer.querySelector('.body-feedback').style.display == 'flex') {
|
|
14424
14475
|
this._SfDetailContainer.querySelector('.body-feedback').style.display = 'none';
|
|
14425
14476
|
this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '+';
|
|
@@ -14429,11 +14480,11 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14429
14480
|
this._SfDetailContainer.querySelector('.head-indicator-feedback').innerHTML = '-';
|
|
14430
14481
|
}
|
|
14431
14482
|
});
|
|
14432
|
-
(
|
|
14483
|
+
(_o = this._SfDetailContainer.querySelector('#button-detail-close')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', () => {
|
|
14433
14484
|
this._SfDetailContainer.innerHTML = '';
|
|
14434
14485
|
this._SfDetailContainer.style.display = 'none';
|
|
14435
14486
|
});
|
|
14436
|
-
(
|
|
14487
|
+
(_p = this._SfDetailContainer.querySelector('#button-feedback')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', () => {
|
|
14437
14488
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14438
14489
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
14439
14490
|
const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
|
|
@@ -14469,7 +14520,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14469
14520
|
// }
|
|
14470
14521
|
// console.log(body);
|
|
14471
14522
|
});
|
|
14472
|
-
(
|
|
14523
|
+
(_q = this._SfDetailContainer.querySelector('#button-feedback-cancel')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', () => {
|
|
14473
14524
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14474
14525
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
14475
14526
|
const feedbackSuspenseLabel = this._SfDetailContainer.querySelector('#feedback-suspense-label');
|
|
@@ -14500,7 +14551,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14500
14551
|
buttonFeedback.classList.remove('hide');
|
|
14501
14552
|
}
|
|
14502
14553
|
});
|
|
14503
|
-
(
|
|
14554
|
+
(_r = this._SfDetailContainer.querySelector('#button-feedback-confirm')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', async () => {
|
|
14504
14555
|
var _a, _b, _c;
|
|
14505
14556
|
const feedbackMessage = this._SfDetailContainer.querySelector('#feedback-message');
|
|
14506
14557
|
const feedbackSuspense = this._SfDetailContainer.querySelector('#feedback-suspense');
|
|
@@ -14540,112 +14591,313 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14540
14591
|
buttonClose.click();
|
|
14541
14592
|
}
|
|
14542
14593
|
});
|
|
14543
|
-
(
|
|
14594
|
+
(_s = this._SfDetailContainer.querySelector('#feedback-message')) === null || _s === void 0 ? void 0 : _s.addEventListener('keyup', (e) => {
|
|
14544
14595
|
if (e.code == "Enter") {
|
|
14545
14596
|
const buttonConfirm = this._SfDetailContainer.querySelector('#button-feedback-confirm');
|
|
14546
14597
|
buttonConfirm.click();
|
|
14547
14598
|
}
|
|
14548
14599
|
});
|
|
14549
14600
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
14550
|
-
let
|
|
14601
|
+
let eventDetailReportingContainer = this._SfDetailContainer.querySelector('#reporting-view-container');
|
|
14602
|
+
if (eventDetailReportingContainer != null) {
|
|
14603
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, this._SfDetailContainer);
|
|
14604
|
+
}
|
|
14605
|
+
}
|
|
14606
|
+
this.fetchStatuteDefinitionDetails(statuteName);
|
|
14607
|
+
console.log('customreporting', event['customreporting']);
|
|
14608
|
+
if (event['customreporting'] != null) {
|
|
14609
|
+
let reportingContainer = this._SfDetailContainer;
|
|
14610
|
+
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
14611
|
+
reportingContainer.querySelector('#report-format-container').innerHTML = `<slot name="reporting"></slot>`;
|
|
14612
|
+
console.log('innerhtml', reportingContainer.querySelector('#report-format-container').innerHTML);
|
|
14613
|
+
this._SfReporting[0].querySelector('#reporting-format').name = event.obligationtitle;
|
|
14614
|
+
this._SfReporting[0].querySelector('#reporting-format').mode = "edit";
|
|
14615
|
+
this._SfReporting[0].querySelector('#reporting-format').configjson = event['customreporting'];
|
|
14616
|
+
// if(reportformatvalues != ""){
|
|
14617
|
+
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
14618
|
+
// }
|
|
14619
|
+
this._SfReporting[0].querySelector('#reporting-format').loadMode();
|
|
14620
|
+
}
|
|
14621
|
+
}
|
|
14622
|
+
else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
14623
|
+
this.fetchReportFormat(this._SfDetailContainer, reportformatName, (_t = event['reportformatschema']) !== null && _t !== void 0 ? _t : "", (_u = event['reportformatvalues']) !== null && _u !== void 0 ? _u : "");
|
|
14624
|
+
}
|
|
14625
|
+
};
|
|
14626
|
+
this.renderEventDetailReporting = (eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer) => {
|
|
14627
|
+
var _a, _b, _c, _f, _g, _h, _j, _k, _l, _m;
|
|
14628
|
+
console.log('detailreporting event', event, this.graphFilter);
|
|
14629
|
+
let html = '';
|
|
14630
|
+
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
14631
|
+
let reportformatName = '';
|
|
14632
|
+
if (event['reportformat'] != null) {
|
|
14633
|
+
reportformatName = ((_a = event['reportformat'][0]) !== null && _a !== void 0 ? _a : "").trim().replace('&', '&');
|
|
14634
|
+
}
|
|
14635
|
+
let docs = event['documents'] == null ? [] : event['documents'];
|
|
14636
|
+
event.approved = event['approved'] == null ? false : event['approved'];
|
|
14637
|
+
event.dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
14638
|
+
event.makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
14639
|
+
event.docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
14640
|
+
html = this.renderReporting(event, mmddyyyy);
|
|
14641
|
+
console.log('reporting html', html);
|
|
14642
|
+
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
14643
|
+
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>`;
|
|
14644
|
+
eventDetailReportingContainer.innerHTML = html;
|
|
14645
|
+
if (this._SfUploader[0] != null) {
|
|
14646
|
+
this._SfUploader[0].querySelector('#uploader').emailcontent = emailcontent;
|
|
14647
|
+
}
|
|
14648
|
+
(_c = eventDetailReportingContainer.querySelector('.button-delete')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
|
|
14649
|
+
await this.fetchDeleteReview(event["id"], mmddyyyy, event.entityid, event.locationid);
|
|
14650
|
+
this.setSuccess('Deleted successfully!');
|
|
14651
|
+
setTimeout(() => {
|
|
14652
|
+
this.clearMessages();
|
|
14653
|
+
}, 3000);
|
|
14654
|
+
//console.log('deleted', resultDelete);
|
|
14655
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
14656
|
+
this.processDateSelection(this._SfCustomContainer);
|
|
14657
|
+
}
|
|
14658
|
+
else {
|
|
14659
|
+
// if(currentColumnButton != null) {
|
|
14660
|
+
// currentColumnButton.click();
|
|
14661
|
+
// }
|
|
14662
|
+
}
|
|
14663
|
+
});
|
|
14664
|
+
(_f = eventDetailReportingContainer.querySelector('#button-auto-approve')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
|
|
14665
|
+
var _a, _b;
|
|
14666
|
+
if (this.selectedItemIds.length <= 1) {
|
|
14667
|
+
await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance");
|
|
14668
|
+
this.setSuccess('Auto-Approved successfully!');
|
|
14669
|
+
setTimeout(() => {
|
|
14670
|
+
this.clearMessages();
|
|
14671
|
+
}, 3000);
|
|
14672
|
+
}
|
|
14673
|
+
else {
|
|
14674
|
+
let bulkBodyReview = [];
|
|
14675
|
+
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14676
|
+
const selectedId = this.selectedItemIds[k];
|
|
14677
|
+
//console.log('selectedid', selectedId);
|
|
14678
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14679
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14680
|
+
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14681
|
+
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14682
|
+
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
14683
|
+
let yearStr = this.getFinancialYear(mmddyyyy);
|
|
14684
|
+
bulkBodyReview.push({
|
|
14685
|
+
"mmddyyyy": mmddyyyy,
|
|
14686
|
+
"projectid": this.projectId,
|
|
14687
|
+
"type": "review",
|
|
14688
|
+
"eventid": eventId,
|
|
14689
|
+
"comments": "Auto approved",
|
|
14690
|
+
"approved": true,
|
|
14691
|
+
"entityid": entityId,
|
|
14692
|
+
"locationid": locationId,
|
|
14693
|
+
"username": this.userName,
|
|
14694
|
+
"userid": this.userProfileId,
|
|
14695
|
+
"userrole": this.myRole,
|
|
14696
|
+
"year": yearStr,
|
|
14697
|
+
"module": (_b = event.module) !== null && _b !== void 0 ? _b : "compliance"
|
|
14698
|
+
});
|
|
14699
|
+
}
|
|
14700
|
+
await this.uploadReviewsBulk(bulkBodyReview);
|
|
14701
|
+
}
|
|
14702
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
14703
|
+
this.processDateSelection(this._SfCustomContainer);
|
|
14704
|
+
}
|
|
14705
|
+
else {
|
|
14706
|
+
// if(currentColumnButton != null) {
|
|
14707
|
+
// currentColumnButton.click();
|
|
14708
|
+
// }
|
|
14709
|
+
}
|
|
14710
|
+
});
|
|
14711
|
+
(_g = eventDetailReportingContainer.querySelector('#upload-guidance-button')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async () => {
|
|
14712
|
+
var _a, _b, _c, _f, _g, _h;
|
|
14713
|
+
console.log('upload guidance clicked', event);
|
|
14714
|
+
let inputReportingPercentage = (_b = (_a = eventDetailReportingContainer.querySelector('#input-reporter-percentage')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : "100";
|
|
14715
|
+
let selectReportedLocations = eventDetailReportingContainer.querySelectorAll('.input-reporter-location');
|
|
14716
|
+
let selectReportedLocationValue = "[]";
|
|
14717
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
14718
|
+
selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value]);
|
|
14719
|
+
}
|
|
14720
|
+
let approvercomments = (_f = (_c = eventDetailReportingContainer.querySelector('#input-approver-comments')) === null || _c === void 0 ? void 0 : _c.value) !== null && _f !== void 0 ? _f : "";
|
|
14721
|
+
let reportercomments = (_h = (_g = eventDetailReportingContainer.querySelector('#input-reporter-comments')) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : "";
|
|
14722
|
+
let dateOfCompletion;
|
|
14723
|
+
if (eventDetailReportingContainer.querySelector('#input-reporter-doc') != null) {
|
|
14724
|
+
dateOfCompletion = new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "";
|
|
14725
|
+
}
|
|
14726
|
+
else {
|
|
14727
|
+
dateOfCompletion = new Date(eventDetailReportingContainer.querySelector('#input-approver-doc').value).getTime() + "";
|
|
14728
|
+
}
|
|
14729
|
+
let documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
|
|
14730
|
+
if (dateOfCompletion == "NaN") {
|
|
14731
|
+
dateOfCompletion = "";
|
|
14732
|
+
}
|
|
14733
|
+
console.log('dateOfCompletion', dateOfCompletion);
|
|
14734
|
+
await this.fetchEventDetails(event, mmddyyyy, null, eventDetailContainer, "", "", true, eventDetailReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
|
|
14735
|
+
});
|
|
14736
|
+
if (this.mode == "consumer" || this.mode == "next") {
|
|
14737
|
+
let inputReportingPercentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage');
|
|
14551
14738
|
let percentage = inputReportingPercentage.value;
|
|
14739
|
+
const entityContainers = eventDetailReportingContainer.querySelectorAll('.reporting-entity-container');
|
|
14740
|
+
const locationsContainers = eventDetailReportingContainer.querySelectorAll('.reporting-location-container');
|
|
14741
|
+
const addLocationButtons = eventDetailReportingContainer.querySelectorAll('.button-reporter-location-add');
|
|
14552
14742
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
14553
|
-
|
|
14554
|
-
|
|
14743
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
14744
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
14745
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
14555
14746
|
}
|
|
14556
14747
|
else {
|
|
14557
|
-
|
|
14558
|
-
|
|
14748
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
14749
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
14750
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
14559
14751
|
}
|
|
14560
14752
|
inputReportingPercentage === null || inputReportingPercentage === void 0 ? void 0 : inputReportingPercentage.addEventListener('change', () => {
|
|
14561
14753
|
setTimeout(() => {
|
|
14562
14754
|
let percentage = inputReportingPercentage.value;
|
|
14563
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
14755
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
14564
14756
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
14565
|
-
|
|
14566
|
-
|
|
14757
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
14758
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
14759
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
14567
14760
|
}
|
|
14568
14761
|
else {
|
|
14569
|
-
|
|
14570
|
-
|
|
14762
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
14763
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
14764
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
14571
14765
|
}
|
|
14572
|
-
if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
|
|
14573
|
-
|
|
14766
|
+
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
14767
|
+
eventDetailReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents';
|
|
14574
14768
|
}
|
|
14575
14769
|
else {
|
|
14576
|
-
|
|
14770
|
+
eventDetailReportingContainer.querySelector('#input-label-docs').innerHTML = 'Supporting Documents*';
|
|
14771
|
+
}
|
|
14772
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
|
|
14773
|
+
event.percentage = percentage;
|
|
14774
|
+
event.reportedlocations = JSON.stringify([""]);
|
|
14775
|
+
event.reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
|
|
14776
|
+
event.dateofcompletion = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
|
|
14777
|
+
event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
|
|
14778
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations);
|
|
14779
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
14577
14780
|
}
|
|
14578
14781
|
}, 200);
|
|
14579
14782
|
});
|
|
14580
|
-
let selectReportingEntity = this._SfDetailContainer.querySelector('#input-reporter-entity');
|
|
14581
|
-
let selectReportingLocation = this._SfDetailContainer.querySelector('#input-reporter-location');
|
|
14582
|
-
selectReportingEntity.innerHTML = '';
|
|
14583
14783
|
let projectUserMap = Util.getProjectUsermap();
|
|
14584
|
-
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14784
|
+
addLocationButtons.forEach((addLocationBtn) => {
|
|
14785
|
+
addLocationBtn.addEventListener('click', () => {
|
|
14786
|
+
let iconhtml = addLocationBtn.innerHTML;
|
|
14787
|
+
let index = parseInt(addLocationBtn.id.split('-')[4]);
|
|
14788
|
+
console.log('button clicked', iconhtml, addLocationBtn.id);
|
|
14789
|
+
if (iconhtml == "add") {
|
|
14790
|
+
console.log('this.reportedLocationsVals', this.reportedLocationsVals);
|
|
14791
|
+
this.reportedLocationsVals.push("");
|
|
14792
|
+
}
|
|
14793
|
+
else {
|
|
14794
|
+
this.reportedLocationsVals.splice(index, 1);
|
|
14795
|
+
}
|
|
14796
|
+
event.percentage = inputReportingPercentage.value;
|
|
14797
|
+
event.reportedlocations = JSON.stringify(this.reportedLocationsVals);
|
|
14798
|
+
if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
|
|
14799
|
+
event.percentage = "100";
|
|
14800
|
+
}
|
|
14801
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations);
|
|
14802
|
+
event.reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
|
|
14803
|
+
event.dateofcompletion = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
|
|
14804
|
+
event.documents = this._SfUploader[0].querySelector('#uploader').selectedValues();
|
|
14805
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
14806
|
+
});
|
|
14807
|
+
});
|
|
14808
|
+
for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
|
|
14809
|
+
console.log('AddingEntities', indexRepLoc);
|
|
14810
|
+
let selectReportingEntity = eventDetailReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc);
|
|
14811
|
+
let selectReportingLocation = eventDetailReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc);
|
|
14812
|
+
selectReportingEntity.innerHTML = '';
|
|
14597
14813
|
for (let country of Object.keys(projectUserMap)) {
|
|
14598
14814
|
if (country == "roles") {
|
|
14599
14815
|
continue;
|
|
14600
14816
|
}
|
|
14601
14817
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
14602
|
-
|
|
14818
|
+
let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "");
|
|
14819
|
+
let option = new Option(entityName, entity);
|
|
14820
|
+
selectReportingEntity.add(option);
|
|
14821
|
+
}
|
|
14822
|
+
}
|
|
14823
|
+
selectReportingEntity.addEventListener('change', (e) => {
|
|
14824
|
+
selectReportingLocation.innerHTML = '';
|
|
14825
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
14826
|
+
if (country == "roles") {
|
|
14603
14827
|
continue;
|
|
14604
14828
|
}
|
|
14605
|
-
for (let
|
|
14606
|
-
|
|
14607
|
-
|
|
14608
|
-
|
|
14829
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
14830
|
+
if (entity.indexOf(e.target.value) < 0) {
|
|
14831
|
+
continue;
|
|
14832
|
+
}
|
|
14833
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
14834
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
|
|
14835
|
+
let option = new Option(locationName, location);
|
|
14836
|
+
selectReportingLocation.add(option);
|
|
14837
|
+
}
|
|
14609
14838
|
}
|
|
14610
14839
|
}
|
|
14611
|
-
|
|
14612
|
-
|
|
14613
|
-
|
|
14614
|
-
|
|
14615
|
-
|
|
14616
|
-
|
|
14617
|
-
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
if (event.reportedlocations.indexOf(location) >= 0) {
|
|
14625
|
-
selectReportingEntity.value = entity;
|
|
14626
|
-
const changeEvent = new Event('change', { bubbles: true });
|
|
14627
|
-
selectReportingEntity.dispatchEvent(changeEvent);
|
|
14628
|
-
selectReportingLocation.value = location;
|
|
14629
|
-
flagSetVal = true;
|
|
14840
|
+
eventDetailReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc).classList.remove('hide');
|
|
14841
|
+
selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
|
|
14842
|
+
});
|
|
14843
|
+
if (selectReportingLocation.innerHTML == '') {
|
|
14844
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
14845
|
+
if (country == "roles") {
|
|
14846
|
+
continue;
|
|
14847
|
+
}
|
|
14848
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
14849
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
14850
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "");
|
|
14851
|
+
let option = new Option(locationName, location);
|
|
14852
|
+
selectReportingLocation.add(option);
|
|
14630
14853
|
break;
|
|
14631
14854
|
}
|
|
14632
|
-
}
|
|
14633
|
-
if (flagSetVal) {
|
|
14634
14855
|
break;
|
|
14635
14856
|
}
|
|
14857
|
+
break;
|
|
14636
14858
|
}
|
|
14637
14859
|
}
|
|
14860
|
+
selectReportingLocation.addEventListener('change', (e) => {
|
|
14861
|
+
let index = parseInt(e.target.id.split('-')[3]);
|
|
14862
|
+
this.reportedLocationsVals[index] = e.target.value;
|
|
14863
|
+
});
|
|
14864
|
+
if (event.reportedlocations != null && event.reportedlocations.length > 0) {
|
|
14865
|
+
console.log('setting reportedlocations', event.reportedlocations);
|
|
14866
|
+
let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations;
|
|
14867
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
14868
|
+
if (country == "roles") {
|
|
14869
|
+
continue;
|
|
14870
|
+
}
|
|
14871
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
14872
|
+
let flagSetVal = false;
|
|
14873
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
14874
|
+
if (tempReportedLocation.indexOf(location) >= 0) {
|
|
14875
|
+
selectReportingEntity.value = entity;
|
|
14876
|
+
const changeEvent = new Event('change', { bubbles: true });
|
|
14877
|
+
selectReportingEntity.dispatchEvent(changeEvent);
|
|
14878
|
+
selectReportingLocation.value = location;
|
|
14879
|
+
flagSetVal = true;
|
|
14880
|
+
break;
|
|
14881
|
+
}
|
|
14882
|
+
}
|
|
14883
|
+
if (flagSetVal) {
|
|
14884
|
+
break;
|
|
14885
|
+
}
|
|
14886
|
+
}
|
|
14887
|
+
}
|
|
14888
|
+
}
|
|
14889
|
+
else {
|
|
14890
|
+
selectReportingEntity.value = "";
|
|
14891
|
+
selectReportingLocation.value = "";
|
|
14892
|
+
}
|
|
14638
14893
|
}
|
|
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;
|
|
14894
|
+
(_h = eventDetailReportingContainer.querySelector('#button-uploader-submit-approve')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async (ev) => {
|
|
14895
|
+
var _a, _b;
|
|
14645
14896
|
let buttonClick = ev.target;
|
|
14646
14897
|
buttonClick.innerHTML = "Saving...";
|
|
14647
|
-
const comments =
|
|
14648
|
-
|
|
14898
|
+
const comments = eventDetailReportingContainer.querySelector('#input-approver-comments').value;
|
|
14899
|
+
console.log('comments', comments, JSON.stringify(event.comments));
|
|
14900
|
+
const approved = eventDetailReportingContainer.querySelector('#input-approve-yes').checked;
|
|
14649
14901
|
let currStatus = this.getCompletenessStatus(event);
|
|
14650
14902
|
let newEvent = { ...event };
|
|
14651
14903
|
newEvent.comments = comments;
|
|
@@ -14659,22 +14911,19 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14659
14911
|
}, 3000);
|
|
14660
14912
|
return;
|
|
14661
14913
|
}
|
|
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
14914
|
let flagBulk = false;
|
|
14670
14915
|
if (this.selectedItemIds.length <= 1) {
|
|
14671
|
-
|
|
14672
|
-
if (await this.uploadReview(
|
|
14916
|
+
console.log('selectedevent', JSON.stringify(event));
|
|
14917
|
+
if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
|
|
14673
14918
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
14674
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
14919
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
14675
14920
|
this.events[mmdd][p].approved = approved;
|
|
14921
|
+
console.log('selected event', this.events[mmdd][p]);
|
|
14676
14922
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
|
|
14677
14923
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
14924
|
+
if (approved) {
|
|
14925
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + "";
|
|
14926
|
+
}
|
|
14678
14927
|
}
|
|
14679
14928
|
}
|
|
14680
14929
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -14688,8 +14937,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14688
14937
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14689
14938
|
const selectedId = this.selectedItemIds[k];
|
|
14690
14939
|
//console.log('selectedid', selectedId);
|
|
14691
|
-
|
|
14692
|
-
|
|
14940
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14941
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14693
14942
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14694
14943
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14695
14944
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
@@ -14701,8 +14950,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14701
14950
|
"eventid": eventId,
|
|
14702
14951
|
"comments": comments,
|
|
14703
14952
|
"approved": approved,
|
|
14704
|
-
"entityid":
|
|
14705
|
-
"locationid":
|
|
14953
|
+
"entityid": entityid,
|
|
14954
|
+
"locationid": locationid,
|
|
14706
14955
|
"username": this.userName,
|
|
14707
14956
|
"userid": this.userProfileId,
|
|
14708
14957
|
"userrole": this.myRole,
|
|
@@ -14718,16 +14967,16 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14718
14967
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14719
14968
|
const selectedId = this.selectedItemIds[k];
|
|
14720
14969
|
//console.log('selectedid', selectedId);
|
|
14721
|
-
|
|
14722
|
-
|
|
14970
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14971
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14723
14972
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14724
14973
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14725
14974
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
14726
14975
|
if (this.mode == "next") {
|
|
14727
14976
|
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;
|
|
14977
|
+
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
14978
|
flagBulk = true;
|
|
14979
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
14731
14980
|
if (this.recentlyReported[mmdd] == null) {
|
|
14732
14981
|
this.recentlyReported[mmdd] = [];
|
|
14733
14982
|
}
|
|
@@ -14737,7 +14986,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14737
14986
|
}
|
|
14738
14987
|
else {
|
|
14739
14988
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
14740
|
-
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid ==
|
|
14989
|
+
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
|
|
14741
14990
|
this.events[mmdd][p].isbulk = true;
|
|
14742
14991
|
flagBulk = true;
|
|
14743
14992
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -14752,7 +15001,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14752
15001
|
if (this.mode == "next") {
|
|
14753
15002
|
// this.fetchNext(this.nextPage)
|
|
14754
15003
|
// this.renderRoleTabsNext(this.nextPage)
|
|
14755
|
-
this.renderNextEvents(this.nextEvents, this.nextPage, this.
|
|
15004
|
+
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
|
|
14756
15005
|
}
|
|
14757
15006
|
else {
|
|
14758
15007
|
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
@@ -14766,39 +15015,17 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14766
15015
|
if (this.selectedItemIds.length > 0) {
|
|
14767
15016
|
await this.fetchBulkReportingData();
|
|
14768
15017
|
}
|
|
15018
|
+
console.log('events', this.events);
|
|
14769
15019
|
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
15020
|
}
|
|
14780
15021
|
}
|
|
14781
15022
|
});
|
|
14782
|
-
(
|
|
15023
|
+
(_j = eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async (ev) => {
|
|
14783
15024
|
var _a, _b;
|
|
14784
15025
|
let buttonClick = ev.target;
|
|
14785
15026
|
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
|
-
}
|
|
15027
|
+
const comments = eventDetailReportingContainer.querySelector('#input-auditor-comments').value;
|
|
15028
|
+
const approved = eventDetailReportingContainer.querySelector('#input-approve-yes').checked;
|
|
14802
15029
|
if (comments.trim().length === 0) {
|
|
14803
15030
|
buttonClick.innerHTML = "Save";
|
|
14804
15031
|
this.setError('Comments cannot be blank!');
|
|
@@ -14809,22 +15036,14 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14809
15036
|
else {
|
|
14810
15037
|
let flagBulk = false;
|
|
14811
15038
|
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();
|
|
15039
|
+
if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, (_a = event.module) !== null && _a !== void 0 ? _a : "compliance")) {
|
|
15040
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15041
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
15042
|
+
this.events[mmdd][p].approved = approved;
|
|
15043
|
+
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() });
|
|
15044
|
+
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
15045
|
+
if (approved) {
|
|
15046
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + "";
|
|
14828
15047
|
}
|
|
14829
15048
|
}
|
|
14830
15049
|
}
|
|
@@ -14839,8 +15058,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14839
15058
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14840
15059
|
const selectedId = this.selectedItemIds[k];
|
|
14841
15060
|
//console.log('selectedid', selectedId);
|
|
14842
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14843
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15061
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15062
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14844
15063
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14845
15064
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14846
15065
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
@@ -14865,20 +15084,20 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14865
15084
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
14866
15085
|
const selectedId = this.selectedItemIds[k];
|
|
14867
15086
|
//console.log('selectedid', selectedId);
|
|
14868
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
14869
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15087
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15088
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
14870
15089
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
14871
15090
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
14872
15091
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
14873
15092
|
if (this.mode == "next") {
|
|
14874
15093
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
14875
15094
|
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
15095
|
flagBulk = true;
|
|
15096
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
14878
15097
|
if (this.recentlyReported[mmdd] == null) {
|
|
14879
15098
|
this.recentlyReported[mmdd] = [];
|
|
14880
15099
|
}
|
|
14881
|
-
this.recentlyReported[mmdd].push(this.
|
|
15100
|
+
this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p]);
|
|
14882
15101
|
}
|
|
14883
15102
|
}
|
|
14884
15103
|
}
|
|
@@ -14896,12 +15115,6 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14896
15115
|
}
|
|
14897
15116
|
}
|
|
14898
15117
|
}
|
|
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
15118
|
if (this.mode == "next") {
|
|
14906
15119
|
// this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
|
|
14907
15120
|
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole);
|
|
@@ -14927,33 +15140,33 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14927
15140
|
}
|
|
14928
15141
|
});
|
|
14929
15142
|
if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
14930
|
-
if (approved) {
|
|
14931
|
-
if (
|
|
14932
|
-
|
|
15143
|
+
if (event.approved) {
|
|
15144
|
+
if (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') != null) {
|
|
15145
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'hidden';
|
|
14933
15146
|
}
|
|
14934
15147
|
}
|
|
14935
15148
|
else {
|
|
14936
|
-
if (
|
|
14937
|
-
|
|
14938
|
-
(
|
|
15149
|
+
if (eventDetailReportingContainer.querySelector('#button-uploader-submit-report') != null) {
|
|
15150
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-report').style.visibility = 'visible';
|
|
15151
|
+
(_k = eventDetailReportingContainer.querySelector('#button-uploader-submit-report')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', async (ev) => {
|
|
14939
15152
|
var _a, _b, _c, _f;
|
|
14940
15153
|
let buttonClick = ev.target;
|
|
14941
15154
|
buttonClick.innerHTML = "Saving...";
|
|
14942
|
-
const reportercomments =
|
|
15155
|
+
const reportercomments = eventDetailReportingContainer.querySelector('#input-reporter-comments').value;
|
|
14943
15156
|
//console.log('reporter comments 1', reportercomments);
|
|
14944
|
-
const reporterdoc =
|
|
15157
|
+
const reporterdoc = eventDetailReportingContainer.querySelector('#input-reporter-doc').value.length > 0 ? (new Date(eventDetailReportingContainer.querySelector('#input-reporter-doc').value).getTime() + "") : "";
|
|
14945
15158
|
let docs = [];
|
|
14946
15159
|
//console.log('reporter comments 2', reportercomments);
|
|
15160
|
+
// if(docsOptional.length === 0) {
|
|
14947
15161
|
let percentage = "100";
|
|
14948
|
-
if (
|
|
14949
|
-
percentage =
|
|
15162
|
+
if (eventDetailReportingContainer.querySelector('#input-reporter-percentage') != null) {
|
|
15163
|
+
percentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage').value;
|
|
14950
15164
|
}
|
|
14951
|
-
// if(docsOptional.length === 0) {
|
|
14952
15165
|
docs = this._SfUploader[0].querySelector('#uploader').selectedValues();
|
|
14953
15166
|
// }
|
|
14954
15167
|
let flag = false;
|
|
14955
15168
|
do {
|
|
14956
|
-
if (docs.length > 0 && docsOptional != null && docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
15169
|
+
if (docs.length > 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
14957
15170
|
for (let doc of docs) {
|
|
14958
15171
|
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
15172
|
flag = false;
|
|
@@ -14979,6 +15192,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14979
15192
|
reportformatvalues = (_a = JSON.stringify(this._SfReporting[0].querySelector('#reporting-format').selectedValues())) !== null && _a !== void 0 ? _a : "";
|
|
14980
15193
|
reportformatschema = (_b = this._SfReporting[0].querySelector('#reporting-format').configjson) !== null && _b !== void 0 ? _b : "";
|
|
14981
15194
|
}
|
|
15195
|
+
console.log('percentage', percentage, eventDetailReportingContainer.querySelector('#input-reporter-percentage').value);
|
|
14982
15196
|
if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
|
|
14983
15197
|
//console.log('reporter comments 3', reportercomments);
|
|
14984
15198
|
buttonClick.innerHTML = "Save";
|
|
@@ -14988,7 +15202,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
14988
15202
|
}, 3000);
|
|
14989
15203
|
}
|
|
14990
15204
|
else {
|
|
14991
|
-
if (docs.length
|
|
15205
|
+
if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
14992
15206
|
//console.log('reporter comments 3', reportercomments);
|
|
14993
15207
|
buttonClick.innerHTML = "Save";
|
|
14994
15208
|
this.setError('No documents uploaded!');
|
|
@@ -15022,43 +15236,58 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15022
15236
|
}, 3000);
|
|
15023
15237
|
}
|
|
15024
15238
|
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
15239
|
let flagBulk = false;
|
|
15032
|
-
let
|
|
15240
|
+
// let reportedlocations = selectReportingLocation?.value ?? "";
|
|
15241
|
+
let reportedlocations = "[]";
|
|
15242
|
+
if (parseInt(percentage) !== 100) {
|
|
15243
|
+
let selectReportedLocations = eventDetailReportingContainer.querySelectorAll('.input-reporter-location');
|
|
15244
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
15245
|
+
reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value]);
|
|
15246
|
+
}
|
|
15247
|
+
}
|
|
15033
15248
|
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);
|
|
15249
|
+
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)) {
|
|
15250
|
+
if (this.mode != "next") {
|
|
15049
15251
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15050
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
15252
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
15051
15253
|
this.events[mmdd][p].documents = docs;
|
|
15254
|
+
this.events[mmdd][p].percentage = percentage;
|
|
15255
|
+
this.events[mmdd][p].reportedlocations = reportedlocations;
|
|
15052
15256
|
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
15053
15257
|
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
15054
15258
|
}
|
|
15055
15259
|
}
|
|
15260
|
+
if (event.makercheckers.length > 0) {
|
|
15261
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
15262
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15263
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
15264
|
+
this.events[mmdd][p].approved = true;
|
|
15265
|
+
// this.events[mmdd][p].documents = docs
|
|
15266
|
+
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
|
|
15267
|
+
this.events[mmdd][p].lastupdated = new Date().toString();
|
|
15268
|
+
}
|
|
15269
|
+
}
|
|
15270
|
+
}
|
|
15271
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
15272
|
+
this.recentlyReported[mmdd] = [];
|
|
15273
|
+
}
|
|
15274
|
+
this.recentlyReported[mmdd].push(event);
|
|
15275
|
+
console.log('recently reported', this.recentlyReported);
|
|
15056
15276
|
}
|
|
15057
|
-
|
|
15058
|
-
|
|
15059
|
-
|
|
15277
|
+
else {
|
|
15278
|
+
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
15279
|
+
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) {
|
|
15280
|
+
this.nextEvents[this.nextTabRole][mmdd][p].documents = docs;
|
|
15281
|
+
this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage;
|
|
15282
|
+
this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations;
|
|
15283
|
+
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() });
|
|
15284
|
+
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString();
|
|
15285
|
+
}
|
|
15286
|
+
}
|
|
15287
|
+
if (event.makercheckers.length > 0) {
|
|
15288
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
15060
15289
|
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 ==
|
|
15290
|
+
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
15291
|
this.nextEvents[this.nextTabRole][mmdd][p].approved = true;
|
|
15063
15292
|
// this.events[mmdd][p].documents = docs
|
|
15064
15293
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() });
|
|
@@ -15066,21 +15295,12 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15066
15295
|
}
|
|
15067
15296
|
}
|
|
15068
15297
|
}
|
|
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
|
-
}
|
|
15298
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
15299
|
+
this.recentlyReported[mmdd] = [];
|
|
15078
15300
|
}
|
|
15301
|
+
this.recentlyReported[mmdd].push(event);
|
|
15302
|
+
console.log('recently reported', this.recentlyReported);
|
|
15079
15303
|
}
|
|
15080
|
-
if (this.recentlyReported[mmdd] == null) {
|
|
15081
|
-
this.recentlyReported[mmdd] = [];
|
|
15082
|
-
}
|
|
15083
|
-
this.recentlyReported[mmdd].push(event);
|
|
15084
15304
|
}
|
|
15085
15305
|
}
|
|
15086
15306
|
else {
|
|
@@ -15090,30 +15310,11 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15090
15310
|
const selectedId = this.selectedItemIds[k];
|
|
15091
15311
|
//console.log('selectedid', selectedId);
|
|
15092
15312
|
const makercheckersL = selectedId.split('-')[5];
|
|
15093
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15094
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15313
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15314
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15095
15315
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
15096
15316
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
15097
15317
|
//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
15318
|
// await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
|
|
15118
15319
|
// if(parseInt(makercheckersL) > 0) {
|
|
15119
15320
|
// bulkBodyReview.push({
|
|
@@ -15148,7 +15349,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15148
15349
|
"comments": reportercomments,
|
|
15149
15350
|
"dateofcompletion": reporterdoc,
|
|
15150
15351
|
"percentage": percentage,
|
|
15151
|
-
"
|
|
15352
|
+
"reportedlocations": reportedlocations,
|
|
15152
15353
|
"entityid": entityId,
|
|
15153
15354
|
"locationid": locationId,
|
|
15154
15355
|
"event": null,
|
|
@@ -15167,26 +15368,27 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15167
15368
|
// await this.sleep(2000);
|
|
15168
15369
|
// this.clearMessages();
|
|
15169
15370
|
}
|
|
15371
|
+
// await this.uploadReportsBulk(bulkBody);
|
|
15372
|
+
// await this.fetchBulkReportingData();
|
|
15170
15373
|
if (bulkBody.length > 0) {
|
|
15171
15374
|
await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
|
|
15172
15375
|
}
|
|
15173
|
-
// await this.fetchBulkReportingData();
|
|
15174
15376
|
// if(bulkBodyReview.length > 0){
|
|
15175
15377
|
// await this.uploadReportsReviewsBulk(bulkBodyReview)
|
|
15176
15378
|
// }
|
|
15177
15379
|
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
15178
15380
|
const selectedId = this.selectedItemIds[k];
|
|
15179
15381
|
//console.log('selectedid', selectedId);
|
|
15180
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15181
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15382
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
15383
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
15182
15384
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
15183
15385
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
15184
15386
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1];
|
|
15185
15387
|
if (this.mode == "next") {
|
|
15186
15388
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
15187
15389
|
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
15390
|
flagBulk = true;
|
|
15391
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true;
|
|
15190
15392
|
if (this.recentlyReported[mmdd] == null) {
|
|
15191
15393
|
this.recentlyReported[mmdd] = [];
|
|
15192
15394
|
}
|
|
@@ -15197,8 +15399,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15197
15399
|
else {
|
|
15198
15400
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
15199
15401
|
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
15402
|
flagBulk = true;
|
|
15403
|
+
this.events[mmdd][p].isbulk = true;
|
|
15202
15404
|
if (this.recentlyReported[mmdd] == null) {
|
|
15203
15405
|
this.recentlyReported[mmdd] = [];
|
|
15204
15406
|
}
|
|
@@ -15239,32 +15441,38 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15239
15441
|
}
|
|
15240
15442
|
}
|
|
15241
15443
|
if (this._SfUploader[0] != null) {
|
|
15242
|
-
|
|
15444
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15445
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
|
|
15446
|
+
}
|
|
15243
15447
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev) => {
|
|
15244
15448
|
console.log('uploader analysisInProgress', _ev);
|
|
15245
|
-
|
|
15449
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15450
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "block";
|
|
15451
|
+
}
|
|
15246
15452
|
});
|
|
15247
15453
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev) => {
|
|
15248
15454
|
console.log('uploader analysisInProgress', _ev);
|
|
15249
|
-
if (
|
|
15250
|
-
|
|
15455
|
+
if (eventDetailReportingContainer.querySelector('.uploader-analysis-message') != null) {
|
|
15456
|
+
eventDetailReportingContainer.querySelector('.uploader-analysis-message').style.display = "none";
|
|
15251
15457
|
}
|
|
15252
15458
|
});
|
|
15253
15459
|
//console.log('documentType checking', documentType);
|
|
15254
|
-
if (documentType != null) {
|
|
15255
|
-
this._SfUploader[0].querySelector('#uploader').docType = documentType;
|
|
15460
|
+
if (event.documentType != null) {
|
|
15461
|
+
this._SfUploader[0].querySelector('#uploader').docType = event.documentType;
|
|
15256
15462
|
}
|
|
15257
15463
|
else {
|
|
15258
15464
|
this._SfUploader[0].querySelector('#uploader').docType = "";
|
|
15259
15465
|
}
|
|
15260
15466
|
this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify([]);
|
|
15261
15467
|
console.log('uploader', this._SfUploader[0].querySelector('#uploader'));
|
|
15468
|
+
this._SfUploader[0].querySelector('#uploader').current = 0;
|
|
15262
15469
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15263
15470
|
if (docs.length > 0) {
|
|
15264
15471
|
this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr = JSON.stringify(docs);
|
|
15472
|
+
this._SfUploader[0].querySelector('#uploader').current = docs.length;
|
|
15265
15473
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15266
15474
|
}
|
|
15267
|
-
if (this.myRole == this.TAB_APPROVER || approved) {
|
|
15475
|
+
if (this.myRole == this.TAB_APPROVER || event.approved) {
|
|
15268
15476
|
this._SfUploader[0].querySelector('#uploader').readOnly = true;
|
|
15269
15477
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15270
15478
|
}
|
|
@@ -15275,8 +15483,8 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15275
15483
|
const dataPassthrough = {
|
|
15276
15484
|
projectId: this.projectId,
|
|
15277
15485
|
countryId: this.countryId,
|
|
15278
|
-
entityId:
|
|
15279
|
-
locationId:
|
|
15486
|
+
entityId: event.entityid,
|
|
15487
|
+
locationId: event.locationid,
|
|
15280
15488
|
mmddyyyy: mmddyyyy,
|
|
15281
15489
|
complianceId: event['id'],
|
|
15282
15490
|
path: "uploadextract"
|
|
@@ -15288,6 +15496,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15288
15496
|
this._SfUploader[0].querySelector('#uploader').callbackUrlHost = callbackUrlHost;
|
|
15289
15497
|
this._SfUploader[0].querySelector('#uploader').callbackUrlPath = callbackUrlPath;
|
|
15290
15498
|
this._SfUploader[0].querySelector('#uploader').loadMode();
|
|
15499
|
+
console.log('uploader prepopulate', this._SfUploader[0].querySelector('#uploader').prepopulatedInputArr, this._SfUploader[0].querySelector('#uploader').extract);
|
|
15291
15500
|
}
|
|
15292
15501
|
//console.log('approved 1', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
15293
15502
|
if (this.myRole == this.TAB_APPROVER || this.myRole == this.TAB_VIEWER || this.myRole == this.TAB_AUDITOR || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
@@ -15295,50 +15504,34 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
15295
15504
|
if (event["approved"] != null) {
|
|
15296
15505
|
if (event["approved"] === true) {
|
|
15297
15506
|
//console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
15298
|
-
if (
|
|
15299
|
-
|
|
15507
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15508
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = true;
|
|
15300
15509
|
}
|
|
15301
|
-
if (
|
|
15302
|
-
|
|
15510
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15511
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = false;
|
|
15303
15512
|
}
|
|
15304
15513
|
}
|
|
15305
15514
|
else {
|
|
15306
|
-
if (
|
|
15307
|
-
|
|
15515
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15516
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
|
|
15308
15517
|
}
|
|
15309
|
-
if (
|
|
15310
|
-
|
|
15518
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15519
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
|
|
15311
15520
|
}
|
|
15312
15521
|
}
|
|
15313
15522
|
}
|
|
15314
15523
|
else {
|
|
15315
|
-
if (
|
|
15316
|
-
|
|
15524
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') != null) {
|
|
15525
|
+
eventDetailReportingContainer.querySelector('#input-approve-yes').checked = false;
|
|
15317
15526
|
}
|
|
15318
|
-
if (
|
|
15319
|
-
|
|
15527
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-no') != null) {
|
|
15528
|
+
eventDetailReportingContainer.querySelector('#input-approve-no').checked = true;
|
|
15320
15529
|
}
|
|
15321
15530
|
}
|
|
15322
15531
|
}
|
|
15323
15532
|
}
|
|
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 : "");
|
|
15533
|
+
if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
15534
|
+
this.fetchReportFormat(eventDetailReportingContainer, reportformatName, (_l = event['reportformatschema']) !== null && _l !== void 0 ? _l : "", (_m = event['reportformatvalues']) !== null && _m !== void 0 ? _m : "");
|
|
15342
15535
|
}
|
|
15343
15536
|
};
|
|
15344
15537
|
this.renderCalendar = () => {
|
|
@@ -22094,6 +22287,37 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
22094
22287
|
}
|
|
22095
22288
|
return retValue;
|
|
22096
22289
|
};
|
|
22290
|
+
this.exportRegister = async () => {
|
|
22291
|
+
let url = "https://" + this.apiId + "/scheduleregisterexportjob";
|
|
22292
|
+
const body = {
|
|
22293
|
+
"projectid": this.projectId,
|
|
22294
|
+
"userid": this.userProfileId,
|
|
22295
|
+
"role": this.myRole,
|
|
22296
|
+
};
|
|
22297
|
+
console.log('exporting Register...', body);
|
|
22298
|
+
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
22299
|
+
const xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
|
|
22300
|
+
this._SfLoader.innerHTML = '';
|
|
22301
|
+
if (xhr.status == 200) {
|
|
22302
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
22303
|
+
console.log('jsonResponse sync', jsonRespose);
|
|
22304
|
+
this.setSuccess("Register export started successfully! Youwill get an email with your register landscape.");
|
|
22305
|
+
setTimeout(() => {
|
|
22306
|
+
this.clearMessages();
|
|
22307
|
+
}, 5000);
|
|
22308
|
+
}
|
|
22309
|
+
else {
|
|
22310
|
+
if (xhr.status == 401) {
|
|
22311
|
+
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
22312
|
+
this.dispatchEvent(changeEvent);
|
|
22313
|
+
}
|
|
22314
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
22315
|
+
this.setError(jsonRespose.error);
|
|
22316
|
+
setTimeout(() => {
|
|
22317
|
+
this.clearMessages();
|
|
22318
|
+
}, 3000);
|
|
22319
|
+
}
|
|
22320
|
+
};
|
|
22097
22321
|
this.uploadMapping = async () => {
|
|
22098
22322
|
let url = "https://" + this.apiId + "/mapevents";
|
|
22099
22323
|
const mapping = this.transformMappingsForUpload({
|
|
@@ -24630,7 +24854,6 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
24630
24854
|
let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
24631
24855
|
console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
24632
24856
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
24633
|
-
4;
|
|
24634
24857
|
this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer);
|
|
24635
24858
|
}
|
|
24636
24859
|
else {
|
|
@@ -26378,6 +26601,10 @@ SfIEvents.styles = css `
|
|
|
26378
26601
|
margin-left: 10px;
|
|
26379
26602
|
}
|
|
26380
26603
|
|
|
26604
|
+
.ml-10-m-0 {
|
|
26605
|
+
margin-left: 10px;
|
|
26606
|
+
}
|
|
26607
|
+
|
|
26381
26608
|
.mt-20 {
|
|
26382
26609
|
margin-top: 20px;
|
|
26383
26610
|
}
|
|
@@ -26386,6 +26613,10 @@ SfIEvents.styles = css `
|
|
|
26386
26613
|
margin-left: 20px;
|
|
26387
26614
|
}
|
|
26388
26615
|
|
|
26616
|
+
.ml-20-m-0 {
|
|
26617
|
+
margin-left: 20px;
|
|
26618
|
+
}
|
|
26619
|
+
|
|
26389
26620
|
.mr-20 {
|
|
26390
26621
|
margin-right: 20px;
|
|
26391
26622
|
}
|
|
@@ -26548,6 +26779,14 @@ SfIEvents.styles = css `
|
|
|
26548
26779
|
.calendar-right-data {
|
|
26549
26780
|
width: 100%;
|
|
26550
26781
|
}
|
|
26782
|
+
|
|
26783
|
+
.ml-10-m-0 {
|
|
26784
|
+
margin-left: 0px;
|
|
26785
|
+
}
|
|
26786
|
+
|
|
26787
|
+
.ml-20-m-0 {
|
|
26788
|
+
margin-left: 0px;
|
|
26789
|
+
}
|
|
26551
26790
|
|
|
26552
26791
|
}
|
|
26553
26792
|
|