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/src/sf-i-events.ts
CHANGED
|
@@ -1709,6 +1709,8 @@ export class SfIEvents extends LitElement {
|
|
|
1709
1709
|
suspenseFlag: boolean = false;
|
|
1710
1710
|
|
|
1711
1711
|
tablecols: string[] = []
|
|
1712
|
+
|
|
1713
|
+
reportedLocationsVals: any[] = []
|
|
1712
1714
|
static override styles = css`
|
|
1713
1715
|
|
|
1714
1716
|
.bg-white {
|
|
@@ -2261,6 +2263,10 @@ export class SfIEvents extends LitElement {
|
|
|
2261
2263
|
margin-left: 10px;
|
|
2262
2264
|
}
|
|
2263
2265
|
|
|
2266
|
+
.ml-10-m-0 {
|
|
2267
|
+
margin-left: 10px;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2264
2270
|
.mt-20 {
|
|
2265
2271
|
margin-top: 20px;
|
|
2266
2272
|
}
|
|
@@ -2269,6 +2275,10 @@ export class SfIEvents extends LitElement {
|
|
|
2269
2275
|
margin-left: 20px;
|
|
2270
2276
|
}
|
|
2271
2277
|
|
|
2278
|
+
.ml-20-m-0 {
|
|
2279
|
+
margin-left: 20px;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2272
2282
|
.mr-20 {
|
|
2273
2283
|
margin-right: 20px;
|
|
2274
2284
|
}
|
|
@@ -2431,6 +2441,14 @@ export class SfIEvents extends LitElement {
|
|
|
2431
2441
|
.calendar-right-data {
|
|
2432
2442
|
width: 100%;
|
|
2433
2443
|
}
|
|
2444
|
+
|
|
2445
|
+
.ml-10-m-0 {
|
|
2446
|
+
margin-left: 0px;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
.ml-20-m-0 {
|
|
2450
|
+
margin-left: 0px;
|
|
2451
|
+
}
|
|
2434
2452
|
|
|
2435
2453
|
}
|
|
2436
2454
|
|
|
@@ -4816,9 +4834,9 @@ export class SfIEvents extends LitElement {
|
|
|
4816
4834
|
const eventIdSanitized = event.id.replace(/-/g, '_');
|
|
4817
4835
|
const mmddSanitized = mmdd.replace(/\//g, '-');
|
|
4818
4836
|
const dueDateParts = event.duedate.split('/');
|
|
4819
|
-
const isReportedLocation = event.reportedlocationsflag == true
|
|
4820
|
-
const isSuspense = event.suspense == true
|
|
4821
|
-
const isReviewed = event.review == true
|
|
4837
|
+
const isReportedLocation = event.reportedlocationsflag == true
|
|
4838
|
+
const isSuspense = event.suspense == true
|
|
4839
|
+
const isReviewed = event.review == true
|
|
4822
4840
|
const showCheckbox = !(hasReportFormat || isBulk || hasCustomReporting || isReportedLocation);
|
|
4823
4841
|
// const showReportingButton = !hasReportFormat && !hasCustomReporting && event.reporters == null;
|
|
4824
4842
|
const showReportingButton = !hasReportFormat && !hasCustomReporting && event.concise != null && !isReportedLocation;
|
|
@@ -5211,7 +5229,7 @@ export class SfIEvents extends LitElement {
|
|
|
5211
5229
|
const configFlag = configHome.features != null && configHome.features.indexOf("understood") >= 0
|
|
5212
5230
|
html += '<div class="d-flex align-center event-user-labels-container"><div part="badge-filter-name" class="graphparamname graphparamname1 mb-20' + (event.concise == null ? "" : ' hide') + '">' + graphParam.split(';')[0] + '</div>' + reporterStr + approverStr + (((event.module == "compliances" || event.module == null) && event.concise == null && ((event.reportformat == null || event.reportformat.length == 0) && (event.customreporting == null) && (event.reportedlocationsflag != true))) ? ('<button id="button-list-reporting-' + mmdd.replace('/', '-') + '-' + j + '-" part="button-list-reporting" class="material-icons ml-10 mb-20 button-list-reporting">edit_note</button>') : '') + (((event.module == "compliances" || event.module == null) && event.concise == null && configFlag) ? (event.review ? ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-reviewed" class="material-symbols-outlined d-flex align-center mb-20 ml-10 button-icon-review">flag_check</button>') : ('<button id="input-checkbox-review-' + mmdd.replace('/', '-') + '-' + j + '" part="button-icon-review" class="d-flex align-center mb-20 ml-10 button-icon-review"><span class="material-symbols-outlined" title="Mark as reviewed">flag</span> Mark Understood</button>')) : '') + '</div>';
|
|
5213
5231
|
// }
|
|
5214
|
-
|
|
5232
|
+
|
|
5215
5233
|
return html;
|
|
5216
5234
|
|
|
5217
5235
|
}
|
|
@@ -5920,7 +5938,9 @@ export class SfIEvents extends LitElement {
|
|
|
5920
5938
|
let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
5921
5939
|
let docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
5922
5940
|
let uploadGuidance = event['uploadguidance'] ?? 0
|
|
5923
|
-
|
|
5941
|
+
this.reportedLocationsVals = (event['reportedlocations'] != null) ? (Util.isJSONParsable(event['reportedlocations']) ? JSON.parse(event['reportedlocations']) : [event['reportedlocations']]) : ['']
|
|
5942
|
+
console.log('reportedLocations found', this.reportedLocationsVals)
|
|
5943
|
+
console.log('rendering reporting', event, percentage, this.reportedLocationsVals)
|
|
5924
5944
|
if (this.selectedItemIds.length > 0) {
|
|
5925
5945
|
html += `<div class="d-flex justify-between ">
|
|
5926
5946
|
<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>
|
|
@@ -5952,19 +5972,39 @@ export class SfIEvents extends LitElement {
|
|
|
5952
5972
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
5953
5973
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
5954
5974
|
html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
|
|
5955
|
-
html += '<div class="d-flex justify-start align-center">';
|
|
5975
|
+
html += '<div class="d-flex justify-start align-center flex-wrap">';
|
|
5956
5976
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
5957
5977
|
html += '<label part="input-label">Completion Percentage</label>';
|
|
5958
5978
|
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1" disabled/><br />';
|
|
5959
5979
|
html += '</div>'
|
|
5960
|
-
html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
|
|
5980
|
+
html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
5961
5981
|
html += '<label part="input-label">Entity</label>';
|
|
5962
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
5982
|
+
html += '<select id="input-reporter-entity-0" part="input" disabled></select>';
|
|
5963
5983
|
html += '</div>'
|
|
5964
|
-
html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
|
|
5984
|
+
html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
5965
5985
|
html += '<label part="input-label">Location</label>';
|
|
5966
|
-
html += '<select id="input-reporter-location" part="input"></select
|
|
5986
|
+
html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input" disabled></select>';
|
|
5967
5987
|
html += '</div>'
|
|
5988
|
+
// 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>'
|
|
5989
|
+
if (this.reportedLocationsVals.length > 1) {
|
|
5990
|
+
let indexLocation = 1;
|
|
5991
|
+
while (indexLocation < this.reportedLocationsVals.length) {
|
|
5992
|
+
html += '<div class="d-flex justify-start align-end flex-wrap">';
|
|
5993
|
+
html += '<div class="d-flex flex-col flex-grow">';
|
|
5994
|
+
html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
|
|
5995
|
+
html += '</div>'
|
|
5996
|
+
html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
|
|
5997
|
+
html += '<label part="input-label">Entity</label>';
|
|
5998
|
+
html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
|
|
5999
|
+
html += '</div>'
|
|
6000
|
+
html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide" disabled>';
|
|
6001
|
+
html += '<label part="input-label">Location</label>';
|
|
6002
|
+
html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
|
|
6003
|
+
html += '</div>'
|
|
6004
|
+
// 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>'
|
|
6005
|
+
indexLocation++
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
5968
6008
|
html += '</div>'
|
|
5969
6009
|
|
|
5970
6010
|
}
|
|
@@ -6026,20 +6066,41 @@ export class SfIEvents extends LitElement {
|
|
|
6026
6066
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
6027
6067
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
6028
6068
|
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 />';
|
|
6029
|
-
html += '<div class="d-flex justify-start align-
|
|
6069
|
+
html += '<div class="d-flex justify-start align-end flex-wrap">';
|
|
6030
6070
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
6031
6071
|
html += '<label part="input-label">Completion Percentage*</label>';
|
|
6032
|
-
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"
|
|
6072
|
+
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1"/>';
|
|
6033
6073
|
html += '</div>'
|
|
6034
|
-
html += '<div id="reporting-entity-container" class="d-flex flex-col flex-grow ml-20 hide">';
|
|
6074
|
+
html += '<div id="reporting-entity-container-0" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
6035
6075
|
html += '<label part="input-label">Entity</label>';
|
|
6036
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
6076
|
+
html += '<select id="input-reporter-entity-0" part="input"></select>';
|
|
6037
6077
|
html += '</div>'
|
|
6038
|
-
html += '<div id="reporting-location-container" class="d-flex flex-col flex-grow ml-20 hide">';
|
|
6078
|
+
html += '<div id="reporting-location-container-0" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
6039
6079
|
html += '<label part="input-label">Location</label>';
|
|
6040
|
-
html += '<select id="input-reporter-location" part="input"></select
|
|
6041
|
-
html += '</div>'
|
|
6080
|
+
html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input"></select>';
|
|
6042
6081
|
html += '</div>'
|
|
6082
|
+
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>'
|
|
6083
|
+
if (this.reportedLocationsVals.length > 1) {
|
|
6084
|
+
let indexLocation = 1;
|
|
6085
|
+
while (indexLocation < this.reportedLocationsVals.length) {
|
|
6086
|
+
html += '<div class="d-flex justify-start align-end flex-wrap">';
|
|
6087
|
+
html += '<div class="d-flex flex-col flex-grow">';
|
|
6088
|
+
html += '<label class="invisible" part="input-label">Completion Percentage*</label>';
|
|
6089
|
+
html += '</div>'
|
|
6090
|
+
html += '<div id="reporting-entity-container-' + indexLocation + '" class="reporting-entity-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
6091
|
+
html += '<label part="input-label">Entity</label>';
|
|
6092
|
+
html += '<select id="input-reporter-entity-' + indexLocation + '" part="input"></select>';
|
|
6093
|
+
html += '</div>'
|
|
6094
|
+
html += '<div id="reporting-location-container-' + indexLocation + '" class="reporting-location-container d-flex flex-col flex-grow ml-20-m-0 hide">';
|
|
6095
|
+
html += '<label part="input-label">Location</label>';
|
|
6096
|
+
html += '<select id="input-reporter-location-' + indexLocation + '" class="input-reporter-location" part="input"></select>';
|
|
6097
|
+
html += '</div>'
|
|
6098
|
+
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>'
|
|
6099
|
+
indexLocation++
|
|
6100
|
+
}
|
|
6101
|
+
}
|
|
6102
|
+
html += '<div class="d-flex justify-end align-end mt-10" class="input-report-location-add-container">';
|
|
6103
|
+
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>'
|
|
6043
6104
|
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 />'
|
|
6044
6105
|
|
|
6045
6106
|
// if(docsOptional.length === 0) {
|
|
@@ -6264,7 +6325,11 @@ export class SfIEvents extends LitElement {
|
|
|
6264
6325
|
listReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
|
|
6265
6326
|
console.log('upload guidance clicked', event);
|
|
6266
6327
|
let inputReportingPercentage = (listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
|
|
6267
|
-
let
|
|
6328
|
+
let selectReportedLocations = (listReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
6329
|
+
let selectReportedLocationValue = "[]";
|
|
6330
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
6331
|
+
selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value])
|
|
6332
|
+
}
|
|
6268
6333
|
let approvercomments = (listReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
|
|
6269
6334
|
let reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
|
|
6270
6335
|
let dateOfCompletion;
|
|
@@ -6278,97 +6343,161 @@ export class SfIEvents extends LitElement {
|
|
|
6278
6343
|
dateOfCompletion = "";
|
|
6279
6344
|
}
|
|
6280
6345
|
console.log('dateOfCompletion', dateOfCompletion)
|
|
6281
|
-
await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage,
|
|
6346
|
+
await this.fetchEventDetails(event, mmddyyyy, null, eventsContainer, "", "", true, listReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
|
|
6282
6347
|
})
|
|
6283
6348
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
6284
6349
|
let inputReportingPercentage = listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
|
|
6285
6350
|
let percentage = inputReportingPercentage.value
|
|
6286
|
-
|
|
6351
|
+
const entityContainers = listReportingContainer.querySelectorAll('.reporting-entity-container') as NodeListOf<HTMLDivElement>;
|
|
6352
|
+
const locationsContainers = listReportingContainer.querySelectorAll('.reporting-location-container') as NodeListOf<HTMLDivElement>;
|
|
6353
|
+
const addLocationButtons = listReportingContainer.querySelectorAll('.button-reporter-location-add') as NodeListOf<HTMLButtonElement>;
|
|
6287
6354
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
6288
|
-
|
|
6289
|
-
|
|
6355
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
6356
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
6357
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
6290
6358
|
} else {
|
|
6291
|
-
|
|
6292
|
-
|
|
6359
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
6360
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
6361
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
6293
6362
|
}
|
|
6294
6363
|
inputReportingPercentage?.addEventListener('change', () => {
|
|
6295
6364
|
setTimeout(() => {
|
|
6296
6365
|
let percentage = inputReportingPercentage.value
|
|
6297
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
6366
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
6298
6367
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
6299
|
-
|
|
6300
|
-
|
|
6368
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
6369
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
6370
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
6301
6371
|
} else {
|
|
6302
|
-
|
|
6303
|
-
|
|
6372
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
6373
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
6374
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
6304
6375
|
}
|
|
6305
6376
|
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
6306
6377
|
(listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
|
|
6307
6378
|
} else {
|
|
6308
6379
|
(listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
|
|
6309
6380
|
}
|
|
6381
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
|
|
6382
|
+
event.percentage = percentage
|
|
6383
|
+
event.reportedlocations = JSON.stringify([""])
|
|
6384
|
+
event.reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
6385
|
+
event.dateofcompletion = (listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
6386
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
6387
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
6388
|
+
this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
|
|
6389
|
+
}
|
|
6310
6390
|
}, 200);
|
|
6311
6391
|
})
|
|
6312
|
-
let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity') as HTMLSelectElement;
|
|
6313
|
-
let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location') as HTMLSelectElement;
|
|
6314
|
-
selectReportingEntity.innerHTML = '';
|
|
6315
6392
|
let projectUserMap = Util.getProjectUsermap()
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6393
|
+
addLocationButtons.forEach((addLocationBtn) => {
|
|
6394
|
+
addLocationBtn.addEventListener('click', () => {
|
|
6395
|
+
let iconhtml = addLocationBtn.innerHTML
|
|
6396
|
+
let index = parseInt(addLocationBtn.id.split('-')[4])
|
|
6397
|
+
console.log('button clicked', iconhtml, addLocationBtn.id);
|
|
6398
|
+
if (iconhtml == "add") {
|
|
6399
|
+
console.log('this.reportedLocationsVals', this.reportedLocationsVals)
|
|
6400
|
+
this.reportedLocationsVals.push("");
|
|
6401
|
+
} else {
|
|
6402
|
+
this.reportedLocationsVals.splice(index, 1);
|
|
6403
|
+
}
|
|
6404
|
+
event.percentage = inputReportingPercentage.value;
|
|
6405
|
+
event.reportedlocations = JSON.stringify(this.reportedLocationsVals)
|
|
6406
|
+
if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
|
|
6407
|
+
event.percentage = "100";
|
|
6408
|
+
}
|
|
6409
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
6410
|
+
event.reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
6411
|
+
event.dateofcompletion = (listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((listReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
6412
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
6413
|
+
this.renderListReporting(listReportingContainer, event, mmddyyyy, eventsContainer);
|
|
6414
|
+
})
|
|
6415
|
+
})
|
|
6416
|
+
|
|
6417
|
+
for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
|
|
6418
|
+
console.log('AddingEntities', indexRepLoc)
|
|
6419
|
+
let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc) as HTMLSelectElement;
|
|
6420
|
+
let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc) as HTMLSelectElement;
|
|
6421
|
+
selectReportingEntity.innerHTML = '';
|
|
6328
6422
|
for (let country of Object.keys(projectUserMap)) {
|
|
6329
6423
|
if (country == "roles") {
|
|
6330
6424
|
continue;
|
|
6331
6425
|
}
|
|
6332
6426
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
6333
|
-
|
|
6427
|
+
let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
6428
|
+
let option = new Option(entityName, entity)
|
|
6429
|
+
selectReportingEntity.add(option);
|
|
6430
|
+
}
|
|
6431
|
+
}
|
|
6432
|
+
selectReportingEntity.addEventListener('change', (e: any) => {
|
|
6433
|
+
selectReportingLocation.innerHTML = ''
|
|
6434
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
6435
|
+
if (country == "roles") {
|
|
6436
|
+
continue;
|
|
6437
|
+
}
|
|
6438
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
6439
|
+
if (entity.indexOf(e.target.value) < 0) {
|
|
6440
|
+
continue;
|
|
6441
|
+
}
|
|
6442
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
6443
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
6444
|
+
let option = new Option(locationName, location)
|
|
6445
|
+
selectReportingLocation.add(option);
|
|
6446
|
+
}
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
(listReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc) as HTMLDivElement).classList.remove('hide')
|
|
6450
|
+
selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
|
|
6451
|
+
})
|
|
6452
|
+
if (selectReportingLocation.innerHTML == '') {
|
|
6453
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
6454
|
+
if (country == "roles") {
|
|
6334
6455
|
continue;
|
|
6335
6456
|
}
|
|
6336
|
-
for (let
|
|
6337
|
-
let
|
|
6338
|
-
|
|
6339
|
-
|
|
6457
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
6458
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
6459
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
6460
|
+
let option = new Option(locationName, location)
|
|
6461
|
+
selectReportingLocation.add(option);
|
|
6462
|
+
break;
|
|
6463
|
+
}
|
|
6464
|
+
break;
|
|
6340
6465
|
}
|
|
6466
|
+
break;
|
|
6341
6467
|
}
|
|
6342
6468
|
}
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
for (let
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6469
|
+
selectReportingLocation.addEventListener('change', (e: any) => {
|
|
6470
|
+
let index = parseInt(e.target.id.split('-')[3])
|
|
6471
|
+
this.reportedLocationsVals[index] = e.target.value
|
|
6472
|
+
})
|
|
6473
|
+
if (event.reportedlocations != null && event.reportedlocations.length > 0) {
|
|
6474
|
+
console.log('setting reportedlocations', event.reportedlocations)
|
|
6475
|
+
let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations
|
|
6476
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
6477
|
+
if (country == "roles") {
|
|
6478
|
+
continue;
|
|
6479
|
+
}
|
|
6480
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
6481
|
+
let flagSetVal = false;
|
|
6482
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
6483
|
+
if (tempReportedLocation.indexOf(location) >= 0) {
|
|
6484
|
+
selectReportingEntity.value = entity;
|
|
6485
|
+
const changeEvent = new Event('change', { bubbles: true });
|
|
6486
|
+
selectReportingEntity.dispatchEvent(changeEvent)
|
|
6487
|
+
selectReportingLocation.value = location;
|
|
6488
|
+
flagSetVal = true;
|
|
6489
|
+
break;
|
|
6490
|
+
}
|
|
6491
|
+
}
|
|
6492
|
+
if (flagSetVal) {
|
|
6361
6493
|
break;
|
|
6362
6494
|
}
|
|
6363
6495
|
}
|
|
6364
|
-
if (flagSetVal) {
|
|
6365
|
-
break;
|
|
6366
|
-
}
|
|
6367
6496
|
}
|
|
6497
|
+
} else {
|
|
6498
|
+
selectReportingEntity.value = "";
|
|
6499
|
+
selectReportingLocation.value = "";
|
|
6368
6500
|
}
|
|
6369
|
-
} else {
|
|
6370
|
-
selectReportingEntity.value = "";
|
|
6371
|
-
selectReportingLocation.value = "";
|
|
6372
6501
|
}
|
|
6373
6502
|
|
|
6374
6503
|
listReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
|
|
@@ -6744,7 +6873,14 @@ export class SfIEvents extends LitElement {
|
|
|
6744
6873
|
|
|
6745
6874
|
} else {
|
|
6746
6875
|
let flagBulk = false;
|
|
6747
|
-
let reportedlocations = selectReportingLocation?.value ?? "";
|
|
6876
|
+
// let reportedlocations = selectReportingLocation?.value ?? "";
|
|
6877
|
+
let reportedlocations = "[]";
|
|
6878
|
+
if (parseInt(percentage) !== 100) {
|
|
6879
|
+
let selectReportedLocations = (listReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
6880
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
6881
|
+
reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value])
|
|
6882
|
+
}
|
|
6883
|
+
}
|
|
6748
6884
|
if (this.selectedItemIds.length <= 1) {
|
|
6749
6885
|
|
|
6750
6886
|
if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, event.makercheckers, reportedlocations)) {
|
|
@@ -6753,6 +6889,8 @@ export class SfIEvents extends LitElement {
|
|
|
6753
6889
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
6754
6890
|
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
6755
6891
|
this.events[mmdd][p].documents = docs
|
|
6892
|
+
this.events[mmdd][p].percentage = percentage
|
|
6893
|
+
this.events[mmdd][p].reportedlocations = reportedlocations
|
|
6756
6894
|
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
6757
6895
|
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
6758
6896
|
}
|
|
@@ -6779,6 +6917,8 @@ export class SfIEvents extends LitElement {
|
|
|
6779
6917
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
6780
6918
|
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) {
|
|
6781
6919
|
this.nextEvents[this.nextTabRole][mmdd][p].documents = docs
|
|
6920
|
+
this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage
|
|
6921
|
+
this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations
|
|
6782
6922
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
6783
6923
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
6784
6924
|
}
|
|
@@ -7070,7 +7210,6 @@ export class SfIEvents extends LitElement {
|
|
|
7070
7210
|
let listReportingContainer = eventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
|
|
7071
7211
|
// console.log('mmddyyyy', this.events[mmdd][j], listReportingContainer, '#list-reporting-container-'+mmdd.replace(/\//g,'-')+'-'+j);
|
|
7072
7212
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
7073
|
-
4
|
|
7074
7213
|
this.renderListReporting(listReportingContainer, this.events[mmdd][j], mmdd + '/' + yyyy, eventsContainer)
|
|
7075
7214
|
} else {
|
|
7076
7215
|
listReportingContainer.innerHTML = '';
|
|
@@ -7098,11 +7237,11 @@ export class SfIEvents extends LitElement {
|
|
|
7098
7237
|
const j = idArr[5];
|
|
7099
7238
|
console.log('review clicked', mmdd, yyyy, j, this.events[mmdd][j], ev.target.checked);
|
|
7100
7239
|
let eventKey = this.events[mmdd][j].entityid + ';' + this.events[mmdd][j].locationid + ';' + this.events[mmdd][j].id;
|
|
7101
|
-
for(var p = 0; p < Object.keys(this.events).length; p++) {
|
|
7240
|
+
for (var p = 0; p < Object.keys(this.events).length; p++) {
|
|
7102
7241
|
let tempMmDd = Object.keys(this.events)[p];
|
|
7103
|
-
for(var q = 0; q < this.events[tempMmDd].length; q++) {
|
|
7242
|
+
for (var q = 0; q < this.events[tempMmDd].length; q++) {
|
|
7104
7243
|
let tempEventKey = this.events[tempMmDd][q].entityid + ';' + this.events[tempMmDd][q].locationid + ';' + this.events[tempMmDd][q].id;
|
|
7105
|
-
if(tempEventKey == eventKey) {
|
|
7244
|
+
if (tempEventKey == eventKey) {
|
|
7106
7245
|
this.events[tempMmDd][q].review = ev.target.innerHTML.indexOf('flag_check') < 0
|
|
7107
7246
|
}
|
|
7108
7247
|
}
|
|
@@ -8391,6 +8530,9 @@ export class SfIEvents extends LitElement {
|
|
|
8391
8530
|
|
|
8392
8531
|
this.csvDataRegisters = '';
|
|
8393
8532
|
let flagUpdateFilters = Object.keys(this.registerFilters).length == 0;
|
|
8533
|
+
html += '<div class="d-flex flex-col align-end">'
|
|
8534
|
+
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>';
|
|
8535
|
+
html += '</div>'
|
|
8394
8536
|
html += '<div class="d-flex scroll-x w-100p">';
|
|
8395
8537
|
|
|
8396
8538
|
for (var i = 0; i < Object.keys(events).length; i++) {
|
|
@@ -8621,6 +8763,10 @@ export class SfIEvents extends LitElement {
|
|
|
8621
8763
|
divRegisterList!.innerHTML = html;
|
|
8622
8764
|
console.log('registerFilters', flagUpdateFilters, this.registerFilters, html.indexOf('input-select-filter-0-0'));
|
|
8623
8765
|
// console.log('csvdataregisters', this.csvDataRegisters);
|
|
8766
|
+
let buttonExportRegister = (this._SfRegisterContainer.querySelector('.calendar-right-data-register') as HTMLDivElement).querySelector('#button-export') as HTMLButtonElement
|
|
8767
|
+
buttonExportRegister?.addEventListener('click', () => {
|
|
8768
|
+
this.exportRegister();
|
|
8769
|
+
})
|
|
8624
8770
|
if (this.selectedRegisterIndex >= 0) {
|
|
8625
8771
|
const divFilterString = (this._SfRegisterContainer.querySelector('.calendar-right-data-register') as HTMLDivElement).querySelector('#filter-string') as HTMLDivElement
|
|
8626
8772
|
let filterString = ""
|
|
@@ -16910,7 +17056,7 @@ export class SfIEvents extends LitElement {
|
|
|
16910
17056
|
this.setSuccess("Renewal successful");
|
|
16911
17057
|
setTimeout(() => {
|
|
16912
17058
|
this.clearMessages()
|
|
16913
|
-
},3000)
|
|
17059
|
+
}, 3000)
|
|
16914
17060
|
} else {
|
|
16915
17061
|
if (xhr.status == 401) {
|
|
16916
17062
|
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
@@ -17141,8 +17287,8 @@ export class SfIEvents extends LitElement {
|
|
|
17141
17287
|
reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
|
|
17142
17288
|
}
|
|
17143
17289
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
|
|
17144
|
-
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues),comparedObj)
|
|
17145
|
-
if(Object.keys(comparedObj).length > 0){
|
|
17290
|
+
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj)
|
|
17291
|
+
if (Object.keys(comparedObj).length > 0) {
|
|
17146
17292
|
await this.sendSuggestions(listEvent.id, comparedObj);
|
|
17147
17293
|
}
|
|
17148
17294
|
// return;
|
|
@@ -17841,12 +17987,12 @@ export class SfIEvents extends LitElement {
|
|
|
17841
17987
|
console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
|
|
17842
17988
|
console.log('previousid', previousId, 'nextid', nextId);
|
|
17843
17989
|
console.log('confighome', Util.getProjectConfigHome())
|
|
17844
|
-
let comments, docs, approved
|
|
17990
|
+
let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
|
|
17845
17991
|
let entityId: string = "";
|
|
17846
17992
|
let locationId: string = "";
|
|
17847
17993
|
let statuteName: string = "";
|
|
17848
17994
|
let reportformatName: string = "";
|
|
17849
|
-
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
17995
|
+
// let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
17850
17996
|
entityId = event.entityid;
|
|
17851
17997
|
locationId = event.locationid;
|
|
17852
17998
|
// let completeness = this.getCompletenessStatus(event);
|
|
@@ -17854,9 +18000,9 @@ export class SfIEvents extends LitElement {
|
|
|
17854
18000
|
docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
|
|
17855
18001
|
approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
|
|
17856
18002
|
// dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
17857
|
-
makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
17858
|
-
docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
17859
|
-
documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
|
|
18003
|
+
// makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
18004
|
+
// docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
18005
|
+
// documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
|
|
17860
18006
|
|
|
17861
18007
|
statuteName = event['statute'][0].trim();
|
|
17862
18008
|
if (event['reportformat'] != null) {
|
|
@@ -18187,7 +18333,7 @@ export class SfIEvents extends LitElement {
|
|
|
18187
18333
|
|
|
18188
18334
|
if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
|
|
18189
18335
|
if (this.mode != "viewer") {
|
|
18190
|
-
html += '<div part="reporting-view-container">'
|
|
18336
|
+
html += '<div part="reporting-view-container" id="reporting-view-container">'
|
|
18191
18337
|
html += this.renderReporting(event, mmddyyyy);
|
|
18192
18338
|
html += "</div>"
|
|
18193
18339
|
}
|
|
@@ -18275,95 +18421,12 @@ export class SfIEvents extends LitElement {
|
|
|
18275
18421
|
|
|
18276
18422
|
(this._SfDetailContainer as HTMLDivElement).innerHTML = html;
|
|
18277
18423
|
(this._SfDetailContainer as HTMLDivElement).style.display = 'block';
|
|
18278
|
-
// let attachmentUploaders = (this._SfDetailContainer as HTMLDivElement).querySelectorAll('.event-attachment') as NodeListOf<SfIUploader>
|
|
18279
|
-
// for(let attachmentUploader of attachmentUploaders){
|
|
18280
|
-
// attachmentUploader.loadMode();
|
|
18281
|
-
// }
|
|
18282
18424
|
if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
|
|
18283
18425
|
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
18284
18426
|
|
|
18285
18427
|
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%">${event.statute[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">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>`;
|
|
18286
18428
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader).emailcontent = emailcontent;
|
|
18287
18429
|
}
|
|
18288
|
-
(this._SfDetailContainer as HTMLDivElement).querySelector('.button-delete')?.addEventListener('click', async () => {
|
|
18289
|
-
|
|
18290
|
-
await this.fetchDeleteReview(event["id"], mmddyyyy, entityId, locationId);
|
|
18291
|
-
this.setSuccess('Deleted successfully!')
|
|
18292
|
-
setTimeout(() => {
|
|
18293
|
-
this.clearMessages()
|
|
18294
|
-
}, 3000);
|
|
18295
|
-
//console.log('deleted', resultDelete);
|
|
18296
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18297
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18298
|
-
// } else {
|
|
18299
|
-
if (currentColumnButton != null) {
|
|
18300
|
-
currentColumnButton.click();
|
|
18301
|
-
}
|
|
18302
|
-
// }
|
|
18303
|
-
|
|
18304
|
-
var clickEvent = new MouseEvent("click", {
|
|
18305
|
-
"view": window,
|
|
18306
|
-
"bubbles": true,
|
|
18307
|
-
"cancelable": false
|
|
18308
|
-
});
|
|
18309
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18310
|
-
|
|
18311
|
-
});
|
|
18312
|
-
(this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
|
|
18313
|
-
if (this.selectedItemIds.length <= 1) {
|
|
18314
|
-
await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
18315
|
-
this.setSuccess('Auto-Approved successfully!')
|
|
18316
|
-
setTimeout(() => {
|
|
18317
|
-
this.clearMessages()
|
|
18318
|
-
}, 3000);
|
|
18319
|
-
} else {
|
|
18320
|
-
let bulkBodyReview = []
|
|
18321
|
-
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
18322
|
-
|
|
18323
|
-
const selectedId = this.selectedItemIds[k];
|
|
18324
|
-
//console.log('selectedid', selectedId);
|
|
18325
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18326
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18327
|
-
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18328
|
-
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18329
|
-
|
|
18330
|
-
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
18331
|
-
let yearStr = this.getFinancialYear(mmddyyyy)
|
|
18332
|
-
bulkBodyReview.push({
|
|
18333
|
-
"mmddyyyy": mmddyyyy,
|
|
18334
|
-
"projectid": this.projectId,
|
|
18335
|
-
"type": "review",
|
|
18336
|
-
"eventid": eventId,
|
|
18337
|
-
"comments": "Auto approved",
|
|
18338
|
-
"approved": true,
|
|
18339
|
-
"entityid": entityId,
|
|
18340
|
-
"locationid": locationId,
|
|
18341
|
-
"username": this.userName,
|
|
18342
|
-
"userid": this.userProfileId,
|
|
18343
|
-
"userrole": this.myRole,
|
|
18344
|
-
"year": yearStr,
|
|
18345
|
-
"module": event.module ?? "compliance"
|
|
18346
|
-
})
|
|
18347
|
-
}
|
|
18348
|
-
await this.uploadReviewsBulk(bulkBodyReview);
|
|
18349
|
-
}
|
|
18350
|
-
//console.log('deleted', resultDelete);
|
|
18351
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18352
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18353
|
-
// } else {
|
|
18354
|
-
if (currentColumnButton != null) {
|
|
18355
|
-
currentColumnButton.click();
|
|
18356
|
-
}
|
|
18357
|
-
// }
|
|
18358
|
-
|
|
18359
|
-
var clickEvent = new MouseEvent("click", {
|
|
18360
|
-
"view": window,
|
|
18361
|
-
"bubbles": true,
|
|
18362
|
-
"cancelable": false
|
|
18363
|
-
});
|
|
18364
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18365
|
-
|
|
18366
|
-
});
|
|
18367
18430
|
|
|
18368
18431
|
(this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close')?.addEventListener('click', () => {
|
|
18369
18432
|
|
|
@@ -18601,101 +18664,304 @@ export class SfIEvents extends LitElement {
|
|
|
18601
18664
|
})
|
|
18602
18665
|
|
|
18603
18666
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
18604
|
-
let
|
|
18605
|
-
|
|
18667
|
+
let eventDetailReportingContainer = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-view-container') as HTMLDivElement
|
|
18668
|
+
if (eventDetailReportingContainer != null) {
|
|
18669
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, (this._SfDetailContainer as HTMLDivElement))
|
|
18670
|
+
}
|
|
18671
|
+
}
|
|
18672
|
+
|
|
18673
|
+
this.fetchStatuteDefinitionDetails(statuteName);
|
|
18674
|
+
console.log('customreporting', event['customreporting'])
|
|
18675
|
+
if (event['customreporting'] != null) {
|
|
18676
|
+
let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
|
|
18677
|
+
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
18678
|
+
reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
|
|
18679
|
+
console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
|
|
18680
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
|
|
18681
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
|
|
18682
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
|
|
18683
|
+
// if(reportformatvalues != ""){
|
|
18684
|
+
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
18685
|
+
// }
|
|
18686
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
|
|
18687
|
+
}
|
|
18688
|
+
} else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
18689
|
+
this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
18690
|
+
}
|
|
18691
|
+
}
|
|
18692
|
+
|
|
18693
|
+
renderEventDetailReporting = (eventDetailReportingContainer: HTMLDivElement, event: any, mmddyyyy: any, eventDetailContainer: HTMLDivElement) => {
|
|
18694
|
+
console.log('detailreporting event', event, this.graphFilter);
|
|
18695
|
+
let html = ''
|
|
18696
|
+
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18697
|
+
|
|
18698
|
+
let reportformatName: string = '';
|
|
18699
|
+
if (event['reportformat'] != null) {
|
|
18700
|
+
reportformatName = (event['reportformat'][0] ?? "").trim().replace('&', '&');
|
|
18701
|
+
}
|
|
18702
|
+
let docs = event['documents'] == null ? [] : event['documents'];
|
|
18703
|
+
event.approved = event['approved'] == null ? false : event['approved'];
|
|
18704
|
+
event.dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
18705
|
+
event.makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
18706
|
+
event.docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
18707
|
+
html = this.renderReporting(event, mmddyyyy);
|
|
18708
|
+
console.log('reporting html', html);
|
|
18709
|
+
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
18710
|
+
|
|
18711
|
+
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%">${(event.statute[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">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>`;
|
|
18712
|
+
eventDetailReportingContainer.innerHTML = html;
|
|
18713
|
+
if (this._SfUploader[0] != null) {
|
|
18714
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.emailcontent = emailcontent;
|
|
18715
|
+
}
|
|
18716
|
+
eventDetailReportingContainer.querySelector('.button-delete')?.addEventListener('click', async () => {
|
|
18717
|
+
|
|
18718
|
+
await this.fetchDeleteReview(event["id"], mmddyyyy, event.entityid, event.locationid);
|
|
18719
|
+
this.setSuccess('Deleted successfully!')
|
|
18720
|
+
setTimeout(() => {
|
|
18721
|
+
this.clearMessages()
|
|
18722
|
+
}, 3000);
|
|
18723
|
+
//console.log('deleted', resultDelete);
|
|
18724
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18725
|
+
this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18726
|
+
} else {
|
|
18727
|
+
// if(currentColumnButton != null) {
|
|
18728
|
+
// currentColumnButton.click();
|
|
18729
|
+
// }
|
|
18730
|
+
}
|
|
18731
|
+
|
|
18732
|
+
});
|
|
18733
|
+
eventDetailReportingContainer.querySelector('#button-auto-approve')?.addEventListener('click', async () => {
|
|
18734
|
+
if (this.selectedItemIds.length <= 1) {
|
|
18735
|
+
await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
18736
|
+
this.setSuccess('Auto-Approved successfully!')
|
|
18737
|
+
setTimeout(() => {
|
|
18738
|
+
this.clearMessages()
|
|
18739
|
+
}, 3000);
|
|
18740
|
+
} else {
|
|
18741
|
+
let bulkBodyReview = []
|
|
18742
|
+
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
18743
|
+
|
|
18744
|
+
const selectedId = this.selectedItemIds[k];
|
|
18745
|
+
//console.log('selectedid', selectedId);
|
|
18746
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18747
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18748
|
+
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18749
|
+
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18750
|
+
|
|
18751
|
+
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
18752
|
+
let yearStr = this.getFinancialYear(mmddyyyy)
|
|
18753
|
+
bulkBodyReview.push({
|
|
18754
|
+
"mmddyyyy": mmddyyyy,
|
|
18755
|
+
"projectid": this.projectId,
|
|
18756
|
+
"type": "review",
|
|
18757
|
+
"eventid": eventId,
|
|
18758
|
+
"comments": "Auto approved",
|
|
18759
|
+
"approved": true,
|
|
18760
|
+
"entityid": entityId,
|
|
18761
|
+
"locationid": locationId,
|
|
18762
|
+
"username": this.userName,
|
|
18763
|
+
"userid": this.userProfileId,
|
|
18764
|
+
"userrole": this.myRole,
|
|
18765
|
+
"year": yearStr,
|
|
18766
|
+
"module": event.module ?? "compliance"
|
|
18767
|
+
})
|
|
18768
|
+
}
|
|
18769
|
+
await this.uploadReviewsBulk(bulkBodyReview);
|
|
18770
|
+
}
|
|
18771
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18772
|
+
this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18773
|
+
} else {
|
|
18774
|
+
// if(currentColumnButton != null) {
|
|
18775
|
+
// currentColumnButton.click();
|
|
18776
|
+
// }
|
|
18777
|
+
}
|
|
18606
18778
|
|
|
18779
|
+
});
|
|
18780
|
+
eventDetailReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
|
|
18781
|
+
console.log('upload guidance clicked', event);
|
|
18782
|
+
let inputReportingPercentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
|
|
18783
|
+
let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
18784
|
+
let selectReportedLocationValue = "[]";
|
|
18785
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
18786
|
+
selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value])
|
|
18787
|
+
}
|
|
18788
|
+
let approvercomments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
|
|
18789
|
+
let reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
|
|
18790
|
+
let dateOfCompletion;
|
|
18791
|
+
if ((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement) != null) {
|
|
18792
|
+
dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "";
|
|
18793
|
+
} else {
|
|
18794
|
+
dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-approver-doc') as HTMLInputElement).value).getTime() + "";
|
|
18795
|
+
}
|
|
18796
|
+
let documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader).selectedValues()
|
|
18797
|
+
if (dateOfCompletion == "NaN") {
|
|
18798
|
+
dateOfCompletion = "";
|
|
18799
|
+
}
|
|
18800
|
+
console.log('dateOfCompletion', dateOfCompletion)
|
|
18801
|
+
await this.fetchEventDetails(event, mmddyyyy, null, eventDetailContainer, "", "", true, eventDetailReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
|
|
18802
|
+
})
|
|
18803
|
+
if (this.mode == "consumer" || this.mode == "next") {
|
|
18804
|
+
let inputReportingPercentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
|
|
18805
|
+
let percentage = inputReportingPercentage.value
|
|
18806
|
+
const entityContainers = eventDetailReportingContainer.querySelectorAll('.reporting-entity-container') as NodeListOf<HTMLDivElement>;
|
|
18807
|
+
const locationsContainers = eventDetailReportingContainer.querySelectorAll('.reporting-location-container') as NodeListOf<HTMLDivElement>;
|
|
18808
|
+
const addLocationButtons = eventDetailReportingContainer.querySelectorAll('.button-reporter-location-add') as NodeListOf<HTMLButtonElement>;
|
|
18607
18809
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
18608
|
-
|
|
18609
|
-
|
|
18810
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
18811
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
18812
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
18610
18813
|
} else {
|
|
18611
|
-
|
|
18612
|
-
|
|
18814
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
18815
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
18816
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
18613
18817
|
}
|
|
18614
18818
|
inputReportingPercentage?.addEventListener('change', () => {
|
|
18615
18819
|
setTimeout(() => {
|
|
18616
18820
|
let percentage = inputReportingPercentage.value
|
|
18617
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
18821
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
18618
18822
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
18619
|
-
|
|
18620
|
-
|
|
18823
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
18824
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
18825
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
18621
18826
|
} else {
|
|
18622
|
-
|
|
18623
|
-
|
|
18827
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
18828
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
18829
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
18624
18830
|
}
|
|
18625
|
-
if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
|
|
18626
|
-
(
|
|
18831
|
+
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
18832
|
+
(eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
|
|
18627
18833
|
} else {
|
|
18628
|
-
(
|
|
18834
|
+
(eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
|
|
18835
|
+
}
|
|
18836
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
|
|
18837
|
+
event.percentage = percentage
|
|
18838
|
+
event.reportedlocations = JSON.stringify([""])
|
|
18839
|
+
event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
18840
|
+
event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
18841
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
18842
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
18843
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
18629
18844
|
}
|
|
18630
18845
|
}, 200);
|
|
18631
18846
|
})
|
|
18632
|
-
let selectReportingEntity = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-entity') as HTMLSelectElement;
|
|
18633
|
-
let selectReportingLocation = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-location') as HTMLSelectElement;
|
|
18634
|
-
selectReportingEntity.innerHTML = '';
|
|
18635
18847
|
let projectUserMap = Util.getProjectUsermap()
|
|
18636
|
-
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18641
|
-
|
|
18642
|
-
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18647
|
-
|
|
18848
|
+
addLocationButtons.forEach((addLocationBtn) => {
|
|
18849
|
+
addLocationBtn.addEventListener('click', () => {
|
|
18850
|
+
let iconhtml = addLocationBtn.innerHTML
|
|
18851
|
+
let index = parseInt(addLocationBtn.id.split('-')[4])
|
|
18852
|
+
console.log('button clicked', iconhtml, addLocationBtn.id);
|
|
18853
|
+
if (iconhtml == "add") {
|
|
18854
|
+
console.log('this.reportedLocationsVals', this.reportedLocationsVals)
|
|
18855
|
+
this.reportedLocationsVals.push("");
|
|
18856
|
+
} else {
|
|
18857
|
+
this.reportedLocationsVals.splice(index, 1);
|
|
18858
|
+
}
|
|
18859
|
+
event.percentage = inputReportingPercentage.value;
|
|
18860
|
+
event.reportedlocations = JSON.stringify(this.reportedLocationsVals)
|
|
18861
|
+
if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
|
|
18862
|
+
event.percentage = "100";
|
|
18863
|
+
}
|
|
18864
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
18865
|
+
event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
18866
|
+
event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
18867
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
18868
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
18869
|
+
})
|
|
18870
|
+
})
|
|
18871
|
+
|
|
18872
|
+
for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
|
|
18873
|
+
console.log('AddingEntities', indexRepLoc)
|
|
18874
|
+
let selectReportingEntity = eventDetailReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc) as HTMLSelectElement;
|
|
18875
|
+
let selectReportingLocation = eventDetailReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc) as HTMLSelectElement;
|
|
18876
|
+
selectReportingEntity.innerHTML = '';
|
|
18648
18877
|
for (let country of Object.keys(projectUserMap)) {
|
|
18649
18878
|
if (country == "roles") {
|
|
18650
18879
|
continue;
|
|
18651
18880
|
}
|
|
18652
18881
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18653
|
-
|
|
18882
|
+
let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18883
|
+
let option = new Option(entityName, entity)
|
|
18884
|
+
selectReportingEntity.add(option);
|
|
18885
|
+
}
|
|
18886
|
+
}
|
|
18887
|
+
selectReportingEntity.addEventListener('change', (e: any) => {
|
|
18888
|
+
selectReportingLocation.innerHTML = ''
|
|
18889
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18890
|
+
if (country == "roles") {
|
|
18654
18891
|
continue;
|
|
18655
18892
|
}
|
|
18656
|
-
for (let
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18893
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18894
|
+
if (entity.indexOf(e.target.value) < 0) {
|
|
18895
|
+
continue;
|
|
18896
|
+
}
|
|
18897
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18898
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18899
|
+
let option = new Option(locationName, location)
|
|
18900
|
+
selectReportingLocation.add(option);
|
|
18901
|
+
}
|
|
18660
18902
|
}
|
|
18661
18903
|
}
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
selectReportingEntity.value = entity;
|
|
18677
|
-
const changeEvent = new Event('change', { bubbles: true });
|
|
18678
|
-
selectReportingEntity.dispatchEvent(changeEvent)
|
|
18679
|
-
selectReportingLocation.value = location;
|
|
18680
|
-
flagSetVal = true;
|
|
18904
|
+
(eventDetailReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc) as HTMLDivElement).classList.remove('hide')
|
|
18905
|
+
selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
|
|
18906
|
+
})
|
|
18907
|
+
|
|
18908
|
+
if (selectReportingLocation.innerHTML == '') {
|
|
18909
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18910
|
+
if (country == "roles") {
|
|
18911
|
+
continue;
|
|
18912
|
+
}
|
|
18913
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18914
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18915
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18916
|
+
let option = new Option(locationName, location)
|
|
18917
|
+
selectReportingLocation.add(option);
|
|
18681
18918
|
break;
|
|
18682
18919
|
}
|
|
18683
|
-
}
|
|
18684
|
-
if (flagSetVal) {
|
|
18685
18920
|
break;
|
|
18686
18921
|
}
|
|
18922
|
+
break;
|
|
18687
18923
|
}
|
|
18688
18924
|
}
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18925
|
+
selectReportingLocation.addEventListener('change', (e: any) => {
|
|
18926
|
+
let index = parseInt(e.target.id.split('-')[3])
|
|
18927
|
+
this.reportedLocationsVals[index] = e.target.value
|
|
18928
|
+
})
|
|
18929
|
+
if (event.reportedlocations != null && event.reportedlocations.length > 0) {
|
|
18930
|
+
console.log('setting reportedlocations', event.reportedlocations)
|
|
18931
|
+
let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations
|
|
18932
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18933
|
+
if (country == "roles") {
|
|
18934
|
+
continue;
|
|
18935
|
+
}
|
|
18936
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18937
|
+
let flagSetVal = false;
|
|
18938
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18939
|
+
if (tempReportedLocation.indexOf(location) >= 0) {
|
|
18940
|
+
selectReportingEntity.value = entity;
|
|
18941
|
+
const changeEvent = new Event('change', { bubbles: true });
|
|
18942
|
+
selectReportingEntity.dispatchEvent(changeEvent)
|
|
18943
|
+
selectReportingLocation.value = location;
|
|
18944
|
+
flagSetVal = true;
|
|
18945
|
+
break;
|
|
18946
|
+
}
|
|
18947
|
+
}
|
|
18948
|
+
if (flagSetVal) {
|
|
18949
|
+
break;
|
|
18950
|
+
}
|
|
18951
|
+
}
|
|
18952
|
+
}
|
|
18953
|
+
} else {
|
|
18954
|
+
selectReportingEntity.value = "";
|
|
18955
|
+
selectReportingLocation.value = "";
|
|
18956
|
+
}
|
|
18692
18957
|
}
|
|
18693
18958
|
|
|
18694
|
-
|
|
18959
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
|
|
18695
18960
|
let buttonClick = ev.target as HTMLButtonElement
|
|
18696
18961
|
buttonClick.innerHTML = "Saving..."
|
|
18697
|
-
const comments = (
|
|
18698
|
-
|
|
18962
|
+
const comments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement).value;
|
|
18963
|
+
console.log('comments', comments, JSON.stringify(event.comments))
|
|
18964
|
+
const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
|
|
18699
18965
|
let currStatus = this.getCompletenessStatus(event);
|
|
18700
18966
|
let newEvent = { ...event };
|
|
18701
18967
|
newEvent.comments = comments;
|
|
@@ -18709,24 +18975,19 @@ export class SfIEvents extends LitElement {
|
|
|
18709
18975
|
}, 3000);
|
|
18710
18976
|
return;
|
|
18711
18977
|
}
|
|
18712
|
-
var clickEvent = new MouseEvent("click", {
|
|
18713
|
-
"view": window,
|
|
18714
|
-
"bubbles": true,
|
|
18715
|
-
"cancelable": false
|
|
18716
|
-
});
|
|
18717
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18718
|
-
|
|
18719
|
-
// await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
|
|
18720
18978
|
let flagBulk = false;
|
|
18721
18979
|
if (this.selectedItemIds.length <= 1) {
|
|
18722
|
-
|
|
18723
|
-
if (await this.uploadReview(
|
|
18980
|
+
console.log('selectedevent', JSON.stringify(event));
|
|
18981
|
+
if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
|
|
18724
18982
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18725
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
18726
|
-
|
|
18983
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
18727
18984
|
this.events[mmdd][p].approved = approved
|
|
18985
|
+
console.log('selected event', this.events[mmdd][p]);
|
|
18728
18986
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
18729
18987
|
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
18988
|
+
if (approved) {
|
|
18989
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
|
|
18990
|
+
}
|
|
18730
18991
|
}
|
|
18731
18992
|
}
|
|
18732
18993
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -18740,8 +19001,8 @@ export class SfIEvents extends LitElement {
|
|
|
18740
19001
|
|
|
18741
19002
|
const selectedId = this.selectedItemIds[k];
|
|
18742
19003
|
//console.log('selectedid', selectedId);
|
|
18743
|
-
|
|
18744
|
-
|
|
19004
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19005
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18745
19006
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18746
19007
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18747
19008
|
|
|
@@ -18754,8 +19015,8 @@ export class SfIEvents extends LitElement {
|
|
|
18754
19015
|
"eventid": eventId,
|
|
18755
19016
|
"comments": comments,
|
|
18756
19017
|
"approved": approved,
|
|
18757
|
-
"entityid":
|
|
18758
|
-
"locationid":
|
|
19018
|
+
"entityid": entityid,
|
|
19019
|
+
"locationid": locationid,
|
|
18759
19020
|
"username": this.userName,
|
|
18760
19021
|
"userid": this.userProfileId,
|
|
18761
19022
|
"userrole": this.myRole,
|
|
@@ -18775,17 +19036,16 @@ export class SfIEvents extends LitElement {
|
|
|
18775
19036
|
|
|
18776
19037
|
const selectedId = this.selectedItemIds[k];
|
|
18777
19038
|
//console.log('selectedid', selectedId);
|
|
18778
|
-
|
|
18779
|
-
|
|
19039
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19040
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18780
19041
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18781
19042
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18782
19043
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18783
19044
|
if (this.mode == "next") {
|
|
18784
19045
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
18785
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
18786
|
-
|
|
18787
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19046
|
+
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) {
|
|
18788
19047
|
flagBulk = true;
|
|
19048
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18789
19049
|
if (this.recentlyReported[mmdd] == null) {
|
|
18790
19050
|
this.recentlyReported[mmdd] = []
|
|
18791
19051
|
}
|
|
@@ -18794,10 +19054,10 @@ export class SfIEvents extends LitElement {
|
|
|
18794
19054
|
}
|
|
18795
19055
|
} else {
|
|
18796
19056
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18797
|
-
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid ==
|
|
19057
|
+
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
|
|
18798
19058
|
|
|
18799
19059
|
this.events[mmdd][p].isbulk = true
|
|
18800
|
-
flagBulk = true
|
|
19060
|
+
flagBulk = true
|
|
18801
19061
|
if (this.recentlyReported[mmdd] == null) {
|
|
18802
19062
|
this.recentlyReported[mmdd] = []
|
|
18803
19063
|
}
|
|
@@ -18811,7 +19071,7 @@ export class SfIEvents extends LitElement {
|
|
|
18811
19071
|
if (this.mode == "next") {
|
|
18812
19072
|
// this.fetchNext(this.nextPage)
|
|
18813
19073
|
// this.renderRoleTabsNext(this.nextPage)
|
|
18814
|
-
this.renderNextEvents(this.nextEvents, this.nextPage, this.
|
|
19074
|
+
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
|
|
18815
19075
|
} else {
|
|
18816
19076
|
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18817
19077
|
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
@@ -18823,41 +19083,19 @@ export class SfIEvents extends LitElement {
|
|
|
18823
19083
|
if (this.selectedItemIds.length > 0) {
|
|
18824
19084
|
await this.fetchBulkReportingData();
|
|
18825
19085
|
}
|
|
19086
|
+
console.log('events', this.events);
|
|
18826
19087
|
this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
|
|
18827
|
-
var clickEvent = new MouseEvent("click", {
|
|
18828
|
-
"view": window,
|
|
18829
|
-
"bubbles": true,
|
|
18830
|
-
"cancelable": false
|
|
18831
|
-
});
|
|
18832
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)?.dispatchEvent(clickEvent);
|
|
18833
|
-
|
|
18834
|
-
// if(currentColumnButton != null) {
|
|
18835
|
-
// currentColumnButton.click();
|
|
18836
|
-
// }
|
|
18837
19088
|
}
|
|
18838
19089
|
}
|
|
18839
19090
|
|
|
18840
19091
|
});
|
|
18841
19092
|
|
|
18842
|
-
|
|
19093
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
|
|
18843
19094
|
let buttonClick = ev.target as HTMLButtonElement
|
|
18844
19095
|
buttonClick.innerHTML = "Saving..."
|
|
18845
|
-
const comments
|
|
18846
|
-
const approved = (
|
|
18847
|
-
|
|
18848
|
-
let newEvent = { ...event };
|
|
18849
|
-
newEvent.comments = comments;
|
|
18850
|
-
newEvent.approved = approved;
|
|
18851
|
-
let newStatus = this.getCompletenessStatus(newEvent);
|
|
18852
|
-
console.log('status', currStatus, newStatus)
|
|
18853
|
-
if (currStatus == newStatus) {
|
|
18854
|
-
buttonClick.innerHTML = "Save"
|
|
18855
|
-
this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
|
|
18856
|
-
setTimeout(() => {
|
|
18857
|
-
this.clearMessages();
|
|
18858
|
-
}, 3000);
|
|
18859
|
-
return;
|
|
18860
|
-
}
|
|
19096
|
+
const comments = (eventDetailReportingContainer.querySelector('#input-auditor-comments') as HTMLInputElement).value;
|
|
19097
|
+
const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
|
|
19098
|
+
|
|
18861
19099
|
if (comments.trim().length === 0) {
|
|
18862
19100
|
buttonClick.innerHTML = "Save"
|
|
18863
19101
|
this.setError('Comments cannot be blank!');
|
|
@@ -18868,22 +19106,14 @@ export class SfIEvents extends LitElement {
|
|
|
18868
19106
|
} else {
|
|
18869
19107
|
let flagBulk = false;
|
|
18870
19108
|
if (this.selectedItemIds.length <= 1) {
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
this.
|
|
18879
|
-
}
|
|
18880
|
-
}
|
|
18881
|
-
} else {
|
|
18882
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18883
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
18884
|
-
this.events[mmdd][p].approved = approved
|
|
18885
|
-
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
18886
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19109
|
+
if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
|
|
19110
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19111
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19112
|
+
this.events[mmdd][p].approved = approved
|
|
19113
|
+
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
19114
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19115
|
+
if (approved) {
|
|
19116
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
|
|
18887
19117
|
}
|
|
18888
19118
|
}
|
|
18889
19119
|
}
|
|
@@ -18899,8 +19129,8 @@ export class SfIEvents extends LitElement {
|
|
|
18899
19129
|
const selectedId = this.selectedItemIds[k];
|
|
18900
19130
|
//console.log('selectedid', selectedId);
|
|
18901
19131
|
|
|
18902
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18903
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19132
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19133
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18904
19134
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18905
19135
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18906
19136
|
|
|
@@ -18929,21 +19159,20 @@ export class SfIEvents extends LitElement {
|
|
|
18929
19159
|
|
|
18930
19160
|
const selectedId = this.selectedItemIds[k];
|
|
18931
19161
|
//console.log('selectedid', selectedId);
|
|
18932
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18933
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19162
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19163
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18934
19164
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18935
19165
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18936
19166
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18937
19167
|
if (this.mode == "next") {
|
|
18938
19168
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
18939
19169
|
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) {
|
|
18940
|
-
|
|
18941
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18942
19170
|
flagBulk = true;
|
|
19171
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18943
19172
|
if (this.recentlyReported[mmdd] == null) {
|
|
18944
19173
|
this.recentlyReported[mmdd] = []
|
|
18945
19174
|
}
|
|
18946
|
-
this.recentlyReported[mmdd].push(this.
|
|
19175
|
+
this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p])
|
|
18947
19176
|
}
|
|
18948
19177
|
}
|
|
18949
19178
|
} else {
|
|
@@ -18960,15 +19189,7 @@ export class SfIEvents extends LitElement {
|
|
|
18960
19189
|
}
|
|
18961
19190
|
}
|
|
18962
19191
|
}
|
|
18963
|
-
|
|
18964
19192
|
}
|
|
18965
|
-
|
|
18966
|
-
var clickEvent = new MouseEvent("click", {
|
|
18967
|
-
"view": window,
|
|
18968
|
-
"bubbles": true,
|
|
18969
|
-
"cancelable": false
|
|
18970
|
-
});
|
|
18971
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18972
19193
|
if (this.mode == "next") {
|
|
18973
19194
|
// this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
|
|
18974
19195
|
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
|
|
@@ -18997,42 +19218,42 @@ export class SfIEvents extends LitElement {
|
|
|
18997
19218
|
});
|
|
18998
19219
|
|
|
18999
19220
|
if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
19221
|
+
if (event.approved) {
|
|
19000
19222
|
|
|
19001
|
-
|
|
19002
|
-
|
|
19003
|
-
if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
19004
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
|
|
19223
|
+
if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
19224
|
+
(eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
|
|
19005
19225
|
}
|
|
19006
19226
|
|
|
19007
19227
|
|
|
19008
19228
|
} else {
|
|
19009
19229
|
|
|
19010
|
-
if ((
|
|
19230
|
+
if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
19011
19231
|
|
|
19012
19232
|
|
|
19013
|
-
(
|
|
19233
|
+
(eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
|
|
19014
19234
|
|
|
19015
|
-
|
|
19235
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev: any) => {
|
|
19016
19236
|
let buttonClick = ev.target as HTMLButtonElement
|
|
19017
19237
|
buttonClick.innerHTML = "Saving..."
|
|
19018
|
-
const reportercomments = (
|
|
19238
|
+
const reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
19019
19239
|
|
|
19020
19240
|
//console.log('reporter comments 1', reportercomments);
|
|
19021
19241
|
|
|
19022
|
-
const reporterdoc = (
|
|
19242
|
+
const reporterdoc = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
19023
19243
|
let docs: any[] = [];
|
|
19024
19244
|
|
|
19025
19245
|
//console.log('reporter comments 2', reportercomments);
|
|
19246
|
+
|
|
19247
|
+
// if(docsOptional.length === 0) {
|
|
19026
19248
|
let percentage: string = "100";
|
|
19027
|
-
if ((
|
|
19028
|
-
percentage = (
|
|
19249
|
+
if ((eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement) != null) {
|
|
19250
|
+
percentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value
|
|
19029
19251
|
}
|
|
19030
|
-
// if(docsOptional.length === 0) {
|
|
19031
19252
|
docs = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
19032
19253
|
// }
|
|
19033
19254
|
let flag = false;
|
|
19034
19255
|
do {
|
|
19035
|
-
if (docs.length > 0 && docsOptional != null && docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19256
|
+
if (docs.length > 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19036
19257
|
for (let doc of docs) {
|
|
19037
19258
|
if ((doc.jobId == null || doc.jobId.length === 0) && (doc.ext.toLowerCase() == 'pdf' || doc.ext.toLowerCase() == 'png' || doc.ext.toLowerCase() == 'jpeg' || doc.ext.toLowerCase() == 'jpg')) {
|
|
19038
19259
|
flag = false
|
|
@@ -19057,7 +19278,7 @@ export class SfIEvents extends LitElement {
|
|
|
19057
19278
|
reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
|
|
19058
19279
|
}
|
|
19059
19280
|
|
|
19060
|
-
|
|
19281
|
+
console.log('percentage', percentage, (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value);
|
|
19061
19282
|
if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
|
|
19062
19283
|
|
|
19063
19284
|
//console.log('reporter comments 3', reportercomments);
|
|
@@ -19068,7 +19289,7 @@ export class SfIEvents extends LitElement {
|
|
|
19068
19289
|
}, 3000);
|
|
19069
19290
|
|
|
19070
19291
|
} else {
|
|
19071
|
-
if (docs.length
|
|
19292
|
+
if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19072
19293
|
|
|
19073
19294
|
//console.log('reporter comments 3', reportercomments);
|
|
19074
19295
|
buttonClick.innerHTML = "Save"
|
|
@@ -19107,68 +19328,76 @@ export class SfIEvents extends LitElement {
|
|
|
19107
19328
|
}, 3000);
|
|
19108
19329
|
|
|
19109
19330
|
} else {
|
|
19331
|
+
let flagBulk = false;
|
|
19332
|
+
// let reportedlocations = selectReportingLocation?.value ?? "";
|
|
19333
|
+
let reportedlocations = "[]";
|
|
19334
|
+
if (parseInt(percentage) !== 100) {
|
|
19335
|
+
let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
19336
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
19337
|
+
reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value])
|
|
19338
|
+
}
|
|
19339
|
+
}
|
|
19340
|
+
if (this.selectedItemIds.length <= 1) {
|
|
19110
19341
|
|
|
19342
|
+
if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, event.makercheckers, reportedlocations)) {
|
|
19111
19343
|
|
|
19112
|
-
|
|
19113
|
-
|
|
19114
|
-
|
|
19115
|
-
|
|
19116
|
-
|
|
19344
|
+
if (this.mode != "next") {
|
|
19345
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19346
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19347
|
+
this.events[mmdd][p].documents = docs
|
|
19348
|
+
this.events[mmdd][p].percentage = percentage
|
|
19349
|
+
this.events[mmdd][p].reportedlocations = reportedlocations
|
|
19350
|
+
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19351
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19352
|
+
}
|
|
19353
|
+
}
|
|
19117
19354
|
|
|
19118
|
-
|
|
19119
|
-
let flagBulk = false;
|
|
19120
|
-
let reportinglocation = selectReportingLocation.value;
|
|
19121
|
-
if (this.selectedItemIds.length <= 1) {
|
|
19355
|
+
if (event.makercheckers.length > 0) {
|
|
19122
19356
|
|
|
19123
|
-
|
|
19124
|
-
|
|
19125
|
-
|
|
19126
|
-
|
|
19127
|
-
|
|
19357
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
19358
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19359
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19360
|
+
this.events[mmdd][p].approved = true
|
|
19361
|
+
// this.events[mmdd][p].documents = docs
|
|
19362
|
+
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19363
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19364
|
+
}
|
|
19365
|
+
}
|
|
19366
|
+
}
|
|
19367
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
19368
|
+
this.recentlyReported[mmdd] = []
|
|
19369
|
+
}
|
|
19370
|
+
this.recentlyReported[mmdd].push(event)
|
|
19371
|
+
console.log('recently reported', this.recentlyReported)
|
|
19372
|
+
} else {
|
|
19128
19373
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19129
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
19374
|
+
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) {
|
|
19130
19375
|
this.nextEvents[this.nextTabRole][mmdd][p].documents = docs
|
|
19376
|
+
this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage
|
|
19377
|
+
this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations
|
|
19131
19378
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19132
19379
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
19133
19380
|
}
|
|
19134
19381
|
}
|
|
19135
|
-
} else {
|
|
19136
|
-
console.log('this.events', this.events);
|
|
19137
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19138
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19139
|
-
this.events[mmdd][p].documents = docs
|
|
19140
|
-
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19141
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19142
|
-
}
|
|
19143
|
-
}
|
|
19144
|
-
}
|
|
19145
|
-
if (makercheckers.length > 0) {
|
|
19146
19382
|
|
|
19147
|
-
|
|
19148
|
-
|
|
19383
|
+
if (event.makercheckers.length > 0) {
|
|
19384
|
+
|
|
19385
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
19149
19386
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19150
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
19387
|
+
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) {
|
|
19151
19388
|
this.nextEvents[this.nextTabRole][mmdd][p].approved = true
|
|
19152
19389
|
// this.events[mmdd][p].documents = docs
|
|
19153
19390
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19154
19391
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
19155
19392
|
}
|
|
19156
19393
|
}
|
|
19157
|
-
} else {
|
|
19158
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19159
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19160
|
-
this.events[mmdd][p].approved = true
|
|
19161
|
-
// this.events[mmdd][p].documents = docs
|
|
19162
|
-
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19163
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19164
|
-
}
|
|
19165
|
-
}
|
|
19166
19394
|
}
|
|
19395
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
19396
|
+
this.recentlyReported[mmdd] = []
|
|
19397
|
+
}
|
|
19398
|
+
this.recentlyReported[mmdd].push(event)
|
|
19399
|
+
console.log('recently reported', this.recentlyReported)
|
|
19167
19400
|
}
|
|
19168
|
-
if (this.recentlyReported[mmdd] == null) {
|
|
19169
|
-
this.recentlyReported[mmdd] = []
|
|
19170
|
-
}
|
|
19171
|
-
this.recentlyReported[mmdd].push(event)
|
|
19172
19401
|
}
|
|
19173
19402
|
} else {
|
|
19174
19403
|
let bulkBody = []
|
|
@@ -19179,31 +19408,13 @@ export class SfIEvents extends LitElement {
|
|
|
19179
19408
|
//console.log('selectedid', selectedId);
|
|
19180
19409
|
|
|
19181
19410
|
const makercheckersL = selectedId.split('-')[5];
|
|
19182
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19183
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19411
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19412
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19184
19413
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
19185
19414
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
19186
19415
|
|
|
19187
19416
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
19188
|
-
|
|
19189
|
-
// "mmddyyyy": mmddyyyy,
|
|
19190
|
-
// "projectid": this.projectId,
|
|
19191
|
-
// "type": "report",
|
|
19192
|
-
// "eventid": eventId,
|
|
19193
|
-
// "comments": reportercomments,
|
|
19194
|
-
// "dateofcompletion": reporterdoc,
|
|
19195
|
-
// "entityid": entityId,
|
|
19196
|
-
// "locationid": locationId,
|
|
19197
|
-
// "event": null,
|
|
19198
|
-
// "docs": JSON.stringify(docs),
|
|
19199
|
-
// "username": this.userName,
|
|
19200
|
-
// "reportformatvalues": reportformatvalues,
|
|
19201
|
-
// "reportformatschema": reportformatschema,
|
|
19202
|
-
// "userid": this.userProfileId,
|
|
19203
|
-
// "userrole": this.myRole,
|
|
19204
|
-
// "year": this.calendarStartYYYY,
|
|
19205
|
-
// "module": event.module ?? "compliance"
|
|
19206
|
-
// })
|
|
19417
|
+
|
|
19207
19418
|
// await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
|
|
19208
19419
|
// if(parseInt(makercheckersL) > 0) {
|
|
19209
19420
|
// bulkBodyReview.push({
|
|
@@ -19239,7 +19450,7 @@ export class SfIEvents extends LitElement {
|
|
|
19239
19450
|
"comments": reportercomments,
|
|
19240
19451
|
"dateofcompletion": reporterdoc,
|
|
19241
19452
|
"percentage": percentage,
|
|
19242
|
-
"
|
|
19453
|
+
"reportedlocations": reportedlocations,
|
|
19243
19454
|
"entityid": entityId,
|
|
19244
19455
|
"locationid": locationId,
|
|
19245
19456
|
"event": null,
|
|
@@ -19260,11 +19471,13 @@ export class SfIEvents extends LitElement {
|
|
|
19260
19471
|
// this.clearMessages();
|
|
19261
19472
|
|
|
19262
19473
|
}
|
|
19474
|
+
// await this.uploadReportsBulk(bulkBody);
|
|
19263
19475
|
|
|
19476
|
+
// await this.fetchBulkReportingData();
|
|
19264
19477
|
if (bulkBody.length > 0) {
|
|
19265
19478
|
await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
|
|
19266
19479
|
}
|
|
19267
|
-
|
|
19480
|
+
|
|
19268
19481
|
// if(bulkBodyReview.length > 0){
|
|
19269
19482
|
// await this.uploadReportsReviewsBulk(bulkBodyReview)
|
|
19270
19483
|
// }
|
|
@@ -19272,17 +19485,16 @@ export class SfIEvents extends LitElement {
|
|
|
19272
19485
|
|
|
19273
19486
|
const selectedId = this.selectedItemIds[k];
|
|
19274
19487
|
//console.log('selectedid', selectedId);
|
|
19275
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19276
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19488
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19489
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19277
19490
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
19278
19491
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
19279
19492
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
19280
19493
|
if (this.mode == "next") {
|
|
19281
19494
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19282
19495
|
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) {
|
|
19283
|
-
|
|
19284
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19285
19496
|
flagBulk = true;
|
|
19497
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19286
19498
|
if (this.recentlyReported[mmdd] == null) {
|
|
19287
19499
|
this.recentlyReported[mmdd] = []
|
|
19288
19500
|
}
|
|
@@ -19292,9 +19504,8 @@ export class SfIEvents extends LitElement {
|
|
|
19292
19504
|
} else {
|
|
19293
19505
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19294
19506
|
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19295
|
-
|
|
19296
|
-
this.events[mmdd][p].isbulk = true
|
|
19297
19507
|
flagBulk = true;
|
|
19508
|
+
this.events[mmdd][p].isbulk = true
|
|
19298
19509
|
if (this.recentlyReported[mmdd] == null) {
|
|
19299
19510
|
this.recentlyReported[mmdd] = []
|
|
19300
19511
|
}
|
|
@@ -19303,7 +19514,6 @@ export class SfIEvents extends LitElement {
|
|
|
19303
19514
|
}
|
|
19304
19515
|
}
|
|
19305
19516
|
}
|
|
19306
|
-
|
|
19307
19517
|
}
|
|
19308
19518
|
|
|
19309
19519
|
if (this.mode == "next") {
|
|
@@ -19326,10 +19536,7 @@ export class SfIEvents extends LitElement {
|
|
|
19326
19536
|
// }
|
|
19327
19537
|
}
|
|
19328
19538
|
}
|
|
19329
|
-
|
|
19330
19539
|
}
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
19540
|
}
|
|
19334
19541
|
}
|
|
19335
19542
|
}
|
|
@@ -19342,37 +19549,44 @@ export class SfIEvents extends LitElement {
|
|
|
19342
19549
|
}
|
|
19343
19550
|
|
|
19344
19551
|
if (this._SfUploader[0] != null) {
|
|
19345
|
-
(
|
|
19552
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19553
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
|
|
19554
|
+
}
|
|
19346
19555
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev: any) => {
|
|
19347
19556
|
console.log('uploader analysisInProgress', _ev);
|
|
19348
|
-
|
|
19557
|
+
|
|
19558
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19559
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
|
|
19560
|
+
}
|
|
19349
19561
|
});
|
|
19350
19562
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev: any) => {
|
|
19351
19563
|
console.log('uploader analysisInProgress', _ev);
|
|
19352
|
-
if ((
|
|
19353
|
-
(
|
|
19564
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19565
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
|
|
19354
19566
|
}
|
|
19355
19567
|
});
|
|
19356
19568
|
|
|
19357
19569
|
|
|
19358
19570
|
//console.log('documentType checking', documentType);
|
|
19359
19571
|
|
|
19360
|
-
if (documentType != null) {
|
|
19361
|
-
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = documentType;
|
|
19572
|
+
if (event.documentType != null) {
|
|
19573
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = event.documentType;
|
|
19362
19574
|
} else {
|
|
19363
|
-
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = ""
|
|
19575
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = "";
|
|
19364
19576
|
}
|
|
19365
19577
|
|
|
19366
19578
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify([]);
|
|
19367
19579
|
console.log('uploader', (this._SfUploader[0].querySelector('#uploader') as SfIUploader));
|
|
19580
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = 0;
|
|
19368
19581
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19369
19582
|
|
|
19370
19583
|
if (docs.length > 0) {
|
|
19371
19584
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify(docs);
|
|
19585
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = docs.length;
|
|
19372
19586
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19373
19587
|
}
|
|
19374
19588
|
|
|
19375
|
-
if (this.myRole == this.TAB_APPROVER || approved) {
|
|
19589
|
+
if (this.myRole == this.TAB_APPROVER || event.approved) {
|
|
19376
19590
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = true;
|
|
19377
19591
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19378
19592
|
} else {
|
|
@@ -19383,8 +19597,8 @@ export class SfIEvents extends LitElement {
|
|
|
19383
19597
|
const dataPassthrough = {
|
|
19384
19598
|
projectId: this.projectId,
|
|
19385
19599
|
countryId: this.countryId,
|
|
19386
|
-
entityId:
|
|
19387
|
-
locationId:
|
|
19600
|
+
entityId: event.entityid,
|
|
19601
|
+
locationId: event.locationid,
|
|
19388
19602
|
mmddyyyy: mmddyyyy,
|
|
19389
19603
|
complianceId: event['id'],
|
|
19390
19604
|
path: "uploadextract"
|
|
@@ -19398,6 +19612,7 @@ export class SfIEvents extends LitElement {
|
|
|
19398
19612
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlHost = callbackUrlHost;
|
|
19399
19613
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlPath = callbackUrlPath;
|
|
19400
19614
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19615
|
+
console.log('uploader prepopulate', (this._SfUploader[0].querySelector('#uploader') as SfIUploader).prepopulatedInputArr, (this._SfUploader[0].querySelector('#uploader') as SfIUploader).extract)
|
|
19401
19616
|
|
|
19402
19617
|
}
|
|
19403
19618
|
|
|
@@ -19409,50 +19624,32 @@ export class SfIEvents extends LitElement {
|
|
|
19409
19624
|
if (event["approved"] != null) {
|
|
19410
19625
|
if (event["approved"] === true) {
|
|
19411
19626
|
//console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
19412
|
-
if ((
|
|
19413
|
-
(
|
|
19627
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
|
|
19628
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
|
|
19414
19629
|
}
|
|
19415
|
-
if ((
|
|
19416
|
-
(
|
|
19630
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19631
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = false;
|
|
19417
19632
|
}
|
|
19418
19633
|
} else {
|
|
19419
|
-
if ((
|
|
19420
|
-
(
|
|
19634
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
|
|
19635
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
|
|
19421
19636
|
}
|
|
19422
|
-
if ((
|
|
19423
|
-
(
|
|
19637
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19638
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
|
|
19424
19639
|
}
|
|
19425
19640
|
}
|
|
19426
19641
|
} else {
|
|
19427
|
-
if (
|
|
19428
|
-
(
|
|
19642
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement != null) {
|
|
19643
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
|
|
19429
19644
|
}
|
|
19430
|
-
if ((
|
|
19431
|
-
(
|
|
19645
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19646
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = true;
|
|
19432
19647
|
}
|
|
19433
|
-
|
|
19434
19648
|
}
|
|
19435
19649
|
}
|
|
19436
|
-
|
|
19437
19650
|
}
|
|
19438
|
-
|
|
19439
|
-
|
|
19440
|
-
console.log('customreporting', event['customreporting'])
|
|
19441
|
-
if (event['customreporting'] != null) {
|
|
19442
|
-
let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
|
|
19443
|
-
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
19444
|
-
reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
|
|
19445
|
-
console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
|
|
19446
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
|
|
19447
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
|
|
19448
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
|
|
19449
|
-
// if(reportformatvalues != ""){
|
|
19450
|
-
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
19451
|
-
// }
|
|
19452
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
|
|
19453
|
-
}
|
|
19454
|
-
} else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
19455
|
-
this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
19651
|
+
if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
19652
|
+
this.fetchReportFormat(eventDetailReportingContainer, reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
19456
19653
|
}
|
|
19457
19654
|
}
|
|
19458
19655
|
|
|
@@ -27884,7 +28081,7 @@ export class SfIEvents extends LitElement {
|
|
|
27884
28081
|
}
|
|
27885
28082
|
}
|
|
27886
28083
|
|
|
27887
|
-
sendSuggestions = async (eventid: string, eventdelta:any) => {
|
|
28084
|
+
sendSuggestions = async (eventid: string, eventdelta: any) => {
|
|
27888
28085
|
let url = "https://" + this.apiIdRCMResources + "/sendsuggestions";
|
|
27889
28086
|
|
|
27890
28087
|
const body = {
|
|
@@ -27928,6 +28125,44 @@ export class SfIEvents extends LitElement {
|
|
|
27928
28125
|
return retValue;
|
|
27929
28126
|
}
|
|
27930
28127
|
|
|
28128
|
+
exportRegister = async () => {
|
|
28129
|
+
|
|
28130
|
+
let url = "https://" + this.apiId + "/scheduleregisterexportjob";
|
|
28131
|
+
|
|
28132
|
+
const body = {
|
|
28133
|
+
"projectid": this.projectId,
|
|
28134
|
+
"userid": this.userProfileId,
|
|
28135
|
+
"role": this.myRole,
|
|
28136
|
+
}
|
|
28137
|
+
|
|
28138
|
+
console.log('exporting Register...', body);
|
|
28139
|
+
|
|
28140
|
+
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
28141
|
+
const xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
|
|
28142
|
+
this._SfLoader.innerHTML = '';
|
|
28143
|
+
if (xhr.status == 200) {
|
|
28144
|
+
|
|
28145
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
28146
|
+
console.log('jsonResponse sync', jsonRespose);
|
|
28147
|
+
this.setSuccess("Register export started successfully! Youwill get an email with your register landscape.");
|
|
28148
|
+
setTimeout(() => {
|
|
28149
|
+
this.clearMessages();
|
|
28150
|
+
}, 5000);
|
|
28151
|
+
|
|
28152
|
+
} else {
|
|
28153
|
+
if (xhr.status == 401) {
|
|
28154
|
+
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
28155
|
+
this.dispatchEvent(changeEvent);
|
|
28156
|
+
}
|
|
28157
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
28158
|
+
this.setError(jsonRespose.error);
|
|
28159
|
+
setTimeout(() => {
|
|
28160
|
+
this.clearMessages()
|
|
28161
|
+
}, 3000);
|
|
28162
|
+
}
|
|
28163
|
+
}
|
|
28164
|
+
|
|
28165
|
+
|
|
27931
28166
|
uploadMapping = async () => {
|
|
27932
28167
|
|
|
27933
28168
|
let url = "https://" + this.apiId + "/mapevents";
|
|
@@ -29323,7 +29558,7 @@ export class SfIEvents extends LitElement {
|
|
|
29323
29558
|
let url = "https://" + this.apiId + "/markreviewed";
|
|
29324
29559
|
|
|
29325
29560
|
//console.log('fetch calendar url', url);
|
|
29326
|
-
let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark"
|
|
29561
|
+
let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark": review };
|
|
29327
29562
|
|
|
29328
29563
|
//console.log('urlbody', urlBody);
|
|
29329
29564
|
|
|
@@ -31081,7 +31316,6 @@ export class SfIEvents extends LitElement {
|
|
|
31081
31316
|
let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
|
|
31082
31317
|
console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
31083
31318
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
31084
|
-
4
|
|
31085
31319
|
this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer)
|
|
31086
31320
|
} else {
|
|
31087
31321
|
listReportingContainer.innerHTML = '';
|