cat-qw-lib 2.5.21 → 2.5.23

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.
@@ -2397,6 +2397,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
2397
2397
  type: Input
2398
2398
  }] } });
2399
2399
 
2400
+ // Constant for unassigned underwriter filter value
2401
+ const UNASSIGNED_UNDERWRITER_ID = 'unassigned';
2400
2402
  /**
2401
2403
  *
2402
2404
  */
@@ -2616,7 +2618,20 @@ class QueueFilterDropdownService extends BaseService {
2616
2618
  filterParams['pendingDays'] = filters.pendingDays.toString();
2617
2619
  }
2618
2620
  if (filters.assignedUnderwriter && filters.assignedUnderwriter.length > 0) {
2619
- filterParams['underwriterId'] = filters.assignedUnderwriter.join(',');
2621
+ // Separate approach: Use unassigned boolean param and underwriterId for actual IDs
2622
+ const hasUnassigned = filters.assignedUnderwriter.includes(UNASSIGNED_UNDERWRITER_ID);
2623
+ const realUnderwriterIds = filters.assignedUnderwriter.filter(id => id !== UNASSIGNED_UNDERWRITER_ID);
2624
+ // Set unassigned parameter if "unassigned" is selected
2625
+ if (hasUnassigned) {
2626
+ filterParams['unassigned'] = 'true';
2627
+ }
2628
+ else {
2629
+ filterParams['unassigned'] = 'false';
2630
+ }
2631
+ // Set underwriterId parameter only if there are real IDs (excluding "unassigned")
2632
+ if (realUnderwriterIds.length > 0) {
2633
+ filterParams['underwriterId'] = realUnderwriterIds.join(',');
2634
+ }
2620
2635
  }
2621
2636
  return new URLSearchParams(filterParams).toString();
2622
2637
  }
@@ -7269,7 +7284,7 @@ class QueueFilterDropdownComponent {
7269
7284
  return this.filterService.getUnderwritersList(searchKey || SHARED.EMPTY);
7270
7285
  })).subscribe((underwriters) => {
7271
7286
  // Add "Unassigned" option at the beginning of the list
7272
- const unassignedOption = { id: 'unassigned', name: 'Unassigned' };
7287
+ const unassignedOption = { id: UNASSIGNED_UNDERWRITER_ID, name: 'Unassigned' };
7273
7288
  this.underwriterOptions = [unassignedOption, ...underwriters];
7274
7289
  this.loadingUnderwriters = false;
7275
7290
  });
@@ -7286,10 +7301,13 @@ class QueueFilterDropdownComponent {
7286
7301
  if (!this.showDropdown) {
7287
7302
  // Store current state when opening dropdown (this will be the applied filters)
7288
7303
  this.originalFilters = this.filterService.getFilters();
7289
- // Load initial underwriter list when opening dropdown
7290
- if (this.underwriterOptions.length === 0) {
7291
- this.loadInitialUnderwriters();
7292
- }
7304
+ // Reset loading state and reload underwriter list every time dropdown opens
7305
+ this.loadingUnderwriters = false;
7306
+ this.loadInitialUnderwriters();
7307
+ }
7308
+ else {
7309
+ // Reset loading state when closing dropdown
7310
+ this.loadingUnderwriters = false;
7293
7311
  }
7294
7312
  this.showDropdown = !this.showDropdown;
7295
7313
  this.skipNextDocumentClick = true;
@@ -7349,11 +7367,12 @@ class QueueFilterDropdownComponent {
7349
7367
  }
7350
7368
  applyFilters() {
7351
7369
  const filterData = this.filterService.getFilters();
7352
- if (this.filterService.hasFilters()) {
7353
- this.filterApplied.emit(filterData);
7354
- this.filtersApplied = true; // Mark that filters have been applied
7355
- }
7370
+ // Always emit filterApplied event to trigger API call, even if no filters
7371
+ // This ensures the list API is called every time Apply Filters is clicked
7372
+ this.filterApplied.emit(filterData);
7373
+ this.filtersApplied = true; // Mark that filters have been applied
7356
7374
  this.showDropdown = false;
7375
+ this.loadingUnderwriters = false; // Reset loading state when closing
7357
7376
  this.originalFilters = null; // Clear stored state after applying
7358
7377
  this.filters = this.filterService.getFilters();
7359
7378
  }
@@ -7397,6 +7416,7 @@ class QueueFilterDropdownComponent {
7397
7416
  // Only restore original filters if no filters have been applied yet
7398
7417
  this.filterService.setAllFilters(this.originalFilters);
7399
7418
  }
7419
+ this.loadingUnderwriters = false; // Reset loading state when closing without applying
7400
7420
  this.originalFilters = null;
7401
7421
  }
7402
7422
  onDocumentClick(event) {