tango-app-ui-shared 3.3.1-beta.31 → 3.3.1-beta.33

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.
@@ -3241,6 +3241,7 @@ class TrafficHeaderComponent {
3241
3241
  this.getLocations();
3242
3242
  this.getGroups();
3243
3243
  this.getStore();
3244
+ this.emitAndStoreFilters();
3244
3245
  }
3245
3246
  // Load filters from localStorage if they exist
3246
3247
  const storedFilters = localStorage.getItem("header-filters");
@@ -3275,7 +3276,6 @@ class TrafficHeaderComponent {
3275
3276
  };
3276
3277
  }
3277
3278
  // Emit data via service and update localStorage
3278
- // this.emitAndStoreFilters();
3279
3279
  }
3280
3280
  else {
3281
3281
  // Initialize empty states if no header filters are present in localStorage
@@ -3293,6 +3293,7 @@ class TrafficHeaderComponent {
3293
3293
  emitAndStoreFilters() {
3294
3294
  this.gs.dataRangeValue.next(this.selectedFilters);
3295
3295
  localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
3296
+ // console.log("1")
3296
3297
  }
3297
3298
  /**
3298
3299
  * Reset selectedFilters and all related arrays to empty states
@@ -3332,7 +3333,8 @@ class TrafficHeaderComponent {
3332
3333
  this.selectedFilters.stores = headerFilters.stores;
3333
3334
  this.selectedFilters.group = headerFilters.group;
3334
3335
  this.selectedFilters.location = headerFilters.location;
3335
- // this.gs.dataRangeValue.next(this.selectedFilters);
3336
+ this.gs.dataRangeValue.next(this.selectedFilters);
3337
+ // console.log("2")
3336
3338
  // Ensure locations and groups are loaded before fetching stores
3337
3339
  this.getLocations();
3338
3340
  this.getGroups();
@@ -3351,6 +3353,7 @@ class TrafficHeaderComponent {
3351
3353
  this.selectedFilters.location = headerFilters.location;
3352
3354
  localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
3353
3355
  this.gs.dataRangeValue.next(this.selectedFilters);
3356
+ // console.log("3")
3354
3357
  this.cd.detectChanges();
3355
3358
  // Ensure locations and groups are loaded before fetching stores
3356
3359
  this.getLocations();
@@ -3370,6 +3373,7 @@ class TrafficHeaderComponent {
3370
3373
  this.getStore();
3371
3374
  localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
3372
3375
  this.gs.dataRangeValue.next(this.selectedFilters);
3376
+ // console.log("4")
3373
3377
  this.cd.detectChanges();
3374
3378
  }
3375
3379
  },
@@ -3490,7 +3494,6 @@ class TrafficHeaderComponent {
3490
3494
  });
3491
3495
  }
3492
3496
  isAllLocationsSelected() {
3493
- // return this.filteredLocations.every(location => location.checked)
3494
3497
  return this.filteredLocations.every(location => location.checked);
3495
3498
  }
3496
3499
  selectedLocationsLabel() {
@@ -3546,9 +3549,13 @@ class TrafficHeaderComponent {
3546
3549
  const selectedCities = this.locations
3547
3550
  .filter((location) => location.checked)
3548
3551
  .map((location) => location.city);
3549
- if (selectedCities.length > 0 && !this.searchGroupText.trim()) {
3552
+ // Fetch groups only if locations are selected, no search text exists, and dropdown is opened
3553
+ if (this.filteredLocations.length > 0 || (selectedCities.length > 0 && !this.searchGroupText.trim())) {
3550
3554
  this.getGroups();
3551
3555
  }
3556
+ else {
3557
+ this.filteredGroups = []; // Clear groups if no locations are selected
3558
+ }
3552
3559
  }
3553
3560
  if (type === 'store') {
3554
3561
  // Fetch stores only if not already fetched and no search text is active
@@ -3628,7 +3635,7 @@ class TrafficHeaderComponent {
3628
3635
  // Update localStorage with the latest selectedFilters
3629
3636
  localStorage.setItem('header-filters', JSON.stringify(this.selectedFilters));
3630
3637
  // Emit data via service
3631
- this.gs.dataRangeValue.next(this.selectedFilters);
3638
+ // this.gs.dataRangeValue.next(this.selectedFilters);
3632
3639
  // Trigger change detection to reflect changes in the UI
3633
3640
  this.cd.detectChanges();
3634
3641
  },
@@ -3673,6 +3680,9 @@ class TrafficHeaderComponent {
3673
3680
  const isChecked = event.target.checked;
3674
3681
  this.filteredLocations.forEach((location) => (location.checked = isChecked));
3675
3682
  this.updateSelectedLocations();
3683
+ if (!isChecked) {
3684
+ this.removeLocation();
3685
+ }
3676
3686
  }
3677
3687
  toggleSelectAllStores(event) {
3678
3688
  const checked = event.target.checked;
@@ -3705,7 +3715,8 @@ class TrafficHeaderComponent {
3705
3715
  this.filteredGroups = []; // Clear groups if no locations are selected
3706
3716
  // this.getGroups();
3707
3717
  }
3708
- this.selectedFilters.location = this.locations;
3718
+ this.selectedFilters.location = [];
3719
+ this.selectedFilters.group = [];
3709
3720
  this.filteredStores = []; // Reset stores as well
3710
3721
  this.searchGroupText = '';
3711
3722
  this.searchStoreText = '';
@@ -3739,7 +3750,7 @@ class TrafficHeaderComponent {
3739
3750
  this.selectedFilters.stores = [];
3740
3751
  localStorage.setItem('header-filters', JSON.stringify(this.selectedFilters));
3741
3752
  // Emit data via service
3742
- this.gs.dataRangeValue.next(this.selectedFilters);
3753
+ // this.gs.dataRangeValue.next(this.selectedFilters);
3743
3754
  }
3744
3755
  // Clear the search store text when groups are updated
3745
3756
  this.searchStoreText = '';
@@ -4164,8 +4175,6 @@ class SidebarMenuComponent {
4164
4175
  var queryParams = `?token=${ciphertext}`;
4165
4176
  var baseUrl = `${this.oldDashboardRoutingUrl}/auth/login`;
4166
4177
  var url = `${baseUrl}${queryParams}`;
4167
- console.log(queryParams);
4168
- return;
4169
4178
  // // Opening the URL in a new tab/window
4170
4179
  // // Note: This might trigger popup blockers if not invoked by user action
4171
4180
  var newTab = window.open(url, "_blank");