@annalib/anna-core 7.2.4 → 7.2.6

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.
Files changed (156) hide show
  1. package/annalib-anna-core.d.ts +5 -0
  2. package/esm2020/annalib-anna-core.mjs +5 -0
  3. package/esm2020/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.mjs +15 -0
  4. package/esm2020/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.mjs +35 -0
  5. package/esm2020/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.mjs +15 -0
  6. package/esm2020/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.mjs +22 -0
  7. package/esm2020/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.mjs +15 -0
  8. package/esm2020/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.mjs +21 -0
  9. package/esm2020/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.mjs +15 -0
  10. package/esm2020/lib/anna-core-shared-lib/constants/shared.constant.mjs +35 -0
  11. package/esm2020/lib/anna-core-shared-lib/directives/digits-only/digits-only.directive.mjs +282 -0
  12. package/esm2020/lib/anna-core-shared-lib/directives/show-ellipsis-text/show-ellipsis-text.directive.mjs +27 -0
  13. package/esm2020/lib/anna-core-shared-lib/models/anna-generic-data-type.model.mjs +2 -0
  14. package/esm2020/lib/anna-core-shared-lib/models/anna-global-dropdown-config.model.mjs +2 -0
  15. package/esm2020/lib/anna-core-shared-lib/models/anna-manage-users.model.mjs +8 -0
  16. package/esm2020/lib/anna-core-shared-lib/models/anna-non-editable-gt-models.mjs +2 -0
  17. package/esm2020/lib/anna-core-shared-lib/models/anna-sort.model.mjs +7 -0
  18. package/esm2020/lib/anna-core-shared-lib/models/anna-tooltip.model.mjs +30 -0
  19. package/esm2020/lib/anna-core-shared-lib/pipes/annaConvertZeroOrNullOrUndefined.pipe.mjs +26 -0
  20. package/esm2020/lib/anna-core-shared-lib/pipes/annaFilterSearchedText.pipe.mjs +46 -0
  21. package/esm2020/lib/anna-core-shared-lib/pipes/annaReplaceChar.pipe.mjs +25 -0
  22. package/esm2020/lib/anna-core-shared-lib/pipes/annaTypeOfData.pipe.mjs +16 -0
  23. package/esm2020/lib/anna-core-shared-lib/services/anna-date-time-format.service.mjs +199 -0
  24. package/esm2020/lib/anna-core-shared-lib/services/anna-filter.service.mjs +469 -0
  25. package/esm2020/lib/anna-core-shared-lib/services/anna-generic-table.service.mjs +124 -0
  26. package/esm2020/lib/anna-core-shared-lib/services/anna-global-config.service.mjs +133 -0
  27. package/esm2020/lib/anna-core-shared-lib/services/anna-number-format.service.mjs +41 -0
  28. package/esm2020/lib/anna-core-shared-lib/services/anna-sort.service.mjs +147 -0
  29. package/esm2020/lib/anna-core.module.mjs +180 -0
  30. package/esm2020/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.mjs +101 -0
  31. package/esm2020/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.mjs +364 -0
  32. package/esm2020/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.mjs +1834 -0
  33. package/esm2020/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.mjs +69 -0
  34. package/esm2020/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.mjs +357 -0
  35. package/esm2020/lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/anna-fixed-row-size-table-virtual-scroll-strategy.directive.mjs +189 -0
  36. package/esm2020/lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/index.mjs +2 -0
  37. package/esm2020/lib/anna-generic-table-lib/directives/anna-virtual-table/anna-virtual-table.directive.mjs +178 -0
  38. package/esm2020/lib/anna-generic-table-lib/directives/anna-virtual-table/index.mjs +2 -0
  39. package/esm2020/public-api.mjs +50 -0
  40. package/fesm2015/annalib-anna-core.mjs +4875 -0
  41. package/fesm2015/annalib-anna-core.mjs.map +1 -0
  42. package/fesm2020/annalib-anna-core.mjs +4868 -0
  43. package/fesm2020/annalib-anna-core.mjs.map +1 -0
  44. package/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.d.ts +8 -0
  45. package/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.d.ts +16 -0
  46. package/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.d.ts +8 -0
  47. package/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.d.ts +11 -0
  48. package/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.d.ts +8 -0
  49. package/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.d.ts +11 -0
  50. package/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.d.ts +8 -0
  51. package/lib/anna-core-shared-lib/constants/shared.constant.d.ts +33 -0
  52. package/lib/anna-core-shared-lib/directives/digits-only/digits-only.directive.d.ts +34 -0
  53. package/lib/anna-core-shared-lib/directives/show-ellipsis-text/show-ellipsis-text.directive.d.ts +9 -0
  54. package/lib/anna-core-shared-lib/models/anna-generic-data-type.model.d.ts +16 -0
  55. package/{src/lib/anna-core-shared-lib/models/anna-global-dropdown-config.model.ts → lib/anna-core-shared-lib/models/anna-global-dropdown-config.model.d.ts} +9 -21
  56. package/lib/anna-core-shared-lib/models/anna-manage-users.model.d.ts +6 -0
  57. package/{src/lib/anna-core-shared-lib/models/anna-non-editable-gt-models.ts → lib/anna-core-shared-lib/models/anna-non-editable-gt-models.d.ts} +17 -28
  58. package/lib/anna-core-shared-lib/models/anna-sort.model.d.ts +11 -0
  59. package/lib/anna-core-shared-lib/models/anna-tooltip.model.d.ts +25 -0
  60. package/lib/anna-core-shared-lib/pipes/annaConvertZeroOrNullOrUndefined.pipe.d.ts +9 -0
  61. package/lib/anna-core-shared-lib/pipes/annaFilterSearchedText.pipe.d.ts +9 -0
  62. package/lib/anna-core-shared-lib/pipes/annaReplaceChar.pipe.d.ts +9 -0
  63. package/lib/anna-core-shared-lib/pipes/annaTypeOfData.pipe.d.ts +7 -0
  64. package/lib/anna-core-shared-lib/services/anna-date-time-format.service.d.ts +27 -0
  65. package/lib/anna-core-shared-lib/services/anna-filter.service.d.ts +74 -0
  66. package/lib/anna-core-shared-lib/services/anna-generic-table.service.d.ts +28 -0
  67. package/lib/anna-core-shared-lib/services/anna-global-config.service.d.ts +21 -0
  68. package/lib/anna-core-shared-lib/services/anna-number-format.service.d.ts +7 -0
  69. package/lib/anna-core-shared-lib/services/anna-sort.service.d.ts +16 -0
  70. package/lib/anna-core.module.d.ts +36 -0
  71. package/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.d.ts +34 -0
  72. package/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.d.ts +70 -0
  73. package/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.d.ts +283 -0
  74. package/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.d.ts +17 -0
  75. package/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.d.ts +141 -0
  76. package/lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/anna-fixed-row-size-table-virtual-scroll-strategy.directive.d.ts +89 -0
  77. package/{src/lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/index.ts → lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/index.d.ts} +0 -0
  78. package/lib/anna-generic-table-lib/directives/anna-virtual-table/anna-virtual-table.directive.d.ts +45 -0
  79. package/{src/lib/anna-generic-table-lib/directives/anna-virtual-table/index.ts → lib/anna-generic-table-lib/directives/anna-virtual-table/index.d.ts} +0 -0
  80. package/package.json +39 -19
  81. package/{src/public-api.ts → public-api.d.ts} +0 -28
  82. package/.browserslistrc +0 -16
  83. package/karma.conf.js +0 -44
  84. package/ng-package.json +0 -14
  85. package/src/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.html +0 -22
  86. package/src/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.scss +0 -0
  87. package/src/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.spec.ts +0 -25
  88. package/src/lib/anna-core-shared-lib/components/anna-buyer-approval-icon-template/anna-buyer-approval-icon-template.component.ts +0 -16
  89. package/src/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.html +0 -33
  90. package/src/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.scss +0 -0
  91. package/src/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.spec.ts +0 -25
  92. package/src/lib/anna-core-shared-lib/components/anna-icon-column/anna-icon-column.component.ts +0 -28
  93. package/src/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.html +0 -20
  94. package/src/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.scss +0 -0
  95. package/src/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.spec.ts +0 -25
  96. package/src/lib/anna-core-shared-lib/components/anna-live-icon-template/anna-live-icon-template.component.ts +0 -16
  97. package/src/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.html +0 -3
  98. package/src/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.scss +0 -17
  99. package/src/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.spec.ts +0 -24
  100. package/src/lib/anna-core-shared-lib/components/anna-no-data/anna-no-data.component.ts +0 -20
  101. package/src/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.html +0 -23
  102. package/src/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.scss +0 -0
  103. package/src/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.spec.ts +0 -25
  104. package/src/lib/anna-core-shared-lib/components/anna-notify-icon-template/anna-notify-icon-template.component.ts +0 -16
  105. package/src/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.html +0 -15
  106. package/src/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.scss +0 -0
  107. package/src/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.spec.ts +0 -25
  108. package/src/lib/anna-core-shared-lib/components/anna-pay-for-performance-icon-template/anna-pay-for-performance-icon-template.component.ts +0 -19
  109. package/src/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.html +0 -14
  110. package/src/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.scss +0 -0
  111. package/src/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.spec.ts +0 -25
  112. package/src/lib/anna-core-shared-lib/components/anna-rejected-icon-template/anna-rejected-icon-template.component.ts +0 -16
  113. package/src/lib/anna-core-shared-lib/constants/shared.constant.ts +0 -35
  114. package/src/lib/anna-core-shared-lib/directives/digits-only/digits-only.directive.ts +0 -307
  115. package/src/lib/anna-core-shared-lib/directives/show-ellipsis-text/show-ellipsis-text.directive.ts +0 -19
  116. package/src/lib/anna-core-shared-lib/models/anna-generic-data-type.model.ts +0 -19
  117. package/src/lib/anna-core-shared-lib/models/anna-manage-users.model.ts +0 -6
  118. package/src/lib/anna-core-shared-lib/models/anna-sort.model.ts +0 -13
  119. package/src/lib/anna-core-shared-lib/models/anna-tooltip.model.ts +0 -44
  120. package/src/lib/anna-core-shared-lib/pipes/annaConvertZeroOrNullOrUndefined.pipe.ts +0 -20
  121. package/src/lib/anna-core-shared-lib/pipes/annaFilterSearchedText.pipe.ts +0 -43
  122. package/src/lib/anna-core-shared-lib/pipes/annaReplaceChar.pipe.ts +0 -19
  123. package/src/lib/anna-core-shared-lib/pipes/annaTypeOfData.pipe.ts +0 -12
  124. package/src/lib/anna-core-shared-lib/services/anna-date-time-format.service.ts +0 -219
  125. package/src/lib/anna-core-shared-lib/services/anna-filter.service.ts +0 -563
  126. package/src/lib/anna-core-shared-lib/services/anna-generic-table.service.ts +0 -136
  127. package/src/lib/anna-core-shared-lib/services/anna-global-config.service.ts +0 -170
  128. package/src/lib/anna-core-shared-lib/services/anna-number-format.service.ts +0 -43
  129. package/src/lib/anna-core-shared-lib/services/anna-sort.service.ts +0 -179
  130. package/src/lib/anna-core.module.ts +0 -112
  131. package/src/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.html +0 -46
  132. package/src/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.scss +0 -153
  133. package/src/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.spec.ts +0 -24
  134. package/src/lib/anna-dropdown-lib/components/anna-calendar-filter/anna-calendar-filter.component.ts +0 -106
  135. package/src/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.html +0 -129
  136. package/src/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.scss +0 -275
  137. package/src/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.spec.ts +0 -24
  138. package/src/lib/anna-dropdown-lib/components/anna-week-calendar-filter/anna-week-calendar-filter.component.ts +0 -414
  139. package/src/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.html +0 -1080
  140. package/src/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.scss +0 -668
  141. package/src/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.spec.ts +0 -25
  142. package/src/lib/anna-generic-table-lib/components/anna-non-editable-generic-table/anna-non-editable-generic-table.component.ts +0 -2186
  143. package/src/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.html +0 -10
  144. package/src/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.scss +0 -1
  145. package/src/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.spec.ts +0 -24
  146. package/src/lib/anna-generic-table-lib/components/anna-sort/anna-sort.component.ts +0 -69
  147. package/src/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.html +0 -13
  148. package/src/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.scss +0 -88
  149. package/src/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.spec.ts +0 -25
  150. package/src/lib/anna-generic-table-lib/components/anna-table-virtual-scroll-viewport/anna-table-virtual-scroll-viewport.component.ts +0 -460
  151. package/src/lib/anna-generic-table-lib/directives/anna-fixed-row-size-table-virtual-scroll-strategy/anna-fixed-row-size-table-virtual-scroll-strategy.directive.ts +0 -237
  152. package/src/lib/anna-generic-table-lib/directives/anna-virtual-table/anna-virtual-table.directive.ts +0 -204
  153. package/src/test.ts +0 -27
  154. package/tsconfig.lib.json +0 -19
  155. package/tsconfig.lib.prod.json +0 -10
  156. package/tsconfig.spec.json +0 -17
