sf-i-events 1.0.977 → 1.0.979

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,146 +17204,958 @@ 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>';
17222
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17223
+ if (taggingArray.data.mappings.mappings[i].id != null && sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[i].id] == null) {
17224
+ taggingArray.data.mappings.mappings.splice(i, 1);
17092
17225
  }
17093
17226
  }
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>'
17107
- // }
17108
- // }
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>';
17114
- }
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>';
17227
+ let mandatoryPresent = true;
17228
+ console.log('mandatoryFields', mandatoryFields);
17229
+ for (i = 0; i < mandatoryFields.length; i++) {
17230
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17231
+ if (taggingArray.data.mappings.mappings[j][mandatoryFields[i]] == null) {
17232
+ console.log('mandatory not found', mandatoryFields[i]);
17233
+ mandatoryPresent = false;
17234
+ }
17120
17235
  }
17121
17236
  }
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;
17237
+ var taggedIds = [];
17238
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17239
+ if (taggingArray.data.mappings.mappings[j] != null) {
17240
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
17241
+ if (taggedIds.indexOf(taggingArray.data.mappings.mappings[j].id) < 0) {
17242
+ taggedIds.push(taggingArray.data.mappings.mappings[j].id);
17243
+ }
17244
+ }
17128
17245
  }
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;
17246
+ }
17247
+ if (sourceMapping.data == null) {
17248
+ sourceMapping = { data: { mappings: Object.values(sourceArray.data.mappings.mappings) } };
17249
+ }
17250
+ for (var i = 0; i < ((_b = (_a = sourceMapping.data) === null || _a === void 0 ? void 0 : _a.mappings) !== null && _b !== void 0 ? _b : []).length; i++) {
17251
+ let flagMatch = false;
17252
+ if (sourceArray.data.mappings.mappings[sourceMapping.data.mappings[i].id] == null) {
17253
+ continue;
17132
17254
  }
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;
17255
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17256
+ if (taggingArray.data.mappings.mappings[j] != null) {
17257
+ if (sourceMapping.data.mappings[i].id == taggingArray.data.mappings.mappings[j].id) {
17258
+ let flagMatchObj = true;
17259
+ for (let objKey of compareFields) {
17260
+ if (sourceMapping.data.mappings[i][objKey] !== taggingArray.data.mappings.mappings[j][objKey] && taggingArray.data.mappings.mappings[j][objKey] != null) {
17261
+ console.log('Flag Mismatch', objKey, sourceMapping.data.mappings[i][objKey], taggingArray.data.mappings.mappings[j][objKey]);
17262
+ flagMatchObj = false;
17263
+ break;
17264
+ }
17265
+ }
17266
+ if (flagMatchObj == true) {
17267
+ flagMatch = true;
17268
+ continue;
17269
+ }
17270
+ }
17271
+ }
17136
17272
  }
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;
17273
+ if (!flagMatch) {
17274
+ let objToPush = sourceMapping.data.mappings[i];
17275
+ for (i = 0; i < mandatoryFields.length; i++) {
17276
+ objToPush[mandatoryFields[i]] = "";
17277
+ }
17278
+ taggingArray.data.mappings.mappings.push(objToPush);
17140
17279
  }
