sf-i-events 1.0.949 → 1.0.951
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/index.html +2 -31
- package/package.json +1 -1
- package/sf-i-events.d.ts +2 -0
- package/sf-i-events.js +651 -435
- package/src/sf-i-events.ts +690 -486
- package/src/util.ts +1 -0
package/src/sf-i-events.ts
CHANGED
|
@@ -156,6 +156,7 @@ export class SfIEvents extends LitElement {
|
|
|
156
156
|
padding-left: 20px;
|
|
157
157
|
padding-right: 20px;
|
|
158
158
|
border-radius: 10px;
|
|
159
|
+
position: relative;
|
|
159
160
|
}
|
|
160
161
|
.certificate-section h1 {
|
|
161
162
|
font-family: Belanosima;
|
|
@@ -279,11 +280,24 @@ export class SfIEvents extends LitElement {
|
|
|
279
280
|
.color-late-reported {
|
|
280
281
|
color: #Ef9C66;
|
|
281
282
|
}
|
|
283
|
+
.watermark {
|
|
284
|
+
background-image: url(https://flagggrc-images.s3.amazonaws.com/logo.png);
|
|
285
|
+
background-position: center;
|
|
286
|
+
background-repeat: repeat;
|
|
287
|
+
background-size: 20%;
|
|
288
|
+
opacity: 5%;
|
|
289
|
+
left: 0;
|
|
290
|
+
right: 0;
|
|
291
|
+
top: 0;
|
|
292
|
+
bottom: 0;
|
|
293
|
+
position: absolute;
|
|
294
|
+
}
|
|
282
295
|
</style>
|
|
283
296
|
</head>
|
|
284
297
|
<body>
|
|
285
298
|
<div class="certificate-section">
|
|
286
299
|
<h1 class="text-center">Certificate</h1>
|
|
300
|
+
<div class="watermark"></div>
|
|
287
301
|
<p>I, PERSON_NAME, working as <span class="person-designation">PERSON_DESIGNATION</span> in PERSON_COMPANY, hereby declare that I am entrusted with the responsibility of ensuring compliance with various laws applicable to the company in the administration of business and the affairs of the company</p>
|
|
288
302
|
<p>After having examined and considered all relevant information and based on the information furnished by the concerned officers, I, do hereby certify that the Finance / Technical / Administration / Legal wings / department of PERSON_COMPANY for the period PERSON_PERIOD, has in the conduct of business:</p>
|
|
289
303
|
<ol>
|
|
@@ -305,6 +319,7 @@ export class SfIEvents extends LitElement {
|
|
|
305
319
|
</div>
|
|
306
320
|
</div>
|
|
307
321
|
<br /><br />
|
|
322
|
+
<div class="watermark"></div>
|
|
308
323
|
<h3>Compliance Status</h3>
|
|
309
324
|
PERSON_COMPLIANCE_STATUS
|
|
310
325
|
<br /><br />
|
|
@@ -1694,6 +1709,8 @@ export class SfIEvents extends LitElement {
|
|
|
1694
1709
|
suspenseFlag: boolean = false;
|
|
1695
1710
|
|
|
1696
1711
|
tablecols: string[] = []
|
|
1712
|
+
|
|
1713
|
+
reportedLocationsVals: any[] = []
|
|
1697
1714
|
static override styles = css`
|
|
1698
1715
|
|
|
1699
1716
|
.bg-white {
|
|
@@ -2246,6 +2263,10 @@ export class SfIEvents extends LitElement {
|
|
|
2246
2263
|
margin-left: 10px;
|
|
2247
2264
|
}
|
|
2248
2265
|
|
|
2266
|
+
.ml-10-m-0 {
|
|
2267
|
+
margin-left: 10px;
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2249
2270
|
.mt-20 {
|
|
2250
2271
|
margin-top: 20px;
|
|
2251
2272
|
}
|
|
@@ -2254,6 +2275,10 @@ export class SfIEvents extends LitElement {
|
|
|
2254
2275
|
margin-left: 20px;
|
|
2255
2276
|
}
|
|
2256
2277
|
|
|
2278
|
+
.ml-20-m-0 {
|
|
2279
|
+
margin-left: 20px;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2257
2282
|
.mr-20 {
|
|
2258
2283
|
margin-right: 20px;
|
|
2259
2284
|
}
|
|
@@ -2416,6 +2441,14 @@ export class SfIEvents extends LitElement {
|
|
|
2416
2441
|
.calendar-right-data {
|
|
2417
2442
|
width: 100%;
|
|
2418
2443
|
}
|
|
2444
|
+
|
|
2445
|
+
.ml-10-m-0 {
|
|
2446
|
+
margin-left: 0px;
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
.ml-20-m-0 {
|
|
2450
|
+
margin-left: 0px;
|
|
2451
|
+
}
|
|
2419
2452
|
|
|
2420
2453
|
}
|
|
2421
2454
|
|
|
@@ -4801,9 +4834,9 @@ export class SfIEvents extends LitElement {
|
|
|
4801
4834
|
const eventIdSanitized = event.id.replace(/-/g, '_');
|
|
4802
4835
|
const mmddSanitized = mmdd.replace(/\//g, '-');
|
|
4803
4836
|
const dueDateParts = event.duedate.split('/');
|
|
4804
|
-
const isReportedLocation = event.reportedlocationsflag == true
|
|
4805
|
-
const isSuspense = event.suspense == true
|
|
4806
|
-
const isReviewed = event.review == true
|
|
4837
|
+
const isReportedLocation = event.reportedlocationsflag == true
|
|
4838
|
+
const isSuspense = event.suspense == true
|
|
4839
|
+
const isReviewed = event.review == true
|
|
4807
4840
|
const showCheckbox = !(hasReportFormat || isBulk || hasCustomReporting || isReportedLocation);
|
|
4808
4841
|
// const showReportingButton = !hasReportFormat && !hasCustomReporting && event.reporters == null;
|
|
4809
4842
|
const showReportingButton = !hasReportFormat && !hasCustomReporting && event.concise != null && !isReportedLocation;
|
|
@@ -5196,7 +5229,7 @@ export class SfIEvents extends LitElement {
|
|
|
5196
5229
|
const configFlag = configHome.features != null && configHome.features.indexOf("understood") >= 0
|
|
5197
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>';
|
|
5198
5231
|
// }
|
|
5199
|
-
|
|
5232
|
+
|
|
5200
5233
|
return html;
|
|
5201
5234
|
|
|
5202
5235
|
}
|
|
@@ -5905,7 +5938,9 @@ export class SfIEvents extends LitElement {
|
|
|
5905
5938
|
let makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
5906
5939
|
let docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
5907
5940
|
let uploadGuidance = event['uploadguidance'] ?? 0
|
|
5908
|
-
|
|
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)
|
|
5909
5944
|
if (this.selectedItemIds.length > 0) {
|
|
5910
5945
|
html += `<div class="d-flex justify-between ">
|
|
5911
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>
|
|
@@ -5937,19 +5972,39 @@ export class SfIEvents extends LitElement {
|
|
|
5937
5972
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
5938
5973
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
5939
5974
|
html += '<input id="input-approver-doc" part="input" type="date" value="' + (dateOfCompletion == "" ? dateOfCompletion : new Date(parseInt(dateOfCompletion)).toISOString().substring(0, 10)) + '" disabled/><br />';
|
|
5940
|
-
html += '<div class="d-flex justify-start align-center">';
|
|
5975
|
+
html += '<div class="d-flex justify-start align-center flex-wrap">';
|
|
5941
5976
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
5942
5977
|
html += '<label part="input-label">Completion Percentage</label>';
|
|
5943
5978
|
html += '<input id="input-reporter-percentage" part="input" type="number" value="' + percentage + '" max="100" min="0" step="1" disabled/><br />';
|
|
5944
5979
|
html += '</div>'
|
|
5945
|
-
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">';
|
|
5946
5981
|
html += '<label part="input-label">Entity</label>';
|
|
5947
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
5982
|
+
html += '<select id="input-reporter-entity-0" part="input" disabled></select>';
|
|
5948
5983
|
html += '</div>'
|
|
5949
|
-
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">';
|
|
5950
5985
|
html += '<label part="input-label">Location</label>';
|
|
5951
|
-
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>';
|
|
5952
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
|
+
}
|
|
5953
6008
|
html += '</div>'
|
|
5954
6009
|
|
|
5955
6010
|
}
|
|
@@ -6011,20 +6066,41 @@ export class SfIEvents extends LitElement {
|
|
|
6011
6066
|
if (event.module != 'contract' && event.module != 'license' && event.module != 'rcmresource') {
|
|
6012
6067
|
html += '<label part="input-label">Date of Completion*</label>';
|
|
6013
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 />';
|
|
6014
|
-
html += '<div class="d-flex justify-start align-
|
|
6069
|
+
html += '<div class="d-flex justify-start align-end flex-wrap">';
|
|
6015
6070
|
html += '<div class="d-flex flex-col flex-grow">';
|
|
6016
6071
|
html += '<label part="input-label">Completion Percentage*</label>';
|
|
6017
|
-
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"/>';
|
|
6018
6073
|
html += '</div>'
|
|
6019
|
-
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">';
|
|
6020
6075
|
html += '<label part="input-label">Entity</label>';
|
|
6021
|
-
html += '<select id="input-reporter-entity" part="input"></select
|
|
6076
|
+
html += '<select id="input-reporter-entity-0" part="input"></select>';
|
|
6022
6077
|
html += '</div>'
|
|
6023
|
-
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">';
|
|
6024
6079
|
html += '<label part="input-label">Location</label>';
|
|
6025
|
-
html += '<select id="input-reporter-location" part="input"></select
|
|
6026
|
-
html += '</div>'
|
|
6080
|
+
html += '<select id="input-reporter-location-0" class="input-reporter-location" part="input"></select>';
|
|
6027
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>'
|
|
6028
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 />'
|
|
6029
6105
|
|
|
6030
6106
|
// if(docsOptional.length === 0) {
|
|
@@ -6249,7 +6325,11 @@ export class SfIEvents extends LitElement {
|
|
|
6249
6325
|
listReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
|
|
6250
6326
|
console.log('upload guidance clicked', event);
|
|
6251
6327
|
let inputReportingPercentage = (listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
|
|
6252
|
-
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
|
+
}
|
|
6253
6333
|
let approvercomments = (listReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
|
|
6254
6334
|
let reportercomments = (listReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
|
|
6255
6335
|
let dateOfCompletion;
|
|
@@ -6263,97 +6343,161 @@ export class SfIEvents extends LitElement {
|
|
|
6263
6343
|
dateOfCompletion = "";
|
|
6264
6344
|
}
|
|
6265
6345
|
console.log('dateOfCompletion', dateOfCompletion)
|
|
6266
|
-
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);
|
|
6267
6347
|
})
|
|
6268
6348
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
6269
6349
|
let inputReportingPercentage = listReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
|
|
6270
6350
|
let percentage = inputReportingPercentage.value
|
|
6271
|
-
|
|
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>;
|
|
6272
6354
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
6273
|
-
|
|
6274
|
-
|
|
6355
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
6356
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
6357
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
6275
6358
|
} else {
|
|
6276
|
-
|
|
6277
|
-
|
|
6359
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
6360
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
6361
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
6278
6362
|
}
|
|
6279
6363
|
inputReportingPercentage?.addEventListener('change', () => {
|
|
6280
6364
|
setTimeout(() => {
|
|
6281
6365
|
let percentage = inputReportingPercentage.value
|
|
6282
|
-
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value);
|
|
6366
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
6283
6367
|
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
6284
|
-
|
|
6285
|
-
|
|
6368
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
6369
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
6370
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
6286
6371
|
} else {
|
|
6287
|
-
|
|
6288
|
-
|
|
6372
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
6373
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
6374
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
6289
6375
|
}
|
|
6290
6376
|
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
6291
6377
|
(listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
|
|
6292
6378
|
} else {
|
|
6293
6379
|
(listReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
|
|
6294
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
|
+
}
|
|
6295
6390
|
}, 200);
|
|
6296
6391
|
})
|
|
6297
|
-
let selectReportingEntity = listReportingContainer.querySelector('#input-reporter-entity') as HTMLSelectElement;
|
|
6298
|
-
let selectReportingLocation = listReportingContainer.querySelector('#input-reporter-location') as HTMLSelectElement;
|
|
6299
|
-
selectReportingEntity.innerHTML = '';
|
|
6300
6392
|
let projectUserMap = Util.getProjectUsermap()
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
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 = '';
|
|
6313
6422
|
for (let country of Object.keys(projectUserMap)) {
|
|
6314
6423
|
if (country == "roles") {
|
|
6315
6424
|
continue;
|
|
6316
6425
|
}
|
|
6317
6426
|
for (let entity of Object.keys(projectUserMap[country])) {
|
|
6318
|
-
|
|
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") {
|
|
6319
6436
|
continue;
|
|
6320
6437
|
}
|
|
6321
|
-
for (let
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
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
|
+
}
|
|
6325
6447
|
}
|
|
6326
6448
|
}
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
if (event.reportedlocations.indexOf(location) >= 0) {
|
|
6341
|
-
selectReportingEntity.value = entity;
|
|
6342
|
-
const changeEvent = new Event('change', { bubbles: true });
|
|
6343
|
-
selectReportingEntity.dispatchEvent(changeEvent)
|
|
6344
|
-
selectReportingLocation.value = location;
|
|
6345
|
-
flagSetVal = true;
|
|
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") {
|
|
6455
|
+
continue;
|
|
6456
|
+
}
|
|
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);
|
|
6346
6462
|
break;
|
|
6347
6463
|
}
|
|
6348
|
-
}
|
|
6349
|
-
if (flagSetVal) {
|
|
6350
6464
|
break;
|
|
6351
6465
|
}
|
|
6466
|
+
break;
|
|
6352
6467
|
}
|
|
6353
6468
|
}
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
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) {
|
|
6493
|
+
break;
|
|
6494
|
+
}
|
|
6495
|
+
}
|
|
6496
|
+
}
|
|
6497
|
+
} else {
|
|
6498
|
+
selectReportingEntity.value = "";
|
|
6499
|
+
selectReportingLocation.value = "";
|
|
6500
|
+
}
|
|
6357
6501
|
}
|
|
6358
6502
|
|
|
6359
6503
|
listReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
|
|
@@ -6729,7 +6873,14 @@ export class SfIEvents extends LitElement {
|
|
|
6729
6873
|
|
|
6730
6874
|
} else {
|
|
6731
6875
|
let flagBulk = false;
|
|
6732
|
-
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
|
+
}
|
|
6733
6884
|
if (this.selectedItemIds.length <= 1) {
|
|
6734
6885
|
|
|
6735
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)) {
|
|
@@ -6738,6 +6889,8 @@ export class SfIEvents extends LitElement {
|
|
|
6738
6889
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
6739
6890
|
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
6740
6891
|
this.events[mmdd][p].documents = docs
|
|
6892
|
+
this.events[mmdd][p].percentage = percentage
|
|
6893
|
+
this.events[mmdd][p].reportedlocations = reportedlocations
|
|
6741
6894
|
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
6742
6895
|
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
6743
6896
|
}
|
|
@@ -6764,6 +6917,8 @@ export class SfIEvents extends LitElement {
|
|
|
6764
6917
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
6765
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) {
|
|
6766
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
|
|
6767
6922
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
6768
6923
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
6769
6924
|
}
|
|
@@ -7055,7 +7210,6 @@ export class SfIEvents extends LitElement {
|
|
|
7055
7210
|
let listReportingContainer = eventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
|
|
7056
7211
|
// console.log('mmddyyyy', this.events[mmdd][j], listReportingContainer, '#list-reporting-container-'+mmdd.replace(/\//g,'-')+'-'+j);
|
|
7057
7212
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
7058
|
-
4
|
|
7059
7213
|
this.renderListReporting(listReportingContainer, this.events[mmdd][j], mmdd + '/' + yyyy, eventsContainer)
|
|
7060
7214
|
} else {
|
|
7061
7215
|
listReportingContainer.innerHTML = '';
|
|
@@ -7083,11 +7237,11 @@ export class SfIEvents extends LitElement {
|
|
|
7083
7237
|
const j = idArr[5];
|
|
7084
7238
|
console.log('review clicked', mmdd, yyyy, j, this.events[mmdd][j], ev.target.checked);
|
|
7085
7239
|
let eventKey = this.events[mmdd][j].entityid + ';' + this.events[mmdd][j].locationid + ';' + this.events[mmdd][j].id;
|
|
7086
|
-
for(var p = 0; p < Object.keys(this.events).length; p++) {
|
|
7240
|
+
for (var p = 0; p < Object.keys(this.events).length; p++) {
|
|
7087
7241
|
let tempMmDd = Object.keys(this.events)[p];
|
|
7088
|
-
for(var q = 0; q < this.events[tempMmDd].length; q++) {
|
|
7242
|
+
for (var q = 0; q < this.events[tempMmDd].length; q++) {
|
|
7089
7243
|
let tempEventKey = this.events[tempMmDd][q].entityid + ';' + this.events[tempMmDd][q].locationid + ';' + this.events[tempMmDd][q].id;
|
|
7090
|
-
if(tempEventKey == eventKey) {
|
|
7244
|
+
if (tempEventKey == eventKey) {
|
|
7091
7245
|
this.events[tempMmDd][q].review = ev.target.innerHTML.indexOf('flag_check') < 0
|
|
7092
7246
|
}
|
|
7093
7247
|
}
|
|
@@ -16895,7 +17049,7 @@ export class SfIEvents extends LitElement {
|
|
|
16895
17049
|
this.setSuccess("Renewal successful");
|
|
16896
17050
|
setTimeout(() => {
|
|
16897
17051
|
this.clearMessages()
|
|
16898
|
-
},3000)
|
|
17052
|
+
}, 3000)
|
|
16899
17053
|
} else {
|
|
16900
17054
|
if (xhr.status == 401) {
|
|
16901
17055
|
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
@@ -17126,8 +17280,8 @@ export class SfIEvents extends LitElement {
|
|
|
17126
17280
|
reportformatvaluesStr = JSON.stringify(reportingReporting!.selectedValues())
|
|
17127
17281
|
}
|
|
17128
17282
|
let comparedObj = Util.compareObjects(reportformatvalues, JSON.parse(listEvent.reportformatvalues))
|
|
17129
|
-
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues),comparedObj)
|
|
17130
|
-
if(Object.keys(comparedObj).length > 0){
|
|
17283
|
+
console.log('reportformatvalues', reportformatvalues, JSON.parse(listEvent.reportformatvalues), comparedObj)
|
|
17284
|
+
if (Object.keys(comparedObj).length > 0) {
|
|
17131
17285
|
await this.sendSuggestions(listEvent.id, comparedObj);
|
|
17132
17286
|
}
|
|
17133
17287
|
// return;
|
|
@@ -17826,12 +17980,12 @@ export class SfIEvents extends LitElement {
|
|
|
17826
17980
|
console.log('event details', event, mmddyyyy, currentColumnButton == null ? "null currentColumnButton" : currentColumnButton.id);
|
|
17827
17981
|
console.log('previousid', previousId, 'nextid', nextId);
|
|
17828
17982
|
console.log('confighome', Util.getProjectConfigHome())
|
|
17829
|
-
let comments, docs, approved
|
|
17983
|
+
let comments, docs, approved /*,dateOfCompletion, makercheckers: Array<string>, docsOptional: boolean | any, documentType: string | any*/;
|
|
17830
17984
|
let entityId: string = "";
|
|
17831
17985
|
let locationId: string = "";
|
|
17832
17986
|
let statuteName: string = "";
|
|
17833
17987
|
let reportformatName: string = "";
|
|
17834
|
-
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
17988
|
+
// let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
17835
17989
|
entityId = event.entityid;
|
|
17836
17990
|
locationId = event.locationid;
|
|
17837
17991
|
// let completeness = this.getCompletenessStatus(event);
|
|
@@ -17839,9 +17993,9 @@ export class SfIEvents extends LitElement {
|
|
|
17839
17993
|
docs = event['documents'] == null ? [] : event['documents'] == null ? [] : (event['documents']);
|
|
17840
17994
|
approved = event['approved'] == null ? false : event['approved'] == null ? false : event['approved'];
|
|
17841
17995
|
// dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
17842
|
-
makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
17843
|
-
docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
17844
|
-
documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
|
|
17996
|
+
// makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
17997
|
+
// docsOptional = event['docs'] == null ? [] : event['docs'] == null ? [] : event['docs'];
|
|
17998
|
+
// documentType = event['documenttype'] == null ? null : event['documenttype'][0] == null ? null : event['documenttype'][0].split(" ")[0];
|
|
17845
17999
|
|
|
17846
18000
|
statuteName = event['statute'][0].trim();
|
|
17847
18001
|
if (event['reportformat'] != null) {
|
|
@@ -18172,7 +18326,7 @@ export class SfIEvents extends LitElement {
|
|
|
18172
18326
|
|
|
18173
18327
|
if (this.mode == "consumer" || this.mode == "next" || this.mode == "viewer") {
|
|
18174
18328
|
if (this.mode != "viewer") {
|
|
18175
|
-
html += '<div part="reporting-view-container">'
|
|
18329
|
+
html += '<div part="reporting-view-container" id="reporting-view-container">'
|
|
18176
18330
|
html += this.renderReporting(event, mmddyyyy);
|
|
18177
18331
|
html += "</div>"
|
|
18178
18332
|
}
|
|
@@ -18260,95 +18414,12 @@ export class SfIEvents extends LitElement {
|
|
|
18260
18414
|
|
|
18261
18415
|
(this._SfDetailContainer as HTMLDivElement).innerHTML = html;
|
|
18262
18416
|
(this._SfDetailContainer as HTMLDivElement).style.display = 'block';
|
|
18263
|
-
// let attachmentUploaders = (this._SfDetailContainer as HTMLDivElement).querySelectorAll('.event-attachment') as NodeListOf<SfIUploader>
|
|
18264
|
-
// for(let attachmentUploader of attachmentUploaders){
|
|
18265
|
-
// attachmentUploader.loadMode();
|
|
18266
|
-
// }
|
|
18267
18417
|
if (this.mode != "viewer" && (this._SfUploader[0]) != null) {
|
|
18268
18418
|
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
18269
18419
|
|
|
18270
18420
|
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>`;
|
|
18271
18421
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader).emailcontent = emailcontent;
|
|
18272
18422
|
}
|
|
18273
|
-
(this._SfDetailContainer as HTMLDivElement).querySelector('.button-delete')?.addEventListener('click', async () => {
|
|
18274
|
-
|
|
18275
|
-
await this.fetchDeleteReview(event["id"], mmddyyyy, entityId, locationId);
|
|
18276
|
-
this.setSuccess('Deleted successfully!')
|
|
18277
|
-
setTimeout(() => {
|
|
18278
|
-
this.clearMessages()
|
|
18279
|
-
}, 3000);
|
|
18280
|
-
//console.log('deleted', resultDelete);
|
|
18281
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18282
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18283
|
-
// } else {
|
|
18284
|
-
if (currentColumnButton != null) {
|
|
18285
|
-
currentColumnButton.click();
|
|
18286
|
-
}
|
|
18287
|
-
// }
|
|
18288
|
-
|
|
18289
|
-
var clickEvent = new MouseEvent("click", {
|
|
18290
|
-
"view": window,
|
|
18291
|
-
"bubbles": true,
|
|
18292
|
-
"cancelable": false
|
|
18293
|
-
});
|
|
18294
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18295
|
-
|
|
18296
|
-
});
|
|
18297
|
-
(this._SfDetailContainer as HTMLDivElement).querySelector('#button-auto-approve')?.addEventListener('click', async () => {
|
|
18298
|
-
if (this.selectedItemIds.length <= 1) {
|
|
18299
|
-
await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
18300
|
-
this.setSuccess('Auto-Approved successfully!')
|
|
18301
|
-
setTimeout(() => {
|
|
18302
|
-
this.clearMessages()
|
|
18303
|
-
}, 3000);
|
|
18304
|
-
} else {
|
|
18305
|
-
let bulkBodyReview = []
|
|
18306
|
-
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
18307
|
-
|
|
18308
|
-
const selectedId = this.selectedItemIds[k];
|
|
18309
|
-
//console.log('selectedid', selectedId);
|
|
18310
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18311
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18312
|
-
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18313
|
-
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18314
|
-
|
|
18315
|
-
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
18316
|
-
let yearStr = this.getFinancialYear(mmddyyyy)
|
|
18317
|
-
bulkBodyReview.push({
|
|
18318
|
-
"mmddyyyy": mmddyyyy,
|
|
18319
|
-
"projectid": this.projectId,
|
|
18320
|
-
"type": "review",
|
|
18321
|
-
"eventid": eventId,
|
|
18322
|
-
"comments": "Auto approved",
|
|
18323
|
-
"approved": true,
|
|
18324
|
-
"entityid": entityId,
|
|
18325
|
-
"locationid": locationId,
|
|
18326
|
-
"username": this.userName,
|
|
18327
|
-
"userid": this.userProfileId,
|
|
18328
|
-
"userrole": this.myRole,
|
|
18329
|
-
"year": yearStr,
|
|
18330
|
-
"module": event.module ?? "compliance"
|
|
18331
|
-
})
|
|
18332
|
-
}
|
|
18333
|
-
await this.uploadReviewsBulk(bulkBodyReview);
|
|
18334
|
-
}
|
|
18335
|
-
//console.log('deleted', resultDelete);
|
|
18336
|
-
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18337
|
-
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18338
|
-
// } else {
|
|
18339
|
-
if (currentColumnButton != null) {
|
|
18340
|
-
currentColumnButton.click();
|
|
18341
|
-
}
|
|
18342
|
-
// }
|
|
18343
|
-
|
|
18344
|
-
var clickEvent = new MouseEvent("click", {
|
|
18345
|
-
"view": window,
|
|
18346
|
-
"bubbles": true,
|
|
18347
|
-
"cancelable": false
|
|
18348
|
-
});
|
|
18349
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18350
|
-
|
|
18351
|
-
});
|
|
18352
18423
|
|
|
18353
18424
|
(this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close')?.addEventListener('click', () => {
|
|
18354
18425
|
|
|
@@ -18586,132 +18657,330 @@ export class SfIEvents extends LitElement {
|
|
|
18586
18657
|
})
|
|
18587
18658
|
|
|
18588
18659
|
if (this.mode == "consumer" || this.mode == "next") {
|
|
18589
|
-
let
|
|
18590
|
-
|
|
18660
|
+
let eventDetailReportingContainer = (this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-view-container') as HTMLDivElement
|
|
18661
|
+
if(eventDetailReportingContainer != null){
|
|
18662
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, (this._SfDetailContainer as HTMLDivElement))
|
|
18663
|
+
}
|
|
18664
|
+
}
|
|
18591
18665
|
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18666
|
+
this.fetchStatuteDefinitionDetails(statuteName);
|
|
18667
|
+
console.log('customreporting', event['customreporting'])
|
|
18668
|
+
if (event['customreporting'] != null) {
|
|
18669
|
+
let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
|
|
18670
|
+
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
18671
|
+
reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
|
|
18672
|
+
console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
|
|
18673
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
|
|
18674
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
|
|
18675
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
|
|
18676
|
+
// if(reportformatvalues != ""){
|
|
18677
|
+
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
18678
|
+
// }
|
|
18679
|
+
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
|
|
18680
|
+
}
|
|
18681
|
+
} else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
18682
|
+
this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
18683
|
+
}
|
|
18684
|
+
}
|
|
18685
|
+
|
|
18686
|
+
renderEventDetailReporting = (eventDetailReportingContainer: HTMLDivElement, event: any, mmddyyyy: any, eventDetailContainer: HTMLDivElement) => {
|
|
18687
|
+
console.log('detailreporting event', event, this.graphFilter);
|
|
18688
|
+
let html = ''
|
|
18689
|
+
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18690
|
+
|
|
18691
|
+
let reportformatName: string = '';
|
|
18692
|
+
if (event['reportformat'] != null) {
|
|
18693
|
+
reportformatName = (event['reportformat'][0] ?? "").trim().replace('&', '&');
|
|
18694
|
+
}
|
|
18695
|
+
let docs = event['documents'] == null ? [] : event['documents'];
|
|
18696
|
+
event.approved = event['approved'] == null ? false : event['approved'];
|
|
18697
|
+
event.dateOfCompletion = event['dateofcompletion'] == null ? '' : event['dateofcompletion'];
|
|
18698
|
+
event.makercheckers = event['makercheckers'] == null ? [] : event['makercheckers'];
|
|
18699
|
+
event.docsOptional = event['docs'] == null ? [] : event['docs'];
|
|
18700
|
+
html = this.renderReporting(event, mmddyyyy);
|
|
18701
|
+
console.log('reporting html', html);
|
|
18702
|
+
let ddmmyyyy = mmddyyyy.split('/')[1] + '/' + mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[2];
|
|
18703
|
+
|
|
18704
|
+
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>`;
|
|
18705
|
+
eventDetailReportingContainer.innerHTML = html;
|
|
18706
|
+
if (this._SfUploader[0] != null) {
|
|
18707
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.emailcontent = emailcontent;
|
|
18708
|
+
}
|
|
18709
|
+
eventDetailReportingContainer.querySelector('.button-delete')?.addEventListener('click', async () => {
|
|
18710
|
+
|
|
18711
|
+
await this.fetchDeleteReview(event["id"], mmddyyyy, event.entityid, event.locationid);
|
|
18712
|
+
this.setSuccess('Deleted successfully!')
|
|
18713
|
+
setTimeout(() => {
|
|
18714
|
+
this.clearMessages()
|
|
18715
|
+
}, 3000);
|
|
18716
|
+
//console.log('deleted', resultDelete);
|
|
18717
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18718
|
+
this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18595
18719
|
} else {
|
|
18596
|
-
(
|
|
18597
|
-
|
|
18720
|
+
// if(currentColumnButton != null) {
|
|
18721
|
+
// currentColumnButton.click();
|
|
18722
|
+
// }
|
|
18598
18723
|
}
|
|
18599
|
-
|
|
18724
|
+
|
|
18725
|
+
});
|
|
18726
|
+
eventDetailReportingContainer.querySelector('#button-auto-approve')?.addEventListener('click', async () => {
|
|
18727
|
+
if (this.selectedItemIds.length <= 1) {
|
|
18728
|
+
await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
18729
|
+
this.setSuccess('Auto-Approved successfully!')
|
|
18600
18730
|
setTimeout(() => {
|
|
18601
|
-
|
|
18602
|
-
|
|
18603
|
-
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
18604
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.remove('hide');
|
|
18605
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
|
|
18606
|
-
} else {
|
|
18607
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-entity-container') as HTMLDivElement).classList.add('hide');
|
|
18608
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.add('hide')
|
|
18609
|
-
}
|
|
18610
|
-
if ((percentage != null && parseInt(percentage) == 0) || docsOptional.length > 0) {
|
|
18611
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
|
|
18612
|
-
} else {
|
|
18613
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
|
|
18614
|
-
}
|
|
18615
|
-
}, 200);
|
|
18616
|
-
})
|
|
18617
|
-
let selectReportingEntity = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-entity') as HTMLSelectElement;
|
|
18618
|
-
let selectReportingLocation = (this._SfDetailContainer as HTMLDivElement).querySelector('#input-reporter-location') as HTMLSelectElement;
|
|
18619
|
-
selectReportingEntity.innerHTML = '';
|
|
18620
|
-
let projectUserMap = Util.getProjectUsermap()
|
|
18621
|
-
for (let country of Object.keys(projectUserMap)) {
|
|
18622
|
-
if (country == "roles") {
|
|
18623
|
-
continue;
|
|
18624
|
-
}
|
|
18625
|
-
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18626
|
-
let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18627
|
-
let option = new Option(entityName, entity)
|
|
18628
|
-
selectReportingEntity.add(option);
|
|
18629
|
-
}
|
|
18630
|
-
}
|
|
18631
|
-
selectReportingEntity.addEventListener('change', (e: any) => {
|
|
18632
|
-
selectReportingLocation.innerHTML = ''
|
|
18633
|
-
for (let country of Object.keys(projectUserMap)) {
|
|
18634
|
-
if (country == "roles") {
|
|
18635
|
-
continue;
|
|
18636
|
-
}
|
|
18637
|
-
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18638
|
-
if (entity.indexOf(e.target.value) < 0) {
|
|
18639
|
-
continue;
|
|
18640
|
-
}
|
|
18641
|
-
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18642
|
-
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18643
|
-
let option = new Option(locationName, location)
|
|
18644
|
-
selectReportingLocation.add(option);
|
|
18645
|
-
}
|
|
18646
|
-
}
|
|
18647
|
-
}
|
|
18648
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#reporting-location-container') as HTMLDivElement).classList.remove('hide')
|
|
18649
|
-
selectReportingLocation.value = event.reportedlocations ?? "";
|
|
18650
|
-
})
|
|
18651
|
-
if (event.reportedlocations != null && event.reportedlocations.length > 0) {
|
|
18652
|
-
console.log('setting reportedlocations', event.reportedlocations)
|
|
18653
|
-
for (let country of Object.keys(projectUserMap)) {
|
|
18654
|
-
if (country == "roles") {
|
|
18655
|
-
continue;
|
|
18656
|
-
}
|
|
18657
|
-
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18658
|
-
let flagSetVal = false;
|
|
18659
|
-
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18660
|
-
if (event.reportedlocations.indexOf(location) >= 0) {
|
|
18661
|
-
selectReportingEntity.value = entity;
|
|
18662
|
-
const changeEvent = new Event('change', { bubbles: true });
|
|
18663
|
-
selectReportingEntity.dispatchEvent(changeEvent)
|
|
18664
|
-
selectReportingLocation.value = location;
|
|
18665
|
-
flagSetVal = true;
|
|
18666
|
-
break;
|
|
18667
|
-
}
|
|
18668
|
-
}
|
|
18669
|
-
if (flagSetVal) {
|
|
18670
|
-
break;
|
|
18671
|
-
}
|
|
18672
|
-
}
|
|
18673
|
-
}
|
|
18731
|
+
this.clearMessages()
|
|
18732
|
+
}, 3000);
|
|
18674
18733
|
} else {
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
}
|
|
18734
|
+
let bulkBodyReview = []
|
|
18735
|
+
for (var k = 0; k < this.selectedItemIds.length; k++) {
|
|
18678
18736
|
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18737
|
+
const selectedId = this.selectedItemIds[k];
|
|
18738
|
+
//console.log('selectedid', selectedId);
|
|
18739
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18740
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18741
|
+
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18742
|
+
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18743
|
+
|
|
18744
|
+
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
18745
|
+
let yearStr = this.getFinancialYear(mmddyyyy)
|
|
18746
|
+
bulkBodyReview.push({
|
|
18747
|
+
"mmddyyyy": mmddyyyy,
|
|
18748
|
+
"projectid": this.projectId,
|
|
18749
|
+
"type": "review",
|
|
18750
|
+
"eventid": eventId,
|
|
18751
|
+
"comments": "Auto approved",
|
|
18752
|
+
"approved": true,
|
|
18753
|
+
"entityid": entityId,
|
|
18754
|
+
"locationid": locationId,
|
|
18755
|
+
"username": this.userName,
|
|
18756
|
+
"userid": this.userProfileId,
|
|
18757
|
+
"userrole": this.myRole,
|
|
18758
|
+
"year": yearStr,
|
|
18759
|
+
"module": event.module ?? "compliance"
|
|
18760
|
+
})
|
|
18761
|
+
}
|
|
18762
|
+
await this.uploadReviewsBulk(bulkBodyReview);
|
|
18763
|
+
}
|
|
18764
|
+
if (this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18765
|
+
this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
18766
|
+
} else {
|
|
18767
|
+
// if(currentColumnButton != null) {
|
|
18768
|
+
// currentColumnButton.click();
|
|
18769
|
+
// }
|
|
18770
|
+
}
|
|
18771
|
+
|
|
18772
|
+
});
|
|
18773
|
+
eventDetailReportingContainer.querySelector('#upload-guidance-button')?.addEventListener('click', async () => {
|
|
18774
|
+
console.log('upload guidance clicked', event);
|
|
18775
|
+
let inputReportingPercentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement)?.value ?? "100";
|
|
18776
|
+
let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
18777
|
+
let selectReportedLocationValue = "[]";
|
|
18778
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
18779
|
+
selectReportedLocationValue = JSON.stringify([...JSON.parse(selectReportedLocationValue), selectReportedLocation.value])
|
|
18780
|
+
}
|
|
18781
|
+
let approvercomments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement)?.value ?? "";
|
|
18782
|
+
let reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement)?.value ?? "";
|
|
18783
|
+
let dateOfCompletion;
|
|
18784
|
+
if ((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement) != null) {
|
|
18785
|
+
dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "";
|
|
18786
|
+
} else {
|
|
18787
|
+
dateOfCompletion = new Date((eventDetailReportingContainer.querySelector('#input-approver-doc') as HTMLInputElement).value).getTime() + "";
|
|
18788
|
+
}
|
|
18789
|
+
let documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader).selectedValues()
|
|
18790
|
+
if (dateOfCompletion == "NaN") {
|
|
18791
|
+
dateOfCompletion = "";
|
|
18792
|
+
}
|
|
18793
|
+
console.log('dateOfCompletion', dateOfCompletion)
|
|
18794
|
+
await this.fetchEventDetails(event, mmddyyyy, null, eventDetailContainer, "", "", true, eventDetailReportingContainer, reportercomments, approvercomments, inputReportingPercentage, selectReportedLocationValue, documents, dateOfCompletion);
|
|
18795
|
+
})
|
|
18796
|
+
if (this.mode == "consumer" || this.mode == "next") {
|
|
18797
|
+
let inputReportingPercentage = eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement;
|
|
18798
|
+
let percentage = inputReportingPercentage.value
|
|
18799
|
+
const entityContainers = eventDetailReportingContainer.querySelectorAll('.reporting-entity-container') as NodeListOf<HTMLDivElement>;
|
|
18800
|
+
const locationsContainers = eventDetailReportingContainer.querySelectorAll('.reporting-location-container') as NodeListOf<HTMLDivElement>;
|
|
18801
|
+
const addLocationButtons = eventDetailReportingContainer.querySelectorAll('.button-reporter-location-add') as NodeListOf<HTMLButtonElement>;
|
|
18802
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
18803
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
18804
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
18805
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
18806
|
+
} else {
|
|
18807
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
18808
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
18809
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
18810
|
+
}
|
|
18811
|
+
inputReportingPercentage?.addEventListener('change', () => {
|
|
18812
|
+
setTimeout(() => {
|
|
18813
|
+
let percentage = inputReportingPercentage.value
|
|
18814
|
+
console.log('percentage', percentage, inputReportingPercentage, inputReportingPercentage.value, event.reportedlocations);
|
|
18815
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100) {
|
|
18816
|
+
entityContainers.forEach(container => container.classList.remove('hide'));
|
|
18817
|
+
locationsContainers.forEach(container => container.classList.remove('hide'));
|
|
18818
|
+
addLocationButtons.forEach(container => container.classList.remove('hide'));
|
|
18819
|
+
} else {
|
|
18820
|
+
entityContainers.forEach(container => container.classList.add('hide'));
|
|
18821
|
+
locationsContainers.forEach(container => container.classList.add('hide'));
|
|
18822
|
+
addLocationButtons.forEach(container => container.classList.add('hide'));
|
|
18823
|
+
}
|
|
18824
|
+
if ((percentage != null && parseInt(percentage) == 0) || event.docsOptional.length > 0) {
|
|
18825
|
+
(eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents';
|
|
18826
|
+
} else {
|
|
18827
|
+
(eventDetailReportingContainer.querySelector('#input-label-docs') as HTMLLabelElement).innerHTML = 'Supporting Documents*';
|
|
18828
|
+
}
|
|
18829
|
+
if (percentage != null && percentage.length > 0 && parseInt(percentage) < 100 && (event.reportedlocations == "" || event.reportedlocations == "[]")) {
|
|
18830
|
+
event.percentage = percentage
|
|
18831
|
+
event.reportedlocations = JSON.stringify([""])
|
|
18832
|
+
event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
18833
|
+
event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
18834
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
18835
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
18836
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
18837
|
+
}
|
|
18838
|
+
}, 200);
|
|
18839
|
+
})
|
|
18840
|
+
let projectUserMap = Util.getProjectUsermap()
|
|
18841
|
+
addLocationButtons.forEach((addLocationBtn) => {
|
|
18842
|
+
addLocationBtn.addEventListener('click', () => {
|
|
18843
|
+
let iconhtml = addLocationBtn.innerHTML
|
|
18844
|
+
let index = parseInt(addLocationBtn.id.split('-')[4])
|
|
18845
|
+
console.log('button clicked', iconhtml, addLocationBtn.id);
|
|
18846
|
+
if (iconhtml == "add") {
|
|
18847
|
+
console.log('this.reportedLocationsVals', this.reportedLocationsVals)
|
|
18848
|
+
this.reportedLocationsVals.push("");
|
|
18849
|
+
} else {
|
|
18850
|
+
this.reportedLocationsVals.splice(index, 1);
|
|
18851
|
+
}
|
|
18852
|
+
event.percentage = inputReportingPercentage.value;
|
|
18853
|
+
event.reportedlocations = JSON.stringify(this.reportedLocationsVals)
|
|
18854
|
+
if (this.reportedLocationsVals.length == 0 || (this.reportedLocationsVals.length == 1 && this.reportedLocationsVals[0] == "")) {
|
|
18855
|
+
event.percentage = "100";
|
|
18856
|
+
}
|
|
18857
|
+
console.log('rendering list reporting', event.percentage, event.reportedlocations)
|
|
18858
|
+
event.reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
18859
|
+
event.dateofcompletion = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
18860
|
+
event.documents = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
18861
|
+
this.renderEventDetailReporting(eventDetailReportingContainer, event, mmddyyyy, eventDetailContainer);
|
|
18862
|
+
})
|
|
18863
|
+
})
|
|
18864
|
+
|
|
18865
|
+
for (let indexRepLoc = 0; indexRepLoc < this.reportedLocationsVals.length; indexRepLoc++) {
|
|
18866
|
+
console.log('AddingEntities', indexRepLoc)
|
|
18867
|
+
let selectReportingEntity = eventDetailReportingContainer.querySelector('#input-reporter-entity-' + indexRepLoc) as HTMLSelectElement;
|
|
18868
|
+
let selectReportingLocation = eventDetailReportingContainer.querySelector('#input-reporter-location-' + indexRepLoc) as HTMLSelectElement;
|
|
18869
|
+
selectReportingEntity.innerHTML = '';
|
|
18870
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18871
|
+
if (country == "roles") {
|
|
18872
|
+
continue;
|
|
18873
|
+
}
|
|
18874
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18875
|
+
let entityName = entity.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18876
|
+
let option = new Option(entityName, entity)
|
|
18877
|
+
selectReportingEntity.add(option);
|
|
18878
|
+
}
|
|
18879
|
+
}
|
|
18880
|
+
selectReportingEntity.addEventListener('change', (e: any) => {
|
|
18881
|
+
selectReportingLocation.innerHTML = ''
|
|
18882
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18883
|
+
if (country == "roles") {
|
|
18884
|
+
continue;
|
|
18885
|
+
}
|
|
18886
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18887
|
+
if (entity.indexOf(e.target.value) < 0) {
|
|
18888
|
+
continue;
|
|
18889
|
+
}
|
|
18890
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18891
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18892
|
+
let option = new Option(locationName, location)
|
|
18893
|
+
selectReportingLocation.add(option);
|
|
18894
|
+
}
|
|
18895
|
+
}
|
|
18896
|
+
}
|
|
18897
|
+
(eventDetailReportingContainer.querySelector('#reporting-location-container-' + indexRepLoc) as HTMLDivElement).classList.remove('hide')
|
|
18898
|
+
selectReportingLocation.value = event.reportedlocations != null ? (Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations) : "";
|
|
18899
|
+
})
|
|
18900
|
+
|
|
18901
|
+
if(selectReportingLocation.innerHTML == ''){
|
|
18902
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18903
|
+
if (country == "roles") {
|
|
18904
|
+
continue;
|
|
18905
|
+
}
|
|
18906
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18907
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18908
|
+
let locationName = location.split(';')[0].replace(/ *\([^)]*\) */g, "")
|
|
18909
|
+
let option = new Option(locationName, location)
|
|
18910
|
+
selectReportingLocation.add(option);
|
|
18911
|
+
break;
|
|
18912
|
+
}
|
|
18913
|
+
break;
|
|
18914
|
+
}
|
|
18915
|
+
break;
|
|
18916
|
+
}
|
|
18917
|
+
}
|
|
18918
|
+
selectReportingLocation.addEventListener('change', (e: any) => {
|
|
18919
|
+
let index = parseInt(e.target.id.split('-')[3])
|
|
18920
|
+
this.reportedLocationsVals[index] = e.target.value
|
|
18921
|
+
})
|
|
18922
|
+
if (event.reportedlocations != null && event.reportedlocations.length > 0) {
|
|
18923
|
+
console.log('setting reportedlocations', event.reportedlocations)
|
|
18924
|
+
let tempReportedLocation = Util.isJSONParsable(event.reportedlocations) ? JSON.parse(event.reportedlocations)[indexRepLoc] : event.reportedlocations
|
|
18925
|
+
for (let country of Object.keys(projectUserMap)) {
|
|
18926
|
+
if (country == "roles") {
|
|
18927
|
+
continue;
|
|
18928
|
+
}
|
|
18929
|
+
for (let entity of Object.keys(projectUserMap[country])) {
|
|
18930
|
+
let flagSetVal = false;
|
|
18931
|
+
for (let location of Object.keys(projectUserMap[country][entity])) {
|
|
18932
|
+
if (tempReportedLocation.indexOf(location) >= 0) {
|
|
18933
|
+
selectReportingEntity.value = entity;
|
|
18934
|
+
const changeEvent = new Event('change', { bubbles: true });
|
|
18935
|
+
selectReportingEntity.dispatchEvent(changeEvent)
|
|
18936
|
+
selectReportingLocation.value = location;
|
|
18937
|
+
flagSetVal = true;
|
|
18938
|
+
break;
|
|
18939
|
+
}
|
|
18940
|
+
}
|
|
18941
|
+
if (flagSetVal) {
|
|
18942
|
+
break;
|
|
18943
|
+
}
|
|
18944
|
+
}
|
|
18945
|
+
}
|
|
18946
|
+
} else {
|
|
18947
|
+
selectReportingEntity.value = "";
|
|
18948
|
+
selectReportingLocation.value = "";
|
|
18949
|
+
}
|
|
18950
|
+
}
|
|
18951
|
+
|
|
18952
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-approve')?.addEventListener('click', async (ev: any) => {
|
|
18953
|
+
let buttonClick = ev.target as HTMLButtonElement
|
|
18954
|
+
buttonClick.innerHTML = "Saving..."
|
|
18955
|
+
const comments = (eventDetailReportingContainer.querySelector('#input-approver-comments') as HTMLInputElement).value;
|
|
18956
|
+
console.log('comments', comments, JSON.stringify(event.comments))
|
|
18957
|
+
const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
|
|
18958
|
+
let currStatus = this.getCompletenessStatus(event);
|
|
18959
|
+
let newEvent = { ...event };
|
|
18960
|
+
newEvent.comments = comments;
|
|
18961
|
+
newEvent.approved = approved;
|
|
18962
|
+
let newStatus = this.getCompletenessStatus(newEvent);
|
|
18963
|
+
if (currStatus == newStatus) {
|
|
18964
|
+
buttonClick.innerHTML = "Save"
|
|
18965
|
+
this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
|
|
18692
18966
|
setTimeout(() => {
|
|
18693
18967
|
this.clearMessages();
|
|
18694
18968
|
}, 3000);
|
|
18695
18969
|
return;
|
|
18696
18970
|
}
|
|
18697
|
-
var clickEvent = new MouseEvent("click", {
|
|
18698
|
-
"view": window,
|
|
18699
|
-
"bubbles": true,
|
|
18700
|
-
"cancelable": false
|
|
18701
|
-
});
|
|
18702
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18703
|
-
|
|
18704
|
-
// await this.uploadReview(entityId, locationId, mmddyyyy, event["id"], comments, approved)
|
|
18705
18971
|
let flagBulk = false;
|
|
18706
18972
|
if (this.selectedItemIds.length <= 1) {
|
|
18707
|
-
|
|
18708
|
-
if (await this.uploadReview(
|
|
18973
|
+
console.log('selectedevent', JSON.stringify(event));
|
|
18974
|
+
if (await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
|
|
18709
18975
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18710
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid ==
|
|
18711
|
-
|
|
18976
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
18712
18977
|
this.events[mmdd][p].approved = approved
|
|
18978
|
+
console.log('selected event', this.events[mmdd][p]);
|
|
18713
18979
|
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
18714
18980
|
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
18981
|
+
if (approved) {
|
|
18982
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
|
|
18983
|
+
}
|
|
18715
18984
|
}
|
|
18716
18985
|
}
|
|
18717
18986
|
if (this.recentlyReported[mmdd] == null) {
|
|
@@ -18725,8 +18994,8 @@ export class SfIEvents extends LitElement {
|
|
|
18725
18994
|
|
|
18726
18995
|
const selectedId = this.selectedItemIds[k];
|
|
18727
18996
|
//console.log('selectedid', selectedId);
|
|
18728
|
-
|
|
18729
|
-
|
|
18997
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18998
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18730
18999
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18731
19000
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18732
19001
|
|
|
@@ -18739,8 +19008,8 @@ export class SfIEvents extends LitElement {
|
|
|
18739
19008
|
"eventid": eventId,
|
|
18740
19009
|
"comments": comments,
|
|
18741
19010
|
"approved": approved,
|
|
18742
|
-
"entityid":
|
|
18743
|
-
"locationid":
|
|
19011
|
+
"entityid": entityid,
|
|
19012
|
+
"locationid": locationid,
|
|
18744
19013
|
"username": this.userName,
|
|
18745
19014
|
"userid": this.userProfileId,
|
|
18746
19015
|
"userrole": this.myRole,
|
|
@@ -18760,17 +19029,16 @@ export class SfIEvents extends LitElement {
|
|
|
18760
19029
|
|
|
18761
19030
|
const selectedId = this.selectedItemIds[k];
|
|
18762
19031
|
//console.log('selectedid', selectedId);
|
|
18763
|
-
|
|
18764
|
-
|
|
19032
|
+
let entityid = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19033
|
+
let locationid = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18765
19034
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18766
19035
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18767
19036
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18768
19037
|
if (this.mode == "next") {
|
|
18769
19038
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
18770
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == eventId && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
18771
|
-
|
|
18772
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19039
|
+
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) {
|
|
18773
19040
|
flagBulk = true;
|
|
19041
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18774
19042
|
if (this.recentlyReported[mmdd] == null) {
|
|
18775
19043
|
this.recentlyReported[mmdd] = []
|
|
18776
19044
|
}
|
|
@@ -18779,10 +19047,10 @@ export class SfIEvents extends LitElement {
|
|
|
18779
19047
|
}
|
|
18780
19048
|
} else {
|
|
18781
19049
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18782
|
-
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid ==
|
|
19050
|
+
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationid && this.events[mmdd][p].entityid == entityid) {
|
|
18783
19051
|
|
|
18784
19052
|
this.events[mmdd][p].isbulk = true
|
|
18785
|
-
flagBulk = true
|
|
19053
|
+
flagBulk = true
|
|
18786
19054
|
if (this.recentlyReported[mmdd] == null) {
|
|
18787
19055
|
this.recentlyReported[mmdd] = []
|
|
18788
19056
|
}
|
|
@@ -18796,7 +19064,7 @@ export class SfIEvents extends LitElement {
|
|
|
18796
19064
|
if (this.mode == "next") {
|
|
18797
19065
|
// this.fetchNext(this.nextPage)
|
|
18798
19066
|
// this.renderRoleTabsNext(this.nextPage)
|
|
18799
|
-
this.renderNextEvents(this.nextEvents, this.nextPage, this.
|
|
19067
|
+
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
|
|
18800
19068
|
} else {
|
|
18801
19069
|
// if(this.getCurrentTab() == this.TAB_CUSTOM) {
|
|
18802
19070
|
// this.processDateSelection((this._SfCustomContainer as HTMLDivElement));
|
|
@@ -18808,41 +19076,19 @@ export class SfIEvents extends LitElement {
|
|
|
18808
19076
|
if (this.selectedItemIds.length > 0) {
|
|
18809
19077
|
await this.fetchBulkReportingData();
|
|
18810
19078
|
}
|
|
19079
|
+
console.log('events', this.events);
|
|
18811
19080
|
this.renderAppropriateStream(this.sdate, this.edate, true, flagBulk);
|
|
18812
|
-
var clickEvent = new MouseEvent("click", {
|
|
18813
|
-
"view": window,
|
|
18814
|
-
"bubbles": true,
|
|
18815
|
-
"cancelable": false
|
|
18816
|
-
});
|
|
18817
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)?.dispatchEvent(clickEvent);
|
|
18818
|
-
|
|
18819
|
-
// if(currentColumnButton != null) {
|
|
18820
|
-
// currentColumnButton.click();
|
|
18821
|
-
// }
|
|
18822
19081
|
}
|
|
18823
19082
|
}
|
|
18824
19083
|
|
|
18825
19084
|
});
|
|
18826
19085
|
|
|
18827
|
-
|
|
19086
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-audit')?.addEventListener('click', async (ev: any) => {
|
|
18828
19087
|
let buttonClick = ev.target as HTMLButtonElement
|
|
18829
19088
|
buttonClick.innerHTML = "Saving..."
|
|
18830
|
-
const comments
|
|
18831
|
-
const approved = (
|
|
18832
|
-
|
|
18833
|
-
let newEvent = { ...event };
|
|
18834
|
-
newEvent.comments = comments;
|
|
18835
|
-
newEvent.approved = approved;
|
|
18836
|
-
let newStatus = this.getCompletenessStatus(newEvent);
|
|
18837
|
-
console.log('status', currStatus, newStatus)
|
|
18838
|
-
if (currStatus == newStatus) {
|
|
18839
|
-
buttonClick.innerHTML = "Save"
|
|
18840
|
-
this.setError(approved ? 'Already Approved!' : 'Already Rejected!');
|
|
18841
|
-
setTimeout(() => {
|
|
18842
|
-
this.clearMessages();
|
|
18843
|
-
}, 3000);
|
|
18844
|
-
return;
|
|
18845
|
-
}
|
|
19089
|
+
const comments = (eventDetailReportingContainer.querySelector('#input-auditor-comments') as HTMLInputElement).value;
|
|
19090
|
+
const approved = (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked;
|
|
19091
|
+
|
|
18846
19092
|
if (comments.trim().length === 0) {
|
|
18847
19093
|
buttonClick.innerHTML = "Save"
|
|
18848
19094
|
this.setError('Comments cannot be blank!');
|
|
@@ -18853,22 +19099,14 @@ export class SfIEvents extends LitElement {
|
|
|
18853
19099
|
} else {
|
|
18854
19100
|
let flagBulk = false;
|
|
18855
19101
|
if (this.selectedItemIds.length <= 1) {
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
this.
|
|
18864
|
-
}
|
|
18865
|
-
}
|
|
18866
|
-
} else {
|
|
18867
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
18868
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
18869
|
-
this.events[mmdd][p].approved = approved
|
|
18870
|
-
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
18871
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19102
|
+
if (await this.uploadAudit(event.entityid, event.locationid, mmddyyyy, event["id"], comments, approved, event.module ?? "compliance")) {
|
|
19103
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19104
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19105
|
+
this.events[mmdd][p].approved = approved
|
|
19106
|
+
this.events[mmdd][p].comments.push({ 'author': 'Auditor', 'comment': comments + ` (Approved: ${approved ? 'Yes' : 'No'})`, 'timestamp': new Date().toString() })
|
|
19107
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19108
|
+
if (approved) {
|
|
19109
|
+
this.events[mmdd][p].dateofcompletion = new Date().getTime() + ""
|
|
18872
19110
|
}
|
|
18873
19111
|
}
|
|
18874
19112
|
}
|
|
@@ -18884,8 +19122,8 @@ export class SfIEvents extends LitElement {
|
|
|
18884
19122
|
const selectedId = this.selectedItemIds[k];
|
|
18885
19123
|
//console.log('selectedid', selectedId);
|
|
18886
19124
|
|
|
18887
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18888
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19125
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19126
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18889
19127
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18890
19128
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18891
19129
|
|
|
@@ -18914,21 +19152,20 @@ export class SfIEvents extends LitElement {
|
|
|
18914
19152
|
|
|
18915
19153
|
const selectedId = this.selectedItemIds[k];
|
|
18916
19154
|
//console.log('selectedid', selectedId);
|
|
18917
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
18918
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19155
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19156
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
18919
19157
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
18920
19158
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
18921
19159
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
18922
19160
|
if (this.mode == "next") {
|
|
18923
19161
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
18924
19162
|
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) {
|
|
18925
|
-
|
|
18926
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18927
19163
|
flagBulk = true;
|
|
19164
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
18928
19165
|
if (this.recentlyReported[mmdd] == null) {
|
|
18929
19166
|
this.recentlyReported[mmdd] = []
|
|
18930
19167
|
}
|
|
18931
|
-
this.recentlyReported[mmdd].push(this.
|
|
19168
|
+
this.recentlyReported[mmdd].push(this.nextEvents[this.nextTabRole][mmdd][p])
|
|
18932
19169
|
}
|
|
18933
19170
|
}
|
|
18934
19171
|
} else {
|
|
@@ -18945,15 +19182,7 @@ export class SfIEvents extends LitElement {
|
|
|
18945
19182
|
}
|
|
18946
19183
|
}
|
|
18947
19184
|
}
|
|
18948
|
-
|
|
18949
19185
|
}
|
|
18950
|
-
|
|
18951
|
-
var clickEvent = new MouseEvent("click", {
|
|
18952
|
-
"view": window,
|
|
18953
|
-
"bubbles": true,
|
|
18954
|
-
"cancelable": false
|
|
18955
|
-
});
|
|
18956
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-detail-close') as HTMLButtonElement)!.dispatchEvent(clickEvent);
|
|
18957
19186
|
if (this.mode == "next") {
|
|
18958
19187
|
// this.fetchNext(this.nextPage, this.nextTabRole, this.nextTabStatus)
|
|
18959
19188
|
this.renderNextEvents(this.nextEvents, this.nextPage, this.nextTabRole)
|
|
@@ -18982,42 +19211,42 @@ export class SfIEvents extends LitElement {
|
|
|
18982
19211
|
});
|
|
18983
19212
|
|
|
18984
19213
|
if (this.myRole == this.TAB_REPORTER || this.myRole == this.TAB_FUNCTION_HEAD) {
|
|
19214
|
+
if (event.approved) {
|
|
18985
19215
|
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
if (((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
18989
|
-
((this._SfDetailContainer as HTMLDivElement).querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
|
|
19216
|
+
if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
19217
|
+
(eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'hidden';
|
|
18990
19218
|
}
|
|
18991
19219
|
|
|
18992
19220
|
|
|
18993
19221
|
} else {
|
|
18994
19222
|
|
|
18995
|
-
if ((
|
|
19223
|
+
if ((eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement) != null) {
|
|
18996
19224
|
|
|
18997
19225
|
|
|
18998
|
-
(
|
|
19226
|
+
(eventDetailReportingContainer.querySelector('#button-uploader-submit-report') as HTMLElement).style.visibility = 'visible';
|
|
18999
19227
|
|
|
19000
|
-
|
|
19228
|
+
eventDetailReportingContainer.querySelector('#button-uploader-submit-report')?.addEventListener('click', async (ev: any) => {
|
|
19001
19229
|
let buttonClick = ev.target as HTMLButtonElement
|
|
19002
19230
|
buttonClick.innerHTML = "Saving..."
|
|
19003
|
-
const reportercomments = (
|
|
19231
|
+
const reportercomments = (eventDetailReportingContainer.querySelector('#input-reporter-comments') as HTMLInputElement).value;
|
|
19004
19232
|
|
|
19005
19233
|
//console.log('reporter comments 1', reportercomments);
|
|
19006
19234
|
|
|
19007
|
-
const reporterdoc = (
|
|
19235
|
+
const reporterdoc = (eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value.length > 0 ? (new Date((eventDetailReportingContainer.querySelector('#input-reporter-doc') as HTMLInputElement).value).getTime() + "") : "";
|
|
19008
19236
|
let docs: any[] = [];
|
|
19009
19237
|
|
|
19010
19238
|
//console.log('reporter comments 2', reportercomments);
|
|
19239
|
+
|
|
19240
|
+
// if(docsOptional.length === 0) {
|
|
19011
19241
|
let percentage: string = "100";
|
|
19012
|
-
if ((
|
|
19013
|
-
percentage = (
|
|
19242
|
+
if ((eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement) != null) {
|
|
19243
|
+
percentage = (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value
|
|
19014
19244
|
}
|
|
19015
|
-
// if(docsOptional.length === 0) {
|
|
19016
19245
|
docs = (this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.selectedValues();
|
|
19017
19246
|
// }
|
|
19018
19247
|
let flag = false;
|
|
19019
19248
|
do {
|
|
19020
|
-
if (docs.length > 0 && docsOptional != null && docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19249
|
+
if (docs.length > 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19021
19250
|
for (let doc of docs) {
|
|
19022
19251
|
if ((doc.jobId == null || doc.jobId.length === 0) && (doc.ext.toLowerCase() == 'pdf' || doc.ext.toLowerCase() == 'png' || doc.ext.toLowerCase() == 'jpeg' || doc.ext.toLowerCase() == 'jpg')) {
|
|
19023
19252
|
flag = false
|
|
@@ -19042,7 +19271,7 @@ export class SfIEvents extends LitElement {
|
|
|
19042
19271
|
reportformatschema = (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting)!.configjson ?? "";
|
|
19043
19272
|
}
|
|
19044
19273
|
|
|
19045
|
-
|
|
19274
|
+
console.log('percentage', percentage, (eventDetailReportingContainer.querySelector('#input-reporter-percentage') as HTMLInputElement).value);
|
|
19046
19275
|
if (Number.isNaN(parseInt(percentage)) || parseInt(percentage) < 0 || parseInt(percentage) > 100) {
|
|
19047
19276
|
|
|
19048
19277
|
//console.log('reporter comments 3', reportercomments);
|
|
@@ -19053,7 +19282,7 @@ export class SfIEvents extends LitElement {
|
|
|
19053
19282
|
}, 3000);
|
|
19054
19283
|
|
|
19055
19284
|
} else {
|
|
19056
|
-
if (docs.length
|
|
19285
|
+
if (docs.length == 0 && event.docsOptional != null && event.docsOptional.length === 0 && parseInt(percentage) > 0) {
|
|
19057
19286
|
|
|
19058
19287
|
//console.log('reporter comments 3', reportercomments);
|
|
19059
19288
|
buttonClick.innerHTML = "Save"
|
|
@@ -19092,68 +19321,76 @@ export class SfIEvents extends LitElement {
|
|
|
19092
19321
|
}, 3000);
|
|
19093
19322
|
|
|
19094
19323
|
} else {
|
|
19324
|
+
let flagBulk = false;
|
|
19325
|
+
// let reportedlocations = selectReportingLocation?.value ?? "";
|
|
19326
|
+
let reportedlocations = "[]";
|
|
19327
|
+
if (parseInt(percentage) !== 100) {
|
|
19328
|
+
let selectReportedLocations = (eventDetailReportingContainer.querySelectorAll('.input-reporter-location') as NodeListOf<HTMLSelectElement>);
|
|
19329
|
+
for (let selectReportedLocation of selectReportedLocations) {
|
|
19330
|
+
reportedlocations = JSON.stringify([...JSON.parse(reportedlocations), selectReportedLocation.value])
|
|
19331
|
+
}
|
|
19332
|
+
}
|
|
19333
|
+
if (this.selectedItemIds.length <= 1) {
|
|
19095
19334
|
|
|
19335
|
+
if (await this.uploadReport(event.entityid, event.locationid, mmddyyyy, event["id"], reportercomments, reporterdoc, docs, event, reportformatvalues, reportformatschema, event.module ?? "compliance", percentage, event.makercheckers, reportedlocations)) {
|
|
19096
19336
|
|
|
19097
|
-
|
|
19098
|
-
|
|
19099
|
-
|
|
19100
|
-
|
|
19101
|
-
|
|
19337
|
+
if (this.mode != "next") {
|
|
19338
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19339
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19340
|
+
this.events[mmdd][p].documents = docs
|
|
19341
|
+
this.events[mmdd][p].percentage = percentage
|
|
19342
|
+
this.events[mmdd][p].reportedlocations = reportedlocations
|
|
19343
|
+
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19344
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19345
|
+
}
|
|
19346
|
+
}
|
|
19102
19347
|
|
|
19103
|
-
|
|
19104
|
-
let flagBulk = false;
|
|
19105
|
-
let reportinglocation = selectReportingLocation.value;
|
|
19106
|
-
if (this.selectedItemIds.length <= 1) {
|
|
19348
|
+
if (event.makercheckers.length > 0) {
|
|
19107
19349
|
|
|
19108
|
-
|
|
19109
|
-
|
|
19110
|
-
|
|
19111
|
-
|
|
19112
|
-
|
|
19350
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
19351
|
+
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19352
|
+
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == event.locationid && this.events[mmdd][p].entityid == event.entityid) {
|
|
19353
|
+
this.events[mmdd][p].approved = true
|
|
19354
|
+
// this.events[mmdd][p].documents = docs
|
|
19355
|
+
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19356
|
+
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19357
|
+
}
|
|
19358
|
+
}
|
|
19359
|
+
}
|
|
19360
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
19361
|
+
this.recentlyReported[mmdd] = []
|
|
19362
|
+
}
|
|
19363
|
+
this.recentlyReported[mmdd].push(event)
|
|
19364
|
+
console.log('recently reported', this.recentlyReported)
|
|
19365
|
+
} else {
|
|
19113
19366
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19114
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
19367
|
+
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) {
|
|
19115
19368
|
this.nextEvents[this.nextTabRole][mmdd][p].documents = docs
|
|
19369
|
+
this.nextEvents[this.nextTabRole][mmdd][p].percentage = percentage
|
|
19370
|
+
this.nextEvents[this.nextTabRole][mmdd][p].reportedlocations = reportedlocations
|
|
19116
19371
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19117
19372
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
19118
19373
|
}
|
|
19119
19374
|
}
|
|
19120
|
-
} else {
|
|
19121
|
-
console.log('this.events', this.events);
|
|
19122
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19123
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19124
|
-
this.events[mmdd][p].documents = docs
|
|
19125
|
-
this.events[mmdd][p].comments.push({ 'author': 'Reporter', 'comment': reportercomments + ` (Documents Saved: ${docs.length}})`, 'timestamp': new Date().toString() })
|
|
19126
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19127
|
-
}
|
|
19128
|
-
}
|
|
19129
|
-
}
|
|
19130
|
-
if (makercheckers.length > 0) {
|
|
19131
19375
|
|
|
19132
|
-
|
|
19133
|
-
|
|
19376
|
+
if (event.makercheckers.length > 0) {
|
|
19377
|
+
|
|
19378
|
+
// await this.uploadReview(event.entityid, event.locationid, mmddyyyy, event["id"], "Auto approved", true, event.module ?? "compliance");
|
|
19134
19379
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19135
|
-
if (this.nextEvents[this.nextTabRole][mmdd][p].id == event.id && this.nextEvents[this.nextTabRole][mmdd][p].locationid ==
|
|
19380
|
+
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) {
|
|
19136
19381
|
this.nextEvents[this.nextTabRole][mmdd][p].approved = true
|
|
19137
19382
|
// this.events[mmdd][p].documents = docs
|
|
19138
19383
|
this.nextEvents[this.nextTabRole][mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19139
19384
|
this.nextEvents[this.nextTabRole][mmdd][p].lastupdated = new Date().toString()
|
|
19140
19385
|
}
|
|
19141
19386
|
}
|
|
19142
|
-
} else {
|
|
19143
|
-
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19144
|
-
if (this.events[mmdd][p].id == event.id && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19145
|
-
this.events[mmdd][p].approved = true
|
|
19146
|
-
// this.events[mmdd][p].documents = docs
|
|
19147
|
-
this.events[mmdd][p].comments.push({ 'author': 'Approver', 'comment': `Auto approved (Approved: Yes})`, 'timestamp': new Date().toString() })
|
|
19148
|
-
this.events[mmdd][p].lastupdated = new Date().toString()
|
|
19149
|
-
}
|
|
19150
|
-
}
|
|
19151
19387
|
}
|
|
19388
|
+
if (this.recentlyReported[mmdd] == null) {
|
|
19389
|
+
this.recentlyReported[mmdd] = []
|
|
19390
|
+
}
|
|
19391
|
+
this.recentlyReported[mmdd].push(event)
|
|
19392
|
+
console.log('recently reported', this.recentlyReported)
|
|
19152
19393
|
}
|
|
19153
|
-
if (this.recentlyReported[mmdd] == null) {
|
|
19154
|
-
this.recentlyReported[mmdd] = []
|
|
19155
|
-
}
|
|
19156
|
-
this.recentlyReported[mmdd].push(event)
|
|
19157
19394
|
}
|
|
19158
19395
|
} else {
|
|
19159
19396
|
let bulkBody = []
|
|
@@ -19164,31 +19401,13 @@ export class SfIEvents extends LitElement {
|
|
|
19164
19401
|
//console.log('selectedid', selectedId);
|
|
19165
19402
|
|
|
19166
19403
|
const makercheckersL = selectedId.split('-')[5];
|
|
19167
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19168
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19404
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19405
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19169
19406
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
19170
19407
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
19171
19408
|
|
|
19172
19409
|
//console.log(entityId, locationId, eventId, mmddyyyy);
|
|
19173
|
-
|
|
19174
|
-
// "mmddyyyy": mmddyyyy,
|
|
19175
|
-
// "projectid": this.projectId,
|
|
19176
|
-
// "type": "report",
|
|
19177
|
-
// "eventid": eventId,
|
|
19178
|
-
// "comments": reportercomments,
|
|
19179
|
-
// "dateofcompletion": reporterdoc,
|
|
19180
|
-
// "entityid": entityId,
|
|
19181
|
-
// "locationid": locationId,
|
|
19182
|
-
// "event": null,
|
|
19183
|
-
// "docs": JSON.stringify(docs),
|
|
19184
|
-
// "username": this.userName,
|
|
19185
|
-
// "reportformatvalues": reportformatvalues,
|
|
19186
|
-
// "reportformatschema": reportformatschema,
|
|
19187
|
-
// "userid": this.userProfileId,
|
|
19188
|
-
// "userrole": this.myRole,
|
|
19189
|
-
// "year": this.calendarStartYYYY,
|
|
19190
|
-
// "module": event.module ?? "compliance"
|
|
19191
|
-
// })
|
|
19410
|
+
|
|
19192
19411
|
// await this.uploadReport(entityId, locationId, mmddyyyy, eventId, reportercomments, reporterdoc, docs, null)
|
|
19193
19412
|
// if(parseInt(makercheckersL) > 0) {
|
|
19194
19413
|
// bulkBodyReview.push({
|
|
@@ -19224,7 +19443,7 @@ export class SfIEvents extends LitElement {
|
|
|
19224
19443
|
"comments": reportercomments,
|
|
19225
19444
|
"dateofcompletion": reporterdoc,
|
|
19226
19445
|
"percentage": percentage,
|
|
19227
|
-
"
|
|
19446
|
+
"reportedlocations": reportedlocations,
|
|
19228
19447
|
"entityid": entityId,
|
|
19229
19448
|
"locationid": locationId,
|
|
19230
19449
|
"event": null,
|
|
@@ -19245,11 +19464,13 @@ export class SfIEvents extends LitElement {
|
|
|
19245
19464
|
// this.clearMessages();
|
|
19246
19465
|
|
|
19247
19466
|
}
|
|
19467
|
+
// await this.uploadReportsBulk(bulkBody);
|
|
19248
19468
|
|
|
19469
|
+
// await this.fetchBulkReportingData();
|
|
19249
19470
|
if (bulkBody.length > 0) {
|
|
19250
19471
|
await this.uploadReportsBulk(bulkBody, bulkBodyReview.length == 0);
|
|
19251
19472
|
}
|
|
19252
|
-
|
|
19473
|
+
|
|
19253
19474
|
// if(bulkBodyReview.length > 0){
|
|
19254
19475
|
// await this.uploadReportsReviewsBulk(bulkBodyReview)
|
|
19255
19476
|
// }
|
|
@@ -19257,17 +19478,16 @@ export class SfIEvents extends LitElement {
|
|
|
19257
19478
|
|
|
19258
19479
|
const selectedId = this.selectedItemIds[k];
|
|
19259
19480
|
//console.log('selectedid', selectedId);
|
|
19260
|
-
entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19261
|
-
locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19481
|
+
let entityId = selectedId.split('-')[7].replace(/_/g, '-');
|
|
19482
|
+
let locationId = selectedId.split('-')[8].replace(/_/g, '-');
|
|
19262
19483
|
const eventId = selectedId.split('-')[9].replace(/_/g, '-');
|
|
19263
19484
|
mmddyyyy = selectedId.split('-')[10] + '/' + selectedId.split('-')[11] + '/' + selectedId.split('-')[12];
|
|
19264
19485
|
let mmdd = mmddyyyy.split('/')[0] + '/' + mmddyyyy.split('/')[1]
|
|
19265
19486
|
if (this.mode == "next") {
|
|
19266
19487
|
for (var p = 0; p < this.nextEvents[this.nextTabRole][mmdd].length; p++) {
|
|
19267
19488
|
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) {
|
|
19268
|
-
|
|
19269
|
-
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19270
19489
|
flagBulk = true;
|
|
19490
|
+
this.nextEvents[this.nextTabRole][mmdd][p].isbulk = true
|
|
19271
19491
|
if (this.recentlyReported[mmdd] == null) {
|
|
19272
19492
|
this.recentlyReported[mmdd] = []
|
|
19273
19493
|
}
|
|
@@ -19277,9 +19497,8 @@ export class SfIEvents extends LitElement {
|
|
|
19277
19497
|
} else {
|
|
19278
19498
|
for (var p = 0; p < this.events[mmdd].length; p++) {
|
|
19279
19499
|
if (this.events[mmdd][p].id == eventId && this.events[mmdd][p].locationid == locationId && this.events[mmdd][p].entityid == entityId) {
|
|
19280
|
-
|
|
19281
|
-
this.events[mmdd][p].isbulk = true
|
|
19282
19500
|
flagBulk = true;
|
|
19501
|
+
this.events[mmdd][p].isbulk = true
|
|
19283
19502
|
if (this.recentlyReported[mmdd] == null) {
|
|
19284
19503
|
this.recentlyReported[mmdd] = []
|
|
19285
19504
|
}
|
|
@@ -19288,7 +19507,6 @@ export class SfIEvents extends LitElement {
|
|
|
19288
19507
|
}
|
|
19289
19508
|
}
|
|
19290
19509
|
}
|
|
19291
|
-
|
|
19292
19510
|
}
|
|
19293
19511
|
|
|
19294
19512
|
if (this.mode == "next") {
|
|
@@ -19311,10 +19529,7 @@ export class SfIEvents extends LitElement {
|
|
|
19311
19529
|
// }
|
|
19312
19530
|
}
|
|
19313
19531
|
}
|
|
19314
|
-
|
|
19315
19532
|
}
|
|
19316
|
-
|
|
19317
|
-
|
|
19318
19533
|
}
|
|
19319
19534
|
}
|
|
19320
19535
|
}
|
|
@@ -19327,37 +19542,44 @@ export class SfIEvents extends LitElement {
|
|
|
19327
19542
|
}
|
|
19328
19543
|
|
|
19329
19544
|
if (this._SfUploader[0] != null) {
|
|
19330
|
-
(
|
|
19545
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19546
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
|
|
19547
|
+
}
|
|
19331
19548
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisInProgress', (_ev: any) => {
|
|
19332
19549
|
console.log('uploader analysisInProgress', _ev);
|
|
19333
|
-
|
|
19550
|
+
|
|
19551
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19552
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "block"
|
|
19553
|
+
}
|
|
19334
19554
|
});
|
|
19335
19555
|
this._SfUploader[0].querySelector('#uploader').addEventListener('analysisCompleted', (_ev: any) => {
|
|
19336
19556
|
console.log('uploader analysisInProgress', _ev);
|
|
19337
|
-
if ((
|
|
19338
|
-
(
|
|
19557
|
+
if ((eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement) != null) {
|
|
19558
|
+
(eventDetailReportingContainer.querySelector('.uploader-analysis-message') as HTMLDivElement).style.display = "none"
|
|
19339
19559
|
}
|
|
19340
19560
|
});
|
|
19341
19561
|
|
|
19342
19562
|
|
|
19343
19563
|
//console.log('documentType checking', documentType);
|
|
19344
19564
|
|
|
19345
|
-
if (documentType != null) {
|
|
19346
|
-
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = documentType;
|
|
19565
|
+
if (event.documentType != null) {
|
|
19566
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = event.documentType;
|
|
19347
19567
|
} else {
|
|
19348
|
-
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = ""
|
|
19568
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.docType = "";
|
|
19349
19569
|
}
|
|
19350
19570
|
|
|
19351
19571
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify([]);
|
|
19352
19572
|
console.log('uploader', (this._SfUploader[0].querySelector('#uploader') as SfIUploader));
|
|
19573
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = 0;
|
|
19353
19574
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19354
19575
|
|
|
19355
19576
|
if (docs.length > 0) {
|
|
19356
19577
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.prepopulatedInputArr = JSON.stringify(docs);
|
|
19578
|
+
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.current = docs.length;
|
|
19357
19579
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19358
19580
|
}
|
|
19359
19581
|
|
|
19360
|
-
if (this.myRole == this.TAB_APPROVER || approved) {
|
|
19582
|
+
if (this.myRole == this.TAB_APPROVER || event.approved) {
|
|
19361
19583
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.readOnly = true;
|
|
19362
19584
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19363
19585
|
} else {
|
|
@@ -19368,8 +19590,8 @@ export class SfIEvents extends LitElement {
|
|
|
19368
19590
|
const dataPassthrough = {
|
|
19369
19591
|
projectId: this.projectId,
|
|
19370
19592
|
countryId: this.countryId,
|
|
19371
|
-
entityId:
|
|
19372
|
-
locationId:
|
|
19593
|
+
entityId: event.entityid,
|
|
19594
|
+
locationId: event.locationid,
|
|
19373
19595
|
mmddyyyy: mmddyyyy,
|
|
19374
19596
|
complianceId: event['id'],
|
|
19375
19597
|
path: "uploadextract"
|
|
@@ -19383,6 +19605,7 @@ export class SfIEvents extends LitElement {
|
|
|
19383
19605
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlHost = callbackUrlHost;
|
|
19384
19606
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.callbackUrlPath = callbackUrlPath;
|
|
19385
19607
|
(this._SfUploader[0].querySelector('#uploader') as SfIUploader)!.loadMode();
|
|
19608
|
+
console.log('uploader prepopulate', (this._SfUploader[0].querySelector('#uploader') as SfIUploader).prepopulatedInputArr, (this._SfUploader[0].querySelector('#uploader') as SfIUploader).extract)
|
|
19386
19609
|
|
|
19387
19610
|
}
|
|
19388
19611
|
|
|
@@ -19394,50 +19617,32 @@ export class SfIEvents extends LitElement {
|
|
|
19394
19617
|
if (event["approved"] != null) {
|
|
19395
19618
|
if (event["approved"] === true) {
|
|
19396
19619
|
//console.log('approved 2', event["approved"], this.myRole, this.TAB_APPROVER);
|
|
19397
|
-
if ((
|
|
19398
|
-
(
|
|
19620
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
|
|
19621
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = true;
|
|
19399
19622
|
}
|
|
19400
|
-
if ((
|
|
19401
|
-
(
|
|
19623
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19624
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = false;
|
|
19402
19625
|
}
|
|
19403
19626
|
} else {
|
|
19404
|
-
if ((
|
|
19405
|
-
(
|
|
19627
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement) != null) {
|
|
19628
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement)!.checked = false;
|
|
19406
19629
|
}
|
|
19407
|
-
if ((
|
|
19408
|
-
(
|
|
19630
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19631
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement)!.checked = true;
|
|
19409
19632
|
}
|
|
19410
19633
|
}
|
|
19411
19634
|
} else {
|
|
19412
|
-
if (
|
|
19413
|
-
(
|
|
19635
|
+
if (eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement != null) {
|
|
19636
|
+
(eventDetailReportingContainer.querySelector('#input-approve-yes') as HTMLInputElement).checked = false;
|
|
19414
19637
|
}
|
|
19415
|
-
if ((
|
|
19416
|
-
(
|
|
19638
|
+
if ((eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement) != null) {
|
|
19639
|
+
(eventDetailReportingContainer.querySelector('#input-approve-no') as HTMLInputElement).checked = true;
|
|
19417
19640
|
}
|
|
19418
|
-
|
|
19419
19641
|
}
|
|
19420
19642
|
}
|
|
19421
|
-
|
|
19422
19643
|
}
|
|
19423
|
-
|
|
19424
|
-
|
|
19425
|
-
console.log('customreporting', event['customreporting'])
|
|
19426
|
-
if (event['customreporting'] != null) {
|
|
19427
|
-
let reportingContainer = (this._SfDetailContainer as HTMLDivElement)
|
|
19428
|
-
if (reportingContainer.querySelector('#report-format-container') != null) {
|
|
19429
|
-
reportingContainer.querySelector('#report-format-container')!.innerHTML = `<slot name="reporting"></slot>`;
|
|
19430
|
-
console.log('innerhtml', reportingContainer.querySelector('#report-format-container')!.innerHTML);
|
|
19431
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).name = event.obligationtitle;
|
|
19432
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).mode = "edit";
|
|
19433
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).configjson = event['customreporting'];
|
|
19434
|
-
// if(reportformatvalues != ""){
|
|
19435
|
-
// (this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).prepopulateValJson = reportformatvalues
|
|
19436
|
-
// }
|
|
19437
|
-
(this._SfReporting[0].querySelector('#reporting-format') as SfIReporting).loadMode();
|
|
19438
|
-
}
|
|
19439
|
-
} else if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
19440
|
-
this.fetchReportFormat((this._SfDetailContainer as HTMLDivElement), reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
19644
|
+
if (event['reportformat'] != null && event['reportformat'].length > 0) {
|
|
19645
|
+
this.fetchReportFormat(eventDetailReportingContainer, reportformatName, event['reportformatschema'] ?? "", event['reportformatvalues'] ?? "");
|
|
19441
19646
|
}
|
|
19442
19647
|
}
|
|
19443
19648
|
|
|
@@ -27869,7 +28074,7 @@ export class SfIEvents extends LitElement {
|
|
|
27869
28074
|
}
|
|
27870
28075
|
}
|
|
27871
28076
|
|
|
27872
|
-
sendSuggestions = async (eventid: string, eventdelta:any) => {
|
|
28077
|
+
sendSuggestions = async (eventid: string, eventdelta: any) => {
|
|
27873
28078
|
let url = "https://" + this.apiIdRCMResources + "/sendsuggestions";
|
|
27874
28079
|
|
|
27875
28080
|
const body = {
|
|
@@ -29308,7 +29513,7 @@ export class SfIEvents extends LitElement {
|
|
|
29308
29513
|
let url = "https://" + this.apiId + "/markreviewed";
|
|
29309
29514
|
|
|
29310
29515
|
//console.log('fetch calendar url', url);
|
|
29311
|
-
let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark"
|
|
29516
|
+
let urlBody: any = { "projectid": this.projectId, "eventid": suspenseKey.split(';')[2], "entityid": suspenseKey.split(';')[0], "locationid": suspenseKey.split(';')[1], "year": year, "mark": review };
|
|
29312
29517
|
|
|
29313
29518
|
//console.log('urlbody', urlBody);
|
|
29314
29519
|
|
|
@@ -29516,7 +29721,7 @@ export class SfIEvents extends LitElement {
|
|
|
29516
29721
|
let path = "", view = "";
|
|
29517
29722
|
this.sdate = startDate;
|
|
29518
29723
|
this.edate = endDate;
|
|
29519
|
-
this.suspenseCount = 0;
|
|
29724
|
+
this.suspenseCount = this.suspenseFlag ? this.suspenseCount : 0;
|
|
29520
29725
|
if (this.tagId != null && this.tagId != "") {
|
|
29521
29726
|
view = "tag";
|
|
29522
29727
|
} else if (this.countryId != null && this.countryId != "") {
|
|
@@ -29570,7 +29775,7 @@ export class SfIEvents extends LitElement {
|
|
|
29570
29775
|
await this.fetchPresignedUrlDelete(jsonRespose.signedUrlDelete)
|
|
29571
29776
|
if (JSON.stringify(urlBody) == this.getallcountryevetsParams) {
|
|
29572
29777
|
this.lastupdated = Util.getDateTimeStrings(new Date().getTime())
|
|
29573
|
-
this.suspenseCount = jsonRespose.suspensecount ?? 0;
|
|
29778
|
+
this.suspenseCount = this.suspenseFlag ? this.suspenseCount : (jsonRespose.suspensecount ?? 0);
|
|
29574
29779
|
console.log('rendering appropriate string', list, this.selectedTab);
|
|
29575
29780
|
this.renderAppropriateStream(startDate, endDate, true);
|
|
29576
29781
|
this.fetchBulkReportingData();
|
|
@@ -31066,7 +31271,6 @@ export class SfIEvents extends LitElement {
|
|
|
31066
31271
|
let listReportingContainer = nextEventsContainer.querySelector('#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j) as HTMLDivElement
|
|
31067
31272
|
console.log('mmddyyyy', eventsData[role][mmdd][j], listReportingContainer, '#list-reporting-container-' + mmdd.replace(/\//g, '-') + '-' + j);
|
|
31068
31273
|
if (listReportingContainer.style.display == 'none' || listReportingContainer.style.display == '') {
|
|
31069
|
-
4
|
|
31070
31274
|
this.renderListReporting(listReportingContainer, eventsData[role][mmdd][j], mmdd + '/' + yyyy, nextEventsContainer)
|
|
31071
31275
|
} else {
|
|
31072
31276
|
listReportingContainer.innerHTML = '';
|