@@ -1,2186 +0,0 @@
1
-
2
- // Angular import statements
3
- import { Component, OnInit, Input, ViewChildren, QueryList, Output, EventEmitter, SimpleChanges, OnChanges, ChangeDetectorRef, ElementRef, AfterViewChecked, ChangeDetectionStrategy } from '@angular/core';
4
-
5
- // Third party import statements
6
- import dayjs from "dayjs";
7
- import { Options } from '@angular-slider/ngx-slider';
8
- import { cloneDeep, isEqual, map, uniq, sortBy } from "lodash-es";
9
-
10
-
11
- //sub-entries of anna lib import statement
12
- import { IGtGeneralConfig, IGtTableHeader, IHeaderInfo, ITotalRowInfo } from '../../../anna-core-shared-lib/models/anna-non-editable-gt-models';
13
- import { AnnaDateTimeFormatService, NgbDateType } from '../../../anna-core-shared-lib/services/anna-date-time-format.service';
14
- import { IWeekCalendar } from '../../../anna-core-shared-lib/models/anna-global-dropdown-config.model';
15
- import { GtColumnIconEmittedData, RatingSellerGroupHierarchy, } from '../../../anna-core-shared-lib/models/anna-generic-data-type.model';
16
- import { SortType, SortTypeEnum } from '../../../anna-core-shared-lib/models/anna-sort.model';
17
- import { radioButtonModel, TooltipModel } from '../../../anna-core-shared-lib/models/anna-tooltip.model';
18
- import { AnnaSortService } from '../../../anna-core-shared-lib/services/anna-sort.service';
19
- import { AnnaFilterService } from '../../../anna-core-shared-lib/services/anna-filter.service';
20
- import { BehaviorSubject } from 'rxjs';
21
- import { UserActivationStatus } from '../../../anna-core-shared-lib/models/anna-manage-users.model';
22
-
23
-
24
- @Component({
25
- selector: 'anna-core-non-editable-generic-table-lib',
26
- templateUrl: './anna-non-editable-generic-table.component.html',
27
- styleUrls: ['./anna-non-editable-generic-table.component.scss'],
28
- changeDetection: ChangeDetectionStrategy.OnPush
29
- })
30
- export class AnnaNonEditableGenericTableComponent implements OnInit, OnChanges, AfterViewChecked {
31
-
32
- @Input() showSkeletonLoading: boolean;
33
- @Input() tableHeaders: IGtTableHeader[];
34
- @Input() tableData: any[];
35
- @Input() clonedTableData: any[];
36
- @Input() gtGeneralConfig: IGtGeneralConfig;
37
- @Input() totalRowInfo?: ITotalRowInfo[];
38
- @Input() gtDimension: { rowHeight: number, headerHeight: number, dataOnTopHeight: number, marginFromBottom: number, tableHeight?: string};
39
- @Input() tableClass: string;
40
- @Input() maximumRowsWhichCanBeRenderedWithoutScroll: number = 5;
41
- @Input() limit: number = 30;
42
- @Input() includeBorderInTableHeight: boolean = true;
43
- @Input() downloadInProgress: boolean;
44
- @Input() percentDone: number;
45
- @Input() starredInProgress: boolean;
46
- @Input() clickableRow: boolean = false;
47
-
48
- @Output() toggleCheckbox = new EventEmitter();
49
- @Output() toggleRowCheckbox = new EventEmitter();
50
- @Output() toggleHeaderCheckbox = new EventEmitter();
51
- @Output() undoIconClicked = new EventEmitter();
52
- @Output() filterAppliedToTable = new EventEmitter();
53
- @Output() sortingAppliedToTable = new EventEmitter();
54
- @Output() rowClicked = new EventEmitter();
55
- @Output() radioButtonSelected = new EventEmitter();
56
- @Output() columnFilterOpened = new EventEmitter();
57
- @Output() columnFilterClosed = new EventEmitter();
58
- @Output() gtIconClicked = new EventEmitter();
59
- @Output() gtSVGIconClicked = new EventEmitter();
60
- @Output() gtTextActionClicked = new EventEmitter();
61
- @Output() gtViewDetailClicked = new EventEmitter();
62
- @Output() downloadSpotDetails = new EventEmitter();
63
- @Output() clickableDataClicked = new EventEmitter();
64
-
65
-
66
- numberOfSkeletonRows: number[][] = Array(10).fill(0);
67
- tableDataWrapper: any[];
68
- rowChecked: boolean;
69
- isAllRowsChecked: boolean;
70
- noDataWidth: string = "50%";
71
- markedForCreditStatus: string;
72
- markedForMGStatus: string;
73
-
74
- //Sort and Filter
75
- toolTipdata: any;
76
- tempTooltipData: any;
77
- tooltipRadioTextMap: Map<any, any>;
78
- filterTabObjects: any[];
79
- tooltip: any;
80
- clonedTooltipData: any;
81
- clonedTooltipSelectedMapData: any;
82
- searchBar: string;
83
- disableClearAllBtn: boolean = true;
84
- disableColumnClearAllBtn: boolean = true;
85
- allSelected = 0;
86
- showAll: boolean;
87
- disableCheckboxApply: boolean;
88
- disableSliderApplyButton: boolean;
89
- disableTimeApplyButton: boolean;
90
-
91
- // Slider Filter
92
- sliderMinValue: number;
93
- sliderMaxValue: number;
94
- options: Options = {
95
- floor: 0,
96
- ceil: 0,
97
- step: 0.1
98
- };
99
- sliderValue: { min: number, max: number };
100
- sliderFilterTextBoxStep: string;
101
- sliderEnteredMinValue: number;
102
- sliderEnteredMaxValue: number;
103
-
104
- // Calendar Filter
105
- calendarMinEnabledDate: NgbDateType;
106
- calendarMaxEnabledDate: NgbDateType;
107
- selectedMinDate: NgbDateType;
108
- selectedMaxDate: NgbDateType;
109
-
110
- //Week Filter
111
- multiWeekPickerConfig: IWeekCalendar;
112
-
113
- //Time Filter
114
- selectedFromTime: any[];
115
- selectedToTime: any[];
116
- clonedSelectedFromTime: any;
117
- clonedSelectedToTime: any;
118
- disableTimeFilterApplyBtn: boolean;
119
- tableColumns: string[] = [];
120
- totalRowColumns: string[] = null;
121
- showMultiTimeCheckbox: boolean;
122
- showZeroTimeCheckbox: boolean;
123
- showEnterTimeCheckbox: boolean;
124
- multiTimeCheckboxChecked: boolean;
125
- zeroTimeCheckboxChecked: boolean;
126
- enterTimeCheckboxChecked: boolean;
127
- bindValueFuncCalled: boolean;
128
-
129
- hierarchyTooltip: { open: () => void; close: () => void; };
130
- sellerGroupHierarchy: RatingSellerGroupHierarchy[];
131
- showFilterTooltipTabs: boolean; //Change the Name
132
-
133
- isScrolledLeft: boolean = false;
134
- rowBorderWidth: number = 2;
135
-
136
- showSortComponent: boolean = false;
137
- showFilterComponent: boolean = false;
138
- tempSortOrder: SortType = null;
139
-
140
- tooltipOptions: TooltipModel[];
141
- clonedTooltipOptions: TooltipModel[];
142
- disableSelectAll: boolean;
143
- disableClearAll: boolean;
144
- searchItem: string;
145
-
146
- disableCalendarApplyBtn: boolean;
147
- calendarSelection: any = {fromDate: null , toDate: null};
148
-
149
- showSliderMinValueError: boolean;
150
- showSliderMaxValueError: boolean;
151
- isMinTextBoxEmpty: boolean;
152
- isMaxTextBoxEmpty: boolean;
153
- selectedLabel: string;
154
-
155
- startTimeHourErr: boolean;
156
- startTimeMinErr: boolean;
157
- endTimeHourErr: boolean;
158
- endTimeMinErr: boolean;
159
-
160
- sameTooltipClicked: boolean;
161
- marginTop: string = "";
162
- @ViewChildren('tableHeader') viewChildTableHeaders: QueryList<ElementRef>;
163
-
164
- selectedCheckboxOptionsCount: number;
165
- isFilterChanged: boolean;
166
- isSortChanged: boolean;
167
- isDifferenceLessThan25Percent: boolean;
168
- incorrectSliderInput: boolean;
169
- start: number = 0;
170
- end: number = this.limit + this.start;
171
- renderedData: any[];
172
- selectedInventoryIdForDownload: number;
173
- selectedDemographicForDownload: any;
174
- selectedRowTypeForDownload: string;
175
- heightOfCheckboxTooltipFilter: number;
176
- isNoDataToDisplaySubject$ = new BehaviorSubject<boolean>(false);
177
- selectedStarredOrderId: string;
178
- userActionTableMetaData: { lastEmailResentAt: string; passwordValidity: string; status: UserActivationStatus};
179
- UserActivationStatus = UserActivationStatus;
180
-
181
- constructor(
182
- private cdRef: ChangeDetectorRef,
183
- private annaSortService: AnnaSortService,
184
- public annaDateTimeFormatService: AnnaDateTimeFormatService,
185
- public annaFilterService: AnnaFilterService
186
- ) {
187
- this.setTooltipRadioNames();
188
- }
189
-
190
- ngAfterViewChecked(): void {
191
- if(this.gtGeneralConfig.component && this.gtGeneralConfig.component.includes("ORDER_LISTING") || this.gtGeneralConfig.component == "DRRLISTING"){
192
- this.setMarginLeftForFilterIcon();
193
- }
194
- }
195
-
196
- ngOnInit() {
197
- }
198
-
199
- ngOnChanges(changes: SimpleChanges) {
200
- if(changes && changes["gtDimension"] && changes["gtDimension"].currentValue){
201
- this.setTableHeight();
202
- }
203
- if (this.showSkeletonLoading) {
204
- this.tableData = this.numberOfSkeletonRows;
205
- this.renderedData = this.numberOfSkeletonRows;
206
- this.isNoDataToDisplaySubject$.next(false);
207
- this.annaFilterService.initialValueMap = new Map();
208
- }
209
- else if(changes["percentDone"] || changes["downloadInProgress"] || ( changes["starredInProgress"] && changes["starredInProgress"].currentValue != undefined )){
210
- console.log("do nothing");
211
- }
212
- else {
213
- this.setInitialRowsForTable();
214
- this.disableEnableEachColumnTooltipIcon();
215
- this.tableColumns = this.tableHeaders.filter(x => x.visible).map(x => x.headerInfo[0].objectKey);
216
- if(this.tableData && this.tableData.length == 0){
217
- this.tableData = Array(2).fill(0);
218
- this.renderedData = cloneDeep(this.tableData);
219
- this.marginTop = (- this.gtDimension.rowHeight - (this.gtDimension.rowHeight/2)) + 'px';
220
- this.isNoDataToDisplaySubject$.next(true);
221
- }
222
- else{
223
- this.isNoDataToDisplaySubject$.next(false);
224
- }
225
-
226
- this.showSkeletonLoading = false;
227
- }
228
-
229
- //setting table column here as well because while showing skeleton loader, we should show table headers.
230
- if (changes['tableHeaders'] && !isEqual(changes['tableHeaders'].currentValue, changes['tableHeaders'].previousValue)) {
231
- this.tableColumns = this.tableHeaders.filter(x => x.visible).map(x => x.headerInfo[0].objectKey);
232
- this.annaSortService.columnSortState = new Map();
233
- // this.setColumnSortStateMap();
234
- this.setActiveStateObject();
235
- }
236
-
237
- if (changes['totalRowInfo'] && changes['totalRowInfo'].currentValue) {
238
- this.totalRowColumns = this.totalRowInfo.map(x => x.colName);
239
- }
240
- this.cdRef.detectChanges();
241
- }
242
-
243
- setTableHeight(){
244
- let viewportHeight = window.innerHeight;
245
- let rowHeight = this.gtDimension.rowHeight;
246
- let headerHeight = this.gtDimension.headerHeight;
247
- let dataOnTopHeight = this.gtDimension.dataOnTopHeight;
248
- let marginFromBottom = this.gtDimension.marginFromBottom;
249
-
250
- let heightLeftForTable = viewportHeight - dataOnTopHeight - marginFromBottom;
251
- this.maximumRowsWhichCanBeRenderedWithoutScroll =
252
- Math.floor((heightLeftForTable - headerHeight - rowHeight) / rowHeight) + 1;
253
- let actualTableHeight = heightLeftForTable - ((heightLeftForTable - headerHeight - rowHeight) % rowHeight);
254
- this.gtDimension.tableHeight = `${actualTableHeight}px`;
255
-
256
- this.numberOfSkeletonRows = Array(this.maximumRowsWhichCanBeRenderedWithoutScroll).fill(0);
257
- }
258
-
259
-
260
- trackByFn(index: number) {
261
- return index;
262
- }
263
-
264
- setTooltipRadioNames() {
265
- this.tooltipRadioTextMap = new Map();
266
- this.tooltipRadioTextMap.set("StartTimeForFilter", "Start Time");
267
- this.tooltipRadioTextMap.set("EndTimeForFilter", "End Time");
268
- this.tooltipRadioTextMap.set("start_time_for_filter", "Start Time");
269
- this.tooltipRadioTextMap.set("end_time_for_filter", "End Time");
270
- this.tooltipRadioTextMap.set("primaryAEName", "Primary AE");
271
- this.tooltipRadioTextMap.set("region", "Region");
272
- this.tooltipRadioTextMap.set("agencyName", "Agency");
273
- this.tooltipRadioTextMap.set("location", "Location");
274
- this.tooltipRadioTextMap.set("advertiserName", "Advertiser");
275
- this.tooltipRadioTextMap.set("productCode", "Product Category");
276
- this.tooltipRadioTextMap.set("flightStartDate", "Start Date");
277
- this.tooltipRadioTextMap.set("flightEndDate", "End Date");
278
- this.tooltipRadioTextMap.set("orderIdAndRevNumber", "STN Order#-Rev#");
279
- this.tooltipRadioTextMap.set("alternateOrderId", "Alt/Rep Order #");
280
- this.tooltipRadioTextMap.set("grp", "GRP");
281
- this.tooltipRadioTextMap.set("cpp", "CPP");
282
- this.tooltipRadioTextMap.set("imps", "IMPS");
283
- this.tooltipRadioTextMap.set("cpm", "CPM");
284
- this.tooltipRadioTextMap.set("offeredMGs", "Offered MG");
285
- this.tooltipRadioTextMap.set("outstandingPE", "O/S PE");
286
- this.tooltipRadioTextMap.set("offeredADUs", "Offered ADUs");
287
- this.tooltipRadioTextMap.set("udDeficitValue", "O/S Aud Delta");
288
- this.tooltipRadioTextMap.set("startEndTimeMulti", "Time");
289
- this.tooltipRadioTextMap.set("bookedValue", "Booked");
290
- this.tooltipRadioTextMap.set("bookedSpots", "Spots");
291
- this.tooltipRadioTextMap.set("userChanges", "User Changes");
292
- this.tooltipRadioTextMap.set("buyerChanges", "Buyer Changes");
293
- this.tooltipRadioTextMap.set("userMG", "User MG");
294
- this.tooltipRadioTextMap.set("userADUs", "User ADUs");
295
- this.tooltipRadioTextMap.set("inventoryCode", "Inventory Code");
296
- this.tooltipRadioTextMap.set("program", "Program");
297
- this.tooltipRadioTextMap.set("agency", "Agency");
298
- this.tooltipRadioTextMap.set("advertiser", "Advertiser");
299
- this.tooltipRadioTextMap.set("startDate", "Start Date");
300
- this.tooltipRadioTextMap.set("endDate", "End Date");
301
- this.tooltipRadioTextMap.set("date", "Date");
302
- this.tooltipRadioTextMap.set("rcvPreempt", "$ Madegood PEs");
303
- this.tooltipRadioTextMap.set("osPreempt", "$ O/S PEs");
304
- this.tooltipRadioTextMap.set("rcvUnderDly", "Recovered UD");
305
- this.tooltipRadioTextMap.set("osUnderDly", "O/s Under Dly");
306
- this.tooltipRadioTextMap.set("primaryAe", "Primary AE");
307
- this.tooltipRadioTextMap.set("region", "Region");
308
- this.tooltipRadioTextMap.set("revCode1", "Rev code 1");
309
- this.tooltipRadioTextMap.set("orderNoRevNo", "STN Order#-Rev#");
310
- this.tooltipRadioTextMap.set("revCode2", "Rev code 2");
311
- this.tooltipRadioTextMap.set("revCode3", "Rev code 3");
312
- this.tooltipRadioTextMap.set("booked", "$ Booked");
313
- this.tooltipRadioTextMap.set("spots", "Spots");
314
- this.tooltipRadioTextMap.set("postedAudPercent", "Posted %");
315
- this.tooltipRadioTextMap.set("revision", "Revision");
316
- this.tooltipRadioTextMap.set("buyerOrderId", "ALT/REP Order#");
317
- this.tooltipRadioTextMap.set("demo","Demo");
318
- this.tooltipRadioTextMap.set("postedAdu","$ Posted ADUs");
319
- this.tooltipRadioTextMap.set("scheduledAdu","$ Scheduled ADUs");
320
- this.tooltipRadioTextMap.set("audienceDeficit","$ O/S Audience");
321
- this.tooltipRadioTextMap.set("postedAudPercent","Posted Audience %");
322
- this.tooltipRadioTextMap.set("potentialUnitsValue","POT Units");
323
- this.tooltipRadioTextMap.set("bookedUnitsValue","Booked Units");
324
- this.tooltipRadioTextMap.set("bookedAmountWithZeroRatingValue","Total $ Booked");
325
- this.tooltipRadioTextMap.set("bookedAmountPercentageWithZeroRatingValue","% Against All Demos");
326
- this.tooltipRadioTextMap.set("bookedAmountWithoutZeroRatingValue","$Booked With Imps(’000)");
327
- this.tooltipRadioTextMap.set("bookedAmountPercentageWithoutZeroRatingValue", "% Against All Demos");
328
-
329
- this.tooltipRadioTextMap.set("totalBookedAmountValue","Total $Booked");
330
- this.tooltipRadioTextMap.set("averageUnitRateValue","AUR");
331
- this.tooltipRadioTextMap.set("totalBookedAmountWithRatingValue", "$Booked With Rating");
332
- this.tooltipRadioTextMap.set("averageUnitRateWithRatingValue", "AUR With Rating");
333
-
334
- this.tooltipRadioTextMap.set("totalBookedAmountWithImpressionValue", "$Booked With IMPS");
335
- this.tooltipRadioTextMap.set("averageUnitRateWithImpressionValue", "AUR With IMPS");
336
-
337
- this.tooltipRadioTextMap.set("bookedUnitsWithRatingValue", "Booked Units With Rating");
338
- this.tooltipRadioTextMap.set("postedUnitsWithRatingValue", "Posted Units With Rating");
339
-
340
- this.tooltipRadioTextMap.set("bookedUnitsWithImpressionValue", "Booked Units With IMPS");
341
- this.tooltipRadioTextMap.set("postedUnitsWithImpressionValue", "Posted Units With IMPS");
342
-
343
- this.tooltipRadioTextMap.set("bookedRatings", "Booked Rating");
344
- this.tooltipRadioTextMap.set("postedRatings", "Posted Rating");
345
-
346
- this.tooltipRadioTextMap.set("bookedImpressions", "Booked IMPS");
347
- this.tooltipRadioTextMap.set("postedImpressions", "Posted IMPS");
348
-
349
- this.tooltipRadioTextMap.set("bookedAverageRating", "Booked AVG Rating");
350
- this.tooltipRadioTextMap.set("postedAverageRating", "Posted AVG Rating");
351
-
352
- this.tooltipRadioTextMap.set("bookedAverageImpression", "Booked AVG IMPS");
353
- this.tooltipRadioTextMap.set("postedAverageImpression", "Posted AVG IMPS");
354
-
355
- this.tooltipRadioTextMap.set("bookedCppValue", "Booked CPP");
356
- this.tooltipRadioTextMap.set("bookedEffectiveCppValue", "Effective CPP");
357
-
358
- this.tooltipRadioTextMap.set("bookedCpmValue", "Booked CPM");
359
- this.tooltipRadioTextMap.set("bookedEffectiveCpmValue", "Effective CPM");
360
-
361
- this.tooltipRadioTextMap.set("orderSource","Order Route");
362
- this.tooltipRadioTextMap.set("orderCategory","Rev Category");
363
- this.tooltipRadioTextMap.set("cashOrTrade","C/T");
364
- this.tooltipRadioTextMap.set("revisionStartDate", "Revision Start Date");
365
- this.tooltipRadioTextMap.set("name", "name");
366
- this.tooltipRadioTextMap.set("role", "role");
367
- this.tooltipRadioTextMap.set("stationCount", "stationCount");
368
- this.tooltipRadioTextMap.set("stationList", "stationList");
369
-
370
- this.tooltipRadioTextMap.set("ODImps","OD IMPS");
371
- this.tooltipRadioTextMap.set("UDImps","UD IMPS");
372
- this.tooltipRadioTextMap.set("ODGrp","OD GRP");
373
- this.tooltipRadioTextMap.set("UDGrp","UD GRP");
374
- this.tooltipRadioTextMap.set("udImpsPercent","UD IMPS %");
375
- this.tooltipRadioTextMap.set("udGrpPercent","UD GRP %");
376
- this.tooltipRadioTextMap.set("odImpsPercent","OD IMPS %");
377
- this.tooltipRadioTextMap.set("odGrpPercent","OD GRP %");
378
- }
379
-
380
- generateTableDataWrapper() {
381
- this.showSkeletonLoading = true;
382
- this.tableDataWrapper = [];
383
- let rowObject: any;
384
- let columnName: string;
385
- let columnObject: { [x: string]: any; };
386
- let columnObjectKey;
387
- let keysUsedForTableDisplay: string[];
388
- let keysUsedForColumn: string[];
389
- let additionalInfoObject: { [x: string]: any; };
390
- let additionalKeys;
391
- this.tableData.forEach((obj: { [x: string]: any; }) => {
392
- rowObject = {};
393
- keysUsedForTableDisplay = [];
394
- for (var colNum in this.tableHeaders) {
395
- columnObject = {};
396
- if (!this.tableHeaders[colNum].visible) {
397
- continue;
398
- }
399
- columnName = "";
400
- keysUsedForColumn = [];
401
- this.tableHeaders[colNum].headerInfo.forEach((header) => {
402
- if (header.typeOfBodyData === "STRING") {
403
- columnObjectKey = header.objectKey;
404
- columnObject[columnObjectKey] = obj[columnObjectKey];
405
- keysUsedForTableDisplay.push(columnObjectKey);
406
- keysUsedForColumn.push(columnObjectKey);
407
- }
408
- else if (header.typeOfBodyData === "ICON") {
409
- columnObjectKey = header.typeOfBodyData;
410
- columnObject[columnObjectKey] = obj[header.objectKey];
411
- keysUsedForColumn.push(header.objectKey);
412
- }
413
- else if (header.typeOfBodyData === "CHECKBOX") {
414
- columnObjectKey = header.typeOfBodyData;
415
- columnObject[columnObjectKey] = obj[header.objectKey];
416
- keysUsedForColumn.push(header.objectKey);
417
- }
418
- })
419
- for (var i = 0; i < keysUsedForColumn.length; i++) {
420
- columnName += keysUsedForColumn[i];
421
- if (i !== keysUsedForColumn.length - 1) {
422
- columnName += ',';
423
- }
424
- }
425
- rowObject[columnName] = columnObject;
426
- }
427
- additionalInfoObject = {};
428
- additionalKeys = Object.keys(obj).filter(key => !keysUsedForTableDisplay.includes(key));
429
- additionalKeys.forEach(key => {
430
- additionalInfoObject[key] = obj[key];
431
- })
432
- rowObject.AdditionalInfo = additionalInfoObject;
433
- this.tableDataWrapper.push(rowObject);
434
- })
435
- this.tableData = this.tableDataWrapper;
436
- this.showSkeletonLoading = false;
437
- }
438
-
439
-
440
- selectOrUnselectCheckbox(rowData: any, columnKeys: any, isCheckboxSelected: any) {
441
- this.toggleCheckbox.emit({ rowData, columnKeys, isCheckboxSelected });
442
- }
443
-
444
- selectUnselectAllRows() {
445
- this.toggleHeaderCheckbox.emit();
446
- }
447
-
448
- selectUnselectRow(rowData: any) {
449
- this.toggleRowCheckbox.emit(rowData);
450
- }
451
-
452
- undoCreditedSpot(data: any) {
453
- this.undoIconClicked.emit({ data, mgOrCredit: "Credit" });
454
- }
455
-
456
- undoMgSpot(data: any) {
457
- this.undoIconClicked.emit({ data, mgOrCredit: "MakeGood" });
458
- }
459
-
460
- //Sort and Filter Logic begins!
461
- closeTooltip() {
462
- if (this.tooltip && this.tooltip.isOpen()) {
463
- this.tooltip.close();
464
- }
465
- this.tooltip = null;
466
- this.disableCheckboxApply = false;
467
- if (!this.bindValueFuncCalled) {
468
- this.columnFilterClosed.emit();
469
- }
470
- }
471
-
472
- isTooltipActive(header: any[]) {
473
- return this.annaFilterService.isTooltipActive(header,this.annaSortService.columnSortState);
474
- }
475
-
476
- bindTheValueToToolTip(tooltip: any, header: IHeaderInfo) {
477
-
478
- this.bindValueFuncCalled = true;
479
- let containerToScroll;
480
- if (this.gtGeneralConfig.component === "SPOTDETAILS" || this.gtGeneralConfig.component === "DRRLISTING") {
481
- containerToScroll = document.getElementsByClassName("scrollable-container")[0];
482
- var mediaQuery = window.matchMedia("(max-width: 1366px)");
483
- if (mediaQuery.matches) {
484
- containerToScroll.scroll(0, this.gtGeneralConfig.verticalScrollOffsetForFilterTooltip);
485
- }
486
- }
487
-
488
- // if same tooltip opened close it
489
- if (tooltip == this.tooltip) {
490
- this.bindValueFuncCalled = false;
491
- this.closeTooltip();
492
- }
493
- else {
494
- let enabledHeaders: any[] = [];
495
- this.checkIfUniqueValuePresentForTheHeader(header,enabledHeaders);
496
- this.openTooltip(tooltip, enabledHeaders,header);
497
-
498
- if (window.innerWidth < 1500 && window.innerHeight < 768 && !this.annaFilterService.sliderSet.has(header.filterSortObjectKeys[0])) {
499
- this.columnFilterOpened.emit();
500
- }
501
-
502
- this.showFilterTooltipTabs = header.filterSortObjectKeys.length > 1;
503
- let activeTab = this.filterTabObjects[0];
504
- this.populateTooltipDataBasedOnSelectedRadio(activeTab);
505
- this.bindValueFuncCalled = false;
506
- }
507
- }
508
-
509
- checkIfUniqueValuePresentForTheHeader(header: IHeaderInfo, enabledHeaders: any[]){
510
- header.filterSortObjectKeys.forEach((item: string) => {
511
- let dataToCheck = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData, item);
512
- if(item == "period"){
513
- let uniqStartDate = uniq(dataToCheck.map((u: { [x: string]: any; }) => u["startDate"]));
514
- let uniqEndDate = uniq(dataToCheck.map((u:{ [x: string]: any; }) => u["endDate"]));
515
- if(uniqStartDate.length > 1 || uniqEndDate.length > 1 || this.isTooltipActive([item])){
516
- enabledHeaders.push(item);
517
- }
518
- }
519
-
520
- else{
521
- let values = dataToCheck.map((u: { [x: string]: any; }) => u[item]);
522
- // if last applied filter is this header, push it alos as enabledHeader
523
- let activeAndLastlyAppliedHeader = false;
524
- if(this.annaFilterService.appliedFiltersArray.length > 0 &&
525
- this.annaFilterService.appliedFiltersArray[this.annaFilterService.appliedFiltersArray.length-1] == item){
526
- activeAndLastlyAppliedHeader = true;
527
- }
528
- if(header.filter == "CHECKBOX" && (uniq(values).filter(n => n!=null).length > 1 || activeAndLastlyAppliedHeader)){
529
- enabledHeaders.push(item);
530
- }
531
- else if(header.filter != "CHECKBOX" && (uniq(values).filter(n => n!=null && n!="-").length > 1 || activeAndLastlyAppliedHeader)){
532
- enabledHeaders.push(item);
533
- }
534
- }
535
- });
536
- }
537
-
538
- openTooltip(tooltip: any,header: any, columnHeader: IHeaderInfo) {
539
- this.closeTooltip();
540
- this.tooltip = tooltip;
541
- this.tooltip.open();
542
- //convert key into the header
543
- this.filterTabObjects = header.map((key: string,index: number) => {
544
- let value = this.tooltipRadioTextMap.has(key)
545
- ? this.tooltipRadioTextMap.get(key)
546
- : key; //change to display name
547
- return new radioButtonModel(key, value, columnHeader.isSortRequired[index], columnHeader.isFilterRequired[index]);
548
- });
549
- }
550
-
551
- clearColumnFilter() {
552
- this.annaFilterService.clearColumnFilter();
553
- this.closeTooltip();
554
- this.tableData = cloneDeep(this.annaFilterService.filterData(this.clonedTableData, ""));
555
- this.annaSortService.noSortingAppliedData = this.tableData;
556
- this.checkIfSortingIsApplied();
557
- this.filterAppliedToTable.emit(this.tableData);
558
- this.disableEnableEachColumnTooltipIcon();
559
- this.annaFilterService.updateStateOfTheCurrentFilterTab(this.annaSortService.columnSortState);
560
- this.cdRef.detectChanges();
561
- }
562
-
563
- populateTooltipDataBasedOnSelectedRadio(activeTab: radioButtonModel) {
564
-
565
- let header = activeTab.key;
566
- this.selectedLabel = activeTab.label;
567
- this.showSortComponent = false;
568
- this.showFilterComponent = false;
569
- this.searchItem = null;
570
-
571
- this.showSortComponent = activeTab.isSortRequired;
572
- this.showFilterComponent = activeTab.isFilterRequired;
573
- this.tempSortOrder = null;
574
- this.isFilterChanged = false;
575
- this.isSortChanged = false;
576
-
577
- this.annaFilterService.selectedRadio = header;
578
- this.disableActiveFilterClearButton();
579
-
580
- this.createFilterTooltipData(header);
581
-
582
- }
583
-
584
- createFilterTooltipData(header: string){
585
- if(this.showFilterComponent){
586
- this.disableSliderApplyButton = this.disableCheckboxApply = true;
587
- this.disableCalendarApplyBtn = this.disableTimeFilterApplyBtn = true;
588
-
589
- if (this.annaFilterService.calendarSet.has(header)) {
590
- this.getCalendarData();
591
- } else if (this.annaFilterService.sliderSet.has(header)) {
592
- this.getSliderData(header);
593
- } else if (this.annaFilterService.timeSet.has(header)) {
594
- this.getTimeFilterData(header);
595
- } else {
596
- this.getCheckboxData(header);
597
- }
598
- }
599
- else if(this.showSortComponent){
600
- this.disableSliderApplyButton = this.disableCheckboxApply = true;
601
- this.disableCalendarApplyBtn = this.disableTimeFilterApplyBtn = true;
602
- }
603
- }
604
-
605
- disableActiveFilterClearButton(){
606
- let selectedFilterSet = new Set(this.annaFilterService.appliedFiltersArray);
607
-
608
- let currentColumnSortFilter = this.getColumnSortStateForSelectedRadio();
609
- let isSortPresent = (this.annaSortService.columnSortState.size > 0 && currentColumnSortFilter != SortTypeEnum.DEFAULT);
610
-
611
- this.disableColumnClearAllBtn = selectedFilterSet.has(this.annaFilterService.selectedRadio) || isSortPresent ? false : true;
612
- }
613
-
614
- getSliderData(header: string) {
615
-
616
- this.createOptionsForSlider(header);
617
- this.setSelectedRangeForSlider(header);
618
- }
619
-
620
- createOptionsForSlider(header: string){
621
-
622
- let translateFunc;
623
- this.incorrectSliderInput = false;
624
- this.sliderEnteredMaxValue = this.sliderEnteredMinValue = null;
625
- this.showSliderMinValueError = this.showSliderMaxValueError = this.isMinTextBoxEmpty = this.isMaxTextBoxEmpty = false;
626
-
627
- if (this.annaFilterService.sliderCurrencySet.has(header)) {
628
- translateFunc = "currency";
629
- }
630
- else if(header == "postedAudPercent"){
631
- translateFunc = "percent";
632
- }
633
- else {
634
- translateFunc = "normal";
635
- }
636
-
637
- let optionsData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
638
- let minValue = this.annaFilterService.returnMaxAndMinValue(optionsData, header, true);
639
- let maxValue = this.annaFilterService.returnMaxAndMinValue(optionsData, header, false);
640
-
641
- let obj = this.annaFilterService.setOptionValues(minValue,maxValue);
642
-
643
- if (translateFunc === "normal") {
644
- obj.translate = this.annaFilterService.normalTranslateFunction;
645
- } else if (translateFunc === "percent") {
646
- obj.translate = this.annaFilterService.percentTranslateFunction;
647
- } else if (translateFunc === "currency") {
648
- obj.translate = this.annaFilterService.currencyTranslateFunction;
649
- }
650
-
651
- this.options = obj;
652
- this.options.step = 1;
653
- this.sliderFilterTextBoxStep = "1";
654
- if (header !== "WeekNumber") {
655
- this.options.step = 0.1;
656
- this.sliderFilterTextBoxStep = "0.1";
657
- }
658
- }
659
-
660
- setSelectedRangeForSlider(header: string){
661
- if(this.annaFilterService.tooltipSelectedMap.has(header)){
662
- let selectedObj = this.annaFilterService.tooltipSelectedMap.get(header);
663
- this.sliderMinValue = selectedObj.min < this.options.floor ? this.options.floor : selectedObj.min;
664
- this.sliderMaxValue = selectedObj.max < this.options.ceil ? selectedObj.max : this.options.ceil;
665
- this.sliderEnteredMinValue = this.sliderMinValue;
666
- this.sliderEnteredMaxValue = this.sliderMaxValue;
667
- }
668
- else{
669
- this.sliderMinValue = this.options.floor;
670
- this.sliderMaxValue = this.options.ceil;
671
- }
672
- this.sliderEnteredMinValue = this.sliderMinValue;
673
- this.sliderEnteredMaxValue = this.sliderMaxValue;
674
- }
675
-
676
-
677
- getCheckboxData(header: string) {
678
-
679
- let tooltipOptions = this.createListForCheckboxFilter(header);
680
- let selectedItems = sortBy(tooltipOptions.filter(item => item.isSelected),"label");
681
- let unselectedItems = sortBy(tooltipOptions.filter(item => !item.isSelected),"label");
682
-
683
- this.clonedTooltipOptions = [...selectedItems, ...unselectedItems];
684
-
685
- this.tooltipOptions = cloneDeep(this.clonedTooltipOptions);
686
-
687
- let margin = 5;
688
- let dataLength = this.tooltipOptions.length;
689
- this.heightOfCheckboxTooltipFilter = dataLength > 6 ? 200 : ((26.03 * dataLength) + (margin * dataLength) + margin);
690
-
691
- this.disableSelectAll = unselectedItems.length == 0;
692
- this.disableClearAll = selectedItems.length == 0;
693
- this.selectedCheckboxOptionsCount = selectedItems.length;
694
- }
695
-
696
- createListForCheckboxFilter(header: string){
697
- let optionData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
698
- let uniqOptionData = uniq(optionData.map(item => item[header]));
699
- let tooltipOptions = uniqOptionData.map((item,index) => new TooltipModel(item,index+1));
700
-
701
- this.selectUnselectListCheckbox(tooltipOptions,header);
702
- let index = tooltipOptions.findIndex(item => item.value == null);
703
-
704
- if(index != -1){
705
- tooltipOptions[index].label = "(Blank)";
706
- }
707
-
708
- return tooltipOptions;
709
- }
710
-
711
- selectUnselectListCheckbox(tooltipOptions: TooltipModel[],header: string){
712
-
713
- if(this.annaFilterService.tooltipSelectedMap.has(header)){
714
- let selectedValueSet = new Set(this.annaFilterService.tooltipSelectedMap.get(header));
715
- tooltipOptions.forEach(item => item.isSelected = selectedValueSet.has(item.value) ? true : false);
716
- }
717
- else{
718
- tooltipOptions.forEach(item => item.isSelected = true);
719
- }
720
-
721
- }
722
-
723
- getCalendarData() {
724
- const parsingFormat = "MM/DD/YYYY";
725
- let minMaxDate = this.createRangeForTheDateFilter();
726
- this.selectRangeForTheDateFilter(minMaxDate, parsingFormat);
727
- }
728
-
729
- createRangeForTheDateFilter(){
730
-
731
- let optionData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
732
-
733
- let minMaxDate;
734
- //When you want to use startDate and endDate combined as single column then use Period.
735
- if(this.annaFilterService.selectedRadio == "period"){
736
- minMaxDate = this.createStartEndDateRange(optionData);
737
- }
738
- else{
739
- minMaxDate = this.annaFilterService.returnMinAndMaxDate(optionData, this.annaFilterService.selectedRadio);
740
- }
741
-
742
- return minMaxDate;
743
-
744
- }
745
-
746
- createStartEndDateRange(optionData: any[]){
747
- let minStartDate = this.annaFilterService.returnMinAndMaxDate(optionData, "startDate");
748
- let maxEndDate = this.annaFilterService.returnMinAndMaxDate(optionData,"endDate");
749
- return [minStartDate[0],maxEndDate[1]];
750
- }
751
-
752
- selectRangeForTheDateFilter(minMaxDate: any[], parsingFormat: string){
753
- this.calendarMinEnabledDate = this.annaDateTimeFormatService.convertToNgbDate(minMaxDate[0],parsingFormat);
754
- this.calendarMaxEnabledDate = this.annaDateTimeFormatService.convertToNgbDate(minMaxDate[1],parsingFormat);
755
-
756
-
757
- if(this.annaFilterService.tooltipSelectedMap.has(this.annaFilterService.selectedRadio)){
758
- let selectedDateObj = this.annaFilterService.tooltipSelectedMap.get(this.annaFilterService.selectedRadio);
759
-
760
- if(selectedDateObj.fromDate.isAfter(minMaxDate[0])){
761
- this.selectedMinDate = this.annaDateTimeFormatService.convertToNgbDate(selectedDateObj.fromDate,parsingFormat);
762
- }
763
- else{
764
- this.selectedMinDate = this.annaDateTimeFormatService.convertToNgbDate(minMaxDate[0],parsingFormat);
765
- }
766
-
767
- if(selectedDateObj.toDate.isAfter(minMaxDate[1])){
768
- this.selectedMaxDate = this.annaDateTimeFormatService.convertToNgbDate(minMaxDate[1],parsingFormat);
769
- }
770
- else{
771
- this.selectedMaxDate = this.annaDateTimeFormatService.convertToNgbDate(selectedDateObj.toDate,parsingFormat);
772
- }
773
-
774
- }
775
- else{
776
- this.selectedMinDate = cloneDeep(this.calendarMinEnabledDate);
777
- this.selectedMaxDate = cloneDeep(this.calendarMaxEnabledDate);
778
- }
779
-
780
- this.calendarSelection.fromDate = cloneDeep(this.selectedMinDate);
781
- this.calendarSelection.toDate = cloneDeep(this.selectedMaxDate);
782
-
783
-
784
- }
785
-
786
- getTimeFilterData(header: string): void {
787
-
788
- this.startTimeHourErr = this.startTimeMinErr = this.endTimeHourErr = this.endTimeMinErr = false;
789
-
790
- if (this.annaFilterService.tooltipSelectedMap.has(header)) {
791
- this.selectedFromTime = this.annaFilterService.tooltipSelectedMap.get(header).fromTime;
792
- this.selectedToTime = this.annaFilterService.tooltipSelectedMap.get(header).toTime;
793
- } else {
794
- this.setInitialValueMapForTimeFilter(header);
795
- this.selectedFromTime = this.annaFilterService.initialValueMap.get(header).fromTime;
796
- this.selectedToTime = this.annaFilterService.initialValueMap.get(header).toTime;
797
- }
798
-
799
- if(this.selectedFromTime != undefined || this.selectedToTime != undefined) {
800
- this.selectedFromTime = this.annaDateTimeFormatService.formatToTwelveHrs(this.selectedFromTime, true);
801
- this.selectedToTime = this.annaDateTimeFormatService.formatToTwelveHrs(this.selectedToTime, true);
802
-
803
- this.clonedSelectedFromTime = cloneDeep(this.selectedFromTime);
804
- this.clonedSelectedToTime = cloneDeep(this.selectedToTime);
805
- }
806
- else {
807
- this.selectedFromTime = ["-", "-", "-"];
808
- this.selectedToTime = ["-", "-", "-"];
809
- }
810
-
811
- if(this.gtGeneralConfig.component === "SPOTDETAILS" || this.gtGeneralConfig.component === "EXCLUDEINVENTORYPOPUP" || this.gtGeneralConfig.component === "ACTIVITYLOG") {
812
- this.setTimeFilterDataForComponentsOtherThanRatingsPage(header);
813
- }
814
- else if(this.gtGeneralConfig.component === "RATING"){
815
- this.setTimeFilterDataForRatingPageComponent(header);
816
- }
817
- }
818
-
819
- //Need to change this method
820
- setTimeFilterDataForComponentsOtherThanRatingsPage(header: string){
821
- this.showMultiTimeCheckbox = false;
822
- this.showZeroTimeCheckbox = false;
823
- this.showEnterTimeCheckbox = false;
824
- this.multiTimeCheckboxChecked = false;
825
- this.zeroTimeCheckboxChecked = false;
826
- this.enterTimeCheckboxChecked = false;
827
-
828
-
829
- let optionsData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
830
- let selectedObj;
831
-
832
- if(this.annaFilterService.tooltipSelectedMap.has(header)){
833
- selectedObj = this.annaFilterService.tooltipSelectedMap.get(header);
834
- }
835
- else{
836
- selectedObj = this.annaFilterService.initialValueMap.get(header);
837
- }
838
-
839
- if(optionsData.findIndex(obj => obj[header] == "0") != -1) {
840
- this.showZeroTimeCheckbox = true;
841
- this.zeroTimeCheckboxChecked = selectedObj.includeZeroTime;
842
- }
843
-
844
-
845
- if(optionsData.findIndex(obj => obj[header] == "<multi>") != -1) {
846
- this.showMultiTimeCheckbox = true;
847
- this.multiTimeCheckboxChecked = selectedObj.includeMulti;
848
- }
849
-
850
-
851
- if(this.showZeroTimeCheckbox || this.showMultiTimeCheckbox) {
852
- this.showEnterTimeCheckbox = true;
853
- }
854
-
855
- if(optionsData.findIndex(obj => obj[header] != "<multi>" && obj[header] != "0") != -1) {
856
- this.enterTimeCheckboxChecked = selectedObj.includeTimeRange;
857
- }
858
- }
859
-
860
- setTimeFilterDataForRatingPageComponent(header: string){
861
- this.showMultiTimeCheckbox = false;
862
- this.showZeroTimeCheckbox = false;
863
- this.showEnterTimeCheckbox = false;
864
- this.multiTimeCheckboxChecked = false;
865
- this.zeroTimeCheckboxChecked = false;
866
- this.enterTimeCheckboxChecked = false;
867
-
868
- let optionsData = this.annaFilterService.getFilterOptionsData(this.tableData, this.clonedTableData);
869
- let selectedObj;
870
-
871
- if(this.annaFilterService.tooltipSelectedMap.has(header)){
872
- selectedObj = this.annaFilterService.tooltipSelectedMap.get(header);
873
- }
874
- else{
875
- selectedObj = this.annaFilterService.initialValueMap.get(header);
876
- }
877
-
878
- if(optionsData.findIndex(obj => obj[header][0] == "0") != -1) {
879
- this.showZeroTimeCheckbox = true;
880
- this.zeroTimeCheckboxChecked = selectedObj.includeZeroTime;
881
- }
882
-
883
-
884
- if(optionsData.findIndex(obj => obj[header][0] == "<multi>") != -1) {
885
- this.showMultiTimeCheckbox = true;
886
- this.multiTimeCheckboxChecked = selectedObj.includeMulti;
887
- }
888
-
889
-
890
- if(this.showZeroTimeCheckbox || this.showMultiTimeCheckbox) {
891
- this.showEnterTimeCheckbox = true;
892
- }
893
-
894
- if(optionsData.findIndex(obj => obj[header][0] != "<multi>" && obj[header][0] != "0") != -1) {
895
- this.enterTimeCheckboxChecked = selectedObj.includeTimeRange;
896
- }
897
- }
898
-
899
- selectOrUnselectMultiTimeCheckbox() {
900
- this.multiTimeCheckboxChecked = !this.multiTimeCheckboxChecked;
901
- this.disableTimeFilterApplyButton();
902
- }
903
-
904
- selectOrUnselectZeroTimeCheckbox() {
905
- this.zeroTimeCheckboxChecked = !this.zeroTimeCheckboxChecked;
906
- this.disableTimeFilterApplyButton();
907
- }
908
-
909
- selectOrUnselectEnterTimeCheckbox() {
910
- this.enterTimeCheckboxChecked = !this.enterTimeCheckboxChecked;
911
- this.disableTimeFilterApplyButton();
912
- }
913
-
914
-
915
- selectUnselectCheckbox(data: TooltipModel) {
916
- data.isSelected = !data.isSelected;
917
- let index = this.clonedTooltipOptions.findIndex(item => item.id == data.id);
918
- this.clonedTooltipOptions[index].isSelected = data.isSelected;
919
-
920
- let selectedItems = this.tooltipOptions.filter(item => item.isSelected);
921
- let unselectedItems = this.tooltipOptions.filter(item => !item.isSelected);
922
-
923
- this.disableClearAll = selectedItems.length == 0;
924
- this.disableSelectAll = unselectedItems.length == 0;
925
- this.selectedCheckboxOptionsCount = selectedItems.length;
926
- this.disableCheckboxFilterApplyButton();
927
- }
928
-
929
- minValueChanged(val: string) {
930
- if (val || val == '0') {
931
- this.sliderEnteredMinValue = parseInt(val);
932
- this.isMinTextBoxEmpty = false;
933
- if (this.isMaxTextBoxEmpty) {
934
- if ( (this.sliderEnteredMinValue > this.options.ceil) || (this.sliderEnteredMinValue < this.options.floor)) {
935
- this.showSliderMinValueError = true;
936
- this.disableSliderApplyButton = true;
937
- this.incorrectSliderInput = true;
938
- } else {
939
- this.showSliderMinValueError = false;
940
- this.showSliderMaxValueError = false;
941
- this.disableSliderApplyButton = false;
942
- this.incorrectSliderInput = false;
943
- }
944
- } else if (this.sliderEnteredMinValue > this.sliderEnteredMaxValue) {
945
- if(this.isValueInRange(this.sliderEnteredMaxValue)){
946
- this.showSliderMinValueError = true;
947
- this.showSliderMaxValueError = false;
948
- }
949
- else{
950
- this.showSliderMaxValueError = true;
951
- if(this.isValueInRange(this.sliderEnteredMinValue)){
952
- this.showSliderMinValueError = false;
953
- }
954
- else{
955
- this.showSliderMinValueError = true;
956
- }
957
-
958
- }
959
- this.disableSliderApplyButton = true;
960
- this.incorrectSliderInput = true;
961
-
962
- } else if (this.sliderEnteredMinValue < this.options.floor) {
963
- this.showSliderMinValueError = true;
964
- this.disableSliderApplyButton = true;
965
- this.incorrectSliderInput = true;
966
- } else {
967
- this.showSliderMinValueError = false;
968
- this.disableSliderApplyButton = false;
969
- this.incorrectSliderInput = false;
970
- }
971
-
972
- } else {
973
- this.sliderEnteredMinValue = this.options.floor;
974
- this.isMinTextBoxEmpty = true;
975
- this.showSliderMinValueError = false;
976
-
977
- }
978
- this.showErrorForMinAndMaxValue();
979
- }
980
-
981
- maxValueChanged(val: string) {
982
- if (val || val == "0") {
983
- this.sliderEnteredMaxValue = parseInt(val);
984
- this.isMaxTextBoxEmpty = false;
985
- if (this.isMinTextBoxEmpty) {
986
- if ( (this.sliderEnteredMaxValue < this.options.floor) || (this.sliderEnteredMaxValue > this.options.ceil)) {
987
- this.showSliderMaxValueError = true;
988
- this.disableSliderApplyButton = true;
989
- this.incorrectSliderInput = true;
990
- } else {
991
- this.showSliderMaxValueError = false;
992
- this.showSliderMinValueError = false;
993
- this.disableSliderApplyButton = false;
994
- this.incorrectSliderInput = false;
995
- }
996
- } else if (this.sliderEnteredMaxValue < this.sliderEnteredMinValue) {
997
- if(this.isValueInRange(this.sliderEnteredMinValue)){
998
- this.showSliderMaxValueError = true;
999
- this.showSliderMinValueError = false;
1000
- }
1001
- else{
1002
- this.showSliderMinValueError = true;
1003
- if(this.isValueInRange(this.sliderEnteredMaxValue)){
1004
- this.showSliderMaxValueError = false;
1005
- }
1006
- else{
1007
- this.showSliderMaxValueError = true;
1008
- }
1009
- }
1010
- this.disableSliderApplyButton = true;
1011
- this.incorrectSliderInput = true;
1012
- // this.showMaxError = true;
1013
- } else if (this.sliderEnteredMaxValue > this.options.ceil) {
1014
- this.showSliderMaxValueError = true;
1015
- this.disableSliderApplyButton = true;
1016
- this.incorrectSliderInput = true;
1017
- } else {
1018
- this.showSliderMaxValueError = false;
1019
- this.disableSliderApplyButton = false;
1020
- this.incorrectSliderInput = false;
1021
- }
1022
- } else {
1023
- this.sliderEnteredMaxValue = this.options.ceil;
1024
- this.isMaxTextBoxEmpty = true;
1025
- this.showSliderMaxValueError = false;
1026
- }
1027
- this.showErrorForMinAndMaxValue();
1028
- }
1029
-
1030
- showErrorForMinAndMaxValue(){
1031
- if(this.isMinTextBoxEmpty && this.isMaxTextBoxEmpty){
1032
- this.showSliderMinValueError = true;
1033
- this.showSliderMaxValueError = true;
1034
- this.disableSliderApplyButton = true;
1035
- this.incorrectSliderInput = true;
1036
- }
1037
- else if(this.showSliderMaxValueError || this.showSliderMinValueError){
1038
- this.incorrectSliderInput = true;
1039
- }
1040
- else{
1041
- this.incorrectSliderInput = false;
1042
- }
1043
- this.disableSliderApplyBtn();
1044
- }
1045
-
1046
- isValueInRange(val: number){
1047
- return this.options.floor <= val && val <= this.options.ceil;
1048
- }
1049
-
1050
- disableSliderApplyBtn(){
1051
- if(this.showFilterComponent && this.showSortComponent){
1052
- let isFilterChanged = this.checkIfSliderTooltipIsFiltered();
1053
- let isSortChanged = this.checkIfSortingChanged();
1054
-
1055
- this.disableSliderApplyButton = this.incorrectSliderInput || (!isSortChanged && !isFilterChanged );
1056
- }
1057
- else if(this.showFilterComponent){
1058
- this.disableSliderApplyButton = this.incorrectSliderInput || !this.checkIfSliderTooltipIsFiltered();
1059
- }
1060
- else if(this.showSortComponent){
1061
- this.disableSliderApplyButton = !this.checkIfSortingChanged();
1062
- }
1063
- }
1064
-
1065
- sliderValueChange() {
1066
- this.sliderValue = { min: this.sliderMinValue, max: this.sliderMaxValue };
1067
- }
1068
-
1069
- cancelSliderFilter() {
1070
- this.sliderValue = null;
1071
- this.closeTooltip();
1072
- }
1073
-
1074
- applyFilters() {
1075
- this.applyListFilters();
1076
- this.applySortingOnFilteredData();
1077
- // this.emitData();
1078
- this.setInitialRowsForTable();
1079
- this.disableEnableEachColumnTooltipIcon();
1080
- this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
1081
- this.emitData();
1082
- this.closeTooltip();
1083
- }
1084
-
1085
- applyListFilters(){
1086
- if(this.showFilterComponent && this.isFilterChanged){
1087
- let currentSelectedValue = [];
1088
-
1089
- if(this.tooltipOptions){
1090
-
1091
- currentSelectedValue = sortBy(this.tooltipOptions.filter(item => item.isSelected).map(item => item.value));
1092
-
1093
- if(!this.searchItem && currentSelectedValue.length == this.tooltipOptions.length && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1094
- currentSelectedValue = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1095
- }
1096
-
1097
- }
1098
-
1099
- let blankIndex = currentSelectedValue.findIndex((item: string) => item == null);
1100
- if(blankIndex != -1){
1101
- currentSelectedValue = sortBy(currentSelectedValue);
1102
- }
1103
-
1104
- this.annaFilterService.reOrderAppliedFiltersState(this.clonedTableData,currentSelectedValue);
1105
- this.annaFilterService.tooltipSelectedMap.set(this.annaFilterService.selectedRadio, currentSelectedValue);
1106
-
1107
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
1108
- this.annaSortService.noSortingAppliedData = cloneDeep(this.tableData);
1109
- }
1110
- }
1111
-
1112
- applySortingOnFilteredData(){
1113
- if(this.showSortComponent){
1114
- if(this.isSortChanged){
1115
- this.updateSortMap();
1116
- }
1117
- else if(this.isFilterChanged){
1118
- this.checkIfSortingIsApplied();
1119
- }
1120
- }
1121
- else if(this.isFilterChanged){
1122
- this.checkIfSortingIsApplied();
1123
- }
1124
- }
1125
-
1126
- emitData(){
1127
- if(this.isFilterChanged && this.isSortChanged){
1128
- this.filterAppliedToTable.emit(this.tableData);
1129
- }
1130
- else if(this.isFilterChanged){
1131
- this.filterAppliedToTable.emit(this.tableData);
1132
- }
1133
- else if(this.isSortChanged){
1134
- this.sortingAppliedToTable.emit(this.tableData);
1135
- }
1136
- }
1137
-
1138
- applySorting(key: string){
1139
- if(this.tempSortOrder == "ASC"){
1140
- this.tableData = cloneDeep(this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(true,this.tableData,key));
1141
- }
1142
- else if(this.tempSortOrder == "DESC"){
1143
- this.tableData = cloneDeep(this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(false,this.tableData,key));
1144
- }
1145
- else if(this.tempSortOrder == "DEFAULT"){
1146
- this.tableData = cloneDeep(this.annaSortService.noSortingAppliedData);
1147
- }
1148
- }
1149
-
1150
- revert() {
1151
- this.tempTooltipData = cloneDeep(this.toolTipdata);
1152
- this.annaFilterService.tooltipMap.set(this.annaFilterService.selectedRadio, this.tempTooltipData);
1153
- this.toolTipdata = null;
1154
- }
1155
-
1156
- closeCheckboxFilter() {
1157
- if (this.toolTipdata) {
1158
- this.revert();
1159
- }
1160
- this.closeTooltip();
1161
- }
1162
-
1163
- applySliderFilter() {
1164
-
1165
- this.applySliderFilterOnData();
1166
- this.applySortingOnFilteredData();
1167
- this.emitData();
1168
- this.setInitialRowsForTable();
1169
- this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
1170
- this.closeTooltip();
1171
- }
1172
-
1173
- applySliderFilterOnData(){
1174
- if(this.showFilterComponent && this.isFilterChanged){
1175
- let currentSliderData: {min:any, max: any} = {min: null , max: null};
1176
-
1177
- // if(this.isMinTextBoxEmpty){
1178
- // currentSliderData.min = this.options.floor;
1179
- // currentSliderData.max = this.sliderMaxValue;
1180
- // }
1181
- // else if(this.isMaxTextBoxEmpty){
1182
- // currentSliderData.max = this.options.ceil;
1183
- // currentSliderData.min = this.sliderMinValue;
1184
- // }
1185
- // else{
1186
- currentSliderData.max = this.sliderEnteredMaxValue;
1187
- currentSliderData.min = this.sliderEnteredMinValue;
1188
- // }
1189
-
1190
- if(currentSliderData.min == this.options.floor && currentSliderData.max == this.options.ceil && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio) ){
1191
- currentSliderData = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1192
- }
1193
-
1194
- this.annaFilterService.reOrderAppliedFiltersState(this.clonedTableData,currentSliderData);
1195
- this.annaFilterService.tooltipSelectedMap.set(this.annaFilterService.selectedRadio,currentSliderData);
1196
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
1197
- this.annaSortService.noSortingAppliedData = cloneDeep(this.tableData);
1198
- this.disableEnableEachColumnTooltipIcon();
1199
- }
1200
- }
1201
-
1202
- cancelInDateFilter() {
1203
- this.closeTooltip();
1204
- }
1205
-
1206
- updateSortMap(){
1207
- this.annaSortService.columnSortState = new Map();
1208
- this.annaSortService.columnSortState.set(this.annaFilterService.selectedRadio, this.tempSortOrder);
1209
- this.applySorting(this.annaFilterService.selectedRadio);
1210
- }
1211
-
1212
- applyDateFilter() {
1213
- this.applyDateFilterOnData();
1214
- this.applySortingOnFilteredData();
1215
- this.emitData();
1216
- this.setInitialRowsForTable();
1217
- this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
1218
- this.closeTooltip();
1219
-
1220
- }
1221
-
1222
- applyDateFilterOnData(){
1223
- if(this.showFilterComponent && this.isFilterChanged){
1224
- let currentSelectedDate = this.calendarSelection;
1225
-
1226
- let fromDate = {year: currentSelectedDate.fromDate.year,month: currentSelectedDate.fromDate.month,day: currentSelectedDate.fromDate.day};
1227
- let toDate = {year: currentSelectedDate.toDate.year,month: currentSelectedDate.toDate.month,day: currentSelectedDate.toDate.day};
1228
-
1229
- if(isEqual(this.calendarMinEnabledDate,fromDate) && isEqual(this.calendarMaxEnabledDate,toDate) && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1230
- currentSelectedDate = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1231
- }
1232
- else{
1233
- currentSelectedDate.fromDate = dayjs(this.annaDateTimeFormatService.convertNgbDateToMoment(currentSelectedDate.fromDate));
1234
- currentSelectedDate.toDate = dayjs(this.annaDateTimeFormatService.convertNgbDateToMoment(currentSelectedDate.toDate));
1235
- }
1236
-
1237
-
1238
- this.annaFilterService.reOrderAppliedFiltersState(this.clonedTableData,currentSelectedDate);
1239
- this.annaFilterService.tooltipSelectedMap.set(this.annaFilterService.selectedRadio,currentSelectedDate);
1240
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
1241
- this.annaSortService.noSortingAppliedData = cloneDeep(this.tableData);
1242
- this.disableEnableEachColumnTooltipIcon();
1243
-
1244
- }
1245
- }
1246
-
1247
- applyWeekFilter(event: any) {
1248
-
1249
- }
1250
-
1251
- incrementHour(arr: any[]) {
1252
- if (arr[0] == "") {
1253
- arr[0] = 1;
1254
- } else if (parseInt(arr[0]) < 12) {
1255
- arr[0] = parseInt(arr[0]) + 1;
1256
- } else {
1257
- arr[0] = 1;
1258
- }
1259
- }
1260
-
1261
- decrementHour(arr: any[]) {
1262
- if (arr[0] == "") {
1263
- arr[0] = 12;
1264
- } else if (parseInt(arr[0]) > 1) {
1265
- arr[0] = parseInt(arr[0]) - 1;
1266
- } else {
1267
- arr[0] = 12;
1268
- }
1269
- }
1270
-
1271
- incrementMinute(arr: any[]) {
1272
- // increment to nearest proper interval(15,30,45)
1273
- let min = parseInt(arr[1])
1274
- if (min <= 14) {
1275
- arr[1] = "15";
1276
- } else if (min >= 15 && min <= 29) {
1277
- arr[1] = "30";
1278
- } else if (min >= 30 && min <= 44) {
1279
- arr[1] = "45";
1280
- } else if (min >= 45) {
1281
- arr[1] = "00";
1282
- }
1283
-
1284
- // arr[1] = parseInt(arr[1]) + 15;
1285
- // if (parseInt(arr[1]) == 60) {
1286
- // arr[1] = "00";
1287
- // } else if (parseInt(arr[1]) == 0) {
1288
- // arr[1] = "00";
1289
- // }
1290
- // else if(parseInt(arr[1]) > 60){
1291
- // let res = parseInt(arr[1]) - 60;
1292
- // arr[1] = res < 10 ? `0${res}` : res.toString();
1293
- // }
1294
- }
1295
-
1296
- decrementMinute(arr: any) {
1297
- let min = parseInt(arr[1]);
1298
- if (min > 0 && min <= 15) {
1299
- arr[1] = "00";
1300
- } else if (min >= 16 && min <= 30) {
1301
- arr[1] = "15";
1302
- } else if (min >= 31 && min <= 45) {
1303
- arr[1] = "30";
1304
- } else if (min > 45 || min == 0) {
1305
- arr[1] = "45";
1306
- }
1307
-
1308
- // arr[1] = parseInt(arr[1]) - 15;
1309
- // if (parseInt(arr[1]) < 0) {
1310
- // let res = 60 + parseInt(arr[1]);
1311
- // arr[1] = res;
1312
- // } else if (parseInt(arr[1]) == 0) {
1313
- // arr[1] = "00";
1314
- // }
1315
- // else if(arr[1] < 10){
1316
- // arr[1]= `0${arr[1]}`;
1317
- // }
1318
- }
1319
-
1320
- changeStartTimeHour(increment: boolean) {
1321
- if (increment) {
1322
- this.incrementHour(this.selectedFromTime);
1323
- } else {
1324
- this.decrementHour(this.selectedFromTime);
1325
- }
1326
- this.startTimeHourChange(this.selectedFromTime[0].toString());
1327
- }
1328
-
1329
- changeEndTimeHour(increment: boolean) {
1330
- if (increment) {
1331
- this.incrementHour(this.selectedToTime);
1332
- } else {
1333
- this.decrementHour(this.selectedToTime);
1334
- }
1335
- this.endTimeHourChange(this.selectedToTime[0].toString());
1336
- }
1337
-
1338
- changeEndTimeMinute(increment: boolean) {
1339
- if (increment) {
1340
- this.incrementMinute(this.selectedToTime);
1341
- } else {
1342
- this.decrementMinute(this.selectedToTime);
1343
- }
1344
- this.endTimeMinChange(this.selectedToTime[1].toString());
1345
- }
1346
-
1347
- changeStartTimeMinute(increment: boolean) {
1348
- if (increment) {
1349
- this.incrementMinute(this.selectedFromTime);
1350
- } else {
1351
- this.decrementMinute(this.selectedFromTime);
1352
- }
1353
- this.startTimeMinChange(this.selectedFromTime[1].toString());
1354
- }
1355
-
1356
- applyTimeFilters() {
1357
-
1358
- this.applyTimeFilterOnData();
1359
- this.applySortingOnFilteredData();
1360
- this.emitData();
1361
- this.setInitialRowsForTable();
1362
- this.annaFilterService.updateStateOfAllTheKeys(this.annaSortService.columnSortState);
1363
- this.closeTooltip();
1364
-
1365
- }
1366
-
1367
- applyTimeFilterOnData(){
1368
- if(this.showFilterComponent && this.isFilterChanged){
1369
- let currentSelectedTimeFilter: {fromTime: string, toTime:string, includeMulti: boolean, includeZero: boolean, includeTimeRange: boolean} = {
1370
- fromTime: null,
1371
- toTime: null,
1372
- includeMulti: false,
1373
- includeZero: false,
1374
- includeTimeRange: false,
1375
- };
1376
-
1377
- let fromTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1378
- this.selectedFromTime[0] + ":" + this.selectedFromTime[1] + " " + this.selectedFromTime[2],
1379
- true
1380
- );
1381
- let fromTime24HrFormat = fromTime24HrFormatArr[0] + ":" + fromTime24HrFormatArr[1] + ":00";
1382
-
1383
- let toTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1384
- this.selectedToTime[0] + ":" + this.selectedToTime[1] + " " + this.selectedToTime[2],
1385
- true
1386
- );
1387
- let toTime24HrFormat = toTime24HrFormatArr[0] + ":" + toTime24HrFormatArr[1] + ":59";
1388
-
1389
- currentSelectedTimeFilter = { fromTime: fromTime24HrFormat, toTime: toTime24HrFormat, includeMulti: this.multiTimeCheckboxChecked,
1390
- includeZero: this.zeroTimeCheckboxChecked, includeTimeRange: this.enterTimeCheckboxChecked};
1391
-
1392
- let isFiltered = this.annaFilterService.reOrderAppliedFiltersState(this.clonedTableData,currentSelectedTimeFilter);
1393
- this.annaFilterService.tooltipSelectedMap.set(this.annaFilterService.selectedRadio,currentSelectedTimeFilter);
1394
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
1395
-
1396
- if(!isFiltered){
1397
- this.annaFilterService.tooltipSelectedMap.delete(this.annaFilterService.selectedRadio);
1398
- }
1399
- this.annaSortService.noSortingAppliedData = cloneDeep(this.tableData);
1400
- this.disableEnableEachColumnTooltipIcon();
1401
-
1402
- }
1403
- }
1404
-
1405
- closeTimeFilter() {
1406
- this.selectedFromTime = cloneDeep(this.clonedSelectedFromTime);
1407
- this.selectedToTime = cloneDeep(this.clonedSelectedToTime);
1408
- this.closeTooltip();
1409
- }
1410
-
1411
- disableTimeFilterApplyButton() {
1412
-
1413
- if(this.showFilterComponent && this.showSortComponent){
1414
- let isFilterChanged = this.checkIfTimeTooltipIsFiltered();
1415
- let isSortChanged = this.checkIfSortingChanged();
1416
- this.disableTimeFilterApplyBtn = !this.validateTimeFilterInput() || (!isSortChanged && !isFilterChanged );
1417
- }
1418
- else if(this.showFilterComponent){
1419
- this.disableTimeFilterApplyBtn = !this.validateTimeFilterInput() || !this.checkIfTimeTooltipIsFiltered();
1420
- }
1421
- else if(this.showSortComponent){
1422
- this.disableTimeFilterApplyBtn = !this.checkIfSortingChanged();
1423
- }
1424
-
1425
- }
1426
-
1427
- validateTimeFilterInput(){
1428
- if(this.startTimeHourErr || this.startTimeMinErr || this.endTimeHourErr || this.endTimeMinErr){
1429
- return false;
1430
- }
1431
-
1432
- if ((this.showMultiTimeCheckbox && !this.multiTimeCheckboxChecked) &&
1433
- (this.showZeroTimeCheckbox && !this.zeroTimeCheckboxChecked )&&
1434
- (this.showEnterTimeCheckbox && !this.enterTimeCheckboxChecked)) {
1435
- return false;
1436
- }
1437
-
1438
- let timeFormat = "HH:mm:ss";
1439
-
1440
- let startTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1441
- this.selectedFromTime[0] + ":" + this.selectedFromTime[1] + " " + this.selectedFromTime[2],
1442
- true
1443
- );
1444
- let startTime24HrFormat = startTime24HrFormatArr[0] + ":" + startTime24HrFormatArr[1] + ":00";
1445
- let endTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1446
- this.selectedToTime[0] + ":" + this.selectedToTime[1] + " " + this.selectedToTime[2],
1447
- true
1448
- );
1449
- let endTime24HrFormat = endTime24HrFormatArr[0] + ":" + endTime24HrFormatArr[1] + ":00";
1450
-
1451
- return !(dayjs(startTime24HrFormat, timeFormat).isAfter(dayjs(endTime24HrFormat, timeFormat)));
1452
- }
1453
-
1454
- sortedData(event: any) {
1455
- if (event.type == "none") {
1456
- this.tableData = this.annaFilterService.filterData(this.clonedTableData, "");
1457
- } else {
1458
- this.tableData = event.data;
1459
- }
1460
- this.sortingAppliedToTable.emit(this.tableData);
1461
- }
1462
-
1463
- checkIfSortingIsApplied() {
1464
- for(let [key,value] of this.annaSortService.columnSortState.entries()){
1465
- if(value == "ASC"){
1466
- this.tableData = cloneDeep(this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(true,this.tableData,key));
1467
- }
1468
- else if(value == "DESC"){
1469
- this.tableData = cloneDeep(this.annaSortService.sortDataForComponentOtherThanLurAndCsrPage(false,this.tableData,key));
1470
- }
1471
- }
1472
- }
1473
-
1474
-
1475
- disableEnableEachColumnTooltipIcon() {
1476
- this.tableHeaders.forEach(header => {
1477
-
1478
- header.headerInfo.forEach(item => {
1479
- if (item.showTooltipIcon) {
1480
-
1481
- let values = [];
1482
- item.disableTooltipIcon = true;
1483
-
1484
- item.filterSortObjectKeys.forEach(key => {
1485
-
1486
- let latestFilters = this.annaFilterService.appliedFiltersArray;
1487
-
1488
- if(latestFilters.length > 0 && item.disableTooltipIcon && latestFilters[latestFilters.length - 1] == key){
1489
- item.disableTooltipIcon = false;
1490
- }
1491
-
1492
- if(item.disableTooltipIcon){
1493
-
1494
- if(key == "period"){
1495
- let uniqStartDate = uniq(this.tableData.map((u: { [x: string]: any; }) => u["startDate"]));
1496
- let uniqEndDate = uniq(this.tableData.map((u: { [x: string]: any; }) => u["endDate"]));
1497
-
1498
- item.disableTooltipIcon = (uniqStartDate.length > 1 || uniqEndDate.length > 1) ? false : true;
1499
- }
1500
- else{
1501
- values = this.tableData.map((u: { [x: string]: any; }) => u[key]);
1502
- if( (item.filter == "CHECKBOX" && uniq(values).filter(n => n!=null).length > 1) || (item.filter != "CHECKBOX" && uniq(values).filter(n => n!=null && n!="-").length > 1)){
1503
-
1504
- item.disableTooltipIcon = false;
1505
- }
1506
-
1507
- }
1508
- }
1509
-
1510
- })
1511
- }
1512
-
1513
- });
1514
- });
1515
-
1516
-
1517
- }
1518
-
1519
- setMarginLeftForFilterIcon(){
1520
- let elementArr = this.viewChildTableHeaders.toArray();
1521
- elementArr.forEach((item) => {
1522
- let childDivElements = item.nativeElement.children;
1523
-
1524
- if (childDivElements.length == 2) {
1525
- let firstParagraphWidth = childDivElements[0].children[0];
1526
- let secondParagraphWidth = childDivElements[1].children[0];
1527
-
1528
- if(firstParagraphWidth.offsetWidth > secondParagraphWidth.offsetWidth){
1529
- let diff = firstParagraphWidth.offsetWidth - secondParagraphWidth.offsetWidth;
1530
- if(childDivElements[0].children.length == 2){
1531
- childDivElements[0].children[1].style.marginLeft = 4 + 'px';
1532
- }
1533
-
1534
- if(childDivElements[1].children.length == 2){
1535
-
1536
- childDivElements[1].children[1].style.marginLeft = diff + 4 + 'px';
1537
- }
1538
- }
1539
- else{
1540
- let diff = secondParagraphWidth.offsetWidth - firstParagraphWidth.offsetWidth;
1541
- if(childDivElements[0].children.length == 2){
1542
- childDivElements[0].children[1].style.marginLeft = diff + 4 + 'px';
1543
- }
1544
-
1545
- if(childDivElements[1].children.length == 2){
1546
-
1547
- childDivElements[1].children[1].style.marginLeft = 4 + 'px';
1548
- }
1549
- }
1550
-
1551
- }
1552
- });
1553
- }
1554
-
1555
- dataRowClicked(rowData: any) {
1556
- this.rowClicked.emit(rowData);
1557
- }
1558
-
1559
- radioButtonClicked(data: any, action: string, isDisabled: boolean) {
1560
- if (!isDisabled) {
1561
- this.radioButtonSelected.emit({ data, action });
1562
- }
1563
- }
1564
-
1565
- bindTheValueToSellerGroupTooltip(sellerGroupHierarchy: RatingSellerGroupHierarchy[], tooltip: any): void {
1566
- if (this.hierarchyTooltip && this.hierarchyTooltip.open) {
1567
- this.hierarchyTooltip.close();
1568
- }
1569
- this.sellerGroupHierarchy = sellerGroupHierarchy;
1570
- this.hierarchyTooltip = tooltip;
1571
- this.hierarchyTooltip.open();
1572
- }
1573
-
1574
- iconClicked(rowData: any,iconClass: string){
1575
-
1576
- if("orderId" in rowData && iconClass.includes("mdi-star") ){
1577
- this.selectedStarredOrderId = rowData.orderId;
1578
- }
1579
-
1580
- this.gtIconClicked.emit({data: rowData,iconClass: iconClass});
1581
- }
1582
-
1583
- svgIconClicked(data: GtColumnIconEmittedData){
1584
- this.gtSVGIconClicked.emit(data);
1585
- }
1586
-
1587
- textActionClicked(rowData: any,id: any){
1588
- this.gtTextActionClicked.emit({data:rowData, id: id});
1589
- }
1590
-
1591
- iconClickedOnStringIconActionType(rowData: any, id: any){
1592
- this.gtTextActionClicked.emit({data:rowData, id: id});
1593
- }
1594
-
1595
- viewDetailsClicked(rowData: any){
1596
- this.gtViewDetailClicked.emit({data:rowData});
1597
- }
1598
-
1599
- // setColumnSortStateMap(){
1600
- // this.tableHeaders.forEach(column => {
1601
- // column.headerInfo.forEach( (header) => {
1602
- // if(header.showTooltipIcon && header.isSortRequired){
1603
- // header.isSortRequired.forEach( (item,index) => {
1604
- // if(item){
1605
- // this.annaSortService.columnSortState.set(header.filterSortObjectKeys[index], "DEFAULT");
1606
- // }
1607
- // })
1608
- // }
1609
- // })
1610
- // });
1611
- // }
1612
-
1613
- storeSortTypeInTempVariable(event: SortType){
1614
- this.tempSortOrder = event;
1615
- this.disableApplyButtonOfSelectedFilter();
1616
- }
1617
-
1618
- unCheckAllCheckbox(){
1619
- this.tooltipOptions.forEach(item => {
1620
- item.isSelected = false;
1621
- let index = this.clonedTooltipOptions.findIndex(opt => opt.id == item.id);
1622
- this.clonedTooltipOptions[index].isSelected = false;
1623
-
1624
- });
1625
- this.selectedCheckboxOptionsCount = 0;
1626
- this.disableSelectAll = false;
1627
- this.disableClearAll = true;
1628
- this.disableCheckboxApply = true;
1629
- }
1630
-
1631
- selectAllCheckbox(){
1632
- this.tooltipOptions.forEach(item => {
1633
- item.isSelected = true;
1634
- let index = this.clonedTooltipOptions.findIndex(opt => opt.id == item.id);
1635
- this.clonedTooltipOptions[index].isSelected = true;
1636
- });
1637
- this.selectedCheckboxOptionsCount = this.tooltipOptions.length;
1638
- this.disableSelectAll = true;
1639
- this.disableClearAll = false;
1640
- this.disableCheckboxFilterApplyButton();
1641
- }
1642
-
1643
- searchForTheItem(str: string){
1644
- if(str){
1645
- this.tooltipOptions = cloneDeep(this.clonedTooltipOptions.filter(item => item.label.toString().toLowerCase().includes(str.toLowerCase())));
1646
-
1647
- this.tooltipOptions.forEach(element => {
1648
- element.label = this.boldString(element.label,str);
1649
- });
1650
-
1651
- if(this.tooltipOptions.length > 0){
1652
- let unselectedItems = this.tooltipOptions.filter((item) => !item.isSelected);
1653
- let selectedItems = this.tooltipOptions.filter((item) => item.isSelected);
1654
- this.disableSelectAll = unselectedItems.length == 0;
1655
- this.disableClearAll = selectedItems.length == 0;
1656
- this.selectedCheckboxOptionsCount = selectedItems.length;
1657
- this.disableCheckboxApply = (selectedItems.length == 0 || !this.checkIfCheckboxTooltipIsFiltered());
1658
-
1659
- }
1660
- else{
1661
- this.selectedCheckboxOptionsCount = 0;
1662
- this.disableCheckboxApply = true;
1663
- this.disableClearAll = true;
1664
- this.disableSelectAll = true;
1665
- }
1666
- }
1667
- else{
1668
- this.tooltipOptions = cloneDeep(this.clonedTooltipOptions);
1669
- let unselectedItems = this.tooltipOptions.filter(item => !item.isSelected);
1670
- let selectedItems = this.tooltipOptions.filter(item => item.isSelected);
1671
- this.selectedCheckboxOptionsCount = selectedItems.length;
1672
- this.disableSelectAll = unselectedItems.length == 0;
1673
- this.disableClearAll = selectedItems.length == 0;
1674
- this.disableCheckboxFilterApplyButton();
1675
- }
1676
- }
1677
-
1678
- boldString(str: string, find: string) {
1679
- let indexes = this.getIndicesOf(find, str, false);
1680
-
1681
- indexes.forEach((item,index) => {
1682
- let startIndex = item + (index * 7); //Multiplying by 7 as there are 7char: <b></b>
1683
- let endIndex = startIndex + find.length;
1684
- let strToBeReplaced = str.substring(startIndex, endIndex);
1685
- str = str.replace(strToBeReplaced, "<b>" + strToBeReplaced + "</b>");
1686
- });
1687
- return str;
1688
- }
1689
-
1690
- getIndicesOf(searchStr: string, str: string, caseSensitive: boolean) {
1691
- var searchStrLen = searchStr.length;
1692
- if (searchStrLen == 0) {
1693
- return [];
1694
- }
1695
- var startIndex = 0, index, indices = [];
1696
- if (!caseSensitive) {
1697
- str = str.toLowerCase();
1698
- searchStr = searchStr.toLowerCase();
1699
- }
1700
- while ((index = str.indexOf(searchStr, startIndex)) > -1) {
1701
- indices.push(index);
1702
- startIndex = index + searchStrLen;
1703
- }
1704
- return indices;
1705
- }
1706
-
1707
-
1708
- removeBoldElementFromString(originalString: string){
1709
- let firstRegExp = new RegExp('<b>','g');
1710
- let secondRegExp = new RegExp('</b>','g');
1711
-
1712
- let ret = originalString.replace(firstRegExp,'');
1713
- return ret.replace(secondRegExp,'');
1714
- }
1715
-
1716
- clearSearchedItem(){
1717
- this.searchItem = "";
1718
- this.searchForTheItem("");
1719
- }
1720
-
1721
- calendarDateChanged(event: any){
1722
- this.calendarSelection = event;
1723
- this.disableCalendarApplyButton();
1724
- }
1725
-
1726
- disableCalendarApplyButton() {
1727
-
1728
- if(this.showFilterComponent && this.showSortComponent){
1729
- let isFilterChanged = this.checkIfDateTooltipIsFiltered();
1730
- let isSortChanged = this.checkIfSortingChanged();
1731
-
1732
- this.disableCalendarApplyBtn = !(this.calendarSelection.fromDate && this.calendarSelection.toDate) || (!isSortChanged && !isFilterChanged );
1733
- }
1734
- else if(this.showFilterComponent){
1735
- this.disableCalendarApplyBtn = !(this.calendarSelection.fromDate && this.calendarSelection.toDate) || !this.checkIfDateTooltipIsFiltered();
1736
- }
1737
- else if(this.showSortComponent){
1738
- this.disableCalendarApplyBtn = !this.checkIfSortingChanged();
1739
- }
1740
-
1741
- }
1742
-
1743
- setInitialValueMapForTimeFilter(key: string) {
1744
- let data = this.clonedTableData.filter(
1745
- (obj) => !["", "-", null, "0", "<multi>"].includes(obj[key]));
1746
-
1747
- let timeArr = map(data, key);
1748
- timeArr.sort((a, b) => {
1749
- return this.annaDateTimeFormatService.sortByTimeAscending(a, b);
1750
- });
1751
-
1752
- let obj = {
1753
- fromTime: timeArr[0],
1754
- toTime: timeArr[timeArr.length - 1],
1755
- includeMulti: false,
1756
- includeZero: false,
1757
- includeTimeRange: false
1758
- };
1759
-
1760
- if (
1761
- this.gtGeneralConfig.component === "SPOTDETAILS" ||
1762
- this.gtGeneralConfig.component === "EXCLUDEINVENTORYPOPUP" ||
1763
- this.gtGeneralConfig.component === "ACTIVITYLOG"
1764
- ) {
1765
- let includeMulti =
1766
- this.clonedTableData.findIndex((obj) => obj[key] == "<multi>") !=
1767
- -1;
1768
- let includeZero =
1769
- this.clonedTableData.findIndex((obj) => obj[key] == "0") != -1;
1770
- let includeTimeRange =
1771
- this.clonedTableData.findIndex(
1772
- (obj) => obj[key] != "0" && obj[key] != "<multi>"
1773
- ) != -1;
1774
-
1775
- let obj = {
1776
- fromTime: timeArr[0],
1777
- toTime: timeArr[timeArr.length - 1],
1778
- includeMulti: includeMulti,
1779
- includeZero: includeZero,
1780
- includeTimeRange: includeTimeRange,
1781
- };
1782
- this.annaFilterService.initialValueMap.set(key, obj);
1783
- }
1784
- else if (this.gtGeneralConfig.component === "RATING") {
1785
- this.setInitialValueMapForRatingPageTimeFilter(key);
1786
- } else {
1787
- this.annaFilterService.initialValueMap.set(key, obj);
1788
- }
1789
- }
1790
-
1791
- setInitialValueMapForRatingPageTimeFilter(key: string){
1792
- let includeMulti =
1793
- this.clonedTableData.findIndex((obj) => obj[key][0] == "<multi>") !=
1794
- -1;
1795
- let includeZero =
1796
- this.clonedTableData.findIndex((obj) => obj[key][0] == "0") != -1;
1797
- let includeTimeRange =
1798
- this.clonedTableData.findIndex(
1799
- (obj) => obj[key][0] != "0" && obj[key][0] != "<multi>"
1800
- ) != -1;
1801
-
1802
- let startTimeArr = map(this.clonedTableData, "startTime");
1803
- let endTimeArr = map(this.clonedTableData, "endTime");
1804
-
1805
- startTimeArr.sort((a, b) => {
1806
- return this.annaDateTimeFormatService.sortByTimeAscending(a, b);
1807
- });
1808
-
1809
- endTimeArr.sort((a, b) => {
1810
- return this.annaDateTimeFormatService.sortByTimeDescending(a, b);
1811
- });
1812
-
1813
- let obj = {
1814
- fromTime: startTimeArr[0],
1815
- toTime: endTimeArr[0],
1816
- includeMulti: includeMulti,
1817
- includeZero: includeZero,
1818
- includeTimeRange: includeTimeRange,
1819
- };
1820
- this.annaFilterService.initialValueMap.set(key, obj);
1821
- }
1822
-
1823
- startTimeHourChange(val: string){
1824
- if(val.length == 0 || 1 > parseInt(val) || parseInt(val) > 12){
1825
- this.startTimeHourErr = true;
1826
- }
1827
- else{
1828
- this.startTimeHourErr = false;
1829
- }
1830
- this.disableTimeFilterApplyButton();
1831
- }
1832
-
1833
- startTimeMinChange(val: string){
1834
- if(val.length != 2 || 0 > parseInt(val) || parseInt(val) > 59){
1835
- this.startTimeMinErr = true;
1836
- }
1837
- else{
1838
- this.startTimeMinErr = false;
1839
- }
1840
- this.disableTimeFilterApplyButton();
1841
- }
1842
-
1843
- endTimeHourChange(val: string){
1844
- if(val.length == 0 || 1 > parseInt(val) || parseInt(val) > 12){
1845
- this.endTimeHourErr = true;
1846
- }
1847
- else{
1848
- this.endTimeHourErr = false;
1849
- }
1850
- this.disableTimeFilterApplyButton();
1851
- }
1852
-
1853
- endTimeMinChange(val: string){
1854
- if(val.length != 2 || 0 > parseInt(val) || parseInt(val) > 59){
1855
- this.endTimeMinErr = true;
1856
- }
1857
- else{
1858
- this.endTimeMinErr = false;
1859
- }
1860
- this.disableTimeFilterApplyButton();
1861
- }
1862
-
1863
- checkIfCheckboxTooltipIsFiltered(){
1864
- let currentSelectedValue = [];
1865
- let previousSelectedValue = [];
1866
-
1867
- if(this.annaFilterService.tooltipSelectedMap.has(this.annaFilterService.selectedRadio)){
1868
- previousSelectedValue = this.annaFilterService.tooltipSelectedMap.get(this.annaFilterService.selectedRadio);
1869
-
1870
- if(!this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1871
- let initialValue = sortBy(uniq(this.clonedTableData.map(item => item[this.annaFilterService.selectedRadio])));
1872
- this.annaFilterService.initialValueMap.set(this.annaFilterService.selectedRadio,initialValue);
1873
- }
1874
-
1875
- }
1876
- else if(this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1877
- previousSelectedValue = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1878
- }
1879
- else{
1880
- previousSelectedValue = sortBy(uniq(this.clonedTableData.map(item => item[this.annaFilterService.selectedRadio])));
1881
- this.annaFilterService.initialValueMap.set(this.annaFilterService.selectedRadio,previousSelectedValue);
1882
- }
1883
-
1884
- if(this.tooltipOptions){
1885
-
1886
- currentSelectedValue = sortBy(this.tooltipOptions.filter(item => item.isSelected).map(item => item.value));
1887
-
1888
- if(!this.searchItem && currentSelectedValue.length == this.tooltipOptions.length && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1889
- currentSelectedValue = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1890
- }
1891
-
1892
- }
1893
-
1894
- let blankIndex = currentSelectedValue.findIndex((item: string) => item == null);
1895
- if(blankIndex != -1){
1896
- currentSelectedValue = sortBy(currentSelectedValue);
1897
- }
1898
-
1899
- this.isFilterChanged = !isEqual(currentSelectedValue,previousSelectedValue);
1900
- return this.isFilterChanged;
1901
- }
1902
-
1903
- checkIfTimeTooltipIsFiltered(){
1904
- let currentSelectedTimeFilter: {fromTime: string, toTime:string, includeMulti: boolean, includeZero: boolean, includeTimeRange: boolean} = {
1905
- fromTime: null,
1906
- toTime: null,
1907
- includeMulti: false,
1908
- includeZero: false,
1909
- includeTimeRange: false,
1910
- };
1911
-
1912
- let previousSelectedTimeFilter;
1913
-
1914
- if(this.annaFilterService.tooltipSelectedMap.has(this.annaFilterService.selectedRadio)){
1915
- previousSelectedTimeFilter = this.annaFilterService.tooltipSelectedMap.get(this.annaFilterService.selectedRadio);
1916
- }
1917
- else if(this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1918
- previousSelectedTimeFilter = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1919
- }
1920
-
1921
- let fromTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1922
- this.selectedFromTime[0] + ":" + this.selectedFromTime[1] + " " + this.selectedFromTime[2],
1923
- true
1924
- );
1925
- let fromTime24HrFormat = fromTime24HrFormatArr[0] + ":" + fromTime24HrFormatArr[1] + ":00";
1926
-
1927
- let toTime24HrFormatArr = this.annaDateTimeFormatService.convertTotwentyFourHrsFormat(
1928
- this.selectedToTime[0] + ":" + this.selectedToTime[1] + " " + this.selectedToTime[2],
1929
- true
1930
- );
1931
- let toTime24HrFormat = toTime24HrFormatArr[0] + ":" + toTime24HrFormatArr[1] + ":00";
1932
-
1933
- currentSelectedTimeFilter = { fromTime: fromTime24HrFormat, toTime: toTime24HrFormat, includeMulti: this.multiTimeCheckboxChecked,
1934
- includeZero: this.zeroTimeCheckboxChecked, includeTimeRange: this.enterTimeCheckboxChecked};
1935
-
1936
- this.isFilterChanged = !isEqual(previousSelectedTimeFilter, currentSelectedTimeFilter);
1937
- return this.isFilterChanged;
1938
- }
1939
-
1940
- checkIfDateTooltipIsFiltered(){
1941
- let currentSelectedDate = cloneDeep(this.calendarSelection);
1942
- let previousSelectedDate: {fromDate: any, toDate: any} = {fromDate: null, toDate: null};
1943
-
1944
- if(this.annaFilterService.tooltipSelectedMap.has(this.annaFilterService.selectedRadio)){
1945
- previousSelectedDate = this.annaFilterService.tooltipSelectedMap.get(this.annaFilterService.selectedRadio);
1946
-
1947
- if(!this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1948
- this.setInitialValueMapForDateFilter();
1949
- }
1950
-
1951
- }
1952
- else if(this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1953
- previousSelectedDate = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1954
- }
1955
- else{
1956
- this.setInitialValueMapForDateFilter();
1957
- previousSelectedDate = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1958
- }
1959
-
1960
- if(currentSelectedDate.fromDate && currentSelectedDate.toDate){
1961
- let fromDate = {year: currentSelectedDate.fromDate.year,month: currentSelectedDate.fromDate.month,day: currentSelectedDate.fromDate.day};
1962
- let toDate = {year: currentSelectedDate.toDate.year,month: currentSelectedDate.toDate.month,day: currentSelectedDate.toDate.day};
1963
-
1964
- if(isEqual(this.calendarMinEnabledDate,fromDate) && isEqual(this.calendarMaxEnabledDate,toDate) && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
1965
- currentSelectedDate = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
1966
- }
1967
- else{
1968
- currentSelectedDate.fromDate = dayjs(this.annaDateTimeFormatService.convertNgbDateToMoment(currentSelectedDate.fromDate));
1969
- currentSelectedDate.toDate = dayjs(this.annaDateTimeFormatService.convertNgbDateToMoment(currentSelectedDate.toDate));
1970
- }
1971
- this.isFilterChanged = !isEqual(previousSelectedDate,currentSelectedDate);
1972
- }
1973
-
1974
- return this.isFilterChanged;
1975
- }
1976
-
1977
- setInitialValueMapForDateFilter(){
1978
- let minMaxDate;
1979
-
1980
- if(this.annaFilterService.selectedRadio == "period"){
1981
- let minStartDate = this.annaFilterService.returnMinAndMaxDate(this.clonedTableData, "startDate");
1982
- let maxEndDate = this.annaFilterService.returnMinAndMaxDate(this.clonedTableData,"endDate");
1983
- minMaxDate = [minStartDate[0],maxEndDate[1]];
1984
- }
1985
- else{
1986
- minMaxDate = this.annaFilterService.returnMinAndMaxDate(this.clonedTableData,this.annaFilterService.selectedRadio);
1987
- }
1988
- let selectedDate = {fromDate: minMaxDate[0], toDate: minMaxDate[1]};
1989
- this.annaFilterService.initialValueMap.set(this.annaFilterService.selectedRadio, selectedDate);
1990
- }
1991
-
1992
- checkIfSliderTooltipIsFiltered(){
1993
- let currentSliderData: {min:any, max: any} = {min: null , max: null};
1994
- let previousSliderData: {min:any, max: any} = {min: "", max: ""};
1995
-
1996
- // if(this.isMinTextBoxEmpty){
1997
- // currentSliderData.min = this.options.floor;
1998
- // currentSliderData.max = this.sliderMaxValue;
1999
- // }
2000
- // else if(this.isMaxTextBoxEmpty){
2001
- // currentSliderData.max = this.options.ceil;
2002
- // currentSliderData.min = this.sliderMinValue;
2003
- // }
2004
- // else{
2005
- currentSliderData.max = this.sliderEnteredMaxValue;
2006
- currentSliderData.min = this.sliderEnteredMinValue;
2007
- // }
2008
-
2009
- if(this.annaFilterService.tooltipSelectedMap.has(this.annaFilterService.selectedRadio)){
2010
- previousSliderData = this.annaFilterService.tooltipSelectedMap.get(this.annaFilterService.selectedRadio);
2011
- if(!this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
2012
- this.setInitialValueMapForSliderFilter();
2013
- }
2014
- }
2015
- else if(this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio)){
2016
- previousSliderData = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
2017
- }
2018
- else{
2019
- this.setInitialValueMapForSliderFilter();
2020
- previousSliderData = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
2021
- }
2022
-
2023
- if(currentSliderData.min == this.options.floor && currentSliderData.max == this.options.ceil && this.annaFilterService.initialValueMap.has(this.annaFilterService.selectedRadio) ){
2024
- currentSliderData = this.annaFilterService.initialValueMap.get(this.annaFilterService.selectedRadio);
2025
- }
2026
-
2027
- this.isFilterChanged = !isEqual(previousSliderData,currentSliderData);
2028
- return this.isFilterChanged;
2029
- }
2030
-
2031
- setInitialValueMapForSliderFilter(){
2032
- let minValue = this.annaFilterService.returnMaxAndMinValue(this.clonedTableData, this.annaFilterService.selectedRadio, true);
2033
- let maxValue = this.annaFilterService.returnMaxAndMinValue(this.clonedTableData, this.annaFilterService.selectedRadio, false);
2034
- let sliderData = { min: minValue, max: maxValue };
2035
- this.annaFilterService.initialValueMap.set(this.annaFilterService.selectedRadio, sliderData);
2036
-
2037
- }
2038
-
2039
- checkIfSortingChanged(){
2040
- let currentColumnSortFilter = this.getColumnSortStateForSelectedRadio();
2041
-
2042
- this.isSortChanged = this.tempSortOrder != null && this.tempSortOrder != currentColumnSortFilter;
2043
- return this.isSortChanged;
2044
- }
2045
-
2046
- getColumnSortStateForSelectedRadio(): string {
2047
- let currentColumnSortFilter = this.annaSortService.columnSortState.get(this.annaFilterService.selectedRadio);
2048
- currentColumnSortFilter = currentColumnSortFilter ? currentColumnSortFilter : SortTypeEnum.DEFAULT;
2049
- return currentColumnSortFilter;
2050
- }
2051
-
2052
- disableApplyButtonOfSelectedFilter(){
2053
- let header = this.annaFilterService.selectedRadio;
2054
-
2055
- if (this.annaFilterService.calendarSet.has(header)) {
2056
- this.disableCalendarApplyButton();
2057
- } else if (this.annaFilterService.sliderSet.has(header)) {
2058
- this.disableSliderApplyBtn();
2059
- } else if (this.annaFilterService.timeSet.has(header)) {
2060
- this.disableTimeFilterApplyButton();
2061
- } else {
2062
- this.disableCheckboxFilterApplyButton();
2063
- }
2064
- }
2065
-
2066
- disableCheckboxFilterApplyButton(){
2067
- let selectedItems = this.showFilterComponent ? this.tooltipOptions.filter(item => item.isSelected) : [];
2068
-
2069
- if(this.showFilterComponent && this.showSortComponent){
2070
- let isFilterChanged = this.checkIfCheckboxTooltipIsFiltered();
2071
- let isSortChanged = this.checkIfSortingChanged();
2072
- this.disableCheckboxApply = selectedItems.length == 0 || (!isSortChanged && !isFilterChanged );
2073
- }
2074
- else if(this.showFilterComponent){
2075
- this.disableCheckboxApply = selectedItems.length == 0 || !this.checkIfCheckboxTooltipIsFiltered();
2076
- }
2077
- else if(this.showSortComponent){
2078
- this.disableCheckboxApply = !this.checkIfSortingChanged();
2079
- }
2080
- }
2081
-
2082
- trackByTooltipModelId(index: number , item: TooltipModel){
2083
- return item.id;
2084
- }
2085
-
2086
- setActiveStateObject(){
2087
- this.annaFilterService.isFilterSortActive = !this.annaFilterService.resetFilterSortActiveStatus
2088
- ? this.annaFilterService.isFilterSortActive
2089
- : {};
2090
- this.tableHeaders.forEach(item => {
2091
- item.headerInfo.forEach(header => {
2092
- if(header.showTooltipIcon){
2093
- let key = header.filterSortObjectKeys.join(',');
2094
- header.joinedFilterSortObjectKeys = key;
2095
- // ANNA-4113 fix
2096
- if(this.annaFilterService.resetFilterSortActiveStatus){
2097
- this.annaFilterService.isFilterSortActive[key] = false;
2098
- }
2099
- }
2100
- })
2101
- });
2102
- this.annaFilterService.resetFilterSortActiveStatus = true;
2103
- }
2104
-
2105
- setIsDifference(value: boolean){
2106
- this.isDifferenceLessThan25Percent = value;
2107
- }
2108
-
2109
- resetIndex(){
2110
- this.start = 0;
2111
- this.end = this.limit + this.start;
2112
- }
2113
-
2114
- onTableContainerScroll(e: any) {
2115
- const tableViewHeight = e.target.offsetHeight; // viewport
2116
- const tableScrollHeight = e.target.scrollHeight; // length of all table
2117
- const scrollLocation = e.target.scrollTop; // how far user scrolled
2118
-
2119
- const elements = document.getElementsByClassName("remarks-info-tooltip");
2120
- const gtTooltip = document.getElementsByClassName("remove-on-scroll-class");
2121
- while (elements.length > 0) {
2122
- elements[0].remove();
2123
- }
2124
- while (gtTooltip.length > 0) {
2125
- elements[0].remove();
2126
- }
2127
-
2128
- // If the user has scrolled within 150px of the bottom, add more data
2129
- const buffer = 150;
2130
- const limit = tableScrollHeight - tableViewHeight - buffer;
2131
- if (scrollLocation > limit) {
2132
- let data = this.getTableData(this.start, this.end);
2133
- this.renderedData = this.renderedData.concat(data);
2134
- this.updateIndex();
2135
- }
2136
- this.tableContainerScrolled(e);
2137
- }
2138
-
2139
- getTableData(start: number, end: number) {
2140
- return this.tableData.filter((value, index) => index >= start && index < end);
2141
- }
2142
-
2143
- updateIndex() {
2144
- this.start = this.end;
2145
- this.end = this.limit + this.start;
2146
- }
2147
-
2148
- setInitialRowsForTable(){
2149
- this.resetIndex();
2150
- this.renderedData = this.getTableData(this.start,this.end);
2151
- this.updateIndex();
2152
- }
2153
-
2154
- spotDetailsDownloadClicked(parentChildOrTotalRow: "DATAROW" | "TOTALROW", rowdata?: any ) {
2155
- if(rowdata){
2156
- this.selectedInventoryIdForDownload = rowdata.inventoryCodeId;
2157
- this.selectedDemographicForDownload = rowdata.demographic;
2158
- } else{
2159
- this.selectedInventoryIdForDownload = null;
2160
- this.selectedDemographicForDownload = null;
2161
- }
2162
- this.selectedRowTypeForDownload = parentChildOrTotalRow;
2163
- this.downloadSpotDetails.emit({
2164
- parentChildOrTotalRow: parentChildOrTotalRow,
2165
- inventoryCodeId: this.selectedInventoryIdForDownload,
2166
- demographic: this.selectedDemographicForDownload})
2167
- }
2168
-
2169
- tableContainerScrolled(event: any){
2170
- this.isScrolledLeft = event.target.scrollLeft > 0;
2171
- }
2172
-
2173
- mouseEnterOnStringTextActionType(rowData: any ){
2174
- this.userActionTableMetaData = {
2175
- 'lastEmailResentAt': rowData.lastEmailResentAt,
2176
- 'passwordValidity': rowData.passwordValidity,
2177
- 'status': rowData.userActivationStatus
2178
- }
2179
- }
2180
-
2181
- onClickableDataClicked(Rowdata: any, id: number){
2182
- this.clickableDataClicked.emit({data: Rowdata, id: id});
2183
- }
2184
-
2185
-
2186
- }