sf-i-events 1.0.952 → 1.0.954
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dev/index.html +4 -4
- package/package.json +1 -1
- package/sf-i-events.d.ts +3 -1
- package/sf-i-events.js +318 -5
- package/src/sf-i-events.ts +378 -5
- package/src/util.ts +1 -1
- package/util.js +1 -1
package/dev/index.html
CHANGED
|
@@ -889,14 +889,14 @@
|
|
|
889
889
|
disablesignoff="yes" disableclientresponse="yes">
|
|
890
890
|
|
|
891
891
|
</sf-i-events> -->
|
|
892
|
-
|
|
892
|
+
<sf-i-events projectid="41ab3c86-ccc0-4c0e-8e31-cd079a07a710" projectname="ABC Global" mode="onboarding"
|
|
893
893
|
locations="{"India":{"Maharashtra":["Pune","Mumbai"],"Telangana":["Telangana"]},"Canada":{"CanadaSO":["CanadaLO"]},"Singapore":{"SingaporeSO":["Orchard","Raffles","Robinson","Tanjong","Tras"]},"United Kingdom":{"UnitedSO":["UnitedLO"]},"United States of America":{"AmericaSO":["AmericaLO"]}}"
|
|
894
894
|
contractstartdate="1/4/2024" apiid="dwqyez2puoxmu.cloudfront.net/event" username="ninad.t@flagggrc.tech"
|
|
895
895
|
apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiidcompliances="dnytrdlrmxgsy.cloudfront.net/compliance"
|
|
896
896
|
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidusers="dnytrdlrmxgsy.cloudfront.net/userprofile"
|
|
897
897
|
disablesignoff="yes" disableclientresponse="yes">
|
|
898
898
|
|
|
899
|
-
</sf-i-events>
|
|
899
|
+
</sf-i-events>
|
|
900
900
|
<!-- <sf-i-events id="sf-i-events-next" name="Next Compliances" apiid="dwqyez2puoxmu.cloudfront.net/event"
|
|
901
901
|
apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiidcompliances="dnytrdlrmxgsy.cloudfront.net/compliance"
|
|
902
902
|
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
|
@@ -941,7 +941,7 @@
|
|
|
941
941
|
</div>
|
|
942
942
|
|
|
943
943
|
</sf-i-events> -->
|
|
944
|
-
<sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
|
|
944
|
+
<!-- <sf-i-events name="Calendar" apiid="dwqyez2puoxmu.cloudfront.net/event" mode="consumer"
|
|
945
945
|
apiidtags="dnytrdlrmxgsy.cloudfront.net/tagging" apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute"
|
|
946
946
|
apiiddefinitions="dwqyez2puoxmu.cloudfront.net/definition"
|
|
947
947
|
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
|
@@ -970,7 +970,7 @@
|
|
|
970
970
|
<sf-i-reporting id="reporting-format" mode="view"></sf-i-reporting>
|
|
971
971
|
</div>
|
|
972
972
|
|
|
973
|
-
</sf-i-events>
|
|
973
|
+
</sf-i-events> -->
|
|
974
974
|
<!-- <sf-i-events id="sf-i-events-next" name="Next Compliances" apiid="dwqyez2puoxmu.cloudfront.net/event"
|
|
975
975
|
apiidstatutes="dnytrdlrmxgsy.cloudfront.net/statute" apiidcompliances="dnytrdlrmxgsy.cloudfront.net/compliance"
|
|
976
976
|
apiidreportformats="dwqyez2puoxmu.cloudfront.net/reportformat"
|
package/package.json
CHANGED
package/sf-i-events.d.ts
CHANGED
|
@@ -659,7 +659,8 @@ export declare class SfIEvents extends LitElement {
|
|
|
659
659
|
refreshCalendar: () => Promise<void>;
|
|
660
660
|
renderNewOnboarding: () => void;
|
|
661
661
|
renderOnboardingSignoff: (signoff: any) => void;
|
|
662
|
-
renderOnboardingSuspense: (
|
|
662
|
+
renderOnboardingSuspense: (sourceArray: any, suspenseList: any) => void;
|
|
663
|
+
renderOnboardingSuspenseOld: (_suspenseList: any) => void;
|
|
663
664
|
renderOnboardingCalendar: (_calendarJobs: any) => void;
|
|
664
665
|
renderOnboardingTriggers: (mappedTriggers: any, mappedSerializedAlertSchedules: any, triggersJobs: any) => void;
|
|
665
666
|
renderOnboardingInternalControls: (mappedInternalControls: any, mappedSerializedTriggers: any, internalcontrolsJobs: any) => void;
|
|
@@ -757,6 +758,7 @@ export declare class SfIEvents extends LitElement {
|
|
|
757
758
|
uploadLocationsMapping: (data: any) => Promise<void>;
|
|
758
759
|
uploadEntitiesMapping: (data: any) => Promise<void>;
|
|
759
760
|
uploadCountriesMapping: (data: any) => Promise<void>;
|
|
761
|
+
uploadMappedSuspense: (data: any) => Promise<any>;
|
|
760
762
|
uploadOnboardingMapping: (data: any, onboardingstep: string) => Promise<void>;
|
|
761
763
|
uploadToPresignedUrl: (data: any, url: string) => Promise<void>;
|
|
762
764
|
uploadCompliancesMapping: (data: any) => Promise<void>;
|
package/sf-i-events.js
CHANGED
|
@@ -7508,9 +7508,10 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
7508
7508
|
this.loadOnboardingSuspense = async () => {
|
|
7509
7509
|
this.hideTabContainers();
|
|
7510
7510
|
this._SfOnboardingSuspenseContainer.style.display = 'flex';
|
|
7511
|
+
const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
|
|
7511
7512
|
const suspenseList = await this.fetchSuspenseList();
|
|
7512
7513
|
console.log('suspenseList', suspenseList);
|
|
7513
|
-
this.renderOnboardingSuspense(suspenseList);
|
|
7514
|
+
this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList);
|
|
7514
7515
|
};
|
|
7515
7516
|
this.calculateStartAndEndDateOfPast = (index = 0) => {
|
|
7516
7517
|
//console.log('calculating start and end of past');
|
|
@@ -13196,7 +13197,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
13196
13197
|
};
|
|
13197
13198
|
this.renewRCMResource = async (listEvent, reportformatvalues) => {
|
|
13198
13199
|
var _a;
|
|
13199
|
-
let url = "https://" + this.apiIdRCMResources + "/
|
|
13200
|
+
let url = "https://" + this.apiIdRCMResources + "/reopen1";
|
|
13200
13201
|
console.log('renewing', reportformatvalues);
|
|
13201
13202
|
//console.log('fetch calendar url', url);
|
|
13202
13203
|
let urlBody = { projectid: this.projectId, objectid: listEvent.id, newvalues: reportformatvalues == "" ? null : JSON.parse(reportformatvalues), published: true, terminated: ((_a = JSON.parse(reportformatvalues).terminated) !== null && _a !== void 0 ? _a : false) };
|
|
@@ -17562,7 +17563,292 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
17562
17563
|
this.loadOnboardingSignoff();
|
|
17563
17564
|
});
|
|
17564
17565
|
};
|
|
17565
|
-
this.renderOnboardingSuspense = (
|
|
17566
|
+
this.renderOnboardingSuspense = (sourceArray, suspenseList) => {
|
|
17567
|
+
console.log('sourceList', sourceArray);
|
|
17568
|
+
console.log('suspenseList', suspenseList);
|
|
17569
|
+
let sourceCols = ["shortid", "obligationtitle", "obligationtype"];
|
|
17570
|
+
let uniqCols = ["id", "entityname", "locationname"];
|
|
17571
|
+
let colName = 'suspense';
|
|
17572
|
+
var html = '';
|
|
17573
|
+
html += '<div id="suspense-list-container" class="pb-10 pt-10 w-100">';
|
|
17574
|
+
html += '<div class="d-flex justify-between flex-wrap align-center"> ';
|
|
17575
|
+
var status = '';
|
|
17576
|
+
status = '<span class="color-done material-icons">check_circle</span>';
|
|
17577
|
+
let tagged = 0;
|
|
17578
|
+
var changed = 0;
|
|
17579
|
+
let tempSourceArray = sourceArray;
|
|
17580
|
+
console.log('suspensekey length', tempSourceArray.data.mappings.mappings.length);
|
|
17581
|
+
for (let [itemIndex, item] of tempSourceArray.data.mappings.mappings.entries()) {
|
|
17582
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id;
|
|
17583
|
+
console.log('suspensekey', suspenseKey, item);
|
|
17584
|
+
if (suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) {
|
|
17585
|
+
tagged++;
|
|
17586
|
+
}
|
|
17587
|
+
tempSourceArray.data.mappings.mappings[itemIndex].suspense = suspenseList[suspenseKey] != null;
|
|
17588
|
+
if (this.changedOnboardingItemIds.indexOf(suspenseKey) >= 0) {
|
|
17589
|
+
changed++;
|
|
17590
|
+
}
|
|
17591
|
+
}
|
|
17592
|
+
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>');
|
|
17593
|
+
if (changed > 0) {
|
|
17594
|
+
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>');
|
|
17595
|
+
}
|
|
17596
|
+
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>');
|
|
17597
|
+
html += '<div class="d-flex align-center">';
|
|
17598
|
+
// html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="'+subfilter+'" />';
|
|
17599
|
+
html += '<div class="mr-10">';
|
|
17600
|
+
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>';
|
|
17601
|
+
// 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>'
|
|
17602
|
+
html += '<div style="position: absolute; margin-top: 5px;">';
|
|
17603
|
+
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>';
|
|
17604
|
+
// console.log('jobs', jobs);
|
|
17605
|
+
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>');
|
|
17606
|
+
html += '</div>';
|
|
17607
|
+
html += '</div>';
|
|
17608
|
+
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>';
|
|
17609
|
+
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>';
|
|
17610
|
+
html += '</div>';
|
|
17611
|
+
html += '</div>';
|
|
17612
|
+
html += '<div>';
|
|
17613
|
+
html += '<h4 id="span-filtered" part="results-title"></h4>';
|
|
17614
|
+
html += '<div id="div-subfiltered"></div>';
|
|
17615
|
+
html += '</div>';
|
|
17616
|
+
html += '<br />';
|
|
17617
|
+
html += '<div class="d-flex justify-center align-center w-100 mt-20 scroll-x">';
|
|
17618
|
+
html += '<table id="table-data" class="mt-20" style="height: 200px">';
|
|
17619
|
+
html += '<thead>';
|
|
17620
|
+
// html += '<th part="td-head" class="td-head">'
|
|
17621
|
+
// html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
|
|
17622
|
+
// html += '</th>'
|
|
17623
|
+
html += '<th part="td-head" class="td-head">';
|
|
17624
|
+
html += colName;
|
|
17625
|
+
html += '</th>';
|
|
17626
|
+
for (let i = 0; i < uniqCols.length; i++) {
|
|
17627
|
+
html += '<th part="td-head" class="td-head">';
|
|
17628
|
+
html += uniqCols[i];
|
|
17629
|
+
html += '</th>';
|
|
17630
|
+
}
|
|
17631
|
+
for (let i = 0; i < sourceCols.length; i++) {
|
|
17632
|
+
html += '<th part="td-head" class="td-head">';
|
|
17633
|
+
html += sourceCols[i];
|
|
17634
|
+
html += '</th>';
|
|
17635
|
+
}
|
|
17636
|
+
html += '</thead>';
|
|
17637
|
+
html += '<tbody>';
|
|
17638
|
+
// console.log('changedIds', this.changedOnboardingItemIds);
|
|
17639
|
+
for (let i = 0; i < sourceArray.data.mappings.mappings.length; i++) {
|
|
17640
|
+
var classBg = "";
|
|
17641
|
+
let item = sourceArray.data.mappings.mappings[i];
|
|
17642
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id;
|
|
17643
|
+
if (i % 2 === 0) {
|
|
17644
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
17645
|
+
let changedId = suspenseKey;
|
|
17646
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
17647
|
+
classBg = 'td-light-selected';
|
|
17648
|
+
}
|
|
17649
|
+
else {
|
|
17650
|
+
classBg = 'td-light';
|
|
17651
|
+
}
|
|
17652
|
+
}
|
|
17653
|
+
else {
|
|
17654
|
+
classBg = 'td-light';
|
|
17655
|
+
}
|
|
17656
|
+
}
|
|
17657
|
+
else {
|
|
17658
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
17659
|
+
let changedId = item.entityid + ';' + item.locationid + ';' + item.id;
|
|
17660
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
17661
|
+
classBg = 'td-dark-selected';
|
|
17662
|
+
}
|
|
17663
|
+
else {
|
|
17664
|
+
classBg = 'td-dark';
|
|
17665
|
+
}
|
|
17666
|
+
}
|
|
17667
|
+
else {
|
|
17668
|
+
classBg = 'td-dark';
|
|
17669
|
+
}
|
|
17670
|
+
}
|
|
17671
|
+
html += '<tr class="" id="tablerow-' + i + '">';
|
|
17672
|
+
// html += '<td class="left-sticky td-body ' + classBg + '" ><div class=""><input id="cb-' + i + '" type="checkbox" class="checkbox-row cb-select"/></div></td>';
|
|
17673
|
+
html += '<td class="left-sticky td-body ' + classBg + '" part="td-key">';
|
|
17674
|
+
html += '<div class="">';
|
|
17675
|
+
html += '<input id="suspense-' + i + '" type="checkbox" part="input" class="suspense-input"' + ((suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) ? ' checked' : '') + '/>';
|
|
17676
|
+
html += '</div>';
|
|
17677
|
+
html += '</td>';
|
|
17678
|
+
for (var l = 0; l < uniqCols.length; l++) {
|
|
17679
|
+
// console.log('uniqcolval', uniqCols[l], sourceArray.data.mappings.mappings[i], sourceArray.data.mappings.mappings[i][uniqCols[l]]);
|
|
17680
|
+
html += '<td class="td-body ' + classBg + '" part="td-key">';
|
|
17681
|
+
html += '<div class="">';
|
|
17682
|
+
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>';
|
|
17683
|
+
html += '</div>';
|
|
17684
|
+
html += '</td>';
|
|
17685
|
+
}
|
|
17686
|
+
for (l = 0; l < sourceCols.length; l++) {
|
|
17687
|
+
for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[0].cols).length; j++) {
|
|
17688
|
+
if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[0].cols)[j]) {
|
|
17689
|
+
if (sourceArray.data.mappings.mappings[i].data != null) {
|
|
17690
|
+
html += '<td class="td-body ' + classBg + '" part="td-body">';
|
|
17691
|
+
html += '<div class="">';
|
|
17692
|
+
//console.log('isArray', sourceCols[l], Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j]));
|
|
17693
|
+
if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j])) {
|
|
17694
|
+
for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[i].data)[j].length; k++) {
|
|
17695
|
+
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>');
|
|
17696
|
+
}
|
|
17697
|
+
}
|
|
17698
|
+
else {
|
|
17699
|
+
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>');
|
|
17700
|
+
}
|
|
17701
|
+
html += '</div>';
|
|
17702
|
+
html += '</td>';
|
|
17703
|
+
}
|
|
17704
|
+
}
|
|
17705
|
+
}
|
|
17706
|
+
}
|
|
17707
|
+
html += '</tr>';
|
|
17708
|
+
//console.log('i=', i);
|
|
17709
|
+
}
|
|
17710
|
+
html += '</tbody>';
|
|
17711
|
+
html += '</table>';
|
|
17712
|
+
html += '</div>';
|
|
17713
|
+
html += '</div>';
|
|
17714
|
+
this._SfOnboardingSuspenseContainer.innerHTML = html;
|
|
17715
|
+
const buttonApply = this._SfOnboardingSuspenseContainer.querySelector('.button-apply');
|
|
17716
|
+
buttonApply.addEventListener('click', () => {
|
|
17717
|
+
let inputSuspenseCheckboxes = this._SfOnboardingSuspenseContainer.querySelectorAll('.suspense-input');
|
|
17718
|
+
let tempSuspenseList = {};
|
|
17719
|
+
for (let inputSuspenseCheckbox of inputSuspenseCheckboxes) {
|
|
17720
|
+
let index = inputSuspenseCheckbox.id.split("-")[1];
|
|
17721
|
+
if (inputSuspenseCheckbox.checked) {
|
|
17722
|
+
let item = sourceArray.data.mappings.mappings[index];
|
|
17723
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id;
|
|
17724
|
+
tempSuspenseList[suspenseKey] = true;
|
|
17725
|
+
}
|
|
17726
|
+
}
|
|
17727
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
|
|
17728
|
+
});
|
|
17729
|
+
const buttonSave = this._SfOnboardingSuspenseContainer.querySelector('.button-save');
|
|
17730
|
+
buttonSave.addEventListener('click', async () => {
|
|
17731
|
+
console.log('saving suspense', suspenseList, Object.keys(suspenseList).length);
|
|
17732
|
+
let response = await this.uploadMappedSuspense(suspenseList);
|
|
17733
|
+
console.log('suspense save response', response);
|
|
17734
|
+
this.loadOnboardingSuspense();
|
|
17735
|
+
});
|
|
17736
|
+
const buttonToggleMoreBack = this._SfOnboardingSuspenseContainer.querySelector('.button-toggle-more-back');
|
|
17737
|
+
const buttonToggleMore = this._SfOnboardingSuspenseContainer.querySelector('.button-toggle-more');
|
|
17738
|
+
buttonToggleMore.addEventListener('click', async (ev) => {
|
|
17739
|
+
ev.target.classList.add('hide');
|
|
17740
|
+
buttonToggleMoreBack.classList.remove('hide');
|
|
17741
|
+
const buttonExportMappingCSV = this._SfOnboardingSuspenseContainer.querySelector('.button-export-mapping-csv');
|
|
17742
|
+
buttonExportMappingCSV.style.display = 'flex';
|
|
17743
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
17744
|
+
// buttonApply.style.display = 'flex';
|
|
17745
|
+
const buttonLoadLocal = this._SfOnboardingSuspenseContainer.querySelector('.button-local-load');
|
|
17746
|
+
buttonLoadLocal.style.display = 'flex';
|
|
17747
|
+
const buttonSaveLocal = this._SfOnboardingSuspenseContainer.querySelector('.button-local-save');
|
|
17748
|
+
buttonSaveLocal.style.display = 'flex';
|
|
17749
|
+
const buttonSave = this._SfOnboardingSuspenseContainer.querySelector('.button-save');
|
|
17750
|
+
buttonSave.style.display = 'flex';
|
|
17751
|
+
const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
|
|
17752
|
+
buttonExportMappingCSVNew === null || buttonExportMappingCSVNew === void 0 ? void 0 : buttonExportMappingCSVNew.addEventListener('click', async () => {
|
|
17753
|
+
let csvArray = JSON.parse(JSON.stringify(sourceArray.data.mappings.mappings));
|
|
17754
|
+
for (let [i, obj] of csvArray.entries()) {
|
|
17755
|
+
let tempCsvObj = obj;
|
|
17756
|
+
if (obj['cols'] != null && obj['data'] != null) {
|
|
17757
|
+
let dataArr = JSON.parse(obj['data']);
|
|
17758
|
+
let colsArr = JSON.parse(obj['cols']);
|
|
17759
|
+
for (let [j, colKey] of colsArr.entries()) {
|
|
17760
|
+
tempCsvObj['cols_' + colKey] = dataArr[j];
|
|
17761
|
+
}
|
|
17762
|
+
}
|
|
17763
|
+
csvArray[i] = tempCsvObj;
|
|
17764
|
+
}
|
|
17765
|
+
console.log('csv array', csvArray);
|
|
17766
|
+
let csvData = Util.convertToCSV(csvArray);
|
|
17767
|
+
// let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
|
|
17768
|
+
console.log('csvData', csvData);
|
|
17769
|
+
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
|
|
17770
|
+
const url = window.URL.createObjectURL(blob);
|
|
17771
|
+
const a = document.createElement('a');
|
|
17772
|
+
a.setAttribute('href', url);
|
|
17773
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().getTime() + '.csv');
|
|
17774
|
+
a.click();
|
|
17775
|
+
});
|
|
17776
|
+
const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
|
|
17777
|
+
buttonLoadLocalNew === null || buttonLoadLocalNew === void 0 ? void 0 : buttonLoadLocalNew.addEventListener('click', async () => {
|
|
17778
|
+
console.log('load-local');
|
|
17779
|
+
this._SfOnboardingSuspenseContainer.querySelector('#fileInput').click();
|
|
17780
|
+
});
|
|
17781
|
+
const fileInput = this._SfOnboardingSuspenseContainer.querySelector('#fileInput');
|
|
17782
|
+
fileInput.value = '';
|
|
17783
|
+
const fileInputNew = Util.clearListeners(fileInput);
|
|
17784
|
+
fileInputNew.addEventListener('change', (e) => {
|
|
17785
|
+
var frCsv = new FileReader();
|
|
17786
|
+
frCsv.onload = () => {
|
|
17787
|
+
console.log('taggingarray onload called');
|
|
17788
|
+
console.log('csv result', frCsv.result);
|
|
17789
|
+
const tempArr = Util.parseCsv(frCsv.result + "");
|
|
17790
|
+
console.log('csv data', tempArr);
|
|
17791
|
+
let changeCount = 0;
|
|
17792
|
+
let tempSuspenseList = {};
|
|
17793
|
+
for (let obj of tempArr) {
|
|
17794
|
+
let suspenseKey = obj.entityid + ';' + obj.locationid + ';' + obj.id;
|
|
17795
|
+
if ((suspenseList[suspenseKey] == null && obj.suspense == true) || (suspenseList[suspenseKey] != null && obj.suspense == false)) {
|
|
17796
|
+
console.log('adding to suspense change', suspenseKey, suspenseList[suspenseKey], obj.suspense);
|
|
17797
|
+
this.changedOnboardingItemIds.push(suspenseKey);
|
|
17798
|
+
changeCount++;
|
|
17799
|
+
}
|
|
17800
|
+
tempSuspenseList[suspenseKey] = obj.suspense;
|
|
17801
|
+
}
|
|
17802
|
+
this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
|
|
17803
|
+
() => {
|
|
17804
|
+
this.clearMessages();
|
|
17805
|
+
this.changedOnboardingItemIds = [];
|
|
17806
|
+
buttonToggleMoreBack.click();
|
|
17807
|
+
},
|
|
17808
|
+
() => {
|
|
17809
|
+
this.clearMessages();
|
|
17810
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
|
|
17811
|
+
}
|
|
17812
|
+
]);
|
|
17813
|
+
// let tempObj:any = {"data":{"mappings":{"mappings":tempArr}}}
|
|
17814
|
+
// let tempObj:{data:{mappings:{mappings:any[]}}} = {data:{mappings:{mappings:tempArr}}}
|
|
17815
|
+
};
|
|
17816
|
+
if (e.target.files[0].name.toLowerCase().indexOf("suspense".toLowerCase()) >= 0) {
|
|
17817
|
+
frCsv.readAsText(e.target.files[0]);
|
|
17818
|
+
}
|
|
17819
|
+
});
|
|
17820
|
+
const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
|
|
17821
|
+
buttonSaveLocalNew === null || buttonSaveLocalNew === void 0 ? void 0 : buttonSaveLocalNew.addEventListener('click', async () => {
|
|
17822
|
+
console.log('save-local');
|
|
17823
|
+
const blob = new Blob([JSON.stringify(sourceArray)], { type: 'text/plain' });
|
|
17824
|
+
const url = window.URL.createObjectURL(blob);
|
|
17825
|
+
const a = document.createElement('a');
|
|
17826
|
+
a.setAttribute('href', url);
|
|
17827
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().toLocaleString() + '.txt');
|
|
17828
|
+
a.click();
|
|
17829
|
+
});
|
|
17830
|
+
});
|
|
17831
|
+
buttonToggleMoreBack.addEventListener('click', async (ev) => {
|
|
17832
|
+
ev.target.classList.add('hide');
|
|
17833
|
+
buttonToggleMore.classList.remove('hide');
|
|
17834
|
+
const buttonDownloadBackups = this._SfOnboardingSuspenseContainer.querySelector('.button-download-backups');
|
|
17835
|
+
buttonDownloadBackups.style.display = 'none';
|
|
17836
|
+
const buttonExportMapping = this._SfOnboardingSuspenseContainer.querySelector('.button-export-mapping');
|
|
17837
|
+
buttonExportMapping.style.display = 'none';
|
|
17838
|
+
const buttonExportMappingCSV = this._SfOnboardingSuspenseContainer.querySelector('.button-export-mapping-csv');
|
|
17839
|
+
buttonExportMappingCSV.style.display = 'none';
|
|
17840
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
17841
|
+
// buttonApply.style.display = 'none';
|
|
17842
|
+
const buttonLoadLocal = this._SfOnboardingSuspenseContainer.querySelector('.button-local-load');
|
|
17843
|
+
buttonLoadLocal.style.display = 'none';
|
|
17844
|
+
const buttonSaveLocal = this._SfOnboardingSuspenseContainer.querySelector('.button-local-save');
|
|
17845
|
+
buttonSaveLocal.style.display = 'none';
|
|
17846
|
+
// const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
17847
|
+
// buttonSave.style.display = 'none';
|
|
17848
|
+
});
|
|
17849
|
+
this.changedOnboardingItemIds = [];
|
|
17850
|
+
};
|
|
17851
|
+
this.renderOnboardingSuspenseOld = (_suspenseList) => {
|
|
17566
17852
|
//console.log('calendarjobs', calendarJobs);
|
|
17567
17853
|
var _a;
|
|
17568
17854
|
var html = '';
|
|
@@ -21774,6 +22060,33 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
21774
22060
|
this.uploadCountriesMapping = async (data) => {
|
|
21775
22061
|
await this.uploadOnboardingMapping(data, 'countries');
|
|
21776
22062
|
};
|
|
22063
|
+
this.uploadMappedSuspense = async (data) => {
|
|
22064
|
+
//console.log('uploading..', data);
|
|
22065
|
+
let url = "https://" + this.apiId + "/updatemappedsuspense";
|
|
22066
|
+
const body = {
|
|
22067
|
+
"projectid": this.projectId,
|
|
22068
|
+
"data": JSON.stringify(data),
|
|
22069
|
+
};
|
|
22070
|
+
let authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
22071
|
+
let xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
|
|
22072
|
+
this._SfLoader.innerHTML = '';
|
|
22073
|
+
if (xhr.status == 200) {
|
|
22074
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
22075
|
+
console.log('jsonResponse suspense', jsonRespose);
|
|
22076
|
+
return jsonRespose;
|
|
22077
|
+
}
|
|
22078
|
+
else {
|
|
22079
|
+
if (xhr.status == 401) {
|
|
22080
|
+
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
22081
|
+
this.dispatchEvent(changeEvent);
|
|
22082
|
+
}
|
|
22083
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
22084
|
+
this.setError(jsonRespose.error);
|
|
22085
|
+
setTimeout(() => {
|
|
22086
|
+
this.clearMessages();
|
|
22087
|
+
}, 2000);
|
|
22088
|
+
}
|
|
22089
|
+
};
|
|
21777
22090
|
this.uploadOnboardingMapping = async (data, onboardingstep) => {
|
|
21778
22091
|
//console.log('uploading..', data);
|
|
21779
22092
|
let url = "https://" + this.apiId + "/updatemappedonboarding";
|
|
@@ -21931,7 +22244,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
21931
22244
|
}
|
|
21932
22245
|
};
|
|
21933
22246
|
this.uploadTriggerMyEvent = async (complianceid, message, countryname, entityname, locationname, statute, subcategory, suspenseVal = {}) => {
|
|
21934
|
-
let url = "https://" + this.apiId + "/
|
|
22247
|
+
let url = "https://" + this.apiId + "/triggermyevent2";
|
|
21935
22248
|
const body = {
|
|
21936
22249
|
"projectid": this.projectId,
|
|
21937
22250
|
"complianceid": complianceid,
|
|
@@ -23377,7 +23690,7 @@ let SfIEvents = class SfIEvents extends LitElement {
|
|
|
23377
23690
|
}
|
|
23378
23691
|
};
|
|
23379
23692
|
this.fetchSuspenseList = async () => {
|
|
23380
|
-
let url = "https://" + this.apiId + "/
|
|
23693
|
+
let url = "https://" + this.apiId + "/getsuspenselist1";
|
|
23381
23694
|
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
23382
23695
|
const year = this.getCurrentYearGeneric();
|
|
23383
23696
|
const xhr = (await this.prepareXhr({ "projectid": this.projectId, "year": year }, url, this._SfLoader, authorization));
|
package/src/sf-i-events.ts
CHANGED
|
@@ -10367,9 +10367,10 @@ export class SfIEvents extends LitElement {
|
|
|
10367
10367
|
loadOnboardingSuspense = async () => {
|
|
10368
10368
|
this.hideTabContainers();
|
|
10369
10369
|
(this._SfOnboardingSuspenseContainer as HTMLDivElement).style.display = 'flex';
|
|
10370
|
+
const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
|
|
10370
10371
|
const suspenseList = await this.fetchSuspenseList();
|
|
10371
10372
|
console.log('suspenseList', suspenseList);
|
|
10372
|
-
this.renderOnboardingSuspense(suspenseList);
|
|
10373
|
+
this.renderOnboardingSuspense(mappedSerializedLocations, suspenseList);
|
|
10373
10374
|
}
|
|
10374
10375
|
|
|
10375
10376
|
calculateStartAndEndDateOfPast = (index: number = 0) => {
|
|
@@ -17040,7 +17041,7 @@ export class SfIEvents extends LitElement {
|
|
|
17040
17041
|
|
|
17041
17042
|
renewRCMResource = async (listEvent: any, reportformatvalues: any) => {
|
|
17042
17043
|
|
|
17043
|
-
let url = "https://" + this.apiIdRCMResources + "/
|
|
17044
|
+
let url = "https://" + this.apiIdRCMResources + "/reopen1";
|
|
17044
17045
|
|
|
17045
17046
|
console.log('renewing', reportformatvalues)
|
|
17046
17047
|
//console.log('fetch calendar url', url);
|
|
@@ -22314,7 +22315,346 @@ export class SfIEvents extends LitElement {
|
|
|
22314
22315
|
|
|
22315
22316
|
}
|
|
22316
22317
|
|
|
22317
|
-
renderOnboardingSuspense = (
|
|
22318
|
+
renderOnboardingSuspense = (sourceArray: any, suspenseList: any) => {
|
|
22319
|
+
|
|
22320
|
+
console.log('sourceList', sourceArray);
|
|
22321
|
+
console.log('suspenseList', suspenseList);
|
|
22322
|
+
let sourceCols = ["shortid", "obligationtitle", "obligationtype"]
|
|
22323
|
+
let uniqCols = ["id", "entityname", "locationname"]
|
|
22324
|
+
let colName = 'suspense'
|
|
22325
|
+
var html: string = '';
|
|
22326
|
+
|
|
22327
|
+
html += '<div id="suspense-list-container" class="pb-10 pt-10 w-100">';
|
|
22328
|
+
|
|
22329
|
+
html += '<div class="d-flex justify-between flex-wrap align-center"> ';
|
|
22330
|
+
|
|
22331
|
+
var status = '';
|
|
22332
|
+
status = '<span class="color-done material-icons">check_circle</span>';
|
|
22333
|
+
let tagged = 0
|
|
22334
|
+
var changed = 0
|
|
22335
|
+
let tempSourceArray = sourceArray
|
|
22336
|
+
console.log('suspensekey length', tempSourceArray.data.mappings.mappings.length)
|
|
22337
|
+
for (let [itemIndex, item] of tempSourceArray.data.mappings.mappings.entries()) {
|
|
22338
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22339
|
+
console.log('suspensekey', suspenseKey, item)
|
|
22340
|
+
if (suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) {
|
|
22341
|
+
tagged++;
|
|
22342
|
+
}
|
|
22343
|
+
tempSourceArray.data.mappings.mappings[itemIndex].suspense = suspenseList[suspenseKey] != null
|
|
22344
|
+
if (this.changedOnboardingItemIds.indexOf(suspenseKey) >= 0) {
|
|
22345
|
+
changed++;
|
|
22346
|
+
}
|
|
22347
|
+
}
|
|
22348
|
+
|
|
22349
|
+
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>');
|
|
22350
|
+
|
|
22351
|
+
|
|
22352
|
+
if (changed > 0) {
|
|
22353
|
+
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>')
|
|
22354
|
+
}
|
|
22355
|
+
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>')
|
|
22356
|
+
|
|
22357
|
+
html += '<div class="d-flex align-center">';
|
|
22358
|
+
// html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="'+subfilter+'" />';
|
|
22359
|
+
html += '<div class="mr-10">';
|
|
22360
|
+
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>'
|
|
22361
|
+
// 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>'
|
|
22362
|
+
html += '<div style="position: absolute; margin-top: 5px;">'
|
|
22363
|
+
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>'
|
|
22364
|
+
|
|
22365
|
+
// console.log('jobs', jobs);
|
|
22366
|
+
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>');
|
|
22367
|
+
html += '</div>';
|
|
22368
|
+
html += '</div>';
|
|
22369
|
+
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>'
|
|
22370
|
+
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>'
|
|
22371
|
+
html += '</div>';
|
|
22372
|
+
|
|
22373
|
+
html += '</div>';
|
|
22374
|
+
|
|
22375
|
+
html += '<div>';
|
|
22376
|
+
html += '<h4 id="span-filtered" part="results-title"></h4>'
|
|
22377
|
+
html += '<div id="div-subfiltered"></div>'
|
|
22378
|
+
html += '</div>';
|
|
22379
|
+
|
|
22380
|
+
html += '<br />';
|
|
22381
|
+
|
|
22382
|
+
html += '<div class="d-flex justify-center align-center w-100 mt-20 scroll-x">';
|
|
22383
|
+
html += '<table id="table-data" class="mt-20" style="height: 200px">';
|
|
22384
|
+
|
|
22385
|
+
html += '<thead>';
|
|
22386
|
+
// html += '<th part="td-head" class="td-head">'
|
|
22387
|
+
// html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
|
|
22388
|
+
// html += '</th>'
|
|
22389
|
+
html += '<th part="td-head" class="td-head">'
|
|
22390
|
+
html += colName;
|
|
22391
|
+
html += '</th>'
|
|
22392
|
+
for (let i = 0; i < uniqCols.length; i++) {
|
|
22393
|
+
html += '<th part="td-head" class="td-head">'
|
|
22394
|
+
html += uniqCols[i];
|
|
22395
|
+
html += '</th>'
|
|
22396
|
+
}
|
|
22397
|
+
for (let i = 0; i < sourceCols.length; i++) {
|
|
22398
|
+
html += '<th part="td-head" class="td-head">'
|
|
22399
|
+
html += sourceCols[i];
|
|
22400
|
+
html += '</th>'
|
|
22401
|
+
}
|
|
22402
|
+
html += '</thead>';
|
|
22403
|
+
html += '<tbody>';
|
|
22404
|
+
// console.log('changedIds', this.changedOnboardingItemIds);
|
|
22405
|
+
for (let i = 0; i < sourceArray.data.mappings.mappings.length; i++) {
|
|
22406
|
+
|
|
22407
|
+
var classBg = "";
|
|
22408
|
+
let item = sourceArray.data.mappings.mappings[i]
|
|
22409
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22410
|
+
if (i % 2 === 0) {
|
|
22411
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
22412
|
+
let changedId = suspenseKey
|
|
22413
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
22414
|
+
classBg = 'td-light-selected';
|
|
22415
|
+
} else {
|
|
22416
|
+
classBg = 'td-light';
|
|
22417
|
+
}
|
|
22418
|
+
} else {
|
|
22419
|
+
classBg = 'td-light';
|
|
22420
|
+
}
|
|
22421
|
+
} else {
|
|
22422
|
+
if (this.changedOnboardingItemIds.length > 0) {
|
|
22423
|
+
let changedId = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22424
|
+
if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
|
|
22425
|
+
classBg = 'td-dark-selected';
|
|
22426
|
+
} else {
|
|
22427
|
+
classBg = 'td-dark';
|
|
22428
|
+
}
|
|
22429
|
+
} else {
|
|
22430
|
+
classBg = 'td-dark';
|
|
22431
|
+
}
|
|
22432
|
+
}
|
|
22433
|
+
|
|
22434
|
+
html += '<tr class="" id="tablerow-' + i + '">';
|
|
22435
|
+
|
|
22436
|
+
// html += '<td class="left-sticky td-body ' + classBg + '" ><div class=""><input id="cb-' + i + '" type="checkbox" class="checkbox-row cb-select"/></div></td>';
|
|
22437
|
+
|
|
22438
|
+
html += '<td class="left-sticky td-body ' + classBg + '" part="td-key">'
|
|
22439
|
+
html += '<div class="">';
|
|
22440
|
+
html += '<input id="suspense-' + i + '" type="checkbox" part="input" class="suspense-input"' + ((suspenseList[suspenseKey] != null && suspenseList[suspenseKey] != false) ? ' checked' : '') +'/>';
|
|
22441
|
+
|
|
22442
|
+
|
|
22443
|
+
html += '</div>';
|
|
22444
|
+
html += '</td>'
|
|
22445
|
+
|
|
22446
|
+
for (var l = 0; l < uniqCols.length; l++) {
|
|
22447
|
+
// console.log('uniqcolval', uniqCols[l], sourceArray.data.mappings.mappings[i], sourceArray.data.mappings.mappings[i][uniqCols[l]]);
|
|
22448
|
+
html += '<td class="td-body ' + classBg + '" part="td-key">'
|
|
22449
|
+
html += '<div class="">';
|
|
22450
|
+
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>';
|
|
22451
|
+
html += '</div>';
|
|
22452
|
+
html += '</td>'
|
|
22453
|
+
}
|
|
22454
|
+
|
|
22455
|
+
|
|
22456
|
+
for (l = 0; l < sourceCols.length; l++) {
|
|
22457
|
+
|
|
22458
|
+
for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[0].cols).length; j++) {
|
|
22459
|
+
|
|
22460
|
+
if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[0].cols)[j]) {
|
|
22461
|
+
|
|
22462
|
+
if (sourceArray.data.mappings.mappings[i].data != null) {
|
|
22463
|
+
|
|
22464
|
+
html += '<td class="td-body ' + classBg + '" part="td-body">';
|
|
22465
|
+
html += '<div class="">';
|
|
22466
|
+
|
|
22467
|
+
//console.log('isArray', sourceCols[l], Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j]));
|
|
22468
|
+
if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[i].data)[j])) {
|
|
22469
|
+
|
|
22470
|
+
for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[i].data)[j].length; k++) {
|
|
22471
|
+
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>');
|
|
22472
|
+
}
|
|
22473
|
+
|
|
22474
|
+
} else {
|
|
22475
|
+
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>')
|
|
22476
|
+
}
|
|
22477
|
+
|
|
22478
|
+
html += '</div>';
|
|
22479
|
+
html += '</td>';
|
|
22480
|
+
|
|
22481
|
+
}
|
|
22482
|
+
|
|
22483
|
+
}
|
|
22484
|
+
|
|
22485
|
+
}
|
|
22486
|
+
|
|
22487
|
+
}
|
|
22488
|
+
|
|
22489
|
+
html += '</tr>';
|
|
22490
|
+
//console.log('i=', i);
|
|
22491
|
+
|
|
22492
|
+
}
|
|
22493
|
+
html += '</tbody>';
|
|
22494
|
+
html += '</table>';
|
|
22495
|
+
|
|
22496
|
+
|
|
22497
|
+
html += '</div>';
|
|
22498
|
+
|
|
22499
|
+
html += '</div>';
|
|
22500
|
+
|
|
22501
|
+
(this._SfOnboardingSuspenseContainer as HTMLDivElement).innerHTML = html;
|
|
22502
|
+
|
|
22503
|
+
const buttonApply = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22504
|
+
buttonApply.addEventListener('click', () => {
|
|
22505
|
+
let inputSuspenseCheckboxes = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelectorAll('.suspense-input') as NodeListOf<HTMLInputElement>;
|
|
22506
|
+
let tempSuspenseList: any = {}
|
|
22507
|
+
for(let inputSuspenseCheckbox of inputSuspenseCheckboxes){
|
|
22508
|
+
let index = inputSuspenseCheckbox.id.split("-")[1]
|
|
22509
|
+
if(inputSuspenseCheckbox.checked){
|
|
22510
|
+
let item = sourceArray.data.mappings.mappings[index]
|
|
22511
|
+
let suspenseKey = item.entityid + ';' + item.locationid + ';' + item.id
|
|
22512
|
+
tempSuspenseList[suspenseKey] = true
|
|
22513
|
+
}
|
|
22514
|
+
}
|
|
22515
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList)
|
|
22516
|
+
})
|
|
22517
|
+
|
|
22518
|
+
const buttonSave = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22519
|
+
buttonSave.addEventListener('click', async () => {
|
|
22520
|
+
console.log('saving suspense', suspenseList, Object.keys(suspenseList).length);
|
|
22521
|
+
let response = await this.uploadMappedSuspense(suspenseList)
|
|
22522
|
+
console.log('suspense save response', response);
|
|
22523
|
+
this.loadOnboardingSuspense()
|
|
22524
|
+
})
|
|
22525
|
+
|
|
22526
|
+
const buttonToggleMoreBack = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-toggle-more-back') as HTMLButtonElement;
|
|
22527
|
+
const buttonToggleMore = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-toggle-more') as HTMLButtonElement;
|
|
22528
|
+
|
|
22529
|
+
buttonToggleMore.addEventListener('click', async (ev: any) => {
|
|
22530
|
+
|
|
22531
|
+
ev.target.classList.add('hide');
|
|
22532
|
+
buttonToggleMoreBack.classList.remove('hide');
|
|
22533
|
+
|
|
22534
|
+
const buttonExportMappingCSV = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
|
|
22535
|
+
buttonExportMappingCSV.style.display = 'flex';
|
|
22536
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22537
|
+
// buttonApply.style.display = 'flex';
|
|
22538
|
+
const buttonLoadLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
|
|
22539
|
+
buttonLoadLocal.style.display = 'flex';
|
|
22540
|
+
const buttonSaveLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
|
|
22541
|
+
buttonSaveLocal.style.display = 'flex';
|
|
22542
|
+
const buttonSave = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22543
|
+
buttonSave.style.display = 'flex';
|
|
22544
|
+
|
|
22545
|
+
const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
|
|
22546
|
+
buttonExportMappingCSVNew?.addEventListener('click', async () => {
|
|
22547
|
+
let csvArray = JSON.parse(JSON.stringify(sourceArray.data.mappings.mappings))
|
|
22548
|
+
for (let [i, obj] of csvArray.entries()) {
|
|
22549
|
+
let tempCsvObj = obj
|
|
22550
|
+
if (obj['cols'] != null && obj['data'] != null) {
|
|
22551
|
+
let dataArr = JSON.parse(obj['data'])
|
|
22552
|
+
let colsArr = JSON.parse(obj['cols'])
|
|
22553
|
+
for (let [j, colKey] of colsArr.entries()) {
|
|
22554
|
+
tempCsvObj['cols_' + colKey] = dataArr[j]
|
|
22555
|
+
}
|
|
22556
|
+
}
|
|
22557
|
+
csvArray[i] = tempCsvObj
|
|
22558
|
+
}
|
|
22559
|
+
console.log('csv array', csvArray)
|
|
22560
|
+
let csvData = Util.convertToCSV(csvArray);
|
|
22561
|
+
// let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
|
|
22562
|
+
console.log('csvData', csvData);
|
|
22563
|
+
const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
|
|
22564
|
+
const url = window.URL.createObjectURL(blob)
|
|
22565
|
+
const a = document.createElement('a')
|
|
22566
|
+
a.setAttribute('href', url)
|
|
22567
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().getTime() + '.csv');
|
|
22568
|
+
a.click()
|
|
22569
|
+
})
|
|
22570
|
+
|
|
22571
|
+
const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
|
|
22572
|
+
buttonLoadLocalNew?.addEventListener('click', async () => {
|
|
22573
|
+
console.log('load-local');
|
|
22574
|
+
((this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('#fileInput') as HTMLInputElement).click();
|
|
22575
|
+
});
|
|
22576
|
+
|
|
22577
|
+
const fileInput = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('#fileInput') as HTMLButtonElement;
|
|
22578
|
+
fileInput.value = '';
|
|
22579
|
+
const fileInputNew = Util.clearListeners(fileInput);
|
|
22580
|
+
fileInputNew.addEventListener('change', (e: any) => {
|
|
22581
|
+
|
|
22582
|
+
var frCsv = new FileReader();
|
|
22583
|
+
frCsv.onload = () => {
|
|
22584
|
+
console.log('taggingarray onload called');
|
|
22585
|
+
console.log('csv result', frCsv.result);
|
|
22586
|
+
const tempArr = Util.parseCsv(frCsv.result + "");
|
|
22587
|
+
console.log('csv data', tempArr)
|
|
22588
|
+
let changeCount = 0;
|
|
22589
|
+
let tempSuspenseList: any = {}
|
|
22590
|
+
for (let obj of tempArr) {
|
|
22591
|
+
let suspenseKey = obj.entityid + ';' + obj.locationid + ';' + obj.id
|
|
22592
|
+
if ((suspenseList[suspenseKey] == null && obj.suspense == true) || (suspenseList[suspenseKey] != null && obj.suspense == false)) {
|
|
22593
|
+
console.log('adding to suspense change', suspenseKey, suspenseList[suspenseKey], obj.suspense)
|
|
22594
|
+
this.changedOnboardingItemIds.push(suspenseKey)
|
|
22595
|
+
changeCount++
|
|
22596
|
+
}
|
|
22597
|
+
tempSuspenseList[suspenseKey] = obj.suspense
|
|
22598
|
+
}
|
|
22599
|
+
this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
|
|
22600
|
+
() => {
|
|
22601
|
+
this.clearMessages();
|
|
22602
|
+
this.changedOnboardingItemIds = [];
|
|
22603
|
+
(buttonToggleMoreBack as HTMLButtonElement).click();
|
|
22604
|
+
},
|
|
22605
|
+
() => {
|
|
22606
|
+
this.clearMessages();
|
|
22607
|
+
this.renderOnboardingSuspense(sourceArray, tempSuspenseList);
|
|
22608
|
+
}
|
|
22609
|
+
])
|
|
22610
|
+
// let tempObj:any = {"data":{"mappings":{"mappings":tempArr}}}
|
|
22611
|
+
// let tempObj:{data:{mappings:{mappings:any[]}}} = {data:{mappings:{mappings:tempArr}}}
|
|
22612
|
+
|
|
22613
|
+
|
|
22614
|
+
}
|
|
22615
|
+
if (e.target.files[0].name.toLowerCase().indexOf("suspense".toLowerCase()) >= 0) {
|
|
22616
|
+
frCsv.readAsText(e.target.files[0]);
|
|
22617
|
+
}
|
|
22618
|
+
})
|
|
22619
|
+
|
|
22620
|
+
const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
|
|
22621
|
+
buttonSaveLocalNew?.addEventListener('click', async () => {
|
|
22622
|
+
console.log('save-local');
|
|
22623
|
+
const blob = new Blob([JSON.stringify(sourceArray)], { type: 'text/plain' });
|
|
22624
|
+
const url = window.URL.createObjectURL(blob)
|
|
22625
|
+
const a = document.createElement('a')
|
|
22626
|
+
a.setAttribute('href', url)
|
|
22627
|
+
a.setAttribute('download', 'mapping_suspense_' + new Date().toLocaleString() + '.txt');
|
|
22628
|
+
a.click()
|
|
22629
|
+
});
|
|
22630
|
+
|
|
22631
|
+
});
|
|
22632
|
+
|
|
22633
|
+
buttonToggleMoreBack.addEventListener('click', async (ev: any) => {
|
|
22634
|
+
|
|
22635
|
+
ev.target.classList.add('hide');
|
|
22636
|
+
buttonToggleMore.classList.remove('hide');
|
|
22637
|
+
const buttonDownloadBackups = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-download-backups') as HTMLButtonElement;
|
|
22638
|
+
buttonDownloadBackups.style.display = 'none';
|
|
22639
|
+
const buttonExportMapping = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping') as HTMLButtonElement;
|
|
22640
|
+
buttonExportMapping.style.display = 'none';
|
|
22641
|
+
const buttonExportMappingCSV = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
|
|
22642
|
+
buttonExportMappingCSV.style.display = 'none';
|
|
22643
|
+
// const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
|
|
22644
|
+
// buttonApply.style.display = 'none';
|
|
22645
|
+
const buttonLoadLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
|
|
22646
|
+
buttonLoadLocal.style.display = 'none';
|
|
22647
|
+
const buttonSaveLocal = (this._SfOnboardingSuspenseContainer as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
|
|
22648
|
+
buttonSaveLocal.style.display = 'none';
|
|
22649
|
+
// const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
|
|
22650
|
+
// buttonSave.style.display = 'none';
|
|
22651
|
+
|
|
22652
|
+
});
|
|
22653
|
+
|
|
22654
|
+
this.changedOnboardingItemIds = [];
|
|
22655
|
+
}
|
|
22656
|
+
|
|
22657
|
+
renderOnboardingSuspenseOld = (_suspenseList: any) => {
|
|
22318
22658
|
|
|
22319
22659
|
//console.log('calendarjobs', calendarJobs);
|
|
22320
22660
|
|
|
@@ -27541,6 +27881,39 @@ export class SfIEvents extends LitElement {
|
|
|
27541
27881
|
await this.uploadOnboardingMapping(data, 'countries');
|
|
27542
27882
|
}
|
|
27543
27883
|
|
|
27884
|
+
uploadMappedSuspense = async (data: any) => {
|
|
27885
|
+
|
|
27886
|
+
//console.log('uploading..', data);
|
|
27887
|
+
|
|
27888
|
+
let url = "https://" + this.apiId + "/updatemappedsuspense";
|
|
27889
|
+
|
|
27890
|
+
const body = {
|
|
27891
|
+
"projectid": this.projectId,
|
|
27892
|
+
"data": JSON.stringify(data),
|
|
27893
|
+
}
|
|
27894
|
+
|
|
27895
|
+
let authorization: any = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
27896
|
+
let xhr: any = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
|
|
27897
|
+
this._SfLoader.innerHTML = '';
|
|
27898
|
+
if (xhr.status == 200) {
|
|
27899
|
+
|
|
27900
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
27901
|
+
console.log('jsonResponse suspense', jsonRespose);
|
|
27902
|
+
return jsonRespose;
|
|
27903
|
+
} else {
|
|
27904
|
+
if (xhr.status == 401) {
|
|
27905
|
+
let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
|
|
27906
|
+
this.dispatchEvent(changeEvent);
|
|
27907
|
+
}
|
|
27908
|
+
const jsonRespose = JSON.parse(xhr.responseText);
|
|
27909
|
+
this.setError(jsonRespose.error);
|
|
27910
|
+
setTimeout(() => {
|
|
27911
|
+
this.clearMessages()
|
|
27912
|
+
}, 2000);
|
|
27913
|
+
}
|
|
27914
|
+
|
|
27915
|
+
}
|
|
27916
|
+
|
|
27544
27917
|
uploadOnboardingMapping = async (data: any, onboardingstep: string) => {
|
|
27545
27918
|
|
|
27546
27919
|
//console.log('uploading..', data);
|
|
@@ -27738,7 +28111,7 @@ export class SfIEvents extends LitElement {
|
|
|
27738
28111
|
|
|
27739
28112
|
uploadTriggerMyEvent = async (complianceid: string, message: string, countryname: string, entityname: string, locationname: string, statute: string, subcategory: string, suspenseVal: any = {}) => {
|
|
27740
28113
|
|
|
27741
|
-
let url = "https://" + this.apiId + "/
|
|
28114
|
+
let url = "https://" + this.apiId + "/triggermyevent2";
|
|
27742
28115
|
|
|
27743
28116
|
const body = {
|
|
27744
28117
|
"projectid": this.projectId,
|
|
@@ -29584,7 +29957,7 @@ export class SfIEvents extends LitElement {
|
|
|
29584
29957
|
|
|
29585
29958
|
fetchSuspenseList = async () => {
|
|
29586
29959
|
|
|
29587
|
-
let url = "https://" + this.apiId + "/
|
|
29960
|
+
let url = "https://" + this.apiId + "/getsuspenselist1";
|
|
29588
29961
|
const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
|
|
29589
29962
|
const year = this.getCurrentYearGeneric();
|
|
29590
29963
|
const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "year": year }, url, this._SfLoader, authorization)) as any;
|
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
|
}
|