sf-i-events 1.0.977 → 1.0.978

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.
@@ -14,6 +14,7 @@ import { Chart, ChartItem, registerables } from 'chart.js';
14
14
  import { SfIElasticText } from 'sf-i-elastic-text';
15
15
  import { SfIMultitextarea } from 'sf-i-multitextarea';
16
16
  import { SfIReporting } from 'sf-i-reporting';
17
+ import { SfMultiselectSearch } from 'sf-multiselect-search';
17
18
  // import {LitElement, html, css} from 'lit';
18
19
  // import {customElement} from 'lit/decorators.js';
19
20
 
@@ -3112,6 +3113,9 @@ export class SfIEvents extends LitElement {
3112
3113
  @query('#internalcontrols-container')
3113
3114
  _SfOnboardingInternalControlsContainer: any;
3114
3115
 
3116
+ @query('#reportedlocations-list-container')
3117
+ _SfOnboardingReportedLocationsListContainer: any;
3118
+
3115
3119
  @query('#reportedlocations-container')
3116
3120
  _SfOnboardingReportedLocationsContainer: any;
3117
3121
 
@@ -7755,7 +7759,7 @@ export class SfIEvents extends LitElement {
7755
7759
  console.log('idArr', idArr);
7756
7760
  const mmdd = idArr[2] + "/" + idArr[3];
7757
7761
  const j = idArr[4];
7758
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
7762
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
7759
7763
  let renewEvent = this.events[mmdd][j];
7760
7764
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
7761
7765
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -10240,82 +10244,86 @@ export class SfIEvents extends LitElement {
10240
10244
  this.renderOnboardingStatutes(mappedStatutes);
10241
10245
  }
10242
10246
 
10243
- loadOnboardingCompliances = async () => {
10247
+ loadOnboardingCompliances = async (selectedStatutes: any = []) => {
10244
10248
  this.hideTabContainers();
10245
10249
  (this._SfOnboardingCompliancesContainer as HTMLDivElement).style.display = 'flex';
10246
- const mappedStatutes = await this.fetchMappedStatutes();
10247
- const mappedCompliances = await this.fetchMappedCompliances();
10248
- this.renderOnboardingCompliances(mappedStatutes, mappedCompliances);
10250
+ const mappedStatutes = await this.fetchMappedStatutesList();
10251
+ console.log("mapped statutes", mappedStatutes);
10252
+ // const mappedStatutes = await this.fetchMappedStatutes();
10253
+ // const mappedCompliances = await this.fetchMappedCompliances();
10254
+ // this.renderOnboardingCompliances(mappedStatutes, mappedCompliances);
10255
+ this.renderOnboardingStatutesDropdownMapping(this._SfOnboardingCompliancesContainer as HTMLDivElement, mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.renderOnboardingCompliances);
10249
10256
  }
10250
10257
 
10251
- loadOnboardingCountries = async () => {
10258
+ loadOnboardingCountries = async (selectedStatutes: any = []) => {
10252
10259
  this.hideTabContainers();
10253
10260
  (this._SfOnboardingCountriesContainer as HTMLDivElement).style.display = 'flex';
10261
+ const mappedStatutes = await this.fetchMappedStatutesList();
10254
10262
  // const countriesJobs = await this.fetchCountriesJobs();
10255
- const mappedCountries = await this.fetchMappedCountries();
10256
- const mappedCompliances = await this.fetchMappedCompliances();
10263
+ // const mappedCountries = await this.fetchMappedCountries();
10264
+ // const mappedCompliances = await this.fetchMappedCompliances();
10257
10265
  // const mappedStatutes = await this.fetchMappedStatutes();
10258
- //console.log('countriesJobs', countriesJobs);
10259
- console.log('mappedCompliances', mappedCompliances);
10260
- console.log('mappedCountries', mappedCountries);
10261
-
10262
-
10263
- for (var i = 0; i < mappedCompliances.data.mappings.mappings.length; i++) {
10264
-
10265
- if (mappedCompliances.data.mappings.mappings[i].id == "33a0deab-e93e-41b7-831a-473f9ea3eea2") {
10266
- //console.log('uniqcol zero', mappedCompliances.data.mappings.mappings[i]);
10267
- }
10268
-
10269
- }
10270
- this.renderOnboardingCountries(mappedCountries, mappedCompliances, null);
10266
+ // //console.log('countriesJobs', countriesJobs);
10267
+ // console.log('mappedCompliances', mappedCompliances);
10268
+ // console.log('mappedCountries', mappedCountries);
10269
+ // this.renderOnboardingCountries(mappedCountries, mappedCompliances, null);
10270
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingCountriesContainer as HTMLDivElement, 'countries-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, () => { return [] }, this.fetchMappedCountries, this.renderOnboardingCountries);
10271
10271
  }
10272
10272
 
10273
- loadOnboardingEntities = async () => {
10273
+ loadOnboardingEntities = async (selectedStatutes: any = []) => {
10274
10274
  this.hideTabContainers();
10275
10275
  (this._SfOnboardingEntitiesContainer as HTMLDivElement).style.display = 'flex';
10276
10276
  // const entitiesJobs = await this.fetchEntitiesJobs();
10277
- const mappedEntities = await this.fetchMappedEntities();
10278
- const mappedSerializedCountries = await this.fetchMappedSerializedCountries();
10279
- const arrStatuteEntitiesApplicabilities = await this.loadProposedFromStatutes(1);
10280
- // const mappedStatutes = await this.fetchMappedStatutes();
10277
+ const mappedStatutes = await this.fetchMappedStatutesList();
10278
+ // const mappedEntities = await this.fetchMappedEntities();
10279
+ // const mappedSerializedCountries = await this.fetchMappedSerializedCountries();
10280
+ // const arrStatuteEntitiesApplicabilities = await this.loadProposedFromStatutes(1);
10281
+ // // const mappedStatutes = await this.fetchMappedStatutes();
10281
10282
  //console.log('mappedSerializedCountries', mappedSerializedCountries);
10282
10283
  //console.log('mappedEntities', mappedEntities);
10283
10284
  //console.log('entitiesApplicabilities', arrStatuteEntitiesApplicabilities);
10284
- this.renderOnboardingEntities(mappedEntities, mappedSerializedCountries, null, arrStatuteEntitiesApplicabilities);
10285
+ // this.renderOnboardingEntities(mappedEntities, mappedSerializedCountries, null, arrStatuteEntitiesApplicabilities);
10286
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingEntitiesContainer as HTMLDivElement, 'entities-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedCountries, this.fetchMappedEntities, this.renderOnboardingEntities);
10285
10287
  }
10286
10288
 
10287
- loadOnboardingLocations = async () => {
10289
+ loadOnboardingLocations = async (selectedStatutes: any = []) => {
10288
10290
  this.hideTabContainers();
10289
10291
  (this._SfOnboardingLocationsContainer as HTMLDivElement).style.display = 'flex';
10290
10292
  // const locationsJobs = await this.fetchLocationsJobs();
10291
- const mappedSerializedEntities = await this.fetchMappedSerializedEntities();
10292
- const mappedLocations = await this.fetchMappedLocations();
10293
+ const mappedStatutes = await this.fetchMappedStatutesList();
10294
+ // const mappedSerializedEntities = await this.fetchMappedSerializedEntities();
10295
+ // const mappedLocations = await this.fetchMappedLocations();
10293
10296
  //console.log('mappedserializedentities', mappedSerializedEntities);
10294
- //console.log('mappedlocations', mappedLocations);
10295
- this.renderOnboardingLocations(mappedLocations, mappedSerializedEntities, null);
10297
+ //console.log('mappedlocations', mappedLocations);
10298
+ // this.renderOnboardingLocations(mappedLocations, mappedSerializedEntities, null);
10299
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingLocationsContainer as HTMLDivElement, 'locations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedEntities, this.fetchMappedLocations, this.renderOnboardingLocations);
10296
10300
  }
10297
10301
 
10298
- loadOnboardingFunctions = async () => {
10302
+ loadOnboardingFunctions = async (selectedStatutes: any = []) => {
10299
10303
  this.hideTabContainers();
10300
10304
  (this._SfOnboardingFunctionsContainer as HTMLDivElement).style.display = 'flex';
10305
+ const mappedStatutes = await this.fetchMappedStatutesList()
10301
10306
  // const functionsJobs = await this.fetchFunctionJobs();
10302
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10303
- const mappedFunctions = await this.fetchMappedFunctions();
10307
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10308
+ // const mappedFunctions = await this.fetchMappedFunctions();
10304
10309
  //console.log('functionjobs', functionsJobs);
10305
10310
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10306
10311
  //console.log('mappedfunctions', mappedFunctions);
10307
- this.renderOnboardingFunctions(mappedFunctions, mappedSerializedLocations, null);
10312
+ // this.renderOnboardingFunctions(mappedFunctions, mappedSerializedLocations, null);
10313
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingFunctionsContainer as HTMLDivElement, 'functions-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedLocations, this.fetchMappedFunctions, this.renderOnboardingFunctions);
10308
10314
  }
10309
10315
 
10310
- loadOnboardingTags = async () => {
10316
+ loadOnboardingTags = async (selectedStatutes: any = []) => {
10311
10317
  this.hideTabContainers();
10312
10318
  (this._SfOnboardingTagsContainer as HTMLDivElement).style.display = 'flex';
10319
+ const mappedStatutes = await this.fetchMappedStatutesList()
10313
10320
  // const tagsJobs = await this.fetchTagsJobs();
10314
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10315
- const mappedTags = await this.fetchMappedTags();
10321
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10322
+ // const mappedTags = await this.fetchMappedTags();
10316
10323
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10317
10324
  //console.log('mappedtags', mappedTags);
10318
- this.renderOnboardingTags(mappedTags, mappedSerializedLocations, null);
10325
+ // this.renderOnboardingTags(mappedTags, mappedSerializedLocations, null);
10326
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingTagsContainer as HTMLDivElement, 'tags-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedTags, this.renderOnboardingTags);
10319
10327
  }
10320
10328
 
10321
10329
  loadProposedFromStatutes = async (fieldIndex: number) => {
@@ -10337,175 +10345,206 @@ export class SfIEvents extends LitElement {
10337
10345
  return arrStatuteReporters;
10338
10346
  }
10339
10347
 
10340
- loadOnboardingReporters = async () => {
10348
+ loadOnboardingReporters = async (selectedStatutes: any = []) => {
10341
10349
  this.hideTabContainers();
10342
10350
  (this._SfOnboardingReportersContainer as HTMLDivElement).style.display = 'flex';
10351
+ const mappedStatutes = await this.fetchMappedStatutesList()
10343
10352
  // const reportersJobs = await this.fetchReportersJobs();
10344
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10345
- const mappedReporters = await this.fetchMappedReporters();
10353
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10354
+ // const mappedReporters = await this.fetchMappedReporters();
10346
10355
  // const arrStatuteReporters = await this.loadProposedFromStatutes(1);
10347
10356
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10348
10357
  //console.log('mappedreporters', mappedReporters);
10349
10358
  //console.log('arrstatutereporters', arrStatuteReporters);
10350
- this.renderOnboardingReporters(mappedReporters, mappedSerializedLocations, null, null);
10359
+ // this.renderOnboardingReporters(mappedReporters, mappedSerializedLocations, null, null);
10360
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingReportersContainer as HTMLDivElement, 'reporters-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedReporters, this.renderOnboardingReporters);
10351
10361
  }
10352
10362
 
10353
- loadOnboardingApprovers = async () => {
10363
+ loadOnboardingApprovers = async (selectedStatutes: any = []) => {
10354
10364
  this.hideTabContainers();
10355
10365
  (this._SfOnboardingApproversContainer as HTMLDivElement).style.display = 'flex';
10366
+ const mappedStatutes = await this.fetchMappedStatutesList()
10356
10367
  // const approversJobs = await this.fetchApproversJobs();
10357
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10358
- const mappedApprovers = await this.fetchMappedApprovers();
10368
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10369
+ // const mappedApprovers = await this.fetchMappedApprovers();
10359
10370
  // const arrStatuteApprovers = await this.loadProposedFromStatutes(2);
10360
10371
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10361
10372
  //console.log('mappedapprovers', mappedApprovers);
10362
- this.renderOnboardingApprovers(mappedApprovers, mappedSerializedLocations, null, null);
10373
+ // this.renderOnboardingApprovers(mappedApprovers, mappedSerializedLocations, null, null);
10374
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingApproversContainer as HTMLDivElement, 'approvers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedApprovers, this.renderOnboardingApprovers);
10363
10375
  }
10364
10376
 
10365
- loadOnboardingFunctionHeads = async () => {
10377
+ loadOnboardingFunctionHeads = async (selectedStatutes: any = []) => {
10366
10378
  this.hideTabContainers();
10367
10379
  (this._SfOnboardingFunctionHeadsContainer as HTMLDivElement).style.display = 'flex';
10380
+ const mappedStatutes = await this.fetchMappedStatutesList()
10368
10381
  // const functionHeadsJobs = await this.fetchFunctionHeadsJobs();
10369
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10370
- const mappedFunctionHeads = await this.fetchMappedFunctionHeads();
10382
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10383
+ // const mappedFunctionHeads = await this.fetchMappedFunctionHeads();
10371
10384
  // const arrStatuteFunctionheads = await this.loadProposedFromStatutes(3);
10372
10385
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10373
10386
  //console.log('mappedfunctionheads', mappedFunctionHeads);
10374
- this.renderOnboardingFunctionHeads(mappedFunctionHeads, mappedSerializedLocations, null, null);
10387
+ // this.renderOnboardingFunctionHeads(mappedFunctionHeads, mappedSerializedLocations, null, null);
10388
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingFunctionHeadsContainer as HTMLDivElement, 'functionheads-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedFunctionHeads, this.renderOnboardingFunctionHeads);
10375
10389
  }
10376
10390
 
10377
- loadOnboardingViewers = async () => {
10391
+ loadOnboardingViewers = async (selectedStatutes: any = []) => {
10378
10392
  this.hideTabContainers();
10379
10393
  (this._SfOnboardingViewersContainer as HTMLDivElement).style.display = 'flex';
10394
+ const mappedStatutes = await this.fetchMappedStatutesList()
10380
10395
  // const makerViewersJobs = await this.fetchViewersJobs();
10381
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10382
- const mappedViewers = await this.fetchMappedViewers();
10396
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10397
+ // const mappedViewers = await this.fetchMappedViewers();
10383
10398
  // const arrStatuteViewers = await this.loadProposedFromStatutes(5);
10384
10399
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10385
10400
  //console.log('mappedViewers', mappedViewers);
10386
- this.renderOnboardingViewers(mappedViewers, mappedSerializedLocations, null, null);
10401
+ // this.renderOnboardingViewers(mappedViewers, mappedSerializedLocations, null, null);
10402
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingViewersContainer as HTMLDivElement, 'viewers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedViewers, this.renderOnboardingViewers);
10387
10403
  }
10388
10404
 
10389
- loadOnboardingDocs = async () => {
10405
+ loadOnboardingDocs = async (selectedStatutes: any = []) => {
10390
10406
  this.hideTabContainers();
10391
10407
  (this._SfOnboardingDocsContainer as HTMLDivElement).style.display = 'flex';
10408
+ const mappedStatutes = await this.fetchMappedStatutesList()
10392
10409
  // const docsJobs = await this.fetchDocsJobs();
10393
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10394
- const mappedDocs = await this.fetchMappedDocs();
10410
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10411
+ // const mappedDocs = await this.fetchMappedDocs();
10395
10412
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10396
10413
  //console.log('mappedDocs', mappedDocs);
10397
- this.renderOnboardingDocs(mappedDocs, mappedSerializedLocations, null);
10414
+ // this.renderOnboardingDocs(mappedDocs, mappedSerializedLocations, null);
10415
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingDocsContainer as HTMLDivElement, 'docs-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedDocs, this.renderOnboardingDocs);
10398
10416
  }
10399
10417
 
10400
- loadOnboardingMakerCheckers = async () => {
10418
+ loadOnboardingMakerCheckers = async (selectedStatutes: any = []) => {
10401
10419
  this.hideTabContainers();
10402
10420
  (this._SfOnboardingMakerCheckersContainer as HTMLDivElement).style.display = 'flex';
10421
+ const mappedStatutes = await this.fetchMappedStatutesList()
10403
10422
  // const makerCheckersJobs = await this.fetchMakerCheckersJobs();
10404
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10405
- const mappedMakerCheckers = await this.fetchMappedMakerCheckers();
10423
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10424
+ // const mappedMakerCheckers = await this.fetchMappedMakerCheckers();
10406
10425
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10407
10426
  //console.log('mappedMakerCheckers', mappedMakerCheckers);
10408
- this.renderOnboardingMakerCheckers(mappedMakerCheckers, mappedSerializedLocations, null);
10427
+ // this.renderOnboardingMakerCheckers(mappedMakerCheckers, mappedSerializedLocations, null);
10428
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingMakerCheckersContainer as HTMLDivElement, 'makercheckers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedMakerCheckers, this.renderOnboardingMakerCheckers);
10409
10429
  }
10410
10430
 
10411
- loadOnboardingAuditors = async () => {
10431
+ loadOnboardingAuditors = async (selectedStatutes: any = []) => {
10412
10432
  this.hideTabContainers();
10413
10433
  (this._SfOnboardingAuditorsContainer as HTMLDivElement).style.display = 'flex';
10434
+ const mappedStatutes = await this.fetchMappedStatutesList()
10414
10435
  // const auditorsJobs = await this.fetchAuditorsJobs();
10415
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10416
- const mappedAuditors = await this.fetchMappedAuditors();
10436
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10437
+ // const mappedAuditors = await this.fetchMappedAuditors();
10417
10438
  // const arrStatuteAuditors = await this.loadProposedFromStatutes(4);
10418
10439
  //console.log('mappedSerializedFunctionheads', mappedSerializedLocations);
10419
10440
  //console.log('mappedAuditors', mappedAuditors);
10420
- this.renderOnboardingAuditors(mappedAuditors, mappedSerializedLocations, null, null);
10441
+ // this.renderOnboardingAuditors(mappedAuditors, mappedSerializedLocations, null, null);
10442
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingAuditorsContainer as HTMLDivElement, 'auditors-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedAuditors, this.renderOnboardingAuditors);
10443
+
10421
10444
  }
10422
10445
 
10423
- loadOnboardingDuedates = async () => {
10446
+ loadOnboardingDuedates = async (selectedStatutes: any = []) => {
10424
10447
  this.hideTabContainers();
10425
10448
  (this._SfOnboardingDuedatesContainer as HTMLDivElement).style.display = 'flex';
10449
+ const mappedStatutes = await this.fetchMappedStatutesList()
10426
10450
  // const duedatesJobs = await this.fetchDueDatesJobs();
10427
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10428
- const mappedDuedates = await this.fetchMappedDuedates();
10451
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10452
+ // const mappedDuedates = await this.fetchMappedDuedates();
10429
10453
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
10430
10454
  //console.log('mappedduedates', mappedDuedates);
10431
- this.renderOnboardingDuedates(mappedDuedates, mappedSerializedLocations, null);
10455
+ // this.renderOnboardingDuedates(mappedDuedates, mappedSerializedLocations, null);
10456
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingDuedatesContainer as HTMLDivElement, 'duedates-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedDuedates, this.renderOnboardingDuedates);
10432
10457
  }
10433
10458
 
10434
- loadOnboardingActivations = async () => {
10459
+ loadOnboardingActivations = async (selectedStatutes: any = []) => {
10435
10460
  this.hideTabContainers();
10436
10461
  (this._SfOnboardingActivationsContainer as HTMLDivElement).style.display = 'flex';
10462
+ const mappedStatutes = await this.fetchMappedStatutesList()
10437
10463
  // const activationsJobs = await this.fetchExtensionsJobs();
10438
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10439
- const mappedActivations = await this.fetchMappedActivations();
10464
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10465
+ // const mappedActivations = await this.fetchMappedActivations();
10440
10466
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10441
10467
  //console.log('mappedactivations', mappedActivations);
10442
- this.renderOnboardingActivations(mappedActivations, mappedSerializedLocations, null);
10468
+ // this.renderOnboardingActivations(mappedActivations, mappedSerializedLocations, null);
10469
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingActivationsContainer as HTMLDivElement, 'activations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedActivations, this.renderOnboardingActivations);
10443
10470
  }
10444
10471
 
10445
- loadOnboardingInvalidations = async () => {
10472
+ loadOnboardingInvalidations = async (selectedStatutes: any = []) => {
10446
10473
  this.hideTabContainers();
10447
10474
  (this._SfOnboardingInvalidationsContainer as HTMLDivElement).style.display = 'flex';
10475
+ const mappedStatutes = await this.fetchMappedStatutesList()
10448
10476
  // const invalidationsJobs = await this.fetchExtensionsJobs();
10449
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10450
- const mappedInvalidations = await this.fetchMappedInvalidations();
10477
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10478
+ // const mappedInvalidations = await this.fetchMappedInvalidations();
10451
10479
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10452
10480
  //console.log('mappedinvalidations', mappedInvalidations);
10453
- this.renderOnboardingInvalidations(mappedInvalidations, mappedSerializedLocations, null);
10481
+ // this.renderOnboardingInvalidations(mappedInvalidations, mappedSerializedLocations, null);
10482
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingInvalidationsContainer as HTMLDivElement, 'invalidations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedInvalidations, this.renderOnboardingInvalidations);
10454
10483
  }
10455
10484
 
10456
- loadOnboardingAlertSchedules = async () => {
10485
+ loadOnboardingAlertSchedules = async (selectedStatutes: any = []) => {
10457
10486
  this.hideTabContainers();
10458
10487
  (this._SfOnboardingAlertSchedulesContainer as HTMLDivElement).style.display = 'flex';
10488
+ const mappedStatutes = await this.fetchMappedStatutesList()
10459
10489
  // const alertschedulesJobs = await this.fetchAlertSchedulesJobs();
10460
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10461
- const mappedAlertSchedules = await this.fetchMappedAlertSchedules();
10490
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10491
+ // const mappedAlertSchedules = await this.fetchMappedAlertSchedules();
10462
10492
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10463
10493
  //console.log('mappedalertschedules', mappedAlertSchedules);
10464
- this.renderOnboardingAlertSchedules(mappedAlertSchedules, mappedSerializedLocations, null);
10494
+ // this.renderOnboardingAlertSchedules(mappedAlertSchedules, mappedSerializedLocations, null);
10495
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingAlertSchedulesContainer as HTMLDivElement, 'alertschedules-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedAlertSchedules, this.renderOnboardingAlertSchedules);
10465
10496
  }
10466
10497
 
10467
- loadOnboardingExtensions = async () => {
10498
+ loadOnboardingExtensions = async (selectedStatutes: any = []) => {
10468
10499
  this.hideTabContainers();
10469
10500
  (this._SfOnboardingExtensionsContainer as HTMLDivElement).style.display = 'flex';
10501
+ const mappedStatutes = await this.fetchMappedStatutesList()
10470
10502
  // const extensionsJobs = await this.fetchExtensionsJobs();
10471
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10472
- const mappedExtensions = await this.fetchMappedExtensions();
10503
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10504
+ // const mappedExtensions = await this.fetchMappedExtensions();
10473
10505
  //console.log('mappedserializedlocations', mappedSerializedLocations);
10474
10506
  //console.log('mappedextensions', mappedExtensions);
10475
- this.renderOnboardingExtensions(mappedExtensions, mappedSerializedLocations, null);
10507
+ // this.renderOnboardingExtensions(mappedExtensions, mappedSerializedLocations, null);
10508
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingExtensionsContainer as HTMLDivElement, 'extensions-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedExtensions, this.renderOnboardingExtensions);
10476
10509
  }
10477
10510
 
10478
- loadOnboardingTriggers = async () => {
10511
+ loadOnboardingTriggers = async (selectedStatutes: any = []) => {
10479
10512
  this.hideTabContainers();
10480
10513
  (this._SfOnboardingTriggersContainer as HTMLDivElement).style.display = 'flex';
10514
+ const mappedStatutes = await this.fetchMappedStatutesList()
10481
10515
  // const triggersJobs = await this.fetchInternalControlsJobs();
10482
10516
  // const mappedSerializedAlertSchedules = await this.fetchMappedSerializedAlertSchedules();
10483
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10484
- const mappedTriggers = await this.fetchMappedTriggers();
10517
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10518
+ // const mappedTriggers = await this.fetchMappedTriggers();
10485
10519
  //console.log('mappedSerializedAlertSchedules', mappedSerializedAlertSchedules);
10486
10520
  //console.log('mappedTriggers', mappedTriggers);
10487
- this.renderOnboardingTriggers(mappedTriggers, mappedSerializedLocations, null);
10521
+ // this.renderOnboardingTriggers(mappedTriggers, mappedSerializedLocations, null);
10522
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingTriggersContainer as HTMLDivElement, 'triggers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedTriggers, this.renderOnboardingTriggers);
10488
10523
  }
10489
10524
 
10490
- loadOnboardingInternalControls = async () => {
10525
+ loadOnboardingInternalControls = async (selectedStatutes: any = []) => {
10491
10526
  this.hideTabContainers();
10492
10527
  (this._SfOnboardingInternalControlsContainer as HTMLDivElement).style.display = 'flex';
10528
+ const mappedStatutes = await this.fetchMappedStatutesList()
10493
10529
  // const internalcontrolsJobs = await this.fetchInternalControlsJobs();
10494
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10495
- const mappedInternalControls = await this.fetchMappedInternalControls();
10530
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10531
+ // const mappedInternalControls = await this.fetchMappedInternalControls();
10496
10532
  //console.log('mappedSerializedlocations', mappedSerializedLocations);
10497
10533
  //console.log('mappedinternalcontrols', mappedInternalControls);
10498
- this.renderOnboardingInternalControls(mappedInternalControls, mappedSerializedLocations, null);
10534
+ // this.renderOnboardingInternalControls(mappedInternalControls, mappedSerializedLocations, null);
10535
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingInternalControlsContainer as HTMLDivElement, 'internalcontrols-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedInternalControls, this.renderOnboardingInternalControls);
10499
10536
  }
10500
10537
 
10501
- loadOnboardingReportedLocations = async () => {
10538
+ loadOnboardingReportedLocations = async (selectedStatutes: any = []) => {
10502
10539
  this.hideTabContainers();
10503
10540
  (this._SfOnboardingReportedLocationsContainer as HTMLDivElement).style.display = 'flex';
10504
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10505
- const mappedReportedLocations = await this.fetchMappedReportedLocations();
10541
+ const mappedStatutes = await this.fetchMappedStatutesList()
10542
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
10543
+ // const mappedReportedLocations = await this.fetchMappedReportedLocations();
10506
10544
  //console.log('mappedSerializedlocations', mappedSerializedLocations);
10507
10545
  //console.log('mappedReportedLocations', mappedReportedLocations);
10508
- this.renderOnboardingReportedLocations(mappedReportedLocations, mappedSerializedLocations, null);
10546
+ // this.renderOnboardingReportedLocations(mappedReportedLocations, mappedSerializedLocations, null);
10547
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingReportedLocationsContainer as HTMLDivElement, 'reportedlocations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedReportedLocations, this.renderOnboardingReportedLocations);
10509
10548
  }
10510
10549
 
10511
10550
  loadOnboardingSignoff = async () => {
@@ -12467,7 +12506,7 @@ export class SfIEvents extends LitElement {
12467
12506
  console.log('idArr', idArr);
12468
12507
  const mmdd = idArr[2] + "/" + idArr[3];
12469
12508
  const j = idArr[4];
12470
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
12509
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
12471
12510
  let renewEvent = this.events[mmdd][j];
12472
12511
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
12473
12512
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -13200,7 +13239,7 @@ export class SfIEvents extends LitElement {
13200
13239
  console.log('idArr', idArr);
13201
13240
  const mmdd = idArr[2] + "/" + idArr[3];
13202
13241
  const j = idArr[4];
13203
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
13242
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
13204
13243
  let renewEvent = this.events[mmdd][j];
13205
13244
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
13206
13245
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -13413,7 +13452,7 @@ export class SfIEvents extends LitElement {
13413
13452
  const startDate = new Date(startDateStr);
13414
13453
  const endDate = new Date(endDateStr);
13415
13454
  const month = parseInt(monthStr, 10); // Ensure month is a number
13416
-
13455
+ console.log('getting date', startDate, endDate, month);
13417
13456
  if (isNaN(month) || month < 1 || month > 12) {
13418
13457
  return this.calendarStartYYYY
13419
13458
  }
@@ -14494,7 +14533,7 @@ export class SfIEvents extends LitElement {
14494
14533
  console.log('idArr', idArr);
14495
14534
  const mmdd = idArr[2] + "/" + idArr[3];
14496
14535
  const j = idArr[4];
14497
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
14536
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
14498
14537
  let renewEvent = this.events[mmdd][j];
14499
14538
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
14500
14539
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -20169,6 +20208,63 @@ export class SfIEvents extends LitElement {
20169
20208
 
20170
20209
  }
20171
20210
 
20211
+ applyAndReloadTaggingNew = (e: any, colName: string, taggingArray: any, sourceArray: any, divElement: any) => {
20212
+
20213
+ const selectedIndex = e.currentTarget.id.split('-')[1];
20214
+ const tempArray = [];
20215
+ console.log('sourceArray apply', sourceArray, taggingArray);
20216
+ console.log('selectedindexchecking 1', this.selectedCbs)
20217
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
20218
+ console.log('selectedindexchecking', selectedIndex, count, this.selectedCbs.includes(selectedIndex + ""), this.selectedCbs.includes(count + ""));
20219
+ tempArray.push(taggingArray.data.mappings.mappings[count]);
20220
+ if (this.selectedCbs.includes(selectedIndex + '') && this.selectedCbs.includes(count + '')) {
20221
+ if (((divElement as HTMLDivElement).querySelector('#tags-' + selectedIndex) as SfIForm).selectedValues != null) {
20222
+
20223
+ if (tempArray[count] == null) tempArray[count] = {};
20224
+ tempArray[count][colName] = ((divElement as HTMLDivElement).querySelector('#tags-' + selectedIndex) as SfIForm).selectedValues();
20225
+ } else {
20226
+
20227
+ if (tempArray[count] == null) tempArray[count] = {};
20228
+ tempArray[count][colName] = ((divElement as HTMLDivElement).querySelector('#tags-' + selectedIndex) as HTMLInputElement).value;
20229
+ }
20230
+
20231
+ } else {
20232
+
20233
+ if (((divElement as HTMLDivElement).querySelector('#tags-' + count) as SfIForm).selectedValues != null) {
20234
+
20235
+ if (tempArray[count] == null) tempArray[count] = {};
20236
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
20237
+ let selectedValues = ((divElement as HTMLDivElement).querySelector('#tags-' + count) as SfIForm).selectedValues()
20238
+ if (selectedValues == null || selectedValues.length == 0) {
20239
+ tempArray[count] = {};
20240
+ console.log('deleting1', tempArray)
20241
+ } else {
20242
+ tempArray[count][colName] = ((divElement as HTMLDivElement).querySelector('#tags-' + count) as SfIForm).selectedValues();
20243
+ }
20244
+ } else {
20245
+ tempArray[count][colName] = ((divElement as HTMLDivElement).querySelector('#tags-' + count) as SfIForm).selectedValues();
20246
+ }
20247
+
20248
+
20249
+ } else {
20250
+ //console.log('selectedindexchecking D');
20251
+
20252
+ if (tempArray[count] == null) tempArray[count] = {};
20253
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
20254
+ tempArray[count] = {};
20255
+ console.log('deleting2', tempArray);
20256
+ } else {
20257
+ tempArray[count][colName] = ((divElement as HTMLDivElement).querySelector('#tags-' + count) as HTMLInputElement).value;
20258
+ }
20259
+ }
20260
+ }
20261
+ }
20262
+
20263
+ taggingArray.data.mappings.mappings = tempArray;
20264
+ console.log('selectedindexchecking', colName, taggingArray);
20265
+
20266
+ }
20267
+
20172
20268
  getDataValue = (jsonData: any, id: string) => {
20173
20269
 
20174
20270
  let ret: any = null;
@@ -20203,7 +20299,7 @@ export class SfIEvents extends LitElement {
20203
20299
 
20204
20300
  }
20205
20301
 
20206
- saveMapping = async (divElement: any, uploadBlock: number, jsonData: any, extraFields: any, searchString: string, uploadFunction: any, refreshFunction: any, saveInBackground: boolean = false) => {
20302
+ saveMapping = async (divElement: any, uploadBlock: number, jsonData: any, extraFields: any, searchString: string, uploadFunction: any, refreshFunction: any, saveInBackground: boolean = false, mappedStatutes: Array<any>) => {
20207
20303
 
20208
20304
  const process = async () => {
20209
20305
  const tableRowArr = (divElement as HTMLDivElement).querySelectorAll('.tablerow') as NodeListOf<HTMLTableRowElement>;
@@ -20218,33 +20314,85 @@ export class SfIEvents extends LitElement {
20218
20314
  let updatedRows = [];
20219
20315
  let jsonArr = [];
20220
20316
  if (uploadBlock < 0) {
20221
- for (var i = 0; i < checkboxArr.length; i++) {
20317
+ if (mappedStatutes.length == 0) {
20318
+ for (var i = 0; i < checkboxArr.length; i++) {
20222
20319
 
20223
- //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
20320
+ //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
20321
+ if (checkboxArr[i].checked !== true) {
20322
+ continue;
20323
+ }
20224
20324
 
20225
- if ((tableRowArr[i] as HTMLTableRowElement).style.display == 'none') {
20226
- } else {
20227
- updatedRows.push((statuteArr[i] as SfIElasticText).text);
20325
+ if ((tableRowArr[i] as HTMLTableRowElement).style.display == 'none') {
20326
+ } else {
20327
+ updatedRows.push((statuteArr[i] as SfIElasticText).text);
20328
+ }
20329
+ let cols = JSON.parse(this.getColsValue(jsonData, (statuteArr[i] as SfIElasticText).text)[0]);
20330
+ let data = JSON.parse(this.getDataValue(jsonData, (statuteArr[i] as SfIElasticText).text)[0]);
20331
+ var dataToBePushed: any = { id: (statuteArr[i] as SfIElasticText).text, name: data[cols.indexOf('name')], countryname: data[cols.indexOf('country')][0] };
20332
+ /* var dataToBePushed = { id: (statuteArr[k] as SfIElasticText).text, selected: checkboxArr[k].checked, data: this.getDataValue(jsonData, (statuteArr[k] as SfIElasticText).text), cols: this.getColsValue(jsonData, (statuteArr[k] as SfIElasticText).text), extraFields: [] as string[], updatedFields: [] as string[] };
20333
+ for (var j = 0; j < extraFields.length; j++) {
20334
+ const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
20335
+ const value = inputArr[k].getValues();
20336
+ dataToBePushed.extraFields.push(value);
20337
+ if (j === 0) {
20338
+ const fields = inputArr[i].getFields();
20339
+ dataToBePushed.updatedFields.push(...fields);
20340
+ }
20341
+ } */
20342
+
20343
+ jsonArr.push(dataToBePushed)
20228
20344
  }
20345
+ console.log('jsonArr', jsonArr);
20346
+ //console.log('updatedRows', updatedRows);
20347
+ // const batchNum = new Date().getTime();
20348
+ // await uploadFunction({ "searchstring": searchString, "mappings": jsonArr, "batch": batchNum, "updatedrows": updatedRows });
20229
20349
 
20230
- var dataToBePushed = { id: (statuteArr[i] as SfIElasticText).text, selected: checkboxArr[i].checked, data: this.getDataValue(jsonData, (statuteArr[i] as SfIElasticText).text), cols: this.getColsValue(jsonData, (statuteArr[i] as SfIElasticText).text), extraFields: [] as string[], updatedFields: [] as string[] };
20231
- for (var j = 0; j < extraFields.length; j++) {
20232
- const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
20233
- const value = inputArr[i].getValues();
20234
- // //console.log('value', value);
20235
- dataToBePushed.extraFields.push(value);
20236
- if (j === 0) {
20237
- const fields = inputArr[i].getFields();
20238
- dataToBePushed.updatedFields.push(...fields);
20350
+ await uploadFunction({ "searchstring": searchString, "mappings": jsonArr });
20351
+ } else {
20352
+ for (var i = 0; i < checkboxArr.length; i++) {
20353
+
20354
+ //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
20355
+ if (checkboxArr[i].checked !== true) {
20356
+ continue;
20357
+ }
20358
+
20359
+ if ((tableRowArr[i] as HTMLTableRowElement).style.display == 'none') {
20360
+ } else {
20361
+ updatedRows.push((statuteArr[i] as SfIElasticText).text);
20362
+ }
20363
+ let cols = JSON.parse(this.getColsValue(jsonData, (statuteArr[i] as SfIElasticText).text)[0]);
20364
+ let data = JSON.parse(this.getDataValue(jsonData, (statuteArr[i] as SfIElasticText).text)[0]);
20365
+ var dataToBePushed: any = { id: (statuteArr[i] as SfIElasticText).text, data: [JSON.stringify(data)], cols: [JSON.stringify(cols)] };
20366
+ /* var dataToBePushed = { id: (statuteArr[k] as SfIElasticText).text, selected: checkboxArr[k].checked, data: this.getDataValue(jsonData, (statuteArr[k] as SfIElasticText).text), cols: this.getColsValue(jsonData, (statuteArr[k] as SfIElasticText).text), extraFields: [] as string[], updatedFields: [] as string[] };
20367
+ for (var j = 0; j < extraFields.length; j++) {
20368
+ const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
20369
+ const value = inputArr[k].getValues();
20370
+ dataToBePushed.extraFields.push(value);
20371
+ if (j === 0) {
20372
+ const fields = inputArr[i].getFields();
20373
+ dataToBePushed.updatedFields.push(...fields);
20374
+ }
20375
+ } */
20376
+
20377
+ jsonArr.push(dataToBePushed)
20378
+ }
20379
+ let jsonObj: { [key: string]: { [key: string]: any } } = {};
20380
+
20381
+ for (let statuteObj of mappedStatutes) {
20382
+ let statuteid = statuteObj.id;
20383
+ if (jsonObj[statuteid] == null) {
20384
+ jsonObj[statuteid] = {};
20385
+ }
20386
+ for (let mappingObj of jsonArr) {
20387
+ console.log('mappingObj', mappingObj.data, statuteid);
20388
+ if (mappingObj.data[0].indexOf(statuteid) >= 0) {
20389
+ jsonObj[statuteid][mappingObj.id] = mappingObj;
20390
+ }
20239
20391
  }
20240
20392
  }
20241
20393
 
20242
- jsonArr.push(dataToBePushed)
20394
+ await uploadFunction(jsonObj, mappedStatutes);
20243
20395
  }
20244
- //console.log('jsonArr', jsonArr);
20245
- //console.log('updatedRows', updatedRows);
20246
- const batchNum = new Date().getTime();
20247
- await uploadFunction({ "searchstring": searchString, "mappings": jsonArr, "batch": batchNum, "updatedrows": updatedRows });
20248
20396
 
20249
20397
  } else {
20250
20398
 
@@ -20261,7 +20409,7 @@ export class SfIEvents extends LitElement {
20261
20409
 
20262
20410
  if ((statuteArr[k] as SfIElasticText) != null) {
20263
20411
 
20264
- var dataToBePushed = { id: (statuteArr[k] as SfIElasticText).text, selected: checkboxArr[k].checked, data: this.getDataValue(jsonData, (statuteArr[k] as SfIElasticText).text), cols: this.getColsValue(jsonData, (statuteArr[k] as SfIElasticText).text), extraFields: [] as string[], updatedFields: [] as string[] };
20412
+ var dataToBePushed: any = { id: (statuteArr[k] as SfIElasticText).text, selected: checkboxArr[k].checked, data: this.getDataValue(jsonData, (statuteArr[k] as SfIElasticText).text), cols: this.getColsValue(jsonData, (statuteArr[k] as SfIElasticText).text), extraFields: [] as string[], updatedFields: [] as string[] };
20265
20413
  for (var j = 0; j < extraFields.length; j++) {
20266
20414
  const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
20267
20415
  const value = inputArr[k].getValues();
@@ -20287,7 +20435,7 @@ export class SfIEvents extends LitElement {
20287
20435
 
20288
20436
  }
20289
20437
 
20290
- if (!saveInBackground) refreshFunction();
20438
+ if (!saveInBackground) refreshFunction(mappedStatutes);
20291
20439
  }
20292
20440
 
20293
20441
  if (this.disablesave == "yes") {
@@ -20312,14 +20460,54 @@ export class SfIEvents extends LitElement {
20312
20460
 
20313
20461
  }
20314
20462
 
20315
- saveTagging = async (mapping: any, uploadFunction: any, refreshFunction: any, saveInBackground: boolean) => {
20463
+ saveTagging = async (mapping: any, selectedStatutes: any, uploadFunction: any, refreshFunction: any, saveInBackground: boolean, colName: string) => {
20316
20464
 
20317
20465
  async function process() {
20318
20466
 
20319
- //console.log('Saving...', mapping);
20467
+ console.log('Saving...', JSON.stringify(mapping));
20468
+ let statuteids = []
20469
+ let statutewiseMapping: any = {}
20470
+ for (let statutesObj of selectedStatutes) {
20471
+ statuteids.push(statutesObj.id);
20472
+ statutewiseMapping[statutesObj.id] = {};
20473
+ for (let mapObj of mapping.mappings) {
20474
+ if (mapObj.statuteid == statutesObj.id) {
20475
+ let pushObj = mapObj;
20476
+ delete pushObj.statuteid
20477
+ let compoundid = mapObj.id
20478
+
20479
+ // if (colName == "countries" || colName == "entities" || colName == "locations") {
20480
+ switch (colName) {
20481
+ case "countries":
20482
+ compoundid = mapObj.id
20483
+ break;
20484
+
20485
+ case "entities":
20486
+ compoundid = mapObj.countryid + ';' + mapObj.id;
20487
+ break;
20488
+
20489
+ case "locations":
20490
+ compoundid = mapObj.entityid + ';' + mapObj.id;
20491
+ break;
20492
+
20493
+ default:
20494
+ compoundid = mapObj.entityid + ';' + mapObj.locationid + ';' + mapObj.id
20495
+ break;
20496
+ }
20320
20497
 
20321
- await uploadFunction(mapping);
20322
- if (!saveInBackground) refreshFunction();
20498
+ // }
20499
+ if (statutewiseMapping[statutesObj.id][compoundid] != null) {
20500
+ let pushObjOld = statutewiseMapping[statutesObj.id][compoundid];
20501
+ pushObj[colName] = [...pushObjOld[colName], ...mapObj[colName]]
20502
+ } else {
20503
+ statutewiseMapping[statutesObj.id][compoundid] = pushObj;
20504
+ }
20505
+ }
20506
+ }
20507
+ }
20508
+ console.log('Uploading ...', JSON.stringify(statutewiseMapping));
20509
+ await uploadFunction(statutewiseMapping, statuteids);
20510
+ if (!saveInBackground) refreshFunction(selectedStatutes);
20323
20511
  }
20324
20512
 
20325
20513
  if (this.disablesave == "yes") {
@@ -21497,7 +21685,7 @@ export class SfIEvents extends LitElement {
21497
21685
 
21498
21686
  const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
21499
21687
  buttonSave?.addEventListener('click', async () => {
21500
- await this.saveTagging(taggingArray.data.mappings, uploadFunction, refreshFunction, false);
21688
+ await this.saveTagging(taggingArray.data.mappings, [], uploadFunction, refreshFunction, false, colName);
21501
21689
  });
21502
21690
 
21503
21691
  const buttonCancel = (divElement as HTMLDivElement).querySelector('.button-cancel') as HTMLButtonElement;
@@ -21541,139 +21729,1149 @@ export class SfIEvents extends LitElement {
21541
21729
  this.changedOnboardingItemIds = []
21542
21730
  }
21543
21731
 
21544
- renderMappingTable = (divElement: any, jsonData: Array<any>, cursor: Array<any>, fetchFunction: any, searchString: string, mappedArray: any, found: number, uploadFunction: any, refreshFunction: any, extraFields: Array<string>, uploadBlock: number, extraFieldPosition: number, colName: string, subfilter: string, statuteColName: string, extraHintsArr: Array<string>) => {
21545
- console.log('cols1', jsonData);
21546
- // console.log('cols', jsonData[0].data.cols);
21547
- //console.log('divelement', divElement);
21548
- //console.log('jsonData', jsonData);
21549
- //console.log('cursor', cursor);
21550
- //console.log('fetch', fetchFunction);
21551
- //console.log('searchstring', searchString);
21552
- //console.log('subfiltervalue', subfilter);
21553
-
21554
- const arrCompliancesFrequencies: any = {};
21555
-
21556
- if (jsonData.length === 0) return;
21732
+ renderTaggingTableNew = (divElement: any, selectedStatutes: any, sourceObject: any, sourceMapping: any, taggingObject: any, sourceCols: any, uploadFunction: any, refreshFunction: any, colName: any, uniqCols: Array<any>, apiIdDropdown: string, dropdownSearchPhrase: any, mandatoryFields: any, compareFields: Array<any>, anotherProjection: any, extraFields: Array<string>, _arrFeedbackReference: any, proposedUsersLabel: string, subfilter: string) => {
21733
+ console.log('sourceObj', sourceObject)
21734
+ console.log('taggingObj', taggingObject)
21735
+ let sourceArray: any = { data: { mappings: { mappings: sourceObject.data.mappings } } };
21736
+ let taggingArray: any = { data: { mappings: { mappings: taggingObject.data.mappings } } };
21737
+ if (taggingObject.data.mappings.mappings != null) {
21738
+ taggingArray = taggingObject;
21739
+ }
21740
+ console.log('divelement', divElement);
21741
+ console.log('sourcearray', sourceArray);
21742
+ console.log('sourceMapping', sourceMapping);
21743
+ console.log('taggingarray', JSON.stringify(taggingArray));
21744
+ console.log('selectedStatutes', selectedStatutes);
21557
21745
 
21558
21746
  this.selectedCbs = [];
21559
21747
 
21560
- let colCountry = -1;
21561
- let colState = -1;
21562
- let colSubcategory = -1;
21563
- let colStatute = -1;
21748
+ // const foundArr = [];
21564
21749
 
21565
- const unfilteredDict: any[] = [];
21750
+ // if (taggingArray.data.mappings != null && taggingArray.data.mappings.mappings.length > 0) {
21751
+ // console.log('scanning taggingarray', taggingArray.data.mappings.mappings.length + "");
21752
+ // for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
21566
21753
 
21567
- var html = '';
21754
+ // var found = false;
21568
21755
 
21569
- html += '<div>';
21570
- html += '<h3 part="results-title">Total Items (' + found + ')</h3>';
21571
- html += '<h4 id="span-filtered" part="results-title"></h4>'
21572
- html += '<h4 id="span-extra-filled" part="results-title"></h4>'
21573
- html += '</div>';
21756
+ // // console.log('source array search', sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id], taggingArray.data.mappings.mappings[i].id)
21757
+ // if (taggingArray.data.mappings.mappings[i].id != null && sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] != null) {
21574
21758
 
21759
+ // var equal = true;
21575
21760
 
21576
- html += '<div class="d-flex justify-between align-center left-sticky flex-wrap mb-20">';
21761
+ // for (var k = 0; k < uniqCols.length; k++) {
21762
+ // console.log('checking uniqCols', uniqCols[k]);
21763
+ // if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] != null && taggingArray.data.mappings.mappings[i] != null) {
21764
+ // if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
21765
+ // equal = false;
21766
+ // }
21767
+ // }
21577
21768
 
21578
- html += '<div id="div-subfiltered"></div>';
21579
- html += '<div id="scroll-overlay" part="onboarding-scroll-overlay" class="pos-fixed-scroll justify-center align-center">';
21580
- html += '<div id="scroll-overlay-left" class="mr-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_left_alt</span></button></div>';
21581
- html += '<div id="scroll-overlay-right" class="ml-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_right_alt</span></button></div>';
21582
- html += '</div>';
21769
+ // }
21583
21770
 
21584
- html += '<div id="detail-overlay" part="onboarding-detail-overlay" class="pos-fixed justify-center align-center hide">';
21585
- html += '<div class="cover-slide"></div>';
21586
- html += '<div class="detail-container p-10">';
21587
- html += '<div class="d-flex justify-between align-center mb-20">';
21588
- html += '<div part="results-title">Row Details</div>';
21589
- html += '<button part="button-icon" class="detail-close"><span class="material-symbols-outlined">close</span></button>';
21590
- html += '</div>';
21591
- html += '<div id="detail-overlay-list">';
21592
- html += '</div>';
21593
- html += '</div>';
21594
- html += '</div>';
21771
+ // if (equal) {
21772
+ // found = true;
21773
+ // }
21774
+ // }
21595
21775
 
21596
- html += '<div class="d-flex align-center">';
21597
- html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="' + subfilter + '" />';
21598
- html += '<div class="mr-10">';
21599
- 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>'
21600
- html += '<div style="position: absolute; margin-top: 5px;"><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></div>'
21601
- html += '</div>';
21602
- html += (this.disablesave == "yes" ? '' : '<button part="button" class="button-save" disabled>Save</button>');
21603
- html += '</div>';
21776
+ // if (found) {
21777
+ // foundArr.push(taggingArray.data.mappings.mappings[i]);
21778
+ // } else {
21779
+ // console.log('taggingarray not found', taggingArray.data.mappings.mappings[i], i)
21780
+ // }
21604
21781
 
21605
- html += '</div>';
21782
+ // }
21783
+ // } else {
21784
+ // console.log('taggingArray1', taggingArray.data.mappings, taggingArray.data.mappings.mappings)
21785
+ // }
21786
+ // console.log('taggingarray2', taggingArray.data.mappings.mappings.length + "");
21787
+ // if (taggingArray.data.mappings == null) {
21788
+ // taggingArray.data.mappings = {};
21789
+ // }
21606
21790
 
21607
- html += '<table id="table-data">';
21791
+ // taggingArray.data.mappings.mappings = foundArr;
21608
21792
 
21609
- html += '<thead>';
21610
- html += '<th part="td-head" class="td-head">'
21611
- // html += 'Select';
21612
- html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
21613
- html += '</th>'
21614
- html += '<th part="td-head" class="td-head">'
21615
- html += '<div>View</div>';
21616
- html += '</th>'
21617
- if (extraFieldPosition === 0) {
21618
- for (var i = 0; i < extraFields.length; i++) {
21619
- html += '<th part="td-head" class="td-head">'
21620
- html += extraFields[i];
21621
- html += '</th>'
21793
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
21794
+
21795
+ if (taggingArray.data.mappings.mappings[i].id != null && sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] == null) {
21796
+ taggingArray.data.mappings.mappings.splice(i, 1)
21622
21797
  }
21623
21798
  }
21624
- if (colName.toLowerCase() == "compliances") {
21625
- html += '<th part="td-head" class="td-head">'
21626
- html += 'Proposed Users';
21627
- html += '</th>'
21628
- }
21629
- html += '<th part="td-head" class="td-head">'
21630
- html += 'Id';
21631
- html += '</th>'
21799
+ let mandatoryPresent = true;
21800
+ console.log('mandatoryFields', mandatoryFields);
21801
+ for (i = 0; i < (mandatoryFields as Array<string>).length; i++) {
21632
21802
 
21633
- // for(var j = 0; j < JSON.parse(jsonData[0].data.cols).length; j++) {
21803
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
21634
21804
 
21635
- // if(jsonData[0].cols.includes(JSON.parse(jsonData[0].data.cols)[j])) {
21636
- // html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == JSON.parse(jsonData[0].data.cols)[j].toLowerCase() ? 'left-sticky' : '') + '">'
21637
- // html += JSON.parse(jsonData[0].data.cols)[j]
21638
- // html += '</th>'
21639
- // }
21640
21805
 
21641
- // }
21806
+ if (taggingArray.data.mappings.mappings[j][mandatoryFields[i]] == null) {
21807
+ console.log('mandatory not found', mandatoryFields[i])
21808
+ mandatoryPresent = false;
21809
+ }
21642
21810
 
21643
- for (var j = 0; j < jsonData[0].cols.length; j++) {
21644
- console.log('jsoncols', JSON.parse(jsonData[0].data.cols), jsonData[0].cols.length, j)
21645
- html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == (JSON.parse(jsonData[0].data.cols)[j] ?? "").toLowerCase() ? 'left-sticky' : '') + '">'
21646
- // html += jsonData[0].cols[j]
21647
- html += '</th>'
21811
+ }
21648
21812
 
21649
21813
  }
21650
21814
 
21651
- if (extraFieldPosition === 1) {
21652
- for (var i = 0; i < extraFields.length; i++) {
21653
- html += '<th part="td-head" class="td-head">'
21654
- html += extraFields[i];
21655
- html += '</th>'
21815
+ var taggedIds = []
21816
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
21817
+ if (taggingArray.data.mappings.mappings[j] != null) {
21818
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
21819
+ if (taggedIds.indexOf(taggingArray.data.mappings.mappings[j].id) < 0) {
21820
+ taggedIds.push(taggingArray.data.mappings.mappings[j].id)
21821
+ }
21822
+ }
21656
21823
  }
21657
21824
  }
21658
- html += '</thead>'
21659
21825
 
21660
- //console.log('colstate', JSON.parse(jsonData[0].data.cols));
21826
+ // if (taggedIds.length < Object.keys(sourceArray.data.mappings.mappings).length) {
21827
+ // for (let sourceid of Object.keys(sourceArray.data.mappings.mappings)) {
21828
+ // if (taggedIds.indexOf(sourceid) >= 0) {
21829
+ // continue;
21830
+ // }
21831
+ // let objToPush: any = { id: sourceid }
21832
+ // for (i = 0; i < (mandatoryFields as Array<string>).length; i++) {
21833
+ // objToPush[mandatoryFields[i]] = ""
21834
+ // }
21835
+ // taggingArray.data.mappings.mappings.push(objToPush);
21836
+ // }
21837
+ // }
21661
21838
 
21662
- for (var i = 0; i < JSON.parse(jsonData[0].data.cols).length; i++) {
21663
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "country") {
21664
- console.log('colstate country', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
21665
- colCountry = i;
21839
+ for (var i = 0; i < (sourceMapping.data?.mappings ?? []).length; i++) {
21840
+ let flagMatch = false;
21841
+ if (sourceArray.data.mappings.mappings[sourceMapping.data.mappings[i].id] == null) {
21842
+ continue;
21666
21843
  }
21667
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "state") {
21668
- //console.log('colstate state', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
21669
- colState = i;
21844
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
21845
+ if (taggingArray.data.mappings.mappings[j] != null) {
21846
+ if (sourceMapping.data.mappings[i].id == taggingArray.data.mappings.mappings[j].id) {
21847
+ let flagMatchObj = true;
21848
+ for (let objKey of compareFields) {
21849
+ if (sourceMapping.data.mappings[i][objKey] !== taggingArray.data.mappings.mappings[j][objKey] && taggingArray.data.mappings.mappings[j][objKey] != null) {
21850
+ console.log('Flag Mismatch', objKey, sourceMapping.data.mappings[i][objKey], taggingArray.data.mappings.mappings[j][objKey])
21851
+ flagMatchObj = false;
21852
+ break;
21853
+ }
21854
+ }
21855
+ if (flagMatchObj == true) {
21856
+ flagMatch = true;
21857
+ continue;
21858
+ }
21859
+ }
21860
+ }
21670
21861
  }
21671
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "subcategory") {
21672
- //console.log('colstate subcategory', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
21673
- colSubcategory = i;
21862
+ if (!flagMatch) {
21863
+ let objToPush: any = sourceMapping.data.mappings[i]
21864
+ for (i = 0; i < (mandatoryFields as Array<string>).length; i++) {
21865
+ objToPush[mandatoryFields[i]] = ""
21866
+ }
21867
+ taggingArray.data.mappings.mappings.push(objToPush);
21674
21868
  }
21675
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == statuteColName) {
21676
- //console.log('colstate statute', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
21869
+ }
21870
+
21871
+
21872
+ var tagged = 0;
21873
+ var changed = 0;
21874
+ var total = 0;
21875
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
21876
+ if (taggingArray.data.mappings.mappings[j] != null) {
21877
+ if (sourceMapping.data == null) {
21878
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
21879
+ total++;
21880
+ let tagStr = ""
21881
+ for (let col of compareFields) {
21882
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`
21883
+ }
21884
+ tagStr.slice(0, -1)
21885
+ if (this.changedOnboardingItemIds.length > 0) {
21886
+ let changedId = tagStr
21887
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
21888
+ changed++;
21889
+ }
21890
+ }
21891
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
21892
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
21893
+ let flagNull = false;
21894
+ for (let mandatoryfield of mandatoryFields) {
21895
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
21896
+ flagNull = true;
21897
+ break;
21898
+ }
21899
+ }
21900
+ if (flagNull) {
21901
+ continue
21902
+ }
21903
+ } else {
21904
+ continue;
21905
+ }
21906
+ }
21907
+ tagged++;
21908
+ }
21909
+ } else {
21910
+ let flagFound = false;
21911
+ for (let sourceObj of sourceMapping.data.mappings) {
21912
+ if (sourceObj.id == taggingArray.data.mappings.mappings[j].id) {
21913
+ let flagEqual = true;
21914
+ for (let col of compareFields) {
21915
+ if (sourceObj[col] != taggingArray.data.mappings.mappings[j][col] && taggingArray.data.mappings.mappings[j][col] != null) {
21916
+ flagEqual = false;
21917
+ break;
21918
+ }
21919
+ }
21920
+ if (flagEqual) {
21921
+ flagFound = true;
21922
+ break;
21923
+ }
21924
+ }
21925
+ }
21926
+ if (flagFound) {
21927
+ let tagStr = ""
21928
+ for (let col of compareFields) {
21929
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`
21930
+ }
21931
+ tagStr.slice(0, -1)
21932
+ total++;
21933
+ if (this.changedOnboardingItemIds.length > 0) {
21934
+ let changedId = tagStr
21935
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
21936
+ changed++;
21937
+ }
21938
+ }
21939
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
21940
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
21941
+ let flagNull = false;
21942
+ for (let mandatoryfield of mandatoryFields) {
21943
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
21944
+ flagNull = true;
21945
+ break;
21946
+ }
21947
+ }
21948
+ if (flagNull) {
21949
+ continue
21950
+ }
21951
+ } else {
21952
+ continue;
21953
+ }
21954
+ }
21955
+ tagged++;
21956
+ } else {
21957
+ console.log('tagged not found', taggingArray.data.mappings.mappings[j])
21958
+ }
21959
+ }
21960
+ }
21961
+ }
21962
+ console.log('taggingarray3', JSON.stringify(taggingArray.data.mappings.mappings));
21963
+ console.log('tagged', tagged, 'total', total);
21964
+ const unfilteredDict: any[] = [];
21965
+ if (divElement == null) {
21966
+ return;
21967
+ }
21968
+ var html = '';
21969
+
21970
+ var showTable = true;
21971
+
21972
+ html += '<div class="d-flex justify-between flex-wrap align-center"> ';
21973
+
21974
+ var status = '';
21975
+ if (tagged < total) {
21976
+ status = '<span class="color-pending material-icons">pending</span>';
21977
+ } else {
21978
+ status = '<span class="color-done material-icons">check_circle</span>';
21979
+ }
21980
+
21981
+ var mandatoryStatus = '';
21982
+ if (!mandatoryPresent) {
21983
+ mandatoryStatus = '<span class="color-late-executed material-icons">error</span>&nbsp;&nbsp;Mandatory fields are not present';
21984
+ } else {
21985
+ mandatoryStatus = '<span class="color-done material-icons">check_circle</span>&nbsp;&nbsp;Mandatory fields are present';
21986
+ }
21987
+
21988
+ if (showTable) {
21989
+
21990
+ 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 + '&nbsp;&nbsp;Mapped ' + tagged + ' out of ' + total + '</h4></div>');
21991
+
21992
+ } else {
21993
+
21994
+ 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 + '&nbsp;&nbsp;Mapped ' + tagged + ' out of ' + total + '</h4></div>')
21995
+
21996
+ }
21997
+ if (changed > 0) {
21998
+ 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>&nbsp;&nbsp;' + changed + ' Items changed</h4></div>')
21999
+ }
22000
+ html += ('<div class="left-sticky d-flex justify-between align-center mr-10"><h4 part="results-title" class="d-flex align-center m-0">' + mandatoryStatus + '</h4></div>')
22001
+
22002
+ 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>')
22003
+
22004
+ html += '<div class="d-flex align-center">';
22005
+ html += '<div class="mr-10">';
22006
+ 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>'
22007
+
22008
+ html += '<div style="position: absolute; margin-top: 5px;">'
22009
+ 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>'
22010
+
22011
+ // console.log('jobs', jobs);
22012
+ 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>');
22013
+ html += '</div>';
22014
+ html += '</div>';
22015
+ 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>'
22016
+ 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>'
22017
+ html += '</div>';
22018
+
22019
+ html += '</div>';
22020
+
22021
+ html += '<div>';
22022
+ html += '<h4 id="span-filtered" part="results-title"></h4>'
22023
+ html += '<div id="div-subfiltered"></div>'
22024
+ html += '</div>';
22025
+
22026
+ html += '<br />';
22027
+
22028
+ var subfiltered = 0;
22029
+
22030
+ if (showTable) {
22031
+
22032
+ html += '<table id="table-data" class="mt-20" style="height: 200px">';
22033
+
22034
+ html += '<thead>';
22035
+ html += '<th part="td-head" class="td-head">'
22036
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
22037
+ html += '</th>'
22038
+ for (var i = 0; i < extraFields.length; i++) {
22039
+ html += '<th part="td-head" class="td-head">'
22040
+ html += extraFields[i];
22041
+ html += '</th>'
22042
+ }
22043
+ html += '<th part="td-head" class="td-head">'
22044
+ html += colName;
22045
+ html += '</th>'
22046
+
22047
+ for (i = 0; i < uniqCols.length; i++) {
22048
+ html += '<th part="td-head" class="td-head">'
22049
+ html += uniqCols[i];
22050
+ html += '</th>'
22051
+ }
22052
+ for (i = 0; i < sourceCols.length; i++) {
22053
+ html += '<th part="td-head" class="td-head">'
22054
+ html += sourceCols[i];
22055
+ html += '</th>'
22056
+ }
22057
+
22058
+ html += '</thead>';
22059
+ html += '<tbody>';
22060
+ // console.log('changedIds', this.changedOnboardingItemIds);
22061
+ for (i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
22062
+
22063
+ let complianceid = taggingArray.data.mappings.mappings[i].id
22064
+ console.log('compliance id', complianceid);
22065
+ var showSearch = false;
22066
+
22067
+ if (subfilter == "") {
22068
+ //console.log('showsearch true 1');
22069
+ showSearch = true;
22070
+ }
22071
+
22072
+ var classBg = "";
22073
+
22074
+ if (i % 2 === 0) {
22075
+ if (this.changedOnboardingItemIds.length > 0) {
22076
+ let changedId = ""
22077
+ for (let [k, col] of uniqCols.entries()) {
22078
+ // console.log('taggingarray rendered', i, col)
22079
+ changedId += taggingArray.data.mappings.mappings[i][col];
22080
+ if (k < (uniqCols.length - 1)) {
22081
+ changedId += ";"
22082
+ }
22083
+ }
22084
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
22085
+ classBg = 'td-light-selected';
22086
+ } else {
22087
+ classBg = 'td-light';
22088
+ }
22089
+ } else {
22090
+ classBg = 'td-light';
22091
+ }
22092
+ } else {
22093
+ if (this.changedOnboardingItemIds.length > 0) {
22094
+ let changedId = ""
22095
+ for (let [k, col] of uniqCols.entries()) {
22096
+ if (taggingArray.data.mappings.mappings[i] == null) {
22097
+ // console.log('id not found', i, taggingArray.data.mappings.mappings.length, sourceArray.data.mappings.mappings.length)
22098
+ }
22099
+ changedId += taggingArray.data.mappings.mappings[i][col];
22100
+ if (k < (uniqCols.length - 1)) {
22101
+ changedId += ";"
22102
+ }
22103
+ }
22104
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
22105
+ classBg = 'td-dark-selected';
22106
+ } else {
22107
+ classBg = 'td-dark';
22108
+ }
22109
+ } else {
22110
+ classBg = 'td-dark';
22111
+ }
22112
+ }
22113
+
22114
+ html += '<tr class="" id="tablerow-' + i + '">';
22115
+
22116
+ html += '<td class="left-sticky td-body ' + classBg + '" ><div class="' + (!showSearch ? 'truncate' : '') + '"><input id="cb-' + i + '" type="checkbox" class="checkbox-row cb-select"/></div></td>';
22117
+
22118
+ for (var j = 0; j < extraFields.length; j++) {
22119
+
22120
+ if (i < taggingArray.data.mappings.mappings.length) {
22121
+
22122
+ html += '<td part="td-body" class="' + classBg + '">';
22123
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">'
22124
+ html += '<textarea part="input" id="extra-field-' + i + '-' + j + '" class="extra-field extra-field-' + j + '" ' + (extraFields != null ? (extraFields[j] != null ? ((extraFields[j].toLowerCase() == "client remarks" && this.disableclientresponse.toLowerCase() == "yes") ? 'disabled' : ((extraFields[j].toLowerCase() == "flagggrc response" && this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '')) : "") : "") + ' >' + (taggingArray.data.mappings.mappings[i].extraFields != null ? (taggingArray.data.mappings.mappings[i].extraFields[j] != null ? (typeof taggingArray.data.mappings.mappings[i].extraFields[j] == 'string' ? taggingArray.data.mappings.mappings[i].extraFields[j] : "") : "") : "") + '</textarea>';
22125
+ html += '</div>';
22126
+ html += '</td>';
22127
+ } else {
22128
+
22129
+ html += '<td part="td-body" class="' + classBg + '">';
22130
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
22131
+ html += '<textarea part="input" id="extra-field-' + i + '-' + j + '" class="extra-field extra-field-' + j + '" type="text" value="" ' + ((extraFields[j].toLowerCase() == "flagggrc response" && this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + ' ></textarea>';
22132
+ html += '</div>';
22133
+ html += '</td>';
22134
+ }
22135
+
22136
+
22137
+ }
22138
+
22139
+ html += '<td class="td-body ' + classBg + '" part="td-key">'
22140
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
22141
+ if (apiIdDropdown.length > 0) {
22142
+ if (anotherProjection != null) {
22143
+ html += '<sf-i-form id="tags-' + i + '" class="tags-input tags-' + i + '" name="Tags" label="Select ' + colName + '" apiId="' + apiIdDropdown + '" mode="multiselect-dropdown" searchPhrase="' + this.projectName + ((dropdownSearchPhrase != null && dropdownSearchPhrase != "") ? dropdownSearchPhrase : "") + '" selectProjection="name" selectAnotherProjection="' + anotherProjection + '" mandatory></sf-i-form>';
22144
+ } else {
22145
+ html += '<sf-i-form id="tags-' + i + '" class="tags-input tags-' + i + '" name="Tags" label="Select ' + colName + '" apiId="' + apiIdDropdown + '" mode="multiselect-dropdown" searchPhrase="' + this.projectName + ((dropdownSearchPhrase != null && dropdownSearchPhrase != "") ? dropdownSearchPhrase : "") + '" selectProjection="name" mandatory></sf-i-form>';
22146
+ }
22147
+
22148
+ } else {
22149
+
22150
+ if (colName.toLowerCase() == "internalcontrols") {
22151
+ html += '<textarea id="tags-' + i + '" type="text" part="input" class="tags-input"></textarea>';
22152
+ } else {
22153
+ html += '<input id="tags-' + i + '" type="text" part="input" class="tags-input"/>';
22154
+ }
22155
+
22156
+ }
22157
+ html += '</div>';
22158
+ html += '</td>'
22159
+
22160
+ for (var l = 0; l < uniqCols.length; l++) {
22161
+ html += '<td class="td-body ' + classBg + '" part="td-key">'
22162
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
22163
+ html += '<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + taggingArray.data.mappings.mappings[i][uniqCols[l]].replace(/ *\([^)]*\) */g, "") + '" minLength="20"></sf-i-elastic-text>';
22164
+ html += '</div>';
22165
+ html += '</td>'
22166
+ }
22167
+
22168
+
22169
+ for (l = 0; l < sourceCols.length; l++) {
22170
+
22171
+ for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols).length; j++) {
22172
+
22173
+ if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols)[j]) {
22174
+
22175
+ if (sourceArray.data.mappings.mappings[complianceid].data != null) {
22176
+
22177
+ html += '<td class="td-body ' + classBg + '" part="td-body">';
22178
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
22179
+
22180
+ if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
22181
+
22182
+ for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j].length; k++) {
22183
+ html += ('<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j][k] + '" minLength="100" lineSize="4"></sf-i-elastic-text>');
22184
+ }
22185
+
22186
+ } else {
22187
+ if (typeof JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j] == "string" && Util.isJSONParsable(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
22188
+ html += ('<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j]) + '" minLength="100" lineSize="4"></sf-i-elastic-text>')
22189
+
22190
+ } else {
22191
+ html += ('<sf-i-elastic-text exportparts="highlight,highlight-count" text="' + JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j] + '" minLength="100" lineSize="4"></sf-i-elastic-text>')
22192
+ }
22193
+ }
22194
+
22195
+ html += '</div>';
22196
+ html += '</td>';
22197
+
22198
+ }
22199
+
22200
+ }
22201
+
22202
+ }
22203
+
22204
+ }
22205
+
22206
+ html += '</tr>';
22207
+ //console.log('i=', i);
22208
+
22209
+ }
22210
+ html += '</tbody>';
22211
+ html += '</table>';
22212
+
22213
+ }
22214
+ if (divElement == null) {
22215
+ return;
22216
+ }
22217
+ divElement.innerHTML = html;
22218
+
22219
+ if (unfilteredDict.length > 0) {
22220
+ var html = '';
22221
+ html += '<div class="mb-10">Items In Your Category (' + unfilteredDict.length + ")</div>";
22222
+ html += this.getFilterOnboardingString();
22223
+ ((divElement as HTMLDivElement).querySelector('#span-filtered') as HTMLDivElement).innerHTML = html;
22224
+
22225
+ } else {
22226
+ ((divElement as HTMLDivElement).querySelector('#span-filtered') as HTMLDivElement).style.display = 'none';
22227
+ }
22228
+
22229
+ if (subfiltered > 0) {
22230
+ ((divElement as HTMLDivElement).querySelector('#div-subfiltered') as HTMLDivElement).innerHTML = '<h4 part="results-title">Filtered Results (' + subfiltered + ')</h4>';
22231
+ }
22232
+
22233
+ if (this.getfilterOnboarding().length > 0) {
22234
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
22235
+
22236
+ if (!unfilteredDict.includes(i)) {
22237
+ const tableRow = (divElement as HTMLDivElement).querySelector('#tablerow-' + i);
22238
+ if (tableRow != null) {
22239
+ (tableRow as HTMLTableRowElement).style.display = 'none';
22240
+ }
22241
+
22242
+ }
22243
+
22244
+ }
22245
+ }
22246
+
22247
+ (divElement as HTMLDivElement).querySelector('.checkbox-all')?.addEventListener('change', (e: any) => {
22248
+
22249
+ ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22250
+
22251
+ const arrCheckBoxes = (divElement as HTMLDivElement).querySelectorAll('.checkbox-row') as NodeListOf<HTMLInputElement>;
22252
+ //console.log('cb-length', arrCheckBoxes.length);
22253
+ for (var i = 0; i < arrCheckBoxes.length; i++) {
22254
+ const tableRow = (divElement as HTMLDivElement).querySelector('#tablerow-' + (i)) as HTMLElement;
22255
+ //console.log('tablerow', i, tableRow);
22256
+ if (tableRow != null) {
22257
+ if (tableRow.style.display != 'none') {
22258
+ //console.log('tablerow setting', e.currentTarget.checked, (arrCheckBoxes[i] as HTMLInputElement));
22259
+ (arrCheckBoxes[i] as HTMLInputElement).checked = e.currentTarget.checked;
22260
+ if (e.currentTarget.checked) {
22261
+ if (!this.selectedCbs.includes(i + '')) {
22262
+ this.selectedCbs.push(i + '');
22263
+ }
22264
+ } else {
22265
+ this.selectedCbs = [];
22266
+ }
22267
+ }
22268
+ }
22269
+ }
22270
+
22271
+ //console.log('checkedarr', this.selectedCbs);
22272
+
22273
+ });
22274
+
22275
+ for (var j = 0; j < extraFields.length; j++) {
22276
+
22277
+ const inputArrJ = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIForm | HTMLInputElement>;
22278
+ for (var k = 0; k < inputArrJ.length; k++) {
22279
+ inputArrJ[k].addEventListener('keyup', (e: any) => {
22280
+
22281
+ ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22282
+
22283
+ if (e.key == "Enter") {
22284
+
22285
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
22286
+
22287
+ const activeIndex = e.target.id.split('-')[2];
22288
+
22289
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
22290
+
22291
+ taggingArray.data.mappings.mappings[count].extraFields = [];
22292
+
22293
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
22294
+
22295
+ for (var l = 0; l < extraFields.length; l++) {
22296
+ const inputExtraField = ((divElement as HTMLDivElement).querySelector('#extra-field-' + activeIndex + '-' + l) as HTMLInputElement);
22297
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value)
22298
+ }
22299
+
22300
+ } else {
22301
+
22302
+ for (var l = 0; l < extraFields.length; l++) {
22303
+ const inputExtraField = ((divElement as HTMLDivElement).querySelector('#extra-field-' + count + '-' + l) as HTMLInputElement);
22304
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value)
22305
+ }
22306
+
22307
+ }
22308
+
22309
+ }
22310
+
22311
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter)
22312
+
22313
+ }
22314
+
22315
+ // this.saveTagging(taggingArray.data.mappings, uploadFunction, refreshFunction, true);
22316
+
22317
+ });
22318
+
22319
+ inputArrJ[k].addEventListener('focusout', (e: any) => {
22320
+
22321
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
22322
+
22323
+ const activeIndex = e.target.id.split('-')[2];
22324
+
22325
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
22326
+
22327
+ taggingArray.data.mappings.mappings[count].extraFields = [];
22328
+
22329
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
22330
+
22331
+ for (var l = 0; l < extraFields.length; l++) {
22332
+ const inputExtraField = ((divElement as HTMLDivElement).querySelector('#extra-field-' + activeIndex + '-' + l) as HTMLInputElement);
22333
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value)
22334
+ }
22335
+
22336
+ } else {
22337
+
22338
+ for (var l = 0; l < extraFields.length; l++) {
22339
+ const inputExtraField = ((divElement as HTMLDivElement).querySelector('#extra-field-' + count + '-' + l) as HTMLInputElement);
22340
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value)
22341
+ }
22342
+
22343
+ }
22344
+
22345
+ }
22346
+
22347
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter)
22348
+
22349
+ });
22350
+ }
22351
+
22352
+ }
22353
+
22354
+ const multiArr = (divElement as HTMLDivElement).querySelectorAll('.tags-input') as NodeListOf<SfIForm | HTMLInputElement>;
22355
+
22356
+ for (var i = 0; i < multiArr.length; i++) {
22357
+
22358
+ if (apiIdDropdown.length > 0) {
22359
+
22360
+
22361
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
22362
+
22363
+ var equal = true;
22364
+ let complianceid = taggingArray.data.mappings.mappings[i].id
22365
+ for (var k = 0; k < uniqCols.length; k++) {
22366
+ if (uniqCols[k] != "id") { continue; }
22367
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
22368
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
22369
+ equal = false;
22370
+ }
22371
+ }
22372
+
22373
+ }
22374
+
22375
+ if (equal) {
22376
+ let preselctedVals = []
22377
+ if ((colName == "countries" || colName == "entities" || colName == "locations") && taggingArray.data.mappings.mappings[i][colName] == null) {
22378
+ let preselctedValsStr = ""
22379
+ for (let mandatoryfield of mandatoryFields) {
22380
+ if (taggingArray.data.mappings.mappings[i][mandatoryfield] == null || taggingArray.data.mappings.mappings[i][mandatoryfield] == "") {
22381
+ preselctedValsStr = ""
22382
+ } else {
22383
+ preselctedValsStr += `${taggingArray.data.mappings.mappings[i][mandatoryfield]};`
22384
+ }
22385
+ }
22386
+
22387
+ preselctedValsStr = preselctedValsStr.slice(0, -1);
22388
+ if (preselctedValsStr.indexOf(';') >= 0) {
22389
+ preselctedVals.push(preselctedValsStr)
22390
+ }
22391
+ } else {
22392
+ preselctedVals = taggingArray.data.mappings.mappings[i][colName];
22393
+ }
22394
+ (multiArr[i] as SfIForm).preselectedValues = JSON.stringify(preselctedVals);
22395
+ if (preselctedVals.length > 0) {
22396
+ ((multiArr[i] as SfIForm).parentElement as HTMLTableCellElement).setAttribute("part", "row-mapped");
22397
+ }
22398
+
22399
+ }
22400
+
22401
+ // }
22402
+
22403
+ multiArr[i].addEventListener('valueChanged', async (e: any) => {
22404
+
22405
+ ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22406
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
22407
+ });
22408
+
22409
+ } else {
22410
+
22411
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
22412
+
22413
+ var equal = true;
22414
+ let complianceid = taggingArray.data.mappings.mappings[i].id
22415
+ for (var k = 0; k < uniqCols.length; k++) {
22416
+ if (uniqCols[k] != "id") { continue; }
22417
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
22418
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
22419
+ equal = false;
22420
+ }
22421
+ }
22422
+
22423
+ }
22424
+
22425
+ if (equal) {
22426
+
22427
+ if (taggingArray.data.mappings.mappings[i] != null) {
22428
+ if (Util.isJSONParsable(sourceArray.data.mappings.mappings[complianceid][colName])) {
22429
+ (multiArr[i] as HTMLInputElement).value = JSON.parse(sourceArray.data.mappings.mappings[complianceid][colName])[0];
22430
+ } else {
22431
+ (multiArr[i] as HTMLInputElement).value = sourceArray.data.mappings.mappings[complianceid][colName] ?? "";
22432
+ }
22433
+ }
22434
+
22435
+ }
22436
+
22437
+ // }
22438
+
22439
+
22440
+
22441
+ multiArr[i].addEventListener('keyup', async (e: any) => {
22442
+
22443
+ if (e.key == "Enter") {
22444
+
22445
+ ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22446
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
22447
+ }
22448
+
22449
+ });
22450
+
22451
+ multiArr[i].addEventListener('focusout', async (e: any) => {
22452
+
22453
+ ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22454
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
22455
+ });
22456
+
22457
+
22458
+ }
22459
+
22460
+
22461
+ }
22462
+
22463
+ const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
22464
+ buttonApply.addEventListener('click', () => {
22465
+ // console.log('applied');
22466
+ // this.applyAndReloadTagging(e,colName, taggingArray, sourceArray, divElement);
22467
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter)
22468
+ })
22469
+
22470
+ const buttonToggleMoreBack = (divElement as HTMLDivElement).querySelector('.button-toggle-more-back') as HTMLButtonElement;
22471
+ const buttonToggleMore = (divElement as HTMLDivElement).querySelector('.button-toggle-more') as HTMLButtonElement;
22472
+
22473
+ buttonToggleMore.addEventListener('click', async (ev: any) => {
22474
+
22475
+ ev.target.classList.add('hide');
22476
+ buttonToggleMoreBack.classList.remove('hide');
22477
+ const buttonDownloadBackups = (divElement as HTMLDivElement).querySelector('.button-download-backups') as HTMLButtonElement;
22478
+ buttonDownloadBackups.style.display = 'flex';
22479
+ const buttonExportMapping = (divElement as HTMLDivElement).querySelector('.button-export-mapping') as HTMLButtonElement;
22480
+ buttonExportMapping.style.display = 'flex';
22481
+ const buttonExportMappingCSV = (divElement as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
22482
+ buttonExportMappingCSV.style.display = 'flex';
22483
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
22484
+ // buttonApply.style.display = 'flex';
22485
+ const buttonLoadLocal = (divElement as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
22486
+ buttonLoadLocal.style.display = 'flex';
22487
+ const buttonSaveLocal = (divElement as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
22488
+ buttonSaveLocal.style.display = 'flex';
22489
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
22490
+ // buttonSave.style.display = 'flex';
22491
+
22492
+ const buttonDownloadBackupsNew = Util.clearListeners(buttonDownloadBackups);
22493
+ buttonDownloadBackupsNew.addEventListener('click', async () => {
22494
+
22495
+ const result = await this.fetchGetStoredMapping(colName);
22496
+
22497
+ for (var i = 0; i < result.data.length; i++) {
22498
+
22499
+ const blob = new Blob([result.data[i].mappings != null ? JSON.stringify(result.data[i].mappings) : JSON.stringify(result.data[i])], { type: 'text/html' });
22500
+ const url = window.URL.createObjectURL(blob)
22501
+ const a = document.createElement('a')
22502
+ a.setAttribute('href', url)
22503
+ a.setAttribute('download', 'report_' + colName + '_' + i + '.json');
22504
+ a.click()
22505
+
22506
+ }
22507
+
22508
+ (buttonToggleMoreBack as HTMLButtonElement).click();
22509
+
22510
+ if (result.data.length === 0) {
22511
+
22512
+ this.setError("No backups found!")
22513
+ setTimeout(() => {
22514
+ this.clearMessages();
22515
+ }, 3000);
22516
+
22517
+ }
22518
+
22519
+ });
22520
+
22521
+ const buttonExportMappingNew = Util.clearListeners(buttonExportMapping);
22522
+ buttonExportMappingNew.addEventListener('click', async () => {
22523
+
22524
+ let valueStr: string[] = [];
22525
+
22526
+ for (var i = 0; i < multiArr.length; i++) {
22527
+
22528
+ if (apiIdDropdown.length > 0) {
22529
+
22530
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
22531
+
22532
+ var equal = true;
22533
+ let complianceid = taggingArray.data.mappings.mappings[j].id
22534
+ for (var k = 0; k < uniqCols.length; k++) {
22535
+ if (uniqCols[k] != "id") { continue; }
22536
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[j] != null) {
22537
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[j][uniqCols[k]]) {
22538
+ equal = false;
22539
+ }
22540
+ }
22541
+
22542
+ }
22543
+
22544
+ if (equal) {
22545
+ valueStr.push(JSON.stringify(taggingArray.data.mappings.mappings[j][colName]));
22546
+ }
22547
+ }
22548
+
22549
+ } else {
22550
+
22551
+ if (taggingArray.data.mappings.mappings[i] != null) {
22552
+ valueStr.push(taggingArray.data.mappings.mappings[i][colName]);
22553
+ } else {
22554
+ valueStr.push('');
22555
+ }
22556
+
22557
+ }
22558
+
22559
+ }
22560
+
22561
+ //console.log('valueStr', valueStr);
22562
+
22563
+ const valuesHTML = JSON.stringify(valueStr);
22564
+
22565
+ const outerHTML = '<h3>This extract is generated on ' + new Date() + '</h3>' + ((divElement as HTMLDivElement).querySelector('#span-filtered') as HTMLHeadingElement).outerHTML + '<br /><h2>' + ((divElement as HTMLDivElement).querySelector('#mapped-stats-title') as HTMLHeadingElement).outerHTML + '</h2>' + ((divElement as HTMLDivElement).querySelector('#table-data') as HTMLTableElement).outerHTML;
22566
+
22567
+ let tableHTML = this.TAGGING_HTML.replace(/TABLE_DATA/g, outerHTML);
22568
+ tableHTML = tableHTML.replace(/TABLE_VALUES/g, valuesHTML);
22569
+
22570
+ const blob = new Blob([tableHTML], { type: 'text/html' });
22571
+ const url = window.URL.createObjectURL(blob)
22572
+ const a = document.createElement('a')
22573
+ a.setAttribute('href', url)
22574
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.html');
22575
+ a.click()
22576
+
22577
+ });
22578
+
22579
+ const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
22580
+ buttonExportMappingCSVNew?.addEventListener('click', async () => {
22581
+ let csvArray = JSON.parse(JSON.stringify(taggingArray.data.mappings.mappings))
22582
+ for (let [i, obj] of csvArray.entries()) {
22583
+ let tempCsvObj = obj
22584
+ if (obj['cols'] != null && obj['data'] != null) {
22585
+ let dataArr = JSON.parse(obj['data'])
22586
+ let colsArr = JSON.parse(obj['cols'])
22587
+ for (let [j, colKey] of colsArr.entries()) {
22588
+ tempCsvObj['cols_' + colKey] = dataArr[j]
22589
+ }
22590
+ }
22591
+ csvArray[i] = tempCsvObj
22592
+ }
22593
+ console.log('csv array', csvArray)
22594
+ let csvData = Util.convertToCSV(csvArray);
22595
+ // let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
22596
+ console.log('csvData', csvData);
22597
+ const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
22598
+ const url = window.URL.createObjectURL(blob)
22599
+ const a = document.createElement('a')
22600
+ a.setAttribute('href', url)
22601
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.csv');
22602
+ a.click()
22603
+ })
22604
+
22605
+ const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
22606
+ buttonLoadLocalNew?.addEventListener('click', async () => {
22607
+ console.log('load-local');
22608
+ ((divElement as HTMLDivElement).querySelector('#fileInput') as HTMLInputElement).click();
22609
+ });
22610
+
22611
+ const fileInput = (divElement as HTMLDivElement).querySelector('#fileInput') as HTMLButtonElement;
22612
+ fileInput.value = '';
22613
+ const fileInputNew = Util.clearListeners(fileInput);
22614
+ fileInputNew.addEventListener('change', (e: any) => {
22615
+ var fr = new FileReader();
22616
+ fr.onload = () => {
22617
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, JSON.parse(fr.result + ""), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
22618
+ };
22619
+ var frCsv = new FileReader();
22620
+ frCsv.onload = () => {
22621
+ console.log('taggingarray onload called');
22622
+ console.log('csv result', frCsv.result);
22623
+ const tempArr = Util.parseCsv(frCsv.result + "");
22624
+ console.log('csv data', tempArr)
22625
+ let changeCount = 0;
22626
+ for (let [i, obj] of tempArr.entries()) {
22627
+ let tempObj = taggingArray.data.mappings.mappings[i]
22628
+ delete tempObj['delta'];
22629
+ delete tempObj['lastupdated'];
22630
+ let tempNewObj = obj
22631
+ delete tempNewObj['delta'];
22632
+ delete tempNewObj['lastupdated'];
22633
+ if (JSON.stringify(tempObj) !== JSON.stringify(tempNewObj)) {
22634
+ // console.log('item changed', taggingArray.data.mappings.mappings[i], obj)
22635
+ let changedId = ""
22636
+ for (let [k, col] of uniqCols.entries()) {
22637
+ if (col != "id") { continue; }
22638
+ changedId += tempObj[col];
22639
+ if (k < (uniqCols.length - 1)) {
22640
+ changedId += ";"
22641
+ }
22642
+ }
22643
+
22644
+ this.changedOnboardingItemIds.push(changedId)
22645
+ changeCount++
22646
+ }
22647
+ }
22648
+ this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
22649
+ () => {
22650
+ this.clearMessages();
22651
+ this.changedOnboardingItemIds = [];
22652
+ (buttonToggleMoreBack as HTMLButtonElement).click();
22653
+ },
22654
+ () => {
22655
+ this.clearMessages();
22656
+ let tempObj: any = {}
22657
+ tempObj["data"] = {}
22658
+ tempObj["data"]["mappings"] = {}
22659
+ tempObj["data"]["mappings"]["mappings"] = tempArr
22660
+ let tempObjStr = JSON.stringify(tempObj)
22661
+
22662
+ console.log('csv taggingarray cols', uniqCols, JSON.parse(tempObjStr)["data"]["mappings"]["mappings"].length, Object.keys(tempObj.data.mappings.mappings[0]))
22663
+
22664
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, JSON.parse(tempObjStr), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
22665
+ }
22666
+ ])
22667
+ }
22668
+ if (e.target.files[0].name.toLowerCase().indexOf(colName.toLowerCase()) >= 0) {
22669
+ let ext = e.target.files[0].name.split('.')[e.target.files[0].name.split('.').length - 1]
22670
+ if (ext.toLowerCase() == "csv") {
22671
+ frCsv.readAsText(e.target.files[0]);
22672
+ } else {
22673
+ fr.readAsText(e.target.files[0]);
22674
+ }
22675
+ }
22676
+ })
22677
+
22678
+ const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
22679
+ buttonSaveLocalNew?.addEventListener('click', async () => {
22680
+ console.log('save-local');
22681
+ const blob = new Blob([JSON.stringify(taggingArray)], { type: 'text/plain' });
22682
+ const url = window.URL.createObjectURL(blob)
22683
+ const a = document.createElement('a')
22684
+ a.setAttribute('href', url)
22685
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().toLocaleString() + '.txt');
22686
+ a.click()
22687
+ });
22688
+
22689
+ });
22690
+
22691
+ buttonToggleMoreBack.addEventListener('click', async (ev: any) => {
22692
+
22693
+ ev.target.classList.add('hide');
22694
+ buttonToggleMore.classList.remove('hide');
22695
+ const buttonDownloadBackups = (divElement as HTMLDivElement).querySelector('.button-download-backups') as HTMLButtonElement;
22696
+ buttonDownloadBackups.style.display = 'none';
22697
+ const buttonExportMapping = (divElement as HTMLDivElement).querySelector('.button-export-mapping') as HTMLButtonElement;
22698
+ buttonExportMapping.style.display = 'none';
22699
+ const buttonExportMappingCSV = (divElement as HTMLDivElement).querySelector('.button-export-mapping-csv') as HTMLButtonElement;
22700
+ buttonExportMappingCSV.style.display = 'none';
22701
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
22702
+ // buttonApply.style.display = 'none';
22703
+ const buttonLoadLocal = (divElement as HTMLDivElement).querySelector('.button-local-load') as HTMLButtonElement;
22704
+ buttonLoadLocal.style.display = 'none';
22705
+ const buttonSaveLocal = (divElement as HTMLDivElement).querySelector('.button-local-save') as HTMLButtonElement;
22706
+ buttonSaveLocal.style.display = 'none';
22707
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
22708
+ // buttonSave.style.display = 'none';
22709
+
22710
+ });
22711
+
22712
+ const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
22713
+ buttonSave?.addEventListener('click', async () => {
22714
+ await this.saveTagging(taggingArray.data.mappings, selectedStatutes, uploadFunction, refreshFunction, false, colName);
22715
+ });
22716
+
22717
+ const buttonCancel = (divElement as HTMLDivElement).querySelector('.button-cancel') as HTMLButtonElement;
22718
+ buttonCancel?.addEventListener('click', async () => {
22719
+ //console.log('cancel clicked');
22720
+ await this.fetchCancelOnboardingJob(colName);
22721
+ refreshFunction();
22722
+ });
22723
+
22724
+ const cbArr = (divElement as HTMLDivElement).querySelectorAll('.cb-select') as NodeListOf<HTMLInputElement>;
22725
+ for (i = 0; i < cbArr.length; i++) {
22726
+ cbArr[i].addEventListener('change', (ev: any) => {
22727
+ const cbSelectId = ev.currentTarget.id;
22728
+ const cbSelectIndex = cbSelectId.split('-')[1];
22729
+
22730
+ if (!this.selectedCbs.includes(cbSelectIndex)) {
22731
+ this.selectedCbs.push(cbSelectIndex);
22732
+ } else {
22733
+ this.selectedCbs.splice(this.selectedCbs.indexOf(cbSelectIndex), 1);
22734
+ }
22735
+ //console.log(this.selectedCbs);
22736
+ })
22737
+ }
22738
+
22739
+ this.changedOnboardingItemIds = []
22740
+ }
22741
+
22742
+ renderMappingTable = (divElement: any, jsonData: Array<any>, cursor: Array<any>, fetchFunction: any, searchString: string, mappedArray: any, found: number, uploadFunction: any, refreshFunction: any, extraFields: Array<string>, uploadBlock: number, extraFieldPosition: number, colName: string, subfilter: string, statuteColName: string, extraHintsArr: Array<string>, mappedStatutes: Array<any> = []) => {
22743
+ console.log('cols1', jsonData);
22744
+ // console.log('cols', jsonData[0].data.cols);
22745
+ //console.log('divelement', divElement);
22746
+ //console.log('jsonData', jsonData);
22747
+ //console.log('cursor', cursor);
22748
+ //console.log('fetch', fetchFunction);
22749
+ //console.log('searchstring', searchString);
22750
+ //console.log('subfiltervalue', subfilter);
22751
+
22752
+ const arrCompliancesFrequencies: any = {};
22753
+
22754
+ if (jsonData.length === 0) return;
22755
+
22756
+ this.selectedCbs = [];
22757
+
22758
+ let colCountry = -1;
22759
+ let colState = -1;
22760
+ let colSubcategory = -1;
22761
+ let colStatute = -1;
22762
+
22763
+ const unfilteredDict: any[] = [];
22764
+
22765
+ var html = '';
22766
+
22767
+ html += '<div>';
22768
+ html += '<h3 part="results-title">Total Items (' + found + ')</h3>';
22769
+ html += '<h4 id="span-filtered" part="results-title"></h4>'
22770
+ html += '<h4 id="span-extra-filled" part="results-title"></h4>'
22771
+ html += '</div>';
22772
+
22773
+
22774
+ html += '<div class="d-flex justify-between align-center left-sticky flex-wrap mb-20">';
22775
+
22776
+ html += '<div id="div-subfiltered"></div>';
22777
+ html += '<div id="scroll-overlay" part="onboarding-scroll-overlay" class="pos-fixed-scroll justify-center align-center">';
22778
+ html += '<div id="scroll-overlay-left" class="mr-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_left_alt</span></button></div>';
22779
+ html += '<div id="scroll-overlay-right" class="ml-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_right_alt</span></button></div>';
22780
+ html += '</div>';
22781
+
22782
+ html += '<div id="detail-overlay" part="onboarding-detail-overlay" class="pos-fixed justify-center align-center hide">';
22783
+ html += '<div class="cover-slide"></div>';
22784
+ html += '<div class="detail-container p-10">';
22785
+ html += '<div class="d-flex justify-between align-center mb-20">';
22786
+ html += '<div part="results-title">Row Details</div>';
22787
+ html += '<button part="button-icon" class="detail-close"><span class="material-symbols-outlined">close</span></button>';
22788
+ html += '</div>';
22789
+ html += '<div id="detail-overlay-list">';
22790
+ html += '</div>';
22791
+ html += '</div>';
22792
+ html += '</div>';
22793
+
22794
+ html += '<div class="d-flex align-center">';
22795
+ html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="' + subfilter + '" />';
22796
+ html += '<div class="mr-10">';
22797
+ 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>'
22798
+ html += '<div style="position: absolute; margin-top: 5px;"><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></div>'
22799
+ html += '</div>';
22800
+ html += (this.disablesave == "yes" ? '' : '<button part="button" class="button-save" disabled>Save</button>');
22801
+ html += '</div>';
22802
+
22803
+ html += '</div>';
22804
+
22805
+ html += '<table id="table-data">';
22806
+
22807
+ html += '<thead>';
22808
+ html += '<th part="td-head" class="td-head">'
22809
+ // html += 'Select';
22810
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
22811
+ html += '</th>'
22812
+ html += '<th part="td-head" class="td-head">'
22813
+ html += '<div>View</div>';
22814
+ html += '</th>'
22815
+ if (extraFieldPosition === 0) {
22816
+ for (var i = 0; i < extraFields.length; i++) {
22817
+ html += '<th part="td-head" class="td-head">'
22818
+ html += extraFields[i];
22819
+ html += '</th>'
22820
+ }
22821
+ }
22822
+ if (colName.toLowerCase() == "compliances") {
22823
+ html += '<th part="td-head" class="td-head">'
22824
+ html += 'Proposed Users';
22825
+ html += '</th>'
22826
+ }
22827
+ html += '<th part="td-head" class="td-head">'
22828
+ html += 'Id';
22829
+ html += '</th>'
22830
+
22831
+ // for(var j = 0; j < JSON.parse(jsonData[0].data.cols).length; j++) {
22832
+
22833
+ // if(jsonData[0].cols.includes(JSON.parse(jsonData[0].data.cols)[j])) {
22834
+ // html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == JSON.parse(jsonData[0].data.cols)[j].toLowerCase() ? 'left-sticky' : '') + '">'
22835
+ // html += JSON.parse(jsonData[0].data.cols)[j]
22836
+ // html += '</th>'
22837
+ // }
22838
+
22839
+ // }
22840
+
22841
+ for (var j = 0; j < jsonData[0].cols.length; j++) {
22842
+ console.log('jsoncols', JSON.parse(jsonData[0].data.cols), jsonData[0].cols.length, j)
22843
+ html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == (JSON.parse(jsonData[0].data.cols)[j] ?? "").toLowerCase() ? 'left-sticky' : '') + '">'
22844
+ // html += jsonData[0].cols[j]
22845
+ html += '</th>'
22846
+
22847
+ }
22848
+
22849
+ if (extraFieldPosition === 1) {
22850
+ for (var i = 0; i < extraFields.length; i++) {
22851
+ html += '<th part="td-head" class="td-head">'
22852
+ html += extraFields[i];
22853
+ html += '</th>'
22854
+ }
22855
+ }
22856
+ html += '</thead>'
22857
+
22858
+ //console.log('colstate', JSON.parse(jsonData[0].data.cols));
22859
+
22860
+ for (var i = 0; i < JSON.parse(jsonData[0].data.cols).length; i++) {
22861
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "country") {
22862
+ console.log('colstate country', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
22863
+ colCountry = i;
22864
+ }
22865
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "state") {
22866
+ //console.log('colstate state', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
22867
+ colState = i;
22868
+ }
22869
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "subcategory") {
22870
+ //console.log('colstate subcategory', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
22871
+ colSubcategory = i;
22872
+ }
22873
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == statuteColName) {
22874
+ //console.log('colstate statute', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
21677
22875
  colStatute = i;
21678
22876
  }
21679
22877
  }
@@ -22331,7 +23529,7 @@ export class SfIEvents extends LitElement {
22331
23529
  //console.log(e.currentTarget, (e.currentTarget as HTMLInputElement).checked);
22332
23530
  ((divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement).disabled = false;
22333
23531
  if (extraFieldPosition === 1) {
22334
- await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true)
23532
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true, mappedStatutes)
22335
23533
  }
22336
23534
  });
22337
23535
  }
@@ -22409,7 +23607,7 @@ export class SfIEvents extends LitElement {
22409
23607
 
22410
23608
  (this._SfButtonSave as HTMLButtonElement)?.addEventListener('click', async () => {
22411
23609
 
22412
- await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, false)
23610
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, false, mappedStatutes)
22413
23611
 
22414
23612
  });
22415
23613
 
@@ -23158,368 +24356,450 @@ export class SfIEvents extends LitElement {
23158
24356
 
23159
24357
  });
23160
24358
 
23161
- //this.refreshCalendar();
23162
-
23163
- }
23164
-
23165
- renderOnboardingTriggers = (mappedTriggers: any, mappedSerializedAlertSchedules: any, triggersJobs: any) => {
23166
-
23167
- var html = '';
23168
-
23169
- html += '<div id="triggers-list-container" class="d-flex flex-col w-100 scroll-x">';
23170
- html += '</div>';
23171
-
23172
- (this._SfOnboardingTriggersContainer as HTMLDivElement).innerHTML = html;
23173
-
23174
- //console.log('rendering triggers...', (this._SfOnboardingTriggersContainer as HTMLDivElement).innerHTML);
23175
-
23176
- this.renderTaggingTable((this._SfOnboardingTriggersListContainer as HTMLDivElement), mappedSerializedAlertSchedules, mappedTriggers, ["shortid", "obligationtitle", "obligationtype"], this.uploadTriggersMapping, this.loadOnboardingTriggers, "triggers", ["id", "entityname", "locationname"], '', "", ["triggers"], triggersJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24359
+ //this.refreshCalendar();
23177
24360
 
23178
24361
  }
23179
24362
 
23180
- renderOnboardingInternalControls = (mappedInternalControls: any, mappedSerializedTriggers: any, internalcontrolsJobs: any) => {
24363
+ renderOnboardingTriggers = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedTriggers: any) => {
23181
24364
 
23182
- var html = '';
24365
+ this.renderTaggingTableNew((this._SfOnboardingTriggersListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedTriggers, ["shortid", "obligationtitle", "obligationtype"], this.uploadTriggersMapping, this.loadOnboardingTriggers, "triggers", ["id"], '', "", ["triggers"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23183
24366
 
23184
- html += '<div id="internalcontrols-list-container" class="d-flex flex-col w-100 scroll-x">';
23185
- html += '</div>';
24367
+ }
23186
24368
 
23187
- (this._SfOnboardingInternalControlsContainer as HTMLDivElement).innerHTML = html;
24369
+ renderOnboardingInternalControls = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedInternalControls: any) => {
23188
24370
 
23189
- this.renderTaggingTable((this._SfOnboardingInternalControlsListContainer as HTMLDivElement), mappedSerializedTriggers, mappedInternalControls, ["shortid", "obligationtitle", "obligationtype"], this.uploadInternalControlsMapping, this.loadOnboardingInternalControls, "internalcontrols", ["id", "entityname", "locationname"], '', "", ["internalcontrols"], internalcontrolsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24371
+ this.renderTaggingTableNew((this._SfOnboardingInternalControlsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedInternalControls, ["shortid", "obligationtitle", "obligationtype"], this.uploadInternalControlsMapping, this.loadOnboardingInternalControls, "internalcontrols", ["id", "entityname", "locationname"], '', "", ["internalcontrols"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23190
24372
 
23191
24373
  }
23192
24374
 
23193
- renderOnboardingReportedLocations = (mappedReportedLocations: any, mappedSerializedTriggers: any, reportedlocationsJobs: any) => {
24375
+ renderOnboardingReportedLocations = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedReportedLocations: any) => {
23194
24376
 
23195
- var html = '';
24377
+ this.renderTaggingTableNew((this._SfOnboardingReportedLocationsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedReportedLocations, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportedLocationsMapping, this.loadOnboardingReportedLocations, "reportedlocations", ["id", "entityname", "locationname"], '', "", ["reportedlocations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23196
24378
 
23197
- html += '<div id="reportedlocations-list-container" class="d-flex flex-col w-100 scroll-x">';
23198
- html += '</div>';
24379
+ }
23199
24380
 
23200
- (this._SfOnboardingReportedLocationsContainer as HTMLDivElement).innerHTML = html;
24381
+ renderOnboardingActivations = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedActivations: any) => {
23201
24382
 
23202
- this.renderTaggingTable((this._SfOnboardingReportedLocationsContainer as HTMLDivElement), mappedSerializedTriggers, mappedReportedLocations, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportedLocationsMapping, this.loadOnboardingReportedLocations, "reportedlocations", ["id", "entityname", "locationname"], '', "", ["reportedlocations"], reportedlocationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24383
+ this.renderTaggingTableNew((this._SfOnboardingActivationListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedActivations, ["shortid", "obligationtitle", "obligationtype"], this.uploadActivationsMapping, this.loadOnboardingActivations, "activations", ["id", "entityname", "locationname"], '', "", ["activations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23203
24384
 
23204
24385
  }
23205
24386
 
23206
- renderOnboardingActivations = (mappedActivations: any, mappedSerializedExtensions: any, activationsJobs: any) => {
24387
+ renderOnboardingInvalidations = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedInvalidations: any) => {
23207
24388
 
23208
- var html = '';
24389
+ this.renderTaggingTableNew((this._SfOnboardingInvalidationListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedInvalidations, ["shortid", "obligationtitle", "obligationtype"], this.uploadInvalidationsMapping, this.loadOnboardingInvalidations, "invalidations", ["id", "entityname", "locationname"], '', "", ["invalidations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23209
24390
 
23210
- html += '<div id="activations-list-container" class="d-flex flex-col w-100 scroll-x">';
23211
- html += '</div>';
24391
+ }
23212
24392
 
23213
- (this._SfOnboardingActivationsContainer as HTMLDivElement).innerHTML = html;
24393
+ renderOnboardingAlertSchedules = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedAlertSchedules: any) => {
23214
24394
 
23215
- this.renderTaggingTable((this._SfOnboardingActivationListContainer as HTMLDivElement), mappedSerializedExtensions, mappedActivations, ["shortid", "obligationtitle", "obligationtype"], this.uploadActivationsMapping, this.loadOnboardingActivations, "activations", ["id", "entityname", "locationname"], '', "", ["activations"], activationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24395
+ this.renderTaggingTableNew((this._SfOnboardingAlertSchedulesListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedAlertSchedules, ["shortid", "obligationtitle", "obligationtype"], this.uploadAlertSchedulesMapping, this.loadOnboardingAlertSchedules, "alertschedules", ["id", "entityname", "locationname"], '', "", ["alertschedules"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23216
24396
 
23217
24397
  }
23218
24398
 
23219
- renderOnboardingInvalidations = (mappedInvalidations: any, mappedSerializedExtensions: any, invalidationsJobs: any) => {
24399
+ renderOnboardingExtensions = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedExtensions: any) => {
23220
24400
 
23221
- var html = '';
24401
+ this.renderTaggingTableNew((this._SfOnboardingExtensionsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedExtensions, ["shortid", "obligationtitle", "obligationtype"], this.uploadExtensionsMapping, this.loadOnboardingExtensions, "extensions", ["id", "entityname", "locationname"], '', "", ["extensions"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23222
24402
 
23223
- html += '<div id="invalidations-list-container" class="d-flex flex-col w-100 scroll-x">';
23224
- html += '</div>';
24403
+ }
23225
24404
 
23226
- (this._SfOnboardingInvalidationsContainer as HTMLDivElement).innerHTML = html;
24405
+ renderOnboardingDuedates = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedDuedates: any) => {
23227
24406
 
23228
- this.renderTaggingTable((this._SfOnboardingInvalidationListContainer as HTMLDivElement), mappedSerializedExtensions, mappedInvalidations, ["shortid", "obligationtitle", "obligationtype"], this.uploadInvalidationsMapping, this.loadOnboardingInvalidations, "invalidations", ["id", "entityname", "locationname"], '', "", ["invalidations"], invalidationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24407
+ this.renderTaggingTableNew((this._SfOnboardingDuedatesListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedDuedates, ["shortid", "obligationtitle", "obligationtype"], this.uploadDuedatesMapping, this.loadOnboardingDuedates, "duedates", ["id", "entityname", "locationname"], '', "", ["duedates"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23229
24408
 
23230
24409
  }
23231
24410
 
23232
- renderOnboardingAlertSchedules = (mappedAlertSchedules: any, mappedSerializedExtensions: any, alertschedulesJobs: any) => {
24411
+ renderOnboardingReporters = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedReporters: any) => {
23233
24412
 
23234
- var html = '';
24413
+ this.renderTaggingTableNew((this._SfOnboardingReportersListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedReporters, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportersMapping, this.loadOnboardingReporters, "reporters", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["reporters"], ["id", "countryid", "entityid", "locationid"], null, [], null, "Guidelines", "");
23235
24414
 
23236
- html += '<div id="alertschedules-list-container" class="d-flex flex-col w-100 scroll-x">';
23237
- html += '</div>';
24415
+ }
23238
24416
 
23239
- (this._SfOnboardingAlertSchedulesContainer as HTMLDivElement).innerHTML = html;
24417
+ renderOnboardingApprovers = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedApprovers: any) => {
23240
24418
 
23241
- this.renderTaggingTable((this._SfOnboardingAlertSchedulesListContainer as HTMLDivElement), mappedSerializedExtensions, mappedAlertSchedules, ["shortid", "obligationtitle", "obligationtype"], this.uploadAlertSchedulesMapping, this.loadOnboardingAlertSchedules, "alertschedules", ["id", "entityname", "locationname"], '', "", ["alertschedules"], alertschedulesJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24419
+ this.renderTaggingTableNew((this._SfOnboardingApproversListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedApprovers, ["shortid", "obligationtitle", "obligationtype"], this.uploadApproversMapping, this.loadOnboardingApprovers, "approvers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["approvers"], ["id", "countryid", "entityid", "locationid"], null, [], null, "Guidelines", "");
23242
24420
 
23243
24421
  }
23244
24422
 
23245
- renderOnboardingExtensions = (mappedExtensions: any, mappedSerializedDuedates: any, extensionsJobs: any) => {
24423
+ renderOnboardingFunctionHeads = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedFunctionHeads: any) => {
23246
24424
 
23247
- var html = '';
23248
-
23249
- html += '<div id="extensions-list-container" class="d-flex flex-col w-100 scroll-x">';
23250
- html += '</div>';
23251
-
23252
- (this._SfOnboardingExtensionsContainer as HTMLDivElement).innerHTML = html;
23253
24425
 
23254
- this.renderTaggingTable((this._SfOnboardingExtensionsListContainer as HTMLDivElement), mappedSerializedDuedates, mappedExtensions, ["shortid", "obligationtitle", "obligationtype"], this.uploadExtensionsMapping, this.loadOnboardingExtensions, "extensions", ["id", "entityname", "locationname"], '', "", ["extensions"], extensionsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24426
+ this.renderTaggingTableNew((this._SfOnboardingFunctionHeadsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedFunctionHeads, ["shortid", "obligationtitle", "obligationtype"], this.uploadFunctionHeadsMapping, this.loadOnboardingFunctionHeads, "functionheads", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["functionheads"], ["id", "countryid", "entityid", "locationid"], null, [], null, "Guidelines", "");
23255
24427
 
23256
24428
  }
23257
24429
 
23258
- renderOnboardingDuedates = (mappedDuedates: any, mappedSerializedMakerCheckers: any, duedatesJobs: any) => {
23259
-
23260
- var html = '';
23261
-
23262
- html += '<div id="duedates-list-container" class="d-flex flex-col w-100 scroll-x">';
23263
- html += '</div>';
23264
-
23265
- (this._SfOnboardingDuedatesContainer as HTMLDivElement).innerHTML = html;
24430
+ renderOnboardingMakerCheckers = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedMakerCheckers: any) => {
23266
24431
 
23267
- this.renderTaggingTable((this._SfOnboardingDuedatesListContainer as HTMLDivElement), mappedSerializedMakerCheckers, mappedDuedates, ["shortid", "obligationtitle", "obligationtype"], this.uploadDuedatesMapping, this.loadOnboardingDuedates, "duedates", ["id", "entityname", "locationname"], '', "", ["duedates"], duedatesJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24432
+ this.renderTaggingTableNew((this._SfOnboardingMakerCheckersListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedMakerCheckers, ["shortid", "obligationtitle", "obligationtype"], this.uploadMakerCheckersMapping, this.loadOnboardingMakerCheckers, "makercheckers", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["makercheckers"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23268
24433
 
23269
24434
  }
23270
24435
 
23271
- renderOnboardingReporters = (mappedReporters: any, mappedSerializedTags: any, reportersJobs: any, _arrFeedbackReference: any) => {
24436
+ renderOnboardingDocs = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedDocs: any) => {
23272
24437
 
23273
- var html = '';
24438
+ this.renderTaggingTableNew((this._SfOnboardingDocsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedDocs, ["shortid", "obligationtitle", "obligationtype"], this.uploadDocsMapping, this.loadOnboardingDocs, "docs", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["docs"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23274
24439
 
23275
- html += '<div id="reporters-list-container" class="d-flex flex-col w-100 scroll-x">';
23276
- html += '</div>';
24440
+ }
23277
24441
 
23278
- (this._SfOnboardingReportersContainer as HTMLDivElement).innerHTML = html;
24442
+ renderOnboardingAuditors = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedAuditors: any) => {
23279
24443
 
23280
- this.renderTaggingTable((this._SfOnboardingReportersListContainer as HTMLDivElement), mappedSerializedTags, mappedReporters, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportersMapping, this.loadOnboardingReporters, "reporters", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["reporters"], reportersJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
24444
+ this.renderTaggingTableNew((this._SfOnboardingAuditorsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedAuditors, ["shortid", "obligationtitle", "obligationtype"], this.uploadAuditorsMapping, this.loadOnboardingAuditors, "auditors", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["auditors"], ["id", "countryid", "entityid", "locationid"], null, [], null, "Guidelines", "");
23281
24445
 
23282
24446
  }
23283
24447
 
23284
- renderOnboardingApprovers = (mappedApprovers: any, mappedSerializedReporters: any, approversJobs: any, _arrFeedbackReference: any) => {
24448
+ renderOnboardingViewers = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedViewers: any) => {
23285
24449
 
23286
- var html = '';
24450
+ this.renderTaggingTableNew((this._SfOnboardingViewersListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedViewers, ["shortid", "obligationtitle", "obligationtype"], this.uploadViewersMapping, this.loadOnboardingViewers, "viewers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["viewers"], ["id", "countryid", "entityid", "locationid"], null, [], null, "Guidelines", "");
23287
24451
 
23288
- html += '<div id="approvers-list-container" class="d-flex flex-col w-100 scroll-x">';
23289
- html += '</div>';
24452
+ }
23290
24453
 
23291
- (this._SfOnboardingApproversContainer as HTMLDivElement).innerHTML = html;
24454
+ renderOnboardingTags = (selectedStatutes: any, mappedCompliances: any, mappedFunctions: any, mappedTags: any) => {
23292
24455
 
23293
- this.renderTaggingTable((this._SfOnboardingApproversListContainer as HTMLDivElement), mappedSerializedReporters, mappedApprovers, ["shortid", "obligationtitle", "obligationtype"], this.uploadApproversMapping, this.loadOnboardingApprovers, "approvers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["approvers"], approversJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
24456
+ this.renderTaggingTableNew((this._SfOnboardingTagsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedFunctions, mappedTags, ["shortid", "obligationtitle", "obligationtype"], this.uploadTagsMapping, this.loadOnboardingTags, "tags", ["id", "entityname", "locationname"], this.apiIdTags, "&Tag", ["tags"], ["id", "countryid", "entityid", "locationid"], "tagtype", [], null, "", "");
23294
24457
 
23295
24458
  }
23296
24459
 
23297
- renderOnboardingFunctionHeads = (mappedFunctionHeads: any, mappedSerializedApprovers: any, functionHeadsJobs: any, _arrFeedbackReference: any) => {
24460
+ renderOnboardingFunctions = (selectedStatutes: any, mappedCompliances: any, mappedLocations: any, mappedFunctions: any) => {
23298
24461
 
23299
- var html = '';
24462
+ this.renderTaggingTableNew((this._SfOnboardingFunctionsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedLocations, mappedFunctions, ["shortid", "obligationtitle", "obligationtype"], this.uploadFunctionsMapping, this.loadOnboardingFunctions, "functions", ["id", "entityname", "locationname"], this.apiIdTags, "&Function", ["functions"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
23300
24463
 
23301
- html += '<div id="functionheads-list-container" class="d-flex flex-col w-100 scroll-x">';
23302
- html += '</div>';
24464
+ }
23303
24465
 
23304
- (this._SfOnboardingFunctionHeadsContainer as HTMLDivElement).innerHTML = html;
24466
+ renderOnboardingLocations = (selectedStatutes: any, mappedCompliances: any, mappedEntities: any, mappedLocations: any) => {
23305
24467
 
23306
- this.renderTaggingTable((this._SfOnboardingFunctionHeadsListContainer as HTMLDivElement), mappedSerializedApprovers, mappedFunctionHeads, ["shortid", "obligationtitle", "obligationtype"], this.uploadFunctionHeadsMapping, this.loadOnboardingFunctionHeads, "functionheads", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["functionheads"], functionHeadsJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
24468
+ this.renderTaggingTableNew((this._SfOnboardingLocationsListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedEntities, mappedLocations, ["shortid", "applicability", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute", "reference", "activations", "invalidations"], this.uploadLocationsMapping, this.loadOnboardingLocations, "locations", ["id", "entityname"], this.apiIdTags, "&Location", ["locationname", "locationid"], ["id", "countryid", "entityid"], null, [], null, "", "");
23307
24469
 
23308
24470
  }
23309
24471
 
23310
- renderOnboardingMakerCheckers = (mappedMakerCheckers: any, mappedSerializedDocs: any, makerCheckerJobs: any) => {
23311
-
24472
+ renderOnboardingStatutesDropdownMapping = (container: HTMLDivElement, mappedStatutes: any, selectedStatutes: any, fetchtaggingfunction: Function, rendermappingfunction: Function) => {
24473
+ console.log('rendering dropdown', mappedStatutes.length);
23312
24474
  var html = '';
23313
24475
 
23314
- html += '<div id="makercheckers-list-container" class="d-flex flex-col w-100 scroll-x">';
24476
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
24477
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
24478
+ html += '<label part="input-label">Select Statute</label>';
24479
+ html += '<sf-multiselect-search mode="edit" id="statute-select"></sf-multiselect-search>';
23315
24480
  html += '</div>';
23316
24481
 
23317
- (this._SfOnboardingMakerCheckersContainer as HTMLDivElement).innerHTML = html;
23318
-
23319
- this.renderTaggingTable((this._SfOnboardingMakerCheckersListContainer as HTMLDivElement), mappedSerializedDocs, mappedMakerCheckers, ["shortid", "obligationtitle", "obligationtype"], this.uploadMakerCheckersMapping, this.loadOnboardingMakerCheckers, "makercheckers", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["makercheckers"], makerCheckerJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
23320
-
23321
- }
23322
-
23323
- renderOnboardingDocs = (mappedDocs: any, mappedSerializedViewers: any, docsJobs: any) => {
23324
-
23325
- var html = '';
23326
-
23327
- html += '<div id="docs-list-container" class="d-flex flex-col w-100 scroll-x">';
24482
+ html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
23328
24483
  html += '</div>';
24484
+ html += '</div>';
24485
+ console.log('attaching html', html);
24486
+ container.innerHTML = html;
23329
24487
 
23330
- (this._SfOnboardingDocsContainer as HTMLDivElement).innerHTML = html;
24488
+ let multiselectStatute = container.querySelector('#statute-select') as SfMultiselectSearch;
24489
+ multiselectStatute.listelements = mappedStatutes;
24490
+ let selectedStatutesObj: any = {}
24491
+ for (let statuteObj of selectedStatutes) {
24492
+ selectedStatutesObj[statuteObj.id] = true
24493
+ }
24494
+ multiselectStatute.listselection = selectedStatutesObj;
24495
+ multiselectStatute.loadMode();
24496
+ multiselectStatute.addEventListener('valueChanged', async (e: any) => {
24497
+ let multiselect = e.currentTarget as SfMultiselectSearch;
24498
+ console.log('selected statutes', multiselect.selectedValuesNames());
24499
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
24500
+ return;
24501
+ }
24502
+ let selectedStatutes = [];
24503
+ const regex = /^\[.*?\] - /;
24504
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
24505
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
24506
+ }
23331
24507
 
23332
- this.renderTaggingTable((this._SfOnboardingDocsListContainer as HTMLDivElement), mappedSerializedViewers, mappedDocs, ["shortid", "obligationtitle", "obligationtype"], this.uploadDocsMapping, this.loadOnboardingDocs, "docs", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["docs"], docsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24508
+ let mappedCompliances = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
23333
24509
 
24510
+ rendermappingfunction({ data: { mappings: { mappings: selectedStatutes } } }, mappedCompliances);
24511
+ })
23334
24512
  }
23335
24513
 
23336
- renderOnboardingAuditors = (mappedAuditors: any, mappedSerializedFunctionheads: any, auditorsJobs: any, _arrFeedbackReference: any) => {
23337
-
23338
- //console.log('inside rendering auditors..');
23339
-
24514
+ renderOnboardingStatutesDropdownTagging = (container: HTMLDivElement, listcontainerid: string, mappedStatutes: any, selectedStatutes: any, fetchcompliancesfunction: Function, fetchsourcemapping: Function, fetchtaggingfunction: Function, rendertaggingfunction: Function) => {
24515
+ console.log('rendering dropdown', mappedStatutes.length);
23340
24516
  var html = '';
23341
24517
 
23342
- html += '<div id="auditors-list-container" class="d-flex flex-col w-100 scroll-x">';
24518
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
24519
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
24520
+ html += '<label part="input-label">Select Statute</label>';
24521
+ html += '<sf-multiselect-search mode="edit" id="statute-select"></sf-multiselect-search>';
23343
24522
  html += '</div>';
23344
24523
 
23345
- (this._SfOnboardingAuditorsContainer as HTMLDivElement).innerHTML = html;
24524
+ html += '<div id="' + listcontainerid + '" class="d-flex flex-col w-100 scroll-x">';
24525
+ html += '</div>';
24526
+ html += '</div>';
24527
+ console.log('attaching html', html);
24528
+ container.innerHTML = html;
23346
24529
 
23347
- this.renderTaggingTable((this._SfOnboardingAuditorsListContainer as HTMLDivElement), mappedSerializedFunctionheads, mappedAuditors, ["shortid", "obligationtitle", "obligationtype"], this.uploadAuditorsMapping, this.loadOnboardingAuditors, "auditors", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["auditors"], auditorsJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
24530
+ let multiselectStatute = container.querySelector('#statute-select') as SfMultiselectSearch;
24531
+ multiselectStatute.listelements = mappedStatutes;
24532
+ let selectedStatutesObj: any = {}
24533
+ for (let statuteObj of selectedStatutes) {
24534
+ selectedStatutesObj[statuteObj.id] = true
24535
+ }
24536
+ multiselectStatute.listselection = selectedStatutesObj;
24537
+ multiselectStatute.loadMode();
24538
+ multiselectStatute.addEventListener('valueChanged', async (e: any) => {
24539
+ let multiselect = e.currentTarget as SfMultiselectSearch;
24540
+ console.log('selected statutes', multiselect.selectedValuesNames());
24541
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
24542
+ return;
24543
+ }
24544
+ let selectedStatutes = [];
24545
+ const regex = /^\[.*?\] - /;
24546
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
24547
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
24548
+ }
23348
24549
 
24550
+ let sourceMappingArray = await fetchsourcemapping(Object.keys(multiselect.selectedValuesNames()));
24551
+ let mappingArray = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
24552
+ let mappedCompliances = await fetchcompliancesfunction(Object.keys(multiselect.selectedValuesNames()));
24553
+ let mappedCompliancesArr: any = { data: { mappings: {} } };
24554
+ console.log('mapped compliances', mappedCompliances)
24555
+ for (let statuteObj of selectedStatutes) {
24556
+ for (let complianceid of Object.keys(mappedCompliances.data.mappings[statuteObj.id])) {
24557
+ let pushObj = mappedCompliances.data.mappings[statuteObj.id][complianceid];
24558
+ pushObj.id = complianceid;
24559
+ pushObj.statuteid = statuteObj.id;
24560
+ mappedCompliancesArr.data.mappings[complianceid] = pushObj;
24561
+ }
24562
+ }
24563
+ rendertaggingfunction(selectedStatutes, mappedCompliancesArr, sourceMappingArray, mappingArray);
24564
+ })
23349
24565
  }
23350
24566
 
23351
- renderOnboardingViewers = (mappedViewers: any, mappedSerializedAuditors: any, viewersJobs: any, _arrFeedbackReference: any) => {
24567
+ renderOnboardingCompliances = async (mappedStatutes: any, mappedCompliancesArr: any) => {
24568
+
24569
+ //console.log('mappedcompliances', mappedCompliances);
24570
+ //console.log('mappedstatutes', mappedStatutes);
23352
24571
 
23353
- //console.log('inside rendering viewers..');
24572
+ var searchString = "";
24573
+ let mappedCompliances: any = { data: { mappings: { mappings: [] } } };
24574
+ for (var i = 0; i < (mappedStatutes.data.mappings.mappings as Array<any>).length; i++) {
24575
+ if ((mappedStatutes.data.mappings.mappings as Array<any>)[i].selected) {
24576
+ let statuteid = (mappedStatutes.data.mappings.mappings as Array<any>)[i].id
24577
+ if (mappedCompliancesArr.data.mappings[statuteid] != null) {
24578
+ for (let complianceid of Object.keys(mappedCompliancesArr.data.mappings[statuteid])) {
24579
+ let pushObj = mappedCompliancesArr.data.mappings[statuteid][complianceid];
24580
+ pushObj.id = complianceid;
24581
+ mappedCompliances.data.mappings.mappings.push(pushObj);
24582
+ }
24583
+ }
24584
+ searchString += statuteid + "|";
24585
+ }
24586
+ }
24587
+ searchString = searchString.slice(0, -1);
23354
24588
 
23355
- var html = '';
24589
+ //console.log('searchstring', searchString);
23356
24590
 
23357
- html += '<div id="viewers-list-container" class="d-flex flex-col w-100 scroll-x">';
23358
- html += '</div>';
24591
+ var initCursor = "";
23359
24592
 
23360
- (this._SfOnboardingViewersContainer as HTMLDivElement).innerHTML = html;
24593
+ // var html = '';
23361
24594
 
23362
- this.renderTaggingTable((this._SfOnboardingViewersListContainer as HTMLDivElement), mappedSerializedAuditors, mappedViewers, ["shortid", "obligationtitle", "obligationtype"], this.uploadViewersMapping, this.loadOnboardingViewers, "viewers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["viewers"], viewersJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
24595
+ // html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
24596
+ // html += '<div class="d-flex flex-col w-100">';
24597
+ // html += '<label part="input-label">Search Compliances</label>';
24598
+ // html += '<div class="d-flex">';
24599
+ // html += '<input part="input" type="text" class="w-100 input-search" placeholder="Use | to separate..." disabled/>'
24600
+ // html += '<button part="button-icon" class="ml-10 material-icons button-search">search</button>'
24601
+ // html += '</div>';
24602
+ // html += '</div>';
23363
24603
 
23364
- }
24604
+ // html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
24605
+ // html += '</div>';
24606
+ // html += '</div>';
23365
24607
 
23366
- renderOnboardingTags = (mappedTags: any, mappedSerializedFunctions: any, tagsJobs: any) => {
24608
+ // (this._SfOnboardingCompliancesContainer as HTMLDivElement).innerHTML = html;
23367
24609
 
23368
- var html = '';
24610
+ // (this._SfButtonSearch as HTMLButtonElement)?.addEventListener('click', async () => {
24611
+ // //console.log('clicked', mappedStatutes.data.mappings.mappings);
24612
+ // const searchString = (this._SfInputSearch as HTMLButtonElement).value;
24613
+ // //console.log('searchstring', searchString);
24614
+ // if (searchString.length > 0) {
23369
24615
 
23370
- html += '<div id="tags-list-container" class="d-flex flex-col w-100 scroll-x">';
23371
- html += '</div>';
24616
+ // const arrSearchString = searchString.split('|');
23372
24617
 
23373
- (this._SfOnboardingTagsContainer as HTMLDivElement).innerHTML = html;
24618
+ // const arrSearchStringProcessed: any = [];
23374
24619
 
23375
- this.renderTaggingTable((this._SfOnboardingTagsListContainer as HTMLDivElement), mappedSerializedFunctions, mappedTags, ["shortid", "obligationtitle", "obligationtype"], this.uploadTagsMapping, this.loadOnboardingTags, "tags", ["id", "countryname", "entityname", "locationname"], this.apiIdTags, "&Tag", ["tags"], tagsJobs, "tagtype", ["Client remarks", "FlaggGRC response"], null, "", "");
24620
+ // arrSearchString.forEach((complianceId: string) => {
23376
24621
 
23377
- }
24622
+ // if (complianceId.length === 36) {
24623
+ // arrSearchStringProcessed.push(complianceId);
24624
+ // }
23378
24625
 
23379
- renderOnboardingFunctions = (mappedFunctions: any, mappedSerializedLocations: any, functionsJobs: any) => {
24626
+ // });
23380
24627
 
23381
- var html = '';
24628
+ // var resultCompliances: any = {};
24629
+ // resultCompliances.values = [];
24630
+ // const chunkSize = 20;
24631
+ // for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
23382
24632
 
23383
- html += '<div id="functions-list-container" class="d-flex flex-col w-100 scroll-x">';
23384
- html += '</div>';
24633
+ // const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
24634
+ // console.log('chunk', chunk);
24635
+ // // do whatever
24636
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
24637
+ // console.log(tempResultCompliances)
24638
+ // resultCompliances.values.push(...tempResultCompliances.values);
24639
+ // //console.log(resultCompliances);
23385
24640
 
23386
- for (var i = 0; i < mappedSerializedLocations.data.mappings.mappings.length; i++) {
24641
+ // }
23387
24642
 
23388
- if (mappedSerializedLocations.data.mappings.mappings[i].id == "33a0deab-e93e-41b7-831a-473f9ea3eea2") {
23389
- //console.log('mappedSerializedLocations', mappedSerializedLocations.data.mappings.mappings[i]);
23390
- }
24643
+ // // var resultCompliances : any = {};
24644
+ // // resultCompliances.values = [];
24645
+ // // const chunkSize = 20;
24646
+ // // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
23391
24647
 
23392
- }
24648
+ // // const chunk = arrSearchString.slice(k, k + chunkSize);
24649
+ // // console.log('chunk', chunk);
24650
+ // // // do whatever
24651
+ // // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
24652
+ // // console.log(tempResultCompliances)
24653
+ // // resultCompliances.values.push(...tempResultCompliances.values);
24654
+ // // //console.log(resultCompliances);
23393
24655
 
23394
- (this._SfOnboardingFunctionsContainer as HTMLDivElement).innerHTML = html;
24656
+ // // }
23395
24657
 
23396
- this.renderTaggingTable((this._SfOnboardingFunctionsListContainer as HTMLDivElement), mappedSerializedLocations, mappedFunctions, ["shortid", "obligationtitle", "obligationtype"], this.uploadFunctionsMapping, this.loadOnboardingFunctions, "functions", ["id", "countryname", "entityname", "locationname"], this.apiIdTags, "&Function", ["functions"], functionsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24658
+ // if (resultCompliances != null) {
23397
24659
 
23398
- }
24660
+ // const jsonData = [];
23399
24661
 
23400
- renderOnboardingLocations = (mappedLocations: any, mappedSerializedEntities: any, locationsJobs: any) => {
24662
+ // const arrCompliancesFrequencies: any = {};
23401
24663
 
23402
- var html = '';
24664
+ // for (var i = 0; i < resultCompliances.values.length; i++) {
23403
24665
 
23404
- html += '<div id="locations-list-container" class="d-flex flex-col w-100 scroll-x">';
23405
- html += '</div>';
24666
+ // if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
24667
+ // continue;
24668
+ // } else {
24669
+ // arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
24670
+ // }
23406
24671
 
23407
- (this._SfOnboardingLocationsContainer as HTMLDivElement).innerHTML = html;
24672
+ // var mapped = false;
24673
+ // var extraFields = null;
24674
+ // var previousExtraFields = null;
24675
+ // console.log('mappedcompliances', mappedCompliances)
24676
+ // for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
24677
+ // if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
24678
+ // if (mappedCompliances.data.mappings.mappings[j].selected) {
24679
+ // mapped = true;
24680
+ // }
24681
+ // extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
24682
+ // }
24683
+ // }
23408
24684
 
23409
- this.renderTaggingTable((this._SfOnboardingLocationsListContainer as HTMLDivElement), mappedSerializedEntities, mappedLocations, ["shortid", "applicability", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute", "reference", "activations", "invalidations"], this.uploadLocationsMapping, this.loadOnboardingLocations, "locations", ["id", "countryname", "entityname"], this.apiIdTags, "&Location", ["locations"], locationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
24685
+ // for (j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
23410
24686
 
23411
- }
24687
+ // // console.log('mappedStatutes.data.mappings.mappings[j]', mappedStatutes.data.mappings.mappings[j]);
24688
+ // if (Array.isArray(mappedStatutes.data.mappings.mappings[j].statutename)) {
24689
+ // // sometimes this error occurs
24690
+ // continue;
23412
24691
 
23413
- renderOnboardingCompliances = (mappedStatutes: any, mappedCompliances: any) => {
24692
+ // }
23414
24693
 
23415
- //console.log('mappedcompliances', mappedCompliances);
23416
- //console.log('mappedstatutes', mappedStatutes);
24694
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == JSON.parse(resultCompliances.values[i].fields.data[0])[6][0].trim()) {
23417
24695
 
23418
- var searchString = "";
24696
+ // // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
24697
+ // // console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
24698
+ // // }
24699
+ // previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields
24700
+ // }
24701
+ // }
24702
+ // jsonData.push({ id: resultCompliances.values[i].id, mapped: mapped, data: resultCompliances.values[i].fields, cols: ["country", "jurisdiction", "state", "category", "subcategory", "statute", "applicability", "obligationtitle", "obligation", "risk", "riskarea", "frequency", "penalty", "reference", "form", "subfrequency", "obligationtype", "duedate"], extraFields: extraFields, previousExtraFields: previousExtraFields })
24703
+ // }
23419
24704
 
23420
- for (var i = 0; i < (mappedStatutes.data.mappings.mappings as Array<any>).length; i++) {
23421
- if ((mappedStatutes.data.mappings.mappings as Array<any>)[i].selected) {
23422
- searchString += (mappedStatutes.data.mappings.mappings as Array<any>)[i].id + "|";
23423
- }
23424
- }
23425
- searchString = searchString.slice(0, -1);
23426
24705
 
23427
- //console.log('searchstring', searchString);
24706
+ // this.renderMappingTable((this._SfOnboardingCompliancesListContainer as HTMLDivElement), jsonData, [{ prev: initCursor, next: resultCompliances.cursor }], this.fetchSearchCompliances, searchString, mappedCompliances, resultCompliances.values.length, this.uploadCompliancesMapping, this.loadOnboardingCompliances, ["Client remarks", "FlaggGRC response"], -1, 0, "compliances", "", "statute", ["optional", "optional"]);
23428
24707
 
23429
- var initCursor = "";
24708
+ // }
23430
24709
 
23431
- var html = '';
24710
+ // }
23432
24711
 
23433
- html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
23434
- html += '<div class="d-flex flex-col w-100">';
23435
- html += '<label part="input-label">Search Compliances</label>';
23436
- html += '<div class="d-flex">';
23437
- html += '<input part="input" type="text" class="w-100 input-search" placeholder="Use | to separate..." disabled/>'
23438
- html += '<button part="button-icon" class="ml-10 material-icons button-search">search</button>'
23439
- html += '</div>';
23440
- html += '</div>';
24712
+ // });
23441
24713
 
23442
- html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
23443
- html += '</div>';
23444
- html += '</div>';
24714
+ //console.log('compliances searchstring', searchString);
23445
24715
 
23446
- (this._SfOnboardingCompliancesContainer as HTMLDivElement).innerHTML = html;
24716
+ // if (searchString != "") {
24717
+ // (this._SfInputSearch as HTMLInputElement).value = searchString;
24718
+ // (this._SfButtonSearch as HTMLButtonElement).click();
24719
+ // }
23447
24720
 
23448
- (this._SfButtonSearch as HTMLButtonElement).addEventListener('click', async () => {
23449
- //console.log('clicked', mappedStatutes.data.mappings.mappings);
23450
- const searchString = (this._SfInputSearch as HTMLButtonElement).value;
23451
- //console.log('searchstring', searchString);
23452
- if (searchString.length > 0) {
24721
+ if (searchString.length > 0) {
23453
24722
 
23454
- const arrSearchString = searchString.split('|');
24723
+ const arrSearchString = searchString.split('|');
23455
24724
 
23456
- const arrSearchStringProcessed: any = [];
24725
+ const arrSearchStringProcessed: any = [];
23457
24726
 
23458
- arrSearchString.forEach((complianceId: string) => {
24727
+ arrSearchString.forEach((complianceId: string) => {
23459
24728
 
23460
- if (complianceId.length === 36) {
23461
- arrSearchStringProcessed.push(complianceId);
23462
- }
24729
+ if (complianceId.length === 36) {
24730
+ arrSearchStringProcessed.push(complianceId);
24731
+ }
23463
24732
 
23464
- });
24733
+ });
23465
24734
 
23466
- var resultCompliances: any = {};
23467
- resultCompliances.values = [];
23468
- const chunkSize = 20;
23469
- for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
24735
+ var resultCompliances: any = {};
24736
+ resultCompliances.values = [];
24737
+ const chunkSize = 20;
24738
+ for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
23470
24739
 
23471
- const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
23472
- console.log('chunk', chunk);
23473
- // do whatever
23474
- const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
23475
- console.log(tempResultCompliances)
23476
- resultCompliances.values.push(...tempResultCompliances.values);
23477
- //console.log(resultCompliances);
24740
+ const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
24741
+ console.log('chunk', chunk);
24742
+ // do whatever
24743
+ const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
24744
+ console.log(tempResultCompliances)
24745
+ resultCompliances.values.push(...tempResultCompliances.values);
24746
+ //console.log(resultCompliances);
23478
24747
 
23479
- }
24748
+ }
23480
24749
 
23481
- // var resultCompliances : any = {};
23482
- // resultCompliances.values = [];
23483
- // const chunkSize = 20;
23484
- // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
24750
+ // var resultCompliances : any = {};
24751
+ // resultCompliances.values = [];
24752
+ // const chunkSize = 20;
24753
+ // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
23485
24754
 
23486
- // const chunk = arrSearchString.slice(k, k + chunkSize);
23487
- // console.log('chunk', chunk);
23488
- // // do whatever
23489
- // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
23490
- // console.log(tempResultCompliances)
23491
- // resultCompliances.values.push(...tempResultCompliances.values);
23492
- // //console.log(resultCompliances);
24755
+ // const chunk = arrSearchString.slice(k, k + chunkSize);
24756
+ // console.log('chunk', chunk);
24757
+ // // do whatever
24758
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
24759
+ // console.log(tempResultCompliances)
24760
+ // resultCompliances.values.push(...tempResultCompliances.values);
24761
+ // //console.log(resultCompliances);
23493
24762
 
23494
- // }
24763
+ // }
23495
24764
 
23496
- if (resultCompliances != null) {
24765
+ if (resultCompliances != null) {
23497
24766
 
23498
- const jsonData = [];
24767
+ const jsonData = [];
23499
24768
 
23500
- const arrCompliancesFrequencies: any = {};
24769
+ const arrCompliancesFrequencies: any = {};
23501
24770
 
23502
- for (var i = 0; i < resultCompliances.values.length; i++) {
24771
+ for (var i = 0; i < resultCompliances.values.length; i++) {
23503
24772
 
23504
- if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
23505
- continue;
23506
- } else {
23507
- arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
23508
- }
24773
+ if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
24774
+ continue;
24775
+ } else {
24776
+ arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
24777
+ }
23509
24778
 
23510
- var mapped = false;
23511
- var extraFields = null;
23512
- var previousExtraFields = null;
23513
- console.log('mappedcompliances', mappedCompliances)
23514
- for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
23515
- if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
23516
- if (mappedCompliances.data.mappings.mappings[j].selected) {
24779
+ var mapped = false;
24780
+ var extraFields = null;
24781
+ var previousExtraFields = null;
24782
+ console.log('mappedcompliances', mappedCompliances)
24783
+ if (mappedCompliances.data.mappings.mappings == null) {
24784
+ for (var j = 0; j < Object.keys(mappedCompliances.data.mappings).length; j++) {
24785
+ let statuteKey = Object.keys(mappedCompliances.data.mappings)[j];
24786
+ for (var k = 0; k < Object.keys(mappedCompliances.data.mappings[statuteKey]).length; k++) {
24787
+ let complianceKey = Object.keys(mappedCompliances.data.mappings[statuteKey])[k];
24788
+ if (mappedCompliances.data.mappings[statuteKey][complianceKey].id == resultCompliances.values[i].id) {
23517
24789
  mapped = true;
24790
+ extraFields = mappedCompliances.data.mappings[statuteKey][complianceKey].extraFields;
23518
24791
  }
24792
+ }
24793
+ }
24794
+ } else {
24795
+ for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
24796
+ if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
24797
+ mapped = true;
23519
24798
  extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
23520
24799
  }
23521
24800
  }
23522
24801
 
24802
+
23523
24803
  for (j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
23524
24804
 
23525
24805
  // console.log('mappedStatutes.data.mappings.mappings[j]', mappedStatutes.data.mappings.mappings[j]);
@@ -23531,76 +24811,34 @@ export class SfIEvents extends LitElement {
23531
24811
 
23532
24812
  if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == JSON.parse(resultCompliances.values[i].fields.data[0])[6][0].trim()) {
23533
24813
 
23534
- if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
23535
- //console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
23536
- }
24814
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
24815
+ // //console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
24816
+ // }
23537
24817
  previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields
23538
24818
  }
23539
24819
  }
23540
- jsonData.push({ id: resultCompliances.values[i].id, mapped: mapped, data: resultCompliances.values[i].fields, cols: ["country", "jurisdiction", "state", "category", "subcategory", "statute", "applicability", "obligationtitle", "obligation", "risk", "riskarea", "frequency", "penalty", "reference", "form", "subfrequency", "obligationtype", "duedate"], extraFields: extraFields, previousExtraFields: previousExtraFields })
23541
24820
  }
23542
-
23543
-
23544
- this.renderMappingTable((this._SfOnboardingCompliancesListContainer as HTMLDivElement), jsonData, [{ prev: initCursor, next: resultCompliances.cursor }], this.fetchSearchCompliances, searchString, mappedCompliances, resultCompliances.values.length, this.uploadCompliancesMapping, this.loadOnboardingCompliances, ["Client remarks", "FlaggGRC response"], -1, 0, "compliances", "", "statute", ["optional", "optional"]);
23545
-
24821
+ jsonData.push({ id: resultCompliances.values[i].id, mapped: mapped, data: resultCompliances.values[i].fields, cols: ["country", "jurisdiction", "state", "category", "subcategory", "statute", "applicability", "obligationtitle", "obligation", "risk", "riskarea", "frequency", "penalty", "reference", "form", "subfrequency", "obligationtype", "duedate"], extraFields: extraFields, previousExtraFields: previousExtraFields })
23546
24822
  }
23547
24823
 
23548
- }
23549
24824
 
23550
- });
24825
+ this.renderMappingTable((this._SfOnboardingCompliancesListContainer as HTMLDivElement), jsonData, [{ prev: initCursor, next: resultCompliances.cursor }], this.fetchSearchCompliances, searchString, mappedCompliances, resultCompliances.values.length, this.uploadCompliancesMapping, this.loadOnboardingCompliances, [], -1, 0, "compliances", "", "statute", ["optional", "optional"], mappedStatutes.data.mappings.mappings);
23551
24826
 
23552
- //console.log('compliances searchstring', searchString);
24827
+ }
23553
24828
 
23554
- if (searchString != "") {
23555
- (this._SfInputSearch as HTMLInputElement).value = searchString;
23556
- (this._SfButtonSearch as HTMLButtonElement).click();
23557
24829
  }
23558
24830
 
23559
24831
  }
23560
24832
 
23561
- renderOnboardingEntities = (mappedEntities: any, mappedSerializedCountries: any, entitiesJobs: any, arrFeedbackReference: any) => {
23562
-
23563
- var html = '';
23564
-
23565
- html += '<div id="entities-list-container" class="d-flex flex-col w-100 scroll-x">';
23566
- html += '</div>';
23567
-
23568
- (this._SfOnboardingEntitiesContainer as HTMLDivElement).innerHTML = html;
24833
+ renderOnboardingEntities = (selectedStatutes: any, mappedCompliances: any, mappedCountries: any, mappedEntities: any) => {
23569
24834
 
23570
- this.renderTaggingTable((this._SfOnboardingEntitiesListContainer as HTMLDivElement), mappedSerializedCountries, mappedEntities, ["shortid", "applicability", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute"], this.uploadEntitiesMapping, this.loadOnboardingEntities, "entities", ["id", "countryname"], this.apiIdTags, "&Entity", ["entities"], entitiesJobs, null, ["Client remarks", "FlaggGRC response"], arrFeedbackReference, "Guideline", "");
24835
+ this.renderTaggingTableNew((this._SfOnboardingEntitiesListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, mappedCountries, mappedEntities, ["shortid", "applicability", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute"], this.uploadEntitiesMapping, this.loadOnboardingEntities, "entities", ["id", "countryname"], this.apiIdTags, "&Entity", ["entityname", "entityid"], ["id", "countryid"], null, [], [], "Guideline", "");
23571
24836
 
23572
24837
  }
23573
24838
 
23574
- renderOnboardingCountries = (mappedCountries: any, mappedCompliances: any, countriesJobs: any) => {
23575
-
23576
- var html = '';
23577
-
23578
- html += '<div id="countries-list-container" class="d-flex flex-col w-100 scroll-x">';
23579
- html += '</div>';
23580
-
23581
- (this._SfOnboardingCountriesContainer as HTMLDivElement).innerHTML = html;
23582
-
23583
- const arr1 = [];
23584
-
23585
- for (var i = 0; i < mappedCompliances.data.mappings.mappings.length; i++) {
23586
- if (mappedCompliances.data.mappings.mappings[i].selected) {
23587
- arr1.push(mappedCompliances.data.mappings.mappings[i]);
23588
- }
23589
- }
23590
-
23591
- mappedCompliances.data.mappings.mappings = arr1;
23592
-
23593
- // const arr2 = [];
23594
- // for(var i = 0; i < mappedCountries.data.mappings.mappings.length; i++) {
23595
- // if(mappedCountries.data.mappings.mappings[i].selected) {
23596
- // arr2.push(mappedCountries.data.mappings.mappings[i]);
23597
- // }
23598
- // }
23599
-
23600
- // mappedCountries.data.mappings.mappings = arr2;
23601
-
23602
- this.renderTaggingTable((this._SfOnboardingCountriesListContainer as HTMLDivElement), mappedCompliances, mappedCountries, ["shortid", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute", "state", "subcategory"], this.uploadCountriesMapping, this.loadOnboardingCountries, "countries", ["id"], this.apiIdTags, "-Country", ["countries"], countriesJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
23603
-
24839
+ renderOnboardingCountries = (selectedStatutes: any, mappedCompliances: any, sourceMapping: any, mappedCountries: any) => {
24840
+ sourceMapping = {}
24841
+ this.renderTaggingTableNew((this._SfOnboardingCountriesListContainer as HTMLDivElement), selectedStatutes, mappedCompliances, sourceMapping, mappedCountries, ["shortid", "firstlineofdefence", "obligationtitle", "obligationtype", "country", "statute", "state", "subcategory"], this.uploadCountriesMapping, this.loadOnboardingCountries, "countries", ["id"], this.apiIdTags, "-Country", ["countryname", "countryid"], ["id"], null, [], null, "", "");
23604
24842
  }
23605
24843
 
23606
24844
  renderOnboardingStatutes = (mappedStatutes: any) => {
@@ -23646,9 +24884,9 @@ export class SfIEvents extends LitElement {
23646
24884
  for (var j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
23647
24885
  if (mappedStatutes.data.mappings.mappings[j].id == resultStatutes.values[i].id) {
23648
24886
  //console.log('comparing',mappedStatutes.data.mappings.mappings[j].id,resultStatutes.values[i].id);
23649
- if (mappedStatutes.data.mappings.mappings[j].selected) {
23650
- mapped = true;
23651
- }
24887
+ // if (mappedStatutes.data.mappings.mappings[j].selected) {
24888
+ mapped = true;
24889
+ // }
23652
24890
  extraFields = mappedStatutes.data.mappings.mappings[j].extraFields;
23653
24891
  }
23654
24892
  }
@@ -23914,7 +25152,7 @@ export class SfIEvents extends LitElement {
23914
25152
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-statutes')?.addEventListener('click', async () => {
23915
25153
 
23916
25154
  this.myOnboardingTab = this.TAB_STATUTES;
23917
- this.renderOnboardingTabs();
25155
+ await this.renderOnboardingTabs();
23918
25156
  await this.loadOnboardingStatutes();
23919
25157
 
23920
25158
  });
@@ -23922,7 +25160,7 @@ export class SfIEvents extends LitElement {
23922
25160
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-compliances')?.addEventListener('click', async () => {
23923
25161
 
23924
25162
  this.myOnboardingTab = this.TAB_COMPLIANCES;
23925
- this.renderOnboardingTabs();
25163
+ await this.renderOnboardingTabs();
23926
25164
  this.loadOnboardingCompliances();
23927
25165
 
23928
25166
  });
@@ -23930,7 +25168,7 @@ export class SfIEvents extends LitElement {
23930
25168
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-countries')?.addEventListener('click', async () => {
23931
25169
 
23932
25170
  this.myOnboardingTab = this.TAB_COUNTRIES;
23933
- this.renderOnboardingTabs();
25171
+ await this.renderOnboardingTabs();
23934
25172
  this.loadOnboardingCountries();
23935
25173
 
23936
25174
  });
@@ -23938,7 +25176,7 @@ export class SfIEvents extends LitElement {
23938
25176
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-entities')?.addEventListener('click', async () => {
23939
25177
 
23940
25178
  this.myOnboardingTab = this.TAB_ENTITIES;
23941
- this.renderOnboardingTabs();
25179
+ await this.renderOnboardingTabs();
23942
25180
  this.loadOnboardingEntities();
23943
25181
 
23944
25182
  });
@@ -23946,7 +25184,7 @@ export class SfIEvents extends LitElement {
23946
25184
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-locations')?.addEventListener('click', async () => {
23947
25185
 
23948
25186
  this.myOnboardingTab = this.TAB_LOCATIONS;
23949
- this.renderOnboardingTabs();
25187
+ await this.renderOnboardingTabs();
23950
25188
  this.loadOnboardingLocations();
23951
25189
 
23952
25190
  });
@@ -23954,7 +25192,7 @@ export class SfIEvents extends LitElement {
23954
25192
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-functions')?.addEventListener('click', async () => {
23955
25193
 
23956
25194
  this.myOnboardingTab = this.TAB_FUNCTIONS;
23957
- this.renderOnboardingTabs();
25195
+ await this.renderOnboardingTabs();
23958
25196
  this.loadOnboardingFunctions();
23959
25197
 
23960
25198
  });
@@ -23962,7 +25200,7 @@ export class SfIEvents extends LitElement {
23962
25200
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-tags')?.addEventListener('click', async () => {
23963
25201
 
23964
25202
  this.myOnboardingTab = this.TAB_TAGS;
23965
- this.renderOnboardingTabs();
25203
+ await this.renderOnboardingTabs();
23966
25204
  this.loadOnboardingTags();
23967
25205
 
23968
25206
  });
@@ -23970,7 +25208,7 @@ export class SfIEvents extends LitElement {
23970
25208
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-reporters')?.addEventListener('click', async () => {
23971
25209
 
23972
25210
  this.myOnboardingTab = this.TAB_REPORTERS;
23973
- this.renderOnboardingTabs();
25211
+ await this.renderOnboardingTabs();
23974
25212
  this.loadOnboardingReporters();
23975
25213
 
23976
25214
  });
@@ -23978,7 +25216,7 @@ export class SfIEvents extends LitElement {
23978
25216
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-approvers')?.addEventListener('click', async () => {
23979
25217
 
23980
25218
  this.myOnboardingTab = this.TAB_APPROVERS;
23981
- this.renderOnboardingTabs();
25219
+ await this.renderOnboardingTabs();
23982
25220
  this.loadOnboardingApprovers();
23983
25221
 
23984
25222
  });
@@ -23986,7 +25224,7 @@ export class SfIEvents extends LitElement {
23986
25224
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-functionheads')?.addEventListener('click', async () => {
23987
25225
 
23988
25226
  this.myOnboardingTab = this.TAB_FUNCTION_HEADS;
23989
- this.renderOnboardingTabs();
25227
+ await this.renderOnboardingTabs();
23990
25228
  this.loadOnboardingFunctionHeads();
23991
25229
 
23992
25230
  });
@@ -23994,7 +25232,7 @@ export class SfIEvents extends LitElement {
23994
25232
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-auditors')?.addEventListener('click', async () => {
23995
25233
 
23996
25234
  this.myOnboardingTab = this.TAB_AUDITORS;
23997
- this.renderOnboardingTabs();
25235
+ await this.renderOnboardingTabs();
23998
25236
  this.loadOnboardingAuditors();
23999
25237
 
24000
25238
  });
@@ -24002,7 +25240,7 @@ export class SfIEvents extends LitElement {
24002
25240
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-viewers')?.addEventListener('click', async () => {
24003
25241
 
24004
25242
  this.myOnboardingTab = this.TAB_VIEWERS;
24005
- this.renderOnboardingTabs();
25243
+ await this.renderOnboardingTabs();
24006
25244
  this.loadOnboardingViewers();
24007
25245
 
24008
25246
  });
@@ -24010,7 +25248,7 @@ export class SfIEvents extends LitElement {
24010
25248
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-makercheckers')?.addEventListener('click', async () => {
24011
25249
 
24012
25250
  this.myOnboardingTab = this.TAB_MAKER_CHECKERS;
24013
- this.renderOnboardingTabs();
25251
+ await this.renderOnboardingTabs();
24014
25252
  this.loadOnboardingMakerCheckers();
24015
25253
 
24016
25254
  });
@@ -24018,7 +25256,7 @@ export class SfIEvents extends LitElement {
24018
25256
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-docs')?.addEventListener('click', async () => {
24019
25257
 
24020
25258
  this.myOnboardingTab = this.TAB_DOCS;
24021
- this.renderOnboardingTabs();
25259
+ await this.renderOnboardingTabs();
24022
25260
  this.loadOnboardingDocs();
24023
25261
 
24024
25262
  });
@@ -24026,7 +25264,7 @@ export class SfIEvents extends LitElement {
24026
25264
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-duedates')?.addEventListener('click', async () => {
24027
25265
 
24028
25266
  this.myOnboardingTab = this.TAB_DUEDATES;
24029
- this.renderOnboardingTabs();
25267
+ await this.renderOnboardingTabs();
24030
25268
  this.loadOnboardingDuedates();
24031
25269
 
24032
25270
  });
@@ -24034,7 +25272,7 @@ export class SfIEvents extends LitElement {
24034
25272
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-alertschedules')?.addEventListener('click', async () => {
24035
25273
 
24036
25274
  this.myOnboardingTab = this.TAB_ALERTSCHEDULES;
24037
- this.renderOnboardingTabs();
25275
+ await this.renderOnboardingTabs();
24038
25276
  this.loadOnboardingAlertSchedules();
24039
25277
 
24040
25278
  });
@@ -24042,7 +25280,7 @@ export class SfIEvents extends LitElement {
24042
25280
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-activations')?.addEventListener('click', async () => {
24043
25281
 
24044
25282
  this.myOnboardingTab = this.TAB_ACTIVATIONS;
24045
- this.renderOnboardingTabs();
25283
+ await this.renderOnboardingTabs();
24046
25284
  this.loadOnboardingActivations();
24047
25285
 
24048
25286
  });
@@ -24050,7 +25288,7 @@ export class SfIEvents extends LitElement {
24050
25288
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-invalidations')?.addEventListener('click', async () => {
24051
25289
 
24052
25290
  this.myOnboardingTab = this.TAB_INVALIDATION;
24053
- this.renderOnboardingTabs();
25291
+ await this.renderOnboardingTabs();
24054
25292
  this.loadOnboardingInvalidations();
24055
25293
 
24056
25294
  });
@@ -24058,7 +25296,7 @@ export class SfIEvents extends LitElement {
24058
25296
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-triggers')?.addEventListener('click', async () => {
24059
25297
 
24060
25298
  this.myOnboardingTab = this.TAB_TRIGGERS;
24061
- this.renderOnboardingTabs();
25299
+ await this.renderOnboardingTabs();
24062
25300
  this.loadOnboardingTriggers();
24063
25301
 
24064
25302
  });
@@ -24066,7 +25304,7 @@ export class SfIEvents extends LitElement {
24066
25304
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-extensions')?.addEventListener('click', async () => {
24067
25305
 
24068
25306
  this.myOnboardingTab = this.TAB_EXTENSIONS;
24069
- this.renderOnboardingTabs();
25307
+ await this.renderOnboardingTabs();
24070
25308
  this.loadOnboardingExtensions();
24071
25309
 
24072
25310
  });
@@ -24074,7 +25312,7 @@ export class SfIEvents extends LitElement {
24074
25312
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-internalcontrols')?.addEventListener('click', async () => {
24075
25313
 
24076
25314
  this.myOnboardingTab = this.TAB_INTERNALCONTROLS;
24077
- this.renderOnboardingTabs();
25315
+ await this.renderOnboardingTabs();
24078
25316
  this.loadOnboardingInternalControls();
24079
25317
 
24080
25318
  });
@@ -24082,7 +25320,7 @@ export class SfIEvents extends LitElement {
24082
25320
  (this._SfOnboardingTabContainer as HTMLDivElement).querySelector('#onboarding-tab-reportedlocations')?.addEventListener('click', async () => {
24083
25321
 
24084
25322
  this.myOnboardingTab = this.TAB_REPORTEDLOCATIONS;
24085
- this.renderOnboardingTabs();
25323
+ await this.renderOnboardingTabs();
24086
25324
  this.loadOnboardingReportedLocations();
24087
25325
 
24088
25326
  });
@@ -28142,90 +29380,90 @@ export class SfIEvents extends LitElement {
28142
29380
 
28143
29381
  }
28144
29382
 
28145
- uploadTriggersMapping = async (data: any) => {
28146
- await this.uploadOnboardingMapping(data, 'triggers');
29383
+ uploadTriggersMapping = async (data: any, statuteids: string[]) => {
29384
+ await this.uploadOnboardingMapping(data, 'triggers', statuteids);
28147
29385
  }
28148
29386
 
28149
- uploadInternalControlsMapping = async (data: any) => {
28150
- await this.uploadOnboardingMapping(data, 'internalcontrols');
29387
+ uploadInternalControlsMapping = async (data: any, statuteids: string[]) => {
29388
+ await this.uploadOnboardingMapping(data, 'internalcontrols', statuteids);
28151
29389
  }
28152
29390
 
28153
- uploadReportedLocationsMapping = async (data: any) => {
28154
- await this.uploadOnboardingMapping(data, 'reportedlocations');
29391
+ uploadReportedLocationsMapping = async (data: any, statuteids: string[]) => {
29392
+ await this.uploadOnboardingMapping(data, 'reportedlocations', statuteids);
28155
29393
  }
28156
29394
 
28157
- uploadAlertSchedulesMapping = async (data: any) => {
28158
- await this.uploadOnboardingMapping(data, 'alertschedules');
29395
+ uploadAlertSchedulesMapping = async (data: any, statuteids: string[]) => {
29396
+ await this.uploadOnboardingMapping(data, 'alertschedules', statuteids);
28159
29397
  }
28160
29398
 
28161
- uploadActivationsMapping = async (data: any) => {
28162
- await this.uploadOnboardingMapping(data, 'activations');
29399
+ uploadActivationsMapping = async (data: any, statuteids: string[]) => {
29400
+ await this.uploadOnboardingMapping(data, 'activations', statuteids);
28163
29401
  }
28164
29402
 
28165
- uploadInvalidationsMapping = async (data: any) => {
28166
- await this.uploadOnboardingMapping(data, 'invalidations');
29403
+ uploadInvalidationsMapping = async (data: any, statuteids: string[]) => {
29404
+ await this.uploadOnboardingMapping(data, 'invalidations', statuteids);
28167
29405
  }
28168
29406
 
28169
- uploadDuedatesMapping = async (data: any) => {
28170
- await this.uploadOnboardingMapping(data, 'duedates');
29407
+ uploadDuedatesMapping = async (data: any, statuteids: string[]) => {
29408
+ await this.uploadOnboardingMapping(data, 'duedates', statuteids);
28171
29409
 
28172
29410
  }
28173
29411
 
28174
- uploadExtensionsMapping = async (data: any) => {
28175
- await this.uploadOnboardingMapping(data, 'extensions');
29412
+ uploadExtensionsMapping = async (data: any, statuteids: string[]) => {
29413
+ await this.uploadOnboardingMapping(data, 'extensions', statuteids);
28176
29414
 
28177
29415
  }
28178
29416
 
28179
- uploadApproversMapping = async (data: any) => {
28180
- await this.uploadOnboardingMapping(data, 'approvers');
29417
+ uploadApproversMapping = async (data: any, statuteids: string[]) => {
29418
+ await this.uploadOnboardingMapping(data, 'approvers', statuteids);
28181
29419
 
28182
29420
  }
28183
29421
 
28184
- uploadFunctionHeadsMapping = async (data: any) => {
28185
- await this.uploadOnboardingMapping(data, 'functionheads');
29422
+ uploadFunctionHeadsMapping = async (data: any, statuteids: string[]) => {
29423
+ await this.uploadOnboardingMapping(data, 'functionheads', statuteids);
28186
29424
  }
28187
29425
 
28188
- uploadMakerCheckersMapping = async (data: any) => {
28189
- await this.uploadOnboardingMapping(data, 'makercheckers');
29426
+ uploadMakerCheckersMapping = async (data: any, statuteids: string[]) => {
29427
+ await this.uploadOnboardingMapping(data, 'makercheckers', statuteids);
28190
29428
  }
28191
29429
 
28192
- uploadDocsMapping = async (data: any) => {
28193
- await this.uploadOnboardingMapping(data, 'docs');
29430
+ uploadDocsMapping = async (data: any, statuteids: string[]) => {
29431
+ await this.uploadOnboardingMapping(data, 'docs', statuteids);
28194
29432
 
28195
29433
  }
28196
29434
 
28197
- uploadAuditorsMapping = async (data: any) => {
28198
- await this.uploadOnboardingMapping(data, 'auditors');
29435
+ uploadAuditorsMapping = async (data: any, statuteids: string[]) => {
29436
+ await this.uploadOnboardingMapping(data, 'auditors', statuteids);
28199
29437
 
28200
29438
  }
28201
29439
 
28202
- uploadViewersMapping = async (data: any) => {
28203
- await this.uploadOnboardingMapping(data, 'viewers');
29440
+ uploadViewersMapping = async (data: any, statuteids: string[]) => {
29441
+ await this.uploadOnboardingMapping(data, 'viewers', statuteids);
28204
29442
 
28205
29443
  }
28206
29444
 
28207
- uploadReportersMapping = async (data: any) => {
28208
- await this.uploadOnboardingMapping(data, 'reporters');
29445
+ uploadReportersMapping = async (data: any, statuteids: string[]) => {
29446
+ await this.uploadOnboardingMapping(data, 'reporters', statuteids);
28209
29447
  }
28210
29448
 
28211
- uploadTagsMapping = async (data: any) => {
28212
- await this.uploadOnboardingMapping(data, 'tags');
29449
+ uploadTagsMapping = async (data: any, statuteids: string[]) => {
29450
+ await this.uploadOnboardingMapping(data, 'tags', statuteids);
28213
29451
  }
28214
29452
 
28215
- uploadFunctionsMapping = async (data: any) => {
28216
- await this.uploadOnboardingMapping(data, 'functions');
29453
+ uploadFunctionsMapping = async (data: any, statuteids: string[]) => {
29454
+ await this.uploadOnboardingMapping(data, 'functions', statuteids);
28217
29455
  }
28218
29456
 
28219
- uploadLocationsMapping = async (data: any) => {
28220
- await this.uploadOnboardingMapping(data, 'locations');
29457
+ uploadLocationsMapping = async (data: any, statuteids: string[]) => {
29458
+ await this.uploadOnboardingMapping(data, 'locations', statuteids);
28221
29459
  }
28222
29460
 
28223
- uploadEntitiesMapping = async (data: any) => {
28224
- await this.uploadOnboardingMapping(data, 'entities');
29461
+ uploadEntitiesMapping = async (data: any, statuteids: string[]) => {
29462
+ await this.uploadOnboardingMapping(data, 'entities', statuteids);
28225
29463
  }
28226
29464
 
28227
- uploadCountriesMapping = async (data: any) => {
28228
- await this.uploadOnboardingMapping(data, 'countries');
29465
+ uploadCountriesMapping = async (data: any, statuteids: string[]) => {
29466
+ await this.uploadOnboardingMapping(data, 'countries', statuteids);
28229
29467
  }
28230
29468
 
28231
29469
  uploadMappedSuspense = async (data: any, year: string) => {
@@ -28262,11 +29500,11 @@ export class SfIEvents extends LitElement {
28262
29500
 
28263
29501
  }
28264
29502
 
28265
- uploadOnboardingMapping = async (data: any, onboardingstep: string) => {
29503
+ uploadOnboardingMapping = async (data: any, onboardingstep: string, statuteids: string[]) => {
28266
29504
 
28267
29505
  //console.log('uploading..', data);
28268
29506
 
28269
- let url = "https://" + this.apiId + "/updatemappedonboarding";
29507
+ let url = "https://" + this.apiId + "/updatemappedonboarding1";
28270
29508
 
28271
29509
  // const body = {
28272
29510
  // "projectid": this.projectId,
@@ -28277,7 +29515,8 @@ export class SfIEvents extends LitElement {
28277
29515
  let body: any = {
28278
29516
  "projectid": this.projectId,
28279
29517
  "presigned": true,
28280
- "onboardingstep": onboardingstep
29518
+ "onboardingstep": onboardingstep,
29519
+ "statuteids": statuteids
28281
29520
  }
28282
29521
 
28283
29522
  let authorization: any = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -28292,7 +29531,8 @@ export class SfIEvents extends LitElement {
28292
29531
  body = {
28293
29532
  "projectid": this.projectId,
28294
29533
  "key": jsonRespose.key,
28295
- "onboardingstep": onboardingstep
29534
+ "onboardingstep": onboardingstep,
29535
+ "statuteids": statuteids
28296
29536
  }
28297
29537
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
28298
29538
  xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization)) as any;
@@ -28320,11 +29560,14 @@ export class SfIEvents extends LitElement {
28320
29560
  }
28321
29561
  }
28322
29562
 
28323
- uploadCompliancesMapping = async (data: any) => {
28324
-
28325
- //console.log('uploading..', data);
28326
- let url = "https://" + this.apiId + "/updatemappedcompliances";
29563
+ uploadCompliancesMapping = async (data: any, mappedstatutes: Array<any>) => {
28327
29564
 
29565
+ console.log('uploading..', data, mappedstatutes);
29566
+ let url = "https://" + this.apiId + "/updatemappedcompliances1";
29567
+ let statuteids = []
29568
+ for (let statuteObj of mappedstatutes) {
29569
+ statuteids.push(statuteObj.id);
29570
+ }
28328
29571
  let body: any = {
28329
29572
  "projectid": this.projectId,
28330
29573
  "presigned": true,
@@ -28341,6 +29584,7 @@ export class SfIEvents extends LitElement {
28341
29584
 
28342
29585
  body = {
28343
29586
  "projectid": this.projectId,
29587
+ "statuteids": statuteids,
28344
29588
  "key": jsonRespose.key
28345
29589
  }
28346
29590
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -28363,28 +29607,35 @@ export class SfIEvents extends LitElement {
28363
29607
 
28364
29608
  uploadStatutesMapping = async (data: any) => {
28365
29609
 
28366
- //console.log('uploading..', data);
28367
- let url = "https://" + this.apiId + "/updatemappedstatutes";
28368
-
28369
- var searchstring = '';
29610
+ // console.log('uploading..', data);
29611
+ let url = "https://" + this.apiId + "/updatemappedstatutes1";
28370
29612
 
28371
- for (var i = 0; i < data.mappings.length; i++) {
29613
+ // var searchstring = '';
28372
29614
 
28373
- const dataItem = JSON.parse(data.mappings[i].data);
28374
- // //console.log(dataItem[3])
28375
- searchstring += dataItem[3];
28376
- if (i < (data.mappings.length - 1)) {
28377
- searchstring += '|';
28378
- }
29615
+ // for (var i = 0; i < data.mappings.length; i++) {
28379
29616
 
28380
- }
29617
+ // // const dataItem = JSON.parse(data.mappings[i].data);
29618
+ // const dataId = data.mappings[i].id;
29619
+ // // console.log(dataItem[3])
29620
+ // if (data.mappings[i].selected == true) {
29621
+ // searchstring += dataId;
29622
+ // // if (i < (data.mappings.length - 1)) {
29623
+ // searchstring += '|';
29624
+ // // }
29625
+ // }
28381
29626
 
28382
- // const body = {
29627
+ // }
29628
+ // if(searchstring.length > 0){
29629
+ // searchstring = searchstring.slice(0, -1);
29630
+ // }
29631
+ // const bodyUpload = {
28383
29632
  // "projectid": this.projectId,
28384
- // "data": JSON.stringify(data),
29633
+ // // "data": JSON.stringify(data),
28385
29634
  // "compliancessearchstring": searchstring
28386
29635
  // }
28387
29636
 
29637
+ // console.log("upload body", bodyUpload)
29638
+ // return;
28388
29639
 
28389
29640
  let body: any = {
28390
29641
  "projectid": this.projectId,
@@ -28402,7 +29653,6 @@ export class SfIEvents extends LitElement {
28402
29653
  body = {
28403
29654
  "projectid": this.projectId,
28404
29655
  "key": jsonRespose.key,
28405
- "compliancessearchstring": searchstring
28406
29656
  }
28407
29657
 
28408
29658
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -29657,11 +30907,11 @@ export class SfIEvents extends LitElement {
29657
30907
 
29658
30908
  }
29659
30909
 
29660
- fetchMappedCompliances = async () => {
30910
+ fetchMappedCompliances = async (statuteids = []) => {
29661
30911
 
29662
- let url = "https://" + this.apiId + "/getmappedcompliances";
30912
+ let url = "https://" + this.apiId + "/getmappedcompliances1";
29663
30913
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
29664
- const xhr: any = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization)) as any;
30914
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "statuteids": statuteids }, url, this._SfLoader, authorization)) as any;
29665
30915
  this._SfLoader.innerHTML = '';
29666
30916
  if (xhr.status == 200) {
29667
30917
 
@@ -29843,7 +31093,7 @@ export class SfIEvents extends LitElement {
29843
31093
 
29844
31094
  fetchSerializedMapping = async (onboardingstep: string) => {
29845
31095
 
29846
- const url = "https://" + this.apiId + "/getmappedserializedonboarding";
31096
+ const url = "https://" + this.apiId + "/getmappedserializedonboarding1";
29847
31097
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
29848
31098
  const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization)) as any;
29849
31099
  this._SfLoader.innerHTML = '';
@@ -29952,129 +31202,129 @@ export class SfIEvents extends LitElement {
29952
31202
 
29953
31203
  }
29954
31204
 
29955
- fetchMappedTriggers = async () => {
31205
+ fetchMappedTriggers = async (statuteids = []) => {
29956
31206
 
29957
- return (await this.fetchMappedOnboarding('triggers'));
31207
+ return (await this.fetchMappedOnboarding('triggers', statuteids));
29958
31208
 
29959
31209
  }
29960
31210
 
29961
- fetchMappedInternalControls = async () => {
31211
+ fetchMappedInternalControls = async (statuteids = []) => {
29962
31212
 
29963
- return (await this.fetchMappedOnboarding('internalcontrols'));
31213
+ return (await this.fetchMappedOnboarding('internalcontrols', statuteids));
29964
31214
 
29965
31215
  }
29966
31216
 
29967
- fetchMappedReportedLocations = async () => {
31217
+ fetchMappedReportedLocations = async (statuteids = []) => {
29968
31218
 
29969
- return (await this.fetchMappedOnboarding('reportedlocations'));
31219
+ return (await this.fetchMappedOnboarding('reportedlocations', statuteids));
29970
31220
 
29971
31221
  }
29972
31222
 
29973
- fetchMappedAlertSchedules = async () => {
31223
+ fetchMappedAlertSchedules = async (statuteids = []) => {
29974
31224
 
29975
- return (await this.fetchMappedOnboarding('alertschedules'));
31225
+ return (await this.fetchMappedOnboarding('alertschedules', statuteids));
29976
31226
 
29977
31227
  }
29978
31228
 
29979
- fetchMappedActivations = async () => {
31229
+ fetchMappedActivations = async (statuteids = []) => {
29980
31230
 
29981
- return (await this.fetchMappedOnboarding('activations'));
31231
+ return (await this.fetchMappedOnboarding('activations', statuteids));
29982
31232
 
29983
31233
  }
29984
31234
 
29985
- fetchMappedInvalidations = async () => {
31235
+ fetchMappedInvalidations = async (statuteids = []) => {
29986
31236
 
29987
- return (await this.fetchMappedOnboarding('invalidations'));
31237
+ return (await this.fetchMappedOnboarding('invalidations', statuteids));
29988
31238
 
29989
31239
  }
29990
31240
 
29991
- fetchMappedExtensions = async () => {
31241
+ fetchMappedExtensions = async (statuteids = []) => {
29992
31242
 
29993
- return (await this.fetchMappedOnboarding('extensions'));
31243
+ return (await this.fetchMappedOnboarding('extensions', statuteids));
29994
31244
 
29995
31245
  }
29996
31246
 
29997
- fetchMappedDuedates = async () => {
31247
+ fetchMappedDuedates = async (statuteids = []) => {
29998
31248
 
29999
- return (await this.fetchMappedOnboarding('duedates'));
31249
+ return (await this.fetchMappedOnboarding('duedates', statuteids));
30000
31250
 
30001
31251
  }
30002
31252
 
30003
- fetchMappedReporters = async () => {
31253
+ fetchMappedReporters = async (statuteids = []) => {
30004
31254
 
30005
- return (await this.fetchMappedOnboarding('reporters'));
31255
+ return (await this.fetchMappedOnboarding('reporters', statuteids));
30006
31256
 
30007
31257
  }
30008
31258
 
30009
- fetchMappedApprovers = async () => {
31259
+ fetchMappedApprovers = async (statuteids = []) => {
30010
31260
 
30011
- return (await this.fetchMappedOnboarding('approvers'));
31261
+ return (await this.fetchMappedOnboarding('approvers', statuteids));
30012
31262
 
30013
31263
  }
30014
31264
 
30015
- fetchMappedFunctionHeads = async () => {
31265
+ fetchMappedFunctionHeads = async (statuteids = []) => {
30016
31266
 
30017
- return (await this.fetchMappedOnboarding('functionheads'));
31267
+ return (await this.fetchMappedOnboarding('functionheads', statuteids));
30018
31268
 
30019
31269
  }
30020
31270
 
30021
- fetchMappedMakerCheckers = async () => {
31271
+ fetchMappedMakerCheckers = async (statuteids = []) => {
30022
31272
 
30023
- return (await this.fetchMappedOnboarding('makercheckers'));
31273
+ return (await this.fetchMappedOnboarding('makercheckers', statuteids));
30024
31274
 
30025
31275
  }
30026
31276
 
30027
- fetchMappedDocs = async () => {
31277
+ fetchMappedDocs = async (statuteids = []) => {
30028
31278
 
30029
- return (await this.fetchMappedOnboarding('docs'));
31279
+ return (await this.fetchMappedOnboarding('docs', statuteids));
30030
31280
 
30031
31281
  }
30032
31282
 
30033
- fetchMappedAuditors = async () => {
31283
+ fetchMappedAuditors = async (statuteids = []) => {
30034
31284
 
30035
- return (await this.fetchMappedOnboarding('auditors'));
31285
+ return (await this.fetchMappedOnboarding('auditors', statuteids));
30036
31286
 
30037
31287
  }
30038
31288
 
30039
- fetchMappedViewers = async () => {
31289
+ fetchMappedViewers = async (statuteids = []) => {
30040
31290
 
30041
- return (await this.fetchMappedOnboarding('viewers'));
31291
+ return (await this.fetchMappedOnboarding('viewers', statuteids));
30042
31292
 
30043
31293
  }
30044
31294
 
30045
- fetchMappedTags = async () => {
31295
+ fetchMappedTags = async (statuteids = []) => {
30046
31296
 
30047
- return (await this.fetchMappedOnboarding('tags'));
31297
+ return (await this.fetchMappedOnboarding('tags', statuteids));
30048
31298
 
30049
31299
  }
30050
31300
 
30051
- fetchMappedLocations = async () => {
31301
+ fetchMappedLocations = async (statuteids = []) => {
30052
31302
 
30053
- return (await this.fetchMappedOnboarding('locations'));
31303
+ return (await this.fetchMappedOnboarding('locations', statuteids));
30054
31304
 
30055
31305
  }
30056
31306
 
30057
- fetchMappedFunctions = async () => {
31307
+ fetchMappedFunctions = async (statuteids = []) => {
30058
31308
 
30059
- return (await this.fetchMappedOnboarding('functions'));
31309
+ return (await this.fetchMappedOnboarding('functions', statuteids));
30060
31310
  }
30061
31311
 
30062
- fetchMappedEntities = async () => {
31312
+ fetchMappedEntities = async (statuteids = []) => {
30063
31313
 
30064
- return (await this.fetchMappedOnboarding('entities'));
31314
+ return (await this.fetchMappedOnboarding('entities', statuteids));
30065
31315
  }
30066
31316
 
30067
- fetchMappedCountries = async () => {
31317
+ fetchMappedCountries = async (statuteids = []) => {
30068
31318
 
30069
- return (await this.fetchMappedOnboarding('countries'));
31319
+ return (await this.fetchMappedOnboarding('countries', statuteids));
30070
31320
 
30071
31321
  }
30072
31322
 
30073
- fetchMappedOnboarding = async (onboardingstep: string) => {
31323
+ fetchMappedOnboarding = async (onboardingstep: string, statuteids: string[]) => {
30074
31324
 
30075
- const url = "https://" + this.apiId + "/getmappedonboarding";
31325
+ const url = "https://" + this.apiId + "/getmappedonboarding1";
30076
31326
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
30077
- const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization)) as any;
31327
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep, "statuteids": statuteids }, url, this._SfLoader, authorization)) as any;
30078
31328
  this._SfLoader.innerHTML = '';
30079
31329
  if (xhr.status == 200) {
30080
31330
 
@@ -30083,7 +31333,17 @@ export class SfIEvents extends LitElement {
30083
31333
  resultPresigned = {};
30084
31334
  resultPresigned.data = {};
30085
31335
  let tempObj = await this.fetchPresignedUrl(jsRespose.signedUrlGet)
30086
- resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
31336
+ let tempArr = [];
31337
+ for (let statuteid of statuteids) {
31338
+ for (let foundObjId of Object.keys(tempObj[statuteid] ?? [])) {
31339
+ let tempPushObj = tempObj[statuteid][foundObjId];
31340
+ tempPushObj.id = foundObjId.split(';')[foundObjId.split(';').length - 1];
31341
+ tempPushObj.statuteid = statuteid;
31342
+ tempArr.push(tempPushObj);
31343
+ }
31344
+ }
31345
+ // resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
31346
+ resultPresigned.data.mappings = tempArr;
30087
31347
  console.log('resultPresigned onboarding1', tempObj);
30088
31348
  console.log('resultPresigned onboarding', resultPresigned);
30089
31349
  // await this.fetchPresignedUrlDelete(jsRespose.signedUrlDelete)
@@ -30127,7 +31387,7 @@ export class SfIEvents extends LitElement {
30127
31387
 
30128
31388
  fetchMappedStatutes = async () => {
30129
31389
 
30130
- let url = "https://" + this.apiId + "/getmappedstatutes";
31390
+ let url = "https://" + this.apiId + "/getmappedstatutes1";
30131
31391
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
30132
31392
  const xhr: any = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization)) as any;
30133
31393
  this._SfLoader.innerHTML = '';
@@ -30149,6 +31409,30 @@ export class SfIEvents extends LitElement {
30149
31409
 
30150
31410
  }
30151
31411
 
31412
+ fetchMappedStatutesList = async () => {
31413
+
31414
+ let url = "https://" + this.apiId + "/getmappedstatuteslist";
31415
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
31416
+ const xhr: any = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization)) as any;
31417
+ this._SfLoader.innerHTML = '';
31418
+ if (xhr.status == 200) {
31419
+
31420
+ const jsonRespose = JSON.parse(xhr.responseText);
31421
+ //console.log(jsonRespose);
31422
+ return jsonRespose.data;
31423
+
31424
+ } else {
31425
+ if (xhr.status == 401) {
31426
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
31427
+ this.dispatchEvent(changeEvent);
31428
+ }
31429
+ const jsonRespose = JSON.parse(xhr.responseText);
31430
+ this.setError(jsonRespose.error);
31431
+
31432
+ }
31433
+
31434
+ }
31435
+
30152
31436
  fetchCreateRcmJob = async (complianceid: string, data: any, triggerDate: string, triggerMessage: string, projects: any) => {
30153
31437
 
30154
31438
  data.trigger = {};