tango-app-ui-shared 3.5.0-alpha.2 → 3.5.0-alpha.4
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.
- package/esm2022/lib/interceptors/http-auth-interceptor.mjs +144 -67
- package/esm2022/lib/modules/layout/sidebar/sidebar-footer/sidebar-footer.component.mjs +1 -3
- package/esm2022/lib/modules/layout/toolbar/metrics-header/metrics-header.component.mjs +298 -208
- package/esm2022/lib/modules/layout/toolbar/single-storedate/single-storedate.component.mjs +10 -11
- package/esm2022/lib/services/auth.service.mjs +21 -4
- package/fesm2022/tango-app-ui-shared.mjs +470 -289
- package/fesm2022/tango-app-ui-shared.mjs.map +1 -1
- package/lib/interceptors/http-auth-interceptor.d.ts +1 -0
- package/lib/modules/layout/toolbar/metrics-header/metrics-header.component.d.ts +2 -2
- package/lib/services/auth.service.d.ts +5 -0
- package/package.json +1 -1
|
@@ -73,9 +73,8 @@ class AuthService {
|
|
|
73
73
|
return headers;
|
|
74
74
|
}
|
|
75
75
|
logout() {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
});
|
|
76
|
+
this.deleteCookie(this.authlocalStorageToken);
|
|
77
|
+
return this.http.get(`${this.userApiUrl}/logout`);
|
|
79
78
|
}
|
|
80
79
|
getClients() {
|
|
81
80
|
return this.http.get(`${this.clientApiUrl}/get-clients`, {})
|
|
@@ -151,6 +150,24 @@ class AuthService {
|
|
|
151
150
|
getHeaderZone(data) {
|
|
152
151
|
return this.http.post(`${this.trafficApiUrl}/headerZoneV2`, data);
|
|
153
152
|
}
|
|
153
|
+
base64Encode(str) {
|
|
154
|
+
return btoa(encodeURIComponent(str));
|
|
155
|
+
}
|
|
156
|
+
base64Decode(str) {
|
|
157
|
+
return decodeURIComponent(atob(str));
|
|
158
|
+
}
|
|
159
|
+
setCookie(name, value, days = 1) {
|
|
160
|
+
const encodedValue = this.base64Encode(value);
|
|
161
|
+
const expires = new Date(Date.now() + days * 864e5).toUTCString();
|
|
162
|
+
document.cookie = `${name}=${encodedValue}; expires=${expires}; path=/; Secure; SameSite=Strict`;
|
|
163
|
+
}
|
|
164
|
+
getCookie(name) {
|
|
165
|
+
const match = document.cookie.match(new RegExp(`(^| )${name}=([^;]+)`));
|
|
166
|
+
return match ? this.base64Decode(match[2]) : null;
|
|
167
|
+
}
|
|
168
|
+
deleteCookie(name) {
|
|
169
|
+
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
|
170
|
+
}
|
|
154
171
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, deps: [{ token: i2.Router }, { token: i1.GlobalStateService }, { token: i3.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
155
172
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: AuthService, providedIn: 'root' });
|
|
156
173
|
}
|
|
@@ -5251,6 +5268,11 @@ class SingleStoredateComponent {
|
|
|
5251
5268
|
this.selectedFilters.clientName = headerFilters.clientName || "";
|
|
5252
5269
|
this.selectedFilters.store = this.dataUser?.storeId ?? headerFilters.store ?? "";
|
|
5253
5270
|
this.selectedFilters.storeName = headerFilters.storeName || "";
|
|
5271
|
+
this.selectedFilters.group = headerFilters.group;
|
|
5272
|
+
this.selectedFilters.location = headerFilters.location;
|
|
5273
|
+
this.selectedFilters.country = headerFilters.country;
|
|
5274
|
+
this.selectedFilters.stores = headerFilters.stores ?? "";
|
|
5275
|
+
this.selectedFilters.zoneName = headerFilters.zoneName ?? "";
|
|
5254
5276
|
// ✅ Handle query param date if present
|
|
5255
5277
|
if (this.dataUser?.date) {
|
|
5256
5278
|
const date = this.dataUser.date;
|
|
@@ -5317,19 +5339,13 @@ class SingleStoredateComponent {
|
|
|
5317
5339
|
const headerFilters = JSON.parse(localStorage.getItem("header-filters") || "{}");
|
|
5318
5340
|
this.selectedFilters.date = headerFilters.date;
|
|
5319
5341
|
}
|
|
5320
|
-
|
|
5321
|
-
this.selectedFilters.date.startDate = this.dataUser.date;
|
|
5322
|
-
this.selectedFilters.date.endDate = this.dataUser.date;
|
|
5323
|
-
}
|
|
5324
|
-
else {
|
|
5325
|
-
this.selectedFilters.date = this.selectedFilters.date;
|
|
5326
|
-
}
|
|
5327
|
-
const clientId = this.users?.clientId ?? this.dataUser?.client ?? '';
|
|
5342
|
+
const clientId = this.users?.clientId ?? this.dataUser?.client ?? this.selectedFilters.client;
|
|
5328
5343
|
this.selectedFilters.client = clientId;
|
|
5329
|
-
this.selectedFilters.clients = clientId ? [clientId] : [];
|
|
5344
|
+
this.selectedFilters.clients = clientId ? [clientId] : [this.selectedFilters.client];
|
|
5345
|
+
this.selectedFilters.date = this.selectedFilters.date;
|
|
5330
5346
|
this.selectedFilters.storeName = this.selectedFilters.storeName || '';
|
|
5331
|
-
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
5332
5347
|
this.gs.dataRangeValue.next(this.selectedFilters);
|
|
5348
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
5333
5349
|
this.cd.detectChanges();
|
|
5334
5350
|
}
|
|
5335
5351
|
Apply() {
|
|
@@ -6861,8 +6877,10 @@ class MetricsHeaderComponent {
|
|
|
6861
6877
|
const isValidDate = m > this.dayjs();
|
|
6862
6878
|
return isValidDate ? "invalid-date" : false;
|
|
6863
6879
|
};
|
|
6864
|
-
selectedDateRange = {
|
|
6865
|
-
|
|
6880
|
+
selectedDateRange = {
|
|
6881
|
+
startDate: dayjs().subtract(30, "days"),
|
|
6882
|
+
endDate: dayjs().subtract(1, "days"),
|
|
6883
|
+
};
|
|
6866
6884
|
selectedFilters = {
|
|
6867
6885
|
client: null,
|
|
6868
6886
|
clientName: null,
|
|
@@ -6873,7 +6891,7 @@ class MetricsHeaderComponent {
|
|
|
6873
6891
|
group: [],
|
|
6874
6892
|
location: [],
|
|
6875
6893
|
country: [],
|
|
6876
|
-
zoneName: []
|
|
6894
|
+
zoneName: [],
|
|
6877
6895
|
};
|
|
6878
6896
|
Opendropdown = false;
|
|
6879
6897
|
dropdownOpen = null; // 'location' or 'group'
|
|
@@ -6887,8 +6905,8 @@ class MetricsHeaderComponent {
|
|
|
6887
6905
|
filteredZones = [];
|
|
6888
6906
|
stores = [];
|
|
6889
6907
|
zones = [];
|
|
6890
|
-
searchStoreText =
|
|
6891
|
-
searchZoneText =
|
|
6908
|
+
searchStoreText = "";
|
|
6909
|
+
searchZoneText = "";
|
|
6892
6910
|
clientList = [];
|
|
6893
6911
|
selectedClient;
|
|
6894
6912
|
locationLabel = [];
|
|
@@ -6907,7 +6925,7 @@ class MetricsHeaderComponent {
|
|
|
6907
6925
|
}
|
|
6908
6926
|
onClick(event) {
|
|
6909
6927
|
const target = event.target;
|
|
6910
|
-
if (!target.closest(
|
|
6928
|
+
if (!target.closest(".dropdown2")) {
|
|
6911
6929
|
this.Opendropdown = false;
|
|
6912
6930
|
}
|
|
6913
6931
|
}
|
|
@@ -6922,12 +6940,12 @@ class MetricsHeaderComponent {
|
|
|
6922
6940
|
// this.setRangesBasedOnRoute();
|
|
6923
6941
|
// }
|
|
6924
6942
|
// });
|
|
6925
|
-
this.url = this.router.url.split("?")[0].split(
|
|
6926
|
-
const user = JSON.parse(localStorage.getItem(
|
|
6943
|
+
this.url = this.router.url.split("?")[0].split("/");
|
|
6944
|
+
const user = JSON.parse(localStorage.getItem("user-info"));
|
|
6927
6945
|
this.users = user;
|
|
6928
6946
|
this.gs?.manageRefreshTrigger?.subscribe((e) => {
|
|
6929
6947
|
if (e) {
|
|
6930
|
-
if (user.userType ===
|
|
6948
|
+
if (user.userType === "tango") {
|
|
6931
6949
|
this.getClient();
|
|
6932
6950
|
}
|
|
6933
6951
|
else {
|
|
@@ -6936,18 +6954,18 @@ class MetricsHeaderComponent {
|
|
|
6936
6954
|
const headerFilters = JSON.parse(storedFilters);
|
|
6937
6955
|
this.filteredStores = headerFilters?.stores.map((store) => ({
|
|
6938
6956
|
...store,
|
|
6939
|
-
checked: store.checked
|
|
6957
|
+
checked: store.checked,
|
|
6940
6958
|
}));
|
|
6941
6959
|
this.filteredZones = headerFilters?.zoneName.map((store) => ({
|
|
6942
6960
|
...store,
|
|
6943
|
-
checked: store.checked
|
|
6961
|
+
checked: store.checked,
|
|
6944
6962
|
}));
|
|
6945
6963
|
}
|
|
6946
6964
|
}
|
|
6947
6965
|
}
|
|
6948
6966
|
});
|
|
6949
6967
|
// Fetch client data if the user is of type 'tango'
|
|
6950
|
-
if (user.userType ===
|
|
6968
|
+
if (user.userType === "tango") {
|
|
6951
6969
|
this.getClient();
|
|
6952
6970
|
}
|
|
6953
6971
|
else {
|
|
@@ -6959,7 +6977,7 @@ class MetricsHeaderComponent {
|
|
|
6959
6977
|
if (clientFilters) {
|
|
6960
6978
|
const headerclientFilters = JSON.parse(clientFilters);
|
|
6961
6979
|
this.selectedClient = {
|
|
6962
|
-
trafficDateRange: headerclientFilters.trafficDateRange
|
|
6980
|
+
trafficDateRange: headerclientFilters.trafficDateRange,
|
|
6963
6981
|
};
|
|
6964
6982
|
}
|
|
6965
6983
|
}
|
|
@@ -6970,7 +6988,7 @@ class MetricsHeaderComponent {
|
|
|
6970
6988
|
// Initialize selectedFilters with defaults or existing values
|
|
6971
6989
|
this.selectedFilters = {
|
|
6972
6990
|
client: headerFilters.client || this.users.client,
|
|
6973
|
-
clientName: headerFilters.clientName ||
|
|
6991
|
+
clientName: headerFilters.clientName || "",
|
|
6974
6992
|
clients: headerFilters.clients || [],
|
|
6975
6993
|
store: headerFilters.store || null,
|
|
6976
6994
|
date: headerFilters.date || {},
|
|
@@ -7013,7 +7031,7 @@ class MetricsHeaderComponent {
|
|
|
7013
7031
|
return items
|
|
7014
7032
|
? items.map((item) => ({
|
|
7015
7033
|
...item,
|
|
7016
|
-
checked: item.checked === true
|
|
7034
|
+
checked: item.checked === true,
|
|
7017
7035
|
}))
|
|
7018
7036
|
: [];
|
|
7019
7037
|
}
|
|
@@ -7028,7 +7046,7 @@ class MetricsHeaderComponent {
|
|
|
7028
7046
|
resetFilters() {
|
|
7029
7047
|
this.selectedFilters = {
|
|
7030
7048
|
client: null,
|
|
7031
|
-
clientName:
|
|
7049
|
+
clientName: "",
|
|
7032
7050
|
clients: [],
|
|
7033
7051
|
store: null,
|
|
7034
7052
|
date: {},
|
|
@@ -7036,7 +7054,7 @@ class MetricsHeaderComponent {
|
|
|
7036
7054
|
group: [],
|
|
7037
7055
|
location: [],
|
|
7038
7056
|
country: [],
|
|
7039
|
-
zoneName: []
|
|
7057
|
+
zoneName: [],
|
|
7040
7058
|
};
|
|
7041
7059
|
this.filteredLocations = [];
|
|
7042
7060
|
this.filteredGroups = [];
|
|
@@ -7135,13 +7153,13 @@ class MetricsHeaderComponent {
|
|
|
7135
7153
|
}
|
|
7136
7154
|
getUserInfo(client) {
|
|
7137
7155
|
let obj = {
|
|
7138
|
-
clientId: client ? client :
|
|
7156
|
+
clientId: client ? client : "",
|
|
7139
7157
|
};
|
|
7140
7158
|
if (client) {
|
|
7141
7159
|
this.auth.getHeaderUsers(obj).subscribe({
|
|
7142
7160
|
next: (e) => {
|
|
7143
7161
|
localStorage.setItem("usersEmail-info", JSON.stringify(e?.data?.userEmailData || []));
|
|
7144
|
-
}
|
|
7162
|
+
},
|
|
7145
7163
|
});
|
|
7146
7164
|
}
|
|
7147
7165
|
}
|
|
@@ -7174,7 +7192,7 @@ class MetricsHeaderComponent {
|
|
|
7174
7192
|
this.getStore();
|
|
7175
7193
|
this.getGroups();
|
|
7176
7194
|
// Update localStorage with the new client selection and empty filter data
|
|
7177
|
-
localStorage.setItem(
|
|
7195
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7178
7196
|
window.location.reload();
|
|
7179
7197
|
// Emit data to the global service
|
|
7180
7198
|
// this.gs.dataRangeValue.next(this.selectedFilters);
|
|
@@ -7183,16 +7201,16 @@ class MetricsHeaderComponent {
|
|
|
7183
7201
|
}
|
|
7184
7202
|
ranges = {
|
|
7185
7203
|
Today: [dayjs(), dayjs()],
|
|
7186
|
-
Yesterday: [dayjs().subtract(1,
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
dayjs().subtract(14,
|
|
7190
|
-
dayjs().subtract(8,
|
|
7204
|
+
Yesterday: [dayjs().subtract(1, "days"), dayjs().subtract(1, "days")],
|
|
7205
|
+
"This Week": [dayjs().subtract(7, "days"), dayjs().subtract(1, "days")],
|
|
7206
|
+
"Last Week": [
|
|
7207
|
+
dayjs().subtract(14, "days").startOf("day"),
|
|
7208
|
+
dayjs().subtract(8, "days").endOf("day"),
|
|
7191
7209
|
],
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
dayjs().subtract(1,
|
|
7195
|
-
dayjs().subtract(1,
|
|
7210
|
+
"This Month": [dayjs().subtract(30, "days"), dayjs().subtract(1, "days")],
|
|
7211
|
+
"Last Month": [
|
|
7212
|
+
dayjs().subtract(1, "month").startOf("month"),
|
|
7213
|
+
dayjs().subtract(1, "month").endOf("month"),
|
|
7196
7214
|
],
|
|
7197
7215
|
};
|
|
7198
7216
|
onStartDateChange(event) {
|
|
@@ -7205,7 +7223,8 @@ class MetricsHeaderComponent {
|
|
|
7205
7223
|
}
|
|
7206
7224
|
else {
|
|
7207
7225
|
this.isCustomDate = (m) => {
|
|
7208
|
-
const isValidDate = m > this.dayjs() ||
|
|
7226
|
+
const isValidDate = m > this.dayjs() ||
|
|
7227
|
+
m > this.dayjs(event.startDate.add(180, "days"));
|
|
7209
7228
|
return isValidDate ? "invalid-date" : false;
|
|
7210
7229
|
};
|
|
7211
7230
|
}
|
|
@@ -7234,18 +7253,22 @@ class MetricsHeaderComponent {
|
|
|
7234
7253
|
}
|
|
7235
7254
|
getLocations() {
|
|
7236
7255
|
const country = this.countries
|
|
7237
|
-
.filter(country => country.checked)
|
|
7238
|
-
.map(country => country.country);
|
|
7256
|
+
.filter((country) => country.checked)
|
|
7257
|
+
.map((country) => country.country);
|
|
7239
7258
|
// const headerFilters: any = JSON.parse(localStorage.getItem("header-filters") || "{}");
|
|
7240
7259
|
let obj = {
|
|
7241
|
-
clientId: this.selectedFilters.client
|
|
7260
|
+
clientId: this.selectedFilters.client
|
|
7261
|
+
? this.selectedFilters.client
|
|
7262
|
+
: this.users.clientId,
|
|
7242
7263
|
country,
|
|
7243
7264
|
city: [],
|
|
7244
7265
|
group: [],
|
|
7245
7266
|
};
|
|
7246
7267
|
this.auth.getLocation(obj).subscribe({
|
|
7247
7268
|
next: (res) => {
|
|
7248
|
-
let cityList = this.selectedFilters?.location
|
|
7269
|
+
let cityList = this.selectedFilters?.location
|
|
7270
|
+
?.filter((location) => location.checked)
|
|
7271
|
+
.map((loc) => loc.city);
|
|
7249
7272
|
// Map the fetched locations with default unchecked state
|
|
7250
7273
|
this.locations = res?.data?.locationData.map((city) => ({
|
|
7251
7274
|
city: city.city,
|
|
@@ -7253,19 +7276,26 @@ class MetricsHeaderComponent {
|
|
|
7253
7276
|
checked: cityList?.includes(city.city) ? true : false,
|
|
7254
7277
|
}));
|
|
7255
7278
|
// Sync the fetched locations with any stored checked values in localStorage
|
|
7256
|
-
if (this.selectedFilters.location &&
|
|
7257
|
-
|
|
7279
|
+
if (this.selectedFilters.location &&
|
|
7280
|
+
Array.isArray(this.selectedFilters.location)) {
|
|
7281
|
+
this.filteredLocations = this.locations.map((location) => {
|
|
7258
7282
|
const matchedLocation = this.selectedFilters.location.find((loc) => loc.city === location.city);
|
|
7259
|
-
return matchedLocation
|
|
7283
|
+
return matchedLocation
|
|
7284
|
+
? { ...location, checked: matchedLocation.checked }
|
|
7285
|
+
: location;
|
|
7260
7286
|
});
|
|
7261
7287
|
}
|
|
7262
7288
|
else {
|
|
7263
7289
|
this.filteredLocations = this.locations;
|
|
7264
7290
|
}
|
|
7265
7291
|
if (this.searchLocationText) {
|
|
7266
|
-
this.filteredLocations = this.locations.filter((location) => location.city
|
|
7292
|
+
this.filteredLocations = this.locations.filter((location) => location.city
|
|
7293
|
+
.toLowerCase()
|
|
7294
|
+
.includes(this.searchLocationText.toLowerCase()));
|
|
7267
7295
|
}
|
|
7268
|
-
const selectedLocations = this.locations
|
|
7296
|
+
const selectedLocations = this.locations
|
|
7297
|
+
.filter((location) => location.checked)
|
|
7298
|
+
.map((location) => location.city);
|
|
7269
7299
|
if (selectedLocations.length > 0) {
|
|
7270
7300
|
setTimeout(() => {
|
|
7271
7301
|
this.getGroups();
|
|
@@ -7282,36 +7312,50 @@ class MetricsHeaderComponent {
|
|
|
7282
7312
|
});
|
|
7283
7313
|
}
|
|
7284
7314
|
isAllLocationsSelected() {
|
|
7285
|
-
return this.filteredLocations.every(location => location.checked);
|
|
7315
|
+
return this.filteredLocations.every((location) => location.checked);
|
|
7286
7316
|
}
|
|
7287
7317
|
selectedLocationsLabel() {
|
|
7288
|
-
const selectedLocations = this.locationLabel = this.searchLocationText
|
|
7289
|
-
.
|
|
7290
|
-
|
|
7318
|
+
const selectedLocations = (this.locationLabel = this.searchLocationText
|
|
7319
|
+
.length
|
|
7320
|
+
? this.locations
|
|
7321
|
+
.filter((location) => location.checked)
|
|
7322
|
+
.map((location) => location.city)
|
|
7323
|
+
: this.filteredLocations
|
|
7324
|
+
.filter((location) => location.checked)
|
|
7325
|
+
.map((location) => location.city));
|
|
7291
7326
|
return selectedLocations.length === 0
|
|
7292
|
-
?
|
|
7327
|
+
? ""
|
|
7293
7328
|
: selectedLocations.length === 1
|
|
7294
7329
|
? selectedLocations[0]
|
|
7295
|
-
: `${selectedLocations.length}
|
|
7330
|
+
: `${selectedLocations.length} Region`;
|
|
7296
7331
|
}
|
|
7297
7332
|
removeLocation() {
|
|
7298
7333
|
this.Reset();
|
|
7299
7334
|
}
|
|
7300
7335
|
getGroups() {
|
|
7301
7336
|
const country = this.countries
|
|
7302
|
-
.filter(country => country.checked)
|
|
7303
|
-
.map(country => country.country);
|
|
7337
|
+
.filter((country) => country.checked)
|
|
7338
|
+
.map((country) => country.country);
|
|
7304
7339
|
let city;
|
|
7305
7340
|
city = this.locations
|
|
7306
|
-
.filter(location => location.checked)
|
|
7307
|
-
.map(location => location.city);
|
|
7341
|
+
.filter((location) => location.checked)
|
|
7342
|
+
.map((location) => location.city);
|
|
7308
7343
|
if (!city.length && country.length) {
|
|
7309
7344
|
city = this.locations.map((loc) => loc.city);
|
|
7310
7345
|
}
|
|
7311
|
-
const obj = {
|
|
7346
|
+
const obj = {
|
|
7347
|
+
country,
|
|
7348
|
+
city,
|
|
7349
|
+
clientId: this.selectedFilters.client
|
|
7350
|
+
? this.selectedFilters.client
|
|
7351
|
+
: this.users.clientId,
|
|
7352
|
+
group: [],
|
|
7353
|
+
};
|
|
7312
7354
|
this.auth.getGroups(obj).subscribe({
|
|
7313
7355
|
next: (res) => {
|
|
7314
|
-
let checkedGroup = this.selectedFilters?.group
|
|
7356
|
+
let checkedGroup = this.selectedFilters?.group
|
|
7357
|
+
?.filter((group) => group.checked)
|
|
7358
|
+
.map((group) => group.groupName);
|
|
7315
7359
|
const combinedGroups = res?.data?.groupData?.map((groupName) => ({
|
|
7316
7360
|
groupName: groupName.groupName,
|
|
7317
7361
|
checked: checkedGroup?.includes(groupName.groupName) ? true : false,
|
|
@@ -7325,7 +7369,9 @@ class MetricsHeaderComponent {
|
|
|
7325
7369
|
this.filteredGroups = combinedGroups;
|
|
7326
7370
|
}
|
|
7327
7371
|
// Auto-fetch stores when groups are selected
|
|
7328
|
-
const selectedGroups = this.groupsData
|
|
7372
|
+
const selectedGroups = this.groupsData
|
|
7373
|
+
.filter((group) => group.checked)
|
|
7374
|
+
.map((group) => group.groupName);
|
|
7329
7375
|
if (selectedGroups.length > 0) {
|
|
7330
7376
|
setTimeout(() => {
|
|
7331
7377
|
this.getStore(); // Fetch stores based on selected groups
|
|
@@ -7345,51 +7391,57 @@ class MetricsHeaderComponent {
|
|
|
7345
7391
|
else {
|
|
7346
7392
|
// Open the specific dropdown and handle data fetching only if necessary
|
|
7347
7393
|
this.dropdownOpen = type;
|
|
7348
|
-
if (type ===
|
|
7394
|
+
if (type === "country") {
|
|
7349
7395
|
// Fetch countries only if not already fetched and no search text exists
|
|
7350
|
-
if ((!this.filteredCountries || this.filteredCountries.length === 0) &&
|
|
7396
|
+
if ((!this.filteredCountries || this.filteredCountries.length === 0) &&
|
|
7397
|
+
!this.searchCountryText.trim()) {
|
|
7351
7398
|
this.getCountry();
|
|
7352
7399
|
}
|
|
7353
7400
|
}
|
|
7354
|
-
if (type ===
|
|
7401
|
+
if (type === "group") {
|
|
7355
7402
|
// Fetch groups only if there are selected cities and no active search text
|
|
7356
7403
|
const selectedCities = this.locations
|
|
7357
7404
|
.filter((location) => location.checked)
|
|
7358
7405
|
.map((location) => location.city);
|
|
7359
7406
|
// Fetch groups only if locations are selected, no search text exists, and dropdown is opened
|
|
7360
|
-
if (this.filteredLocations.length > 0 ||
|
|
7407
|
+
if (this.filteredLocations.length > 0 ||
|
|
7408
|
+
(selectedCities.length > 0 && !this.searchGroupText.trim())) {
|
|
7361
7409
|
this.getGroups();
|
|
7362
7410
|
}
|
|
7363
7411
|
else {
|
|
7364
7412
|
this.filteredGroups = []; // Clear groups if no locations are selected
|
|
7365
7413
|
}
|
|
7366
7414
|
}
|
|
7367
|
-
if (type ===
|
|
7415
|
+
if (type === "store") {
|
|
7368
7416
|
// Fetch stores only if not already fetched and no search text is active
|
|
7369
|
-
if ((!this.filteredStores || this.filteredStores.length === 0) &&
|
|
7417
|
+
if ((!this.filteredStores || this.filteredStores.length === 0) &&
|
|
7418
|
+
!this.searchStoreText.trim()) {
|
|
7370
7419
|
this.getStore();
|
|
7371
7420
|
}
|
|
7372
7421
|
}
|
|
7373
|
-
if (type ===
|
|
7422
|
+
if (type === "zone") {
|
|
7374
7423
|
// Fetch stores only if not already fetched and no search text is active
|
|
7375
|
-
if ((!this.filteredZones || this.filteredZones.length === 0) &&
|
|
7424
|
+
if ((!this.filteredZones || this.filteredZones.length === 0) &&
|
|
7425
|
+
!this.searchZoneText.trim()) {
|
|
7376
7426
|
this.getZone();
|
|
7377
7427
|
}
|
|
7378
7428
|
}
|
|
7379
7429
|
}
|
|
7380
7430
|
}
|
|
7381
7431
|
handleGroupDropdownClick() {
|
|
7382
|
-
if (this.dropdownOpen ===
|
|
7432
|
+
if (this.dropdownOpen === "group") {
|
|
7383
7433
|
this.resetSelectedGroups();
|
|
7384
7434
|
}
|
|
7385
|
-
this.toggleDropdown(
|
|
7435
|
+
this.toggleDropdown("group");
|
|
7386
7436
|
}
|
|
7387
7437
|
resetSelectedGroups() {
|
|
7388
7438
|
this.filteredGroups.forEach((group) => (group.checked = false));
|
|
7389
7439
|
this.searchGroupText = "";
|
|
7390
7440
|
}
|
|
7391
7441
|
selectedGroupsLabel() {
|
|
7392
|
-
const selectedGroups = this.groupLabel = this.searchGroupText.length
|
|
7442
|
+
const selectedGroups = (this.groupLabel = this.searchGroupText.length
|
|
7443
|
+
? this.groupsData.filter((group) => group.checked)
|
|
7444
|
+
: this.filteredGroups.filter((group) => group.checked));
|
|
7393
7445
|
return selectedGroups.length === 0
|
|
7394
7446
|
? ""
|
|
7395
7447
|
: selectedGroups.length === 1
|
|
@@ -7400,23 +7452,25 @@ class MetricsHeaderComponent {
|
|
|
7400
7452
|
this.Reset();
|
|
7401
7453
|
}
|
|
7402
7454
|
isAllGroupsSelected() {
|
|
7403
|
-
return this.filteredGroups.length
|
|
7455
|
+
return this.filteredGroups.length
|
|
7456
|
+
? this.filteredGroups.every((group) => group.checked)
|
|
7457
|
+
: false;
|
|
7404
7458
|
}
|
|
7405
7459
|
getStore() {
|
|
7406
7460
|
const country = this.countries
|
|
7407
|
-
.filter(country => country.checked)
|
|
7408
|
-
.map(country => country.country);
|
|
7461
|
+
.filter((country) => country.checked)
|
|
7462
|
+
.map((country) => country.country);
|
|
7409
7463
|
const city = this.locations
|
|
7410
|
-
.filter(location => location.checked)
|
|
7411
|
-
.map(location => location.city);
|
|
7464
|
+
.filter((location) => location.checked)
|
|
7465
|
+
.map((location) => location.city);
|
|
7412
7466
|
const group = this.groupsData
|
|
7413
|
-
.filter(group => group.checked)
|
|
7414
|
-
.map(group => group.groupName);
|
|
7467
|
+
.filter((group) => group.checked)
|
|
7468
|
+
.map((group) => group.groupName);
|
|
7415
7469
|
const data = {
|
|
7416
7470
|
country,
|
|
7417
7471
|
city,
|
|
7418
7472
|
clusters: group,
|
|
7419
|
-
clientId: this.users.clientId || this.selectedFilters.client
|
|
7473
|
+
clientId: this.users.clientId || this.selectedFilters.client,
|
|
7420
7474
|
};
|
|
7421
7475
|
this.auth.getHeaderStores(data).subscribe({
|
|
7422
7476
|
next: (res) => {
|
|
@@ -7425,30 +7479,34 @@ class MetricsHeaderComponent {
|
|
|
7425
7479
|
this.stores = res.data.storesData;
|
|
7426
7480
|
// Check if there are previously selected stores
|
|
7427
7481
|
const checkedStoreIds = this.selectedFilters?.stores
|
|
7428
|
-
? this.selectedFilters.stores
|
|
7482
|
+
? this.selectedFilters.stores
|
|
7483
|
+
.filter((store) => store.checked)
|
|
7484
|
+
.map((store) => store.storeId)
|
|
7429
7485
|
: [];
|
|
7430
7486
|
// Sync the `checked` state
|
|
7431
|
-
this.stores.forEach(store => {
|
|
7487
|
+
this.stores.forEach((store) => {
|
|
7432
7488
|
store.checked = checkedStoreIds.length
|
|
7433
7489
|
? checkedStoreIds.includes(store.storeId) // Use previous selection
|
|
7434
7490
|
: true; // Default to true if no previous selection
|
|
7435
7491
|
});
|
|
7436
7492
|
// Apply search filter if search text is present
|
|
7437
7493
|
if (this.searchStoreText.length) {
|
|
7438
|
-
this.filteredStores = this.stores.filter(store => store.storeName
|
|
7494
|
+
this.filteredStores = this.stores.filter((store) => store.storeName
|
|
7495
|
+
.toLowerCase()
|
|
7496
|
+
.includes(this.searchStoreText.toLowerCase()));
|
|
7439
7497
|
}
|
|
7440
7498
|
else {
|
|
7441
7499
|
this.filteredStores = [...this.stores];
|
|
7442
7500
|
}
|
|
7443
7501
|
// Update `selectedFilters.stores` to reflect the current state
|
|
7444
|
-
this.selectedFilters.stores = this.filteredStores.map(store => ({
|
|
7502
|
+
this.selectedFilters.stores = this.filteredStores.map((store) => ({
|
|
7445
7503
|
storeId: store.storeId,
|
|
7446
7504
|
storeName: store.storeName,
|
|
7447
|
-
checked: store.checked
|
|
7505
|
+
checked: store.checked,
|
|
7448
7506
|
}));
|
|
7449
7507
|
// this.selectedFilters.country = country;
|
|
7450
7508
|
// Save updated filters to localStorage
|
|
7451
|
-
localStorage.setItem(
|
|
7509
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7452
7510
|
this.getZone();
|
|
7453
7511
|
// Trigger UI change detection
|
|
7454
7512
|
this.cd.detectChanges();
|
|
@@ -7461,93 +7519,108 @@ class MetricsHeaderComponent {
|
|
|
7461
7519
|
error: (err) => {
|
|
7462
7520
|
console.error("Failed to fetch stores", err);
|
|
7463
7521
|
this.clearStoresState();
|
|
7464
|
-
}
|
|
7522
|
+
},
|
|
7465
7523
|
});
|
|
7466
7524
|
}
|
|
7467
7525
|
getZone() {
|
|
7468
7526
|
const country = this.countries
|
|
7469
|
-
.filter(country => country.checked)
|
|
7470
|
-
.map(country => country.country);
|
|
7527
|
+
.filter((country) => country.checked)
|
|
7528
|
+
.map((country) => country.country);
|
|
7471
7529
|
const city = this.locations
|
|
7472
|
-
.filter(location => location.checked)
|
|
7473
|
-
.map(location => location.city);
|
|
7530
|
+
.filter((location) => location.checked)
|
|
7531
|
+
.map((location) => location.city);
|
|
7474
7532
|
const group = this.groupsData
|
|
7475
|
-
.filter(group => group.checked)
|
|
7476
|
-
.map(group => group.groupName);
|
|
7533
|
+
.filter((group) => group.checked)
|
|
7534
|
+
.map((group) => group.groupName);
|
|
7477
7535
|
const storeId = this.filteredStores
|
|
7478
|
-
.filter(group => group.checked)
|
|
7479
|
-
.map(group => group.storeId);
|
|
7536
|
+
.filter((group) => group.checked)
|
|
7537
|
+
.map((group) => group.storeId);
|
|
7480
7538
|
const data = {
|
|
7481
7539
|
country,
|
|
7482
7540
|
city,
|
|
7483
7541
|
clusters: group,
|
|
7484
7542
|
clientId: this.users.clientId || this.selectedFilters.client,
|
|
7485
|
-
storeId: storeId
|
|
7543
|
+
storeId: storeId,
|
|
7486
7544
|
};
|
|
7487
7545
|
this.auth.getHeaderZone(data).subscribe({
|
|
7488
7546
|
next: (res) => {
|
|
7489
7547
|
if (res && res.code === 200) {
|
|
7490
|
-
// Initialize
|
|
7491
|
-
this.zones =
|
|
7492
|
-
|
|
7548
|
+
// Initialize zones with Overall Store first, unchecked by default
|
|
7549
|
+
this.zones = [
|
|
7550
|
+
{ _id: "overall", tagName: "Overall Store", checked: false },
|
|
7551
|
+
...(res?.data?.zoneData?.map((zone) => ({
|
|
7552
|
+
_id: zone._id,
|
|
7553
|
+
tagName: zone.tagName,
|
|
7554
|
+
checked: false, // initialize unchecked; will update below
|
|
7555
|
+
})) || []),
|
|
7556
|
+
];
|
|
7557
|
+
// Get previously selected zone IDs (checked ones)
|
|
7493
7558
|
const checkedStoreIds = this.selectedFilters?.zoneName
|
|
7494
|
-
? this.selectedFilters
|
|
7559
|
+
? this.selectedFilters.zoneName
|
|
7560
|
+
.filter((zone) => zone.checked)
|
|
7561
|
+
.map((zone) => zone._id)
|
|
7495
7562
|
: [];
|
|
7496
|
-
// Sync
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7563
|
+
// Sync checked state with previous selections or default:
|
|
7564
|
+
// If no previous selection, Overall Store unchecked, others checked
|
|
7565
|
+
this.zones.forEach((zone) => {
|
|
7566
|
+
if (checkedStoreIds.length) {
|
|
7567
|
+
zone.checked = checkedStoreIds.includes(zone._id);
|
|
7568
|
+
}
|
|
7569
|
+
else {
|
|
7570
|
+
zone.checked = zone._id !== "overall";
|
|
7571
|
+
}
|
|
7501
7572
|
});
|
|
7502
|
-
// Apply search filter if
|
|
7573
|
+
// Apply search filter if any
|
|
7503
7574
|
if (this.searchZoneText.length) {
|
|
7504
|
-
this.filteredZones = this.zones.filter(zone => zone.tagName
|
|
7575
|
+
this.filteredZones = this.zones.filter((zone) => zone.tagName
|
|
7576
|
+
.toLowerCase()
|
|
7577
|
+
.includes(this.searchZoneText.toLowerCase()));
|
|
7505
7578
|
}
|
|
7506
7579
|
else {
|
|
7507
7580
|
this.filteredZones = [...this.zones];
|
|
7508
7581
|
}
|
|
7509
|
-
// Update
|
|
7510
|
-
this.selectedFilters.zoneName = this.filteredZones.map(zone => ({
|
|
7582
|
+
// Update selectedFilters.zoneName with current checked states
|
|
7583
|
+
this.selectedFilters.zoneName = this.filteredZones.map((zone) => ({
|
|
7511
7584
|
_id: zone._id,
|
|
7512
7585
|
tagName: zone.tagName,
|
|
7513
|
-
checked: zone.checked
|
|
7586
|
+
checked: zone.checked,
|
|
7514
7587
|
}));
|
|
7515
|
-
// this.selectedFilters.country = couthis.filteredZonesntry;
|
|
7516
7588
|
// Save updated filters to localStorage
|
|
7517
|
-
localStorage.setItem(
|
|
7518
|
-
// Trigger
|
|
7589
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7590
|
+
// Trigger change detection if needed
|
|
7519
7591
|
this.cd.detectChanges();
|
|
7520
7592
|
}
|
|
7521
7593
|
else {
|
|
7522
|
-
// Handle empty or error response
|
|
7523
7594
|
this.clearZoneState();
|
|
7524
7595
|
}
|
|
7525
7596
|
},
|
|
7526
7597
|
error: (err) => {
|
|
7527
|
-
console.error("Failed to fetch
|
|
7598
|
+
console.error("Failed to fetch zones", err);
|
|
7528
7599
|
this.clearZoneState();
|
|
7529
|
-
}
|
|
7600
|
+
},
|
|
7530
7601
|
});
|
|
7531
7602
|
}
|
|
7532
7603
|
clearZoneState() {
|
|
7533
7604
|
this.zones = [];
|
|
7534
7605
|
this.filteredZones = [];
|
|
7535
7606
|
this.selectedFilters.zonename = [];
|
|
7536
|
-
localStorage.setItem(
|
|
7607
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7537
7608
|
}
|
|
7538
7609
|
// Clear stores state and reset filters
|
|
7539
7610
|
clearStoresState() {
|
|
7540
7611
|
this.stores = [];
|
|
7541
7612
|
this.filteredStores = [];
|
|
7542
7613
|
this.selectedFilters.stores = [];
|
|
7543
|
-
localStorage.setItem(
|
|
7614
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7544
7615
|
}
|
|
7545
7616
|
resetSelectedStores() {
|
|
7546
7617
|
this.filteredStores.forEach((store) => (store.checked = false));
|
|
7547
7618
|
this.searchStoreText = "";
|
|
7548
7619
|
}
|
|
7549
7620
|
selectedStoresLabel() {
|
|
7550
|
-
const selectedStores = this.searchStoreText.length
|
|
7621
|
+
const selectedStores = this.searchStoreText.length
|
|
7622
|
+
? this.stores.filter((store) => store.checked)
|
|
7623
|
+
: this.filteredStores.filter((store) => store.checked);
|
|
7551
7624
|
return selectedStores.length === 0
|
|
7552
7625
|
? "0 Stores"
|
|
7553
7626
|
: selectedStores.length === 1
|
|
@@ -7555,7 +7628,9 @@ class MetricsHeaderComponent {
|
|
|
7555
7628
|
: `${selectedStores.length} Stores`;
|
|
7556
7629
|
}
|
|
7557
7630
|
selectedZonesLabel() {
|
|
7558
|
-
const selectedStores = this.searchZoneText.length
|
|
7631
|
+
const selectedStores = this.searchZoneText.length
|
|
7632
|
+
? this.zones.filter((zone) => zone.checked)
|
|
7633
|
+
: this.filteredZones.filter((zone) => zone.checked);
|
|
7559
7634
|
return selectedStores.length === 0
|
|
7560
7635
|
? "0 Zones"
|
|
7561
7636
|
: selectedStores.length === 1
|
|
@@ -7563,23 +7638,26 @@ class MetricsHeaderComponent {
|
|
|
7563
7638
|
: `${selectedStores.length} Zones`;
|
|
7564
7639
|
}
|
|
7565
7640
|
isAllStoresSelected() {
|
|
7566
|
-
return this.filteredStores.length > 0 &&
|
|
7641
|
+
return (this.filteredStores.length > 0 &&
|
|
7642
|
+
this.filteredStores.every((store) => store.checked));
|
|
7567
7643
|
}
|
|
7568
7644
|
isAllZonesSelected() {
|
|
7569
|
-
return this.filteredZones
|
|
7645
|
+
return this.filteredZones
|
|
7646
|
+
.filter((zone) => zone._id !== "overall")
|
|
7647
|
+
.every((zone) => zone.checked);
|
|
7570
7648
|
}
|
|
7571
7649
|
// Method to handle dropdown item selection
|
|
7572
7650
|
updateSelectedStores() {
|
|
7573
|
-
this.filteredStores.forEach(store => {
|
|
7574
|
-
const filteredStore = this.stores.findIndex(fStore => fStore.storeId === store.storeId);
|
|
7651
|
+
this.filteredStores.forEach((store) => {
|
|
7652
|
+
const filteredStore = this.stores.findIndex((fStore) => fStore.storeId === store.storeId);
|
|
7575
7653
|
if (filteredStore != -1) {
|
|
7576
7654
|
this.stores[filteredStore].checked = store.checked; // Sync the checked state with full store list
|
|
7577
7655
|
}
|
|
7578
7656
|
});
|
|
7579
7657
|
// Update selectedFilters based on the current store selection
|
|
7580
|
-
this.selectedFilters.stores = this.stores.filter(store => store.checked);
|
|
7658
|
+
this.selectedFilters.stores = this.stores.filter((store) => store.checked);
|
|
7581
7659
|
// Update localStorage with the latest selection
|
|
7582
|
-
localStorage.setItem(
|
|
7660
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7583
7661
|
// Emit updated filters via service
|
|
7584
7662
|
// this.gs.dataRangeValue.next(this.selectedFilters);
|
|
7585
7663
|
// Trigger change detection if necessary
|
|
@@ -7591,20 +7669,30 @@ class MetricsHeaderComponent {
|
|
|
7591
7669
|
this.selectedFilters.zoneName = [];
|
|
7592
7670
|
this.cd.detectChanges();
|
|
7593
7671
|
}
|
|
7594
|
-
updateSelectedZones() {
|
|
7595
|
-
this.filteredZones.forEach(zone => {
|
|
7596
|
-
const
|
|
7597
|
-
if (
|
|
7598
|
-
this.zones[
|
|
7672
|
+
updateSelectedZones(clickedZoneId) {
|
|
7673
|
+
this.filteredZones.forEach((zone) => {
|
|
7674
|
+
const index = this.zones.findIndex((z) => z._id === zone._id);
|
|
7675
|
+
if (index !== -1) {
|
|
7676
|
+
this.zones[index].checked = zone.checked;
|
|
7599
7677
|
}
|
|
7600
7678
|
});
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7679
|
+
const overallZone = this.zones.find((z) => z._id === "overall");
|
|
7680
|
+
const overallChecked = overallZone?.checked ?? false;
|
|
7681
|
+
const othersSelected = this.zones.some((z) => z._id !== "overall" && z.checked);
|
|
7682
|
+
if (clickedZoneId === "overall" && overallChecked) {
|
|
7683
|
+
this.zones = this.zones.map((z) => ({
|
|
7684
|
+
...z,
|
|
7685
|
+
checked: z._id === "overall",
|
|
7686
|
+
}));
|
|
7687
|
+
}
|
|
7688
|
+
if (clickedZoneId !== "overall" && overallChecked) {
|
|
7689
|
+
if (overallZone) {
|
|
7690
|
+
overallZone.checked = false;
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7693
|
+
this.filteredZones = [...this.zones];
|
|
7694
|
+
this.selectedFilters.zoneName = this.zones.filter((z) => z.checked);
|
|
7695
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7608
7696
|
this.cd.detectChanges();
|
|
7609
7697
|
}
|
|
7610
7698
|
toggleSelectAllLocations(event) {
|
|
@@ -7615,9 +7703,9 @@ class MetricsHeaderComponent {
|
|
|
7615
7703
|
toggleSelectAllStores(event) {
|
|
7616
7704
|
const checked = event.target.checked;
|
|
7617
7705
|
// Apply the selection to both filtered and full list of stores
|
|
7618
|
-
this.filteredStores.forEach(store => store.checked = checked);
|
|
7619
|
-
this.stores.forEach(store => {
|
|
7620
|
-
const filteredStore = this.filteredStores.find(fStore => fStore.storeId === store.storeId);
|
|
7706
|
+
this.filteredStores.forEach((store) => (store.checked = checked));
|
|
7707
|
+
this.stores.forEach((store) => {
|
|
7708
|
+
const filteredStore = this.filteredStores.find((fStore) => fStore.storeId === store.storeId);
|
|
7621
7709
|
if (filteredStore) {
|
|
7622
7710
|
store.checked = checked; // Sync the checked state with full store list
|
|
7623
7711
|
}
|
|
@@ -7627,16 +7715,24 @@ class MetricsHeaderComponent {
|
|
|
7627
7715
|
}
|
|
7628
7716
|
toggleSelectAllZones(event) {
|
|
7629
7717
|
const checked = event.target.checked;
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
zone.checked =
|
|
7718
|
+
this.filteredZones.forEach((zone) => {
|
|
7719
|
+
if (zone._id !== "overall") {
|
|
7720
|
+
zone.checked = checked;
|
|
7721
|
+
}
|
|
7722
|
+
else {
|
|
7723
|
+
zone.checked = false;
|
|
7636
7724
|
}
|
|
7637
7725
|
});
|
|
7638
|
-
|
|
7639
|
-
|
|
7726
|
+
this.zones.forEach((zone) => {
|
|
7727
|
+
const match = this.filteredZones.find((fz) => fz._id === zone._id);
|
|
7728
|
+
if (match) {
|
|
7729
|
+
zone.checked = match.checked;
|
|
7730
|
+
}
|
|
7731
|
+
});
|
|
7732
|
+
// Since this is bulk, pass a dummy value — any non-overall zone is fine
|
|
7733
|
+
const anySelectedZone = this.filteredZones.find((z) => z._id !== "overall");
|
|
7734
|
+
const clickedId = anySelectedZone ? anySelectedZone._id : "";
|
|
7735
|
+
this.updateSelectedZones(clickedId);
|
|
7640
7736
|
}
|
|
7641
7737
|
updateSelectedLocations() {
|
|
7642
7738
|
// When locations are selected, fetch the related groups
|
|
@@ -7663,8 +7759,8 @@ class MetricsHeaderComponent {
|
|
|
7663
7759
|
}
|
|
7664
7760
|
this.selectedFilters.group = [];
|
|
7665
7761
|
this.filteredStores = []; // Reset stores as well
|
|
7666
|
-
this.searchGroupText =
|
|
7667
|
-
this.searchStoreText =
|
|
7762
|
+
this.searchGroupText = "";
|
|
7763
|
+
this.searchStoreText = "";
|
|
7668
7764
|
// this.Opendropdown = false;
|
|
7669
7765
|
}
|
|
7670
7766
|
toggleSelectAllGroups(event) {
|
|
@@ -7694,26 +7790,25 @@ class MetricsHeaderComponent {
|
|
|
7694
7790
|
this.filteredStores = [];
|
|
7695
7791
|
// Also, update localStorage to reflect the cleared store selection
|
|
7696
7792
|
this.selectedFilters.stores = [];
|
|
7697
|
-
localStorage.setItem(
|
|
7793
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7698
7794
|
// Emit data via service
|
|
7699
7795
|
// this.gs.dataRangeValue.next(this.selectedFilters);
|
|
7700
7796
|
}
|
|
7701
7797
|
// Clear the search store text when groups are updated
|
|
7702
|
-
this.searchStoreText =
|
|
7798
|
+
this.searchStoreText = "";
|
|
7703
7799
|
}
|
|
7704
7800
|
Reset() {
|
|
7705
7801
|
setTimeout(() => {
|
|
7706
|
-
// Clear selected groups, stores, and locations
|
|
7707
7802
|
this.filteredCountries = [];
|
|
7708
7803
|
this.filteredGroups = [];
|
|
7709
7804
|
this.filteredStores = [];
|
|
7710
|
-
this.filteredLocations = [];
|
|
7805
|
+
this.filteredLocations = [];
|
|
7711
7806
|
this.locations = [];
|
|
7712
7807
|
this.groupsData = [];
|
|
7713
7808
|
this.stores = [];
|
|
7714
7809
|
this.filteredZones = [];
|
|
7715
7810
|
this.zones = [];
|
|
7716
|
-
|
|
7811
|
+
this.countries = [];
|
|
7717
7812
|
this.searchLocationText = "";
|
|
7718
7813
|
this.searchGroupText = "";
|
|
7719
7814
|
this.searchStoreText = "";
|
|
@@ -7722,32 +7817,14 @@ class MetricsHeaderComponent {
|
|
|
7722
7817
|
this.selectedFilters.location = [];
|
|
7723
7818
|
this.selectedFilters.country = [];
|
|
7724
7819
|
this.selectedFilters.zoneName = [];
|
|
7725
|
-
// Fetch locations, groups, and stores again
|
|
7726
7820
|
this.getCountry();
|
|
7727
7821
|
this.getLocations();
|
|
7728
7822
|
this.getStore();
|
|
7729
7823
|
this.getGroups();
|
|
7730
|
-
|
|
7731
|
-
// // Once stores are fetched, mark all as checked
|
|
7732
|
-
// setTimeout(() => {
|
|
7733
|
-
// this.filteredStores = this.stores.map(store => ({
|
|
7734
|
-
// ...store,
|
|
7735
|
-
// checked: true // Mark all stores as checked
|
|
7736
|
-
// }));
|
|
7737
|
-
// // Sync selectedFilters with the updated store state
|
|
7738
|
-
// this.selectedFilters.stores = this.filteredStores.map(store => ({
|
|
7739
|
-
// ...store,
|
|
7740
|
-
// checked: true
|
|
7741
|
-
// }));
|
|
7742
|
-
// Update localStorage with the latest selectedFilters
|
|
7743
|
-
localStorage.setItem('header-filters', JSON.stringify(this.selectedFilters));
|
|
7824
|
+
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
7744
7825
|
window.location.reload();
|
|
7745
|
-
// Emit the reset filters to update other components if needed
|
|
7746
7826
|
// this.gs.dataRangeValue.next(this.selectedFilters);
|
|
7747
|
-
// Trigger change detection
|
|
7748
7827
|
this.cd.detectChanges();
|
|
7749
|
-
// Adding a slight delay to ensure stores are fetched first
|
|
7750
|
-
// Close dropdown after reset if necessary
|
|
7751
7828
|
this.Opendropdown = false;
|
|
7752
7829
|
}, 100);
|
|
7753
7830
|
}
|
|
@@ -7756,17 +7833,18 @@ class MetricsHeaderComponent {
|
|
|
7756
7833
|
if (searchText) {
|
|
7757
7834
|
// Preserve the checked state during filtering
|
|
7758
7835
|
this.filteredLocations = this.locations
|
|
7759
|
-
.map(location => ({
|
|
7836
|
+
.map((location) => ({
|
|
7760
7837
|
...location,
|
|
7761
|
-
checked: this.filteredLocations.find(l => l.city === location.city)
|
|
7838
|
+
checked: this.filteredLocations.find((l) => l.city === location.city)
|
|
7839
|
+
?.checked || false,
|
|
7762
7840
|
}))
|
|
7763
|
-
.filter(location => location?.city?.toLowerCase().includes(searchText));
|
|
7841
|
+
.filter((location) => location?.city?.toLowerCase().includes(searchText));
|
|
7764
7842
|
}
|
|
7765
7843
|
else {
|
|
7766
7844
|
// Restore the original checked state when search text is cleared
|
|
7767
|
-
this.filteredLocations = this.locations.map(location => ({
|
|
7845
|
+
this.filteredLocations = this.locations.map((location) => ({
|
|
7768
7846
|
...location,
|
|
7769
|
-
checked: this.selectedFilters.location.find((l) => l.city === location.city)?.checked || false
|
|
7847
|
+
checked: this.selectedFilters.location.find((l) => l.city === location.city)?.checked || false,
|
|
7770
7848
|
}));
|
|
7771
7849
|
}
|
|
7772
7850
|
}
|
|
@@ -7775,17 +7853,18 @@ class MetricsHeaderComponent {
|
|
|
7775
7853
|
if (searchText) {
|
|
7776
7854
|
// Preserve the checked state during filtering
|
|
7777
7855
|
this.filteredGroups = this.groupsData
|
|
7778
|
-
.map(group => ({
|
|
7856
|
+
.map((group) => ({
|
|
7779
7857
|
...group,
|
|
7780
|
-
checked: this.filteredGroups.find(g => g.groupName === group.groupName)
|
|
7858
|
+
checked: this.filteredGroups.find((g) => g.groupName === group.groupName)
|
|
7859
|
+
?.checked || false,
|
|
7781
7860
|
}))
|
|
7782
|
-
.filter(group => group?.groupName?.toLowerCase().includes(searchText));
|
|
7861
|
+
.filter((group) => group?.groupName?.toLowerCase().includes(searchText));
|
|
7783
7862
|
}
|
|
7784
7863
|
else {
|
|
7785
7864
|
// Restore the original checked state when search text is cleared
|
|
7786
|
-
this.filteredGroups = this.groupsData.map(group => ({
|
|
7865
|
+
this.filteredGroups = this.groupsData.map((group) => ({
|
|
7787
7866
|
...group,
|
|
7788
|
-
checked: this.selectedFilters.group.find((g) => g.groupName === group.groupName)?.checked || false
|
|
7867
|
+
checked: this.selectedFilters.group.find((g) => g.groupName === group.groupName)?.checked || false,
|
|
7789
7868
|
}));
|
|
7790
7869
|
}
|
|
7791
7870
|
}
|
|
@@ -7795,19 +7874,23 @@ class MetricsHeaderComponent {
|
|
|
7795
7874
|
if (searchText) {
|
|
7796
7875
|
// Filter based on search text while preserving checked state
|
|
7797
7876
|
this.filteredStores = this.stores
|
|
7798
|
-
.map(store => ({
|
|
7877
|
+
.map((store) => ({
|
|
7799
7878
|
...store,
|
|
7800
7879
|
// Check if the store is already checked in filteredStores, fallback to original stores' checked state
|
|
7801
|
-
checked: this.selectedFilters.stores.find((s) => s.storeId === store.storeId)?.checked ||
|
|
7880
|
+
checked: this.selectedFilters.stores.find((s) => s.storeId === store.storeId)?.checked ||
|
|
7881
|
+
store.checked ||
|
|
7882
|
+
false,
|
|
7802
7883
|
}))
|
|
7803
|
-
.filter(store => store.storeName.toLowerCase().includes(searchText));
|
|
7884
|
+
.filter((store) => store.storeName.toLowerCase().includes(searchText));
|
|
7804
7885
|
}
|
|
7805
7886
|
else {
|
|
7806
7887
|
// When the search text is cleared, restore the original list with preserved checked states
|
|
7807
|
-
this.filteredStores = this.stores.map(store => ({
|
|
7888
|
+
this.filteredStores = this.stores.map((store) => ({
|
|
7808
7889
|
...store,
|
|
7809
7890
|
// Preserve the checked state based on the selected filters
|
|
7810
|
-
checked: this.selectedFilters.stores.find((s) => s.storeId === store.storeId)?.checked ||
|
|
7891
|
+
checked: this.selectedFilters.stores.find((s) => s.storeId === store.storeId)?.checked ||
|
|
7892
|
+
store.checked ||
|
|
7893
|
+
false,
|
|
7811
7894
|
}));
|
|
7812
7895
|
}
|
|
7813
7896
|
}
|
|
@@ -7817,19 +7900,25 @@ class MetricsHeaderComponent {
|
|
|
7817
7900
|
if (searchText) {
|
|
7818
7901
|
// Filter based on search text while preserving checked state
|
|
7819
7902
|
this.filteredZones = this.zones
|
|
7820
|
-
.map(zone => ({
|
|
7903
|
+
.map((zone) => ({
|
|
7821
7904
|
...zone,
|
|
7822
7905
|
// Check if the store is already checked in filteredStores, fallback to original stores' checked state
|
|
7823
|
-
checked: this.selectedFilters.zoneName.find((s) => s._id === zone._id)
|
|
7906
|
+
checked: this.selectedFilters.zoneName.find((s) => s._id === zone._id)
|
|
7907
|
+
?.checked ||
|
|
7908
|
+
zone.checked ||
|
|
7909
|
+
false,
|
|
7824
7910
|
}))
|
|
7825
|
-
.filter(zone => zone.tagName.toLowerCase().includes(searchText));
|
|
7911
|
+
.filter((zone) => zone.tagName.toLowerCase().includes(searchText));
|
|
7826
7912
|
}
|
|
7827
7913
|
else {
|
|
7828
7914
|
// When the search text is cleared, restore the original list with preserved checked states
|
|
7829
|
-
this.filteredZones = this.zones.map(zone => ({
|
|
7915
|
+
this.filteredZones = this.zones.map((zone) => ({
|
|
7830
7916
|
...zone,
|
|
7831
7917
|
// Preserve the checked state based on the selected filters
|
|
7832
|
-
checked: this.selectedFilters.zoneName.find((s) => s._id === zone._id)
|
|
7918
|
+
checked: this.selectedFilters.zoneName.find((s) => s._id === zone._id)
|
|
7919
|
+
?.checked ||
|
|
7920
|
+
zone.checked ||
|
|
7921
|
+
false,
|
|
7833
7922
|
}));
|
|
7834
7923
|
}
|
|
7835
7924
|
}
|
|
@@ -7896,7 +7985,7 @@ class MetricsHeaderComponent {
|
|
|
7896
7985
|
// isAllCountriesSelected(): boolean {
|
|
7897
7986
|
// return this.filteredCountries.every(country => country.checked);
|
|
7898
7987
|
// }
|
|
7899
|
-
// filterCountries(): void {
|
|
7988
|
+
// filterCountries(): void {
|
|
7900
7989
|
// const searchText = this.searchCountryText.toLowerCase();
|
|
7901
7990
|
// if (searchText) {
|
|
7902
7991
|
// // Preserve the checked state during filtering
|
|
@@ -7918,12 +8007,16 @@ class MetricsHeaderComponent {
|
|
|
7918
8007
|
// }
|
|
7919
8008
|
getCountry() {
|
|
7920
8009
|
let obj = {
|
|
7921
|
-
clientId: this.selectedFilters.client
|
|
8010
|
+
clientId: this.selectedFilters.client
|
|
8011
|
+
? this.selectedFilters.client
|
|
8012
|
+
: this.users.clientId,
|
|
7922
8013
|
};
|
|
7923
8014
|
this.auth.getCountry(obj).subscribe({
|
|
7924
8015
|
next: (res) => {
|
|
7925
8016
|
// Extract selected countries from existing filters (if any)
|
|
7926
|
-
let countryList = this.selectedFilters?.country
|
|
8017
|
+
let countryList = this.selectedFilters?.country
|
|
8018
|
+
?.filter((country) => country.checked)
|
|
8019
|
+
.map((loc) => loc.country);
|
|
7927
8020
|
// Map API response to frontend model
|
|
7928
8021
|
this.countries = res?.data?.countryData.map((item) => ({
|
|
7929
8022
|
country: item.country,
|
|
@@ -7931,10 +8024,13 @@ class MetricsHeaderComponent {
|
|
|
7931
8024
|
// checked: cityList?.length ? cityList.includes(city.city) : true,
|
|
7932
8025
|
checked: countryList?.includes(item.country) ? true : false,
|
|
7933
8026
|
}));
|
|
7934
|
-
if (this.selectedFilters.country &&
|
|
7935
|
-
|
|
8027
|
+
if (this.selectedFilters.country &&
|
|
8028
|
+
Array.isArray(this.selectedFilters.country)) {
|
|
8029
|
+
this.filteredCountries = this.countries.map((location) => {
|
|
7936
8030
|
const matchedLocation = this.selectedFilters.country.find((loc) => loc.country === location.country);
|
|
7937
|
-
return matchedLocation
|
|
8031
|
+
return matchedLocation
|
|
8032
|
+
? { ...location, checked: matchedLocation.checked }
|
|
8033
|
+
: location;
|
|
7938
8034
|
});
|
|
7939
8035
|
}
|
|
7940
8036
|
else {
|
|
@@ -7962,10 +8058,14 @@ class MetricsHeaderComponent {
|
|
|
7962
8058
|
}
|
|
7963
8059
|
selectedCountriesLabel() {
|
|
7964
8060
|
const selectedCountries = this.searchCountryText.length
|
|
7965
|
-
? this.filteredCountries
|
|
7966
|
-
|
|
8061
|
+
? this.filteredCountries
|
|
8062
|
+
.filter((country) => country.checked)
|
|
8063
|
+
.map((country) => country.country)
|
|
8064
|
+
: this.countries
|
|
8065
|
+
.filter((country) => country.checked)
|
|
8066
|
+
.map((country) => country.country);
|
|
7967
8067
|
return selectedCountries.length === 0
|
|
7968
|
-
?
|
|
8068
|
+
? ""
|
|
7969
8069
|
: selectedCountries.length === 1
|
|
7970
8070
|
? selectedCountries[0]
|
|
7971
8071
|
: `${selectedCountries.length} countries`;
|
|
@@ -7975,22 +8075,24 @@ class MetricsHeaderComponent {
|
|
|
7975
8075
|
if (searchText) {
|
|
7976
8076
|
// Filter and preserve checked state
|
|
7977
8077
|
this.filteredCountries = this.countries
|
|
7978
|
-
.map(country => ({
|
|
8078
|
+
.map((country) => ({
|
|
7979
8079
|
...country,
|
|
7980
|
-
checked: this.filteredCountries.find(c => c.country === country.country)
|
|
8080
|
+
checked: this.filteredCountries.find((c) => c.country === country.country)
|
|
8081
|
+
?.checked || false,
|
|
7981
8082
|
}))
|
|
7982
|
-
.filter(country => country.country.toLowerCase().includes(searchText));
|
|
8083
|
+
.filter((country) => country.country.toLowerCase().includes(searchText));
|
|
7983
8084
|
}
|
|
7984
8085
|
else {
|
|
7985
8086
|
// Reset to full list
|
|
7986
8087
|
this.filteredCountries = this.countries.map((country) => ({
|
|
7987
8088
|
...country,
|
|
7988
|
-
checked: this.selectedFilters.country?.find((c) => c.country === country.country)?.checked || false
|
|
8089
|
+
checked: this.selectedFilters.country?.find((c) => c.country === country.country)?.checked || false,
|
|
7989
8090
|
}));
|
|
7990
8091
|
}
|
|
7991
8092
|
}
|
|
7992
8093
|
isAllCountriesSelected() {
|
|
7993
|
-
return this.filteredCountries.length > 0 &&
|
|
8094
|
+
return (this.filteredCountries.length > 0 &&
|
|
8095
|
+
this.filteredCountries.every((country) => country.checked));
|
|
7994
8096
|
}
|
|
7995
8097
|
toggleSelectAllCountries(event) {
|
|
7996
8098
|
const isChecked = event.target.checked;
|
|
@@ -8027,8 +8129,8 @@ class MetricsHeaderComponent {
|
|
|
8027
8129
|
this.selectedFilters.group = [];
|
|
8028
8130
|
this.filteredStores = []; // Reset stores as well
|
|
8029
8131
|
this.filteredZones = [];
|
|
8030
|
-
this.searchGroupText =
|
|
8031
|
-
this.searchStoreText =
|
|
8132
|
+
this.searchGroupText = "";
|
|
8133
|
+
this.searchStoreText = "";
|
|
8032
8134
|
// this.Opendropdown = false;
|
|
8033
8135
|
}
|
|
8034
8136
|
removeCountry() {
|
|
@@ -8044,8 +8146,12 @@ class MetricsHeaderComponent {
|
|
|
8044
8146
|
this.selectedFilters.country = this.filteredCountries;
|
|
8045
8147
|
this.selectedFilters.location = this.locations;
|
|
8046
8148
|
this.selectedFilters.group = this.groupsData;
|
|
8047
|
-
this.selectedFilters.stores = headerFilters.stores
|
|
8048
|
-
|
|
8149
|
+
this.selectedFilters.stores = headerFilters.stores
|
|
8150
|
+
? headerFilters.stores
|
|
8151
|
+
: this.stores;
|
|
8152
|
+
this.selectedFilters.zoneName = headerFilters.zoneName
|
|
8153
|
+
? headerFilters.zoneName
|
|
8154
|
+
: this.zones;
|
|
8049
8155
|
// this.selectedFilters.zoneName = this.filteredZones;
|
|
8050
8156
|
// Store updated filters back in localStorage
|
|
8051
8157
|
localStorage.setItem("header-filters", JSON.stringify(this.selectedFilters));
|
|
@@ -8058,14 +8164,14 @@ class MetricsHeaderComponent {
|
|
|
8058
8164
|
this.cd.detectChanges();
|
|
8059
8165
|
}
|
|
8060
8166
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MetricsHeaderComponent, deps: [{ token: AuthService }, { token: i2.Router }, { token: i1.GlobalStateService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
8061
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: MetricsHeaderComponent, selector: "lib-metrics-header", host: { listeners: { "document:click": "clickOutside($event)" } }, ngImport: i0, template: "<div class=\"me-3\">\r\n <label *ngIf=\"selectedCountriesLabel()\" class=\"badge badge-light-default mx-2\">{{selectedCountriesLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeCountry()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedLocationsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedLocationsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeLocation()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedGroupsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedGroupsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label class=\"badge badge-light-default\">{{selectedStoresLabel()}}</label>\r\n <label class=\"badge badge-light-default mx-2\">{{selectedZonesLabel()}} \r\n <!-- <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span> -->\r\n </label>\r\n</div>\r\n\r\n\r\n<div class=\"wrapper me-3\" *ngIf=\"(gs.userAccess | async)?.userType === 'tango'\">\r\n<lib-select [items]=\"clientList\" [multi]=\"false\" [searchField]=\"'clientName'\" [disabled]=\"false\" [idField]=\"'clientId'\"\r\n(selected)=\"onClientSelect($event)\" [selectedValues]=\"[selectedClient]\"></lib-select>\r\n</div>\r\n<div class=\"d-flex align-items-center position-relative my-1\">\r\n <span class=\"svg-icon svg-icon-1 position-absolute ms-3\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\r\n <path\r\n d=\"M13.3333 1.66663V4.99996M6.66667 1.66663V4.99996M2.5 8.33329H17.5M4.16667 3.33329H15.8333C16.7538 3.33329 17.5 4.07948 17.5 4.99996V16.6666C17.5 17.5871 16.7538 18.3333 15.8333 18.3333H4.16667C3.24619 18.3333 2.5 17.5871 2.5 16.6666V4.99996C2.5 4.07948 3.24619 3.33329 4.16667 3.33329Z\"\r\n stroke=\"#344054\" stroke-width=\"1.67\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\r\n </svg>\r\n </span>\r\n <input class=\"fx-date-range form-control ps-14\" style=\"min-width: 260px !important;\" type=\"text\" matInput\r\n ngxDaterangepickerMd [drops]=\"'down'\" [opens]=\"'right'\" [ranges]=\"ranges\" [showCustomRangeLabel]=\"true\" [autoApply]=\"true\"\r\n [alwaysShowCalendars]=\"false\" [keepCalendarOpeningWithRange]=\"true\" [showCancel]=\"true\" autocomplete=\"off\"\r\n [(ngModel)]=\"selectedDateRange\" (startDateChanged)=\"onStartDateChange($event)\" [isCustomDate]=\"isCustomDate\"\r\n [locale]=\"{ format: 'DD-MM-YYYY', firstDay: 1, monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] }\"\r\n (datesUpdated)=\"datechange($event)\" name=\"daterange\" [readonly]=\"true\" />\r\n</div>\r\n<div class=\"position-relative\">\r\n <button type=\"button\" (click)=\"opendropdown($event)\" class=\"btn btn-default mx-2 rounded-3 text-nowrap border-val\">\r\n <!-- <span class=\"me-2\">Filter</span> -->\r\n <svg class=\"pl-3\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M5 10H15M2.5 5H17.5M7.5 15H12.5\" stroke=\"#344054\" stroke-width=\"2\" stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\" />\r\n </svg>\r\n </button>\r\n\r\n <div *ngIf=\"Opendropdown\" class=\"card p-5 dropdown2 position-absolute z-1 end-0\" style=\"z-index: 1 !important;\" (clickOutside)=\"closeDropdown1()\">\r\n <div class=\"dropdown-title d-flex justify-content-between mb-2\">Filter Options\r\n <button class=\"btn btn-outline w-25 ms-3 btn-resize\" (click)=\"Reset()\"> Reset </button>\r\n <button class=\"btn btn-primary w-25 btn-resize\" (click)=\"Apply()\">Apply</button>\r\n </div>\r\n\r\n <!-- Country Dropdown -->\r\n<div class=\"dropdown-container\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('country')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedCountriesLabel()\"\r\n readonly\r\n placeholder=\"Select country\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'country'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search country\" \r\n [(ngModel)]=\"searchCountryText\" \r\n (ngModelChange)=\"filterCountries()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllCountries\" \r\n [checked]=\"isAllCountriesSelected()\" \r\n (change)=\"toggleSelectAllCountries($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllCountries\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let country of filteredCountries\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"country.country\" \r\n [(ngModel)]=\"country.checked\"\r\n (change)=\"updateSelectedCountries()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"country.country\">\r\n {{ country.country }}\r\n </label>\r\n \r\n </div>\r\n </div>\r\n</div>\r\n\r\n <!-- Location Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('location')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedLocationsLabel()\"\r\n readonly\r\n placeholder=\"Select Region\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'location'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search Region\" \r\n [(ngModel)]=\"searchLocationText\" \r\n (ngModelChange)=\"filterLocations()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllLocations\" \r\n [checked]=\"isAllLocationsSelected()\" \r\n (change)=\"toggleSelectAllLocations($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllLocations\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let location of filteredLocations\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"location.city\" \r\n [(ngModel)]=\"location.checked\"\r\n (change)=\"updateSelectedLocations()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"location.city\">\r\n {{ location.city }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Group Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('group')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedGroupsLabel()\" readonly\r\n placeholder=\"Select clusters\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'group'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search clusters\" \r\n [(ngModel)]=\"searchGroupText\" \r\n (ngModelChange)=\"filterGroups()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllGroups\" \r\n [checked]=\"isAllGroupsSelected()\" \r\n (change)=\"toggleSelectAllGroups($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllGroups\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let group of filteredGroups\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"group.groupName\"\r\n [(ngModel)]=\"group.checked\"\r\n (change)=\"updateSelectedGroups()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"group.groupName\">\r\n {{ group.groupName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n<!-- Store Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('store')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedStoresLabel()\"\r\n readonly\r\n placeholder=\"Select stores\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'store'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search stores\" \r\n [(ngModel)]=\"searchStoreText\" \r\n (ngModelChange)=\"filterStores()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllStores\" \r\n [checked]=\"isAllStoresSelected()\" \r\n (change)=\"toggleSelectAllStores($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllStores\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let store of filteredStores\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"store.storeId\"\r\n [(ngModel)]=\"store.checked\"\r\n (change)=\"updateSelectedStores()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"store.storeId\">\r\n {{ store.storeName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Zone Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('zone')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedZonesLabel()\"\r\n readonly\r\n placeholder=\"Select zones\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'zone'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search zones\" \r\n [(ngModel)]=\"searchZoneText\" \r\n (ngModelChange)=\"filterZones()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllZones\" \r\n [checked]=\"isAllZonesSelected()\" \r\n (change)=\"toggleSelectAllZones($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllZones\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let zone of filteredZones\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"zone._id\"\r\n [(ngModel)]=\"zone.checked\"\r\n (change)=\"updateSelectedZones()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"zone._id\">\r\n {{ zone.tagName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n\r\n </div>\r\n</div>", styles: [".daterangepicker{display:block!important;top:153.85px!important;left:900px!important;right:0}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize}::ng-deep .applyBtn{display:none!important}:host::ng-deep .md-drppicker .btn{line-height:10px!important}:host::ng-deep .daterangepicker-input+.ngx-daterangepicker-material .applyBtn{display:none}:host::ng-deep .md-drppicker.drops-down-right.ltr.double.show-ranges.shown{top:65px!important;left:-470px!important;height:365px!important}:host::ng-deep .md-drppicker .btn{border-radius:8px!important;border:1px solid var(--Primary-600, #00A3FF)!important;background:var(--Primary-600, #00A3FF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--White, #FFF)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize}:host::ng-deep .md-drppicker .ranges ul li button{padding:12px 16px;width:160px;color:var(--Gray-700, #344054);font-size:14px;font-weight:400;line-height:20px;background:none;border:none;text-align:left;cursor:pointer}:host::ng-deep .md-drppicker td.active,:host::ng-deep .md-drppicker td.active:hover{background-color:#029cf4!important;border-radius:20px!important;color:var(--White, #FFF)!important;text-align:center!important;font-size:14px!important;font-weight:500!important;line-height:20px}:host::ng-deep .md-drppicker.ltr .ranges{float:left;margin-top:10px!important}:host::ng-deep .md-drppicker td.in-range{background:var(--Primary-50, #EAF8FF)}:host::ng-deep .md-drppicker .ranges ul li button.active{background:var(--Primary-50, #EAF8FF)!important;border-radius:8px!important;color:var(--Primary-700, #009BF3);font-size:14px!important;font-weight:500!important;line-height:20px!important}:host::ng-deep table th,:host::ng-deep table td{width:40px!important;height:40px!important;padding:10px 8px!important}:host::ng-deep .md-drppicker td.available.prev,:host::ng-deep .md-drppicker th.available.prev{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep .md-drppicker td.available.next,:host::ng-deep .md-drppicker th.available.next{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep table th{border-bottom:0px solid var(--Gray-200, #EAECF0)!important;background:transparent!important;color:var(--Gray-700, #344054)!important;text-align:center;font-size:16px!important;font-weight:500!important;line-height:24px}:host::ng-deep .md-drppicker .btn.btn-default{border-radius:8px!important;border:1px solid var(--Gray-300, #D0D5DD)!important;background:var(--White, #FFF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize;margin-right:10px!important}:host::ng-deep .md-drppicker td.available.invalid-date{text-decoration:line-through;pointer-events:none;color:#a9a9a9}:host::ng-deep .md-drppicker td.available.today:not(.invalid-date){text-decoration:unset;pointer-events:unset;color:unset}.wrapper{min-width:200px}.btn-primary{line-height:18px!important}.filter-label{color:var(--Gray-500, #667085)!important;font-size:14px;font-style:normal;font-weight:600;line-height:20px;text-transform:capitalize}.position-relative{position:relative}.filter-icon{cursor:pointer}.dropdown-container{position:relative;display:inline-block;width:100%}.dropdown-header{cursor:pointer;width:100%}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize;width:100%;box-sizing:border-box}.dropdown-menu{position:absolute;top:100%;left:0;right:0;border:1px solid #ccc;background-color:#fff;z-index:1000;max-height:230px;overflow-y:auto;display:block;box-sizing:border-box;padding:10px 5px}.dropdown-item{padding:6px 0}.dropdown-item:hover{background-color:#f1f1f1}.dropdown-item input[type=checkbox]{margin-right:10px}.custom-dropdown-menu{border-radius:4px;box-shadow:0 1px 2px #1018280d}.custom-dropdown-item{display:flex;align-items:center}.custom-dropdown-item input{margin-left:10px}.btn-resize{font-size:13px!important;height:29px!important;line-height:11px!important;padding:3px!important}.dropdown2{position:absolute;top:70px;min-width:270px!important}.dropdown2 .dropdown-title{color:var(--Gray-900, #101828);font-size:14px;font-weight:600;line-height:24px}.dropdown2 .dropdown{position:relative;display:inline-block}.dropdown2 .dropdown span{color:var(--Gray-700, #344054);font-size:14px;font-weight:600;line-height:20px}.form-check-label{color:var(--Gray-700, #344054)!important;font-size:14px;font-style:normal;font-weight:500;line-height:20px}input[type=checkbox]{width:16px!important;height:16px!important;margin:0 5px;border-radius:4px!important;-webkit-appearance:none;-moz-appearance:none;-o-appearance:none;appearance:none;outline:1px solid var(--gray-300, #D0D5DD);box-shadow:none;font-size:.8em;text-align:center;line-height:1em;background:#fff}input[type=checkbox]:checked{outline:1px solid var(--primary-600, #00A3FF);background-color:var(--primary-50, #EAF8FF)}input[type=checkbox]:checked:after{content:\"\";transform:rotate(45deg);border-bottom:2px solid #00A3FF;border-right:2px solid #00A3FF;display:inline-block;width:.2em;padding-left:0;padding-top:9px;padding-right:4px}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CustomSelectComponent, selector: "lib-select", inputs: ["items", "searchField", "multi", "idField", "selectedValues", "disabled", "label"], outputs: ["selected"] }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i7.DaterangepickerDirective, selector: "input[ngxDaterangepickerMd]", inputs: ["minDate", "maxDate", "autoApply", "alwaysShowCalendars", "showCustomRangeLabel", "linkedCalendars", "dateLimit", "singleDatePicker", "showWeekNumbers", "showISOWeekNumbers", "showDropdowns", "isInvalidDate", "isCustomDate", "isTooltipDate", "showClearButton", "customRangeDirection", "ranges", "opens", "drops", "firstMonthDayClass", "lastMonthDayClass", "emptyWeekRowClass", "emptyWeekColumnClass", "firstDayOfNextMonthClass", "lastDayOfPreviousMonthClass", "keepCalendarOpeningWithRange", "showRangeLabelOnInput", "showCancel", "lockStartDate", "timePicker", "timePicker24Hour", "timePickerIncrement", "timePickerSeconds", "closeOnAutoApply", "endKeyHolder", "startKey", "locale", "endKey"], outputs: ["change", "rangeClicked", "datesUpdated", "startDateChanged", "endDateChanged", "clearClicked"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
|
|
8167
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: MetricsHeaderComponent, selector: "lib-metrics-header", host: { listeners: { "document:click": "clickOutside($event)" } }, ngImport: i0, template: "<div class=\"me-3\">\r\n <label *ngIf=\"selectedCountriesLabel()\" class=\"badge badge-light-default mx-2\">{{selectedCountriesLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeCountry()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedLocationsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedLocationsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeLocation()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedGroupsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedGroupsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label class=\"badge badge-light-default\">{{selectedStoresLabel()}}</label>\r\n <label class=\"badge badge-light-default mx-2\">{{selectedZonesLabel()}} \r\n <!-- <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span> -->\r\n </label>\r\n</div>\r\n\r\n\r\n<div class=\"wrapper me-3\" *ngIf=\"(gs.userAccess | async)?.userType === 'tango'\">\r\n<lib-select [items]=\"clientList\" [multi]=\"false\" [searchField]=\"'clientName'\" [disabled]=\"false\" [idField]=\"'clientId'\"\r\n(selected)=\"onClientSelect($event)\" [selectedValues]=\"[selectedClient]\"></lib-select>\r\n</div>\r\n<div class=\"d-flex align-items-center position-relative my-1\">\r\n <span class=\"svg-icon svg-icon-1 position-absolute ms-3\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\r\n <path\r\n d=\"M13.3333 1.66663V4.99996M6.66667 1.66663V4.99996M2.5 8.33329H17.5M4.16667 3.33329H15.8333C16.7538 3.33329 17.5 4.07948 17.5 4.99996V16.6666C17.5 17.5871 16.7538 18.3333 15.8333 18.3333H4.16667C3.24619 18.3333 2.5 17.5871 2.5 16.6666V4.99996C2.5 4.07948 3.24619 3.33329 4.16667 3.33329Z\"\r\n stroke=\"#344054\" stroke-width=\"1.67\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\r\n </svg>\r\n </span>\r\n <input class=\"fx-date-range form-control ps-14\" style=\"min-width: 260px !important;\" type=\"text\" matInput\r\n ngxDaterangepickerMd [drops]=\"'down'\" [opens]=\"'right'\" [ranges]=\"ranges\" [showCustomRangeLabel]=\"true\" [autoApply]=\"true\"\r\n [alwaysShowCalendars]=\"false\" [keepCalendarOpeningWithRange]=\"true\" [showCancel]=\"true\" autocomplete=\"off\"\r\n [(ngModel)]=\"selectedDateRange\" (startDateChanged)=\"onStartDateChange($event)\" [isCustomDate]=\"isCustomDate\"\r\n [locale]=\"{ format: 'DD-MM-YYYY', firstDay: 1, monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] }\"\r\n (datesUpdated)=\"datechange($event)\" name=\"daterange\" [readonly]=\"true\" />\r\n</div>\r\n<div class=\"position-relative\">\r\n <button type=\"button\" (click)=\"opendropdown($event)\" class=\"btn btn-default mx-2 rounded-3 text-nowrap border-val\">\r\n <!-- <span class=\"me-2\">Filter</span> -->\r\n <svg class=\"pl-3\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M5 10H15M2.5 5H17.5M7.5 15H12.5\" stroke=\"#344054\" stroke-width=\"2\" stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\" />\r\n </svg>\r\n </button>\r\n\r\n <div *ngIf=\"Opendropdown\" class=\"card p-5 dropdown2 position-absolute z-1 end-0\" style=\"z-index: 1 !important;\" (clickOutside)=\"closeDropdown1()\">\r\n <div class=\"dropdown-title d-flex justify-content-between mb-2\">Filter Options\r\n <button class=\"btn btn-outline w-25 ms-3 btn-resize\" (click)=\"Reset()\"> Reset </button>\r\n <button class=\"btn btn-primary w-25 btn-resize\" (click)=\"Apply()\">Apply</button>\r\n </div>\r\n\r\n <!-- Country Dropdown -->\r\n<div class=\"dropdown-container\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('country')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedCountriesLabel()\"\r\n readonly\r\n placeholder=\"Select country\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'country'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search country\" \r\n [(ngModel)]=\"searchCountryText\" \r\n (ngModelChange)=\"filterCountries()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllCountries\" \r\n [checked]=\"isAllCountriesSelected()\" \r\n (change)=\"toggleSelectAllCountries($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllCountries\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let country of filteredCountries\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"country.country\" \r\n [(ngModel)]=\"country.checked\"\r\n (change)=\"updateSelectedCountries()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"country.country\">\r\n {{ country.country }}\r\n </label>\r\n \r\n </div>\r\n </div>\r\n</div>\r\n\r\n <!-- Location Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('location')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedLocationsLabel()\"\r\n readonly\r\n placeholder=\"Select Region\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'location'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search Region\" \r\n [(ngModel)]=\"searchLocationText\" \r\n (ngModelChange)=\"filterLocations()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllLocations\" \r\n [checked]=\"isAllLocationsSelected()\" \r\n (change)=\"toggleSelectAllLocations($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllLocations\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let location of filteredLocations\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"location.city\" \r\n [(ngModel)]=\"location.checked\"\r\n (change)=\"updateSelectedLocations()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"location.city\">\r\n {{ location.city }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Group Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('group')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedGroupsLabel()\" readonly\r\n placeholder=\"Select clusters\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'group'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search clusters\" \r\n [(ngModel)]=\"searchGroupText\" \r\n (ngModelChange)=\"filterGroups()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllGroups\" \r\n [checked]=\"isAllGroupsSelected()\" \r\n (change)=\"toggleSelectAllGroups($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllGroups\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let group of filteredGroups\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"group.groupName\"\r\n [(ngModel)]=\"group.checked\"\r\n (change)=\"updateSelectedGroups()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"group.groupName\">\r\n {{ group.groupName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n<!-- Store Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('store')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedStoresLabel()\"\r\n readonly\r\n placeholder=\"Select stores\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'store'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search stores\" \r\n [(ngModel)]=\"searchStoreText\" \r\n (ngModelChange)=\"filterStores()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllStores\" \r\n [checked]=\"isAllStoresSelected()\" \r\n (change)=\"toggleSelectAllStores($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllStores\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let store of filteredStores\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"store.storeId\"\r\n [(ngModel)]=\"store.checked\"\r\n (change)=\"updateSelectedStores()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"store.storeId\">\r\n {{ store.storeName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Zone Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('zone')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedZonesLabel()\"\r\n readonly\r\n placeholder=\"Select zones\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'zone'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search zones\" \r\n [(ngModel)]=\"searchZoneText\" \r\n (ngModelChange)=\"filterZones()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllZones\" \r\n [checked]=\"isAllZonesSelected()\" \r\n (change)=\"toggleSelectAllZones($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllZones\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let zone of filteredZones\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"zone._id\"\r\n [(ngModel)]=\"zone.checked\"\r\n (change)=\"updateSelectedZones(zone._id)\"\r\n />\r\n <label class=\"form-check-label\" [for]=\"zone._id\">\r\n {{ zone.tagName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n\r\n </div>\r\n</div>", styles: [".daterangepicker{display:block!important;top:153.85px!important;left:900px!important;right:0}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize}::ng-deep .applyBtn{display:none!important}:host::ng-deep .md-drppicker .btn{line-height:10px!important}:host::ng-deep .daterangepicker-input+.ngx-daterangepicker-material .applyBtn{display:none}:host::ng-deep .md-drppicker.drops-down-right.ltr.double.show-ranges.shown{top:65px!important;left:-470px!important;height:365px!important}:host::ng-deep .md-drppicker .btn{border-radius:8px!important;border:1px solid var(--Primary-600, #00A3FF)!important;background:var(--Primary-600, #00A3FF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--White, #FFF)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize}:host::ng-deep .md-drppicker .ranges ul li button{padding:12px 16px;width:160px;color:var(--Gray-700, #344054);font-size:14px;font-weight:400;line-height:20px;background:none;border:none;text-align:left;cursor:pointer}:host::ng-deep .md-drppicker td.active,:host::ng-deep .md-drppicker td.active:hover{background-color:#029cf4!important;border-radius:20px!important;color:var(--White, #FFF)!important;text-align:center!important;font-size:14px!important;font-weight:500!important;line-height:20px}:host::ng-deep .md-drppicker.ltr .ranges{float:left;margin-top:10px!important}:host::ng-deep .md-drppicker td.in-range{background:var(--Primary-50, #EAF8FF)}:host::ng-deep .md-drppicker .ranges ul li button.active{background:var(--Primary-50, #EAF8FF)!important;border-radius:8px!important;color:var(--Primary-700, #009BF3);font-size:14px!important;font-weight:500!important;line-height:20px!important}:host::ng-deep table th,:host::ng-deep table td{width:40px!important;height:40px!important;padding:10px 8px!important}:host::ng-deep .md-drppicker td.available.prev,:host::ng-deep .md-drppicker th.available.prev{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep .md-drppicker td.available.next,:host::ng-deep .md-drppicker th.available.next{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep table th{border-bottom:0px solid var(--Gray-200, #EAECF0)!important;background:transparent!important;color:var(--Gray-700, #344054)!important;text-align:center;font-size:16px!important;font-weight:500!important;line-height:24px}:host::ng-deep .md-drppicker .btn.btn-default{border-radius:8px!important;border:1px solid var(--Gray-300, #D0D5DD)!important;background:var(--White, #FFF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize;margin-right:10px!important}:host::ng-deep .md-drppicker td.available.invalid-date{text-decoration:line-through;pointer-events:none;color:#a9a9a9}:host::ng-deep .md-drppicker td.available.today:not(.invalid-date){text-decoration:unset;pointer-events:unset;color:unset}.wrapper{min-width:200px}.btn-primary{line-height:18px!important}.filter-label{color:var(--Gray-500, #667085)!important;font-size:14px;font-style:normal;font-weight:600;line-height:20px;text-transform:capitalize}.position-relative{position:relative}.filter-icon{cursor:pointer}.dropdown-container{position:relative;display:inline-block;width:100%}.dropdown-header{cursor:pointer;width:100%}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize;width:100%;box-sizing:border-box}.dropdown-menu{position:absolute;top:100%;left:0;right:0;border:1px solid #ccc;background-color:#fff;z-index:1000;max-height:230px;overflow-y:auto;display:block;box-sizing:border-box;padding:10px 5px}.dropdown-item{padding:6px 0}.dropdown-item:hover{background-color:#f1f1f1}.dropdown-item input[type=checkbox]{margin-right:10px}.custom-dropdown-menu{border-radius:4px;box-shadow:0 1px 2px #1018280d}.custom-dropdown-item{display:flex;align-items:center}.custom-dropdown-item input{margin-left:10px}.btn-resize{font-size:13px!important;height:29px!important;line-height:11px!important;padding:3px!important}.dropdown2{position:absolute;top:70px;min-width:270px!important}.dropdown2 .dropdown-title{color:var(--Gray-900, #101828);font-size:14px;font-weight:600;line-height:24px}.dropdown2 .dropdown{position:relative;display:inline-block}.dropdown2 .dropdown span{color:var(--Gray-700, #344054);font-size:14px;font-weight:600;line-height:20px}.form-check-label{color:var(--Gray-700, #344054)!important;font-size:14px;font-style:normal;font-weight:500;line-height:20px}input[type=checkbox]{width:16px!important;height:16px!important;margin:0 5px;border-radius:4px!important;-webkit-appearance:none;-moz-appearance:none;-o-appearance:none;appearance:none;outline:1px solid var(--gray-300, #D0D5DD);box-shadow:none;font-size:.8em;text-align:center;line-height:1em;background:#fff}input[type=checkbox]:checked{outline:1px solid var(--primary-600, #00A3FF);background-color:var(--primary-50, #EAF8FF)}input[type=checkbox]:checked:after{content:\"\";transform:rotate(45deg);border-bottom:2px solid #00A3FF;border-right:2px solid #00A3FF;display:inline-block;width:.2em;padding-left:0;padding-top:9px;padding-right:4px}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: CustomSelectComponent, selector: "lib-select", inputs: ["items", "searchField", "multi", "idField", "selectedValues", "disabled", "label"], outputs: ["selected"] }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i7.DaterangepickerDirective, selector: "input[ngxDaterangepickerMd]", inputs: ["minDate", "maxDate", "autoApply", "alwaysShowCalendars", "showCustomRangeLabel", "linkedCalendars", "dateLimit", "singleDatePicker", "showWeekNumbers", "showISOWeekNumbers", "showDropdowns", "isInvalidDate", "isCustomDate", "isTooltipDate", "showClearButton", "customRangeDirection", "ranges", "opens", "drops", "firstMonthDayClass", "lastMonthDayClass", "emptyWeekRowClass", "emptyWeekColumnClass", "firstDayOfNextMonthClass", "lastDayOfPreviousMonthClass", "keepCalendarOpeningWithRange", "showRangeLabelOnInput", "showCancel", "lockStartDate", "timePicker", "timePicker24Hour", "timePickerIncrement", "timePickerSeconds", "closeOnAutoApply", "endKeyHolder", "startKey", "locale", "endKey"], outputs: ["change", "rangeClicked", "datesUpdated", "startDateChanged", "endDateChanged", "clearClicked"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }] });
|
|
8062
8168
|
}
|
|
8063
8169
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: MetricsHeaderComponent, decorators: [{
|
|
8064
8170
|
type: Component,
|
|
8065
|
-
args: [{ selector: 'lib-metrics-header', template: "<div class=\"me-3\">\r\n <label *ngIf=\"selectedCountriesLabel()\" class=\"badge badge-light-default mx-2\">{{selectedCountriesLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeCountry()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedLocationsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedLocationsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeLocation()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedGroupsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedGroupsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label class=\"badge badge-light-default\">{{selectedStoresLabel()}}</label>\r\n <label class=\"badge badge-light-default mx-2\">{{selectedZonesLabel()}} \r\n <!-- <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span> -->\r\n </label>\r\n</div>\r\n\r\n\r\n<div class=\"wrapper me-3\" *ngIf=\"(gs.userAccess | async)?.userType === 'tango'\">\r\n<lib-select [items]=\"clientList\" [multi]=\"false\" [searchField]=\"'clientName'\" [disabled]=\"false\" [idField]=\"'clientId'\"\r\n(selected)=\"onClientSelect($event)\" [selectedValues]=\"[selectedClient]\"></lib-select>\r\n</div>\r\n<div class=\"d-flex align-items-center position-relative my-1\">\r\n <span class=\"svg-icon svg-icon-1 position-absolute ms-3\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\r\n <path\r\n d=\"M13.3333 1.66663V4.99996M6.66667 1.66663V4.99996M2.5 8.33329H17.5M4.16667 3.33329H15.8333C16.7538 3.33329 17.5 4.07948 17.5 4.99996V16.6666C17.5 17.5871 16.7538 18.3333 15.8333 18.3333H4.16667C3.24619 18.3333 2.5 17.5871 2.5 16.6666V4.99996C2.5 4.07948 3.24619 3.33329 4.16667 3.33329Z\"\r\n stroke=\"#344054\" stroke-width=\"1.67\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\r\n </svg>\r\n </span>\r\n <input class=\"fx-date-range form-control ps-14\" style=\"min-width: 260px !important;\" type=\"text\" matInput\r\n ngxDaterangepickerMd [drops]=\"'down'\" [opens]=\"'right'\" [ranges]=\"ranges\" [showCustomRangeLabel]=\"true\" [autoApply]=\"true\"\r\n [alwaysShowCalendars]=\"false\" [keepCalendarOpeningWithRange]=\"true\" [showCancel]=\"true\" autocomplete=\"off\"\r\n [(ngModel)]=\"selectedDateRange\" (startDateChanged)=\"onStartDateChange($event)\" [isCustomDate]=\"isCustomDate\"\r\n [locale]=\"{ format: 'DD-MM-YYYY', firstDay: 1, monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] }\"\r\n (datesUpdated)=\"datechange($event)\" name=\"daterange\" [readonly]=\"true\" />\r\n</div>\r\n<div class=\"position-relative\">\r\n <button type=\"button\" (click)=\"opendropdown($event)\" class=\"btn btn-default mx-2 rounded-3 text-nowrap border-val\">\r\n <!-- <span class=\"me-2\">Filter</span> -->\r\n <svg class=\"pl-3\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M5 10H15M2.5 5H17.5M7.5 15H12.5\" stroke=\"#344054\" stroke-width=\"2\" stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\" />\r\n </svg>\r\n </button>\r\n\r\n <div *ngIf=\"Opendropdown\" class=\"card p-5 dropdown2 position-absolute z-1 end-0\" style=\"z-index: 1 !important;\" (clickOutside)=\"closeDropdown1()\">\r\n <div class=\"dropdown-title d-flex justify-content-between mb-2\">Filter Options\r\n <button class=\"btn btn-outline w-25 ms-3 btn-resize\" (click)=\"Reset()\"> Reset </button>\r\n <button class=\"btn btn-primary w-25 btn-resize\" (click)=\"Apply()\">Apply</button>\r\n </div>\r\n\r\n <!-- Country Dropdown -->\r\n<div class=\"dropdown-container\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('country')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedCountriesLabel()\"\r\n readonly\r\n placeholder=\"Select country\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'country'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search country\" \r\n [(ngModel)]=\"searchCountryText\" \r\n (ngModelChange)=\"filterCountries()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllCountries\" \r\n [checked]=\"isAllCountriesSelected()\" \r\n (change)=\"toggleSelectAllCountries($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllCountries\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let country of filteredCountries\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"country.country\" \r\n [(ngModel)]=\"country.checked\"\r\n (change)=\"updateSelectedCountries()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"country.country\">\r\n {{ country.country }}\r\n </label>\r\n \r\n </div>\r\n </div>\r\n</div>\r\n\r\n <!-- Location Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('location')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedLocationsLabel()\"\r\n readonly\r\n placeholder=\"Select Region\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'location'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search Region\" \r\n [(ngModel)]=\"searchLocationText\" \r\n (ngModelChange)=\"filterLocations()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllLocations\" \r\n [checked]=\"isAllLocationsSelected()\" \r\n (change)=\"toggleSelectAllLocations($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllLocations\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let location of filteredLocations\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"location.city\" \r\n [(ngModel)]=\"location.checked\"\r\n (change)=\"updateSelectedLocations()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"location.city\">\r\n {{ location.city }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Group Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('group')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedGroupsLabel()\" readonly\r\n placeholder=\"Select clusters\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'group'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search clusters\" \r\n [(ngModel)]=\"searchGroupText\" \r\n (ngModelChange)=\"filterGroups()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllGroups\" \r\n [checked]=\"isAllGroupsSelected()\" \r\n (change)=\"toggleSelectAllGroups($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllGroups\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let group of filteredGroups\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"group.groupName\"\r\n [(ngModel)]=\"group.checked\"\r\n (change)=\"updateSelectedGroups()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"group.groupName\">\r\n {{ group.groupName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n<!-- Store Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('store')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedStoresLabel()\"\r\n readonly\r\n placeholder=\"Select stores\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'store'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search stores\" \r\n [(ngModel)]=\"searchStoreText\" \r\n (ngModelChange)=\"filterStores()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllStores\" \r\n [checked]=\"isAllStoresSelected()\" \r\n (change)=\"toggleSelectAllStores($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllStores\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let store of filteredStores\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"store.storeId\"\r\n [(ngModel)]=\"store.checked\"\r\n (change)=\"updateSelectedStores()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"store.storeId\">\r\n {{ store.storeName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Zone Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('zone')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedZonesLabel()\"\r\n readonly\r\n placeholder=\"Select zones\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'zone'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search zones\" \r\n [(ngModel)]=\"searchZoneText\" \r\n (ngModelChange)=\"filterZones()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllZones\" \r\n [checked]=\"isAllZonesSelected()\" \r\n (change)=\"toggleSelectAllZones($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllZones\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let zone of filteredZones\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"zone._id\"\r\n [(ngModel)]=\"zone.checked\"\r\n (change)=\"updateSelectedZones()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"zone._id\">\r\n {{ zone.tagName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n\r\n </div>\r\n</div>", styles: [".daterangepicker{display:block!important;top:153.85px!important;left:900px!important;right:0}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize}::ng-deep .applyBtn{display:none!important}:host::ng-deep .md-drppicker .btn{line-height:10px!important}:host::ng-deep .daterangepicker-input+.ngx-daterangepicker-material .applyBtn{display:none}:host::ng-deep .md-drppicker.drops-down-right.ltr.double.show-ranges.shown{top:65px!important;left:-470px!important;height:365px!important}:host::ng-deep .md-drppicker .btn{border-radius:8px!important;border:1px solid var(--Primary-600, #00A3FF)!important;background:var(--Primary-600, #00A3FF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--White, #FFF)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize}:host::ng-deep .md-drppicker .ranges ul li button{padding:12px 16px;width:160px;color:var(--Gray-700, #344054);font-size:14px;font-weight:400;line-height:20px;background:none;border:none;text-align:left;cursor:pointer}:host::ng-deep .md-drppicker td.active,:host::ng-deep .md-drppicker td.active:hover{background-color:#029cf4!important;border-radius:20px!important;color:var(--White, #FFF)!important;text-align:center!important;font-size:14px!important;font-weight:500!important;line-height:20px}:host::ng-deep .md-drppicker.ltr .ranges{float:left;margin-top:10px!important}:host::ng-deep .md-drppicker td.in-range{background:var(--Primary-50, #EAF8FF)}:host::ng-deep .md-drppicker .ranges ul li button.active{background:var(--Primary-50, #EAF8FF)!important;border-radius:8px!important;color:var(--Primary-700, #009BF3);font-size:14px!important;font-weight:500!important;line-height:20px!important}:host::ng-deep table th,:host::ng-deep table td{width:40px!important;height:40px!important;padding:10px 8px!important}:host::ng-deep .md-drppicker td.available.prev,:host::ng-deep .md-drppicker th.available.prev{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep .md-drppicker td.available.next,:host::ng-deep .md-drppicker th.available.next{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep table th{border-bottom:0px solid var(--Gray-200, #EAECF0)!important;background:transparent!important;color:var(--Gray-700, #344054)!important;text-align:center;font-size:16px!important;font-weight:500!important;line-height:24px}:host::ng-deep .md-drppicker .btn.btn-default{border-radius:8px!important;border:1px solid var(--Gray-300, #D0D5DD)!important;background:var(--White, #FFF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize;margin-right:10px!important}:host::ng-deep .md-drppicker td.available.invalid-date{text-decoration:line-through;pointer-events:none;color:#a9a9a9}:host::ng-deep .md-drppicker td.available.today:not(.invalid-date){text-decoration:unset;pointer-events:unset;color:unset}.wrapper{min-width:200px}.btn-primary{line-height:18px!important}.filter-label{color:var(--Gray-500, #667085)!important;font-size:14px;font-style:normal;font-weight:600;line-height:20px;text-transform:capitalize}.position-relative{position:relative}.filter-icon{cursor:pointer}.dropdown-container{position:relative;display:inline-block;width:100%}.dropdown-header{cursor:pointer;width:100%}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize;width:100%;box-sizing:border-box}.dropdown-menu{position:absolute;top:100%;left:0;right:0;border:1px solid #ccc;background-color:#fff;z-index:1000;max-height:230px;overflow-y:auto;display:block;box-sizing:border-box;padding:10px 5px}.dropdown-item{padding:6px 0}.dropdown-item:hover{background-color:#f1f1f1}.dropdown-item input[type=checkbox]{margin-right:10px}.custom-dropdown-menu{border-radius:4px;box-shadow:0 1px 2px #1018280d}.custom-dropdown-item{display:flex;align-items:center}.custom-dropdown-item input{margin-left:10px}.btn-resize{font-size:13px!important;height:29px!important;line-height:11px!important;padding:3px!important}.dropdown2{position:absolute;top:70px;min-width:270px!important}.dropdown2 .dropdown-title{color:var(--Gray-900, #101828);font-size:14px;font-weight:600;line-height:24px}.dropdown2 .dropdown{position:relative;display:inline-block}.dropdown2 .dropdown span{color:var(--Gray-700, #344054);font-size:14px;font-weight:600;line-height:20px}.form-check-label{color:var(--Gray-700, #344054)!important;font-size:14px;font-style:normal;font-weight:500;line-height:20px}input[type=checkbox]{width:16px!important;height:16px!important;margin:0 5px;border-radius:4px!important;-webkit-appearance:none;-moz-appearance:none;-o-appearance:none;appearance:none;outline:1px solid var(--gray-300, #D0D5DD);box-shadow:none;font-size:.8em;text-align:center;line-height:1em;background:#fff}input[type=checkbox]:checked{outline:1px solid var(--primary-600, #00A3FF);background-color:var(--primary-50, #EAF8FF)}input[type=checkbox]:checked:after{content:\"\";transform:rotate(45deg);border-bottom:2px solid #00A3FF;border-right:2px solid #00A3FF;display:inline-block;width:.2em;padding-left:0;padding-top:9px;padding-right:4px}\n"] }]
|
|
8171
|
+
args: [{ selector: "lib-metrics-header", template: "<div class=\"me-3\">\r\n <label *ngIf=\"selectedCountriesLabel()\" class=\"badge badge-light-default mx-2\">{{selectedCountriesLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeCountry()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedLocationsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedLocationsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeLocation()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label *ngIf=\"selectedGroupsLabel()\" class=\"badge badge-light-default mx-2\">{{selectedGroupsLabel()}} \r\n <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span>\r\n </label>\r\n <label class=\"badge badge-light-default\">{{selectedStoresLabel()}}</label>\r\n <label class=\"badge badge-light-default mx-2\">{{selectedZonesLabel()}} \r\n <!-- <span class=\"cursor-pointer\" (click)=\"removeGroup()\"><svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 12 12\" fill=\"none\">\r\n <path d=\"M9 3L3 9M3 3L9 9\" stroke=\"#667085\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\r\n </svg></span> -->\r\n </label>\r\n</div>\r\n\r\n\r\n<div class=\"wrapper me-3\" *ngIf=\"(gs.userAccess | async)?.userType === 'tango'\">\r\n<lib-select [items]=\"clientList\" [multi]=\"false\" [searchField]=\"'clientName'\" [disabled]=\"false\" [idField]=\"'clientId'\"\r\n(selected)=\"onClientSelect($event)\" [selectedValues]=\"[selectedClient]\"></lib-select>\r\n</div>\r\n<div class=\"d-flex align-items-center position-relative my-1\">\r\n <span class=\"svg-icon svg-icon-1 position-absolute ms-3\">\r\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\r\n <path\r\n d=\"M13.3333 1.66663V4.99996M6.66667 1.66663V4.99996M2.5 8.33329H17.5M4.16667 3.33329H15.8333C16.7538 3.33329 17.5 4.07948 17.5 4.99996V16.6666C17.5 17.5871 16.7538 18.3333 15.8333 18.3333H4.16667C3.24619 18.3333 2.5 17.5871 2.5 16.6666V4.99996C2.5 4.07948 3.24619 3.33329 4.16667 3.33329Z\"\r\n stroke=\"#344054\" stroke-width=\"1.67\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\r\n </svg>\r\n </span>\r\n <input class=\"fx-date-range form-control ps-14\" style=\"min-width: 260px !important;\" type=\"text\" matInput\r\n ngxDaterangepickerMd [drops]=\"'down'\" [opens]=\"'right'\" [ranges]=\"ranges\" [showCustomRangeLabel]=\"true\" [autoApply]=\"true\"\r\n [alwaysShowCalendars]=\"false\" [keepCalendarOpeningWithRange]=\"true\" [showCancel]=\"true\" autocomplete=\"off\"\r\n [(ngModel)]=\"selectedDateRange\" (startDateChanged)=\"onStartDateChange($event)\" [isCustomDate]=\"isCustomDate\"\r\n [locale]=\"{ format: 'DD-MM-YYYY', firstDay: 1, monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] }\"\r\n (datesUpdated)=\"datechange($event)\" name=\"daterange\" [readonly]=\"true\" />\r\n</div>\r\n<div class=\"position-relative\">\r\n <button type=\"button\" (click)=\"opendropdown($event)\" class=\"btn btn-default mx-2 rounded-3 text-nowrap border-val\">\r\n <!-- <span class=\"me-2\">Filter</span> -->\r\n <svg class=\"pl-3\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\r\n <path d=\"M5 10H15M2.5 5H17.5M7.5 15H12.5\" stroke=\"#344054\" stroke-width=\"2\" stroke-linecap=\"round\"\r\n stroke-linejoin=\"round\" />\r\n </svg>\r\n </button>\r\n\r\n <div *ngIf=\"Opendropdown\" class=\"card p-5 dropdown2 position-absolute z-1 end-0\" style=\"z-index: 1 !important;\" (clickOutside)=\"closeDropdown1()\">\r\n <div class=\"dropdown-title d-flex justify-content-between mb-2\">Filter Options\r\n <button class=\"btn btn-outline w-25 ms-3 btn-resize\" (click)=\"Reset()\"> Reset </button>\r\n <button class=\"btn btn-primary w-25 btn-resize\" (click)=\"Apply()\">Apply</button>\r\n </div>\r\n\r\n <!-- Country Dropdown -->\r\n<div class=\"dropdown-container\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('country')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedCountriesLabel()\"\r\n readonly\r\n placeholder=\"Select country\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'country'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search country\" \r\n [(ngModel)]=\"searchCountryText\" \r\n (ngModelChange)=\"filterCountries()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllCountries\" \r\n [checked]=\"isAllCountriesSelected()\" \r\n (change)=\"toggleSelectAllCountries($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllCountries\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let country of filteredCountries\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"country.country\" \r\n [(ngModel)]=\"country.checked\"\r\n (change)=\"updateSelectedCountries()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"country.country\">\r\n {{ country.country }}\r\n </label>\r\n \r\n </div>\r\n </div>\r\n</div>\r\n\r\n <!-- Location Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('location')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedLocationsLabel()\"\r\n readonly\r\n placeholder=\"Select Region\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'location'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search Region\" \r\n [(ngModel)]=\"searchLocationText\" \r\n (ngModelChange)=\"filterLocations()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllLocations\" \r\n [checked]=\"isAllLocationsSelected()\" \r\n (change)=\"toggleSelectAllLocations($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllLocations\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let location of filteredLocations\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"location.city\" \r\n [(ngModel)]=\"location.checked\"\r\n (change)=\"updateSelectedLocations()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"location.city\">\r\n {{ location.city }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Group Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('group')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\" \r\n [value]=\"selectedGroupsLabel()\" readonly\r\n placeholder=\"Select clusters\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'group'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search\" \r\n placeholder=\"Search clusters\" \r\n [(ngModel)]=\"searchGroupText\" \r\n (ngModelChange)=\"filterGroups()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllGroups\" \r\n [checked]=\"isAllGroupsSelected()\" \r\n (change)=\"toggleSelectAllGroups($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllGroups\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let group of filteredGroups\"\r\n >\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n [id]=\"group.groupName\"\r\n [(ngModel)]=\"group.checked\"\r\n (change)=\"updateSelectedGroups()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"group.groupName\">\r\n {{ group.groupName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n<!-- Store Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('store')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedStoresLabel()\"\r\n readonly\r\n placeholder=\"Select stores\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'store'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search stores\" \r\n [(ngModel)]=\"searchStoreText\" \r\n (ngModelChange)=\"filterStores()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllStores\" \r\n [checked]=\"isAllStoresSelected()\" \r\n (change)=\"toggleSelectAllStores($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllStores\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let store of filteredStores\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"store.storeId\"\r\n [(ngModel)]=\"store.checked\"\r\n (change)=\"updateSelectedStores()\" \r\n />\r\n <label class=\"form-check-label\" [for]=\"store.storeId\">\r\n {{ store.storeName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<!-- Zone Dropdown -->\r\n<div class=\"dropdown-container mt-3\" (clickOutside)=\"closeDropdown()\">\r\n <div class=\"dropdown-header\" (click)=\"toggleDropdown('zone')\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control dropdown-input cursor-pointer\"\r\n [value]=\"selectedZonesLabel()\"\r\n readonly\r\n placeholder=\"Select zones\"\r\n />\r\n </div>\r\n <div class=\"dropdown-menu custom-dropdown-menu\" *ngIf=\"dropdownOpen === 'zone'\">\r\n <input \r\n type=\"text\" \r\n class=\"form-control mb-2 dropdown-search \" \r\n placeholder=\"Search zones\" \r\n [(ngModel)]=\"searchZoneText\" \r\n (ngModelChange)=\"filterZones()\" \r\n />\r\n <div class=\"form-check mb-2 dropdown-item custom-dropdown-item\">\r\n <input \r\n class=\"form-check-input cursor-pointer\" \r\n type=\"checkbox\" \r\n id=\"selectAllZones\" \r\n [checked]=\"isAllZonesSelected()\" \r\n (change)=\"toggleSelectAllZones($event)\" \r\n />\r\n <label class=\"form-check-label\" for=\"selectAllZones\">\r\n Select All\r\n </label>\r\n </div>\r\n <div \r\n class=\"dropdown-item form-check custom-dropdown-item\" \r\n *ngFor=\"let zone of filteredZones\"\r\n >\r\n <input \r\n class=\"form-check-input\" \r\n type=\"checkbox\" \r\n [id]=\"zone._id\"\r\n [(ngModel)]=\"zone.checked\"\r\n (change)=\"updateSelectedZones(zone._id)\"\r\n />\r\n <label class=\"form-check-label\" [for]=\"zone._id\">\r\n {{ zone.tagName }}\r\n </label>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n\r\n\r\n\r\n\r\n </div>\r\n</div>", styles: [".daterangepicker{display:block!important;top:153.85px!important;left:900px!important;right:0}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize}::ng-deep .applyBtn{display:none!important}:host::ng-deep .md-drppicker .btn{line-height:10px!important}:host::ng-deep .daterangepicker-input+.ngx-daterangepicker-material .applyBtn{display:none}:host::ng-deep .md-drppicker.drops-down-right.ltr.double.show-ranges.shown{top:65px!important;left:-470px!important;height:365px!important}:host::ng-deep .md-drppicker .btn{border-radius:8px!important;border:1px solid var(--Primary-600, #00A3FF)!important;background:var(--Primary-600, #00A3FF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--White, #FFF)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize}:host::ng-deep .md-drppicker .ranges ul li button{padding:12px 16px;width:160px;color:var(--Gray-700, #344054);font-size:14px;font-weight:400;line-height:20px;background:none;border:none;text-align:left;cursor:pointer}:host::ng-deep .md-drppicker td.active,:host::ng-deep .md-drppicker td.active:hover{background-color:#029cf4!important;border-radius:20px!important;color:var(--White, #FFF)!important;text-align:center!important;font-size:14px!important;font-weight:500!important;line-height:20px}:host::ng-deep .md-drppicker.ltr .ranges{float:left;margin-top:10px!important}:host::ng-deep .md-drppicker td.in-range{background:var(--Primary-50, #EAF8FF)}:host::ng-deep .md-drppicker .ranges ul li button.active{background:var(--Primary-50, #EAF8FF)!important;border-radius:8px!important;color:var(--Primary-700, #009BF3);font-size:14px!important;font-weight:500!important;line-height:20px!important}:host::ng-deep table th,:host::ng-deep table td{width:40px!important;height:40px!important;padding:10px 8px!important}:host::ng-deep .md-drppicker td.available.prev,:host::ng-deep .md-drppicker th.available.prev{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep .md-drppicker td.available.next,:host::ng-deep .md-drppicker th.available.next{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMy43IDYiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMuNyA2IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxnPg0KCTxwYXRoIGQ9Ik0zLjcsMC43TDEuNCwzbDIuMywyLjNMMyw2TDAsM2wzLTNMMy43LDAuN3oiLz4NCjwvZz4NCjwvc3ZnPg0K)!important;background-repeat:no-repeat!important;background-size:.5em!important;background-position:center!important}:host::ng-deep table th{border-bottom:0px solid var(--Gray-200, #EAECF0)!important;background:transparent!important;color:var(--Gray-700, #344054)!important;text-align:center;font-size:16px!important;font-weight:500!important;line-height:24px}:host::ng-deep .md-drppicker .btn.btn-default{border-radius:8px!important;border:1px solid var(--Gray-300, #D0D5DD)!important;background:var(--White, #FFF)!important;box-shadow:0 1px 2px #1018280d!important;color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600!important;line-height:20px;text-transform:capitalize;margin-right:10px!important}:host::ng-deep .md-drppicker td.available.invalid-date{text-decoration:line-through;pointer-events:none;color:#a9a9a9}:host::ng-deep .md-drppicker td.available.today:not(.invalid-date){text-decoration:unset;pointer-events:unset;color:unset}.wrapper{min-width:200px}.btn-primary{line-height:18px!important}.filter-label{color:var(--Gray-500, #667085)!important;font-size:14px;font-style:normal;font-weight:600;line-height:20px;text-transform:capitalize}.position-relative{position:relative}.filter-icon{cursor:pointer}.dropdown-container{position:relative;display:inline-block;width:100%}.dropdown-header{cursor:pointer;width:100%}.form-control{color:var(--Gray-700, #344054)!important;font-size:14px!important;font-weight:600;line-height:20px;text-transform:capitalize;width:100%;box-sizing:border-box}.dropdown-menu{position:absolute;top:100%;left:0;right:0;border:1px solid #ccc;background-color:#fff;z-index:1000;max-height:230px;overflow-y:auto;display:block;box-sizing:border-box;padding:10px 5px}.dropdown-item{padding:6px 0}.dropdown-item:hover{background-color:#f1f1f1}.dropdown-item input[type=checkbox]{margin-right:10px}.custom-dropdown-menu{border-radius:4px;box-shadow:0 1px 2px #1018280d}.custom-dropdown-item{display:flex;align-items:center}.custom-dropdown-item input{margin-left:10px}.btn-resize{font-size:13px!important;height:29px!important;line-height:11px!important;padding:3px!important}.dropdown2{position:absolute;top:70px;min-width:270px!important}.dropdown2 .dropdown-title{color:var(--Gray-900, #101828);font-size:14px;font-weight:600;line-height:24px}.dropdown2 .dropdown{position:relative;display:inline-block}.dropdown2 .dropdown span{color:var(--Gray-700, #344054);font-size:14px;font-weight:600;line-height:20px}.form-check-label{color:var(--Gray-700, #344054)!important;font-size:14px;font-style:normal;font-weight:500;line-height:20px}input[type=checkbox]{width:16px!important;height:16px!important;margin:0 5px;border-radius:4px!important;-webkit-appearance:none;-moz-appearance:none;-o-appearance:none;appearance:none;outline:1px solid var(--gray-300, #D0D5DD);box-shadow:none;font-size:.8em;text-align:center;line-height:1em;background:#fff}input[type=checkbox]:checked{outline:1px solid var(--primary-600, #00A3FF);background-color:var(--primary-50, #EAF8FF)}input[type=checkbox]:checked:after{content:\"\";transform:rotate(45deg);border-bottom:2px solid #00A3FF;border-right:2px solid #00A3FF;display:inline-block;width:.2em;padding-left:0;padding-top:9px;padding-right:4px}\n"] }]
|
|
8066
8172
|
}], ctorParameters: () => [{ type: AuthService }, { type: i2.Router }, { type: i1.GlobalStateService }, { type: i0.ChangeDetectorRef }], propDecorators: { onClick: [{
|
|
8067
8173
|
type: HostListener,
|
|
8068
|
-
args: [
|
|
8174
|
+
args: ["document:click", ["$event"]]
|
|
8069
8175
|
}], clickOutside: [{
|
|
8070
8176
|
type: HostListener,
|
|
8071
8177
|
args: ["document:click", ["$event"]]
|
|
@@ -8578,9 +8684,7 @@ class SidebarFooterComponent {
|
|
|
8578
8684
|
}
|
|
8579
8685
|
logout() {
|
|
8580
8686
|
this.auth.logout();
|
|
8581
|
-
// .pipe(takeUntil(this.destroy$)).subscribe((res:any)=>{
|
|
8582
8687
|
this.router.navigate(["/auth/login"]);
|
|
8583
|
-
// })
|
|
8584
8688
|
localStorage.clear();
|
|
8585
8689
|
this.pageInfo.setTitle('login');
|
|
8586
8690
|
}
|
|
@@ -10816,28 +10920,131 @@ class HttpAuthInterceptor {
|
|
|
10816
10920
|
}
|
|
10817
10921
|
});
|
|
10818
10922
|
}
|
|
10923
|
+
// intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
10924
|
+
// const user: any = JSON.parse(localStorage.getItem(this.authlocalStorageToken) || '{}');
|
|
10925
|
+
// request = request.clone({
|
|
10926
|
+
// setHeaders: {
|
|
10927
|
+
// Authorization: 'Bearer ' + user.authenticationToken
|
|
10928
|
+
// }
|
|
10929
|
+
// });
|
|
10930
|
+
// return next.handle(request)
|
|
10931
|
+
// .pipe(tap((response:any)=>{
|
|
10932
|
+
// if(response?.body?.data?.result === 'RESTRICTED-IP'){
|
|
10933
|
+
// this.router.navigateByUrl('/error/403-ip')
|
|
10934
|
+
// }
|
|
10935
|
+
// }))
|
|
10936
|
+
// .pipe(
|
|
10937
|
+
// catchError((error:any)=>{
|
|
10938
|
+
// if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
10939
|
+
// // If the error is due to unauthorized access, try to refresh the token
|
|
10940
|
+
// return this.handle401Error(request, next);
|
|
10941
|
+
// }
|
|
10942
|
+
// // else if (error instanceof HttpErrorResponse && error.status === 403) {
|
|
10943
|
+
// // // If the error is due to unauthorized access, try to refresh the token
|
|
10944
|
+
// // this.router.navigate(['/manage/brands'])
|
|
10945
|
+
// // }
|
|
10946
|
+
// return throwError(error);
|
|
10947
|
+
// })
|
|
10948
|
+
// );
|
|
10949
|
+
// }
|
|
10950
|
+
// private handle401Error(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
10951
|
+
// if (!this.isRefreshingToken) {
|
|
10952
|
+
// this.isRefreshingToken = true;
|
|
10953
|
+
// return this.authService.refreshToken().pipe(
|
|
10954
|
+
// switchMap((res: any) => {
|
|
10955
|
+
// if (res && res.code == 200 && res.data.result) {
|
|
10956
|
+
// // Update local storage with the new token
|
|
10957
|
+
// localStorage.setItem(this.authlocalStorageToken, JSON.stringify(res.data.result));
|
|
10958
|
+
// // Clone the request with the new token
|
|
10959
|
+
// request = request.clone({
|
|
10960
|
+
// setHeaders: {
|
|
10961
|
+
// Authorization: `Bearer ${res.data.result.authenticationToken}`
|
|
10962
|
+
// }
|
|
10963
|
+
// });
|
|
10964
|
+
// // Reset the flag for token refreshing
|
|
10965
|
+
// this.isRefreshingToken = false;
|
|
10966
|
+
// // Retry the original request with the new token
|
|
10967
|
+
// return next.handle(request);
|
|
10968
|
+
// } else {
|
|
10969
|
+
// // Logout user if refresh token fails
|
|
10970
|
+
// this.authService.logout();
|
|
10971
|
+
// const keysToKeep = ['data-mismatch-draft'];
|
|
10972
|
+
// const valuesToKeep:any = {};
|
|
10973
|
+
// keysToKeep.forEach(key => {
|
|
10974
|
+
// const value = localStorage.getItem(key);
|
|
10975
|
+
// if (value !== null) {
|
|
10976
|
+
// valuesToKeep[key] = value;
|
|
10977
|
+
// }
|
|
10978
|
+
// });
|
|
10979
|
+
// localStorage.clear();
|
|
10980
|
+
// Object.keys(valuesToKeep).forEach(key => {
|
|
10981
|
+
// localStorage.setItem(key, valuesToKeep[key]);
|
|
10982
|
+
// });
|
|
10983
|
+
// this.router.navigate(['/auth/login']);
|
|
10984
|
+
// return throwError('Token Expired Please Login Again!');
|
|
10985
|
+
// }
|
|
10986
|
+
// }),
|
|
10987
|
+
// catchError((error) => {
|
|
10988
|
+
// // Logout user if refresh token fails
|
|
10989
|
+
// this.authService.logout();
|
|
10990
|
+
// const keysToKeep = ['data-mismatch-draft'];
|
|
10991
|
+
// const valuesToKeep:any = {};
|
|
10992
|
+
// keysToKeep.forEach(key => {
|
|
10993
|
+
// const value = localStorage.getItem(key);
|
|
10994
|
+
// if (value !== null) {
|
|
10995
|
+
// valuesToKeep[key] = value;
|
|
10996
|
+
// }
|
|
10997
|
+
// });
|
|
10998
|
+
// localStorage.clear();
|
|
10999
|
+
// Object.keys(valuesToKeep).forEach(key => {
|
|
11000
|
+
// localStorage.setItem(key, valuesToKeep[key]);
|
|
11001
|
+
// });
|
|
11002
|
+
// this.router.navigate(['/auth/login']);
|
|
11003
|
+
// return throwError(error);
|
|
11004
|
+
// })
|
|
11005
|
+
// );
|
|
11006
|
+
// } else {
|
|
11007
|
+
// // If already refreshing the token, queue the request and wait
|
|
11008
|
+
// return this.tokenRefreshed.pipe(
|
|
11009
|
+
// switchMap(() => {
|
|
11010
|
+
// const tokens: any = JSON.parse(localStorage.getItem(this.authlocalStorageToken) || '{}');
|
|
11011
|
+
// request = request.clone({
|
|
11012
|
+
// setHeaders: {
|
|
11013
|
+
// Authorization: 'Bearer ' + tokens.authenticationToken
|
|
11014
|
+
// }
|
|
11015
|
+
// });
|
|
11016
|
+
// return next.handle(request);
|
|
11017
|
+
// })
|
|
11018
|
+
// );
|
|
11019
|
+
// }
|
|
11020
|
+
// }
|
|
10819
11021
|
intercept(request, next) {
|
|
10820
|
-
const
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
11022
|
+
const tokenObjStr = this.authService.getCookie(this.authlocalStorageToken);
|
|
11023
|
+
let token = '';
|
|
11024
|
+
if (tokenObjStr) {
|
|
11025
|
+
try {
|
|
11026
|
+
const tokenObj = JSON.parse(tokenObjStr);
|
|
11027
|
+
token = tokenObj?.authenticationToken || '';
|
|
10824
11028
|
}
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
11029
|
+
catch (e) {
|
|
11030
|
+
console.error('Invalid auth token format in cookie', e);
|
|
11031
|
+
}
|
|
11032
|
+
}
|
|
11033
|
+
if (token) {
|
|
11034
|
+
request = request.clone({
|
|
11035
|
+
setHeaders: {
|
|
11036
|
+
Authorization: 'Bearer ' + token,
|
|
11037
|
+
},
|
|
11038
|
+
});
|
|
11039
|
+
}
|
|
11040
|
+
return next.handle(request).pipe(tap((response) => {
|
|
10828
11041
|
if (response?.body?.data?.result === 'RESTRICTED-IP') {
|
|
10829
11042
|
this.router.navigateByUrl('/error/403-ip');
|
|
10830
11043
|
}
|
|
10831
|
-
}))
|
|
10832
|
-
.pipe(catchError((error) => {
|
|
11044
|
+
}), catchError((error) => {
|
|
10833
11045
|
if (error instanceof HttpErrorResponse && error.status === 401) {
|
|
10834
|
-
// If the error is due to unauthorized access, try to refresh the token
|
|
10835
11046
|
return this.handle401Error(request, next);
|
|
10836
11047
|
}
|
|
10837
|
-
// else if (error instanceof HttpErrorResponse && error.status === 403) {
|
|
10838
|
-
// // If the error is due to unauthorized access, try to refresh the token
|
|
10839
|
-
// this.router.navigate(['/manage/brands'])
|
|
10840
|
-
// }
|
|
10841
11048
|
return throwError(error);
|
|
10842
11049
|
}));
|
|
10843
11050
|
}
|
|
@@ -10845,70 +11052,44 @@ class HttpAuthInterceptor {
|
|
|
10845
11052
|
if (!this.isRefreshingToken) {
|
|
10846
11053
|
this.isRefreshingToken = true;
|
|
10847
11054
|
return this.authService.refreshToken().pipe(switchMap((res) => {
|
|
10848
|
-
if (res && res.code
|
|
10849
|
-
|
|
10850
|
-
|
|
10851
|
-
// Clone the request with the new token
|
|
11055
|
+
if (res && res.code === 200 && res.data?.result) {
|
|
11056
|
+
this.authService.setCookie(this.authlocalStorageToken, JSON.stringify(res.data.result), 7);
|
|
11057
|
+
const newToken = res.data.result.authenticationToken;
|
|
10852
11058
|
request = request.clone({
|
|
10853
11059
|
setHeaders: {
|
|
10854
|
-
Authorization:
|
|
10855
|
-
}
|
|
11060
|
+
Authorization: 'Bearer ' + newToken,
|
|
11061
|
+
},
|
|
10856
11062
|
});
|
|
10857
|
-
// Reset the flag for token refreshing
|
|
10858
11063
|
this.isRefreshingToken = false;
|
|
10859
|
-
// Retry the original request with the new token
|
|
10860
11064
|
return next.handle(request);
|
|
10861
11065
|
}
|
|
10862
11066
|
else {
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
const valuesToKeep = {};
|
|
10867
|
-
keysToKeep.forEach(key => {
|
|
10868
|
-
const value = localStorage.getItem(key);
|
|
10869
|
-
if (value !== null) {
|
|
10870
|
-
valuesToKeep[key] = value;
|
|
10871
|
-
}
|
|
10872
|
-
});
|
|
10873
|
-
localStorage.clear();
|
|
10874
|
-
Object.keys(valuesToKeep).forEach(key => {
|
|
10875
|
-
localStorage.setItem(key, valuesToKeep[key]);
|
|
10876
|
-
});
|
|
10877
|
-
this.router.navigate(['/auth/login']);
|
|
10878
|
-
return throwError('Token Expired Please Login Again!');
|
|
10879
|
-
}
|
|
10880
|
-
}), catchError((error) => {
|
|
10881
|
-
// Logout user if refresh token fails
|
|
10882
|
-
this.authService.logout();
|
|
10883
|
-
const keysToKeep = ['data-mismatch-draft'];
|
|
10884
|
-
const valuesToKeep = {};
|
|
10885
|
-
keysToKeep.forEach(key => {
|
|
10886
|
-
const value = localStorage.getItem(key);
|
|
10887
|
-
if (value !== null) {
|
|
10888
|
-
valuesToKeep[key] = value;
|
|
10889
|
-
}
|
|
10890
|
-
});
|
|
10891
|
-
localStorage.clear();
|
|
10892
|
-
Object.keys(valuesToKeep).forEach(key => {
|
|
10893
|
-
localStorage.setItem(key, valuesToKeep[key]);
|
|
10894
|
-
});
|
|
10895
|
-
this.router.navigate(['/auth/login']);
|
|
10896
|
-
return throwError(error);
|
|
10897
|
-
}));
|
|
11067
|
+
return this.forceLogout('Token Expired. Please login again.');
|
|
11068
|
+
}
|
|
11069
|
+
}), catchError((err) => this.forceLogout(err)));
|
|
10898
11070
|
}
|
|
10899
11071
|
else {
|
|
10900
|
-
//
|
|
10901
|
-
return
|
|
10902
|
-
const tokens = JSON.parse(localStorage.getItem(this.authlocalStorageToken) || '{}');
|
|
10903
|
-
request = request.clone({
|
|
10904
|
-
setHeaders: {
|
|
10905
|
-
Authorization: 'Bearer ' + tokens.authenticationToken
|
|
10906
|
-
}
|
|
10907
|
-
});
|
|
10908
|
-
return next.handle(request);
|
|
10909
|
-
}));
|
|
11072
|
+
// Optional: implement logic to queue and retry if multiple requests during refresh
|
|
11073
|
+
return throwError('Token refresh already in progress');
|
|
10910
11074
|
}
|
|
10911
11075
|
}
|
|
11076
|
+
forceLogout(message) {
|
|
11077
|
+
this.authService.logout();
|
|
11078
|
+
const keysToKeep = ['data-mismatch-draft'];
|
|
11079
|
+
const valuesToKeep = {};
|
|
11080
|
+
keysToKeep.forEach((key) => {
|
|
11081
|
+
const val = localStorage.getItem(key);
|
|
11082
|
+
if (val)
|
|
11083
|
+
valuesToKeep[key] = val;
|
|
11084
|
+
});
|
|
11085
|
+
localStorage.clear();
|
|
11086
|
+
// Object.entries(valuesToKeep).forEach(([k, v]) => {
|
|
11087
|
+
// return localStorage.setItem(k, v);
|
|
11088
|
+
// });
|
|
11089
|
+
this.authService.deleteCookie(this.authlocalStorageToken);
|
|
11090
|
+
this.router.navigate(['/auth/login']);
|
|
11091
|
+
return throwError(() => message);
|
|
11092
|
+
}
|
|
10912
11093
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HttpAuthInterceptor, deps: [{ token: i1.GlobalStateService }, { token: AuthService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
10913
11094
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: HttpAuthInterceptor });
|
|
10914
11095
|
}
|