@annalib/anna-core 28.6.14 → 28.6.16

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.
@@ -2001,6 +2001,7 @@ class AnnaFilterService {
2001
2001
  "ViolatingSpotDate",
2002
2002
  "ViolatedSpotDate",
2003
2003
  "ActualWeekStartDate",
2004
+ "LastFetchedDate",
2004
2005
  ];
2005
2006
  const timeArr = [
2006
2007
  "StartTimeForFilter",
@@ -2128,7 +2129,8 @@ class AnnaFilterService {
2128
2129
  this.selectedRadio === "GeneratedOn" ||
2129
2130
  this.selectedRadio === "Week" ||
2130
2131
  this.selectedRadio === "ActualWeekStartDate" ||
2131
- this.selectedRadio === "scheduledDate") {
2132
+ this.selectedRadio === "scheduledDate" ||
2133
+ this.selectedRadio === "LastFetchedDate") {
2132
2134
  isDataFiltered =
2133
2135
  !isEqual(this.initialValueMap.get(this.selectedRadio), this.tooltipSelectedMap.get(this.selectedRadio)) && !isEqual(this.tooltipSelectedMap.get(this.selectedRadio), this.flightDateRange);
2134
2136
  if (!isDataFiltered && this.tooltipSelectedMap.has(this.selectedRadio)) {
@@ -2198,7 +2200,8 @@ class AnnaFilterService {
2198
2200
  key === "ActualWeekStartDate" ||
2199
2201
  key === "ViolatedSpotDate" ||
2200
2202
  key === "ViolatingSpotDate" ||
2201
- key === "scheduledDate") {
2203
+ key === "scheduledDate" ||
2204
+ key === "LastFetchedDate") {
2202
2205
  filteredData = filteredData.filter((obj) => this.isObjectInTheRange(obj, value, key));
2203
2206
  }
2204
2207
  else if (key === "period") {
@@ -2403,7 +2406,8 @@ class AnnaFilterService {
2403
2406
  key === "ActualWeekStartDate" ||
2404
2407
  key === "ViolatedSpotDate" ||
2405
2408
  key === "ViolatingSpotDate" ||
2406
- key === "scheduledDate") {
2409
+ key === "scheduledDate" ||
2410
+ key === "LastFetchedDate") {
2407
2411
  filteredData = filteredData.filter((obj) => this.isObjectInTheRange(obj, value, key));
2408
2412
  }
2409
2413
  else if (key === "period") {
@@ -3119,6 +3123,84 @@ class AnnaFilterService {
3119
3123
  }
3120
3124
  });
3121
3125
  }
3126
+ checkIfUniqueValuePresentForTheHeader(header, enabledHeaders, tableData, clonedTableData) {
3127
+ header.filterSortObjectKeys.forEach((item) => {
3128
+ const dataToCheck = this.getFilterOptionsData(tableData, clonedTableData, item);
3129
+ if (item === "period") {
3130
+ const uniqStartDate = uniq(dataToCheck.map((u) => u.startDate));
3131
+ const uniqEndDate = uniq(dataToCheck.map((u) => u.endDate));
3132
+ if (uniqStartDate.length > 1 ||
3133
+ uniqEndDate.length > 1 ||
3134
+ this.isTooltipActive([item], this.annaSortService.columnSortState)) {
3135
+ enabledHeaders.push(item);
3136
+ }
3137
+ }
3138
+ else {
3139
+ const values = dataToCheck.map((u) => u[item]);
3140
+ // if last applied filter is this header, push it alos as enabledHeader
3141
+ let activeAndLastlyAppliedHeader = false;
3142
+ if (this.appliedFiltersArray.length > 0 &&
3143
+ this.appliedFiltersArray[this.appliedFiltersArray.length - 1] === item) {
3144
+ activeAndLastlyAppliedHeader = true;
3145
+ }
3146
+ if (header.filter === "CHECKBOX" && (uniq(values).length > 1 || activeAndLastlyAppliedHeader)) {
3147
+ enabledHeaders.push(item);
3148
+ }
3149
+ else if (header.filter !== "CHECKBOX" &&
3150
+ (uniq(values).filter((n) => n != null && n !== "-").length > 1 || activeAndLastlyAppliedHeader)) {
3151
+ enabledHeaders.push(item);
3152
+ }
3153
+ }
3154
+ });
3155
+ }
3156
+ disableEnableEachColumnTooltipIcon(tableHeaders, tableData, clonedTableData) {
3157
+ tableHeaders.forEach((header) => {
3158
+ header.headerInfo.forEach((item) => {
3159
+ if (item.showTooltipIcon) {
3160
+ let values = [];
3161
+ item.disableTooltipIcon = true;
3162
+ item.filterSortObjectKeys.forEach((key) => {
3163
+ const latestFilters = this.appliedFiltersArray;
3164
+ if (latestFilters.length > 0 &&
3165
+ item.disableTooltipIcon &&
3166
+ latestFilters[latestFilters.length - 1] === key) {
3167
+ item.disableTooltipIcon = false;
3168
+ }
3169
+ if (item.disableTooltipIcon) {
3170
+ if (key === "period") {
3171
+ const uniqStartDate = uniq(tableData.map((u) => u.startDate));
3172
+ const uniqEndDate = uniq(tableData.map((u) => u.endDate));
3173
+ item.disableTooltipIcon = !(uniqStartDate.length > 1 || uniqEndDate.length > 1);
3174
+ }
3175
+ else {
3176
+ values = tableData.map((u) => u[key]);
3177
+ if ((item.filter === "CHECKBOX" && uniq(values).length > 1) ||
3178
+ (item.filter !== "CHECKBOX" &&
3179
+ uniq(values).filter((n) => n != null && n !== "-").length > 1)) {
3180
+ item.disableTooltipIcon = false;
3181
+ }
3182
+ }
3183
+ }
3184
+ });
3185
+ }
3186
+ });
3187
+ });
3188
+ }
3189
+ // for date type of filters we need to update tooltip selected map start and end date values to dayjs object.
3190
+ updateDateFilterTooltipSelectedMap(keys) {
3191
+ keys.forEach((key) => {
3192
+ if (this.tooltipSelectedMap?.has(key)) {
3193
+ const dateRange = this.tooltipSelectedMap.get(key);
3194
+ if (dateRange?.fromDate && dateRange?.toDate) {
3195
+ const selectedDateObj = {
3196
+ fromDate: dayjs(dateRange.fromDate),
3197
+ toDate: dayjs(dateRange.toDate),
3198
+ };
3199
+ this.tooltipSelectedMap.set(key, selectedDateObj);
3200
+ }
3201
+ }
3202
+ });
3203
+ }
3122
3204
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFilterService, deps: [{ token: AnnaDateTimeFormatService }, { token: AnnaSortService }], target: i0.ɵɵFactoryTarget.Injectable }); }
3123
3205
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AnnaFilterService, providedIn: "root" }); }
3124
3206
  }
