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.
package/sf-i-events.js CHANGED
@@ -5280,7 +5280,7 @@ let SfIEvents = class SfIEvents extends LitElement {
5280
5280
  console.log('idArr', idArr);
5281
5281
  const mmdd = idArr[2] + "/" + idArr[3];
5282
5282
  const j = idArr[4];
5283
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
5283
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
5284
5284
  let renewEvent = this.events[mmdd][j];
5285
5285
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
5286
5286
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -7395,73 +7395,81 @@ let SfIEvents = class SfIEvents extends LitElement {
7395
7395
  //console.log('mappedstatutes', mappedStatutes);
7396
7396
  this.renderOnboardingStatutes(mappedStatutes);
7397
7397
  };
7398
- this.loadOnboardingCompliances = async () => {
7398
+ this.loadOnboardingCompliances = async (selectedStatutes = []) => {
7399
7399
  this.hideTabContainers();
7400
7400
  this._SfOnboardingCompliancesContainer.style.display = 'flex';
7401
- const mappedStatutes = await this.fetchMappedStatutes();
7402
- const mappedCompliances = await this.fetchMappedCompliances();
7403
- this.renderOnboardingCompliances(mappedStatutes, mappedCompliances);
7401
+ const mappedStatutes = await this.fetchMappedStatutesList();
7402
+ console.log("mapped statutes", mappedStatutes);
7403
+ // const mappedStatutes = await this.fetchMappedStatutes();
7404
+ // const mappedCompliances = await this.fetchMappedCompliances();
7405
+ // this.renderOnboardingCompliances(mappedStatutes, mappedCompliances);
7406
+ this.renderOnboardingStatutesDropdownMapping(this._SfOnboardingCompliancesContainer, mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.renderOnboardingCompliances);
7404
7407
  };
7405
- this.loadOnboardingCountries = async () => {
7408
+ this.loadOnboardingCountries = async (selectedStatutes = []) => {
7406
7409
  this.hideTabContainers();
7407
7410
  this._SfOnboardingCountriesContainer.style.display = 'flex';
7411
+ const mappedStatutes = await this.fetchMappedStatutesList();
7408
7412
  // const countriesJobs = await this.fetchCountriesJobs();
7409
- const mappedCountries = await this.fetchMappedCountries();
7410
- const mappedCompliances = await this.fetchMappedCompliances();
7413
+ // const mappedCountries = await this.fetchMappedCountries();
7414
+ // const mappedCompliances = await this.fetchMappedCompliances();
7411
7415
  // const mappedStatutes = await this.fetchMappedStatutes();
7412
- //console.log('countriesJobs', countriesJobs);
7413
- console.log('mappedCompliances', mappedCompliances);
7414
- console.log('mappedCountries', mappedCountries);
7415
- for (var i = 0; i < mappedCompliances.data.mappings.mappings.length; i++) {
7416
- if (mappedCompliances.data.mappings.mappings[i].id == "33a0deab-e93e-41b7-831a-473f9ea3eea2") {
7417
- //console.log('uniqcol zero', mappedCompliances.data.mappings.mappings[i]);
7418
- }
7419
- }
7420
- this.renderOnboardingCountries(mappedCountries, mappedCompliances, null);
7416
+ // //console.log('countriesJobs', countriesJobs);
7417
+ // console.log('mappedCompliances', mappedCompliances);
7418
+ // console.log('mappedCountries', mappedCountries);
7419
+ // this.renderOnboardingCountries(mappedCountries, mappedCompliances, null);
7420
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingCountriesContainer, 'countries-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, () => { return []; }, this.fetchMappedCountries, this.renderOnboardingCountries);
7421
7421
  };
7422
- this.loadOnboardingEntities = async () => {
7422
+ this.loadOnboardingEntities = async (selectedStatutes = []) => {
7423
7423
  this.hideTabContainers();
7424
7424
  this._SfOnboardingEntitiesContainer.style.display = 'flex';
7425
7425
  // const entitiesJobs = await this.fetchEntitiesJobs();
7426
- const mappedEntities = await this.fetchMappedEntities();
7427
- const mappedSerializedCountries = await this.fetchMappedSerializedCountries();
7428
- const arrStatuteEntitiesApplicabilities = await this.loadProposedFromStatutes(1);
7429
- // const mappedStatutes = await this.fetchMappedStatutes();
7426
+ const mappedStatutes = await this.fetchMappedStatutesList();
7427
+ // const mappedEntities = await this.fetchMappedEntities();
7428
+ // const mappedSerializedCountries = await this.fetchMappedSerializedCountries();
7429
+ // const arrStatuteEntitiesApplicabilities = await this.loadProposedFromStatutes(1);
7430
+ // // const mappedStatutes = await this.fetchMappedStatutes();
7430
7431
  //console.log('mappedSerializedCountries', mappedSerializedCountries);
7431
7432
  //console.log('mappedEntities', mappedEntities);
7432
7433
  //console.log('entitiesApplicabilities', arrStatuteEntitiesApplicabilities);
7433
- this.renderOnboardingEntities(mappedEntities, mappedSerializedCountries, null, arrStatuteEntitiesApplicabilities);
7434
+ // this.renderOnboardingEntities(mappedEntities, mappedSerializedCountries, null, arrStatuteEntitiesApplicabilities);
7435
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingEntitiesContainer, 'entities-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedCountries, this.fetchMappedEntities, this.renderOnboardingEntities);
7434
7436
  };
7435
- this.loadOnboardingLocations = async () => {
7437
+ this.loadOnboardingLocations = async (selectedStatutes = []) => {
7436
7438
  this.hideTabContainers();
7437
7439
  this._SfOnboardingLocationsContainer.style.display = 'flex';
7438
7440
  // const locationsJobs = await this.fetchLocationsJobs();
7439
- const mappedSerializedEntities = await this.fetchMappedSerializedEntities();
7440
- const mappedLocations = await this.fetchMappedLocations();
7441
+ const mappedStatutes = await this.fetchMappedStatutesList();
7442
+ // const mappedSerializedEntities = await this.fetchMappedSerializedEntities();
7443
+ // const mappedLocations = await this.fetchMappedLocations();
7441
7444
  //console.log('mappedserializedentities', mappedSerializedEntities);
7442
- //console.log('mappedlocations', mappedLocations);
7443
- this.renderOnboardingLocations(mappedLocations, mappedSerializedEntities, null);
7445
+ //console.log('mappedlocations', mappedLocations);
7446
+ // this.renderOnboardingLocations(mappedLocations, mappedSerializedEntities, null);
7447
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingLocationsContainer, 'locations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedEntities, this.fetchMappedLocations, this.renderOnboardingLocations);
7444
7448
  };
7445
- this.loadOnboardingFunctions = async () => {
7449
+ this.loadOnboardingFunctions = async (selectedStatutes = []) => {
7446
7450
  this.hideTabContainers();
7447
7451
  this._SfOnboardingFunctionsContainer.style.display = 'flex';
7452
+ const mappedStatutes = await this.fetchMappedStatutesList();
7448
7453
  // const functionsJobs = await this.fetchFunctionJobs();
7449
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7450
- const mappedFunctions = await this.fetchMappedFunctions();
7454
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7455
+ // const mappedFunctions = await this.fetchMappedFunctions();
7451
7456
  //console.log('functionjobs', functionsJobs);
7452
7457
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7453
7458
  //console.log('mappedfunctions', mappedFunctions);
7454
- this.renderOnboardingFunctions(mappedFunctions, mappedSerializedLocations, null);
7459
+ // this.renderOnboardingFunctions(mappedFunctions, mappedSerializedLocations, null);
7460
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingFunctionsContainer, 'functions-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedLocations, this.fetchMappedFunctions, this.renderOnboardingFunctions);
7455
7461
  };
7456
- this.loadOnboardingTags = async () => {
7462
+ this.loadOnboardingTags = async (selectedStatutes = []) => {
7457
7463
  this.hideTabContainers();
7458
7464
  this._SfOnboardingTagsContainer.style.display = 'flex';
7465
+ const mappedStatutes = await this.fetchMappedStatutesList();
7459
7466
  // const tagsJobs = await this.fetchTagsJobs();
7460
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7461
- const mappedTags = await this.fetchMappedTags();
7467
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7468
+ // const mappedTags = await this.fetchMappedTags();
7462
7469
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7463
7470
  //console.log('mappedtags', mappedTags);
7464
- this.renderOnboardingTags(mappedTags, mappedSerializedLocations, null);
7471
+ // this.renderOnboardingTags(mappedTags, mappedSerializedLocations, null);
7472
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingTagsContainer, 'tags-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedTags, this.renderOnboardingTags);
7465
7473
  };
7466
7474
  this.loadProposedFromStatutes = async (fieldIndex) => {
7467
7475
  const mappedStatutes = await this.fetchMappedStatutes();
@@ -7479,161 +7487,191 @@ let SfIEvents = class SfIEvents extends LitElement {
7479
7487
  //console.log('mappedstatutesend', arrStatuteReporters);
7480
7488
  return arrStatuteReporters;
7481
7489
  };
7482
- this.loadOnboardingReporters = async () => {
7490
+ this.loadOnboardingReporters = async (selectedStatutes = []) => {
7483
7491
  this.hideTabContainers();
7484
7492
  this._SfOnboardingReportersContainer.style.display = 'flex';
7493
+ const mappedStatutes = await this.fetchMappedStatutesList();
7485
7494
  // const reportersJobs = await this.fetchReportersJobs();
7486
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7487
- const mappedReporters = await this.fetchMappedReporters();
7495
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7496
+ // const mappedReporters = await this.fetchMappedReporters();
7488
7497
  // const arrStatuteReporters = await this.loadProposedFromStatutes(1);
7489
7498
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7490
7499
  //console.log('mappedreporters', mappedReporters);
7491
7500
  //console.log('arrstatutereporters', arrStatuteReporters);
7492
- this.renderOnboardingReporters(mappedReporters, mappedSerializedLocations, null, null);
7501
+ // this.renderOnboardingReporters(mappedReporters, mappedSerializedLocations, null, null);
7502
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingReportersContainer, 'reporters-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedReporters, this.renderOnboardingReporters);
7493
7503
  };
7494
- this.loadOnboardingApprovers = async () => {
7504
+ this.loadOnboardingApprovers = async (selectedStatutes = []) => {
7495
7505
  this.hideTabContainers();
7496
7506
  this._SfOnboardingApproversContainer.style.display = 'flex';
7507
+ const mappedStatutes = await this.fetchMappedStatutesList();
7497
7508
  // const approversJobs = await this.fetchApproversJobs();
7498
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7499
- const mappedApprovers = await this.fetchMappedApprovers();
7509
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7510
+ // const mappedApprovers = await this.fetchMappedApprovers();
7500
7511
  // const arrStatuteApprovers = await this.loadProposedFromStatutes(2);
7501
7512
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7502
7513
  //console.log('mappedapprovers', mappedApprovers);
7503
- this.renderOnboardingApprovers(mappedApprovers, mappedSerializedLocations, null, null);
7514
+ // this.renderOnboardingApprovers(mappedApprovers, mappedSerializedLocations, null, null);
7515
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingApproversContainer, 'approvers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedApprovers, this.renderOnboardingApprovers);
7504
7516
  };
7505
- this.loadOnboardingFunctionHeads = async () => {
7517
+ this.loadOnboardingFunctionHeads = async (selectedStatutes = []) => {
7506
7518
  this.hideTabContainers();
7507
7519
  this._SfOnboardingFunctionHeadsContainer.style.display = 'flex';
7520
+ const mappedStatutes = await this.fetchMappedStatutesList();
7508
7521
  // const functionHeadsJobs = await this.fetchFunctionHeadsJobs();
7509
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7510
- const mappedFunctionHeads = await this.fetchMappedFunctionHeads();
7522
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7523
+ // const mappedFunctionHeads = await this.fetchMappedFunctionHeads();
7511
7524
  // const arrStatuteFunctionheads = await this.loadProposedFromStatutes(3);
7512
7525
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7513
7526
  //console.log('mappedfunctionheads', mappedFunctionHeads);
7514
- this.renderOnboardingFunctionHeads(mappedFunctionHeads, mappedSerializedLocations, null, null);
7527
+ // this.renderOnboardingFunctionHeads(mappedFunctionHeads, mappedSerializedLocations, null, null);
7528
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingFunctionHeadsContainer, 'functionheads-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedFunctionHeads, this.renderOnboardingFunctionHeads);
7515
7529
  };
7516
- this.loadOnboardingViewers = async () => {
7530
+ this.loadOnboardingViewers = async (selectedStatutes = []) => {
7517
7531
  this.hideTabContainers();
7518
7532
  this._SfOnboardingViewersContainer.style.display = 'flex';
7533
+ const mappedStatutes = await this.fetchMappedStatutesList();
7519
7534
  // const makerViewersJobs = await this.fetchViewersJobs();
7520
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7521
- const mappedViewers = await this.fetchMappedViewers();
7535
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7536
+ // const mappedViewers = await this.fetchMappedViewers();
7522
7537
  // const arrStatuteViewers = await this.loadProposedFromStatutes(5);
7523
7538
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7524
7539
  //console.log('mappedViewers', mappedViewers);
7525
- this.renderOnboardingViewers(mappedViewers, mappedSerializedLocations, null, null);
7540
+ // this.renderOnboardingViewers(mappedViewers, mappedSerializedLocations, null, null);
7541
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingViewersContainer, 'viewers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedViewers, this.renderOnboardingViewers);
7526
7542
  };
7527
- this.loadOnboardingDocs = async () => {
7543
+ this.loadOnboardingDocs = async (selectedStatutes = []) => {
7528
7544
  this.hideTabContainers();
7529
7545
  this._SfOnboardingDocsContainer.style.display = 'flex';
7546
+ const mappedStatutes = await this.fetchMappedStatutesList();
7530
7547
  // const docsJobs = await this.fetchDocsJobs();
7531
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7532
- const mappedDocs = await this.fetchMappedDocs();
7548
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7549
+ // const mappedDocs = await this.fetchMappedDocs();
7533
7550
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7534
7551
  //console.log('mappedDocs', mappedDocs);
7535
- this.renderOnboardingDocs(mappedDocs, mappedSerializedLocations, null);
7552
+ // this.renderOnboardingDocs(mappedDocs, mappedSerializedLocations, null);
7553
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingDocsContainer, 'docs-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedDocs, this.renderOnboardingDocs);
7536
7554
  };
7537
- this.loadOnboardingMakerCheckers = async () => {
7555
+ this.loadOnboardingMakerCheckers = async (selectedStatutes = []) => {
7538
7556
  this.hideTabContainers();
7539
7557
  this._SfOnboardingMakerCheckersContainer.style.display = 'flex';
7558
+ const mappedStatutes = await this.fetchMappedStatutesList();
7540
7559
  // const makerCheckersJobs = await this.fetchMakerCheckersJobs();
7541
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7542
- const mappedMakerCheckers = await this.fetchMappedMakerCheckers();
7560
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7561
+ // const mappedMakerCheckers = await this.fetchMappedMakerCheckers();
7543
7562
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7544
7563
  //console.log('mappedMakerCheckers', mappedMakerCheckers);
7545
- this.renderOnboardingMakerCheckers(mappedMakerCheckers, mappedSerializedLocations, null);
7564
+ // this.renderOnboardingMakerCheckers(mappedMakerCheckers, mappedSerializedLocations, null);
7565
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingMakerCheckersContainer, 'makercheckers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedMakerCheckers, this.renderOnboardingMakerCheckers);
7546
7566
  };
7547
- this.loadOnboardingAuditors = async () => {
7567
+ this.loadOnboardingAuditors = async (selectedStatutes = []) => {
7548
7568
  this.hideTabContainers();
7549
7569
  this._SfOnboardingAuditorsContainer.style.display = 'flex';
7570
+ const mappedStatutes = await this.fetchMappedStatutesList();
7550
7571
  // const auditorsJobs = await this.fetchAuditorsJobs();
7551
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7552
- const mappedAuditors = await this.fetchMappedAuditors();
7572
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7573
+ // const mappedAuditors = await this.fetchMappedAuditors();
7553
7574
  // const arrStatuteAuditors = await this.loadProposedFromStatutes(4);
7554
7575
  //console.log('mappedSerializedFunctionheads', mappedSerializedLocations);
7555
7576
  //console.log('mappedAuditors', mappedAuditors);
7556
- this.renderOnboardingAuditors(mappedAuditors, mappedSerializedLocations, null, null);
7577
+ // this.renderOnboardingAuditors(mappedAuditors, mappedSerializedLocations, null, null);
7578
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingAuditorsContainer, 'auditors-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedAuditors, this.renderOnboardingAuditors);
7557
7579
  };
7558
- this.loadOnboardingDuedates = async () => {
7580
+ this.loadOnboardingDuedates = async (selectedStatutes = []) => {
7559
7581
  this.hideTabContainers();
7560
7582
  this._SfOnboardingDuedatesContainer.style.display = 'flex';
7583
+ const mappedStatutes = await this.fetchMappedStatutesList();
7561
7584
  // const duedatesJobs = await this.fetchDueDatesJobs();
7562
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7563
- const mappedDuedates = await this.fetchMappedDuedates();
7585
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7586
+ // const mappedDuedates = await this.fetchMappedDuedates();
7564
7587
  //console.log('mappedSerializedLocations', mappedSerializedLocations);
7565
7588
  //console.log('mappedduedates', mappedDuedates);
7566
- this.renderOnboardingDuedates(mappedDuedates, mappedSerializedLocations, null);
7589
+ // this.renderOnboardingDuedates(mappedDuedates, mappedSerializedLocations, null);
7590
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingDuedatesContainer, 'duedates-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedDuedates, this.renderOnboardingDuedates);
7567
7591
  };
7568
- this.loadOnboardingActivations = async () => {
7592
+ this.loadOnboardingActivations = async (selectedStatutes = []) => {
7569
7593
  this.hideTabContainers();
7570
7594
  this._SfOnboardingActivationsContainer.style.display = 'flex';
7595
+ const mappedStatutes = await this.fetchMappedStatutesList();
7571
7596
  // const activationsJobs = await this.fetchExtensionsJobs();
7572
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7573
- const mappedActivations = await this.fetchMappedActivations();
7597
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7598
+ // const mappedActivations = await this.fetchMappedActivations();
7574
7599
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7575
7600
  //console.log('mappedactivations', mappedActivations);
7576
- this.renderOnboardingActivations(mappedActivations, mappedSerializedLocations, null);
7601
+ // this.renderOnboardingActivations(mappedActivations, mappedSerializedLocations, null);
7602
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingActivationsContainer, 'activations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedActivations, this.renderOnboardingActivations);
7577
7603
  };
7578
- this.loadOnboardingInvalidations = async () => {
7604
+ this.loadOnboardingInvalidations = async (selectedStatutes = []) => {
7579
7605
  this.hideTabContainers();
7580
7606
  this._SfOnboardingInvalidationsContainer.style.display = 'flex';
7607
+ const mappedStatutes = await this.fetchMappedStatutesList();
7581
7608
  // const invalidationsJobs = await this.fetchExtensionsJobs();
7582
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7583
- const mappedInvalidations = await this.fetchMappedInvalidations();
7609
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7610
+ // const mappedInvalidations = await this.fetchMappedInvalidations();
7584
7611
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7585
7612
  //console.log('mappedinvalidations', mappedInvalidations);
7586
- this.renderOnboardingInvalidations(mappedInvalidations, mappedSerializedLocations, null);
7613
+ // this.renderOnboardingInvalidations(mappedInvalidations, mappedSerializedLocations, null);
7614
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingInvalidationsContainer, 'invalidations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedInvalidations, this.renderOnboardingInvalidations);
7587
7615
  };
7588
- this.loadOnboardingAlertSchedules = async () => {
7616
+ this.loadOnboardingAlertSchedules = async (selectedStatutes = []) => {
7589
7617
  this.hideTabContainers();
7590
7618
  this._SfOnboardingAlertSchedulesContainer.style.display = 'flex';
7619
+ const mappedStatutes = await this.fetchMappedStatutesList();
7591
7620
  // const alertschedulesJobs = await this.fetchAlertSchedulesJobs();
7592
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7593
- const mappedAlertSchedules = await this.fetchMappedAlertSchedules();
7621
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7622
+ // const mappedAlertSchedules = await this.fetchMappedAlertSchedules();
7594
7623
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7595
7624
  //console.log('mappedalertschedules', mappedAlertSchedules);
7596
- this.renderOnboardingAlertSchedules(mappedAlertSchedules, mappedSerializedLocations, null);
7625
+ // this.renderOnboardingAlertSchedules(mappedAlertSchedules, mappedSerializedLocations, null);
7626
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingAlertSchedulesContainer, 'alertschedules-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedAlertSchedules, this.renderOnboardingAlertSchedules);
7597
7627
  };
7598
- this.loadOnboardingExtensions = async () => {
7628
+ this.loadOnboardingExtensions = async (selectedStatutes = []) => {
7599
7629
  this.hideTabContainers();
7600
7630
  this._SfOnboardingExtensionsContainer.style.display = 'flex';
7631
+ const mappedStatutes = await this.fetchMappedStatutesList();
7601
7632
  // const extensionsJobs = await this.fetchExtensionsJobs();
7602
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7603
- const mappedExtensions = await this.fetchMappedExtensions();
7633
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7634
+ // const mappedExtensions = await this.fetchMappedExtensions();
7604
7635
  //console.log('mappedserializedlocations', mappedSerializedLocations);
7605
7636
  //console.log('mappedextensions', mappedExtensions);
7606
- this.renderOnboardingExtensions(mappedExtensions, mappedSerializedLocations, null);
7637
+ // this.renderOnboardingExtensions(mappedExtensions, mappedSerializedLocations, null);
7638
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingExtensionsContainer, 'extensions-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedExtensions, this.renderOnboardingExtensions);
7607
7639
  };
7608
- this.loadOnboardingTriggers = async () => {
7640
+ this.loadOnboardingTriggers = async (selectedStatutes = []) => {
7609
7641
  this.hideTabContainers();
7610
7642
  this._SfOnboardingTriggersContainer.style.display = 'flex';
7643
+ const mappedStatutes = await this.fetchMappedStatutesList();
7611
7644
  // const triggersJobs = await this.fetchInternalControlsJobs();
7612
7645
  // const mappedSerializedAlertSchedules = await this.fetchMappedSerializedAlertSchedules();
7613
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7614
- const mappedTriggers = await this.fetchMappedTriggers();
7646
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7647
+ // const mappedTriggers = await this.fetchMappedTriggers();
7615
7648
  //console.log('mappedSerializedAlertSchedules', mappedSerializedAlertSchedules);
7616
7649
  //console.log('mappedTriggers', mappedTriggers);
7617
- this.renderOnboardingTriggers(mappedTriggers, mappedSerializedLocations, null);
7650
+ // this.renderOnboardingTriggers(mappedTriggers, mappedSerializedLocations, null);
7651
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingTriggersContainer, 'triggers-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedTriggers, this.renderOnboardingTriggers);
7618
7652
  };
7619
- this.loadOnboardingInternalControls = async () => {
7653
+ this.loadOnboardingInternalControls = async (selectedStatutes = []) => {
7620
7654
  this.hideTabContainers();
7621
7655
  this._SfOnboardingInternalControlsContainer.style.display = 'flex';
7656
+ const mappedStatutes = await this.fetchMappedStatutesList();
7622
7657
  // const internalcontrolsJobs = await this.fetchInternalControlsJobs();
7623
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7624
- const mappedInternalControls = await this.fetchMappedInternalControls();
7658
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7659
+ // const mappedInternalControls = await this.fetchMappedInternalControls();
7625
7660
  //console.log('mappedSerializedlocations', mappedSerializedLocations);
7626
7661
  //console.log('mappedinternalcontrols', mappedInternalControls);
7627
- this.renderOnboardingInternalControls(mappedInternalControls, mappedSerializedLocations, null);
7662
+ // this.renderOnboardingInternalControls(mappedInternalControls, mappedSerializedLocations, null);
7663
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingInternalControlsContainer, 'internalcontrols-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedInternalControls, this.renderOnboardingInternalControls);
7628
7664
  };
7629
- this.loadOnboardingReportedLocations = async () => {
7665
+ this.loadOnboardingReportedLocations = async (selectedStatutes = []) => {
7630
7666
  this.hideTabContainers();
7631
7667
  this._SfOnboardingReportedLocationsContainer.style.display = 'flex';
7632
- const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7633
- const mappedReportedLocations = await this.fetchMappedReportedLocations();
7668
+ const mappedStatutes = await this.fetchMappedStatutesList();
7669
+ // const mappedSerializedLocations = await this.fetchMappedSerializedLocations();
7670
+ // const mappedReportedLocations = await this.fetchMappedReportedLocations();
7634
7671
  //console.log('mappedSerializedlocations', mappedSerializedLocations);
7635
7672
  //console.log('mappedReportedLocations', mappedReportedLocations);
7636
- this.renderOnboardingReportedLocations(mappedReportedLocations, mappedSerializedLocations, null);
7673
+ // this.renderOnboardingReportedLocations(mappedReportedLocations, mappedSerializedLocations, null);
7674
+ this.renderOnboardingStatutesDropdownTagging(this._SfOnboardingReportedLocationsContainer, 'reportedlocations-list-container', mappedStatutes, selectedStatutes, this.fetchMappedCompliances, this.fetchMappedFunctions, this.fetchMappedReportedLocations, this.renderOnboardingReportedLocations);
7637
7675
  };
7638
7676
  this.loadOnboardingSignoff = async () => {
7639
7677
  this.hideTabContainers();
@@ -9274,7 +9312,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9274
9312
  console.log('idArr', idArr);
9275
9313
  const mmdd = idArr[2] + "/" + idArr[3];
9276
9314
  const j = idArr[4];
9277
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
9315
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
9278
9316
  let renewEvent = this.events[mmdd][j];
9279
9317
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
9280
9318
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -9919,7 +9957,7 @@ let SfIEvents = class SfIEvents extends LitElement {
9919
9957
  console.log('idArr', idArr);
9920
9958
  const mmdd = idArr[2] + "/" + idArr[3];
9921
9959
  const j = idArr[4];
9922
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
9960
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
9923
9961
  let renewEvent = this.events[mmdd][j];
9924
9962
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
9925
9963
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -10100,6 +10138,7 @@ let SfIEvents = class SfIEvents extends LitElement {
10100
10138
  const startDate = new Date(startDateStr);
10101
10139
  const endDate = new Date(endDateStr);
10102
10140
  const month = parseInt(monthStr, 10); // Ensure month is a number
10141
+ console.log('getting date', startDate, endDate, month);
10103
10142
  if (isNaN(month) || month < 1 || month > 12) {
10104
10143
  return this.calendarStartYYYY;
10105
10144
  }
@@ -11000,7 +11039,7 @@ let SfIEvents = class SfIEvents extends LitElement {
11000
11039
  console.log('idArr', idArr);
11001
11040
  const mmdd = idArr[2] + "/" + idArr[3];
11002
11041
  const j = idArr[4];
11003
- const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[3]);
11042
+ const yyyy = this.getYearFromMonthBetween(this.sdate, this.edate, idArr[2]);
11004
11043
  let renewEvent = this.events[mmdd][j];
11005
11044
  let fullEvent = await this.fetchRCMResourceDetails(renewEvent, mmdd + "/" + yyyy, true);
11006
11045
  console.log('renew clicked', fullEvent, fullEvent.reportformatvalues);
@@ -15988,6 +16027,61 @@ let SfIEvents = class SfIEvents extends LitElement {
15988
16027
  taggingArray.data.mappings.mappings = tempArray;
15989
16028
  //console.log('selectedindexchecking', colName, taggingArray);
15990
16029
  };
16030
+ this.applyAndReloadTaggingNew = (e, colName, taggingArray, sourceArray, divElement) => {
16031
+ const selectedIndex = e.currentTarget.id.split('-')[1];
16032
+ const tempArray = [];
16033
+ console.log('sourceArray apply', sourceArray, taggingArray);
16034
+ console.log('selectedindexchecking 1', this.selectedCbs);
16035
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
16036
+ console.log('selectedindexchecking', selectedIndex, count, this.selectedCbs.includes(selectedIndex + ""), this.selectedCbs.includes(count + ""));
16037
+ tempArray.push(taggingArray.data.mappings.mappings[count]);
16038
+ if (this.selectedCbs.includes(selectedIndex + '') && this.selectedCbs.includes(count + '')) {
16039
+ if (divElement.querySelector('#tags-' + selectedIndex).selectedValues != null) {
16040
+ if (tempArray[count] == null)
16041
+ tempArray[count] = {};
16042
+ tempArray[count][colName] = divElement.querySelector('#tags-' + selectedIndex).selectedValues();
16043
+ }
16044
+ else {
16045
+ if (tempArray[count] == null)
16046
+ tempArray[count] = {};
16047
+ tempArray[count][colName] = divElement.querySelector('#tags-' + selectedIndex).value;
16048
+ }
16049
+ }
16050
+ else {
16051
+ if (divElement.querySelector('#tags-' + count).selectedValues != null) {
16052
+ if (tempArray[count] == null)
16053
+ tempArray[count] = {};
16054
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
16055
+ let selectedValues = divElement.querySelector('#tags-' + count).selectedValues();
16056
+ if (selectedValues == null || selectedValues.length == 0) {
16057
+ tempArray[count] = {};
16058
+ console.log('deleting1', tempArray);
16059
+ }
16060
+ else {
16061
+ tempArray[count][colName] = divElement.querySelector('#tags-' + count).selectedValues();
16062
+ }
16063
+ }
16064
+ else {
16065
+ tempArray[count][colName] = divElement.querySelector('#tags-' + count).selectedValues();
16066
+ }
16067
+ }
16068
+ else {
16069
+ //console.log('selectedindexchecking D');
16070
+ if (tempArray[count] == null)
16071
+ tempArray[count] = {};
16072
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
16073
+ tempArray[count] = {};
16074
+ console.log('deleting2', tempArray);
16075
+ }
16076
+ else {
16077
+ tempArray[count][colName] = divElement.querySelector('#tags-' + count).value;
16078
+ }
16079
+ }
16080
+ }
16081
+ }
16082
+ taggingArray.data.mappings.mappings = tempArray;
16083
+ console.log('selectedindexchecking', colName, taggingArray);
16084
+ };
15991
16085
  this.getDataValue = (jsonData, id) => {
15992
16086
  let ret = null;
15993
16087
  //console.log('pushing up again..', id, jsonData);
@@ -16007,7 +16101,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16007
16101
  }
16008
16102
  return ret;
16009
16103
  };
16010
- this.saveMapping = async (divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, saveInBackground = false) => {
16104
+ this.saveMapping = async (divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, saveInBackground = false, mappedStatutes) => {
16011
16105
  const process = async () => {
16012
16106
  const tableRowArr = divElement.querySelectorAll('.tablerow');
16013
16107
  const checkboxArr = divElement.querySelectorAll('.checkbox-row');
@@ -16021,30 +16115,79 @@ let SfIEvents = class SfIEvents extends LitElement {
16021
16115
  let updatedRows = [];
16022
16116
  let jsonArr = [];
16023
16117
  if (uploadBlock < 0) {
16024
- for (var i = 0; i < checkboxArr.length; i++) {
16025
- //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
16026
- if (tableRowArr[i].style.display == 'none') {
16027
- }
16028
- else {
16029
- updatedRows.push(statuteArr[i].text);
16118
+ if (mappedStatutes.length == 0) {
16119
+ for (var i = 0; i < checkboxArr.length; i++) {
16120
+ //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
16121
+ if (checkboxArr[i].checked !== true) {
16122
+ continue;
16123
+ }
16124
+ if (tableRowArr[i].style.display == 'none') {
16125
+ }
16126
+ else {
16127
+ updatedRows.push(statuteArr[i].text);
16128
+ }
16129
+ let cols = JSON.parse(this.getColsValue(jsonData, statuteArr[i].text)[0]);
16130
+ let data = JSON.parse(this.getDataValue(jsonData, statuteArr[i].text)[0]);
16131
+ var dataToBePushed = { id: statuteArr[i].text, name: data[cols.indexOf('name')], countryname: data[cols.indexOf('country')][0] };
16132
+ /* 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[] };
16133
+ for (var j = 0; j < extraFields.length; j++) {
16134
+ const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
16135
+ const value = inputArr[k].getValues();
16136
+ dataToBePushed.extraFields.push(value);
16137
+ if (j === 0) {
16138
+ const fields = inputArr[i].getFields();
16139
+ dataToBePushed.updatedFields.push(...fields);
16140
+ }
16141
+ } */
16142
+ jsonArr.push(dataToBePushed);
16030
16143
  }
16031
- var dataToBePushed = { id: statuteArr[i].text, selected: checkboxArr[i].checked, data: this.getDataValue(jsonData, statuteArr[i].text), cols: this.getColsValue(jsonData, statuteArr[i].text), extraFields: [], updatedFields: [] };
16032
- for (var j = 0; j < extraFields.length; j++) {
16033
- const inputArr = divElement.querySelectorAll('.extra-field-' + j);
16034
- const value = inputArr[i].getValues();
16035
- // //console.log('value', value);
16036
- dataToBePushed.extraFields.push(value);
16037
- if (j === 0) {
16144
+ console.log('jsonArr', jsonArr);
16145
+ //console.log('updatedRows', updatedRows);
16146
+ // const batchNum = new Date().getTime();
16147
+ // await uploadFunction({ "searchstring": searchString, "mappings": jsonArr, "batch": batchNum, "updatedrows": updatedRows });
16148
+ await uploadFunction({ "searchstring": searchString, "mappings": jsonArr });
16149
+ }
16150
+ else {
16151
+ for (var i = 0; i < checkboxArr.length; i++) {
16152
+ //console.log('tablerow', (tableRowArr[i] as HTMLTableRowElement));
16153
+ if (checkboxArr[i].checked !== true) {
16154
+ continue;
16155
+ }
16156
+ if (tableRowArr[i].style.display == 'none') {
16157
+ }
16158
+ else {
16159
+ updatedRows.push(statuteArr[i].text);
16160
+ }
16161
+ let cols = JSON.parse(this.getColsValue(jsonData, statuteArr[i].text)[0]);
16162
+ let data = JSON.parse(this.getDataValue(jsonData, statuteArr[i].text)[0]);
16163
+ var dataToBePushed = { id: statuteArr[i].text, data: [JSON.stringify(data)], cols: [JSON.stringify(cols)] };
16164
+ /* 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[] };
16165
+ for (var j = 0; j < extraFields.length; j++) {
16166
+ const inputArr = (divElement as HTMLDivElement).querySelectorAll('.extra-field-' + j) as NodeListOf<SfIMultitextarea>;
16167
+ const value = inputArr[k].getValues();
16168
+ dataToBePushed.extraFields.push(value);
16169
+ if (j === 0) {
16038
16170
  const fields = inputArr[i].getFields();
16039
16171
  dataToBePushed.updatedFields.push(...fields);
16172
+ }
16173
+ } */
16174
+ jsonArr.push(dataToBePushed);
16175
+ }
16176
+ let jsonObj = {};
16177
+ for (let statuteObj of mappedStatutes) {
16178
+ let statuteid = statuteObj.id;
16179
+ if (jsonObj[statuteid] == null) {
16180
+ jsonObj[statuteid] = {};
16181
+ }
16182
+ for (let mappingObj of jsonArr) {
16183
+ console.log('mappingObj', mappingObj.data, statuteid);
16184
+ if (mappingObj.data[0].indexOf(statuteid) >= 0) {
16185
+ jsonObj[statuteid][mappingObj.id] = mappingObj;
16186
+ }
16040
16187
  }
16041
16188
  }
16042
- jsonArr.push(dataToBePushed);
16189
+ await uploadFunction(jsonObj, mappedStatutes);
16043
16190
  }
16044
- //console.log('jsonArr', jsonArr);
16045
- //console.log('updatedRows', updatedRows);
16046
- const batchNum = new Date().getTime();
16047
- await uploadFunction({ "searchstring": searchString, "mappings": jsonArr, "batch": batchNum, "updatedrows": updatedRows });
16048
16191
  }
16049
16192
  else {
16050
16193
  const batchNum = new Date().getTime();
@@ -16077,7 +16220,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16077
16220
  }
16078
16221
  }
16079
16222
  if (!saveInBackground)
16080
- refreshFunction();
16223
+ refreshFunction(mappedStatutes);
16081
16224
  };
16082
16225
  if (this.disablesave == "yes") {
16083
16226
  return;
@@ -16099,12 +16242,49 @@ let SfIEvents = class SfIEvents extends LitElement {
16099
16242
  process();
16100
16243
  }
16101
16244
  };
16102
- this.saveTagging = async (mapping, uploadFunction, refreshFunction, saveInBackground) => {
16245
+ this.saveTagging = async (mapping, selectedStatutes, uploadFunction, refreshFunction, saveInBackground, colName) => {
16103
16246
  async function process() {
16104
- //console.log('Saving...', mapping);
16105
- await uploadFunction(mapping);
16247
+ console.log('Saving...', JSON.stringify(mapping));
16248
+ let statuteids = [];
16249
+ let statutewiseMapping = {};
16250
+ for (let statutesObj of selectedStatutes) {
16251
+ statuteids.push(statutesObj.id);
16252
+ statutewiseMapping[statutesObj.id] = {};
16253
+ for (let mapObj of mapping.mappings) {
16254
+ if (mapObj.statuteid == statutesObj.id) {
16255
+ let pushObj = mapObj;
16256
+ delete pushObj.statuteid;
16257
+ let compoundid = mapObj.id;
16258
+ // if (colName == "countries" || colName == "entities" || colName == "locations") {
16259
+ switch (colName) {
16260
+ case "countries":
16261
+ compoundid = mapObj.id;
16262
+ break;
16263
+ case "entities":
16264
+ compoundid = mapObj.countryid + ';' + mapObj.id;
16265
+ break;
16266
+ case "locations":
16267
+ compoundid = mapObj.entityid + ';' + mapObj.id;
16268
+ break;
16269
+ default:
16270
+ compoundid = mapObj.entityid + ';' + mapObj.locationid + ';' + mapObj.id;
16271
+ break;
16272
+ }
16273
+ // }
16274
+ if (statutewiseMapping[statutesObj.id][compoundid] != null) {
16275
+ let pushObjOld = statutewiseMapping[statutesObj.id][compoundid];
16276
+ pushObj[colName] = [...pushObjOld[colName], ...mapObj[colName]];
16277
+ }
16278
+ else {
16279
+ statutewiseMapping[statutesObj.id][compoundid] = pushObj;
16280
+ }
16281
+ }
16282
+ }
16283
+ }
16284
+ console.log('Uploading ...', JSON.stringify(statutewiseMapping));
16285
+ await uploadFunction(statutewiseMapping, statuteids);
16106
16286
  if (!saveInBackground)
16107
- refreshFunction();
16287
+ refreshFunction(selectedStatutes);
16108
16288
  }
16109
16289
  if (this.disablesave == "yes") {
16110
16290
  return;
@@ -16984,7 +17164,7 @@ let SfIEvents = class SfIEvents extends LitElement {
16984
17164
  // });
16985
17165
  const buttonSave = divElement.querySelector('.button-save');
16986
17166
  buttonSave === null || buttonSave === void 0 ? void 0 : buttonSave.addEventListener('click', async () => {
16987
- await this.saveTagging(taggingArray.data.mappings, uploadFunction, refreshFunction, false);
17167
+ await this.saveTagging(taggingArray.data.mappings, [], uploadFunction, refreshFunction, false, colName);
16988
17168
  });
16989
17169
  const buttonCancel = divElement.querySelector('.button-cancel');
16990
17170
  buttonCancel === null || buttonCancel === void 0 ? void 0 : buttonCancel.addEventListener('click', async () => {
@@ -17024,133 +17204,975 @@ let SfIEvents = class SfIEvents extends LitElement {
17024
17204
  }
17025
17205
  this.changedOnboardingItemIds = [];
17026
17206
  };
17027
- this.renderMappingTable = (divElement, jsonData, cursor, fetchFunction, searchString, mappedArray, found, uploadFunction, refreshFunction, extraFields, uploadBlock, extraFieldPosition, colName, subfilter, statuteColName, extraHintsArr) => {
17028
- var _a, _b, _c, _f, _g, _h, _j;
17029
- console.log('cols1', jsonData);
17030
- // console.log('cols', jsonData[0].data.cols);
17031
- //console.log('divelement', divElement);
17032
- //console.log('jsonData', jsonData);
17033
- //console.log('cursor', cursor);
17034
- //console.log('fetch', fetchFunction);
17035
- //console.log('searchstring', searchString);
17036
- //console.log('subfiltervalue', subfilter);
17037
- const arrCompliancesFrequencies = {};
17038
- if (jsonData.length === 0)
17039
- return;
17207
+ this.renderTaggingTableNew = (divElement, selectedStatutes, sourceObject, sourceMapping, taggingObject, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter) => {
17208
+ var _a, _b, _c, _f;
17209
+ console.log('sourceObj', sourceObject);
17210
+ console.log('taggingObj', taggingObject);
17211
+ let sourceArray = { data: { mappings: { mappings: sourceObject.data.mappings } } };
17212
+ let taggingArray = { data: { mappings: { mappings: taggingObject.data.mappings } } };
17213
+ if (taggingObject.data.mappings.mappings != null) {
17214
+ taggingArray = taggingObject;
17215
+ }
17216
+ console.log('divelement', divElement);
17217
+ console.log('sourcearray', sourceArray);
17218
+ console.log('sourceMapping', sourceMapping);
17219
+ console.log('taggingarray', JSON.stringify(taggingArray));
17220
+ console.log('selectedStatutes', selectedStatutes);
17040
17221
  this.selectedCbs = [];
17041
- let colCountry = -1;
17042
- let colState = -1;
17043
- let colSubcategory = -1;
17044
- let colStatute = -1;
17045
- const unfilteredDict = [];
17046
- var html = '';
17047
- html += '<div>';
17048
- html += '<h3 part="results-title">Total Items (' + found + ')</h3>';
17049
- html += '<h4 id="span-filtered" part="results-title"></h4>';
17050
- html += '<h4 id="span-extra-filled" part="results-title"></h4>';
17051
- html += '</div>';
17052
- html += '<div class="d-flex justify-between align-center left-sticky flex-wrap mb-20">';
17053
- html += '<div id="div-subfiltered"></div>';
17054
- html += '<div id="scroll-overlay" part="onboarding-scroll-overlay" class="pos-fixed-scroll justify-center align-center">';
17055
- html += '<div id="scroll-overlay-left" class="mr-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_left_alt</span></button></div>';
17056
- html += '<div id="scroll-overlay-right" class="ml-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_right_alt</span></button></div>';
17057
- html += '</div>';
17058
- html += '<div id="detail-overlay" part="onboarding-detail-overlay" class="pos-fixed justify-center align-center hide">';
17059
- html += '<div class="cover-slide"></div>';
17060
- html += '<div class="detail-container p-10">';
17061
- html += '<div class="d-flex justify-between align-center mb-20">';
17062
- html += '<div part="results-title">Row Details</div>';
17063
- html += '<button part="button-icon" class="detail-close"><span class="material-symbols-outlined">close</span></button>';
17064
- html += '</div>';
17065
- html += '<div id="detail-overlay-list">';
17066
- html += '</div>';
17067
- html += '</div>';
17068
- html += '</div>';
17069
- html += '<div class="d-flex align-center">';
17070
- html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="' + subfilter + '" />';
17071
- html += '<div class="mr-10">';
17072
- 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>';
17073
- 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>';
17074
- html += '</div>';
17075
- html += (this.disablesave == "yes" ? '' : '<button part="button" class="button-save" disabled>Save</button>');
17076
- html += '</div>';
17077
- html += '</div>';
17078
- html += '<table id="table-data">';
17079
- html += '<thead>';
17080
- html += '<th part="td-head" class="td-head">';
17081
- // html += 'Select';
17082
- html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
17083
- html += '</th>';
17084
- html += '<th part="td-head" class="td-head">';
17085
- html += '<div>View</div>';
17086
- html += '</th>';
17087
- if (extraFieldPosition === 0) {
17088
- for (var i = 0; i < extraFields.length; i++) {
17089
- html += '<th part="td-head" class="td-head">';
17090
- html += extraFields[i];
17091
- html += '</th>';
17092
- }
17093
- }
17094
- if (colName.toLowerCase() == "compliances") {
17095
- html += '<th part="td-head" class="td-head">';
17096
- html += 'Proposed Users';
17097
- html += '</th>';
17098
- }
17099
- html += '<th part="td-head" class="td-head">';
17100
- html += 'Id';
17101
- html += '</th>';
17102
- // for(var j = 0; j < JSON.parse(jsonData[0].data.cols).length; j++) {
17103
- // if(jsonData[0].cols.includes(JSON.parse(jsonData[0].data.cols)[j])) {
17104
- // html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == JSON.parse(jsonData[0].data.cols)[j].toLowerCase() ? 'left-sticky' : '') + '">'
17105
- // html += JSON.parse(jsonData[0].data.cols)[j]
17106
- // html += '</th>'
17222
+ // const foundArr = [];
17223
+ // if (taggingArray.data.mappings != null && taggingArray.data.mappings.mappings.length > 0) {
17224
+ // console.log('scanning taggingarray', taggingArray.data.mappings.mappings.length + "");
17225
+ // for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17226
+ // var found = false;
17227
+ // // console.log('source array search', sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id], taggingArray.data.mappings.mappings[i].id)
17228
+ // if (taggingArray.data.mappings.mappings[i].id != null && sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] != null) {
17229
+ // var equal = true;
17230
+ // for (var k = 0; k < uniqCols.length; k++) {
17231
+ // console.log('checking uniqCols', uniqCols[k]);
17232
+ // if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] != null && taggingArray.data.mappings.mappings[i] != null) {
17233
+ // if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
17234
+ // equal = false;
17235
+ // }
17236
+ // }
17237
+ // }
17238
+ // if (equal) {
17239
+ // found = true;
17240
+ // }
17241
+ // }
17242
+ // if (found) {
17243
+ // foundArr.push(taggingArray.data.mappings.mappings[i]);
17244
+ // } else {
17245
+ // console.log('taggingarray not found', taggingArray.data.mappings.mappings[i], i)
17246
+ // }
17107
17247
  // }
17248
+ // } else {
17249
+ // console.log('taggingArray1', taggingArray.data.mappings, taggingArray.data.mappings.mappings)
17108
17250
  // }
17109
- for (var j = 0; j < jsonData[0].cols.length; j++) {
17110
- console.log('jsoncols', JSON.parse(jsonData[0].data.cols), jsonData[0].cols.length, j);
17111
- html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == ((_a = JSON.parse(jsonData[0].data.cols)[j]) !== null && _a !== void 0 ? _a : "").toLowerCase() ? 'left-sticky' : '') + '">';
17112
- // html += jsonData[0].cols[j]
17113
- html += '</th>';
17251
+ // console.log('taggingarray2', taggingArray.data.mappings.mappings.length + "");
17252
+ // if (taggingArray.data.mappings == null) {
17253
+ // taggingArray.data.mappings = {};
17254
+ // }
17255
+ // taggingArray.data.mappings.mappings = foundArr;
17256
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17257
+ if (taggingArray.data.mappings.mappings[i].id != null && sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] == null) {
17258
+ taggingArray.data.mappings.mappings.splice(i, 1);
17259
+ }
17114
17260
  }
17115
- if (extraFieldPosition === 1) {
17116
- for (var i = 0; i < extraFields.length; i++) {
17117
- html += '<th part="td-head" class="td-head">';
17118
- html += extraFields[i];
17119
- html += '</th>';
17261
+ let mandatoryPresent = true;
17262
+ console.log('mandatoryFields', mandatoryFields);
17263
+ for (i = 0; i < mandatoryFields.length; i++) {
17264
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17265
+ if (taggingArray.data.mappings.mappings[j][mandatoryFields[i]] == null) {
17266
+ console.log('mandatory not found', mandatoryFields[i]);
17267
+ mandatoryPresent = false;
17268
+ }
17120
17269
  }
17121
17270
  }
17122
- html += '</thead>';
17123
- //console.log('colstate', JSON.parse(jsonData[0].data.cols));
17124
- for (var i = 0; i < JSON.parse(jsonData[0].data.cols).length; i++) {
17125
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "country") {
17126
- console.log('colstate country', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
17127
- colCountry = i;
17271
+ var taggedIds = [];
17272
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17273
+ if (taggingArray.data.mappings.mappings[j] != null) {
17274
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
17275
+ if (taggedIds.indexOf(taggingArray.data.mappings.mappings[j].id) < 0) {
17276
+ taggedIds.push(taggingArray.data.mappings.mappings[j].id);
17277
+ }
17278
+ }
17128
17279
  }
17129
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "state") {
17130
- //console.log('colstate state', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
17131
- colState = i;
17280
+ }
17281
+ // if (taggedIds.length < Object.keys(sourceArray.data.mappings.mappings).length) {
17282
+ // for (let sourceid of Object.keys(sourceArray.data.mappings.mappings)) {
17283
+ // if (taggedIds.indexOf(sourceid) >= 0) {
17284
+ // continue;
17285
+ // }
17286
+ // let objToPush: any = { id: sourceid }
17287
+ // for (i = 0; i < (mandatoryFields as Array<string>).length; i++) {
17288
+ // objToPush[mandatoryFields[i]] = ""
17289
+ // }
17290
+ // taggingArray.data.mappings.mappings.push(objToPush);
17291
+ // }
17292
+ // }
17293
+ for (var i = 0; i < ((_b = (_a = sourceMapping.data) === null || _a === void 0 ? void 0 : _a.mappings) !== null && _b !== void 0 ? _b : []).length; i++) {
17294
+ let flagMatch = false;
17295
+ if (sourceArray.data.mappings.mappings[sourceMapping.data.mappings[i].id] == null) {
17296
+ continue;
17132
17297
  }
17133
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "subcategory") {
17134
- //console.log('colstate subcategory', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
17135
- colSubcategory = i;
17298
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17299
+ if (taggingArray.data.mappings.mappings[j] != null) {
17300
+ if (sourceMapping.data.mappings[i].id == taggingArray.data.mappings.mappings[j].id) {
17301
+ let flagMatchObj = true;
17302
+ for (let objKey of compareFields) {
17303
+ if (sourceMapping.data.mappings[i][objKey] !== taggingArray.data.mappings.mappings[j][objKey] && taggingArray.data.mappings.mappings[j][objKey] != null) {
17304
+ console.log('Flag Mismatch', objKey, sourceMapping.data.mappings[i][objKey], taggingArray.data.mappings.mappings[j][objKey]);
17305
+ flagMatchObj = false;
17306
+ break;
17307
+ }
17308
+ }
17309
+ if (flagMatchObj == true) {
17310
+ flagMatch = true;
17311
+ continue;
17312
+ }
17313
+ }
17314
+ }
17136
17315
  }
17137
- if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == statuteColName) {
17138
- //console.log('colstate statute', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
17139
- colStatute = i;
17316
+ if (!flagMatch) {
17317
+ let objToPush = sourceMapping.data.mappings[i];
17318
+ for (i = 0; i < mandatoryFields.length; i++) {
17319
+ objToPush[mandatoryFields[i]] = "";
17320
+ }
17321
+ taggingArray.data.mappings.mappings.push(objToPush);
17140
17322
  }
17141
17323
  }
17142
- //var countExtra0 = 0;
17143
- var countextra = [];
17144
- var subfiltered = 0;
17145
- html += '<tbody>';
17146
- var mappedCount = 0;
17147
- for (let level = 0; level < 2; level++) {
17148
- for (var i = 0; i < jsonData.length; i++) {
17149
- // console.log('subfilter value before', subfiltered);
17150
- console.log('rendering', i, jsonData[i]);
17151
- let tempColCountry = -1;
17152
- let tempColState = -1;
17153
- let tempColStatute = -1;
17324
+ var tagged = 0;
17325
+ var changed = 0;
17326
+ var total = 0;
17327
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17328
+ if (taggingArray.data.mappings.mappings[j] != null) {
17329
+ if (sourceMapping.data == null) {
17330
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
17331
+ total++;
17332
+ let tagStr = "";
17333
+ for (let col of compareFields) {
17334
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`;
17335
+ }
17336
+ tagStr.slice(0, -1);
17337
+ if (this.changedOnboardingItemIds.length > 0) {
17338
+ let changedId = tagStr;
17339
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17340
+ changed++;
17341
+ }
17342
+ }
17343
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
17344
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
17345
+ let flagNull = false;
17346
+ for (let mandatoryfield of mandatoryFields) {
17347
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
17348
+ flagNull = true;
17349
+ break;
17350
+ }
17351
+ }
17352
+ if (flagNull) {
17353
+ continue;
17354
+ }
17355
+ }
17356
+ else {
17357
+ continue;
17358
+ }
17359
+ }
17360
+ tagged++;
17361
+ }
17362
+ }
17363
+ else {
17364
+ let flagFound = false;
17365
+ for (let sourceObj of sourceMapping.data.mappings) {
17366
+ if (sourceObj.id == taggingArray.data.mappings.mappings[j].id) {
17367
+ let flagEqual = true;
17368
+ for (let col of compareFields) {
17369
+ if (sourceObj[col] != taggingArray.data.mappings.mappings[j][col] && taggingArray.data.mappings.mappings[j][col] != null) {
17370
+ flagEqual = false;
17371
+ break;
17372
+ }
17373
+ }
17374
+ if (flagEqual) {
17375
+ flagFound = true;
17376
+ break;
17377
+ }
17378
+ }
17379
+ }
17380
+ if (flagFound) {
17381
+ let tagStr = "";
17382
+ for (let col of compareFields) {
17383
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`;
17384
+ }
17385
+ tagStr.slice(0, -1);
17386
+ total++;
17387
+ if (this.changedOnboardingItemIds.length > 0) {
17388
+ let changedId = tagStr;
17389
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17390
+ changed++;
17391
+ }
17392
+ }
17393
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
17394
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
17395
+ let flagNull = false;
17396
+ for (let mandatoryfield of mandatoryFields) {
17397
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
17398
+ flagNull = true;
17399
+ break;
17400
+ }
17401
+ }
17402
+ if (flagNull) {
17403
+ continue;
17404
+ }
17405
+ }
17406
+ else {
17407
+ continue;
17408
+ }
17409
+ }
17410
+ tagged++;
17411
+ }
17412
+ else {
17413
+ console.log('tagged not found', taggingArray.data.mappings.mappings[j]);
17414
+ }
17415
+ }
17416
+ }
17417
+ }
17418
+ console.log('taggingarray3', JSON.stringify(taggingArray.data.mappings.mappings));
17419
+ console.log('tagged', tagged, 'total', total);
17420
+ const unfilteredDict = [];
17421
+ if (divElement == null) {
17422
+ return;
17423
+ }
17424
+ var html = '';
17425
+ var showTable = true;
17426
+ html += '<div class="d-flex justify-between flex-wrap align-center"> ';
17427
+ var status = '';
17428
+ if (tagged < total) {
17429
+ status = '<span class="color-pending material-icons">pending</span>';
17430
+ }
17431
+ else {
17432
+ status = '<span class="color-done material-icons">check_circle</span>';
17433
+ }
17434
+ var mandatoryStatus = '';
17435
+ if (!mandatoryPresent) {
17436
+ mandatoryStatus = '<span class="color-late-executed material-icons">error</span>&nbsp;&nbsp;Mandatory fields are not present';
17437
+ }
17438
+ else {
17439
+ mandatoryStatus = '<span class="color-done material-icons">check_circle</span>&nbsp;&nbsp;Mandatory fields are present';
17440
+ }
17441
+ if (showTable) {
17442
+ 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>');
17443
+ }
17444
+ else {
17445
+ 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>');
17446
+ }
17447
+ if (changed > 0) {
17448
+ 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>');
17449
+ }
17450
+ 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>');
17451
+ 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>');
17452
+ html += '<div class="d-flex align-center">';
17453
+ html += '<div class="mr-10">';
17454
+ 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>';
17455
+ html += '<div style="position: absolute; margin-top: 5px;">';
17456
+ 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>';
17457
+ // console.log('jobs', jobs);
17458
+ 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>');
17459
+ html += '</div>';
17460
+ html += '</div>';
17461
+ 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>';
17462
+ 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>';
17463
+ html += '</div>';
17464
+ html += '</div>';
17465
+ html += '<div>';
17466
+ html += '<h4 id="span-filtered" part="results-title"></h4>';
17467
+ html += '<div id="div-subfiltered"></div>';
17468
+ html += '</div>';
17469
+ html += '<br />';
17470
+ var subfiltered = 0;
17471
+ if (showTable) {
17472
+ html += '<table id="table-data" class="mt-20" style="height: 200px">';
17473
+ html += '<thead>';
17474
+ html += '<th part="td-head" class="td-head">';
17475
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
17476
+ html += '</th>';
17477
+ for (var i = 0; i < extraFields.length; i++) {
17478
+ html += '<th part="td-head" class="td-head">';
17479
+ html += extraFields[i];
17480
+ html += '</th>';
17481
+ }
17482
+ html += '<th part="td-head" class="td-head">';
17483
+ html += colName;
17484
+ html += '</th>';
17485
+ for (i = 0; i < uniqCols.length; i++) {
17486
+ html += '<th part="td-head" class="td-head">';
17487
+ html += uniqCols[i];
17488
+ html += '</th>';
17489
+ }
17490
+ for (i = 0; i < sourceCols.length; i++) {
17491
+ html += '<th part="td-head" class="td-head">';
17492
+ html += sourceCols[i];
17493
+ html += '</th>';
17494
+ }
17495
+ html += '</thead>';
17496
+ html += '<tbody>';
17497
+ // console.log('changedIds', this.changedOnboardingItemIds);
17498
+ for (i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17499
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17500
+ console.log('compliance id', complianceid);
17501
+ var showSearch = false;
17502
+ if (subfilter == "") {
17503
+ //console.log('showsearch true 1');
17504
+ showSearch = true;
17505
+ }
17506
+ var classBg = "";
17507
+ if (i % 2 === 0) {
17508
+ if (this.changedOnboardingItemIds.length > 0) {
17509
+ let changedId = "";
17510
+ for (let [k, col] of uniqCols.entries()) {
17511
+ // console.log('taggingarray rendered', i, col)
17512
+ changedId += taggingArray.data.mappings.mappings[i][col];
17513
+ if (k < (uniqCols.length - 1)) {
17514
+ changedId += ";";
17515
+ }
17516
+ }
17517
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17518
+ classBg = 'td-light-selected';
17519
+ }
17520
+ else {
17521
+ classBg = 'td-light';
17522
+ }
17523
+ }
17524
+ else {
17525
+ classBg = 'td-light';
17526
+ }
17527
+ }
17528
+ else {
17529
+ if (this.changedOnboardingItemIds.length > 0) {
17530
+ let changedId = "";
17531
+ for (let [k, col] of uniqCols.entries()) {
17532
+ if (taggingArray.data.mappings.mappings[i] == null) {
17533
+ // console.log('id not found', i, taggingArray.data.mappings.mappings.length, sourceArray.data.mappings.mappings.length)
17534
+ }
17535
+ changedId += taggingArray.data.mappings.mappings[i][col];
17536
+ if (k < (uniqCols.length - 1)) {
17537
+ changedId += ";";
17538
+ }
17539
+ }
17540
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17541
+ classBg = 'td-dark-selected';
17542
+ }
17543
+ else {
17544
+ classBg = 'td-dark';
17545
+ }
17546
+ }
17547
+ else {
17548
+ classBg = 'td-dark';
17549
+ }
17550
+ }
17551
+ html += '<tr class="" id="tablerow-' + i + '">';
17552
+ 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>';
17553
+ for (var j = 0; j < extraFields.length; j++) {
17554
+ if (i < taggingArray.data.mappings.mappings.length) {
17555
+ html += '<td part="td-body" class="' + classBg + '">';
17556
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17557
+ 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>';
17558
+ html += '</div>';
17559
+ html += '</td>';
17560
+ }
17561
+ else {
17562
+ html += '<td part="td-body" class="' + classBg + '">';
17563
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17564
+ 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>';
17565
+ html += '</div>';
17566
+ html += '</td>';
17567
+ }
17568
+ }
17569
+ html += '<td class="td-body ' + classBg + '" part="td-key">';
17570
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17571
+ if (apiIdDropdown.length > 0) {
17572
+ if (anotherProjection != null) {
17573
+ 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>';
17574
+ }
17575
+ else {
17576
+ 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>';
17577
+ }
17578
+ }
17579
+ else {
17580
+ if (colName.toLowerCase() == "internalcontrols") {
17581
+ html += '<textarea id="tags-' + i + '" type="text" part="input" class="tags-input"></textarea>';
17582
+ }
17583
+ else {
17584
+ html += '<input id="tags-' + i + '" type="text" part="input" class="tags-input"/>';
17585
+ }
17586
+ }
17587
+ html += '</div>';
17588
+ html += '</td>';
17589
+ for (var l = 0; l < uniqCols.length; l++) {
17590
+ html += '<td class="td-body ' + classBg + '" part="td-key">';
17591
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17592
+ 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>';
17593
+ html += '</div>';
17594
+ html += '</td>';
17595
+ }
17596
+ for (l = 0; l < sourceCols.length; l++) {
17597
+ for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols).length; j++) {
17598
+ if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols)[j]) {
17599
+ if (sourceArray.data.mappings.mappings[complianceid].data != null) {
17600
+ html += '<td class="td-body ' + classBg + '" part="td-body">';
17601
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17602
+ if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
17603
+ for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j].length; k++) {
17604
+ 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>');
17605
+ }
17606
+ }
17607
+ else {
17608
+ if (typeof JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j] == "string" && Util.isJSONParsable(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
17609
+ 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>');
17610
+ }
17611
+ else {
17612
+ 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>');
17613
+ }
17614
+ }
17615
+ html += '</div>';
17616
+ html += '</td>';
17617
+ }
17618
+ }
17619
+ }
17620
+ }
17621
+ html += '</tr>';
17622
+ //console.log('i=', i);
17623
+ }
17624
+ html += '</tbody>';
17625
+ html += '</table>';
17626
+ }
17627
+ if (divElement == null) {
17628
+ return;
17629
+ }
17630
+ divElement.innerHTML = html;
17631
+ if (unfilteredDict.length > 0) {
17632
+ var html = '';
17633
+ html += '<div class="mb-10">Items In Your Category (' + unfilteredDict.length + ")</div>";
17634
+ html += this.getFilterOnboardingString();
17635
+ divElement.querySelector('#span-filtered').innerHTML = html;
17636
+ }
17637
+ else {
17638
+ divElement.querySelector('#span-filtered').style.display = 'none';
17639
+ }
17640
+ if (subfiltered > 0) {
17641
+ divElement.querySelector('#div-subfiltered').innerHTML = '<h4 part="results-title">Filtered Results (' + subfiltered + ')</h4>';
17642
+ }
17643
+ if (this.getfilterOnboarding().length > 0) {
17644
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17645
+ if (!unfilteredDict.includes(i)) {
17646
+ const tableRow = divElement.querySelector('#tablerow-' + i);
17647
+ if (tableRow != null) {
17648
+ tableRow.style.display = 'none';
17649
+ }
17650
+ }
17651
+ }
17652
+ }
17653
+ (_c = divElement.querySelector('.checkbox-all')) === null || _c === void 0 ? void 0 : _c.addEventListener('change', (e) => {
17654
+ divElement.querySelector('.button-save').disabled = false;
17655
+ const arrCheckBoxes = divElement.querySelectorAll('.checkbox-row');
17656
+ //console.log('cb-length', arrCheckBoxes.length);
17657
+ for (var i = 0; i < arrCheckBoxes.length; i++) {
17658
+ const tableRow = divElement.querySelector('#tablerow-' + (i));
17659
+ //console.log('tablerow', i, tableRow);
17660
+ if (tableRow != null) {
17661
+ if (tableRow.style.display != 'none') {
17662
+ //console.log('tablerow setting', e.currentTarget.checked, (arrCheckBoxes[i] as HTMLInputElement));
17663
+ arrCheckBoxes[i].checked = e.currentTarget.checked;
17664
+ if (e.currentTarget.checked) {
17665
+ if (!this.selectedCbs.includes(i + '')) {
17666
+ this.selectedCbs.push(i + '');
17667
+ }
17668
+ }
17669
+ else {
17670
+ this.selectedCbs = [];
17671
+ }
17672
+ }
17673
+ }
17674
+ }
17675
+ //console.log('checkedarr', this.selectedCbs);
17676
+ });
17677
+ for (var j = 0; j < extraFields.length; j++) {
17678
+ const inputArrJ = divElement.querySelectorAll('.extra-field-' + j);
17679
+ for (var k = 0; k < inputArrJ.length; k++) {
17680
+ inputArrJ[k].addEventListener('keyup', (e) => {
17681
+ divElement.querySelector('.button-save').disabled = false;
17682
+ if (e.key == "Enter") {
17683
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17684
+ const activeIndex = e.target.id.split('-')[2];
17685
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
17686
+ taggingArray.data.mappings.mappings[count].extraFields = [];
17687
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
17688
+ for (var l = 0; l < extraFields.length; l++) {
17689
+ const inputExtraField = divElement.querySelector('#extra-field-' + activeIndex + '-' + l);
17690
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17691
+ }
17692
+ }
17693
+ else {
17694
+ for (var l = 0; l < extraFields.length; l++) {
17695
+ const inputExtraField = divElement.querySelector('#extra-field-' + count + '-' + l);
17696
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17697
+ }
17698
+ }
17699
+ }
17700
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17701
+ }
17702
+ // this.saveTagging(taggingArray.data.mappings, uploadFunction, refreshFunction, true);
17703
+ });
17704
+ inputArrJ[k].addEventListener('focusout', (e) => {
17705
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17706
+ const activeIndex = e.target.id.split('-')[2];
17707
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
17708
+ taggingArray.data.mappings.mappings[count].extraFields = [];
17709
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
17710
+ for (var l = 0; l < extraFields.length; l++) {
17711
+ const inputExtraField = divElement.querySelector('#extra-field-' + activeIndex + '-' + l);
17712
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17713
+ }
17714
+ }
17715
+ else {
17716
+ for (var l = 0; l < extraFields.length; l++) {
17717
+ const inputExtraField = divElement.querySelector('#extra-field-' + count + '-' + l);
17718
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17719
+ }
17720
+ }
17721
+ }
17722
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17723
+ });
17724
+ }
17725
+ }
17726
+ const multiArr = divElement.querySelectorAll('.tags-input');
17727
+ for (var i = 0; i < multiArr.length; i++) {
17728
+ if (apiIdDropdown.length > 0) {
17729
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17730
+ var equal = true;
17731
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17732
+ for (var k = 0; k < uniqCols.length; k++) {
17733
+ if (uniqCols[k] != "id") {
17734
+ continue;
17735
+ }
17736
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
17737
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
17738
+ equal = false;
17739
+ }
17740
+ }
17741
+ }
17742
+ if (equal) {
17743
+ let preselctedVals = [];
17744
+ if ((colName == "countries" || colName == "entities" || colName == "locations") && taggingArray.data.mappings.mappings[i][colName] == null) {
17745
+ let preselctedValsStr = "";
17746
+ for (let mandatoryfield of mandatoryFields) {
17747
+ if (taggingArray.data.mappings.mappings[i][mandatoryfield] == null || taggingArray.data.mappings.mappings[i][mandatoryfield] == "") {
17748
+ preselctedValsStr = "";
17749
+ }
17750
+ else {
17751
+ preselctedValsStr += `${taggingArray.data.mappings.mappings[i][mandatoryfield]};`;
17752
+ }
17753
+ }
17754
+ preselctedValsStr = preselctedValsStr.slice(0, -1);
17755
+ if (preselctedValsStr.indexOf(';') >= 0) {
17756
+ preselctedVals.push(preselctedValsStr);
17757
+ }
17758
+ }
17759
+ else {
17760
+ preselctedVals = taggingArray.data.mappings.mappings[i][colName];
17761
+ }
17762
+ multiArr[i].preselectedValues = JSON.stringify(preselctedVals);
17763
+ if (preselctedVals.length > 0) {
17764
+ multiArr[i].parentElement.setAttribute("part", "row-mapped");
17765
+ }
17766
+ }
17767
+ // }
17768
+ multiArr[i].addEventListener('valueChanged', async (e) => {
17769
+ divElement.querySelector('.button-save').disabled = false;
17770
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17771
+ });
17772
+ }
17773
+ else {
17774
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17775
+ var equal = true;
17776
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17777
+ for (var k = 0; k < uniqCols.length; k++) {
17778
+ if (uniqCols[k] != "id") {
17779
+ continue;
17780
+ }
17781
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
17782
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
17783
+ equal = false;
17784
+ }
17785
+ }
17786
+ }
17787
+ if (equal) {
17788
+ if (taggingArray.data.mappings.mappings[i] != null) {
17789
+ if (Util.isJSONParsable(sourceArray.data.mappings.mappings[complianceid][colName])) {
17790
+ multiArr[i].value = JSON.parse(sourceArray.data.mappings.mappings[complianceid][colName])[0];
17791
+ }
17792
+ else {
17793
+ multiArr[i].value = (_f = sourceArray.data.mappings.mappings[complianceid][colName]) !== null && _f !== void 0 ? _f : "";
17794
+ }
17795
+ }
17796
+ }
17797
+ // }
17798
+ multiArr[i].addEventListener('keyup', async (e) => {
17799
+ if (e.key == "Enter") {
17800
+ divElement.querySelector('.button-save').disabled = false;
17801
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17802
+ }
17803
+ });
17804
+ multiArr[i].addEventListener('focusout', async (e) => {
17805
+ divElement.querySelector('.button-save').disabled = false;
17806
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17807
+ });
17808
+ }
17809
+ }
17810
+ const buttonApply = divElement.querySelector('.button-apply');
17811
+ buttonApply.addEventListener('click', () => {
17812
+ // console.log('applied');
17813
+ // this.applyAndReloadTagging(e,colName, taggingArray, sourceArray, divElement);
17814
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17815
+ });
17816
+ const buttonToggleMoreBack = divElement.querySelector('.button-toggle-more-back');
17817
+ const buttonToggleMore = divElement.querySelector('.button-toggle-more');
17818
+ buttonToggleMore.addEventListener('click', async (ev) => {
17819
+ ev.target.classList.add('hide');
17820
+ buttonToggleMoreBack.classList.remove('hide');
17821
+ const buttonDownloadBackups = divElement.querySelector('.button-download-backups');
17822
+ buttonDownloadBackups.style.display = 'flex';
17823
+ const buttonExportMapping = divElement.querySelector('.button-export-mapping');
17824
+ buttonExportMapping.style.display = 'flex';
17825
+ const buttonExportMappingCSV = divElement.querySelector('.button-export-mapping-csv');
17826
+ buttonExportMappingCSV.style.display = 'flex';
17827
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
17828
+ // buttonApply.style.display = 'flex';
17829
+ const buttonLoadLocal = divElement.querySelector('.button-local-load');
17830
+ buttonLoadLocal.style.display = 'flex';
17831
+ const buttonSaveLocal = divElement.querySelector('.button-local-save');
17832
+ buttonSaveLocal.style.display = 'flex';
17833
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
17834
+ // buttonSave.style.display = 'flex';
17835
+ const buttonDownloadBackupsNew = Util.clearListeners(buttonDownloadBackups);
17836
+ buttonDownloadBackupsNew.addEventListener('click', async () => {
17837
+ const result = await this.fetchGetStoredMapping(colName);
17838
+ for (var i = 0; i < result.data.length; i++) {
17839
+ const blob = new Blob([result.data[i].mappings != null ? JSON.stringify(result.data[i].mappings) : JSON.stringify(result.data[i])], { type: 'text/html' });
17840
+ const url = window.URL.createObjectURL(blob);
17841
+ const a = document.createElement('a');
17842
+ a.setAttribute('href', url);
17843
+ a.setAttribute('download', 'report_' + colName + '_' + i + '.json');
17844
+ a.click();
17845
+ }
17846
+ buttonToggleMoreBack.click();
17847
+ if (result.data.length === 0) {
17848
+ this.setError("No backups found!");
17849
+ setTimeout(() => {
17850
+ this.clearMessages();
17851
+ }, 3000);
17852
+ }
17853
+ });
17854
+ const buttonExportMappingNew = Util.clearListeners(buttonExportMapping);
17855
+ buttonExportMappingNew.addEventListener('click', async () => {
17856
+ let valueStr = [];
17857
+ for (var i = 0; i < multiArr.length; i++) {
17858
+ if (apiIdDropdown.length > 0) {
17859
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17860
+ var equal = true;
17861
+ let complianceid = taggingArray.data.mappings.mappings[j].id;
17862
+ for (var k = 0; k < uniqCols.length; k++) {
17863
+ if (uniqCols[k] != "id") {
17864
+ continue;
17865
+ }
17866
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[j] != null) {
17867
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[j][uniqCols[k]]) {
17868
+ equal = false;
17869
+ }
17870
+ }
17871
+ }
17872
+ if (equal) {
17873
+ valueStr.push(JSON.stringify(taggingArray.data.mappings.mappings[j][colName]));
17874
+ }
17875
+ }
17876
+ }
17877
+ else {
17878
+ if (taggingArray.data.mappings.mappings[i] != null) {
17879
+ valueStr.push(taggingArray.data.mappings.mappings[i][colName]);
17880
+ }
17881
+ else {
17882
+ valueStr.push('');
17883
+ }
17884
+ }
17885
+ }
17886
+ //console.log('valueStr', valueStr);
17887
+ const valuesHTML = JSON.stringify(valueStr);
17888
+ const outerHTML = '<h3>This extract is generated on ' + new Date() + '</h3>' + divElement.querySelector('#span-filtered').outerHTML + '<br /><h2>' + divElement.querySelector('#mapped-stats-title').outerHTML + '</h2>' + divElement.querySelector('#table-data').outerHTML;
17889
+ let tableHTML = this.TAGGING_HTML.replace(/TABLE_DATA/g, outerHTML);
17890
+ tableHTML = tableHTML.replace(/TABLE_VALUES/g, valuesHTML);
17891
+ const blob = new Blob([tableHTML], { type: 'text/html' });
17892
+ const url = window.URL.createObjectURL(blob);
17893
+ const a = document.createElement('a');
17894
+ a.setAttribute('href', url);
17895
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.html');
17896
+ a.click();
17897
+ });
17898
+ const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
17899
+ buttonExportMappingCSVNew === null || buttonExportMappingCSVNew === void 0 ? void 0 : buttonExportMappingCSVNew.addEventListener('click', async () => {
17900
+ let csvArray = JSON.parse(JSON.stringify(taggingArray.data.mappings.mappings));
17901
+ for (let [i, obj] of csvArray.entries()) {
17902
+ let tempCsvObj = obj;
17903
+ if (obj['cols'] != null && obj['data'] != null) {
17904
+ let dataArr = JSON.parse(obj['data']);
17905
+ let colsArr = JSON.parse(obj['cols']);
17906
+ for (let [j, colKey] of colsArr.entries()) {
17907
+ tempCsvObj['cols_' + colKey] = dataArr[j];
17908
+ }
17909
+ }
17910
+ csvArray[i] = tempCsvObj;
17911
+ }
17912
+ console.log('csv array', csvArray);
17913
+ let csvData = Util.convertToCSV(csvArray);
17914
+ // let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
17915
+ console.log('csvData', csvData);
17916
+ const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
17917
+ const url = window.URL.createObjectURL(blob);
17918
+ const a = document.createElement('a');
17919
+ a.setAttribute('href', url);
17920
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.csv');
17921
+ a.click();
17922
+ });
17923
+ const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
17924
+ buttonLoadLocalNew === null || buttonLoadLocalNew === void 0 ? void 0 : buttonLoadLocalNew.addEventListener('click', async () => {
17925
+ console.log('load-local');
17926
+ divElement.querySelector('#fileInput').click();
17927
+ });
17928
+ const fileInput = divElement.querySelector('#fileInput');
17929
+ fileInput.value = '';
17930
+ const fileInputNew = Util.clearListeners(fileInput);
17931
+ fileInputNew.addEventListener('change', (e) => {
17932
+ var fr = new FileReader();
17933
+ fr.onload = () => {
17934
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, JSON.parse(fr.result + ""), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17935
+ };
17936
+ var frCsv = new FileReader();
17937
+ frCsv.onload = () => {
17938
+ console.log('taggingarray onload called');
17939
+ console.log('csv result', frCsv.result);
17940
+ const tempArr = Util.parseCsv(frCsv.result + "");
17941
+ console.log('csv data', tempArr);
17942
+ let changeCount = 0;
17943
+ for (let [i, obj] of tempArr.entries()) {
17944
+ let tempObj = taggingArray.data.mappings.mappings[i];
17945
+ delete tempObj['delta'];
17946
+ delete tempObj['lastupdated'];
17947
+ let tempNewObj = obj;
17948
+ delete tempNewObj['delta'];
17949
+ delete tempNewObj['lastupdated'];
17950
+ if (JSON.stringify(tempObj) !== JSON.stringify(tempNewObj)) {
17951
+ // console.log('item changed', taggingArray.data.mappings.mappings[i], obj)
17952
+ let changedId = "";
17953
+ for (let [k, col] of uniqCols.entries()) {
17954
+ if (col != "id") {
17955
+ continue;
17956
+ }
17957
+ changedId += tempObj[col];
17958
+ if (k < (uniqCols.length - 1)) {
17959
+ changedId += ";";
17960
+ }
17961
+ }
17962
+ this.changedOnboardingItemIds.push(changedId);
17963
+ changeCount++;
17964
+ }
17965
+ }
17966
+ this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
17967
+ () => {
17968
+ this.clearMessages();
17969
+ this.changedOnboardingItemIds = [];
17970
+ buttonToggleMoreBack.click();
17971
+ },
17972
+ () => {
17973
+ this.clearMessages();
17974
+ let tempObj = {};
17975
+ tempObj["data"] = {};
17976
+ tempObj["data"]["mappings"] = {};
17977
+ tempObj["data"]["mappings"]["mappings"] = tempArr;
17978
+ let tempObjStr = JSON.stringify(tempObj);
17979
+ console.log('csv taggingarray cols', uniqCols, JSON.parse(tempObjStr)["data"]["mappings"]["mappings"].length, Object.keys(tempObj.data.mappings.mappings[0]));
17980
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceArray, sourceMapping, JSON.parse(tempObjStr), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17981
+ }
17982
+ ]);
17983
+ };
17984
+ if (e.target.files[0].name.toLowerCase().indexOf(colName.toLowerCase()) >= 0) {
17985
+ let ext = e.target.files[0].name.split('.')[e.target.files[0].name.split('.').length - 1];
17986
+ if (ext.toLowerCase() == "csv") {
17987
+ frCsv.readAsText(e.target.files[0]);
17988
+ }
17989
+ else {
17990
+ fr.readAsText(e.target.files[0]);
17991
+ }
17992
+ }
17993
+ });
17994
+ const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
17995
+ buttonSaveLocalNew === null || buttonSaveLocalNew === void 0 ? void 0 : buttonSaveLocalNew.addEventListener('click', async () => {
17996
+ console.log('save-local');
17997
+ const blob = new Blob([JSON.stringify(taggingArray)], { type: 'text/plain' });
17998
+ const url = window.URL.createObjectURL(blob);
17999
+ const a = document.createElement('a');
18000
+ a.setAttribute('href', url);
18001
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().toLocaleString() + '.txt');
18002
+ a.click();
18003
+ });
18004
+ });
18005
+ buttonToggleMoreBack.addEventListener('click', async (ev) => {
18006
+ ev.target.classList.add('hide');
18007
+ buttonToggleMore.classList.remove('hide');
18008
+ const buttonDownloadBackups = divElement.querySelector('.button-download-backups');
18009
+ buttonDownloadBackups.style.display = 'none';
18010
+ const buttonExportMapping = divElement.querySelector('.button-export-mapping');
18011
+ buttonExportMapping.style.display = 'none';
18012
+ const buttonExportMappingCSV = divElement.querySelector('.button-export-mapping-csv');
18013
+ buttonExportMappingCSV.style.display = 'none';
18014
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
18015
+ // buttonApply.style.display = 'none';
18016
+ const buttonLoadLocal = divElement.querySelector('.button-local-load');
18017
+ buttonLoadLocal.style.display = 'none';
18018
+ const buttonSaveLocal = divElement.querySelector('.button-local-save');
18019
+ buttonSaveLocal.style.display = 'none';
18020
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
18021
+ // buttonSave.style.display = 'none';
18022
+ });
18023
+ const buttonSave = divElement.querySelector('.button-save');
18024
+ buttonSave === null || buttonSave === void 0 ? void 0 : buttonSave.addEventListener('click', async () => {
18025
+ await this.saveTagging(taggingArray.data.mappings, selectedStatutes, uploadFunction, refreshFunction, false, colName);
18026
+ });
18027
+ const buttonCancel = divElement.querySelector('.button-cancel');
18028
+ buttonCancel === null || buttonCancel === void 0 ? void 0 : buttonCancel.addEventListener('click', async () => {
18029
+ //console.log('cancel clicked');
18030
+ await this.fetchCancelOnboardingJob(colName);
18031
+ refreshFunction();
18032
+ });
18033
+ const cbArr = divElement.querySelectorAll('.cb-select');
18034
+ for (i = 0; i < cbArr.length; i++) {
18035
+ cbArr[i].addEventListener('change', (ev) => {
18036
+ const cbSelectId = ev.currentTarget.id;
18037
+ const cbSelectIndex = cbSelectId.split('-')[1];
18038
+ if (!this.selectedCbs.includes(cbSelectIndex)) {
18039
+ this.selectedCbs.push(cbSelectIndex);
18040
+ }
18041
+ else {
18042
+ this.selectedCbs.splice(this.selectedCbs.indexOf(cbSelectIndex), 1);
18043
+ }
18044
+ //console.log(this.selectedCbs);
18045
+ });
18046
+ }
18047
+ this.changedOnboardingItemIds = [];
18048
+ };
18049
+ this.renderMappingTable = (divElement, jsonData, cursor, fetchFunction, searchString, mappedArray, found, uploadFunction, refreshFunction, extraFields, uploadBlock, extraFieldPosition, colName, subfilter, statuteColName, extraHintsArr, mappedStatutes = []) => {
18050
+ var _a, _b, _c, _f, _g, _h, _j;
18051
+ console.log('cols1', jsonData);
18052
+ // console.log('cols', jsonData[0].data.cols);
18053
+ //console.log('divelement', divElement);
18054
+ //console.log('jsonData', jsonData);
18055
+ //console.log('cursor', cursor);
18056
+ //console.log('fetch', fetchFunction);
18057
+ //console.log('searchstring', searchString);
18058
+ //console.log('subfiltervalue', subfilter);
18059
+ const arrCompliancesFrequencies = {};
18060
+ if (jsonData.length === 0)
18061
+ return;
18062
+ this.selectedCbs = [];
18063
+ let colCountry = -1;
18064
+ let colState = -1;
18065
+ let colSubcategory = -1;
18066
+ let colStatute = -1;
18067
+ const unfilteredDict = [];
18068
+ var html = '';
18069
+ html += '<div>';
18070
+ html += '<h3 part="results-title">Total Items (' + found + ')</h3>';
18071
+ html += '<h4 id="span-filtered" part="results-title"></h4>';
18072
+ html += '<h4 id="span-extra-filled" part="results-title"></h4>';
18073
+ html += '</div>';
18074
+ html += '<div class="d-flex justify-between align-center left-sticky flex-wrap mb-20">';
18075
+ html += '<div id="div-subfiltered"></div>';
18076
+ html += '<div id="scroll-overlay" part="onboarding-scroll-overlay" class="pos-fixed-scroll justify-center align-center">';
18077
+ html += '<div id="scroll-overlay-left" class="mr-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_left_alt</span></button></div>';
18078
+ html += '<div id="scroll-overlay-right" class="ml-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_right_alt</span></button></div>';
18079
+ html += '</div>';
18080
+ html += '<div id="detail-overlay" part="onboarding-detail-overlay" class="pos-fixed justify-center align-center hide">';
18081
+ html += '<div class="cover-slide"></div>';
18082
+ html += '<div class="detail-container p-10">';
18083
+ html += '<div class="d-flex justify-between align-center mb-20">';
18084
+ html += '<div part="results-title">Row Details</div>';
18085
+ html += '<button part="button-icon" class="detail-close"><span class="material-symbols-outlined">close</span></button>';
18086
+ html += '</div>';
18087
+ html += '<div id="detail-overlay-list">';
18088
+ html += '</div>';
18089
+ html += '</div>';
18090
+ html += '</div>';
18091
+ html += '<div class="d-flex align-center">';
18092
+ html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="' + subfilter + '" />';
18093
+ html += '<div class="mr-10">';
18094
+ 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>';
18095
+ 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>';
18096
+ html += '</div>';
18097
+ html += (this.disablesave == "yes" ? '' : '<button part="button" class="button-save" disabled>Save</button>');
18098
+ html += '</div>';
18099
+ html += '</div>';
18100
+ html += '<table id="table-data">';
18101
+ html += '<thead>';
18102
+ html += '<th part="td-head" class="td-head">';
18103
+ // html += 'Select';
18104
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
18105
+ html += '</th>';
18106
+ html += '<th part="td-head" class="td-head">';
18107
+ html += '<div>View</div>';
18108
+ html += '</th>';
18109
+ if (extraFieldPosition === 0) {
18110
+ for (var i = 0; i < extraFields.length; i++) {
18111
+ html += '<th part="td-head" class="td-head">';
18112
+ html += extraFields[i];
18113
+ html += '</th>';
18114
+ }
18115
+ }
18116
+ if (colName.toLowerCase() == "compliances") {
18117
+ html += '<th part="td-head" class="td-head">';
18118
+ html += 'Proposed Users';
18119
+ html += '</th>';
18120
+ }
18121
+ html += '<th part="td-head" class="td-head">';
18122
+ html += 'Id';
18123
+ html += '</th>';
18124
+ // for(var j = 0; j < JSON.parse(jsonData[0].data.cols).length; j++) {
18125
+ // if(jsonData[0].cols.includes(JSON.parse(jsonData[0].data.cols)[j])) {
18126
+ // html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == JSON.parse(jsonData[0].data.cols)[j].toLowerCase() ? 'left-sticky' : '') + '">'
18127
+ // html += JSON.parse(jsonData[0].data.cols)[j]
18128
+ // html += '</th>'
18129
+ // }
18130
+ // }
18131
+ for (var j = 0; j < jsonData[0].cols.length; j++) {
18132
+ console.log('jsoncols', JSON.parse(jsonData[0].data.cols), jsonData[0].cols.length, j);
18133
+ html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == ((_a = JSON.parse(jsonData[0].data.cols)[j]) !== null && _a !== void 0 ? _a : "").toLowerCase() ? 'left-sticky' : '') + '">';
18134
+ // html += jsonData[0].cols[j]
18135
+ html += '</th>';
18136
+ }
18137
+ if (extraFieldPosition === 1) {
18138
+ for (var i = 0; i < extraFields.length; i++) {
18139
+ html += '<th part="td-head" class="td-head">';
18140
+ html += extraFields[i];
18141
+ html += '</th>';
18142
+ }
18143
+ }
18144
+ html += '</thead>';
18145
+ //console.log('colstate', JSON.parse(jsonData[0].data.cols));
18146
+ for (var i = 0; i < JSON.parse(jsonData[0].data.cols).length; i++) {
18147
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "country") {
18148
+ console.log('colstate country', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18149
+ colCountry = i;
18150
+ }
18151
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "state") {
18152
+ //console.log('colstate state', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18153
+ colState = i;
18154
+ }
18155
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "subcategory") {
18156
+ //console.log('colstate subcategory', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18157
+ colSubcategory = i;
18158
+ }
18159
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == statuteColName) {
18160
+ //console.log('colstate statute', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18161
+ colStatute = i;
18162
+ }
18163
+ }
18164
+ //var countExtra0 = 0;
18165
+ var countextra = [];
18166
+ var subfiltered = 0;
18167
+ html += '<tbody>';
18168
+ var mappedCount = 0;
18169
+ for (let level = 0; level < 2; level++) {
18170
+ for (var i = 0; i < jsonData.length; i++) {
18171
+ // console.log('subfilter value before', subfiltered);
18172
+ console.log('rendering', i, jsonData[i]);
18173
+ let tempColCountry = -1;
18174
+ let tempColState = -1;
18175
+ let tempColStatute = -1;
17154
18176
  let tempColSubcategory = -1;
17155
18177
  if (JSON.parse(jsonData[0].data.cols)[0] == ('lastModifiedBy')) {
17156
18178
  if (JSON.parse(jsonData[i].data.cols)[0] != ('lastModifiedBy')) {
@@ -17637,7 +18659,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17637
18659
  //console.log(e.currentTarget, (e.currentTarget as HTMLInputElement).checked);
17638
18660
  divElement.querySelector('.button-save').disabled = false;
17639
18661
  if (extraFieldPosition === 1) {
17640
- await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true);
18662
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true, mappedStatutes);
17641
18663
  }
17642
18664
  });
17643
18665
  }
