sf-i-events 1.0.953 → 1.0.955
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/index.html +4 -4
- package/package.json +1 -1
- package/sf-i-events.d.ts +9 -1
- package/sf-i-events.js +459 -28
- package/src/sf-i-events.ts +500 -4
- package/src/util.ts +1 -1
- package/util.js +1 -1
package/src/sf-i-events.ts
CHANGED
|
@@ -1711,6 +1711,15 @@ export class SfIEvents extends LitElement {
|
|
|
1711
1711
|
tablecols: string[] = []
|
|
1712
1712
|
|
|
1713
1713
|
reportedLocationsVals: any[] = []
|
|
1714
|
+
|
|
1715
|
+
minRiskMitigated: number = 0;
|
|
1716
|
+
minRiskResidual: number = 0;
|
|
1717
|
+
|
|
1718
|
+
maxRiskMitigated: number = 0;
|
|
1719
|
+
maxRiskResidual: number = 0;
|
|
1720
|
+
|
|
1721
|
+
finRiskCurrency: string = "";
|
|
1722
|
+
|
|
1714
1723
|
static override styles = css`
|
|
1715
1724
|
|
|
1716
1725
|
.bg-white {
|
|
@@ -4549,6 +4558,50 @@ export class SfIEvents extends LitElement {
|
|
|
4549
4558
|
html += '</div>';
|
|
4550
4559
|
html += '</div>';
|
|
4551
4560
|
html += '<div class="chart-container d-flex scroll-x align-center"><div part="chart-item" class="chart-item"><canvas id="myChart"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart4" class="gone"></canvas></div><div part="chart-item chart-item-middle" class="chart-item"><canvas id="myChart2" class="gone"></canvas></div><div part="chart-item" class="chart-item"><canvas id="myChart3" class="gone"></canvas></div></div>';
|
|
4561
|
+
html += '<div id="fin-risk-container" class="mt-20 w-100 d-flex align-end">'
|
|
4562
|
+
html += `
|
|
4563
|
+
<!-- Left Label -->
|
|
4564
|
+
<div class="d-flex align-end">
|
|
4565
|
+
<span part="financial-risk-title">Financial Risk</span>
|
|
4566
|
+
<sup part="financial-risk-currency">FIN_RISK_CURRENCY</sup>
|
|
4567
|
+
</div>
|
|
4568
|
+
|
|
4569
|
+
<!-- Lower (Residual / Pending Risk) -->
|
|
4570
|
+
<div class="d-flex align-end" part="financial-risk-section">
|
|
4571
|
+
<div part="financial-risk-limit-label" style="font-weight:700;font-size:15px;color:#000;">Lower</div>
|
|
4572
|
+
<div class="d-flex align-center">
|
|
4573
|
+
<div class="d-flex flex-col align-center">
|
|
4574
|
+
<span style="color:#555;font-weight:500;font-size:13px;">Addressed</span>
|
|
4575
|
+
<span style="font-weight:700;font-size:16px;color:#27ae60;">FIN_RISK_MITIGATED_MIN</span>
|
|
4576
|
+
</div>
|
|
4577
|
+
<div class="d-flex flex-col align-center">
|
|
4578
|
+
<span style="color:#555;font-weight:500;font-size:13px;">Pending</span>
|
|
4579
|
+
<span style="font-weight:700;font-size:16px;color:#a0005a;">FIN_RISK_RESIDUAL_MIN</span>
|
|
4580
|
+
</div>
|
|
4581
|
+
</div>
|
|
4582
|
+
</div>
|
|
4583
|
+
|
|
4584
|
+
<!-- Upper (Mitigated / Addressed Risk) -->
|
|
4585
|
+
<div class="d-flex align-end" part="financial-risk-section">
|
|
4586
|
+
<div part="financial-risk-limit-label" style="font-weight:700;font-size:15px;color:#000;">Upper</div>
|
|
4587
|
+
<div style="display:flex;align-items:center;gap:8px;">
|
|
4588
|
+
<div class="d-flex flex-col align-center">
|
|
4589
|
+
<span style="color:#555;font-weight:500;font-size:13px;">Addressed</span>
|
|
4590
|
+
<span style="font-weight:700;font-size:16px;color:#27ae60;">FIN_RISK_MITIGATED_MAX</span>
|
|
4591
|
+
</div>
|
|
4592
|
+
<div class="d-flex flex-col align-center">
|
|
4593
|
+
<span style="color:#555;font-weight:500;font-size:13px;">Pending</span>
|
|
4594
|
+
<span style="font-weight:700;font-size:16px;color:#a0005a;">FIN_RISK_RESIDUAL_MAX</span>
|
|
4595
|
+
</div>
|
|
4596
|
+
</div>
|
|
4597
|
+
</div>
|
|
4598
|
+
`
|
|
4599
|
+
// html += '<div part="" class="mb-5">Financial Risk</div>'
|
|
4600
|
+
// html += '<table class="w-100 text-center"><thead><tr><th part="financial-risk-header">Risk Status</th><th part="financial-risk-header" class="financial-risk-header">Minimum Risk</th><th part="financial-risk-header" class="financial-risk-header">Maximum Risk</th></tr></thead><tbody>'
|
|
4601
|
+
// html += '<tr><td>Residual</td><td>FIN_RISK_RESIDUAL_MIN</td><td>FIN_RISK_RESIDUAL_MAX</td></tr>'
|
|
4602
|
+
// html += '<tr><td>Mitigated</td><td>FIN_RISK_MITIGATED_MIN</td><td>FIN_RISK_MITIGATED_MAX</td></tr></tbody></table>'
|
|
4603
|
+
html += '</div>'
|
|
4604
|
+
|
|
4552
4605
|
html += '<div id="chart-settings-controls" class="mt-20"></div>'
|
|
4553
4606
|
html += '<div id="chart-settings"></div>'
|
|
4554
4607
|
} else {
|
|
@@ -5248,6 +5301,12 @@ export class SfIEvents extends LitElement {
|
|
|
5248
5301
|
|
|
5249
5302
|
var lastDay = iLast;
|
|
5250
5303
|
|
|
5304
|
+
this.minRiskMitigated = 0;
|
|
5305
|
+
this.minRiskResidual = 0;
|
|
5306
|
+
this.maxRiskMitigated = 0;
|
|
5307
|
+
this.maxRiskResidual = 0;
|
|
5308
|
+
this.finRiskCurrency = "";
|
|
5309
|
+
|
|
5251
5310
|
this.clearGraphData();
|
|
5252
5311
|
console.log('this.clearSelectedGraphParam(); 1', this.graphFilter);
|
|
5253
5312
|
this.clearSelectedGraphParam();
|
|
@@ -5284,6 +5343,16 @@ export class SfIEvents extends LitElement {
|
|
|
5284
5343
|
htmlSummaryCols += '<tr><th class="td-thin">Id</th><th class="td-wide">ObligationTitle</th><th class="td-wide">Status</th><th class="td-wide">Documents</th></tr>'
|
|
5285
5344
|
}
|
|
5286
5345
|
}
|
|
5346
|
+
let tempMinRiskMitigatedLocal = 0;
|
|
5347
|
+
let tempMinRiskResidualLocal = 0;
|
|
5348
|
+
let tempMaxRiskMitigatedLocal = 0;
|
|
5349
|
+
let tempMaxRiskResidualLocal = 0;
|
|
5350
|
+
let tempMinRiskMitigatedGlobal = 0;
|
|
5351
|
+
let tempMinRiskResidualGlobal = 0;
|
|
5352
|
+
let tempMaxRiskMitigatedGlobal = 0;
|
|
5353
|
+
let tempMaxRiskResidualGlobal = 0;
|
|
5354
|
+
this.finRiskCurrency = ""
|
|
5355
|
+
let flagGlobal = false;
|
|
5287
5356
|
for (var i = iInit; i <= iLast; i++) {
|
|
5288
5357
|
|
|
5289
5358
|
let mmdd: string = "";
|
|
@@ -5341,6 +5410,25 @@ export class SfIEvents extends LitElement {
|
|
|
5341
5410
|
}
|
|
5342
5411
|
// const tempEvents2 = JSON.parse(JSON.stringify(this.events));
|
|
5343
5412
|
// //console.log('eventlog2', tempEvents2['06/30'][7].comments, mmdd, j);
|
|
5413
|
+
if (this.finRiskCurrency == "") {
|
|
5414
|
+
this.finRiskCurrency = this.events[mmdd][j]['localcurrency'] ?? ""
|
|
5415
|
+
}
|
|
5416
|
+
if (this.finRiskCurrency != this.events[mmdd][j]['localcurrency'] && this.finRiskCurrency == "") {
|
|
5417
|
+
this.finRiskCurrency = this.events[mmdd][j]['globalcurrency'] ?? ""
|
|
5418
|
+
flagGlobal = true
|
|
5419
|
+
}
|
|
5420
|
+
|
|
5421
|
+
if (partStatus == "approved") {
|
|
5422
|
+
tempMinRiskMitigatedLocal = tempMinRiskMitigatedLocal + parseInt(this.events[mmdd][j]['minlocal'] ?? "0")
|
|
5423
|
+
tempMaxRiskMitigatedLocal = tempMaxRiskMitigatedLocal + parseInt(this.events[mmdd][j]['maxlocal'] ?? "0")
|
|
5424
|
+
tempMinRiskMitigatedGlobal = tempMinRiskMitigatedGlobal + parseInt(this.events[mmdd][j]['minglobal'] ?? "0")
|
|
5425
|
+
tempMaxRiskMitigatedGlobal = tempMaxRiskMitigatedGlobal + parseInt(this.events[mmdd][j]['maxglobal'] ?? "0")
|
|
5426
|
+
} else {
|
|
5427
|
+
tempMinRiskResidualLocal = tempMinRiskResidualLocal + parseInt(this.events[mmdd][j]['minlocal'] ?? "0")
|
|
5428
|
+
tempMaxRiskResidualLocal = tempMaxRiskResidualLocal + parseInt(this.events[mmdd][j]['maxlocal'] ?? "0")
|
|
5429
|
+
tempMinRiskResidualGlobal = tempMinRiskResidualGlobal + parseInt(this.events[mmdd][j]['minglobal'] ?? "0")
|
|
5430
|
+
tempMaxRiskResidualGlobal = tempMaxRiskResidualGlobal + parseInt(this.events[mmdd][j]['maxglobal'] ?? "0")
|
|
5431
|
+
}
|
|
5344
5432
|
|
|
5345
5433
|
notStarted = notStarted + (partStatus == "not-started" ? 1 : 0);
|
|
5346
5434
|
pendingApproval = pendingApproval + (partStatus == "pending-approval" ? 1 : 0);
|
|
@@ -5621,6 +5709,17 @@ export class SfIEvents extends LitElement {
|
|
|
5621
5709
|
|
|
5622
5710
|
html += this.renderCalendarContainerDivEnd();
|
|
5623
5711
|
|
|
5712
|
+
if (flagGlobal) {
|
|
5713
|
+
this.minRiskMitigated = tempMinRiskMitigatedGlobal
|
|
5714
|
+
this.maxRiskMitigated = tempMaxRiskMitigatedGlobal
|
|
5715
|
+
this.minRiskResidual = tempMinRiskResidualGlobal
|
|
5716
|
+
this.maxRiskResidual = tempMaxRiskResidualGlobal
|
|
5717
|
+
} else {
|
|
5718
|
+
this.minRiskMitigated = tempMinRiskMitigatedLocal
|
|
5719
|
+
this.maxRiskMitigated = tempMaxRiskMitigatedLocal
|
|
5720
|
+
this.minRiskResidual = tempMinRiskResidualLocal
|
|
5721
|
+
this.maxRiskResidual = tempMaxRiskResidualLocal
|
|
5722
|
+
}
|
|
5624
5723
|
//console.log('final risk severities', this.riskSeverityData);
|
|
5625
5724
|
|
|
5626
5725
|
//this.period = firstDay?.getDate() + '/' + (firstDay!.getMonth()+1) + '/' + firstDay?.getFullYear() + " - " + endDay?.getDate() + '/' + (endDay!.getMonth()+1) + '/' + endDay?.getFullYear();
|
|
@@ -5658,6 +5757,12 @@ export class SfIEvents extends LitElement {
|
|
|
5658
5757
|
html = html.replace("DASHBOARD_EXPIRED", expired + "");
|
|
5659
5758
|
html = html.replace("DASHBOARD_TERMINATED", terminated + "");
|
|
5660
5759
|
|
|
5760
|
+
html = html.replace("FIN_RISK_CURRENCY", this.finRiskCurrency);
|
|
5761
|
+
html = html.replace("FIN_RISK_RESIDUAL_MIN", this.formatIndianNumber(this.minRiskResidual));
|
|
5762
|
+
html = html.replace("FIN_RISK_RESIDUAL_MAX", this.formatIndianNumber(this.maxRiskResidual));
|
|
5763
|
+
html = html.replace("FIN_RISK_MITIGATED_MIN", this.formatIndianNumber(this.minRiskMitigated));
|
|
5764
|
+
html = html.replace("FIN_RISK_MITIGATED_MAX", this.formatIndianNumber(this.maxRiskMitigated));
|
|
5765
|
+
|
|
5661
5766
|
if (this.selectedFeatures.indexOf("contracts") >= 0) {
|
|
5662
5767
|
this.csvDataStats = 'Period,Total,Not Started,Approved,Pending Approval,Rejected,Past Due Date,Late Reported,Late Executed,Late Approved,Active,About To Expire,Expired,Terminated\n';
|
|
5663
5768
|
this.csvDataStats += this.period + "," + total + "," + notStarted + "," + approved + "," + pendingApproval + "," + rejected + "," + pastDueDate + "," + lateReported + "," + lateExecuted + "," + lateApproved + "," + active + "," + aboutToExpire + "," + expired + "," + terminated;
|
|
@@ -10367,9 +10472,10 @@ export class SfIEvents extends LitElement {
|
|
|
10367
10472
|
loadOnboardingSuspense = async () => {
|
|
10368
10473
|
this.hideTabContainers();
|
|
10369
10474
|
(this._SfOnboardingSuspenseContainer as HTMLDivElement).style.display = 'flex';
|
|
10475
|
+
const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
|
|
10370
10476
|
const suspenseList = await this.fetchSuspenseList();
|
|
10371
10477
|
console.log('suspenseList', suspenseList);
|
|
10372
|
-
this.renderOnboardingSuspense(suspenseList);
|
|
10478
|
+
this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList);
|
|
10373
10479
|
}
|
|
10374
10480
|
|
|
10375
10481
|
calculateStartAndEndDateOfPast = (index: number = 0) => {
|
|
@@ -22314,7 +22420,346 @@ export class SfIEvents extends LitElement {
|
|
|
22314
22420
|
|
|
22315
22421
|
}
|
|
22316
22422
|
|
|
22317
|
-
renderOnboardingSuspense = (
|
|
22423
|
+
renderOnboardingSuspense = (sourceArray: any, suspenseList: any) => {
|
|
22424
|
+
|
|
22425
|
+
console.log('sourceList', sourceArray);
|
|
22426
|
+
console.log('suspenseList', suspenseList);
|
|
22427
|
+
let sourceCols = ["shortid", "obligationtitle", "obligationtype"]
|
|
22428
|
+
let uniqCols = ["id", "entityname", "locationname"]
|
|
22429
|
+
let colName = 'suspense'
|
|
22430
|
+
var html: string = '';
|
|
22431
|
+
|
|
22432
|
+
html += '<div id="suspense-list-container" class="pb-10 pt-10 w-100">';
|
|
22433
|
+
|
|
22434
|
+
html += '<div class="d-flex justify-between flex-wrap align-center"> ';
|
|
22435
|
+
|
|
22436
|
+
var status = '';
|
|
22437
|
+
status = '<span class="color-done material-icons">check_circle</span>';
|
|
22438
|
+
let tagged = 0
|
|
22439
|
+
var changed = 0
|
|
22440
|
+
let tempSourceArray = sourceArray
|
|
22441
|
+
console.log('suspensekey length', tempSourceArray.data.mappings.mappings.length)
|
|
22442
|
+
for (let [itemIndex, item] of tempSourceArray.data.mappings.mappings.entries()) {
|
|
22443
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22444
|
+
console.log('suspensekey', suspenseKey, item)
|
|
22445
|
+
if (suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) {
|
|
22446
|
+
tagged++;
|
|
22447
|
+
}
|
|
22448
|
+
tempSourceArray.data.mappings.mappings[itemIndex].suspense = suspenseList[suspenseKey] != null
|
|
22449
|
+
if (this.changedOnboardingItemIds.indexOf(suspenseKey) >= 0) {
|
|
22450
|
+
changed++;
|
|
22451
|
+
}
|
|
22452
|
+
}
|
|
22453
|
+
|
|
22454
|
+
html += ('<div class="left-sticky d-flex justify-between align-center mr-10"><h4 id="mapped-stats-title" part="results-title" class="d-flex align-center m-0">' + status + ' ' + tagged + ' in Suspense List out of ' + sourceArray.data.mappings.mappings.length + '</h4></div>');
|
|
22455
|
+
|
|
22456
|
+
|
|
22457
|
+
if (changed > 0) {
|
|
22458
|
+
html += ('<div class="left-sticky d-flex justify-between align-center mr-10"><h4 part="results-title" class="d-flex align-center m-0"><span class="color-pending material-icons">pending</span> ' + changed + ' Items changed</h4></div>')
|
|
22459
|
+
}
|
|
22460
|
+
html += ('<div class="left-sticky d-flex justify-between align-center mr-10"><h4 id="span-extra-filled" class="m-0" part="results-title"></h4></div>')
|
|
22461
|
+
|
|
22462
|
+
html += '<div class="d-flex align-center">';
|
|
22463
|
+
// html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="'+subfilter+'" />';
|
|
22464
|
+
html += '<div class="mr-10">';
|
|
22465
|
+
html += '<div class="d-flex justify-end"><button part="calendar-tab-icon-not-selected" class="material-icons button-toggle-more">expand_more</button><button part="calendar-tab-icon-selected" class="material-icons button-toggle-more-back hide">expand_less</button></div>'
|
|
22466
|
+
// html += '<div class="d-flex justify-end"><button part="button" class="align-center button-download-backups hide" style="position: absolute; margin-top: 5px;"><span class="material-symbols-outlined mr-10">file_save</span><span>Download Backups</span></button></div>'
|
|
22467
|
+
html += '<div style="position: absolute; margin-top: 5px;">'
|
|
22468
|
+
html += '<button part="button" class="hide d-flex align-center button-download-backups" style="margin-left: -80px"><span class="material-symbols-outlined mr-10">file_save</span><span>Download Backups</span></button><button part="button" class="mt-10 hide d-flex align-center button-export-mapping" style="margin-left: -80px"><span class="material-symbols-outlined mr-10">export_notes</span><span>Export Mapping</span></button><button part="button" class="mt-10 hide d-flex align-center button-export-mapping-csv" style="margin-left: -80px"><span class="material-symbols-outlined mr-10">data_table</span><span>Export CSV</span></button>'
|
|
22469
|
+
|
|
22470
|
+
// console.log('jobs', jobs);
|
|
22471
|
+
html += ('<input id="fileInput" type="file" style="display:none;" /><button part="button" class="mt-10 hide button-local-load d-flex align-center mr-10" style="margin-left: -80px"><span class="material-symbols-outlined mr-10">upload_file</span><span>Load From Local</span></button><button part="button" class="mt-10 hide button-local-save d-flex align-center mr-10" style="margin-left: -80px"><span class="material-symbols-outlined mr-10">save</span><span>Save Locally</span></button>');
|
|
22472
|
+
html += '</div>';
|
|
22473
|
+
html += '</div>';
|
|
22474
|
+
html += '<button part="button" class="button-apply d-flex align-center mr-10"><span class="material-symbols-outlined mr-10">touch_app</span><span>Apply</span></button>'
|
|
22475
|
+
html += '<button part="button" class="button-save d-flex align-center"><span class="material-symbols-outlined mr-10">save</span><span>Save On Cloud</span></button>'
|
|
22476
|
+
html += '</div>';
|
|
22477
|
+
|
|
22478
|
+
html += '</div>';
|
|
22479
|
+
|
|
22480
|
+
html += '<div>';
|
|
22481
|
+
html += '<h4 id="span-filtered" part="results-title"></h4>'
|
|
22482
|
+
html += '<div id="div-subfiltered"></div>'
|
|
22483
|
+
html += '</div>';
|
|
22484
|
+
|
|
22485
|
+
html += '<br />';
|
|
22486
|
+
|
|
22487
|
+
html += '<div class="d-flex justify-center align-center w-100 mt-20 scroll-x">';
|
|
22488
|
+
html += '<table id="table-data" class="mt-20" style="height: 200px">';
|
|
22489
|
+
|
|
22490
|
+
html += '<thead>';
|
|
22491
|
+
// html += '<th part="td-head" class="td-head">'
|
|
22492
|
+
// html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
|
|
22493
|
+
// html += '</th>'
|
|
22494
|
+
html += '<th part="td-head" class="td-head">'
|
|
22495
|
+
html += colName;
|
|
22496
|
+
html += '</th>'
|
|
22497
|
+
for (let i = 0; i < uniqCols.length; i++) {
|
|
22498
|
+
html += '<th part="td-head" class="td-head">'
|
|
22499
|
+
html += uniqCols[i];
|
|
22500
|
+
html += '</th>'
|
|
22501
|
+
}
|
|
22502
|
+
for (let i = 0; i < sourceCols.length; i++) {
|
|
22503
|
+
html += '<th part="td-head" class="td-head">'
|
|
22504
|
+
html += sourceCols[i];
|
|
22505
|
+
html += '</th>'
|
|
22506
|
+
}
|
|
22507
|
+
html += '</thead>';
|
|
22508
|
+
html += '<tbody>';
|
|
22509
|
+
// console.log('changedIds', this.changedOnboardingItemIds);
|
|
22510
|
+
for (let i = 0; i < sourceArray.data.mappings.mappings.length; i++) {
|
|
22511
|
+
|
|
22512
|
+
var classBg = "";
|
|
22513
|
+
let item = sourceArray.data.mappings.mappings[i]
|
|
22514
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22515
|
+
if (i % 2 === 0) {
|
|
22516
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
22517
|
+
let changedId = suspenseKey
|
|
22518
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
22519
|
+
classBg = 'td-light-selected';
|
|
22520
|
+
} else {
|
|
22521
|
+
classBg = 'td-light';
|
|
22522
|
+
}
|
|
22523
|
+
} else {
|
|
22524
|
+
classBg = 'td-light';
|
|
22525
|
+
}
|
|
22526
|
+
} else {
|
|
22527
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
22528
|
+
let changedId = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22529
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
22530
|
+
classBg = 'td-dark-selected';
|
|
22531
|
+
} else {
|
|
22532
|
+
classBg = 'td-dark';
|
|
22533
|
+
}
|
|
22534
|
+
} else {
|
|
22535
|
+
classBg = 'td-dark';
|
|
22536
|
+
}
|
|
22537
|
+
}
|
|
22538
|
+
|
|
22539
|
+
html += '<tr class="" id="tablerow-' + i + '">';
|
|
22540
|
+
|
|
22541
|
+
// html += '<td class="left-sticky td-body ' + classBg + '" ><div class=""><input id="cb-' + i + '" type="checkbox" class="checkbox-row cb-select"/></div></td>';
|
|
22542
|
+
|
|
22543
|
+
html += '<td class="left-sticky td-body ' + classBg + '" part="td-key">'
|
|
22544
|
+
html += '<div class="">';
|
|
22545
|
+
html += '<input id="suspense-' + i + '" type="checkbox" part="input" class="suspense-input"' + ((suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) ? ' checked' : '') + '/>';
|
|
22546
|
+
|
|
22547
|
+
|
|
22548
|
+
html += '</div>';
|
|
22549
|
+
html += '</td>'
|
|
22550
|
+
|
|
22551
|
+
for (var l = 0; l < uniqCols.length; l++) {
|
|
22552
|
+
// console.log('uniqcolval', uniqCols[l], sourceArray.data.mappings.mappings[i], sourceArray.data.mappings.mappings[i][uniqCols[l]]);
|
|
22553
|
+
html += '<td class="td-body ' + classBg + '" part="td-key">'
|
|
22554
|
+
html += '<div class="">';
|
|
22555
|
+
html += '<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + sourceArray.data.mappings.mappings[i][uniqCols[l]].replace(/ *\([^)]*\) */g, "") + '" minLength="20"></sf-i-elastic-text>';
|
|
22556
|
+
html += '</div>';
|
|
22557
|
+
html += '</td>'
|
|
22558
|
+
}
|
|
22559
|
+
|
|
22560
|
+
|
|
22561
|
+
for (l = 0; l < sourceCols.length; l++) {
|
|
22562
|
+
|
|
22563
|
+
for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[0].cols).length; j++) {
|
|
22564
|
+
|
|
22565
|
+
if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[0].cols)[j]) {
|
|
22566
|
+
|
|
22567
|
+
if (sourceArray.data.mappings.mappings[i].data != null) {
|
|
22568
|
+
|
|
22569
|
+
html += '<td class="td-body ' + classBg + '" part="td-body">';
|
|
22570
|
+
html += '<div class="">';
|
|
22571
|
+
|
|
22572
|
+
//console.log('isArray', sourceCols[l], Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j]));
|
|
22573
|
+
if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j])) {
|
|
22574
|
+
|
|
22575
|
+
for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[i].data)[j].length; k++) {
|
|
22576
|
+
html += ('<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(sourceArray.data.mappings.mappings[i].data)[j][k] + '" minLength="100" lineSize="4"></sf-i-elastic-text>');
|
|
22577
|
+
}
|
|
22578
|
+
|
|
22579
|
+
} else {
|
|
22580
|
+
html += ('<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(sourceArray.data.mappings.mappings[i].data)[j] + '" minLength="100" lineSize="4"></sf-i-elastic-text>')
|
|
22581
|
+
}
|
|
22582
|
+
|
|
22583
|
+
html += '</div>';
|
|
22584
|
+
html += '</td>';
|
|
22585
|
+
|
|
22586
|
+
}
|
|
22587
|
+
|
|
22588
|
+
}
|
|
22589
|
+
|
|
22590
|
+
}
|
|
22591
|
+
|
|
22592
|
+
}
|
|
22593
|
+
|
|
22594
|
+
html += '</tr>';
|
|
22595
|
+
//console.log('i=', i);
|
|
22596
|
+
|
|
22597
|
+
}
|
|
22598
|
+
html += '</tbody>';
|
|
22599
|
+
html += '</table>';
|
|
22600
|
+
|
|
22601
|
+
|
|
22602
|
+
html += '</div>';
|
|
22603
|
+
|
|
22604
|
+
html += '</div>';
|
|
22605
|
+
|
|
22606
|
+
(this._SfOnboardingSuspenseContainer as HTMLDivElement).innerHTML = html;
|
|
22607
|
+
|
|
22608
|
+
const buttonApply = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22609
|
+
buttonApply.addEventListener('click', () => {
|
|
22610
|
+
let inputSuspenseCheckboxes = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelectorAll('.suspense-input') as NodeListOf<HTMLInputElement>;
|
|
22611
|
+
let tempSuspenseList: any = {}
|
|
22612
|
+
for (let inputSuspenseCheckbox of inputSuspenseCheckboxes) {
|
|
22613
|
+
let index = inputSuspenseCheckbox.id.split("-")[1]
|
|
22614
|
+
if (inputSuspenseCheckbox.checked) {
|
|
22615
|
+
let item = sourceArray.data.mappings.mappings[index]
|
|
22616
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22617
|
+
tempSuspenseList[suspenseKey] = true
|
|
22618
|
+
}
|
|
22619
|
+
}
|
|
22620
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList)
|
|
22621
|
+
})
|
|
22622
|
+
|
|
22623
|
+
const buttonSave = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22624
|
+
buttonSave.addEventListener('click', async () => {
|
|
22625
|
+
console.log('saving suspense', suspenseList, Object.keys(suspenseList).length);
|
|
22626
|
+
let response = await this.uploadMappedSuspense(suspenseList)
|
|
22627
|
+
console.log('suspense save response', response);
|
|
22628
|
+
this.loadOnboardingSuspense()
|
|
22629
|
+
})
|
|
22630
|
+
|
|
22631
|
+
const buttonToggleMoreBack = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-toggle-more-back') as HTMLButtonElement;
|
|
22632
|
+
const buttonToggleMore = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-toggle-more') as HTMLButtonElement;
|
|
22633
|
+
|
|
22634
|
+
buttonToggleMore.addEventListener('click', async (ev: any) => {
|
|
22635
|
+
|
|
22636
|
+
ev.target.classList.add('hide');
|
|
22637
|
+
buttonToggleMoreBack.classList.remove('hide');
|
|
22638
|
+
|
|
22639
|
+
const buttonExportMappingCSV = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
|
|
22640
|
+
buttonExportMappingCSV.style.display = 'flex';
|
|
22641
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22642
|
+
// buttonApply.style.display = 'flex';
|
|
22643
|
+
const buttonLoadLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
|
|
22644
|
+
buttonLoadLocal.style.display = 'flex';
|
|
22645
|
+
const buttonSaveLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
|
|
22646
|
+
buttonSaveLocal.style.display = 'flex';
|
|
22647
|
+
const buttonSave = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22648
|
+
buttonSave.style.display = 'flex';
|
|
22649
|
+
|
|
22650
|
+
const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
|
|
22651
|
+
buttonExportMappingCSVNew?.addEventListener('click', async () => {
|
|
22652
|
+
let csvArray = JSON.parse(JSON.stringify(sourceArray.data.mappings.mappings))
|
|
22653
|
+
for (let [i, obj] of csvArray.entries()) {
|
|
22654
|
+
let tempCsvObj = obj
|
|
22655
|
+
if (obj['cols'] != null && obj['data'] != null) {
|
|
22656
|
+
let dataArr = JSON.parse(obj['data'])
|
|
22657
|
+
let colsArr = JSON.parse(obj['cols'])
|
|
22658
|
+
for (let [j, colKey] of colsArr.entries()) {
|
|
22659
|
+
tempCsvObj['cols_' + colKey] = dataArr[j]
|
|
22660
|
+
}
|
|
22661
|
+
}
|
|
22662
|
+
csvArray[i] = tempCsvObj
|
|
22663
|
+
}
|
|
22664
|
+
console.log('csv array', csvArray)
|
|
22665
|
+
let csvData = Util.convertToCSV(csvArray);
|
|
22666
|
+
// let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
|
|
22667
|
+
console.log('csvData', csvData);
|
|
22668
|
+
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
|
|
22669
|
+
const url = window.URL.createObjectURL(blob)
|
|
22670
|
+
const a = document.createElement('a')
|
|
22671
|
+
a.setAttribute('href', url)
|
|
22672
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().getTime() + '.csv');
|
|
22673
|
+
a.click()
|
|
22674
|
+
})
|
|
22675
|
+
|
|
22676
|
+
const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
|
|
22677
|
+
buttonLoadLocalNew?.addEventListener('click', async () => {
|
|
22678
|
+
console.log('load-local');
|
|
22679
|
+
((this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('#fileInput') as HTMLInputElement).click();
|
|
22680
|
+
});
|
|
22681
|
+
|
|
22682
|
+
const fileInput = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('#fileInput') as HTMLButtonElement;
|
|
22683
|
+
fileInput.value = '';
|
|
22684
|
+
const fileInputNew = Util.clearListeners(fileInput);
|
|
22685
|
+
fileInputNew.addEventListener('change', (e: any) => {
|
|
22686
|
+
|
|
22687
|
+
var frCsv = new FileReader();
|
|
22688
|
+
frCsv.onload = () => {
|
|
22689
|
+
console.log('taggingarray onload called');
|
|
22690
|
+
console.log('csv result', frCsv.result);
|
|
22691
|
+
const tempArr = Util.parseCsv(frCsv.result + "");
|
|
22692
|
+
console.log('csv data', tempArr)
|
|
22693
|
+
let changeCount = 0;
|
|
22694
|
+
let tempSuspenseList: any = {}
|
|
22695
|
+
for (let obj of tempArr) {
|
|
22696
|
+
let suspenseKey = obj.entityid + ';' + obj.locationid + ';' + obj.id
|
|
22697
|
+
if ((suspenseList[suspenseKey] == null && obj.suspense == true) || (suspenseList[suspenseKey] != null && obj.suspense == false)) {
|
|
22698
|
+
console.log('adding to suspense change', suspenseKey, suspenseList[suspenseKey], obj.suspense)
|
|
22699
|
+
this.changedOnboardingItemIds.push(suspenseKey)
|
|
22700
|
+
changeCount++
|
|
22701
|
+
}
|
|
22702
|
+
tempSuspenseList[suspenseKey] = obj.suspense
|
|
22703
|
+
}
|
|
22704
|
+
this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
|
|
22705
|
+
() => {
|
|
22706
|
+
this.clearMessages();
|
|
22707
|
+
this.changedOnboardingItemIds = [];
|
|
22708
|
+
(buttonToggleMoreBack as HTMLButtonElement).click();
|
|
22709
|
+
},
|
|
22710
|
+
() => {
|
|
22711
|
+
this.clearMessages();
|
|
22712
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
|
|
22713
|
+
}
|
|
22714
|
+
])
|
|
22715
|
+
// let tempObj:any = {"data":{"mappings":{"mappings":tempArr}}}
|
|
22716
|
+
// let tempObj:{data:{mappings:{mappings:any[]}}} = {data:{mappings:{mappings:tempArr}}}
|
|
22717
|
+
|
|
22718
|
+
|
|
22719
|
+
}
|
|
22720
|
+
if (e.target.files[0].name.toLowerCase().indexOf("suspense".toLowerCase()) >= 0) {
|
|
22721
|
+
frCsv.readAsText(e.target.files[0]);
|
|
22722
|
+
}
|
|
22723
|
+
})
|
|
22724
|
+
|
|
22725
|
+
const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
|
|
22726
|
+
buttonSaveLocalNew?.addEventListener('click', async () => {
|
|
22727
|
+
console.log('save-local');
|
|
22728
|
+
const blob = new Blob([JSON.stringify(sourceArray)], { type: 'text/plain' });
|
|
22729
|
+
const url = window.URL.createObjectURL(blob)
|
|
22730
|
+
const a = document.createElement('a')
|
|
22731
|
+
a.setAttribute('href', url)
|
|
22732
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().toLocaleString() + '.txt');
|
|
22733
|
+
a.click()
|
|
22734
|
+
});
|
|
22735
|
+
|
|
22736
|
+
});
|
|
22737
|
+
|
|
22738
|
+
buttonToggleMoreBack.addEventListener('click', async (ev: any) => {
|
|
22739
|
+
|
|
22740
|
+
ev.target.classList.add('hide');
|
|
22741
|
+
buttonToggleMore.classList.remove('hide');
|
|
22742
|
+
const buttonDownloadBackups = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-download-backups') as HTMLButtonElement;
|
|
22743
|
+
buttonDownloadBackups.style.display = 'none';
|
|
22744
|
+
const buttonExportMapping = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping') as HTMLButtonElement;
|
|
22745
|
+
buttonExportMapping.style.display = 'none';
|
|
22746
|
+
const buttonExportMappingCSV = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
|
|
22747
|
+
buttonExportMappingCSV.style.display = 'none';
|
|
22748
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22749
|
+
// buttonApply.style.display = 'none';
|
|
22750
|
+
const buttonLoadLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
|
|
22751
|
+
buttonLoadLocal.style.display = 'none';
|
|
22752
|
+
const buttonSaveLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
|
|
22753
|
+
buttonSaveLocal.style.display = 'none';
|
|
22754
|
+
// const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22755
|
+
// buttonSave.style.display = 'none';
|
|
22756
|
+
|
|
22757
|
+
});
|
|
22758
|
+
|
|
22759
|
+
this.changedOnboardingItemIds = [];
|
|
22760
|
+
}
|
|
22761
|
+
|
|
22762
|
+
renderOnboardingSuspenseOld = (_suspenseList: any) => {
|
|
22318
22763
|
|
|
22319
22764
|
//console.log('calendarjobs', calendarJobs);
|
|
22320
22765
|
|
|
@@ -27541,6 +27986,39 @@ export class SfIEvents extends LitElement {
|
|
|
27541
27986
|
await this.uploadOnboardingMapping(data, 'countries');
|
|
27542
27987
|
}
|
|
27543
27988
|
|
|
27989
|
+
uploadMappedSuspense = async (data: any) => {
|
|
27990
|
+
|
|
27991
|
+
//console.log('uploading..', data);
|
|
27992
|
+
|
|
27993
|
+
let url = "https://" + this.apiId + "/updatemappedsuspense";
|
|
27994
|
+
|
|
27995
|
+
const body = {
|
|
27996
|
+
"projectid": this.projectId,
|
|
27997
|
+
"data": JSON.stringify(data),
|
|
27998
|
+
}
|
|
27999
|
+
|
|
28000
|
+
let authorization: any = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
28001
|
+
let xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
|
|
28002
|
+
this._SfLoader.innerHTML = '';
|
|
28003
|
+
if (xhr.status == 200) {
|
|
28004
|
+
|
|
28005
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
28006
|
+
console.log('jsonResponse suspense', jsonRespose);
|
|
28007
|
+
return jsonRespose;
|
|
28008
|
+
} else {
|
|
28009
|
+
if (xhr.status == 401) {
|
|
28010
|
+
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
28011
|
+
this.dispatchEvent(changeEvent);
|
|
28012
|
+
}
|
|
28013
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
28014
|
+
this.setError(jsonRespose.error);
|
|
28015
|
+
setTimeout(() => {
|
|
28016
|
+
this.clearMessages()
|
|
28017
|
+
}, 2000);
|
|
28018
|
+
}
|
|
28019
|
+
|
|
28020
|
+
}
|
|
28021
|
+
|
|
27544
28022
|
uploadOnboardingMapping = async (data: any, onboardingstep: string) => {
|
|
27545
28023
|
|
|
27546
28024
|
//console.log('uploading..', data);
|
|
@@ -27738,7 +28216,7 @@ export class SfIEvents extends LitElement {
|
|
|
27738
28216
|
|
|
27739
28217
|
uploadTriggerMyEvent = async (complianceid: string, message: string, countryname: string, entityname: string, locationname: string, statute: string, subcategory: string, suspenseVal: any = {}) => {
|
|
27740
28218
|
|
|
27741
|
-
let url = "https://" + this.apiId + "/
|
|
28219
|
+
let url = "https://" + this.apiId + "/triggermyevent2";
|
|
27742
28220
|
|
|
27743
28221
|
const body = {
|
|
27744
28222
|
"projectid": this.projectId,
|
|
@@ -29584,7 +30062,7 @@ export class SfIEvents extends LitElement {
|
|
|
29584
30062
|
|
|
29585
30063
|
fetchSuspenseList = async () => {
|
|
29586
30064
|
|
|
29587
|
-
let url = "https://" + this.apiId + "/
|
|
30065
|
+
let url = "https://" + this.apiId + "/getsuspenselist1";
|
|
29588
30066
|
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
29589
30067
|
const year = this.getCurrentYearGeneric();
|
|
29590
30068
|
const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "year": year }, url, this._SfLoader, authorization)) as any;
|
|
@@ -30794,6 +31272,24 @@ export class SfIEvents extends LitElement {
|
|
|
30794
31272
|
|
|
30795
31273
|
}
|
|
30796
31274
|
|
|
31275
|
+
formatIndianNumber = (num: number) => {
|
|
31276
|
+
if (num === null || num === undefined || isNaN(num)) return '';
|
|
31277
|
+
num = Number(num);
|
|
31278
|
+
|
|
31279
|
+
if (num >= 10000000) {
|
|
31280
|
+
// 1 Crore = 10,000,000
|
|
31281
|
+
return (num / 10000000).toFixed(num % 10000000 === 0 ? 0 : 2).replace(/\.00$/, '') + ' Cr';
|
|
31282
|
+
} else if (num >= 100000) {
|
|
31283
|
+
// 1 Lakh = 100,000
|
|
31284
|
+
return (num / 100000).toFixed(num % 100000 === 0 ? 0 : 2).replace(/\.00$/, '') + ' Lac';
|
|
31285
|
+
} else if (num >= 1000) {
|
|
31286
|
+
return (num / 1000).toFixed(num % 1000 === 0 ? 0 : 2).replace(/\.00$/, '') + ' K';
|
|
31287
|
+
} else {
|
|
31288
|
+
return num.toString();
|
|
31289
|
+
}
|
|
31290
|
+
}
|
|
31291
|
+
|
|
31292
|
+
|
|
30797
31293
|
truncate = (str: string, n: number, useWordBoundary: boolean, ellipsis: boolean = true) => {
|
|
30798
31294
|
if (str.length <= n) { return str; }
|
|
30799
31295
|
const subString = str.slice(0, n - 1); // the original check
|
package/src/util.ts
CHANGED
|
@@ -428,7 +428,7 @@ function arrayToObject(csvArray: any) {
|
|
|
428
428
|
|
|
429
429
|
return headers.reduce((acc: any, currentHeader: any, i: string | number) => {
|
|
430
430
|
// console.log('parsing row', row[i], index);
|
|
431
|
-
return ((currentHeader.indexOf('cols_') >= 0 || currentHeader == '') ? acc : ((row[i] != '' && row[i] != null) ? { ...acc, ...{ [currentHeader]: JSON.parse(row[i] == "TRUE" ? "true" : row[i]
|
|
431
|
+
return ((currentHeader.indexOf('cols_') >= 0 || currentHeader == '') ? acc : ((row[i] != '' && row[i] != null) ? { ...acc, ...{ [currentHeader]: JSON.parse(row[i] == "TRUE" ? "true" : (row[i] == "FALSE" ? "false" : row[i]))}} : acc))
|
|
432
432
|
}, {})
|
|
433
433
|
})
|
|
434
434
|
}
|
package/util.js
CHANGED
|
@@ -358,7 +358,7 @@ function arrayToObject(csvArray) {
|
|
|
358
358
|
}).map((row) => {
|
|
359
359
|
return headers.reduce((acc, currentHeader, i) => {
|
|
360
360
|
// console.log('parsing row', row[i], index);
|
|
361
|
-
return ((currentHeader.indexOf('cols_') >= 0 || currentHeader == '') ? acc : ((row[i] != '' && row[i] != null) ? { ...acc, ...{ [currentHeader]: JSON.parse(row[i] == "TRUE" ? "true" : row[i]) } } : acc));
|
|
361
|
+
return ((currentHeader.indexOf('cols_') >= 0 || currentHeader == '') ? acc : ((row[i] != '' && row[i] != null) ? { ...acc, ...{ [currentHeader]: JSON.parse(row[i] == "TRUE" ? "true" : (row[i] == "FALSE" ? "false" : row[i])) } } : acc));
|
|
362
362
|
}, {});
|
|
363
363
|
});
|
|
364
364
|
}
|