@@ -4291,7 +4373,7 @@ class AnnaNonEditableGenericTableComponent {
4291
4373
  }
4292
4374
  else {
4293
4375
  this.setInitialRowsForTable();
4294
- this.disableEnableEachColumnTooltipIcon();
4376
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
4295
4377
  this.tableColumns = this.tableHeaders.filter((x) => x.visible).map((x) => x.headerInfo[0].objectKey);
4296
4378
  if ((this.tableData && this.tableData.length === 0) ||
4297
4379
  (this.tableData.length === 2 && this.checkIfAllTheElementsAreZero())) {
@@ -4726,6 +4808,7 @@ class AnnaNonEditableGenericTableComponent {
4726
4808
  this.tooltipRadioTextMap.set("SellerProgInvCode", "Seller Pgm (Inv Code)");
4727
4809
  this.tooltipRadioTextMap.set("SellerProgramName", "Seller Program");
4728
4810
  this.tooltipRadioTextMap.set("buyerProgramName", "Buyer Program");
4811
+ this.tooltipRadioTextMap.set("LastFetchedDate", "Last Fetched");
4729
4812
  this.tooltipRadioTextMap.set("bookedDps", "Booked Dps");
4730
4813
  this.tooltipRadioTextMap.set("totalBookedGrp", "Total Booked Grp");
4731
4814
  this.tooltipRadioTextMap.set("totalBookedImps", "Total Booked Imps");
@@ -4786,7 +4869,7 @@ class AnnaNonEditableGenericTableComponent {
4786
4869
  }
4787
4870
  else {
4788
4871
  const enabledHeaders = [];
4789
- this.checkIfUniqueValuePresentForTheHeader(header, enabledHeaders);
4872
+ this.annaFilterService.checkIfUniqueValuePresentForTheHeader(header, enabledHeaders, this.tableData, this.clonedTableData);
4790
4873
  this.openTooltip(tooltip, enabledHeaders, header);
4791
4874
  if (window.innerWidth < 1500 &&
4792
4875
  window.innerHeight < 768 &&
@@ -5079,14 +5162,14 @@ class AnnaNonEditableGenericTableComponent {
5079
5162
  this.tableData = tableData;
5080
5163
  this.setScrollToInitialPosition();
5081
5164
  this.setInitialRowsForTable();
5082
- this.disableEnableEachColumnTooltipIcon();
5165
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
5083
5166
  this.filterAppliedToTable.emit(tableData);
5084
5167
  this.closeTooltip();
5085
5168
  }
5086
5169
  sortingApplied(tableData) {
5087
5170
  this.tableData = tableData;
5088
5171
  this.setInitialRowsForTable();
5089
- this.disableEnableEachColumnTooltipIcon();
5172
+ this.annaFilterService.disableEnableEachColumnTooltipIcon(this.tableHeaders, this.tableData, this.clonedTableData);
5090
5173
  this.sortingAppliedToTable.emit(tableData);
5091
5174
  this.closeTooltip();
5092
5175
  }