@@ -17705,7 +18727,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17705
18727
  }
17706
18728
  });
17707
18729
  (_j = this._SfButtonSave) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async () => {
17708
- await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, false);
18730
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, false, mappedStatutes);
17709
18731
  });
17710
18732
  // const arrExtraFields = (divElement as HTMLDivElement).querySelectorAll('.extra-field') as NodeListOf<SfIMultitextarea>;
17711
18733
  // var totalFields = 0;
@@ -18326,220 +19348,321 @@ let SfIEvents = class SfIEvents extends LitElement {
18326
19348
  });
18327
19349
  //this.refreshCalendar();
18328
19350
  };
18329
- this.renderOnboardingTriggers = (mappedTriggers, mappedSerializedAlertSchedules, triggersJobs) => {
18330
- var html = '';
18331
- html += '<div id="triggers-list-container" class="d-flex flex-col w-100 scroll-x">';
18332
- html += '</div>';
18333
- this._SfOnboardingTriggersContainer.innerHTML = html;
18334
- //console.log('rendering triggers...', (this._SfOnboardingTriggersContainer as HTMLDivElement).innerHTML);
18335
- this.renderTaggingTable(this._SfOnboardingTriggersListContainer, mappedSerializedAlertSchedules, mappedTriggers, ["shortid", "obligationtitle", "obligationtype"], this.uploadTriggersMapping, this.loadOnboardingTriggers, "triggers", ["id", "entityname", "locationname"], '', "", ["triggers"], triggersJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19351
+ this.renderOnboardingTriggers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedTriggers) => {
19352
+ this.renderTaggingTableNew(this._SfOnboardingTriggersListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedTriggers, ["shortid", "obligationtitle", "obligationtype"], this.uploadTriggersMapping, this.loadOnboardingTriggers, "triggers", ["id"], '', "", ["triggers"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18336
19353
  };
18337
- this.renderOnboardingInternalControls = (mappedInternalControls, mappedSerializedTriggers, internalcontrolsJobs) => {
18338
- var html = '';
18339
- html += '<div id="internalcontrols-list-container" class="d-flex flex-col w-100 scroll-x">';
18340
- html += '</div>';
18341
- this._SfOnboardingInternalControlsContainer.innerHTML = html;
18342
- this.renderTaggingTable(this._SfOnboardingInternalControlsListContainer, mappedSerializedTriggers, mappedInternalControls, ["shortid", "obligationtitle", "obligationtype"], this.uploadInternalControlsMapping, this.loadOnboardingInternalControls, "internalcontrols", ["id", "entityname", "locationname"], '', "", ["internalcontrols"], internalcontrolsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19354
+ this.renderOnboardingInternalControls = (selectedStatutes, mappedCompliances, mappedFunctions, mappedInternalControls) => {
19355
+ this.renderTaggingTableNew(this._SfOnboardingInternalControlsListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedInternalControls, ["shortid", "obligationtitle", "obligationtype"], this.uploadInternalControlsMapping, this.loadOnboardingInternalControls, "internalcontrols", ["id", "entityname", "locationname"], '', "", ["internalcontrols"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18343
19356
  };
18344
- this.renderOnboardingReportedLocations = (mappedReportedLocations, mappedSerializedTriggers, reportedlocationsJobs) => {
18345
- var html = '';
18346
- html += '<div id="reportedlocations-list-container" class="d-flex flex-col w-100 scroll-x">';
18347
- html += '</div>';
18348
- this._SfOnboardingReportedLocationsContainer.innerHTML = html;
18349
- this.renderTaggingTable(this._SfOnboardingReportedLocationsContainer, mappedSerializedTriggers, mappedReportedLocations, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportedLocationsMapping, this.loadOnboardingReportedLocations, "reportedlocations", ["id", "entityname", "locationname"], '', "", ["reportedlocations"], reportedlocationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19357
+ this.renderOnboardingReportedLocations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedReportedLocations) => {
19358
+ this.renderTaggingTableNew(this._SfOnboardingReportedLocationsListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedReportedLocations, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportedLocationsMapping, this.loadOnboardingReportedLocations, "reportedlocations", ["id", "entityname", "locationname"], '', "", ["reportedlocations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18350
19359
  };
18351
- this.renderOnboardingActivations = (mappedActivations, mappedSerializedExtensions, activationsJobs) => {
18352
- var html = '';
18353
- html += '<div id="activations-list-container" class="d-flex flex-col w-100 scroll-x">';
18354
- html += '</div>';
18355
- this._SfOnboardingActivationsContainer.innerHTML = html;
18356
- this.renderTaggingTable(this._SfOnboardingActivationListContainer, mappedSerializedExtensions, mappedActivations, ["shortid", "obligationtitle", "obligationtype"], this.uploadActivationsMapping, this.loadOnboardingActivations, "activations", ["id", "entityname", "locationname"], '', "", ["activations"], activationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19360
+ this.renderOnboardingActivations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedActivations) => {
19361
+ this.renderTaggingTableNew(this._SfOnboardingActivationListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedActivations, ["shortid", "obligationtitle", "obligationtype"], this.uploadActivationsMapping, this.loadOnboardingActivations, "activations", ["id", "entityname", "locationname"], '', "", ["activations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18357
19362
  };
18358
- this.renderOnboardingInvalidations = (mappedInvalidations, mappedSerializedExtensions, invalidationsJobs) => {
18359
- var html = '';
18360
- html += '<div id="invalidations-list-container" class="d-flex flex-col w-100 scroll-x">';
18361
- html += '</div>';
18362
- this._SfOnboardingInvalidationsContainer.innerHTML = html;
18363
- this.renderTaggingTable(this._SfOnboardingInvalidationListContainer, mappedSerializedExtensions, mappedInvalidations, ["shortid", "obligationtitle", "obligationtype"], this.uploadInvalidationsMapping, this.loadOnboardingInvalidations, "invalidations", ["id", "entityname", "locationname"], '', "", ["invalidations"], invalidationsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19363
+ this.renderOnboardingInvalidations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedInvalidations) => {
19364
+ this.renderTaggingTableNew(this._SfOnboardingInvalidationListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedInvalidations, ["shortid", "obligationtitle", "obligationtype"], this.uploadInvalidationsMapping, this.loadOnboardingInvalidations, "invalidations", ["id", "entityname", "locationname"], '', "", ["invalidations"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18364
19365
  };
18365
- this.renderOnboardingAlertSchedules = (mappedAlertSchedules, mappedSerializedExtensions, alertschedulesJobs) => {
18366
- var html = '';
18367
- html += '<div id="alertschedules-list-container" class="d-flex flex-col w-100 scroll-x">';
18368
- html += '</div>';
18369
- this._SfOnboardingAlertSchedulesContainer.innerHTML = html;
18370
- this.renderTaggingTable(this._SfOnboardingAlertSchedulesListContainer, mappedSerializedExtensions, mappedAlertSchedules, ["shortid", "obligationtitle", "obligationtype"], this.uploadAlertSchedulesMapping, this.loadOnboardingAlertSchedules, "alertschedules", ["id", "entityname", "locationname"], '', "", ["alertschedules"], alertschedulesJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19366
+ this.renderOnboardingAlertSchedules = (selectedStatutes, mappedCompliances, mappedFunctions, mappedAlertSchedules) => {
19367
+ this.renderTaggingTableNew(this._SfOnboardingAlertSchedulesListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedAlertSchedules, ["shortid", "obligationtitle", "obligationtype"], this.uploadAlertSchedulesMapping, this.loadOnboardingAlertSchedules, "alertschedules", ["id", "entityname", "locationname"], '', "", ["alertschedules"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18371
19368
  };
18372
- this.renderOnboardingExtensions = (mappedExtensions, mappedSerializedDuedates, extensionsJobs) => {
18373
- var html = '';
18374
- html += '<div id="extensions-list-container" class="d-flex flex-col w-100 scroll-x">';
18375
- html += '</div>';
18376
- this._SfOnboardingExtensionsContainer.innerHTML = html;
18377
- this.renderTaggingTable(this._SfOnboardingExtensionsListContainer, mappedSerializedDuedates, mappedExtensions, ["shortid", "obligationtitle", "obligationtype"], this.uploadExtensionsMapping, this.loadOnboardingExtensions, "extensions", ["id", "entityname", "locationname"], '', "", ["extensions"], extensionsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19369
+ this.renderOnboardingExtensions = (selectedStatutes, mappedCompliances, mappedFunctions, mappedExtensions) => {
19370
+ this.renderTaggingTableNew(this._SfOnboardingExtensionsListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedExtensions, ["shortid", "obligationtitle", "obligationtype"], this.uploadExtensionsMapping, this.loadOnboardingExtensions, "extensions", ["id", "entityname", "locationname"], '', "", ["extensions"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18378
19371
  };
18379
- this.renderOnboardingDuedates = (mappedDuedates, mappedSerializedMakerCheckers, duedatesJobs) => {
18380
- var html = '';
18381
- html += '<div id="duedates-list-container" class="d-flex flex-col w-100 scroll-x">';
18382
- html += '</div>';
18383
- this._SfOnboardingDuedatesContainer.innerHTML = html;
18384
- this.renderTaggingTable(this._SfOnboardingDuedatesListContainer, mappedSerializedMakerCheckers, mappedDuedates, ["shortid", "obligationtitle", "obligationtype"], this.uploadDuedatesMapping, this.loadOnboardingDuedates, "duedates", ["id", "entityname", "locationname"], '', "", ["duedates"], duedatesJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19372
+ this.renderOnboardingDuedates = (selectedStatutes, mappedCompliances, mappedFunctions, mappedDuedates) => {
19373
+ this.renderTaggingTableNew(this._SfOnboardingDuedatesListContainer, selectedStatutes, mappedCompliances, mappedFunctions, mappedDuedates, ["shortid", "obligationtitle", "obligationtype"], this.uploadDuedatesMapping, this.loadOnboardingDuedates, "duedates", ["id", "entityname", "locationname"], '', "", ["duedates"], ["id", "countryid", "entityid", "locationid"], null, [], null, "", "");
18385
19374
  };
18386
- this.renderOnboardingReporters = (mappedReporters, mappedSerializedTags, reportersJobs, _arrFeedbackReference) => {
18387
- var html = '';
18388
- html += '<div id="reporters-list-container" class="d-flex flex-col w-100 scroll-x">';
18389
- html += '</div>';
18390
- this._SfOnboardingReportersContainer.innerHTML = html;
18391
- this.renderTaggingTable(this._SfOnboardingReportersListContainer, mappedSerializedTags, mappedReporters, ["shortid", "obligationtitle", "obligationtype"], this.uploadReportersMapping, this.loadOnboardingReporters, "reporters", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["reporters"], reportersJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
19375
+ this.renderOnboardingReporters = (selectedStatutes, mappedCompliances, mappedFunctions, mappedReporters) => {
19376
+ this.renderTaggingTableNew(this._SfOnboardingReportersListContainer, 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", "");
18392
19377
  };
18393
- this.renderOnboardingApprovers = (mappedApprovers, mappedSerializedReporters, approversJobs, _arrFeedbackReference) => {
18394
- var html = '';
18395
- html += '<div id="approvers-list-container" class="d-flex flex-col w-100 scroll-x">';
18396
- html += '</div>';
18397
- this._SfOnboardingApproversContainer.innerHTML = html;
18398
- this.renderTaggingTable(this._SfOnboardingApproversListContainer, mappedSerializedReporters, mappedApprovers, ["shortid", "obligationtitle", "obligationtype"], this.uploadApproversMapping, this.loadOnboardingApprovers, "approvers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["approvers"], approversJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
19378
+ this.renderOnboardingApprovers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedApprovers) => {
19379
+ this.renderTaggingTableNew(this._SfOnboardingApproversListContainer, 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", "");
18399
19380
  };
18400
- this.renderOnboardingFunctionHeads = (mappedFunctionHeads, mappedSerializedApprovers, functionHeadsJobs, _arrFeedbackReference) => {
18401
- var html = '';
18402
- html += '<div id="functionheads-list-container" class="d-flex flex-col w-100 scroll-x">';
18403
- html += '</div>';
18404
- this._SfOnboardingFunctionHeadsContainer.innerHTML = html;
18405
- this.renderTaggingTable(this._SfOnboardingFunctionHeadsListContainer, mappedSerializedApprovers, mappedFunctionHeads, ["shortid", "obligationtitle", "obligationtype"], this.uploadFunctionHeadsMapping, this.loadOnboardingFunctionHeads, "functionheads", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["functionheads"], functionHeadsJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
19381
+ this.renderOnboardingFunctionHeads = (selectedStatutes, mappedCompliances, mappedFunctions, mappedFunctionHeads) => {
19382
+ this.renderTaggingTableNew(this._SfOnboardingFunctionHeadsListContainer, 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", "");
18406
19383
  };
18407
- this.renderOnboardingMakerCheckers = (mappedMakerCheckers, mappedSerializedDocs, makerCheckerJobs) => {
18408
- var html = '';
18409
- html += '<div id="makercheckers-list-container" class="d-flex flex-col w-100 scroll-x">';
18410
- html += '</div>';
18411
- this._SfOnboardingMakerCheckersContainer.innerHTML = html;
18412
- this.renderTaggingTable(this._SfOnboardingMakerCheckersListContainer, mappedSerializedDocs, mappedMakerCheckers, ["shortid", "obligationtitle", "obligationtype"], this.uploadMakerCheckersMapping, this.loadOnboardingMakerCheckers, "makercheckers", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["makercheckers"], makerCheckerJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19384
+ this.renderOnboardingMakerCheckers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedMakerCheckers) => {
19385
+ this.renderTaggingTableNew(this._SfOnboardingMakerCheckersListContainer, 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, "", "");
18413
19386
  };
18414
- this.renderOnboardingDocs = (mappedDocs, mappedSerializedViewers, docsJobs) => {
18415
- var html = '';
18416
- html += '<div id="docs-list-container" class="d-flex flex-col w-100 scroll-x">';
18417
- html += '</div>';
18418
- this._SfOnboardingDocsContainer.innerHTML = html;
18419
- this.renderTaggingTable(this._SfOnboardingDocsListContainer, mappedSerializedViewers, mappedDocs, ["shortid", "obligationtitle", "obligationtype"], this.uploadDocsMapping, this.loadOnboardingDocs, "docs", ["id", "entityname", "locationname"], this.apiIdTags, "&MakerChecker", ["docs"], docsJobs, null, ["Client remarks", "FlaggGRC response"], null, "", "");
19387
+ this.renderOnboardingDocs = (selectedStatutes, mappedCompliances, mappedFunctions, mappedDocs) => {
19388
+ this.renderTaggingTableNew(this._SfOnboardingDocsListContainer, 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, "", "");
18420
19389
  };
18421
- this.renderOnboardingAuditors = (mappedAuditors, mappedSerializedFunctionheads, auditorsJobs, _arrFeedbackReference) => {
18422
- //console.log('inside rendering auditors..');
18423
- var html = '';
18424
- html += '<div id="auditors-list-container" class="d-flex flex-col w-100 scroll-x">';
18425
- html += '</div>';
18426
- this._SfOnboardingAuditorsContainer.innerHTML = html;
18427
- this.renderTaggingTable(this._SfOnboardingAuditorsListContainer, mappedSerializedFunctionheads, mappedAuditors, ["shortid", "obligationtitle", "obligationtype"], this.uploadAuditorsMapping, this.loadOnboardingAuditors, "auditors", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["auditors"], auditorsJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
19390
+ this.renderOnboardingAuditors = (selectedStatutes, mappedCompliances, mappedFunctions, mappedAuditors) => {
19391
+ this.renderTaggingTableNew(this._SfOnboardingAuditorsListContainer, 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", "");
18428
19392
  };
18429
- this.renderOnboardingViewers = (mappedViewers, mappedSerializedAuditors, viewersJobs, _arrFeedbackReference) => {
18430
- //console.log('inside rendering viewers..');
18431
- var html = '';
18432
- html += '<div id="viewers-list-container" class="d-flex flex-col w-100 scroll-x">';
18433
- html += '</div>';
18434
- this._SfOnboardingViewersContainer.innerHTML = html;
18435
- this.renderTaggingTable(this._SfOnboardingViewersListContainer, mappedSerializedAuditors, mappedViewers, ["shortid", "obligationtitle", "obligationtype"], this.uploadViewersMapping, this.loadOnboardingViewers, "viewers", ["id", "entityname", "locationname"], this.apiIdUsers, "", ["viewers"], viewersJobs, null, ["Client remarks", "FlaggGRC response"], null, "Guidelines", "");
19393
+ this.renderOnboardingViewers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedViewers) => {
19394
+ this.renderTaggingTableNew(this._SfOnboardingViewersListContainer, 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", "");
18436
19395
  };
18437
- this.renderOnboardingTags = (mappedTags, mappedSerializedFunctions, tagsJobs) => {
18438
- var html = '';
18439
- html += '<div id="tags-list-container" class="d-flex flex-col w-100 scroll-x">';
18440
- html += '</div>';
18441
- this._SfOnboardingTagsContainer.innerHTML = html;
18442
- this.renderTaggingTable(this._SfOnboardingTagsListContainer, 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, "", "");
19396
+ this.renderOnboardingTags = (selectedStatutes, mappedCompliances, mappedFunctions, mappedTags) => {
19397
+ this.renderTaggingTableNew(this._SfOnboardingTagsListContainer, 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, "", "");
18443
19398
  };
18444
- this.renderOnboardingFunctions = (mappedFunctions, mappedSerializedLocations, functionsJobs) => {
19399
+ this.renderOnboardingFunctions = (selectedStatutes, mappedCompliances, mappedLocations, mappedFunctions) => {
19400
+ this.renderTaggingTableNew(this._SfOnboardingFunctionsListContainer, 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, "", "");
19401
+ };
19402
+ this.renderOnboardingLocations = (selectedStatutes, mappedCompliances, mappedEntities, mappedLocations) => {
19403
+ this.renderTaggingTableNew(this._SfOnboardingLocationsListContainer, 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, "", "");
19404
+ };
19405
+ this.renderOnboardingStatutesDropdownMapping = (container, mappedStatutes, selectedStatutes, fetchtaggingfunction, rendermappingfunction) => {
19406
+ console.log('rendering dropdown', mappedStatutes.length);
18445
19407
  var html = '';
18446
- html += '<div id="functions-list-container" class="d-flex flex-col w-100 scroll-x">';
19408
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19409
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
19410
+ html += '<label part="input-label">Select Statute</label>';
19411
+ html += '<sf-multiselect-search mode="edit" id="statute-select"></sf-multiselect-search>';
19412
+ html += '</div>';
19413
+ html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
19414
+ html += '</div>';
18447
19415
  html += '</div>';
18448
- for (var i = 0; i < mappedSerializedLocations.data.mappings.mappings.length; i++) {
18449
- if (mappedSerializedLocations.data.mappings.mappings[i].id == "33a0deab-e93e-41b7-831a-473f9ea3eea2") {
18450
- //console.log('mappedSerializedLocations', mappedSerializedLocations.data.mappings.mappings[i]);
19416
+ console.log('attaching html', html);
19417
+ container.innerHTML = html;
19418
+ let multiselectStatute = container.querySelector('#statute-select');
19419
+ multiselectStatute.listelements = mappedStatutes;
19420
+ let selectedStatutesObj = {};
19421
+ for (let statuteObj of selectedStatutes) {
19422
+ selectedStatutesObj[statuteObj.id] = true;
19423
+ }
19424
+ multiselectStatute.listselection = selectedStatutesObj;
19425
+ multiselectStatute.loadMode();
19426
+ multiselectStatute.addEventListener('valueChanged', async (e) => {
19427
+ let multiselect = e.currentTarget;
19428
+ console.log('selected statutes', multiselect.selectedValuesNames());
19429
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
19430
+ return;
18451
19431
  }
18452
- }
18453
- this._SfOnboardingFunctionsContainer.innerHTML = html;
18454
- this.renderTaggingTable(this._SfOnboardingFunctionsListContainer, 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, "", "");
19432
+ let selectedStatutes = [];
19433
+ const regex = /^\[.*?\] - /;
19434
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
19435
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
19436
+ }
19437
+ let mappedCompliances = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
19438
+ rendermappingfunction({ data: { mappings: { mappings: selectedStatutes } } }, mappedCompliances);
19439
+ });
18455
19440
  };
18456
- this.renderOnboardingLocations = (mappedLocations, mappedSerializedEntities, locationsJobs) => {
19441
+ this.renderOnboardingStatutesDropdownTagging = (container, listcontainerid, mappedStatutes, selectedStatutes, fetchcompliancesfunction, fetchsourcemapping, fetchtaggingfunction, rendertaggingfunction) => {
19442
+ console.log('rendering dropdown', mappedStatutes.length);
18457
19443
  var html = '';
18458
- html += '<div id="locations-list-container" class="d-flex flex-col w-100 scroll-x">';
19444
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19445
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
19446
+ html += '<label part="input-label">Select Statute</label>';
19447
+ html += '<sf-multiselect-search mode="edit" id="statute-select"></sf-multiselect-search>';
18459
19448
  html += '</div>';
18460
- this._SfOnboardingLocationsContainer.innerHTML = html;
18461
- this.renderTaggingTable(this._SfOnboardingLocationsListContainer, 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, "", "");
19449
+ html += '<div id="' + listcontainerid + '" class="d-flex flex-col w-100 scroll-x">';
19450
+ html += '</div>';
19451
+ html += '</div>';
19452
+ console.log('attaching html', html);
19453
+ container.innerHTML = html;
19454
+ let multiselectStatute = container.querySelector('#statute-select');
19455
+ multiselectStatute.listelements = mappedStatutes;
19456
+ let selectedStatutesObj = {};
19457
+ for (let statuteObj of selectedStatutes) {
19458
+ selectedStatutesObj[statuteObj.id] = true;
19459
+ }
19460
+ multiselectStatute.listselection = selectedStatutesObj;
19461
+ multiselectStatute.loadMode();
19462
+ multiselectStatute.addEventListener('valueChanged', async (e) => {
19463
+ let multiselect = e.currentTarget;
19464
+ console.log('selected statutes', multiselect.selectedValuesNames());
19465
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
19466
+ return;
19467
+ }
19468
+ let selectedStatutes = [];
19469
+ const regex = /^\[.*?\] - /;
19470
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
19471
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
19472
+ }
19473
+ let sourceMappingArray = await fetchsourcemapping(Object.keys(multiselect.selectedValuesNames()));
19474
+ let mappingArray = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
19475
+ let mappedCompliances = await fetchcompliancesfunction(Object.keys(multiselect.selectedValuesNames()));
19476
+ let mappedCompliancesArr = { data: { mappings: {} } };
19477
+ console.log('mapped compliances', mappedCompliances);
19478
+ for (let statuteObj of selectedStatutes) {
19479
+ for (let complianceid of Object.keys(mappedCompliances.data.mappings[statuteObj.id])) {
19480
+ let pushObj = mappedCompliances.data.mappings[statuteObj.id][complianceid];
19481
+ pushObj.id = complianceid;
19482
+ pushObj.statuteid = statuteObj.id;
19483
+ mappedCompliancesArr.data.mappings[complianceid] = pushObj;
19484
+ }
19485
+ }
19486
+ rendertaggingfunction(selectedStatutes, mappedCompliancesArr, sourceMappingArray, mappingArray);
19487
+ });
18462
19488
  };
18463
- this.renderOnboardingCompliances = (mappedStatutes, mappedCompliances) => {
19489
+ this.renderOnboardingCompliances = async (mappedStatutes, mappedCompliancesArr) => {
18464
19490
  //console.log('mappedcompliances', mappedCompliances);
18465
19491
  //console.log('mappedstatutes', mappedStatutes);
18466
19492
  var searchString = "";
19493
+ let mappedCompliances = { data: { mappings: { mappings: [] } } };
18467
19494
  for (var i = 0; i < mappedStatutes.data.mappings.mappings.length; i++) {
18468
19495
  if (mappedStatutes.data.mappings.mappings[i].selected) {
18469
- searchString += mappedStatutes.data.mappings.mappings[i].id + "|";
19496
+ let statuteid = mappedStatutes.data.mappings.mappings[i].id;
19497
+ if (mappedCompliancesArr.data.mappings[statuteid] != null) {
19498
+ for (let complianceid of Object.keys(mappedCompliancesArr.data.mappings[statuteid])) {
19499
+ let pushObj = mappedCompliancesArr.data.mappings[statuteid][complianceid];
19500
+ pushObj.id = complianceid;
19501
+ mappedCompliances.data.mappings.mappings.push(pushObj);
19502
+ }
19503
+ }
19504
+ searchString += statuteid + "|";
18470
19505
  }
18471
19506
  }
18472
19507
  searchString = searchString.slice(0, -1);
18473
19508
  //console.log('searchstring', searchString);
18474
19509
  var initCursor = "";
18475
- var html = '';
18476
- html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
18477
- html += '<div class="d-flex flex-col w-100">';
18478
- html += '<label part="input-label">Search Compliances</label>';
18479
- html += '<div class="d-flex">';
18480
- html += '<input part="input" type="text" class="w-100 input-search" placeholder="Use | to separate..." disabled/>';
18481
- html += '<button part="button-icon" class="ml-10 material-icons button-search">search</button>';
18482
- html += '</div>';
18483
- html += '</div>';
18484
- html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
18485
- html += '</div>';
18486
- html += '</div>';
18487
- this._SfOnboardingCompliancesContainer.innerHTML = html;
18488
- this._SfButtonSearch.addEventListener('click', async () => {
18489
- //console.log('clicked', mappedStatutes.data.mappings.mappings);
18490
- const searchString = this._SfInputSearch.value;
18491
- //console.log('searchstring', searchString);
18492
- if (searchString.length > 0) {
18493
- const arrSearchString = searchString.split('|');
18494
- const arrSearchStringProcessed = [];
18495
- arrSearchString.forEach((complianceId) => {
18496
- if (complianceId.length === 36) {
18497
- arrSearchStringProcessed.push(complianceId);
19510
+ // var html = '';
19511
+ // html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19512
+ // html += '<div class="d-flex flex-col w-100">';
19513
+ // html += '<label part="input-label">Search Compliances</label>';
19514
+ // html += '<div class="d-flex">';
19515
+ // html += '<input part="input" type="text" class="w-100 input-search" placeholder="Use | to separate..." disabled/>'
19516
+ // html += '<button part="button-icon" class="ml-10 material-icons button-search">search</button>'
19517
+ // html += '</div>';
19518
+ // html += '</div>';
19519
+ // html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
19520
+ // html += '</div>';
19521
+ // html += '</div>';
19522
+ // (this._SfOnboardingCompliancesContainer as HTMLDivElement).innerHTML = html;
19523
+ // (this._SfButtonSearch as HTMLButtonElement)?.addEventListener('click', async () => {
19524
+ // //console.log('clicked', mappedStatutes.data.mappings.mappings);
19525
+ // const searchString = (this._SfInputSearch as HTMLButtonElement).value;
19526
+ // //console.log('searchstring', searchString);
19527
+ // if (searchString.length > 0) {
19528
+ // const arrSearchString = searchString.split('|');
19529
+ // const arrSearchStringProcessed: any = [];
19530
+ // arrSearchString.forEach((complianceId: string) => {
19531
+ // if (complianceId.length === 36) {
19532
+ // arrSearchStringProcessed.push(complianceId);
19533
+ // }
19534
+ // });
19535
+ // var resultCompliances: any = {};
19536
+ // resultCompliances.values = [];
19537
+ // const chunkSize = 20;
19538
+ // for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
19539
+ // const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
19540
+ // console.log('chunk', chunk);
19541
+ // // do whatever
19542
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
19543
+ // console.log(tempResultCompliances)
19544
+ // resultCompliances.values.push(...tempResultCompliances.values);
19545
+ // //console.log(resultCompliances);
19546
+ // }
19547
+ // // var resultCompliances : any = {};
19548
+ // // resultCompliances.values = [];
19549
+ // // const chunkSize = 20;
19550
+ // // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
19551
+ // // const chunk = arrSearchString.slice(k, k + chunkSize);
19552
+ // // console.log('chunk', chunk);
19553
+ // // // do whatever
19554
+ // // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
19555
+ // // console.log(tempResultCompliances)
19556
+ // // resultCompliances.values.push(...tempResultCompliances.values);
19557
+ // // //console.log(resultCompliances);
19558
+ // // }
19559
+ // if (resultCompliances != null) {
19560
+ // const jsonData = [];
19561
+ // const arrCompliancesFrequencies: any = {};
19562
+ // for (var i = 0; i < resultCompliances.values.length; i++) {
19563
+ // if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
19564
+ // continue;
19565
+ // } else {
19566
+ // arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
19567
+ // }
19568
+ // var mapped = false;
19569
+ // var extraFields = null;
19570
+ // var previousExtraFields = null;
19571
+ // console.log('mappedcompliances', mappedCompliances)
19572
+ // for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
19573
+ // if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
19574
+ // if (mappedCompliances.data.mappings.mappings[j].selected) {
19575
+ // mapped = true;
19576
+ // }
19577
+ // extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
19578
+ // }
19579
+ // }
19580
+ // for (j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
19581
+ // // console.log('mappedStatutes.data.mappings.mappings[j]', mappedStatutes.data.mappings.mappings[j]);
19582
+ // if (Array.isArray(mappedStatutes.data.mappings.mappings[j].statutename)) {
19583
+ // // sometimes this error occurs
19584
+ // continue;
19585
+ // }
19586
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == JSON.parse(resultCompliances.values[i].fields.data[0])[6][0].trim()) {
19587
+ // // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
19588
+ // // console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
19589
+ // // }
19590
+ // previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields
19591
+ // }
19592
+ // }
19593
+ // 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 })
19594
+ // }
19595
+ // 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"]);
19596
+ // }
19597
+ // }
19598
+ // });
19599
+ //console.log('compliances searchstring', searchString);
19600
+ // if (searchString != "") {
19601
+ // (this._SfInputSearch as HTMLInputElement).value = searchString;
19602
+ // (this._SfButtonSearch as HTMLButtonElement).click();
19603
+ // }
19604
+ if (searchString.length > 0) {
19605
+ const arrSearchString = searchString.split('|');
19606
+ const arrSearchStringProcessed = [];
19607
+ arrSearchString.forEach((complianceId) => {
19608
+ if (complianceId.length === 36) {
19609
+ arrSearchStringProcessed.push(complianceId);
19610
+ }
19611
+ });
19612
+ var resultCompliances = {};
19613
+ resultCompliances.values = [];
19614
+ const chunkSize = 20;
19615
+ for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
19616
+ const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
19617
+ console.log('chunk', chunk);
19618
+ // do whatever
19619
+ const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
19620
+ console.log(tempResultCompliances);
19621
+ resultCompliances.values.push(...tempResultCompliances.values);
19622
+ //console.log(resultCompliances);
19623
+ }
19624
+ // var resultCompliances : any = {};
19625
+ // resultCompliances.values = [];
19626
+ // const chunkSize = 20;
19627
+ // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
19628
+ // const chunk = arrSearchString.slice(k, k + chunkSize);
19629
+ // console.log('chunk', chunk);
19630
+ // // do whatever
19631
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
19632
+ // console.log(tempResultCompliances)
19633
+ // resultCompliances.values.push(...tempResultCompliances.values);
19634
+ // //console.log(resultCompliances);
19635
+ // }
19636
+ if (resultCompliances != null) {
19637
+ const jsonData = [];
19638
+ const arrCompliancesFrequencies = {};
19639
+ for (var i = 0; i < resultCompliances.values.length; i++) {
19640
+ if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
19641
+ continue;
18498
19642
  }
18499
- });
18500
- var resultCompliances = {};
18501
- resultCompliances.values = [];
18502
- const chunkSize = 20;
18503
- for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
18504
- const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
18505
- console.log('chunk', chunk);
18506
- // do whatever
18507
- const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
18508
- console.log(tempResultCompliances);
18509
- resultCompliances.values.push(...tempResultCompliances.values);
18510
- //console.log(resultCompliances);
18511
- }
18512
- // var resultCompliances : any = {};
18513
- // resultCompliances.values = [];
18514
- // const chunkSize = 20;
18515
- // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
18516
- // const chunk = arrSearchString.slice(k, k + chunkSize);
18517
- // console.log('chunk', chunk);
18518
- // // do whatever
18519
- // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
18520
- // console.log(tempResultCompliances)
18521
- // resultCompliances.values.push(...tempResultCompliances.values);
18522
- // //console.log(resultCompliances);
18523
- // }
18524
- if (resultCompliances != null) {
18525
- const jsonData = [];
18526
- const arrCompliancesFrequencies = {};
18527
- for (var i = 0; i < resultCompliances.values.length; i++) {
18528
- if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
18529
- continue;
18530
- }
18531
- else {
18532
- arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
19643
+ else {
19644
+ arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
19645
+ }
19646
+ var mapped = false;
19647
+ var extraFields = null;
19648
+ var previousExtraFields = null;
19649
+ console.log('mappedcompliances', mappedCompliances);
19650
+ if (mappedCompliances.data.mappings.mappings == null) {
19651
+ for (var j = 0; j < Object.keys(mappedCompliances.data.mappings).length; j++) {
19652
+ let statuteKey = Object.keys(mappedCompliances.data.mappings)[j];
19653
+ for (var k = 0; k < Object.keys(mappedCompliances.data.mappings[statuteKey]).length; k++) {
19654
+ let complianceKey = Object.keys(mappedCompliances.data.mappings[statuteKey])[k];
19655
+ if (mappedCompliances.data.mappings[statuteKey][complianceKey].id == resultCompliances.values[i].id) {
19656
+ mapped = true;
19657
+ extraFields = mappedCompliances.data.mappings[statuteKey][complianceKey].extraFields;
19658
+ }
19659
+ }
18533
19660
  }
18534
- var mapped = false;
18535
- var extraFields = null;
18536
- var previousExtraFields = null;
18537
- console.log('mappedcompliances', mappedCompliances);
19661
+ }
19662
+ else {
18538
19663
  for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
18539
19664
  if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
18540
- if (mappedCompliances.data.mappings.mappings[j].selected) {
18541
- mapped = true;
18542
- }
19665
+ mapped = true;
18543
19666
  extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
18544
19667
  }
18545
19668
  }
@@ -18550,51 +19673,25 @@ let SfIEvents = class SfIEvents extends LitElement {
18550
19673
  continue;
18551
19674
  }
18552
19675
  if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == JSON.parse(resultCompliances.values[i].fields.data[0])[6][0].trim()) {
18553
- if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
18554
- //console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
18555
- }
19676
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
19677
+ // //console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
19678
+ // }
18556
19679
  previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields;
18557
19680
  }
18558
19681
  }
18559
- 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 });
18560
19682
  }
18561
- this.renderMappingTable(this._SfOnboardingCompliancesListContainer, 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"]);
19683
+ 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 });
18562
19684
  }
19685
+ this.renderMappingTable(this._SfOnboardingCompliancesListContainer, 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);
18563
19686
  }
18564
- });
18565
- //console.log('compliances searchstring', searchString);
18566
- if (searchString != "") {
18567
- this._SfInputSearch.value = searchString;
18568
- this._SfButtonSearch.click();
18569
19687
  }
18570
19688
  };
18571
- this.renderOnboardingEntities = (mappedEntities, mappedSerializedCountries, entitiesJobs, arrFeedbackReference) => {
18572
- var html = '';
18573
- html += '<div id="entities-list-container" class="d-flex flex-col w-100 scroll-x">';
18574
- html += '</div>';
18575
- this._SfOnboardingEntitiesContainer.innerHTML = html;
18576
- this.renderTaggingTable(this._SfOnboardingEntitiesListContainer, 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", "");
19689
+ this.renderOnboardingEntities = (selectedStatutes, mappedCompliances, mappedCountries, mappedEntities) => {
19690
+ this.renderTaggingTableNew(this._SfOnboardingEntitiesListContainer, 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", "");
18577
19691
  };
18578
- this.renderOnboardingCountries = (mappedCountries, mappedCompliances, countriesJobs) => {
18579
- var html = '';
18580
- html += '<div id="countries-list-container" class="d-flex flex-col w-100 scroll-x">';
18581
- html += '</div>';
18582
- this._SfOnboardingCountriesContainer.innerHTML = html;
18583
- const arr1 = [];
18584
- for (var i = 0; i < mappedCompliances.data.mappings.mappings.length; i++) {
18585
- if (mappedCompliances.data.mappings.mappings[i].selected) {
18586
- arr1.push(mappedCompliances.data.mappings.mappings[i]);
18587
- }
18588
- }
18589
- mappedCompliances.data.mappings.mappings = arr1;
18590
- // const arr2 = [];
18591
- // for(var i = 0; i < mappedCountries.data.mappings.mappings.length; i++) {
18592
- // if(mappedCountries.data.mappings.mappings[i].selected) {
18593
- // arr2.push(mappedCountries.data.mappings.mappings[i]);
18594
- // }
18595
- // }
18596
- // mappedCountries.data.mappings.mappings = arr2;
18597
- this.renderTaggingTable(this._SfOnboardingCountriesListContainer, 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, "", "");
19692
+ this.renderOnboardingCountries = (selectedStatutes, mappedCompliances, sourceMapping, mappedCountries) => {
19693
+ sourceMapping = {};
19694
+ this.renderTaggingTableNew(this._SfOnboardingCountriesListContainer, 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, "", "");
18598
19695
  };
18599
19696
  this.renderOnboardingStatutes = (mappedStatutes) => {
18600
19697
  var initCursor = "";
@@ -18631,9 +19728,9 @@ let SfIEvents = class SfIEvents extends LitElement {
18631
19728
  for (var j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
18632
19729
  if (mappedStatutes.data.mappings.mappings[j].id == resultStatutes.values[i].id) {
18633
19730
  //console.log('comparing',mappedStatutes.data.mappings.mappings[j].id,resultStatutes.values[i].id);
18634
- if (mappedStatutes.data.mappings.mappings[j].selected) {
18635
- mapped = true;
18636
- }
19731
+ // if (mappedStatutes.data.mappings.mappings[j].selected) {
19732
+ mapped = true;
19733
+ // }
18637
19734
  extraFields = mappedStatutes.data.mappings.mappings[j].extraFields;
18638
19735
  }
18639
19736
  }
@@ -18868,112 +19965,112 @@ let SfIEvents = class SfIEvents extends LitElement {
18868
19965
  this._SfOnboardingTabContainer.innerHTML = html;
18869
19966
  (_a = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-statutes')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', async () => {
18870
19967
  this.myOnboardingTab = this.TAB_STATUTES;
18871
- this.renderOnboardingTabs();
19968
+ await this.renderOnboardingTabs();
18872
19969
  await this.loadOnboardingStatutes();
18873
19970
  });
18874
19971
  (_b = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-compliances')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', async () => {
18875
19972
  this.myOnboardingTab = this.TAB_COMPLIANCES;
18876
- this.renderOnboardingTabs();
19973
+ await this.renderOnboardingTabs();
18877
19974
  this.loadOnboardingCompliances();
18878
19975
  });
18879
19976
  (_c = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-countries')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
18880
19977
  this.myOnboardingTab = this.TAB_COUNTRIES;
18881
- this.renderOnboardingTabs();
19978
+ await this.renderOnboardingTabs();
18882
19979
  this.loadOnboardingCountries();
18883
19980
  });
18884
19981
  (_f = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-entities')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
18885
19982
  this.myOnboardingTab = this.TAB_ENTITIES;
18886
- this.renderOnboardingTabs();
19983
+ await this.renderOnboardingTabs();
18887
19984
  this.loadOnboardingEntities();
18888
19985
  });
18889
19986
  (_g = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-locations')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async () => {
18890
19987
  this.myOnboardingTab = this.TAB_LOCATIONS;
18891
- this.renderOnboardingTabs();
19988
+ await this.renderOnboardingTabs();
18892
19989
  this.loadOnboardingLocations();
18893
19990
  });
18894
19991
  (_h = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-functions')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async () => {
18895
19992
  this.myOnboardingTab = this.TAB_FUNCTIONS;
18896
- this.renderOnboardingTabs();
19993
+ await this.renderOnboardingTabs();
18897
19994
  this.loadOnboardingFunctions();
18898
19995
  });
18899
19996
  (_j = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-tags')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async () => {
18900
19997
  this.myOnboardingTab = this.TAB_TAGS;
18901
- this.renderOnboardingTabs();
19998
+ await this.renderOnboardingTabs();
18902
19999
  this.loadOnboardingTags();
18903
20000
  });
18904
20001
  (_k = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-reporters')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', async () => {
18905
20002
  this.myOnboardingTab = this.TAB_REPORTERS;
18906
- this.renderOnboardingTabs();
20003
+ await this.renderOnboardingTabs();
18907
20004
  this.loadOnboardingReporters();
18908
20005
  });
18909
20006
  (_l = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-approvers')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', async () => {
18910
20007
  this.myOnboardingTab = this.TAB_APPROVERS;
18911
- this.renderOnboardingTabs();
20008
+ await this.renderOnboardingTabs();
18912
20009
  this.loadOnboardingApprovers();
18913
20010
  });
18914
20011
  (_m = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-functionheads')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', async () => {
18915
20012
  this.myOnboardingTab = this.TAB_FUNCTION_HEADS;
18916
- this.renderOnboardingTabs();
20013
+ await this.renderOnboardingTabs();
18917
20014
  this.loadOnboardingFunctionHeads();
18918
20015
  });
18919
20016
  (_o = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-auditors')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', async () => {
18920
20017
  this.myOnboardingTab = this.TAB_AUDITORS;
18921
- this.renderOnboardingTabs();
20018
+ await this.renderOnboardingTabs();
18922
20019
  this.loadOnboardingAuditors();
18923
20020
  });
18924
20021
  (_p = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-viewers')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', async () => {
18925
20022
  this.myOnboardingTab = this.TAB_VIEWERS;
18926
- this.renderOnboardingTabs();
20023
+ await this.renderOnboardingTabs();
18927
20024
  this.loadOnboardingViewers();
18928
20025
  });
18929
20026
  (_q = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-makercheckers')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', async () => {
18930
20027
  this.myOnboardingTab = this.TAB_MAKER_CHECKERS;
18931
- this.renderOnboardingTabs();
20028
+ await this.renderOnboardingTabs();
18932
20029
  this.loadOnboardingMakerCheckers();
18933
20030
  });
18934
20031
  (_r = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-docs')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', async () => {
18935
20032
  this.myOnboardingTab = this.TAB_DOCS;
18936
- this.renderOnboardingTabs();
20033
+ await this.renderOnboardingTabs();
18937
20034
  this.loadOnboardingDocs();
18938
20035
  });
18939
20036
  (_s = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-duedates')) === null || _s === void 0 ? void 0 : _s.addEventListener('click', async () => {
18940
20037
  this.myOnboardingTab = this.TAB_DUEDATES;
18941
- this.renderOnboardingTabs();
20038
+ await this.renderOnboardingTabs();
18942
20039
  this.loadOnboardingDuedates();
18943
20040
  });
18944
20041
  (_t = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-alertschedules')) === null || _t === void 0 ? void 0 : _t.addEventListener('click', async () => {
18945
20042
  this.myOnboardingTab = this.TAB_ALERTSCHEDULES;
18946
- this.renderOnboardingTabs();
20043
+ await this.renderOnboardingTabs();
18947
20044
  this.loadOnboardingAlertSchedules();
18948
20045
  });
18949
20046
  (_u = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-activations')) === null || _u === void 0 ? void 0 : _u.addEventListener('click', async () => {
18950
20047
  this.myOnboardingTab = this.TAB_ACTIVATIONS;
18951
- this.renderOnboardingTabs();
20048
+ await this.renderOnboardingTabs();
18952
20049
  this.loadOnboardingActivations();
18953
20050
  });
18954
20051
  (_v = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-invalidations')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', async () => {
18955
20052
  this.myOnboardingTab = this.TAB_INVALIDATION;
18956
- this.renderOnboardingTabs();
20053
+ await this.renderOnboardingTabs();
18957
20054
  this.loadOnboardingInvalidations();
18958
20055
  });
18959
20056
  (_w = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-triggers')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', async () => {
18960
20057
  this.myOnboardingTab = this.TAB_TRIGGERS;
18961
- this.renderOnboardingTabs();
20058
+ await this.renderOnboardingTabs();
18962
20059
  this.loadOnboardingTriggers();
18963
20060
  });
18964
20061
  (_x = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-extensions')) === null || _x === void 0 ? void 0 : _x.addEventListener('click', async () => {
18965
20062
  this.myOnboardingTab = this.TAB_EXTENSIONS;
18966
- this.renderOnboardingTabs();
20063
+ await this.renderOnboardingTabs();
18967
20064
  this.loadOnboardingExtensions();
18968
20065
  });
18969
20066
  (_y = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-internalcontrols')) === null || _y === void 0 ? void 0 : _y.addEventListener('click', async () => {
18970
20067
  this.myOnboardingTab = this.TAB_INTERNALCONTROLS;
18971
- this.renderOnboardingTabs();
20068
+ await this.renderOnboardingTabs();
18972
20069
  this.loadOnboardingInternalControls();
18973
20070
  });
18974
20071
  (_z = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-reportedlocations')) === null || _z === void 0 ? void 0 : _z.addEventListener('click', async () => {
18975
20072
  this.myOnboardingTab = this.TAB_REPORTEDLOCATIONS;
18976
- this.renderOnboardingTabs();
20073
+ await this.renderOnboardingTabs();
18977
20074
  this.loadOnboardingReportedLocations();
18978
20075
  });
18979
20076
  (_0 = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-signoff')) === null || _0 === void 0 ? void 0 : _0.addEventListener('click', async () => {
@@ -22346,65 +23443,65 @@ let SfIEvents = class SfIEvents extends LitElement {
22346
23443
  users: transformedUsers
22347
23444
  };
22348
23445
  };
22349
- this.uploadTriggersMapping = async (data) => {
22350
- await this.uploadOnboardingMapping(data, 'triggers');
23446
+ this.uploadTriggersMapping = async (data, statuteids) => {
23447
+ await this.uploadOnboardingMapping(data, 'triggers', statuteids);
22351
23448
  };
22352
- this.uploadInternalControlsMapping = async (data) => {
22353
- await this.uploadOnboardingMapping(data, 'internalcontrols');
23449
+ this.uploadInternalControlsMapping = async (data, statuteids) => {
23450
+ await this.uploadOnboardingMapping(data, 'internalcontrols', statuteids);
22354
23451
  };
22355
- this.uploadReportedLocationsMapping = async (data) => {
22356
- await this.uploadOnboardingMapping(data, 'reportedlocations');
23452
+ this.uploadReportedLocationsMapping = async (data, statuteids) => {
23453
+ await this.uploadOnboardingMapping(data, 'reportedlocations', statuteids);
22357
23454
  };
22358
- this.uploadAlertSchedulesMapping = async (data) => {
22359
- await this.uploadOnboardingMapping(data, 'alertschedules');
23455
+ this.uploadAlertSchedulesMapping = async (data, statuteids) => {
23456
+ await this.uploadOnboardingMapping(data, 'alertschedules', statuteids);
22360
23457
  };
22361
- this.uploadActivationsMapping = async (data) => {
22362
- await this.uploadOnboardingMapping(data, 'activations');
23458
+ this.uploadActivationsMapping = async (data, statuteids) => {
23459
+ await this.uploadOnboardingMapping(data, 'activations', statuteids);
22363
23460
  };
22364
- this.uploadInvalidationsMapping = async (data) => {
22365
- await this.uploadOnboardingMapping(data, 'invalidations');
23461
+ this.uploadInvalidationsMapping = async (data, statuteids) => {
23462
+ await this.uploadOnboardingMapping(data, 'invalidations', statuteids);
22366
23463
  };
22367
- this.uploadDuedatesMapping = async (data) => {
22368
- await this.uploadOnboardingMapping(data, 'duedates');
23464
+ this.uploadDuedatesMapping = async (data, statuteids) => {
23465
+ await this.uploadOnboardingMapping(data, 'duedates', statuteids);
22369
23466
  };
22370
- this.uploadExtensionsMapping = async (data) => {
22371
- await this.uploadOnboardingMapping(data, 'extensions');
23467
+ this.uploadExtensionsMapping = async (data, statuteids) => {
23468
+ await this.uploadOnboardingMapping(data, 'extensions', statuteids);
22372
23469
  };
22373
- this.uploadApproversMapping = async (data) => {
22374
- await this.uploadOnboardingMapping(data, 'approvers');
23470
+ this.uploadApproversMapping = async (data, statuteids) => {
23471
+ await this.uploadOnboardingMapping(data, 'approvers', statuteids);
22375
23472
  };
22376
- this.uploadFunctionHeadsMapping = async (data) => {
22377
- await this.uploadOnboardingMapping(data, 'functionheads');
23473
+ this.uploadFunctionHeadsMapping = async (data, statuteids) => {
23474
+ await this.uploadOnboardingMapping(data, 'functionheads', statuteids);
22378
23475
  };
22379
- this.uploadMakerCheckersMapping = async (data) => {
22380
- await this.uploadOnboardingMapping(data, 'makercheckers');
23476
+ this.uploadMakerCheckersMapping = async (data, statuteids) => {
23477
+ await this.uploadOnboardingMapping(data, 'makercheckers', statuteids);
22381
23478
  };
22382
- this.uploadDocsMapping = async (data) => {
22383
- await this.uploadOnboardingMapping(data, 'docs');
23479
+ this.uploadDocsMapping = async (data, statuteids) => {
23480
+ await this.uploadOnboardingMapping(data, 'docs', statuteids);
22384
23481
  };
22385
- this.uploadAuditorsMapping = async (data) => {
22386
- await this.uploadOnboardingMapping(data, 'auditors');
23482
+ this.uploadAuditorsMapping = async (data, statuteids) => {
23483
+ await this.uploadOnboardingMapping(data, 'auditors', statuteids);
22387
23484
  };
22388
- this.uploadViewersMapping = async (data) => {
22389
- await this.uploadOnboardingMapping(data, 'viewers');
23485
+ this.uploadViewersMapping = async (data, statuteids) => {
23486
+ await this.uploadOnboardingMapping(data, 'viewers', statuteids);
22390
23487
  };
22391
- this.uploadReportersMapping = async (data) => {
22392
- await this.uploadOnboardingMapping(data, 'reporters');
23488
+ this.uploadReportersMapping = async (data, statuteids) => {
23489
+ await this.uploadOnboardingMapping(data, 'reporters', statuteids);
22393
23490
  };
22394
- this.uploadTagsMapping = async (data) => {
22395
- await this.uploadOnboardingMapping(data, 'tags');
23491
+ this.uploadTagsMapping = async (data, statuteids) => {
23492
+ await this.uploadOnboardingMapping(data, 'tags', statuteids);
22396
23493
  };
22397
- this.uploadFunctionsMapping = async (data) => {
22398
- await this.uploadOnboardingMapping(data, 'functions');
23494
+ this.uploadFunctionsMapping = async (data, statuteids) => {
23495
+ await this.uploadOnboardingMapping(data, 'functions', statuteids);
22399
23496
  };
22400
- this.uploadLocationsMapping = async (data) => {
22401
- await this.uploadOnboardingMapping(data, 'locations');
23497
+ this.uploadLocationsMapping = async (data, statuteids) => {
23498
+ await this.uploadOnboardingMapping(data, 'locations', statuteids);
22402
23499
  };
22403
- this.uploadEntitiesMapping = async (data) => {
22404
- await this.uploadOnboardingMapping(data, 'entities');
23500
+ this.uploadEntitiesMapping = async (data, statuteids) => {
23501
+ await this.uploadOnboardingMapping(data, 'entities', statuteids);
22405
23502
  };
22406
- this.uploadCountriesMapping = async (data) => {
22407
- await this.uploadOnboardingMapping(data, 'countries');
23503
+ this.uploadCountriesMapping = async (data, statuteids) => {
23504
+ await this.uploadOnboardingMapping(data, 'countries', statuteids);
22408
23505
  };
22409
23506
  this.uploadMappedSuspense = async (data, year) => {
22410
23507
  //console.log('uploading..', data);
@@ -22434,9 +23531,9 @@ let SfIEvents = class SfIEvents extends LitElement {
22434
23531
  }, 2000);
22435
23532
  }
22436
23533
  };
22437
- this.uploadOnboardingMapping = async (data, onboardingstep) => {
23534
+ this.uploadOnboardingMapping = async (data, onboardingstep, statuteids) => {
22438
23535
  //console.log('uploading..', data);
22439
- let url = "https://" + this.apiId + "/updatemappedonboarding";
23536
+ let url = "https://" + this.apiId + "/updatemappedonboarding1";
22440
23537
  // const body = {
22441
23538
  // "projectid": this.projectId,
22442
23539
  // "data": JSON.stringify(data),
@@ -22445,7 +23542,8 @@ let SfIEvents = class SfIEvents extends LitElement {
22445
23542
  let body = {
22446
23543
  "projectid": this.projectId,
22447
23544
  "presigned": true,
22448
- "onboardingstep": onboardingstep
23545
+ "onboardingstep": onboardingstep,
23546
+ "statuteids": statuteids
22449
23547
  };
22450
23548
  let authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22451
23549
  let xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -22457,7 +23555,8 @@ let SfIEvents = class SfIEvents extends LitElement {
22457
23555
  body = {
22458
23556
  "projectid": this.projectId,
22459
23557
  "key": jsonRespose.key,
22460
- "onboardingstep": onboardingstep
23558
+ "onboardingstep": onboardingstep,
23559
+ "statuteids": statuteids
22461
23560
  };
22462
23561
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22463
23562
  xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -22481,9 +23580,13 @@ let SfIEvents = class SfIEvents extends LitElement {
22481
23580
  if (xhr.status == 200) {
22482
23581
  }
22483
23582
  };
22484
- this.uploadCompliancesMapping = async (data) => {
22485
- //console.log('uploading..', data);
22486
- let url = "https://" + this.apiId + "/updatemappedcompliances";
23583
+ this.uploadCompliancesMapping = async (data, mappedstatutes) => {
23584
+ console.log('uploading..', data, mappedstatutes);
23585
+ let url = "https://" + this.apiId + "/updatemappedcompliances1";
23586
+ let statuteids = [];
23587
+ for (let statuteObj of mappedstatutes) {
23588
+ statuteids.push(statuteObj.id);
23589
+ }
22487
23590
  let body = {
22488
23591
  "projectid": this.projectId,
22489
23592
  "presigned": true,
@@ -22497,6 +23600,7 @@ let SfIEvents = class SfIEvents extends LitElement {
22497
23600
  await this.uploadToPresignedUrl(data, jsonRespose.signedUrl);
22498
23601
  body = {
22499
23602
  "projectid": this.projectId,
23603
+ "statuteids": statuteids,
22500
23604
  "key": jsonRespose.key
22501
23605
  };
22502
23606
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -22516,22 +23620,30 @@ let SfIEvents = class SfIEvents extends LitElement {
22516
23620
  }
22517
23621
  };
22518
23622
  this.uploadStatutesMapping = async (data) => {
22519
- //console.log('uploading..', data);
22520
- let url = "https://" + this.apiId + "/updatemappedstatutes";
22521
- var searchstring = '';
22522
- for (var i = 0; i < data.mappings.length; i++) {
22523
- const dataItem = JSON.parse(data.mappings[i].data);
22524
- // //console.log(dataItem[3])
22525
- searchstring += dataItem[3];
22526
- if (i < (data.mappings.length - 1)) {
22527
- searchstring += '|';
22528
- }
22529
- }
22530
- // const body = {
23623
+ // console.log('uploading..', data);
23624
+ let url = "https://" + this.apiId + "/updatemappedstatutes1";
23625
+ // var searchstring = '';
23626
+ // for (var i = 0; i < data.mappings.length; i++) {
23627
+ // // const dataItem = JSON.parse(data.mappings[i].data);
23628
+ // const dataId = data.mappings[i].id;
23629
+ // // console.log(dataItem[3])
23630
+ // if (data.mappings[i].selected == true) {
23631
+ // searchstring += dataId;
23632
+ // // if (i < (data.mappings.length - 1)) {
23633
+ // searchstring += '|';
23634
+ // // }
23635
+ // }
23636
+ // }
23637
+ // if(searchstring.length > 0){
23638
+ // searchstring = searchstring.slice(0, -1);
23639
+ // }
23640
+ // const bodyUpload = {
22531
23641
  // "projectid": this.projectId,
22532
- // "data": JSON.stringify(data),
23642
+ // // "data": JSON.stringify(data),
22533
23643
  // "compliancessearchstring": searchstring
22534
23644
  // }
23645
+ // console.log("upload body", bodyUpload)
23646
+ // return;
22535
23647
  let body = {
22536
23648
  "projectid": this.projectId,
22537
23649
  "presigned": true,
@@ -22545,7 +23657,6 @@ let SfIEvents = class SfIEvents extends LitElement {
22545
23657
  body = {
22546
23658
  "projectid": this.projectId,
22547
23659
  "key": jsonRespose.key,
22548
- "compliancessearchstring": searchstring
22549
23660
  };
22550
23661
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22551
23662
  xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -23592,10 +24703,10 @@ let SfIEvents = class SfIEvents extends LitElement {
23592
24703
  this.setError(jsonRespose.error);
23593
24704
  }
23594
24705
  };
23595
- this.fetchMappedCompliances = async () => {
23596
- let url = "https://" + this.apiId + "/getmappedcompliances";
24706
+ this.fetchMappedCompliances = async (statuteids = []) => {
24707
+ let url = "https://" + this.apiId + "/getmappedcompliances1";
23597
24708
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23598
- const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
24709
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "statuteids": statuteids }, url, this._SfLoader, authorization));
23599
24710
  this._SfLoader.innerHTML = '';
23600
24711
  if (xhr.status == 200) {
23601
24712
  var jsRespose = JSON.parse(xhr.responseText);
@@ -23710,7 +24821,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23710
24821
  }
23711
24822
  };
23712
24823
  this.fetchSerializedMapping = async (onboardingstep) => {
23713
- const url = "https://" + this.apiId + "/getmappedserializedonboarding";
24824
+ const url = "https://" + this.apiId + "/getmappedserializedonboarding1";
23714
24825
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23715
24826
  const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization));
23716
24827
  this._SfLoader.innerHTML = '';
@@ -23789,70 +24900,71 @@ let SfIEvents = class SfIEvents extends LitElement {
23789
24900
  // return (await this.fetchSerializedPartByPart("https://"+this.apiId+"/getmappedserializedcountries"));
23790
24901
  return (await this.fetchSerializedMapping("countries"));
23791
24902
  };
23792
- this.fetchMappedTriggers = async () => {
23793
- return (await this.fetchMappedOnboarding('triggers'));
24903
+ this.fetchMappedTriggers = async (statuteids = []) => {
24904
+ return (await this.fetchMappedOnboarding('triggers', statuteids));
23794
24905
  };
23795
- this.fetchMappedInternalControls = async () => {
23796
- return (await this.fetchMappedOnboarding('internalcontrols'));
24906
+ this.fetchMappedInternalControls = async (statuteids = []) => {
24907
+ return (await this.fetchMappedOnboarding('internalcontrols', statuteids));
23797
24908
  };
23798
- this.fetchMappedReportedLocations = async () => {
23799
- return (await this.fetchMappedOnboarding('reportedlocations'));
24909
+ this.fetchMappedReportedLocations = async (statuteids = []) => {
24910
+ return (await this.fetchMappedOnboarding('reportedlocations', statuteids));
23800
24911
  };
23801
- this.fetchMappedAlertSchedules = async () => {
23802
- return (await this.fetchMappedOnboarding('alertschedules'));
24912
+ this.fetchMappedAlertSchedules = async (statuteids = []) => {
24913
+ return (await this.fetchMappedOnboarding('alertschedules', statuteids));
23803
24914
  };
23804
- this.fetchMappedActivations = async () => {
23805
- return (await this.fetchMappedOnboarding('activations'));
24915
+ this.fetchMappedActivations = async (statuteids = []) => {
24916
+ return (await this.fetchMappedOnboarding('activations', statuteids));
23806
24917
  };
23807
- this.fetchMappedInvalidations = async () => {
23808
- return (await this.fetchMappedOnboarding('invalidations'));
24918
+ this.fetchMappedInvalidations = async (statuteids = []) => {
24919
+ return (await this.fetchMappedOnboarding('invalidations', statuteids));
23809
24920
  };
23810
- this.fetchMappedExtensions = async () => {
23811
- return (await this.fetchMappedOnboarding('extensions'));
24921
+ this.fetchMappedExtensions = async (statuteids = []) => {
24922
+ return (await this.fetchMappedOnboarding('extensions', statuteids));
23812
24923
  };
23813
- this.fetchMappedDuedates = async () => {
23814
- return (await this.fetchMappedOnboarding('duedates'));
24924
+ this.fetchMappedDuedates = async (statuteids = []) => {
24925
+ return (await this.fetchMappedOnboarding('duedates', statuteids));
23815
24926
  };
23816
- this.fetchMappedReporters = async () => {
23817
- return (await this.fetchMappedOnboarding('reporters'));
24927
+ this.fetchMappedReporters = async (statuteids = []) => {
24928
+ return (await this.fetchMappedOnboarding('reporters', statuteids));
23818
24929
  };
23819
- this.fetchMappedApprovers = async () => {
23820
- return (await this.fetchMappedOnboarding('approvers'));
24930
+ this.fetchMappedApprovers = async (statuteids = []) => {
24931
+ return (await this.fetchMappedOnboarding('approvers', statuteids));
23821
24932
  };
23822
- this.fetchMappedFunctionHeads = async () => {
23823
- return (await this.fetchMappedOnboarding('functionheads'));
24933
+ this.fetchMappedFunctionHeads = async (statuteids = []) => {
24934
+ return (await this.fetchMappedOnboarding('functionheads', statuteids));
23824
24935
  };
23825
- this.fetchMappedMakerCheckers = async () => {
23826
- return (await this.fetchMappedOnboarding('makercheckers'));
24936
+ this.fetchMappedMakerCheckers = async (statuteids = []) => {
24937
+ return (await this.fetchMappedOnboarding('makercheckers', statuteids));
23827
24938
  };
23828
- this.fetchMappedDocs = async () => {
23829
- return (await this.fetchMappedOnboarding('docs'));
24939
+ this.fetchMappedDocs = async (statuteids = []) => {
24940
+ return (await this.fetchMappedOnboarding('docs', statuteids));
23830
24941
  };
23831
- this.fetchMappedAuditors = async () => {
23832
- return (await this.fetchMappedOnboarding('auditors'));
24942
+ this.fetchMappedAuditors = async (statuteids = []) => {
24943
+ return (await this.fetchMappedOnboarding('auditors', statuteids));
23833
24944
  };
23834
- this.fetchMappedViewers = async () => {
23835
- return (await this.fetchMappedOnboarding('viewers'));
24945
+ this.fetchMappedViewers = async (statuteids = []) => {
24946
+ return (await this.fetchMappedOnboarding('viewers', statuteids));
23836
24947
  };
23837
- this.fetchMappedTags = async () => {
23838
- return (await this.fetchMappedOnboarding('tags'));
24948
+ this.fetchMappedTags = async (statuteids = []) => {
24949
+ return (await this.fetchMappedOnboarding('tags', statuteids));
23839
24950
  };
23840
- this.fetchMappedLocations = async () => {
23841
- return (await this.fetchMappedOnboarding('locations'));
24951
+ this.fetchMappedLocations = async (statuteids = []) => {
24952
+ return (await this.fetchMappedOnboarding('locations', statuteids));
23842
24953
  };
23843
- this.fetchMappedFunctions = async () => {
23844
- return (await this.fetchMappedOnboarding('functions'));
24954
+ this.fetchMappedFunctions = async (statuteids = []) => {
24955
+ return (await this.fetchMappedOnboarding('functions', statuteids));
23845
24956
  };
23846
- this.fetchMappedEntities = async () => {
23847
- return (await this.fetchMappedOnboarding('entities'));
24957
+ this.fetchMappedEntities = async (statuteids = []) => {
24958
+ return (await this.fetchMappedOnboarding('entities', statuteids));
23848
24959
  };
23849
- this.fetchMappedCountries = async () => {
23850
- return (await this.fetchMappedOnboarding('countries'));
24960
+ this.fetchMappedCountries = async (statuteids = []) => {
24961
+ return (await this.fetchMappedOnboarding('countries', statuteids));
23851
24962
  };
23852
- this.fetchMappedOnboarding = async (onboardingstep) => {
23853
- const url = "https://" + this.apiId + "/getmappedonboarding";
24963
+ this.fetchMappedOnboarding = async (onboardingstep, statuteids) => {
24964
+ var _a;
24965
+ const url = "https://" + this.apiId + "/getmappedonboarding1";
23854
24966
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23855
- const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization));
24967
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep, "statuteids": statuteids }, url, this._SfLoader, authorization));
23856
24968
  this._SfLoader.innerHTML = '';
23857
24969
  if (xhr.status == 200) {
23858
24970
  var jsRespose = JSON.parse(xhr.responseText);
@@ -23860,7 +24972,17 @@ let SfIEvents = class SfIEvents extends LitElement {
23860
24972
  resultPresigned = {};
23861
24973
  resultPresigned.data = {};
23862
24974
  let tempObj = await this.fetchPresignedUrl(jsRespose.signedUrlGet);
23863
- resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
24975
+ let tempArr = [];
24976
+ for (let statuteid of statuteids) {
24977
+ for (let foundObjId of Object.keys((_a = tempObj[statuteid]) !== null && _a !== void 0 ? _a : [])) {
24978
+ let tempPushObj = tempObj[statuteid][foundObjId];
24979
+ tempPushObj.id = foundObjId.split(';')[foundObjId.split(';').length - 1];
24980
+ tempPushObj.statuteid = statuteid;
24981
+ tempArr.push(tempPushObj);
24982
+ }
24983
+ }
24984
+ // resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
24985
+ resultPresigned.data.mappings = tempArr;
23864
24986
  console.log('resultPresigned onboarding1', tempObj);
23865
24987
  console.log('resultPresigned onboarding', resultPresigned);
23866
24988
  // await this.fetchPresignedUrlDelete(jsRespose.signedUrlDelete)
@@ -23895,7 +25017,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23895
25017
  }
23896
25018
  };
23897
25019
  this.fetchMappedStatutes = async () => {
23898
- let url = "https://" + this.apiId + "/getmappedstatutes";
25020
+ let url = "https://" + this.apiId + "/getmappedstatutes1";
23899
25021
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23900
25022
  const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
23901
25023
  this._SfLoader.innerHTML = '';
@@ -23913,6 +25035,25 @@ let SfIEvents = class SfIEvents extends LitElement {
23913
25035
  this.setError(jsonRespose.error);
23914
25036
  }
23915
25037
  };
25038
+ this.fetchMappedStatutesList = async () => {
25039
+ let url = "https://" + this.apiId + "/getmappedstatuteslist";
25040
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25041
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
25042
+ this._SfLoader.innerHTML = '';
25043
+ if (xhr.status == 200) {
25044
+ const jsonRespose = JSON.parse(xhr.responseText);
25045
+ //console.log(jsonRespose);
25046
+ return jsonRespose.data;
25047
+ }
25048
+ else {
25049
+ if (xhr.status == 401) {
25050
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
25051
+ this.dispatchEvent(changeEvent);
25052
+ }
25053
+ const jsonRespose = JSON.parse(xhr.responseText);
25054
+ this.setError(jsonRespose.error);
25055
+ }
25056
+ };
23916
25057
  this.fetchCreateRcmJob = async (complianceid, data, triggerDate, triggerMessage, projects) => {
23917
25058
  data.trigger = {};
23918
25059
  data.trigger.date = triggerDate;
@@ -28655,6 +29796,9 @@ __decorate([
28655
29796
  __decorate([
28656
29797
  query('#internalcontrols-container')
28657
29798
  ], SfIEvents.prototype, "_SfOnboardingInternalControlsContainer", void 0);
29799
+ __decorate([
29800
+ query('#reportedlocations-list-container')
29801
+ ], SfIEvents.prototype, "_SfOnboardingReportedLocationsListContainer", void 0);
28658
29802
  __decorate([
28659
29803
  query('#reportedlocations-container')
28660
29804
  ], SfIEvents.prototype, "_SfOnboardingReportedLocationsContainer", void 0);