@annalib/anna-core 4.2.5 → 4.2.7

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