17141
17280
  }
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;
17154
- let tempColSubcategory = -1;
17155
- if (JSON.parse(jsonData[0].data.cols)[0] == ('lastModifiedBy')) {
17156
- if (JSON.parse(jsonData[i].data.cols)[0] != ('lastModifiedBy')) {
17157
- tempColCountry = colCountry - 2;
17158
- tempColState = colState - 2;
17159
- tempColStatute = colStatute - 2;
17160
- tempColSubcategory = colSubcategory - 2;
17161
- }
17162
- else {
17163
- tempColCountry = colCountry;
17164
- tempColState = colState;
17165
- tempColStatute = colStatute;
17166
- tempColSubcategory = colSubcategory;
17281
+ var tagged = 0;
17282
+ var changed = 0;
17283
+ var total = 0;
17284
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17285
+ if (taggingArray.data.mappings.mappings[j] != null) {
17286
+ if (sourceMapping.data == null) {
17287
+ if (sourceArray.data.mappings.mappings[taggingArray.data.mappings.mappings[j].id] != null) {
17288
+ total++;
17289
+ let tagStr = "";
17290
+ for (let col of compareFields) {
17291
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`;
17292
+ }
17293
+ tagStr.slice(0, -1);
17294
+ if (this.changedOnboardingItemIds.length > 0) {
17295
+ let changedId = tagStr;
17296
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17297
+ changed++;
17298
+ }
17299
+ }
17300
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
17301
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
17302
+ let flagNull = false;
17303
+ for (let mandatoryfield of mandatoryFields) {
17304
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
17305
+ flagNull = true;
17306
+ break;
17307
+ }
17308
+ }
17309
+ if (flagNull) {
17310
+ continue;
17311
+ }
17312
+ }
17313
+ else {
17314
+ continue;
17315
+ }
17316
+ }
17317
+ tagged++;
17318
+ }
17319
+ else {
17320
+ console.log('tagged not found', taggingArray.data.mappings.mappings[j], sourceObject);
17321
+ }
17322
+ }
17323
+ else {
17324
+ let flagFound = false;
17325
+ for (let sourceObj of sourceMapping.data.mappings) {
17326
+ if (sourceObj.id == taggingArray.data.mappings.mappings[j].id) {
17327
+ let flagEqual = true;
17328
+ for (let col of compareFields) {
17329
+ if (sourceObj[col] != taggingArray.data.mappings.mappings[j][col] && taggingArray.data.mappings.mappings[j][col] != null) {
17330
+ flagEqual = false;
17331
+ break;
17332
+ }
17333
+ }
17334
+ if (flagEqual) {
17335
+ flagFound = true;
17336
+ break;
17337
+ }
17338
+ }
17339
+ }
17340
+ if (flagFound) {
17341
+ let tagStr = "";
17342
+ for (let col of compareFields) {
17343
+ tagStr += `${taggingArray.data.mappings.mappings[j][col]};`;
17344
+ }
17345
+ tagStr.slice(0, -1);
17346
+ total++;
17347
+ if (this.changedOnboardingItemIds.length > 0) {
17348
+ let changedId = tagStr;
17349
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17350
+ changed++;
17351
+ }
17352
+ }
17353
+ if (taggingArray.data.mappings.mappings[j][colName] == null || taggingArray.data.mappings.mappings[j][colName] == "" || taggingArray.data.mappings.mappings[j][colName].length == 0) {
17354
+ if (colName == "countries" || colName == "entities" || colName == "locations") {
17355
+ let flagNull = false;
17356
+ for (let mandatoryfield of mandatoryFields) {
17357
+ if (taggingArray.data.mappings.mappings[j][mandatoryfield] == null || taggingArray.data.mappings.mappings[j][mandatoryfield] == "") {
17358
+ flagNull = true;
17359
+ break;
17360
+ }
17361
+ }
17362
+ if (flagNull) {
17363
+ continue;
17364
+ }
17365
+ }
17366
+ else {
17367
+ continue;
17368
+ }
17369
+ }
17370
+ tagged++;
17371
+ }
17372
+ else {
17373
+ console.log('tagged not found', taggingArray.data.mappings.mappings[j], sourceObject);
17374
+ }
17375
+ }
17376
+ }
17377
+ }
17378
+ console.log('taggingarray3', JSON.stringify(taggingArray.data.mappings.mappings));
17379
+ console.log('tagged', tagged, 'total', total);
17380
+ const unfilteredDict = [];
17381
+ if (divElement == null) {
17382
+ return;
17383
+ }
17384
+ var html = '';
17385
+ var showTable = true;
17386
+ html += '<div class="d-flex justify-between flex-wrap align-center"> ';
17387
+ var status = '';
17388
+ if (tagged < total) {
17389
+ status = '<span class="color-pending material-icons">pending</span>';
17390
+ }
17391
+ else {
17392
+ status = '<span class="color-done material-icons">check_circle</span>';
17393
+ }
17394
+ var mandatoryStatus = '';
17395
+ if (!mandatoryPresent) {
17396
+ mandatoryStatus = '<span class="color-late-executed material-icons">error</span>&nbsp;&nbsp;Mandatory fields are not present';
17397
+ }
17398
+ else {
17399
+ mandatoryStatus = '<span class="color-done material-icons">check_circle</span>&nbsp;&nbsp;Mandatory fields are present';
17400
+ }
17401
+ if (showTable) {
17402
+ 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>');
17403
+ }
17404
+ else {
17405
+ 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>');
17406
+ }
17407
+ if (changed > 0) {
17408
+ 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>');
17409
+ }
17410
+ 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>');
17411
+ 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>');
17412
+ html += '<div class="d-flex align-center">';
17413
+ html += '<div class="mr-10">';
17414
+ 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>';
17415
+ html += '<div style="position: absolute; margin-top: 5px;">';
17416
+ 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>';
17417
+ // console.log('jobs', jobs);
17418
+ 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>');
17419
+ html += '</div>';
17420
+ html += '</div>';
17421
+ 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>';
17422
+ 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>';
17423
+ html += '</div>';
17424
+ html += '</div>';
17425
+ html += '<div>';
17426
+ html += '<h4 id="span-filtered" part="results-title"></h4>';
17427
+ html += '<div id="div-subfiltered"></div>';
17428
+ html += '</div>';
17429
+ html += '<br />';
17430
+ var subfiltered = 0;
17431
+ if (showTable) {
17432
+ html += '<table id="table-data" class="mt-20" style="height: 200px">';
17433
+ html += '<thead>';
17434
+ html += '<th part="td-head" class="td-head">';
17435
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
17436
+ html += '</th>';
17437
+ for (var i = 0; i < extraFields.length; i++) {
17438
+ html += '<th part="td-head" class="td-head">';
17439
+ html += extraFields[i];
17440
+ html += '</th>';
17441
+ }
17442
+ html += '<th part="td-head" class="td-head">';
17443
+ html += colName;
17444
+ html += '</th>';
17445
+ for (i = 0; i < uniqCols.length; i++) {
17446
+ html += '<th part="td-head" class="td-head">';
17447
+ html += uniqCols[i];
17448
+ html += '</th>';
17449
+ }
17450
+ for (i = 0; i < sourceCols.length; i++) {
17451
+ html += '<th part="td-head" class="td-head">';
17452
+ html += sourceCols[i];
17453
+ html += '</th>';
17454
+ }
17455
+ html += '</thead>';
17456
+ html += '<tbody>';
17457
+ // console.log('changedIds', this.changedOnboardingItemIds);
17458
+ for (i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17459
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17460
+ console.log('compliance id', complianceid);
17461
+ var showSearch = false;
17462
+ if (subfilter == "") {
17463
+ //console.log('showsearch true 1');
17464
+ showSearch = true;
17465
+ }
17466
+ var classBg = "";
17467
+ if (i % 2 === 0) {
17468
+ if (this.changedOnboardingItemIds.length > 0) {
17469
+ let changedId = "";
17470
+ for (let [k, col] of uniqCols.entries()) {
17471
+ // console.log('taggingarray rendered', i, col)
17472
+ changedId += taggingArray.data.mappings.mappings[i][col];
17473
+ if (k < (uniqCols.length - 1)) {
17474
+ changedId += ";";
17475
+ }
17476
+ }
17477
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17478
+ classBg = 'td-light-selected';
17479
+ }
17480
+ else {
17481
+ classBg = 'td-light';
17482
+ }
17483
+ }
17484
+ else {
17485
+ classBg = 'td-light';
17486
+ }
17487
+ }
17488
+ else {
17489
+ if (this.changedOnboardingItemIds.length > 0) {
17490
+ let changedId = "";
17491
+ for (let [k, col] of uniqCols.entries()) {
17492
+ if (taggingArray.data.mappings.mappings[i] == null) {
17493
+ // console.log('id not found', i, taggingArray.data.mappings.mappings.length, sourceArray.data.mappings.mappings.length)
17494
+ }
17495
+ changedId += taggingArray.data.mappings.mappings[i][col];
17496
+ if (k < (uniqCols.length - 1)) {
17497
+ changedId += ";";
17498
+ }
17499
+ }
17500
+ if (this.changedOnboardingItemIds.indexOf(changedId) >= 0) {
17501
+ classBg = 'td-dark-selected';
17502
+ }
17503
+ else {
17504
+ classBg = 'td-dark';
17505
+ }
17506
+ }
17507
+ else {
17508
+ classBg = 'td-dark';
17509
+ }
17510
+ }
17511
+ html += '<tr class="" id="tablerow-' + i + '">';
17512
+ 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>';
17513
+ for (var j = 0; j < extraFields.length; j++) {
17514
+ if (i < taggingArray.data.mappings.mappings.length) {
17515
+ html += '<td part="td-body" class="' + classBg + '">';
17516
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17517
+ 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>';
17518
+ html += '</div>';
17519
+ html += '</td>';
17520
+ }
17521
+ else {
17522
+ html += '<td part="td-body" class="' + classBg + '">';
17523
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17524
+ 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>';
17525
+ html += '</div>';
17526
+ html += '</td>';
17527
+ }
17528
+ }
17529
+ html += '<td class="td-body ' + classBg + '" part="td-key">';
17530
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17531
+ if (apiIdDropdown.length > 0) {
17532
+ if (anotherProjection != null) {
17533
+ 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>';
17534
+ }
17535
+ else {
17536
+ 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>';
17537
+ }
17538
+ }
17539
+ else {
17540
+ if (colName.toLowerCase() == "internalcontrols") {
17541
+ html += '<textarea id="tags-' + i + '" type="text" part="input" class="tags-input"></textarea>';
17542
+ }
17543
+ else {
17544
+ html += '<input id="tags-' + i + '" type="text" part="input" class="tags-input"/>';
17545
+ }
17546
+ }
17547
+ html += '</div>';
17548
+ html += '</td>';
17549
+ for (var l = 0; l < uniqCols.length; l++) {
17550
+ html += '<td class="td-body ' + classBg + '" part="td-key">';
17551
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17552
+ 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>';
17553
+ html += '</div>';
17554
+ html += '</td>';
17555
+ }
17556
+ for (l = 0; l < sourceCols.length; l++) {
17557
+ for (var j = 0; j < JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols).length; j++) {
17558
+ if (sourceCols[l] == JSON.parse(sourceArray.data.mappings.mappings[complianceid].cols)[j]) {
17559
+ if (sourceArray.data.mappings.mappings[complianceid].data != null) {
17560
+ html += '<td class="td-body ' + classBg + '" part="td-body">';
17561
+ html += '<div class="' + (!showSearch ? 'truncate' : '') + '">';
17562
+ if (Array.isArray(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
17563
+ for (var k = 0; k < JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j].length; k++) {
17564
+ 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>');
17565
+ }
17566
+ }
17567
+ else {
17568
+ if (typeof JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j] == "string" && Util.isJSONParsable(JSON.parse(sourceArray.data.mappings.mappings[complianceid].data)[j])) {
17569
+ 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>');
17570
+ }
17571
+ else {
17572
+ 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>');
17573
+ }
17574
+ }
17575
+ html += '</div>';
17576
+ html += '</td>';
17577
+ }
17578
+ }
17579
+ }
17580
+ }
17581
+ html += '</tr>';
17582
+ //console.log('i=', i);
17583
+ }
17584
+ html += '</tbody>';
17585
+ html += '</table>';
17586
+ }
17587
+ if (divElement == null) {
17588
+ return;
17589
+ }
17590
+ divElement.innerHTML = html;
17591
+ if (unfilteredDict.length > 0) {
17592
+ var html = '';
17593
+ html += '<div class="mb-10">Items In Your Category (' + unfilteredDict.length + ")</div>";
17594
+ html += this.getFilterOnboardingString();
17595
+ divElement.querySelector('#span-filtered').innerHTML = html;
17596
+ }
17597
+ else {
17598
+ divElement.querySelector('#span-filtered').style.display = 'none';
17599
+ }
17600
+ if (subfiltered > 0) {
17601
+ divElement.querySelector('#div-subfiltered').innerHTML = '<h4 part="results-title">Filtered Results (' + subfiltered + ')</h4>';
17602
+ }
17603
+ if (this.getfilterOnboarding().length > 0) {
17604
+ for (var i = 0; i < taggingArray.data.mappings.mappings.length; i++) {
17605
+ if (!unfilteredDict.includes(i)) {
17606
+ const tableRow = divElement.querySelector('#tablerow-' + i);
17607
+ if (tableRow != null) {
17608
+ tableRow.style.display = 'none';
17609
+ }
17610
+ }
17611
+ }
17612
+ }
17613
+ (_c = divElement.querySelector('.checkbox-all')) === null || _c === void 0 ? void 0 : _c.addEventListener('change', (e) => {
17614
+ divElement.querySelector('.button-save').disabled = false;
17615
+ const arrCheckBoxes = divElement.querySelectorAll('.checkbox-row');
17616
+ //console.log('cb-length', arrCheckBoxes.length);
17617
+ for (var i = 0; i < arrCheckBoxes.length; i++) {
17618
+ const tableRow = divElement.querySelector('#tablerow-' + (i));
17619
+ //console.log('tablerow', i, tableRow);
17620
+ if (tableRow != null) {
17621
+ if (tableRow.style.display != 'none') {
17622
+ //console.log('tablerow setting', e.currentTarget.checked, (arrCheckBoxes[i] as HTMLInputElement));
17623
+ arrCheckBoxes[i].checked = e.currentTarget.checked;
17624
+ if (e.currentTarget.checked) {
17625
+ if (!this.selectedCbs.includes(i + '')) {
17626
+ this.selectedCbs.push(i + '');
17627
+ }
17628
+ }
17629
+ else {
17630
+ this.selectedCbs = [];
17631
+ }
17632
+ }
17633
+ }
17634
+ }
17635
+ //console.log('checkedarr', this.selectedCbs);
17636
+ });
17637
+ for (var j = 0; j < extraFields.length; j++) {
17638
+ const inputArrJ = divElement.querySelectorAll('.extra-field-' + j);
17639
+ for (var k = 0; k < inputArrJ.length; k++) {
17640
+ inputArrJ[k].addEventListener('keyup', (e) => {
17641
+ divElement.querySelector('.button-save').disabled = false;
17642
+ if (e.key == "Enter") {
17643
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17644
+ const activeIndex = e.target.id.split('-')[2];
17645
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
17646
+ taggingArray.data.mappings.mappings[count].extraFields = [];
17647
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
17648
+ for (var l = 0; l < extraFields.length; l++) {
17649
+ const inputExtraField = divElement.querySelector('#extra-field-' + activeIndex + '-' + l);
17650
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17651
+ }
17652
+ }
17653
+ else {
17654
+ for (var l = 0; l < extraFields.length; l++) {
17655
+ const inputExtraField = divElement.querySelector('#extra-field-' + count + '-' + l);
17656
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17657
+ }
17658
+ }
17659
+ }
17660
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17661
+ }
17662
+ // this.saveTagging(taggingArray.data.mappings, uploadFunction, refreshFunction, true);
17663
+ });
17664
+ inputArrJ[k].addEventListener('focusout', (e) => {
17665
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17666
+ const activeIndex = e.target.id.split('-')[2];
17667
+ for (var count = 0; count < taggingArray.data.mappings.mappings.length; count++) {
17668
+ taggingArray.data.mappings.mappings[count].extraFields = [];
17669
+ if (this.selectedCbs.length > 0 && this.selectedCbs.includes(count + "")) {
17670
+ for (var l = 0; l < extraFields.length; l++) {
17671
+ const inputExtraField = divElement.querySelector('#extra-field-' + activeIndex + '-' + l);
17672
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17673
+ }
17674
+ }
17675
+ else {
17676
+ for (var l = 0; l < extraFields.length; l++) {
17677
+ const inputExtraField = divElement.querySelector('#extra-field-' + count + '-' + l);
17678
+ taggingArray.data.mappings.mappings[count].extraFields.push(inputExtraField.value);
17679
+ }
17680
+ }
17681
+ }
17682
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17683
+ });
17684
+ }
17685
+ }
17686
+ const multiArr = divElement.querySelectorAll('.tags-input');
17687
+ for (var i = 0; i < multiArr.length; i++) {
17688
+ if (apiIdDropdown.length > 0) {
17689
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17690
+ var equal = true;
17691
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17692
+ for (var k = 0; k < uniqCols.length; k++) {
17693
+ if (uniqCols[k] != "id") {
17694
+ continue;
17695
+ }
17696
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
17697
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
17698
+ equal = false;
17699
+ }
17700
+ }
17701
+ }
17702
+ if (equal) {
17703
+ let preselctedVals = [];
17704
+ if ((colName == "countries" || colName == "entities" || colName == "locations") && taggingArray.data.mappings.mappings[i][colName] == null) {
17705
+ let preselctedValsStr = "";
17706
+ for (let mandatoryfield of mandatoryFields) {
17707
+ if (taggingArray.data.mappings.mappings[i][mandatoryfield] == null || taggingArray.data.mappings.mappings[i][mandatoryfield] == "") {
17708
+ preselctedValsStr = "";
17709
+ }
17710
+ else {
17711
+ preselctedValsStr += `${taggingArray.data.mappings.mappings[i][mandatoryfield]};`;
17712
+ }
17713
+ }
17714
+ preselctedValsStr = preselctedValsStr.slice(0, -1);
17715
+ if (preselctedValsStr.indexOf(';') >= 0) {
17716
+ preselctedVals.push(preselctedValsStr);
17717
+ }
17718
+ }
17719
+ else {
17720
+ preselctedVals = taggingArray.data.mappings.mappings[i][colName];
17721
+ }
17722
+ multiArr[i].preselectedValues = JSON.stringify(preselctedVals);
17723
+ if (preselctedVals.length > 0) {
17724
+ multiArr[i].parentElement.setAttribute("part", "row-mapped");
17725
+ }
17726
+ }
17727
+ // }
17728
+ multiArr[i].addEventListener('valueChanged', async (e) => {
17729
+ divElement.querySelector('.button-save').disabled = false;
17730
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17731
+ });
17732
+ }
17733
+ else {
17734
+ // for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17735
+ var equal = true;
17736
+ let complianceid = taggingArray.data.mappings.mappings[i].id;
17737
+ for (var k = 0; k < uniqCols.length; k++) {
17738
+ if (uniqCols[k] != "id") {
17739
+ continue;
17740
+ }
17741
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[i] != null) {
17742
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[i][uniqCols[k]]) {
17743
+ equal = false;
17744
+ }
17745
+ }
17746
+ }
17747
+ if (equal) {
17748
+ if (taggingArray.data.mappings.mappings[i] != null) {
17749
+ if (Util.isJSONParsable(sourceArray.data.mappings.mappings[complianceid][colName])) {
17750
+ multiArr[i].value = JSON.parse(sourceArray.data.mappings.mappings[complianceid][colName])[0];
17751
+ }
17752
+ else {
17753
+ multiArr[i].value = (_f = sourceArray.data.mappings.mappings[complianceid][colName]) !== null && _f !== void 0 ? _f : "";
17754
+ }
17755
+ }
17756
+ }
17757
+ // }
17758
+ multiArr[i].addEventListener('keyup', async (e) => {
17759
+ if (e.key == "Enter") {
17760
+ divElement.querySelector('.button-save').disabled = false;
17761
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17762
+ }
17763
+ });
17764
+ multiArr[i].addEventListener('focusout', async (e) => {
17765
+ divElement.querySelector('.button-save').disabled = false;
17766
+ this.applyAndReloadTaggingNew(e, colName, taggingArray, sourceArray, divElement);
17767
+ });
17768
+ }
17769
+ }
17770
+ const buttonApply = divElement.querySelector('.button-apply');
17771
+ buttonApply.addEventListener('click', () => {
17772
+ // console.log('applied');
17773
+ // this.applyAndReloadTagging(e,colName, taggingArray, sourceArray, divElement);
17774
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, taggingArray, sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17775
+ });
17776
+ const buttonToggleMoreBack = divElement.querySelector('.button-toggle-more-back');
17777
+ const buttonToggleMore = divElement.querySelector('.button-toggle-more');
17778
+ buttonToggleMore.addEventListener('click', async (ev) => {
17779
+ ev.target.classList.add('hide');
17780
+ buttonToggleMoreBack.classList.remove('hide');
17781
+ const buttonDownloadBackups = divElement.querySelector('.button-download-backups');
17782
+ buttonDownloadBackups.style.display = 'flex';
17783
+ const buttonExportMapping = divElement.querySelector('.button-export-mapping');
17784
+ buttonExportMapping.style.display = 'flex';
17785
+ const buttonExportMappingCSV = divElement.querySelector('.button-export-mapping-csv');
17786
+ buttonExportMappingCSV.style.display = 'flex';
17787
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
17788
+ // buttonApply.style.display = 'flex';
17789
+ const buttonLoadLocal = divElement.querySelector('.button-local-load');
17790
+ buttonLoadLocal.style.display = 'flex';
17791
+ const buttonSaveLocal = divElement.querySelector('.button-local-save');
17792
+ buttonSaveLocal.style.display = 'flex';
17793
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
17794
+ // buttonSave.style.display = 'flex';
17795
+ const buttonDownloadBackupsNew = Util.clearListeners(buttonDownloadBackups);
17796
+ buttonDownloadBackupsNew.addEventListener('click', async () => {
17797
+ const result = await this.fetchGetStoredMapping(colName);
17798
+ for (var i = 0; i < result.data.length; i++) {
17799
+ const blob = new Blob([result.data[i].mappings != null ? JSON.stringify(result.data[i].mappings) : JSON.stringify(result.data[i])], { type: 'text/html' });
17800
+ const url = window.URL.createObjectURL(blob);
17801
+ const a = document.createElement('a');
17802
+ a.setAttribute('href', url);
17803
+ a.setAttribute('download', 'report_' + colName + '_' + i + '.json');
17804
+ a.click();
17805
+ }
17806
+ buttonToggleMoreBack.click();
17807
+ if (result.data.length === 0) {
17808
+ this.setError("No backups found!");
17809
+ setTimeout(() => {
17810
+ this.clearMessages();
17811
+ }, 3000);
17812
+ }
17813
+ });
17814
+ const buttonExportMappingNew = Util.clearListeners(buttonExportMapping);
17815
+ buttonExportMappingNew.addEventListener('click', async () => {
17816
+ let valueStr = [];
17817
+ for (var i = 0; i < multiArr.length; i++) {
17818
+ if (apiIdDropdown.length > 0) {
17819
+ for (var j = 0; j < taggingArray.data.mappings.mappings.length; j++) {
17820
+ var equal = true;
17821
+ let complianceid = taggingArray.data.mappings.mappings[j].id;
17822
+ for (var k = 0; k < uniqCols.length; k++) {
17823
+ if (uniqCols[k] != "id") {
17824
+ continue;
17825
+ }
17826
+ if (sourceArray.data.mappings.mappings[complianceid] != null && taggingArray.data.mappings.mappings[j] != null) {
17827
+ if (sourceArray.data.mappings.mappings[complianceid][uniqCols[k]] != taggingArray.data.mappings.mappings[j][uniqCols[k]]) {
17828
+ equal = false;
17829
+ }
17830
+ }
17831
+ }
17832
+ if (equal) {
17833
+ valueStr.push(JSON.stringify(taggingArray.data.mappings.mappings[j][colName]));
17834
+ }
17835
+ }
17836
+ }
17837
+ else {
17838
+ if (taggingArray.data.mappings.mappings[i] != null) {
17839
+ valueStr.push(taggingArray.data.mappings.mappings[i][colName]);
17840
+ }
17841
+ else {
17842
+ valueStr.push('');
17843
+ }
17844
+ }
17845
+ }
17846
+ //console.log('valueStr', valueStr);
17847
+ const valuesHTML = JSON.stringify(valueStr);
17848
+ 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;
17849
+ let tableHTML = this.TAGGING_HTML.replace(/TABLE_DATA/g, outerHTML);
17850
+ tableHTML = tableHTML.replace(/TABLE_VALUES/g, valuesHTML);
17851
+ const blob = new Blob([tableHTML], { type: 'text/html' });
17852
+ const url = window.URL.createObjectURL(blob);
17853
+ const a = document.createElement('a');
17854
+ a.setAttribute('href', url);
17855
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.html');
17856
+ a.click();
17857
+ });
17858
+ const buttonExportMappingCSVNew = Util.clearListeners(buttonExportMappingCSV);
17859
+ buttonExportMappingCSVNew === null || buttonExportMappingCSVNew === void 0 ? void 0 : buttonExportMappingCSVNew.addEventListener('click', async () => {
17860
+ let csvArray = JSON.parse(JSON.stringify(taggingArray.data.mappings.mappings));
17861
+ for (let [i, obj] of csvArray.entries()) {
17862
+ let tempCsvObj = obj;
17863
+ let tempId = obj.id;
17864
+ let tempCompliance = sourceArray.data.mappings.mappings[tempId];
17865
+ if (tempCompliance['cols'] != null && tempCompliance['data'] != null) {
17866
+ let dataArr = JSON.parse(tempCompliance['data']);
17867
+ let colsArr = JSON.parse(tempCompliance['cols']);
17868
+ for (let [j, colKey] of colsArr.entries()) {
17869
+ tempCsvObj['cols_' + colKey] = dataArr[j];
17870
+ }
17871
+ }
17872
+ csvArray[i] = tempCsvObj;
17873
+ }
17874
+ console.log('csv array', csvArray);
17875
+ let csvData = Util.convertToCSV(csvArray);
17876
+ // let csvData = Util.convertToCSV(taggingArray.data.mappings.mappings);
17877
+ console.log('csvData', csvData);
17878
+ const blob = new Blob([csvData], { type: 'text/csv;charset=utf-8;' });
17879
+ const url = window.URL.createObjectURL(blob);
17880
+ const a = document.createElement('a');
17881
+ a.setAttribute('href', url);
17882
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().getTime() + '.csv');
17883
+ a.click();
17884
+ });
17885
+ const buttonLoadLocalNew = Util.clearListeners(buttonLoadLocal);
17886
+ buttonLoadLocalNew === null || buttonLoadLocalNew === void 0 ? void 0 : buttonLoadLocalNew.addEventListener('click', async () => {
17887
+ console.log('load-local');
17888
+ divElement.querySelector('#fileInput').click();
17889
+ });
17890
+ const fileInput = divElement.querySelector('#fileInput');
17891
+ fileInput.value = '';
17892
+ const fileInputNew = Util.clearListeners(fileInput);
17893
+ fileInputNew.addEventListener('change', (e) => {
17894
+ var fr = new FileReader();
17895
+ fr.onload = () => {
17896
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, JSON.parse(fr.result + ""), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17897
+ };
17898
+ var frCsv = new FileReader();
17899
+ frCsv.onload = () => {
17900
+ console.log('taggingarray onload called');
17901
+ console.log('csv result', frCsv.result);
17902
+ const tempArr = Util.parseCsv(frCsv.result + "");
17903
+ console.log('csv data', tempArr);
17904
+ let changeCount = 0;
17905
+ for (let [i, obj] of tempArr.entries()) {
17906
+ let tempObj = taggingArray.data.mappings.mappings[i];
17907
+ for (let key of Object.keys(tempObj)) {
17908
+ if (key.indexOf('cols_') >= 0) {
17909
+ delete tempObj[key];
17910
+ }
17911
+ }
17912
+ delete tempObj['delta'];
17913
+ delete tempObj['lastupdated'];
17914
+ let tempNewObj = obj;
17915
+ for (let key of Object.keys(tempNewObj)) {
17916
+ if (key.indexOf('cols_') >= 0) {
17917
+ delete tempNewObj[key];
17918
+ }
17919
+ }
17920
+ delete tempNewObj['delta'];
17921
+ delete tempNewObj['lastupdated'];
17922
+ if (JSON.stringify(tempObj) !== JSON.stringify(tempNewObj)) {
17923
+ // console.log('item changed', taggingArray.data.mappings.mappings[i], obj)
17924
+ let changedId = "";
17925
+ for (let [k, col] of uniqCols.entries()) {
17926
+ // if (col != "id") { continue; }
17927
+ changedId += tempObj[col];
17928
+ if (k < (uniqCols.length - 1)) {
17929
+ changedId += ";";
17930
+ }
17931
+ }
17932
+ this.changedOnboardingItemIds.push(changedId);
17933
+ changeCount++;
17934
+ }
17935
+ }
17936
+ this.setSuccessBtn(changeCount + " items changed. Do you wish to apply?", ["No", "Yes"], [
17937
+ () => {
17938
+ this.clearMessages();
17939
+ this.changedOnboardingItemIds = [];
17940
+ buttonToggleMoreBack.click();
17941
+ },
17942
+ () => {
17943
+ this.clearMessages();
17944
+ let tempObj = {};
17945
+ tempObj["data"] = {};
17946
+ tempObj["data"]["mappings"] = {};
17947
+ tempObj["data"]["mappings"]["mappings"] = tempArr;
17948
+ let tempObjStr = JSON.stringify(tempObj);
17949
+ console.log('csv taggingarray cols', uniqCols, JSON.parse(tempObjStr)["data"]["mappings"]["mappings"].length, Object.keys(tempObj.data.mappings.mappings[0]), sourceMapping);
17950
+ this.renderTaggingTableNew(divElement, selectedStatutes, sourceObject, sourceMapping, JSON.parse(tempObjStr), sourceCols, uploadFunction, refreshFunction, colName, uniqCols, apiIdDropdown, dropdownSearchPhrase, mandatoryFields, compareFields, anotherProjection, extraFields, _arrFeedbackReference, proposedUsersLabel, subfilter);
17951
+ }
17952
+ ]);
17953
+ };
17954
+ if (e.target.files[0].name.toLowerCase().indexOf(colName.toLowerCase()) >= 0) {
17955
+ let ext = e.target.files[0].name.split('.')[e.target.files[0].name.split('.').length - 1];
17956
+ if (ext.toLowerCase() == "csv") {
17957
+ frCsv.readAsText(e.target.files[0]);
17958
+ }
17959
+ else {
17960
+ fr.readAsText(e.target.files[0]);
17961
+ }
17962
+ }
17963
+ });
17964
+ const buttonSaveLocalNew = Util.clearListeners(buttonSaveLocal);
17965
+ buttonSaveLocalNew === null || buttonSaveLocalNew === void 0 ? void 0 : buttonSaveLocalNew.addEventListener('click', async () => {
17966
+ console.log('save-local');
17967
+ const blob = new Blob([JSON.stringify(taggingArray)], { type: 'text/plain' });
17968
+ const url = window.URL.createObjectURL(blob);
17969
+ const a = document.createElement('a');
17970
+ a.setAttribute('href', url);
17971
+ a.setAttribute('download', 'mapping_' + colName + '_' + new Date().toLocaleString() + '.txt');
17972
+ a.click();
17973
+ });
17974
+ });
17975
+ buttonToggleMoreBack.addEventListener('click', async (ev) => {
17976
+ ev.target.classList.add('hide');
17977
+ buttonToggleMore.classList.remove('hide');
17978
+ const buttonDownloadBackups = divElement.querySelector('.button-download-backups');
17979
+ buttonDownloadBackups.style.display = 'none';
17980
+ const buttonExportMapping = divElement.querySelector('.button-export-mapping');
17981
+ buttonExportMapping.style.display = 'none';
17982
+ const buttonExportMappingCSV = divElement.querySelector('.button-export-mapping-csv');
17983
+ buttonExportMappingCSV.style.display = 'none';
17984
+ // const buttonApply = (divElement as HTMLDivElement).querySelector('.button-apply') as HTMLButtonElement;
17985
+ // buttonApply.style.display = 'none';
17986
+ const buttonLoadLocal = divElement.querySelector('.button-local-load');
17987
+ buttonLoadLocal.style.display = 'none';
17988
+ const buttonSaveLocal = divElement.querySelector('.button-local-save');
17989
+ buttonSaveLocal.style.display = 'none';
17990
+ // const buttonSave = (divElement as HTMLDivElement).querySelector('.button-save') as HTMLButtonElement;
17991
+ // buttonSave.style.display = 'none';
17992
+ });
17993
+ const buttonSave = divElement.querySelector('.button-save');
17994
+ buttonSave === null || buttonSave === void 0 ? void 0 : buttonSave.addEventListener('click', async () => {
17995
+ await this.saveTagging(taggingArray.data.mappings, selectedStatutes, uploadFunction, refreshFunction, false, colName);
17996
+ });
17997
+ const buttonCancel = divElement.querySelector('.button-cancel');
17998
+ buttonCancel === null || buttonCancel === void 0 ? void 0 : buttonCancel.addEventListener('click', async () => {
17999
+ //console.log('cancel clicked');
18000
+ await this.fetchCancelOnboardingJob(colName);
18001
+ refreshFunction();
18002
+ });
18003
+ const cbArr = divElement.querySelectorAll('.cb-select');
18004
+ for (i = 0; i < cbArr.length; i++) {
18005
+ cbArr[i].addEventListener('change', (ev) => {
18006
+ const cbSelectId = ev.currentTarget.id;
18007
+ const cbSelectIndex = cbSelectId.split('-')[1];
18008
+ if (!this.selectedCbs.includes(cbSelectIndex)) {
18009
+ this.selectedCbs.push(cbSelectIndex);
18010
+ }
18011
+ else {
18012
+ this.selectedCbs.splice(this.selectedCbs.indexOf(cbSelectIndex), 1);
18013
+ }
18014
+ //console.log(this.selectedCbs);
18015
+ });
18016
+ }
18017
+ this.changedOnboardingItemIds = [];
18018
+ };
18019
+ this.renderMappingTable = (divElement, jsonData, cursor, fetchFunction, searchString, mappedArray, found, uploadFunction, refreshFunction, extraFields, uploadBlock, extraFieldPosition, colName, subfilter, statuteColName, extraHintsArr, mappedStatutes = []) => {
18020
+ var _a, _b, _c, _f, _g, _h, _j;
18021
+ console.log('cols1', jsonData);
18022
+ // console.log('cols', jsonData[0].data.cols);
18023
+ //console.log('divelement', divElement);
18024
+ //console.log('jsonData', jsonData);
18025
+ //console.log('cursor', cursor);
18026
+ //console.log('fetch', fetchFunction);
18027
+ //console.log('searchstring', searchString);
18028
+ //console.log('subfiltervalue', subfilter);
18029
+ const arrCompliancesFrequencies = {};
18030
+ if (jsonData.length === 0)
18031
+ return;
18032
+ this.selectedCbs = [];
18033
+ let colCountry = -1;
18034
+ let colState = -1;
18035
+ let colSubcategory = -1;
18036
+ let colStatute = -1;
18037
+ const unfilteredDict = [];
18038
+ var html = '';
18039
+ html += '<div>';
18040
+ html += '<h3 part="results-title">Total Items (' + found + ')</h3>';
18041
+ html += '<h4 id="span-filtered" part="results-title"></h4>';
18042
+ html += '<h4 id="span-extra-filled" part="results-title"></h4>';
18043
+ html += '</div>';
18044
+ html += '<div class="d-flex justify-between align-center left-sticky flex-wrap mb-20">';
18045
+ html += '<div id="div-subfiltered"></div>';
18046
+ html += '<div id="scroll-overlay" part="onboarding-scroll-overlay" class="pos-fixed-scroll justify-center align-center">';
18047
+ html += '<div id="scroll-overlay-left" class="mr-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_left_alt</span></button></div>';
18048
+ html += '<div id="scroll-overlay-right" class="ml-10"><button part="button-icon"><span class="material-symbols-outlined">arrow_right_alt</span></button></div>';
18049
+ html += '</div>';
18050
+ html += '<div id="detail-overlay" part="onboarding-detail-overlay" class="pos-fixed justify-center align-center hide">';
18051
+ html += '<div class="cover-slide"></div>';
18052
+ html += '<div class="detail-container p-10">';
18053
+ html += '<div class="d-flex justify-between align-center mb-20">';
18054
+ html += '<div part="results-title">Row Details</div>';
18055
+ html += '<button part="button-icon" class="detail-close"><span class="material-symbols-outlined">close</span></button>';
18056
+ html += '</div>';
18057
+ html += '<div id="detail-overlay-list">';
18058
+ html += '</div>';
18059
+ html += '</div>';
18060
+ html += '</div>';
18061
+ html += '<div class="d-flex align-center">';
18062
+ // html += '<input part="input" type="text" placeholder="Filter" class="input-filter mr-10" value="' + subfilter + '" />';
18063
+ html += '<div class="mr-10">';
18064
+ 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>';
18065
+ 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>';
18066
+ html += '</div>';
18067
+ html += (this.disablesave == "yes" ? '' : '<button part="button" class="button-save" disabled>Save</button>');
18068
+ html += '</div>';
18069
+ html += '</div>';
18070
+ html += '<table id="table-data">';
18071
+ html += '<thead>';
18072
+ html += '<th part="td-head" class="td-head">';
18073
+ // html += 'Select';
18074
+ html += '<div id="select-all"><input class="checkbox checkbox-all" part="input-checkbox" type="checkbox" ' + ((this.disableflagggrcresponse.toLowerCase() == "yes") ? 'disabled' : '') + '/></div>';
18075
+ html += '</th>';
18076
+ html += '<th part="td-head" class="td-head">';
18077
+ html += '<div>View</div>';
18078
+ html += '</th>';
18079
+ if (extraFieldPosition === 0) {
18080
+ for (var i = 0; i < extraFields.length; i++) {
18081
+ html += '<th part="td-head" class="td-head">';
18082
+ html += extraFields[i];
18083
+ html += '</th>';
18084
+ }
18085
+ }
18086
+ if (colName.toLowerCase() == "compliances") {
18087
+ html += '<th part="td-head" class="td-head">';
18088
+ html += 'Proposed Users';
18089
+ html += '</th>';
18090
+ }
18091
+ html += '<th part="td-head" class="td-head">';
18092
+ html += 'Id';
18093
+ html += '</th>';
18094
+ // for(var j = 0; j < JSON.parse(jsonData[0].data.cols).length; j++) {
18095
+ // if(jsonData[0].cols.includes(JSON.parse(jsonData[0].data.cols)[j])) {
18096
+ // html += '<th part="td-head" class="td-head ' + (statuteColName.toLowerCase() == JSON.parse(jsonData[0].data.cols)[j].toLowerCase() ? 'left-sticky' : '') + '">'
18097
+ // html += JSON.parse(jsonData[0].data.cols)[j]
18098
+ // html += '</th>'
18099
+ // }
18100
+ // }
18101
+ for (var j = 0; j < jsonData[0].cols.length; j++) {
18102
+ console.log('jsoncols', JSON.parse(jsonData[0].data.cols), jsonData[0].cols.length, j);
18103
+ 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' : '') + '">';
18104
+ // html += jsonData[0].cols[j]
18105
+ html += '</th>';
18106
+ }
18107
+ if (extraFieldPosition === 1) {
18108
+ for (var i = 0; i < extraFields.length; i++) {
18109
+ html += '<th part="td-head" class="td-head">';
18110
+ html += extraFields[i];
18111
+ html += '</th>';
18112
+ }
18113
+ }
18114
+ html += '</thead>';
18115
+ //console.log('colstate', JSON.parse(jsonData[0].data.cols));
18116
+ for (var i = 0; i < JSON.parse(jsonData[0].data.cols).length; i++) {
18117
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "country") {
18118
+ console.log('colstate country', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18119
+ colCountry = i;
18120
+ }
18121
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "state") {
18122
+ //console.log('colstate state', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18123
+ colState = i;
18124
+ }
18125
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == "subcategory") {
18126
+ //console.log('colstate subcategory', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18127
+ colSubcategory = i;
18128
+ }
18129
+ if (JSON.parse(jsonData[0].data.cols)[i].toLowerCase() == statuteColName) {
18130
+ //console.log('colstate statute', JSON.parse(jsonData[0].data.cols)[i].toLowerCase(), i);
18131
+ colStatute = i;
18132
+ }
18133
+ }
18134
+ //var countExtra0 = 0;
18135
+ var countextra = [];
18136
+ var subfiltered = 0;
18137
+ html += '<tbody>';
18138
+ var mappedCount = 0;
18139
+ for (let level = 0; level < 2; level++) {
18140
+ for (var i = 0; i < jsonData.length; i++) {
18141
+ // console.log('subfilter value before', subfiltered);
18142
+ console.log('rendering', i, jsonData[i]);
18143
+ let tempColCountry = -1;
18144
+ let tempColState = -1;
18145
+ let tempColStatute = -1;
18146
+ let tempColSubcategory = -1;
18147
+ if (JSON.parse(jsonData[0].data.cols)[0] == ('lastModifiedBy')) {
18148
+ if (JSON.parse(jsonData[i].data.cols)[0] != ('lastModifiedBy')) {
18149
+ tempColCountry = colCountry - 2;
18150
+ tempColState = colState - 2;
18151
+ tempColStatute = colStatute - 2;
18152
+ tempColSubcategory = colSubcategory - 2;
18153
+ }
18154
+ else {
18155
+ tempColCountry = colCountry;
18156
+ tempColState = colState;
18157
+ tempColStatute = colStatute;
18158
+ tempColSubcategory = colSubcategory;
17167
18159
  }
17168
18160
  }
17169
18161
  else {
@@ -17498,21 +18490,21 @@ let SfIEvents = class SfIEvents extends LitElement {
17498
18490
  // });
17499
18491
  }
17500
18492
  }
17501
- // Filter field handlers
17502
- const inputFilter = divElement.querySelector('.input-filter');
17503
- inputFilter.addEventListener('keyup', (e) => {
17504
- if (e.key == 'Enter') {
17505
- //console.log(inputFilter.value);
17506
- if (this._SfLoader != null) {
17507
- this._SfLoader.innerHTML = '<div class="lds-dual-ring"></div>';
17508
- this._SfLoader.innerHTML += ('<div class="lds-text"><div class="lds-text-c"></div></div>');
17509
- }
17510
- setTimeout(() => {
17511
- this.renderMappingTable(divElement, jsonData, cursor, fetchFunction, searchString, mappedArray, found, uploadFunction, refreshFunction, extraFields, uploadBlock, extraFieldPosition, colName, inputFilter.value, statuteColName, extraHintsArr);
17512
- this._SfLoader.innerHTML = '';
17513
- }, 1000);
17514
- }
17515
- });
18493
+ // // Filter field handlers
18494
+ // const inputFilter = (divElement as HTMLDivElement).querySelector('.input-filter') as HTMLInputElement;
18495
+ // inputFilter.addEventListener('keyup', (e: any) => {
18496
+ // if (e.key == 'Enter') {
18497
+ // //console.log(inputFilter.value);
18498
+ // if (this._SfLoader != null) {
18499
+ // this._SfLoader.innerHTML = '<div class="lds-dual-ring"></div>';
18500
+ // this._SfLoader.innerHTML += ('<div class="lds-text"><div class="lds-text-c"></div></div>');
18501
+ // }
18502
+ // setTimeout(() => {
18503
+ // this.renderMappingTable(divElement, jsonData, cursor, fetchFunction, searchString, mappedArray, found, uploadFunction, refreshFunction, extraFields, uploadBlock, extraFieldPosition, colName, inputFilter.value, statuteColName, extraHintsArr)
18504
+ // this._SfLoader.innerHTML = '';
18505
+ // }, 1000);
18506
+ // }
18507
+ // });
17516
18508
  // More button handlers
17517
18509
  const buttonToggleMoreBack = divElement.querySelector('.button-toggle-more-back');
17518
18510
  const buttonToggleMore = divElement.querySelector('.button-toggle-more');
@@ -17637,7 +18629,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17637
18629
  //console.log(e.currentTarget, (e.currentTarget as HTMLInputElement).checked);
17638
18630
  divElement.querySelector('.button-save').disabled = false;
17639
18631
  if (extraFieldPosition === 1) {
17640
- await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true);
18632
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, true, mappedStatutes);
17641
18633
  }
17642
18634
  });
17643
18635
  }
@@ -17705,7 +18697,7 @@ let SfIEvents = class SfIEvents extends LitElement {
17705
18697
  }
17706
18698
  });
17707
18699
  (_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);
18700
+ await this.saveMapping(divElement, uploadBlock, jsonData, extraFields, searchString, uploadFunction, refreshFunction, false, mappedStatutes);
17709
18701
  });
17710
18702
  // const arrExtraFields = (divElement as HTMLDivElement).querySelectorAll('.extra-field') as NodeListOf<SfIMultitextarea>;
17711
18703
  // var totalFields = 0;
@@ -18326,220 +19318,321 @@ let SfIEvents = class SfIEvents extends LitElement {
18326
19318
  });
18327
19319
  //this.refreshCalendar();
18328
19320
  };
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, "", "");
19321
+ this.renderOnboardingTriggers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedTriggers) => {
19322
+ 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
19323
  };
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, "", "");
19324
+ this.renderOnboardingInternalControls = (selectedStatutes, mappedCompliances, mappedFunctions, mappedInternalControls) => {
19325
+ 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
19326
  };
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, "", "");
19327
+ this.renderOnboardingReportedLocations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedReportedLocations) => {
19328
+ 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
19329
  };
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, "", "");
19330
+ this.renderOnboardingActivations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedActivations) => {
19331
+ 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
19332
  };
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, "", "");
19333
+ this.renderOnboardingInvalidations = (selectedStatutes, mappedCompliances, mappedFunctions, mappedInvalidations) => {
19334
+ 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
19335
  };
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, "", "");
19336
+ this.renderOnboardingAlertSchedules = (selectedStatutes, mappedCompliances, mappedFunctions, mappedAlertSchedules) => {
19337
+ 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
19338
  };
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, "", "");
19339
+ this.renderOnboardingExtensions = (selectedStatutes, mappedCompliances, mappedFunctions, mappedExtensions) => {
19340
+ 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
19341
  };
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, "", "");
19342
+ this.renderOnboardingDuedates = (selectedStatutes, mappedCompliances, mappedFunctions, mappedDuedates) => {
19343
+ 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
19344
  };
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", "");
19345
+ this.renderOnboardingReporters = (selectedStatutes, mappedCompliances, mappedFunctions, mappedReporters) => {
19346
+ 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
19347
  };
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", "");
19348
+ this.renderOnboardingApprovers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedApprovers) => {
19349
+ 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
19350
  };
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", "");
19351
+ this.renderOnboardingFunctionHeads = (selectedStatutes, mappedCompliances, mappedFunctions, mappedFunctionHeads) => {
19352
+ 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
19353
  };
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, "", "");
19354
+ this.renderOnboardingMakerCheckers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedMakerCheckers) => {
19355
+ 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
19356
  };
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, "", "");
19357
+ this.renderOnboardingDocs = (selectedStatutes, mappedCompliances, mappedFunctions, mappedDocs) => {
19358
+ 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
19359
  };
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", "");
19360
+ this.renderOnboardingAuditors = (selectedStatutes, mappedCompliances, mappedFunctions, mappedAuditors) => {
19361
+ 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
19362
  };
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", "");
19363
+ this.renderOnboardingViewers = (selectedStatutes, mappedCompliances, mappedFunctions, mappedViewers) => {
19364
+ 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
19365
  };
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, "", "");
19366
+ this.renderOnboardingTags = (selectedStatutes, mappedCompliances, mappedFunctions, mappedTags) => {
19367
+ 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
19368
  };
18444
- this.renderOnboardingFunctions = (mappedFunctions, mappedSerializedLocations, functionsJobs) => {
19369
+ this.renderOnboardingFunctions = (selectedStatutes, mappedCompliances, mappedLocations, mappedFunctions) => {
19370
+ 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, "", "");
19371
+ };
19372
+ this.renderOnboardingLocations = (selectedStatutes, mappedCompliances, mappedEntities, mappedLocations) => {
19373
+ 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, "", "");
19374
+ };
19375
+ this.renderOnboardingStatutesDropdownMapping = (container, mappedStatutes, selectedStatutes, fetchtaggingfunction, rendermappingfunction) => {
19376
+ console.log('rendering dropdown', mappedStatutes.length);
18445
19377
  var html = '';
18446
- html += '<div id="functions-list-container" class="d-flex flex-col w-100 scroll-x">';
19378
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19379
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
19380
+ html += '<label part="input-label">Select Statute</label>';
19381
+ html += '<sf-multiselect-search mode="edit" exportparts="input:multiselect-input, button-icon-multiselect-button-icon, multiselect-item:multiselect-item, multiselecct-checkbox:multiselect-checkbox, multiselecct-checkbox-label:multiselect-checkbox-label" id="statute-select"></sf-multiselect-search>';
19382
+ html += '</div>';
19383
+ html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
19384
+ html += '</div>';
18447
19385
  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]);
19386
+ console.log('attaching html', html);
19387
+ container.innerHTML = html;
19388
+ let multiselectStatute = container.querySelector('#statute-select');
19389
+ multiselectStatute.listelements = mappedStatutes;
19390
+ let selectedStatutesObj = {};
19391
+ for (let statuteObj of selectedStatutes) {
19392
+ selectedStatutesObj[statuteObj.id] = true;
19393
+ }
19394
+ multiselectStatute.listselection = selectedStatutesObj;
19395
+ multiselectStatute.loadMode();
19396
+ multiselectStatute.addEventListener('valueChanged', async (e) => {
19397
+ let multiselect = e.currentTarget;
19398
+ console.log('selected statutes', multiselect.selectedValuesNames());
19399
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
19400
+ return;
18451
19401
  }
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, "", "");
19402
+ let selectedStatutes = [];
19403
+ const regex = /^\[.*?\] - /;
19404
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
19405
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
19406
+ }
19407
+ let mappedCompliances = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
19408
+ rendermappingfunction({ data: { mappings: { mappings: selectedStatutes } } }, mappedCompliances);
19409
+ });
18455
19410
  };
18456
- this.renderOnboardingLocations = (mappedLocations, mappedSerializedEntities, locationsJobs) => {
19411
+ this.renderOnboardingStatutesDropdownTagging = (container, listcontainerid, mappedStatutes, selectedStatutes, fetchcompliancesfunction, fetchsourcemapping, fetchtaggingfunction, rendertaggingfunction) => {
19412
+ console.log('rendering dropdown', mappedStatutes.length);
18457
19413
  var html = '';
18458
- html += '<div id="locations-list-container" class="d-flex flex-col w-100 scroll-x">';
19414
+ html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19415
+ html += '<div class="d-flex flex-col justify-center align-stretch w-100">';
19416
+ html += '<label part="input-label">Select Statute</label>';
19417
+ html += '<sf-multiselect-search mode="edit" exportparts="input:multiselect-input, button-icon-multiselect-button-icon, multiselect-item:multiselect-item, multiselecct-checkbox:multiselect-checkbox, multiselecct-checkbox-label:multiselect-checkbox-label" id="statute-select"></sf-multiselect-search>';
18459
19418
  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, "", "");
19419
+ html += '<div id="' + listcontainerid + '" class="d-flex flex-col w-100 scroll-x">';
19420
+ html += '</div>';
19421
+ html += '</div>';
19422
+ console.log('attaching html', html);
19423
+ container.innerHTML = html;
19424
+ let multiselectStatute = container.querySelector('#statute-select');
19425
+ multiselectStatute.listelements = mappedStatutes;
19426
+ let selectedStatutesObj = {};
19427
+ for (let statuteObj of selectedStatutes) {
19428
+ selectedStatutesObj[statuteObj.id] = true;
19429
+ }
19430
+ multiselectStatute.listselection = selectedStatutesObj;
19431
+ multiselectStatute.loadMode();
19432
+ multiselectStatute.addEventListener('valueChanged', async (e) => {
19433
+ let multiselect = e.currentTarget;
19434
+ console.log('selected statutes', multiselect.selectedValuesNames());
19435
+ if (Object.keys(multiselect.selectedValuesNames()).length == 0) {
19436
+ return;
19437
+ }
19438
+ let selectedStatutes = [];
19439
+ const regex = /^\[.*?\] - /;
19440
+ for (let statuteid of Object.keys(multiselect.selectedValuesNames())) {
19441
+ selectedStatutes.push({ id: statuteid, selected: true, statutename: multiselect.selectedValuesNames()[statuteid].name.replace(regex, '') });
19442
+ }
19443
+ let sourceMappingArray = await fetchsourcemapping(Object.keys(multiselect.selectedValuesNames()));
19444
+ let mappingArray = await fetchtaggingfunction(Object.keys(multiselect.selectedValuesNames()));
19445
+ let mappedCompliances = await fetchcompliancesfunction(Object.keys(multiselect.selectedValuesNames()));
19446
+ let mappedCompliancesArr = { data: { mappings: {} } };
19447
+ console.log('mapped compliances', mappedCompliances);
19448
+ for (let statuteObj of selectedStatutes) {
19449
+ for (let complianceid of Object.keys(mappedCompliances.data.mappings[statuteObj.id])) {
19450
+ let pushObj = mappedCompliances.data.mappings[statuteObj.id][complianceid];
19451
+ pushObj.id = complianceid;
19452
+ pushObj.statuteid = statuteObj.id;
19453
+ mappedCompliancesArr.data.mappings[complianceid] = pushObj;
19454
+ }
19455
+ }
19456
+ rendertaggingfunction(selectedStatutes, mappedCompliancesArr, sourceMappingArray, mappingArray);
19457
+ });
18462
19458
  };
18463
- this.renderOnboardingCompliances = (mappedStatutes, mappedCompliances) => {
19459
+ this.renderOnboardingCompliances = async (mappedStatutes, mappedCompliancesArr) => {
18464
19460
  //console.log('mappedcompliances', mappedCompliances);
18465
19461
  //console.log('mappedstatutes', mappedStatutes);
18466
19462
  var searchString = "";
19463
+ let mappedCompliances = { data: { mappings: { mappings: [] } } };
18467
19464
  for (var i = 0; i < mappedStatutes.data.mappings.mappings.length; i++) {
18468
19465
  if (mappedStatutes.data.mappings.mappings[i].selected) {
18469
- searchString += mappedStatutes.data.mappings.mappings[i].id + "|";
19466
+ let statuteid = mappedStatutes.data.mappings.mappings[i].id;
19467
+ if (mappedCompliancesArr.data.mappings[statuteid] != null) {
19468
+ for (let complianceid of Object.keys(mappedCompliancesArr.data.mappings[statuteid])) {
19469
+ let pushObj = mappedCompliancesArr.data.mappings[statuteid][complianceid];
19470
+ pushObj.id = complianceid;
19471
+ mappedCompliances.data.mappings.mappings.push(pushObj);
19472
+ }
19473
+ }
19474
+ searchString += statuteid + "|";
18470
19475
  }
18471
19476
  }
18472
19477
  searchString = searchString.slice(0, -1);
18473
19478
  //console.log('searchstring', searchString);
18474
19479
  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);
19480
+ // var html = '';
19481
+ // html += '<div class="d-flex flex-col w-100" style="height: 75vh">';
19482
+ // html += '<div class="d-flex flex-col w-100">';
19483
+ // html += '<label part="input-label">Search Compliances</label>';
19484
+ // html += '<div class="d-flex">';
19485
+ // html += '<input part="input" type="text" class="w-100 input-search" placeholder="Use | to separate..." disabled/>'
19486
+ // html += '<button part="button-icon" class="ml-10 material-icons button-search">search</button>'
19487
+ // html += '</div>';
19488
+ // html += '</div>';
19489
+ // html += '<div id="compliances-list-container" class="d-flex flex-col w-100 scroll-x">';
19490
+ // html += '</div>';
19491
+ // html += '</div>';
19492
+ // (this._SfOnboardingCompliancesContainer as HTMLDivElement).innerHTML = html;
19493
+ // (this._SfButtonSearch as HTMLButtonElement)?.addEventListener('click', async () => {
19494
+ // //console.log('clicked', mappedStatutes.data.mappings.mappings);
19495
+ // const searchString = (this._SfInputSearch as HTMLButtonElement).value;
19496
+ // //console.log('searchstring', searchString);
19497
+ // if (searchString.length > 0) {
19498
+ // const arrSearchString = searchString.split('|');
19499
+ // const arrSearchStringProcessed: any = [];
19500
+ // arrSearchString.forEach((complianceId: string) => {
19501
+ // if (complianceId.length === 36) {
19502
+ // arrSearchStringProcessed.push(complianceId);
19503
+ // }
19504
+ // });
19505
+ // var resultCompliances: any = {};
19506
+ // resultCompliances.values = [];
19507
+ // const chunkSize = 20;
19508
+ // for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
19509
+ // const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
19510
+ // console.log('chunk', chunk);
19511
+ // // do whatever
19512
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
19513
+ // console.log(tempResultCompliances)
19514
+ // resultCompliances.values.push(...tempResultCompliances.values);
19515
+ // //console.log(resultCompliances);
19516
+ // }
19517
+ // // var resultCompliances : any = {};
19518
+ // // resultCompliances.values = [];
19519
+ // // const chunkSize = 20;
19520
+ // // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
19521
+ // // const chunk = arrSearchString.slice(k, k + chunkSize);
19522
+ // // console.log('chunk', chunk);
19523
+ // // // do whatever
19524
+ // // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
19525
+ // // console.log(tempResultCompliances)
19526
+ // // resultCompliances.values.push(...tempResultCompliances.values);
19527
+ // // //console.log(resultCompliances);
19528
+ // // }
19529
+ // if (resultCompliances != null) {
19530
+ // const jsonData = [];
19531
+ // const arrCompliancesFrequencies: any = {};
19532
+ // for (var i = 0; i < resultCompliances.values.length; i++) {
19533
+ // if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
19534
+ // continue;
19535
+ // } else {
19536
+ // arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
19537
+ // }
19538
+ // var mapped = false;
19539
+ // var extraFields = null;
19540
+ // var previousExtraFields = null;
19541
+ // console.log('mappedcompliances', mappedCompliances)
19542
+ // for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
19543
+ // if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
19544
+ // if (mappedCompliances.data.mappings.mappings[j].selected) {
19545
+ // mapped = true;
19546
+ // }
19547
+ // extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
19548
+ // }
19549
+ // }
19550
+ // for (j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
19551
+ // // console.log('mappedStatutes.data.mappings.mappings[j]', mappedStatutes.data.mappings.mappings[j]);
19552
+ // if (Array.isArray(mappedStatutes.data.mappings.mappings[j].statutename)) {
19553
+ // // sometimes this error occurs
19554
+ // continue;
19555
+ // }
19556
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == JSON.parse(resultCompliances.values[i].fields.data[0])[6][0].trim()) {
19557
+ // // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
19558
+ // // console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
19559
+ // // }
19560
+ // previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields
19561
+ // }
19562
+ // }
19563
+ // 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 })
19564
+ // }
19565
+ // 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"]);
19566
+ // }
19567
+ // }
19568
+ // });
19569
+ //console.log('compliances searchstring', searchString);
19570
+ // if (searchString != "") {
19571
+ // (this._SfInputSearch as HTMLInputElement).value = searchString;
19572
+ // (this._SfButtonSearch as HTMLButtonElement).click();
19573
+ // }
19574
+ if (searchString.length > 0) {
19575
+ const arrSearchString = searchString.split('|');
19576
+ const arrSearchStringProcessed = [];
19577
+ arrSearchString.forEach((complianceId) => {
19578
+ if (complianceId.length === 36) {
19579
+ arrSearchStringProcessed.push(complianceId);
19580
+ }
19581
+ });
19582
+ var resultCompliances = {};
19583
+ resultCompliances.values = [];
19584
+ const chunkSize = 20;
19585
+ for (let k = 0; k < arrSearchStringProcessed.length; k += chunkSize) {
19586
+ const chunk = arrSearchStringProcessed.slice(k, k + chunkSize);
19587
+ console.log('chunk', chunk);
19588
+ // do whatever
19589
+ const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchStringProcessed.length);
19590
+ console.log(tempResultCompliances);
19591
+ resultCompliances.values.push(...tempResultCompliances.values);
19592
+ //console.log(resultCompliances);
19593
+ }
19594
+ // var resultCompliances : any = {};
19595
+ // resultCompliances.values = [];
19596
+ // const chunkSize = 20;
19597
+ // for (let k = 0; k < arrSearchString.length; k += chunkSize) {
19598
+ // const chunk = arrSearchString.slice(k, k + chunkSize);
19599
+ // console.log('chunk', chunk);
19600
+ // // do whatever
19601
+ // const tempResultCompliances = await this.fetchSearchCompliances(chunk.join('|'), "", k, arrSearchString.length);
19602
+ // console.log(tempResultCompliances)
19603
+ // resultCompliances.values.push(...tempResultCompliances.values);
19604
+ // //console.log(resultCompliances);
19605
+ // }
19606
+ if (resultCompliances != null) {
19607
+ const jsonData = [];
19608
+ const arrCompliancesFrequencies = {};
19609
+ for (var i = 0; i < resultCompliances.values.length; i++) {
19610
+ if (arrCompliancesFrequencies[resultCompliances.values[i].id] != null) {
19611
+ continue;
18498
19612
  }
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;
19613
+ else {
19614
+ arrCompliancesFrequencies[resultCompliances.values[i].id] = 0;
19615
+ }
19616
+ var mapped = false;
19617
+ var extraFields = null;
19618
+ var previousExtraFields = null;
19619
+ console.log('mappedcompliances', mappedCompliances);
19620
+ if (mappedCompliances.data.mappings.mappings == null) {
19621
+ for (var j = 0; j < Object.keys(mappedCompliances.data.mappings).length; j++) {
19622
+ let statuteKey = Object.keys(mappedCompliances.data.mappings)[j];
19623
+ for (var k = 0; k < Object.keys(mappedCompliances.data.mappings[statuteKey]).length; k++) {
19624
+ let complianceKey = Object.keys(mappedCompliances.data.mappings[statuteKey])[k];
19625
+ if (mappedCompliances.data.mappings[statuteKey][complianceKey].id == resultCompliances.values[i].id) {
19626
+ mapped = true;
19627
+ extraFields = mappedCompliances.data.mappings[statuteKey][complianceKey].extraFields;
19628
+ }
19629
+ }
18533
19630
  }
18534
- var mapped = false;
18535
- var extraFields = null;
18536
- var previousExtraFields = null;
18537
- console.log('mappedcompliances', mappedCompliances);
19631
+ }
19632
+ else {
18538
19633
  for (var j = 0; j < mappedCompliances.data.mappings.mappings.length; j++) {
18539
19634
  if (mappedCompliances.data.mappings.mappings[j].id == resultCompliances.values[i].id) {
18540
- if (mappedCompliances.data.mappings.mappings[j].selected) {
18541
- mapped = true;
18542
- }
19635
+ mapped = true;
18543
19636
  extraFields = mappedCompliances.data.mappings.mappings[j].extraFields;
18544
19637
  }
18545
19638
  }
@@ -18550,51 +19643,25 @@ let SfIEvents = class SfIEvents extends LitElement {
18550
19643
  continue;
18551
19644
  }
18552
19645
  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
- }
19646
+ // if (mappedStatutes.data.mappings.mappings[j].statutename.trim() == "Corporation Act, 2001") {
19647
+ // //console.log('pushpreviousvalues', mappedStatutes.data.mappings.mappings[j], Object.keys(mappedStatutes.data.mappings.mappings[j].extraFields[0]));
19648
+ // }
18556
19649
  previousExtraFields = mappedStatutes.data.mappings.mappings[j].extraFields;
18557
19650
  }
18558
19651
  }
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
19652
  }
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"]);
19653
+ 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
19654
  }
19655
+ 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
19656
  }
18564
- });
18565
- //console.log('compliances searchstring', searchString);
18566
- if (searchString != "") {
18567
- this._SfInputSearch.value = searchString;
18568
- this._SfButtonSearch.click();
18569
19657
  }
18570
19658
  };
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", "");
19659
+ this.renderOnboardingEntities = (selectedStatutes, mappedCompliances, mappedCountries, mappedEntities) => {
19660
+ 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
19661
  };
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, "", "");
19662
+ this.renderOnboardingCountries = (selectedStatutes, mappedCompliances, sourceMapping, mappedCountries) => {
19663
+ sourceMapping = {};
19664
+ 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
19665
  };
18599
19666
  this.renderOnboardingStatutes = (mappedStatutes) => {
18600
19667
  var initCursor = "";
@@ -18631,9 +19698,9 @@ let SfIEvents = class SfIEvents extends LitElement {
18631
19698
  for (var j = 0; j < mappedStatutes.data.mappings.mappings.length; j++) {
18632
19699
  if (mappedStatutes.data.mappings.mappings[j].id == resultStatutes.values[i].id) {
18633
19700
  //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
- }
19701
+ // if (mappedStatutes.data.mappings.mappings[j].selected) {
19702
+ mapped = true;
19703
+ // }
18637
19704
  extraFields = mappedStatutes.data.mappings.mappings[j].extraFields;
18638
19705
  }
18639
19706
  }
@@ -18868,112 +19935,112 @@ let SfIEvents = class SfIEvents extends LitElement {
18868
19935
  this._SfOnboardingTabContainer.innerHTML = html;
18869
19936
  (_a = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-statutes')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', async () => {
18870
19937
  this.myOnboardingTab = this.TAB_STATUTES;
18871
- this.renderOnboardingTabs();
19938
+ await this.renderOnboardingTabs();
18872
19939
  await this.loadOnboardingStatutes();
18873
19940
  });
18874
19941
  (_b = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-compliances')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', async () => {
18875
19942
  this.myOnboardingTab = this.TAB_COMPLIANCES;
18876
- this.renderOnboardingTabs();
19943
+ await this.renderOnboardingTabs();
18877
19944
  this.loadOnboardingCompliances();
18878
19945
  });
18879
19946
  (_c = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-countries')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', async () => {
18880
19947
  this.myOnboardingTab = this.TAB_COUNTRIES;
18881
- this.renderOnboardingTabs();
19948
+ await this.renderOnboardingTabs();
18882
19949
  this.loadOnboardingCountries();
18883
19950
  });
18884
19951
  (_f = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-entities')) === null || _f === void 0 ? void 0 : _f.addEventListener('click', async () => {
18885
19952
  this.myOnboardingTab = this.TAB_ENTITIES;
18886
- this.renderOnboardingTabs();
19953
+ await this.renderOnboardingTabs();
18887
19954
  this.loadOnboardingEntities();
18888
19955
  });
18889
19956
  (_g = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-locations')) === null || _g === void 0 ? void 0 : _g.addEventListener('click', async () => {
18890
19957
  this.myOnboardingTab = this.TAB_LOCATIONS;
18891
- this.renderOnboardingTabs();
19958
+ await this.renderOnboardingTabs();
18892
19959
  this.loadOnboardingLocations();
18893
19960
  });
18894
19961
  (_h = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-functions')) === null || _h === void 0 ? void 0 : _h.addEventListener('click', async () => {
18895
19962
  this.myOnboardingTab = this.TAB_FUNCTIONS;
18896
- this.renderOnboardingTabs();
19963
+ await this.renderOnboardingTabs();
18897
19964
  this.loadOnboardingFunctions();
18898
19965
  });
18899
19966
  (_j = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-tags')) === null || _j === void 0 ? void 0 : _j.addEventListener('click', async () => {
18900
19967
  this.myOnboardingTab = this.TAB_TAGS;
18901
- this.renderOnboardingTabs();
19968
+ await this.renderOnboardingTabs();
18902
19969
  this.loadOnboardingTags();
18903
19970
  });
18904
19971
  (_k = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-reporters')) === null || _k === void 0 ? void 0 : _k.addEventListener('click', async () => {
18905
19972
  this.myOnboardingTab = this.TAB_REPORTERS;
18906
- this.renderOnboardingTabs();
19973
+ await this.renderOnboardingTabs();
18907
19974
  this.loadOnboardingReporters();
18908
19975
  });
18909
19976
  (_l = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-approvers')) === null || _l === void 0 ? void 0 : _l.addEventListener('click', async () => {
18910
19977
  this.myOnboardingTab = this.TAB_APPROVERS;
18911
- this.renderOnboardingTabs();
19978
+ await this.renderOnboardingTabs();
18912
19979
  this.loadOnboardingApprovers();
18913
19980
  });
18914
19981
  (_m = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-functionheads')) === null || _m === void 0 ? void 0 : _m.addEventListener('click', async () => {
18915
19982
  this.myOnboardingTab = this.TAB_FUNCTION_HEADS;
18916
- this.renderOnboardingTabs();
19983
+ await this.renderOnboardingTabs();
18917
19984
  this.loadOnboardingFunctionHeads();
18918
19985
  });
18919
19986
  (_o = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-auditors')) === null || _o === void 0 ? void 0 : _o.addEventListener('click', async () => {
18920
19987
  this.myOnboardingTab = this.TAB_AUDITORS;
18921
- this.renderOnboardingTabs();
19988
+ await this.renderOnboardingTabs();
18922
19989
  this.loadOnboardingAuditors();
18923
19990
  });
18924
19991
  (_p = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-viewers')) === null || _p === void 0 ? void 0 : _p.addEventListener('click', async () => {
18925
19992
  this.myOnboardingTab = this.TAB_VIEWERS;
18926
- this.renderOnboardingTabs();
19993
+ await this.renderOnboardingTabs();
18927
19994
  this.loadOnboardingViewers();
18928
19995
  });
18929
19996
  (_q = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-makercheckers')) === null || _q === void 0 ? void 0 : _q.addEventListener('click', async () => {
18930
19997
  this.myOnboardingTab = this.TAB_MAKER_CHECKERS;
18931
- this.renderOnboardingTabs();
19998
+ await this.renderOnboardingTabs();
18932
19999
  this.loadOnboardingMakerCheckers();
18933
20000
  });
18934
20001
  (_r = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-docs')) === null || _r === void 0 ? void 0 : _r.addEventListener('click', async () => {
18935
20002
  this.myOnboardingTab = this.TAB_DOCS;
18936
- this.renderOnboardingTabs();
20003
+ await this.renderOnboardingTabs();
18937
20004
  this.loadOnboardingDocs();
18938
20005
  });
18939
20006
  (_s = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-duedates')) === null || _s === void 0 ? void 0 : _s.addEventListener('click', async () => {
18940
20007
  this.myOnboardingTab = this.TAB_DUEDATES;
18941
- this.renderOnboardingTabs();
20008
+ await this.renderOnboardingTabs();
18942
20009
  this.loadOnboardingDuedates();
18943
20010
  });
18944
20011
  (_t = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-alertschedules')) === null || _t === void 0 ? void 0 : _t.addEventListener('click', async () => {
18945
20012
  this.myOnboardingTab = this.TAB_ALERTSCHEDULES;
18946
- this.renderOnboardingTabs();
20013
+ await this.renderOnboardingTabs();
18947
20014
  this.loadOnboardingAlertSchedules();
18948
20015
  });
18949
20016
  (_u = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-activations')) === null || _u === void 0 ? void 0 : _u.addEventListener('click', async () => {
18950
20017
  this.myOnboardingTab = this.TAB_ACTIVATIONS;
18951
- this.renderOnboardingTabs();
20018
+ await this.renderOnboardingTabs();
18952
20019
  this.loadOnboardingActivations();
18953
20020
  });
18954
20021
  (_v = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-invalidations')) === null || _v === void 0 ? void 0 : _v.addEventListener('click', async () => {
18955
20022
  this.myOnboardingTab = this.TAB_INVALIDATION;
18956
- this.renderOnboardingTabs();
20023
+ await this.renderOnboardingTabs();
18957
20024
  this.loadOnboardingInvalidations();
18958
20025
  });
18959
20026
  (_w = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-triggers')) === null || _w === void 0 ? void 0 : _w.addEventListener('click', async () => {
18960
20027
  this.myOnboardingTab = this.TAB_TRIGGERS;
18961
- this.renderOnboardingTabs();
20028
+ await this.renderOnboardingTabs();
18962
20029
  this.loadOnboardingTriggers();
18963
20030
  });
18964
20031
  (_x = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-extensions')) === null || _x === void 0 ? void 0 : _x.addEventListener('click', async () => {
18965
20032
  this.myOnboardingTab = this.TAB_EXTENSIONS;
18966
- this.renderOnboardingTabs();
20033
+ await this.renderOnboardingTabs();
18967
20034
  this.loadOnboardingExtensions();
18968
20035
  });
18969
20036
  (_y = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-internalcontrols')) === null || _y === void 0 ? void 0 : _y.addEventListener('click', async () => {
18970
20037
  this.myOnboardingTab = this.TAB_INTERNALCONTROLS;
18971
- this.renderOnboardingTabs();
20038
+ await this.renderOnboardingTabs();
18972
20039
  this.loadOnboardingInternalControls();
18973
20040
  });
18974
20041
  (_z = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-reportedlocations')) === null || _z === void 0 ? void 0 : _z.addEventListener('click', async () => {
18975
20042
  this.myOnboardingTab = this.TAB_REPORTEDLOCATIONS;
18976
- this.renderOnboardingTabs();
20043
+ await this.renderOnboardingTabs();
18977
20044
  this.loadOnboardingReportedLocations();
18978
20045
  });
18979
20046
  (_0 = this._SfOnboardingTabContainer.querySelector('#onboarding-tab-signoff')) === null || _0 === void 0 ? void 0 : _0.addEventListener('click', async () => {
@@ -22346,65 +23413,65 @@ let SfIEvents = class SfIEvents extends LitElement {
22346
23413
  users: transformedUsers
22347
23414
  };
22348
23415
  };
22349
- this.uploadTriggersMapping = async (data) => {
22350
- await this.uploadOnboardingMapping(data, 'triggers');
23416
+ this.uploadTriggersMapping = async (data, statuteids) => {
23417
+ await this.uploadOnboardingMapping(data, 'triggers', statuteids);
22351
23418
  };
22352
- this.uploadInternalControlsMapping = async (data) => {
22353
- await this.uploadOnboardingMapping(data, 'internalcontrols');
23419
+ this.uploadInternalControlsMapping = async (data, statuteids) => {
23420
+ await this.uploadOnboardingMapping(data, 'internalcontrols', statuteids);
22354
23421
  };
22355
- this.uploadReportedLocationsMapping = async (data) => {
22356
- await this.uploadOnboardingMapping(data, 'reportedlocations');
23422
+ this.uploadReportedLocationsMapping = async (data, statuteids) => {
23423
+ await this.uploadOnboardingMapping(data, 'reportedlocations', statuteids);
22357
23424
  };
22358
- this.uploadAlertSchedulesMapping = async (data) => {
22359
- await this.uploadOnboardingMapping(data, 'alertschedules');
23425
+ this.uploadAlertSchedulesMapping = async (data, statuteids) => {
23426
+ await this.uploadOnboardingMapping(data, 'alertschedules', statuteids);
22360
23427
  };
22361
- this.uploadActivationsMapping = async (data) => {
22362
- await this.uploadOnboardingMapping(data, 'activations');
23428
+ this.uploadActivationsMapping = async (data, statuteids) => {
23429
+ await this.uploadOnboardingMapping(data, 'activations', statuteids);
22363
23430
  };
22364
- this.uploadInvalidationsMapping = async (data) => {
22365
- await this.uploadOnboardingMapping(data, 'invalidations');
23431
+ this.uploadInvalidationsMapping = async (data, statuteids) => {
23432
+ await this.uploadOnboardingMapping(data, 'invalidations', statuteids);
22366
23433
  };
22367
- this.uploadDuedatesMapping = async (data) => {
22368
- await this.uploadOnboardingMapping(data, 'duedates');
23434
+ this.uploadDuedatesMapping = async (data, statuteids) => {
23435
+ await this.uploadOnboardingMapping(data, 'duedates', statuteids);
22369
23436
  };
22370
- this.uploadExtensionsMapping = async (data) => {
22371
- await this.uploadOnboardingMapping(data, 'extensions');
23437
+ this.uploadExtensionsMapping = async (data, statuteids) => {
23438
+ await this.uploadOnboardingMapping(data, 'extensions', statuteids);
22372
23439
  };
22373
- this.uploadApproversMapping = async (data) => {
22374
- await this.uploadOnboardingMapping(data, 'approvers');
23440
+ this.uploadApproversMapping = async (data, statuteids) => {
23441
+ await this.uploadOnboardingMapping(data, 'approvers', statuteids);
22375
23442
  };
22376
- this.uploadFunctionHeadsMapping = async (data) => {
22377
- await this.uploadOnboardingMapping(data, 'functionheads');
23443
+ this.uploadFunctionHeadsMapping = async (data, statuteids) => {
23444
+ await this.uploadOnboardingMapping(data, 'functionheads', statuteids);
22378
23445
  };
22379
- this.uploadMakerCheckersMapping = async (data) => {
22380
- await this.uploadOnboardingMapping(data, 'makercheckers');
23446
+ this.uploadMakerCheckersMapping = async (data, statuteids) => {
23447
+ await this.uploadOnboardingMapping(data, 'makercheckers', statuteids);
22381
23448
  };
22382
- this.uploadDocsMapping = async (data) => {
22383
- await this.uploadOnboardingMapping(data, 'docs');
23449
+ this.uploadDocsMapping = async (data, statuteids) => {
23450
+ await this.uploadOnboardingMapping(data, 'docs', statuteids);
22384
23451
  };
22385
- this.uploadAuditorsMapping = async (data) => {
22386
- await this.uploadOnboardingMapping(data, 'auditors');
23452
+ this.uploadAuditorsMapping = async (data, statuteids) => {
23453
+ await this.uploadOnboardingMapping(data, 'auditors', statuteids);
22387
23454
  };
22388
- this.uploadViewersMapping = async (data) => {
22389
- await this.uploadOnboardingMapping(data, 'viewers');
23455
+ this.uploadViewersMapping = async (data, statuteids) => {
23456
+ await this.uploadOnboardingMapping(data, 'viewers', statuteids);
22390
23457
  };
22391
- this.uploadReportersMapping = async (data) => {
22392
- await this.uploadOnboardingMapping(data, 'reporters');
23458
+ this.uploadReportersMapping = async (data, statuteids) => {
23459
+ await this.uploadOnboardingMapping(data, 'reporters', statuteids);
22393
23460
  };
22394
- this.uploadTagsMapping = async (data) => {
22395
- await this.uploadOnboardingMapping(data, 'tags');
23461
+ this.uploadTagsMapping = async (data, statuteids) => {
23462
+ await this.uploadOnboardingMapping(data, 'tags', statuteids);
22396
23463
  };
22397
- this.uploadFunctionsMapping = async (data) => {
22398
- await this.uploadOnboardingMapping(data, 'functions');
23464
+ this.uploadFunctionsMapping = async (data, statuteids) => {
23465
+ await this.uploadOnboardingMapping(data, 'functions', statuteids);
22399
23466
  };
22400
- this.uploadLocationsMapping = async (data) => {
22401
- await this.uploadOnboardingMapping(data, 'locations');
23467
+ this.uploadLocationsMapping = async (data, statuteids) => {
23468
+ await this.uploadOnboardingMapping(data, 'locations', statuteids);
22402
23469
  };
22403
- this.uploadEntitiesMapping = async (data) => {
22404
- await this.uploadOnboardingMapping(data, 'entities');
23470
+ this.uploadEntitiesMapping = async (data, statuteids) => {
23471
+ await this.uploadOnboardingMapping(data, 'entities', statuteids);
22405
23472
  };
22406
- this.uploadCountriesMapping = async (data) => {
22407
- await this.uploadOnboardingMapping(data, 'countries');
23473
+ this.uploadCountriesMapping = async (data, statuteids) => {
23474
+ await this.uploadOnboardingMapping(data, 'countries', statuteids);
22408
23475
  };
22409
23476
  this.uploadMappedSuspense = async (data, year) => {
22410
23477
  //console.log('uploading..', data);
@@ -22434,9 +23501,9 @@ let SfIEvents = class SfIEvents extends LitElement {
22434
23501
  }, 2000);
22435
23502
  }
22436
23503
  };
22437
- this.uploadOnboardingMapping = async (data, onboardingstep) => {
23504
+ this.uploadOnboardingMapping = async (data, onboardingstep, statuteids) => {
22438
23505
  //console.log('uploading..', data);
22439
- let url = "https://" + this.apiId + "/updatemappedonboarding";
23506
+ let url = "https://" + this.apiId + "/updatemappedonboarding1";
22440
23507
  // const body = {
22441
23508
  // "projectid": this.projectId,
22442
23509
  // "data": JSON.stringify(data),
@@ -22445,7 +23512,8 @@ let SfIEvents = class SfIEvents extends LitElement {
22445
23512
  let body = {
22446
23513
  "projectid": this.projectId,
22447
23514
  "presigned": true,
22448
- "onboardingstep": onboardingstep
23515
+ "onboardingstep": onboardingstep,
23516
+ "statuteids": statuteids
22449
23517
  };
22450
23518
  let authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22451
23519
  let xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -22457,7 +23525,8 @@ let SfIEvents = class SfIEvents extends LitElement {
22457
23525
  body = {
22458
23526
  "projectid": this.projectId,
22459
23527
  "key": jsonRespose.key,
22460
- "onboardingstep": onboardingstep
23528
+ "onboardingstep": onboardingstep,
23529
+ "statuteids": statuteids
22461
23530
  };
22462
23531
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22463
23532
  xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -22481,9 +23550,13 @@ let SfIEvents = class SfIEvents extends LitElement {
22481
23550
  if (xhr.status == 200) {
22482
23551
  }
22483
23552
  };
22484
- this.uploadCompliancesMapping = async (data) => {
22485
- //console.log('uploading..', data);
22486
- let url = "https://" + this.apiId + "/updatemappedcompliances";
23553
+ this.uploadCompliancesMapping = async (data, mappedstatutes) => {
23554
+ console.log('uploading..', data, mappedstatutes);
23555
+ let url = "https://" + this.apiId + "/updatemappedcompliances1";
23556
+ let statuteids = [];
23557
+ for (let statuteObj of mappedstatutes) {
23558
+ statuteids.push(statuteObj.id);
23559
+ }
22487
23560
  let body = {
22488
23561
  "projectid": this.projectId,
22489
23562
  "presigned": true,
@@ -22497,6 +23570,7 @@ let SfIEvents = class SfIEvents extends LitElement {
22497
23570
  await this.uploadToPresignedUrl(data, jsonRespose.signedUrl);
22498
23571
  body = {
22499
23572
  "projectid": this.projectId,
23573
+ "statuteids": statuteids,
22500
23574
  "key": jsonRespose.key
22501
23575
  };
22502
23576
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
@@ -22516,22 +23590,30 @@ let SfIEvents = class SfIEvents extends LitElement {
22516
23590
  }
22517
23591
  };
22518
23592
  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 = {
23593
+ // console.log('uploading..', data);
23594
+ let url = "https://" + this.apiId + "/updatemappedstatutes1";
23595
+ // var searchstring = '';
23596
+ // for (var i = 0; i < data.mappings.length; i++) {
23597
+ // // const dataItem = JSON.parse(data.mappings[i].data);
23598
+ // const dataId = data.mappings[i].id;
23599
+ // // console.log(dataItem[3])
23600
+ // if (data.mappings[i].selected == true) {
23601
+ // searchstring += dataId;
23602
+ // // if (i < (data.mappings.length - 1)) {
23603
+ // searchstring += '|';
23604
+ // // }
23605
+ // }
23606
+ // }
23607
+ // if(searchstring.length > 0){
23608
+ // searchstring = searchstring.slice(0, -1);
23609
+ // }
23610
+ // const bodyUpload = {
22531
23611
  // "projectid": this.projectId,
22532
- // "data": JSON.stringify(data),
23612
+ // // "data": JSON.stringify(data),
22533
23613
  // "compliancessearchstring": searchstring
22534
23614
  // }
23615
+ // console.log("upload body", bodyUpload)
23616
+ // return;
22535
23617
  let body = {
22536
23618
  "projectid": this.projectId,
22537
23619
  "presigned": true,
@@ -22545,7 +23627,6 @@ let SfIEvents = class SfIEvents extends LitElement {
22545
23627
  body = {
22546
23628
  "projectid": this.projectId,
22547
23629
  "key": jsonRespose.key,
22548
- "compliancessearchstring": searchstring
22549
23630
  };
22550
23631
  authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
22551
23632
  xhr = (await this.prepareXhr(body, url, this._SfLoader, authorization));
@@ -23592,10 +24673,10 @@ let SfIEvents = class SfIEvents extends LitElement {
23592
24673
  this.setError(jsonRespose.error);
23593
24674
  }
23594
24675
  };
23595
- this.fetchMappedCompliances = async () => {
23596
- let url = "https://" + this.apiId + "/getmappedcompliances";
24676
+ this.fetchMappedCompliances = async (statuteids = []) => {
24677
+ let url = "https://" + this.apiId + "/getmappedcompliances1";
23597
24678
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23598
- const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
24679
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "statuteids": statuteids }, url, this._SfLoader, authorization));
23599
24680
  this._SfLoader.innerHTML = '';
23600
24681
  if (xhr.status == 200) {
23601
24682
  var jsRespose = JSON.parse(xhr.responseText);
@@ -23710,7 +24791,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23710
24791
  }
23711
24792
  };
23712
24793
  this.fetchSerializedMapping = async (onboardingstep) => {
23713
- const url = "https://" + this.apiId + "/getmappedserializedonboarding";
24794
+ const url = "https://" + this.apiId + "/getmappedserializedonboarding1";
23714
24795
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23715
24796
  const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization));
23716
24797
  this._SfLoader.innerHTML = '';
@@ -23789,70 +24870,71 @@ let SfIEvents = class SfIEvents extends LitElement {
23789
24870
  // return (await this.fetchSerializedPartByPart("https://"+this.apiId+"/getmappedserializedcountries"));
23790
24871
  return (await this.fetchSerializedMapping("countries"));
23791
24872
  };
23792
- this.fetchMappedTriggers = async () => {
23793
- return (await this.fetchMappedOnboarding('triggers'));
24873
+ this.fetchMappedTriggers = async (statuteids = []) => {
24874
+ return (await this.fetchMappedOnboarding('triggers', statuteids));
23794
24875
  };
23795
- this.fetchMappedInternalControls = async () => {
23796
- return (await this.fetchMappedOnboarding('internalcontrols'));
24876
+ this.fetchMappedInternalControls = async (statuteids = []) => {
24877
+ return (await this.fetchMappedOnboarding('internalcontrols', statuteids));
23797
24878
  };
23798
- this.fetchMappedReportedLocations = async () => {
23799
- return (await this.fetchMappedOnboarding('reportedlocations'));
24879
+ this.fetchMappedReportedLocations = async (statuteids = []) => {
24880
+ return (await this.fetchMappedOnboarding('reportedlocations', statuteids));
23800
24881
  };
23801
- this.fetchMappedAlertSchedules = async () => {
23802
- return (await this.fetchMappedOnboarding('alertschedules'));
24882
+ this.fetchMappedAlertSchedules = async (statuteids = []) => {
24883
+ return (await this.fetchMappedOnboarding('alertschedules', statuteids));
23803
24884
  };
23804
- this.fetchMappedActivations = async () => {
23805
- return (await this.fetchMappedOnboarding('activations'));
24885
+ this.fetchMappedActivations = async (statuteids = []) => {
24886
+ return (await this.fetchMappedOnboarding('activations', statuteids));
23806
24887
  };
23807
- this.fetchMappedInvalidations = async () => {
23808
- return (await this.fetchMappedOnboarding('invalidations'));
24888
+ this.fetchMappedInvalidations = async (statuteids = []) => {
24889
+ return (await this.fetchMappedOnboarding('invalidations', statuteids));
23809
24890
  };
23810
- this.fetchMappedExtensions = async () => {
23811
- return (await this.fetchMappedOnboarding('extensions'));
24891
+ this.fetchMappedExtensions = async (statuteids = []) => {
24892
+ return (await this.fetchMappedOnboarding('extensions', statuteids));
23812
24893
  };
23813
- this.fetchMappedDuedates = async () => {
23814
- return (await this.fetchMappedOnboarding('duedates'));
24894
+ this.fetchMappedDuedates = async (statuteids = []) => {
24895
+ return (await this.fetchMappedOnboarding('duedates', statuteids));
23815
24896
  };
23816
- this.fetchMappedReporters = async () => {
23817
- return (await this.fetchMappedOnboarding('reporters'));
24897
+ this.fetchMappedReporters = async (statuteids = []) => {
24898
+ return (await this.fetchMappedOnboarding('reporters', statuteids));
23818
24899
  };
23819
- this.fetchMappedApprovers = async () => {
23820
- return (await this.fetchMappedOnboarding('approvers'));
24900
+ this.fetchMappedApprovers = async (statuteids = []) => {
24901
+ return (await this.fetchMappedOnboarding('approvers', statuteids));
23821
24902
  };
23822
- this.fetchMappedFunctionHeads = async () => {
23823
- return (await this.fetchMappedOnboarding('functionheads'));
24903
+ this.fetchMappedFunctionHeads = async (statuteids = []) => {
24904
+ return (await this.fetchMappedOnboarding('functionheads', statuteids));
23824
24905
  };
23825
- this.fetchMappedMakerCheckers = async () => {
23826
- return (await this.fetchMappedOnboarding('makercheckers'));
24906
+ this.fetchMappedMakerCheckers = async (statuteids = []) => {
24907
+ return (await this.fetchMappedOnboarding('makercheckers', statuteids));
23827
24908
  };
23828
- this.fetchMappedDocs = async () => {
23829
- return (await this.fetchMappedOnboarding('docs'));
24909
+ this.fetchMappedDocs = async (statuteids = []) => {
24910
+ return (await this.fetchMappedOnboarding('docs', statuteids));
23830
24911
  };
23831
- this.fetchMappedAuditors = async () => {
23832
- return (await this.fetchMappedOnboarding('auditors'));
24912
+ this.fetchMappedAuditors = async (statuteids = []) => {
24913
+ return (await this.fetchMappedOnboarding('auditors', statuteids));
23833
24914
  };
23834
- this.fetchMappedViewers = async () => {
23835
- return (await this.fetchMappedOnboarding('viewers'));
24915
+ this.fetchMappedViewers = async (statuteids = []) => {
24916
+ return (await this.fetchMappedOnboarding('viewers', statuteids));
23836
24917
  };
23837
- this.fetchMappedTags = async () => {
23838
- return (await this.fetchMappedOnboarding('tags'));
24918
+ this.fetchMappedTags = async (statuteids = []) => {
24919
+ return (await this.fetchMappedOnboarding('tags', statuteids));
23839
24920
  };
23840
- this.fetchMappedLocations = async () => {
23841
- return (await this.fetchMappedOnboarding('locations'));
24921
+ this.fetchMappedLocations = async (statuteids = []) => {
24922
+ return (await this.fetchMappedOnboarding('locations', statuteids));
23842
24923
  };
23843
- this.fetchMappedFunctions = async () => {
23844
- return (await this.fetchMappedOnboarding('functions'));
24924
+ this.fetchMappedFunctions = async (statuteids = []) => {
24925
+ return (await this.fetchMappedOnboarding('functions', statuteids));
23845
24926
  };
23846
- this.fetchMappedEntities = async () => {
23847
- return (await this.fetchMappedOnboarding('entities'));
24927
+ this.fetchMappedEntities = async (statuteids = []) => {
24928
+ return (await this.fetchMappedOnboarding('entities', statuteids));
23848
24929
  };
23849
- this.fetchMappedCountries = async () => {
23850
- return (await this.fetchMappedOnboarding('countries'));
24930
+ this.fetchMappedCountries = async (statuteids = []) => {
24931
+ return (await this.fetchMappedOnboarding('countries', statuteids));
23851
24932
  };
23852
- this.fetchMappedOnboarding = async (onboardingstep) => {
23853
- const url = "https://" + this.apiId + "/getmappedonboarding";
24933
+ this.fetchMappedOnboarding = async (onboardingstep, statuteids) => {
24934
+ var _a;
24935
+ const url = "https://" + this.apiId + "/getmappedonboarding1";
23854
24936
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23855
- const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep }, url, this._SfLoader, authorization));
24937
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId, "onboardingstep": onboardingstep, "statuteids": statuteids }, url, this._SfLoader, authorization));
23856
24938
  this._SfLoader.innerHTML = '';
23857
24939
  if (xhr.status == 200) {
23858
24940
  var jsRespose = JSON.parse(xhr.responseText);
@@ -23860,7 +24942,17 @@ let SfIEvents = class SfIEvents extends LitElement {
23860
24942
  resultPresigned = {};
23861
24943
  resultPresigned.data = {};
23862
24944
  let tempObj = await this.fetchPresignedUrl(jsRespose.signedUrlGet);
23863
- resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
24945
+ let tempArr = [];
24946
+ for (let statuteid of statuteids) {
24947
+ for (let foundObjId of Object.keys((_a = tempObj[statuteid]) !== null && _a !== void 0 ? _a : [])) {
24948
+ let tempPushObj = tempObj[statuteid][foundObjId];
24949
+ tempPushObj.id = foundObjId.split(';')[foundObjId.split(';').length - 1];
24950
+ tempPushObj.statuteid = statuteid;
24951
+ tempArr.push(tempPushObj);
24952
+ }
24953
+ }
24954
+ // resultPresigned.data.mappings = (tempObj.mappings != null) ? tempObj : { mappings: [] };
24955
+ resultPresigned.data.mappings = tempArr;
23864
24956
  console.log('resultPresigned onboarding1', tempObj);
23865
24957
  console.log('resultPresigned onboarding', resultPresigned);
23866
24958
  // await this.fetchPresignedUrlDelete(jsRespose.signedUrlDelete)
@@ -23895,7 +24987,7 @@ let SfIEvents = class SfIEvents extends LitElement {
23895
24987
  }
23896
24988
  };
23897
24989
  this.fetchMappedStatutes = async () => {
23898
- let url = "https://" + this.apiId + "/getmappedstatutes";
24990
+ let url = "https://" + this.apiId + "/getmappedstatutes1";
23899
24991
  const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
23900
24992
  const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
23901
24993
  this._SfLoader.innerHTML = '';
@@ -23913,6 +25005,25 @@ let SfIEvents = class SfIEvents extends LitElement {
23913
25005
  this.setError(jsonRespose.error);
23914
25006
  }
23915
25007
  };
25008
+ this.fetchMappedStatutesList = async () => {
25009
+ let url = "https://" + this.apiId + "/getmappedstatuteslist";
25010
+ const authorization = btoa(Util.readCookie('email') + ":" + Util.readCookie('accessToken'));
25011
+ const xhr = (await this.prepareXhr({ "projectid": this.projectId }, url, this._SfLoader, authorization));
25012
+ this._SfLoader.innerHTML = '';
25013
+ if (xhr.status == 200) {
25014
+ const jsonRespose = JSON.parse(xhr.responseText);
25015
+ //console.log(jsonRespose);
25016
+ return jsonRespose.data;
25017
+ }
25018
+ else {
25019
+ if (xhr.status == 401) {
25020
+ let changeEvent = new CustomEvent('tokenExpired', { bubbles: true });
25021
+ this.dispatchEvent(changeEvent);
25022
+ }
25023
+ const jsonRespose = JSON.parse(xhr.responseText);
25024
+ this.setError(jsonRespose.error);
25025
+ }
25026
+ };
23916
25027
  this.fetchCreateRcmJob = async (complianceid, data, triggerDate, triggerMessage, projects) => {
23917
25028
  data.trigger = {};
23918
25029
  data.trigger.date = triggerDate;
@@ -28655,6 +29766,9 @@ __decorate([
28655
29766
  __decorate([
28656
29767
  query('#internalcontrols-container')
28657
29768
  ], SfIEvents.prototype, "_SfOnboardingInternalControlsContainer", void 0);
29769
+ __decorate([
29770
+ query('#reportedlocations-list-container')
29771
+ ], SfIEvents.prototype, "_SfOnboardingReportedLocationsListContainer", void 0);
28658
29772
  __decorate([
28659
29773
  query('#reportedlocations-container')
28660
29774
  ], SfIEvents.prototype, "_SfOnboardingReportedLocationsContainer", void 0);