@aggdirect/coolmap-services 1.1.2 → 1.1.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.
@@ -9,737 +9,741 @@ import * as i1 from '@angular/common/http';
9
9
  import * as i2 from '@angular/material/snack-bar';
10
10
  import * as i2$1 from '@angular/platform-browser';
11
11
 
12
- class Route {
13
- constructor() {
14
- this.index = 0;
15
- }
16
- }
17
- const EstinationData = ['estimated_distance', 'estimated_time'];
18
- var EstinationEnum;
19
- (function (EstinationEnum) {
20
- EstinationEnum["estimated_distance"] = "miles";
21
- EstinationEnum["estimated_time"] = "time";
22
- })(EstinationEnum || (EstinationEnum = {}));
23
- const JobCodeOverviewData = ['customer_contact', 'delivery_contact', 'pickup_location', 'delivery_location', 'project', 'unit'];
24
- var JobCodeOverviewEnum;
25
- (function (JobCodeOverviewEnum) {
26
- JobCodeOverviewEnum["customer_contact"] = "Customer Contact";
27
- JobCodeOverviewEnum["delivery_contact"] = "Delivery Contact";
28
- JobCodeOverviewEnum["pickup_location"] = "Pickup";
29
- JobCodeOverviewEnum["delivery_location"] = "Delivery";
30
- JobCodeOverviewEnum["project"] = "Project Name";
31
- JobCodeOverviewEnum["unit"] = "Job Type";
32
- })(JobCodeOverviewEnum || (JobCodeOverviewEnum = {}));
33
- const DriversmsCardKey = ['order_number', 'date', 'values', 'material', 'unit', 'pickup_location', 'delivery_location'];
34
- var DriverSmsCardEnum;
35
- (function (DriverSmsCardEnum) {
36
- DriverSmsCardEnum["order_number"] = "Jobcode";
37
- DriverSmsCardEnum["date"] = "Date";
38
- DriverSmsCardEnum["values"] = "Total tasks";
39
- DriverSmsCardEnum["material"] = "Material";
40
- DriverSmsCardEnum["unit"] = "Unit";
41
- DriverSmsCardEnum["pickup_location"] = "Pickup Address";
42
- DriverSmsCardEnum["delivery_location"] = "Delivery Address";
43
- })(DriverSmsCardEnum || (DriverSmsCardEnum = {}));
44
- class PopupData {
45
- }
46
- class CoolmapConfigModel {
12
+ class Route {
13
+ constructor() {
14
+ this.index = 0;
15
+ }
16
+ }
17
+ const EstinationData = ['estimated_distance', 'estimated_time'];
18
+ var EstinationEnum;
19
+ (function (EstinationEnum) {
20
+ EstinationEnum["estimated_distance"] = "miles";
21
+ EstinationEnum["estimated_time"] = "time";
22
+ })(EstinationEnum || (EstinationEnum = {}));
23
+ const JobCodeOverviewData = ['order_number', 'customer_name', 'project', 'unit', 'material', 'customer_contact', 'delivery_contact', 'pickup_location', 'delivery_location'];
24
+ var JobCodeOverviewEnum;
25
+ (function (JobCodeOverviewEnum) {
26
+ JobCodeOverviewEnum["material"] = "Material";
27
+ JobCodeOverviewEnum["order_number"] = "Job Code";
28
+ JobCodeOverviewEnum["customer_name"] = "Customer";
29
+ JobCodeOverviewEnum["customer_contact"] = "Customer Contact";
30
+ JobCodeOverviewEnum["delivery_contact"] = "Delivery Contact";
31
+ JobCodeOverviewEnum["project"] = "Project Name";
32
+ JobCodeOverviewEnum["unit"] = "Job Type";
33
+ JobCodeOverviewEnum["pickup_location"] = "Pickup";
34
+ JobCodeOverviewEnum["delivery_location"] = "Delivery";
35
+ })(JobCodeOverviewEnum || (JobCodeOverviewEnum = {}));
36
+ const DriversmsCardKey = ['order_number', 'date', 'values', 'material', 'unit', 'pickup_location', 'delivery_location'];
37
+ var DriverSmsCardEnum;
38
+ (function (DriverSmsCardEnum) {
39
+ DriverSmsCardEnum["order_number"] = "Jobcode";
40
+ DriverSmsCardEnum["date"] = "Date";
41
+ DriverSmsCardEnum["values"] = "Total tasks";
42
+ DriverSmsCardEnum["material"] = "Material";
43
+ DriverSmsCardEnum["unit"] = "Unit";
44
+ DriverSmsCardEnum["pickup_location"] = "Pickup Address";
45
+ DriverSmsCardEnum["delivery_location"] = "Delivery Address";
46
+ })(DriverSmsCardEnum || (DriverSmsCardEnum = {}));
47
+ class PopupData {
48
+ }
49
+ class CoolmapConfigModel {
47
50
  }
48
51
 
49
- class UtilsService {
50
- constructor(http, snackBar, config) {
51
- this.http = http;
52
- this.snackBar = snackBar;
53
- this.config = config;
54
- this.analyticsRESTURL = '';
55
- this.RESTURLPrefix = '';
56
- this.pickupOptions = [];
57
- this.destOptions = [];
58
- this.ownerOptions = [];
59
- this.customerOptions = [];
60
- this.unitOptions = [];
61
- this.materialOptions = [];
62
- this.jcodeOptions = [];
63
- this.driverOption = [];
64
- this.truckingCompanayOption = [];
65
- this.routeNameOptions = [];
66
- this.preventnavChange = new BehaviorSubject(false);
67
- this.navChangeObserve = this.preventnavChange.asObservable();
68
- this.clearViewRouteforJobCode = new BehaviorSubject(false);
69
- this.clearViewRouteforJobCodeObserve = this.clearViewRouteforJobCode.asObservable();
70
- this.preVentJobdetailclose = new BehaviorSubject(false);
71
- this.getpreVentJobdetailclose = this.preVentJobdetailclose.asObservable();
72
- this.routeDetailsUtility = new BehaviorSubject({});
73
- this.getrouteDetailsUtility = this.routeDetailsUtility.asObservable();
74
- this.removeMapEntity = new BehaviorSubject({});
75
- this.removeMapEntityUtility = this.removeMapEntity.asObservable();
76
- this.dict = new Map();
77
- this.analyticsRESTURL = config.analyticsRESTURL;
78
- this.RESTURLPrefix = config.RESTURLPrefix;
79
- }
80
- getDateFormat(strVal, seprater) {
81
- seprater = seprater ? seprater : '-';
82
- const mydate = strVal;
83
- return mydate?.getFullYear() + seprater + ((mydate ? mydate.getMonth() : 0) + 1) + seprater + mydate?.getDate();
84
- }
85
- getData(path) { return this.http.get(`${this.analyticsRESTURL}${this.config.repository}/${path}`); }
86
- postdata(path, data) { return this.http.post(`${this.analyticsRESTURL}${this.config.repository}/${path}`, data); }
87
- postDataWithRestUrl(path, data) { return this.http.post(`${this.RESTURLPrefix}${path}`, data); }
88
- fetchAutoCompleteLocations(keyword) {
89
- return this.http.get(`https://api.mapbox.com/geocoding/v5/mapbox.places/${keyword}.json?access_token=${this.config.mapboxAccessToken}&country=US`);
90
- }
91
- openSnackBar(message, className) {
92
- this.snackBar.open(message, '', {
93
- duration: 5000, verticalPosition: 'top', horizontalPosition: 'center', panelClass: [className ? className : 'default']
94
- });
95
- }
96
- makeOptions(item) {
97
- if (item.order_number) {
98
- (this.jcodeOptions.findIndex((elem) => elem.job_id === item.job_id) === -1) ? this.jcodeOptions.push({ job_code: item.order_number, job_id: item.job_id }) : null;
99
- if (item.driver_list && item.driver_list?.length > 0) {
100
- item.driver_list.forEach((driver) => {
101
- this.driverOption.findIndex(elem => elem === driver['driver_name']) === -1 ? this.driverOption.push(driver['driver_name']) : null;
102
- this.truckingCompanayOption.findIndex(elem => elem === driver['trucking_company']) === -1 ? this.truckingCompanayOption.push(driver['trucking_company']) : null;
103
- });
104
- }
105
- }
106
- ((this.pickupOptions.findIndex((elem) => elem === item.pickup_location)) === -1) ? this.pickupOptions.push(item.pickup_location) : null;
107
- ((this.destOptions.findIndex((elem) => elem === item.delivery_location)) === -1) ? this.destOptions.push(item.delivery_location) : null;
108
- (this.customerOptions.findIndex((customer) => customer === item.customer_name) === -1) ? this.customerOptions.push(item.customer_name) : null;
109
- (this.unitOptions.findIndex((elem) => elem === item.unit) === -1) ? this.unitOptions.push(item.unit) : null;
110
- (this.materialOptions.findIndex((elem) => elem === item.material) === -1) ? this.materialOptions.push(item.material) : null;
111
- if (item.route_name)
112
- this.routeNameOptions.findIndex(elem => elem === item.route_name) === -1 ? this.routeNameOptions.push(item.route_name) : null;
113
- }
114
- filter(value, filters) {
115
- if (typeof value !== 'string') {
116
- return [];
117
- }
118
- const filterValue = value.toLowerCase();
119
- if (filterValue === '') {
120
- return [];
121
- }
122
- const searchResults = [];
123
- this.unitOptions.map(unit => {
124
- if (unit.toLowerCase().includes(filterValue)) {
125
- searchResults.push({ "type": "unit", "label": unit, "value": unit });
126
- }
127
- });
128
- this.customerOptions.map(unit => {
129
- if (unit.toLowerCase().includes(filterValue)) {
130
- searchResults.push({ "type": "customer", "label": unit, "value": unit });
131
- }
132
- });
133
- this.materialOptions.map(unit => {
134
- if (unit.toLowerCase().includes(filterValue)) {
135
- searchResults.push({ "type": "material", "label": unit, "value": unit });
136
- }
137
- });
138
- this.pickupOptions.map(unit => {
139
- if (unit.toLowerCase().includes(filterValue)) {
140
- searchResults.push({ "type": "pickup location", "label": unit, "value": unit });
141
- }
142
- });
143
- this.destOptions.map(unit => {
144
- if (unit.toLowerCase().includes(filterValue)) {
145
- searchResults.push({ "type": "destination location", "label": unit, "value": unit });
146
- }
147
- });
148
- this.jcodeOptions.map(unit => {
149
- if (unit.job_code.toLowerCase().includes(filterValue)) {
150
- searchResults.push({ "type": "job", "label": unit['job_code'], "value": unit });
151
- }
152
- });
153
- this.driverOption.map(unit => {
154
- if (unit.toLowerCase().includes(filterValue)) {
155
- searchResults.push({ "type": "Driver", "label": unit, "value": unit });
156
- }
157
- });
158
- this.truckingCompanayOption.map(unit => {
159
- if (unit.toLowerCase().includes(filterValue)) {
160
- searchResults.push({ "type": "Trucking Company", "label": unit, "value": unit });
161
- }
162
- });
163
- this.routeNameOptions.map(unit => {
164
- if (unit.toLowerCase().includes(filterValue)) {
165
- searchResults.push({ "type": "Route name", "label": unit, "value": unit });
166
- }
167
- });
168
- const searchDict = {};
169
- filters.map((filter) => {
170
- searchDict[filter['name'] + filter['type']] = filter;
171
- });
172
- const furtherFilter = [];
173
- searchResults.map(search => {
174
- if ((search['label'] + search['type']) in searchDict) { }
175
- else {
176
- furtherFilter.push(search);
177
- }
178
- });
179
- return furtherFilter;
180
- }
181
- getSearchResults(list, filterval) {
182
- return list.filter(element => {
183
- const result_list_boolean = [];
184
- if (filterval.length > 0) {
185
- if (filterval[0]['type'] === 'unit') {
186
- result_list_boolean.push(filterval[0]['name'] === element[filterval[0]['type']]);
187
- }
188
- if (filterval[0]['type'] === 'customer') {
189
- result_list_boolean.push(filterval[0]['name'] === element['customer_name']);
190
- }
191
- if (filterval[0]['type'] === 'material') {
192
- result_list_boolean.push(filterval[0]['name'] === element[filterval[0]['type']]);
193
- }
194
- if (filterval[0]['type'] === 'pickup location') {
195
- result_list_boolean.push(filterval[0]['name'] === element['pickup_location']);
196
- }
197
- if (filterval[0]['type'] === 'destination location') {
198
- result_list_boolean.push(filterval[0]['name'] === element['delivery_location']);
199
- }
200
- if (filterval[0]['type'] === 'job') {
201
- result_list_boolean.push(filterval[0]['name'] === element['order_number']);
202
- }
203
- if (filterval[0]['type'] === 'Route name') {
204
- result_list_boolean.push(filterval[0]['name'] === element['route_name']);
205
- }
206
- if (filterval[0]['type'] === 'Driver') {
207
- const index = element.driver_list?.findIndex(ele => { return filterval[0]['name'] === ele['driver_name']; });
208
- if (index !== -1)
209
- result_list_boolean.push(true);
210
- }
211
- if (filterval[0]['type'] === 'Trucking Company') {
212
- const index = element.driver_list?.findIndex(ele => { return filterval[0]['name'] === ele['trucking_company']; });
213
- if (index !== -1)
214
- result_list_boolean.push(true);
215
- }
216
- }
217
- if (result_list_boolean.length > 0) {
218
- return result_list_boolean.reduce((prev, curr) => prev && curr);
219
- }
220
- return false;
221
- });
222
- }
223
- clearOptions() {
224
- this.pickupOptions = [];
225
- this.destOptions = [];
226
- this.ownerOptions = [];
227
- this.customerOptions = [];
228
- this.unitOptions = [];
229
- this.materialOptions = [];
230
- this.jcodeOptions = [];
231
- this.routeNameOptions = [];
232
- }
233
- setdictValue(key, value) {
234
- this.dict.set(key, value);
235
- }
236
- getdictValue(key) {
237
- return JSON.parse(this.dict.get(key));
238
- }
239
- removedictValue(key) {
240
- this.dict.delete(key);
241
- }
242
- conveySearchIcon(value) {
243
- if (value && typeof (value) !== 'object')
244
- return true;
245
- return false;
246
- }
247
- fetchUnitsList() {
248
- return new Promise((resolve, reject) => {
249
- if (!this.unitsList) {
250
- this.getData('unit/list/view').subscribe((res) => {
251
- if (res) {
252
- this.unitsList = res.data;
253
- resolve(this.unitsList);
254
- }
255
- });
256
- }
257
- else {
258
- resolve(this.unitsList);
259
- }
260
- });
261
- }
262
- fetchMaterialsList() {
263
- return new Promise((resolve, reject) => {
264
- if (!this.materialsList) {
265
- this.getData('material/list/view').subscribe(((res) => {
266
- res.data.sort((a, b) => a.material.localeCompare(b.material));
267
- this.materialsList = res.data;
268
- resolve(this.materialsList);
269
- }));
270
- }
271
- else {
272
- resolve(this.materialsList);
273
- }
274
- });
275
- }
276
- fetchCustomersList() {
277
- return new Promise((resolve, reject) => {
278
- if (!this.customersList) {
279
- this.getData('company/list/view').subscribe((res) => {
280
- if (res) {
281
- this.customersList = res.data;
282
- resolve(this.customersList);
283
- }
284
- });
285
- }
286
- else {
287
- resolve(this.customersList);
288
- }
289
- });
290
- }
291
- }
292
- UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, deps: [{ token: i1.HttpClient }, { token: i2.MatSnackBar }, { token: 'memberData' }], target: i0.ɵɵFactoryTarget.Injectable });
293
- UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, providedIn: 'root' });
294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, decorators: [{
295
- type: Injectable,
296
- args: [{ providedIn: 'root' }]
297
- }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.MatSnackBar }, { type: CoolmapConfigModel, decorators: [{
298
- type: Inject,
299
- args: ['memberData']
52
+ class UtilsService {
53
+ constructor(http, snackBar, config) {
54
+ this.http = http;
55
+ this.snackBar = snackBar;
56
+ this.config = config;
57
+ this.analyticsRESTURL = '';
58
+ this.RESTURLPrefix = '';
59
+ this.pickupOptions = [];
60
+ this.destOptions = [];
61
+ this.ownerOptions = [];
62
+ this.customerOptions = [];
63
+ this.unitOptions = [];
64
+ this.materialOptions = [];
65
+ this.jcodeOptions = [];
66
+ this.driverOption = [];
67
+ this.truckingCompanayOption = [];
68
+ this.routeNameOptions = [];
69
+ this.preventnavChange = new BehaviorSubject(false);
70
+ this.navChangeObserve = this.preventnavChange.asObservable();
71
+ this.clearViewRouteforJobCode = new BehaviorSubject(false);
72
+ this.clearViewRouteforJobCodeObserve = this.clearViewRouteforJobCode.asObservable();
73
+ this.preVentJobdetailclose = new BehaviorSubject(false);
74
+ this.getpreVentJobdetailclose = this.preVentJobdetailclose.asObservable();
75
+ this.routeDetailsUtility = new BehaviorSubject({});
76
+ this.getrouteDetailsUtility = this.routeDetailsUtility.asObservable();
77
+ this.removeMapEntity = new BehaviorSubject({});
78
+ this.removeMapEntityUtility = this.removeMapEntity.asObservable();
79
+ this.dict = new Map();
80
+ this.analyticsRESTURL = config.analyticsRESTURL;
81
+ this.RESTURLPrefix = config.RESTURLPrefix;
82
+ }
83
+ getDateFormat(strVal, seprater) {
84
+ seprater = seprater ? seprater : '-';
85
+ const mydate = strVal;
86
+ return mydate?.getFullYear() + seprater + ((mydate ? mydate.getMonth() : 0) + 1) + seprater + mydate?.getDate();
87
+ }
88
+ getData(path) { return this.http.get(`${this.analyticsRESTURL}${this.config.repository}/${path}`); }
89
+ postdata(path, data) { return this.http.post(`${this.analyticsRESTURL}${this.config.repository}/${path}`, data); }
90
+ postDataWithRestUrl(path, data) { return this.http.post(`${this.RESTURLPrefix}${path}`, data); }
91
+ fetchAutoCompleteLocations(keyword) {
92
+ return this.http.get(`https://api.mapbox.com/geocoding/v5/mapbox.places/${keyword}.json?access_token=${this.config.mapboxAccessToken}&country=US`);
93
+ }
94
+ openSnackBar(message, className) {
95
+ this.snackBar.open(message, '', {
96
+ duration: 5000, verticalPosition: 'top', horizontalPosition: 'center', panelClass: [className ? className : 'default']
97
+ });
98
+ }
99
+ makeOptions(item) {
100
+ if (item.order_number) {
101
+ (this.jcodeOptions.findIndex((elem) => elem.job_id === item.job_id) === -1) ? this.jcodeOptions.push({ job_code: item.order_number, job_id: item.job_id }) : null;
102
+ if (item.driver_list && item.driver_list?.length > 0) {
103
+ item.driver_list.forEach((driver) => {
104
+ this.driverOption.findIndex(elem => elem === driver['driver_name']) === -1 ? this.driverOption.push(driver['driver_name']) : null;
105
+ this.truckingCompanayOption.findIndex(elem => elem === driver['trucking_company']) === -1 ? this.truckingCompanayOption.push(driver['trucking_company']) : null;
106
+ });
107
+ }
108
+ }
109
+ ((this.pickupOptions.findIndex((elem) => elem === item.pickup_location)) === -1) ? this.pickupOptions.push(item.pickup_location) : null;
110
+ ((this.destOptions.findIndex((elem) => elem === item.delivery_location)) === -1) ? this.destOptions.push(item.delivery_location) : null;
111
+ (this.customerOptions.findIndex((customer) => customer === item.customer_name) === -1) ? this.customerOptions.push(item.customer_name) : null;
112
+ (this.unitOptions.findIndex((elem) => elem === item.unit) === -1) ? this.unitOptions.push(item.unit) : null;
113
+ (this.materialOptions.findIndex((elem) => elem === item.material) === -1) ? this.materialOptions.push(item.material) : null;
114
+ if (item.route_name)
115
+ this.routeNameOptions.findIndex(elem => elem === item.route_name) === -1 ? this.routeNameOptions.push(item.route_name) : null;
116
+ }
117
+ filter(value, filters) {
118
+ if (typeof value !== 'string') {
119
+ return [];
120
+ }
121
+ const filterValue = value.toLowerCase();
122
+ if (filterValue === '') {
123
+ return [];
124
+ }
125
+ const searchResults = [];
126
+ this.unitOptions.map(unit => {
127
+ if (unit.toLowerCase().includes(filterValue)) {
128
+ searchResults.push({ "type": "unit", "label": unit, "value": unit });
129
+ }
130
+ });
131
+ this.customerOptions.map(unit => {
132
+ if (unit.toLowerCase().includes(filterValue)) {
133
+ searchResults.push({ "type": "customer", "label": unit, "value": unit });
134
+ }
135
+ });
136
+ this.materialOptions.map(unit => {
137
+ if (unit.toLowerCase().includes(filterValue)) {
138
+ searchResults.push({ "type": "material", "label": unit, "value": unit });
139
+ }
140
+ });
141
+ this.pickupOptions.map(unit => {
142
+ if (unit.toLowerCase().includes(filterValue)) {
143
+ searchResults.push({ "type": "pickup location", "label": unit, "value": unit });
144
+ }
145
+ });
146
+ this.destOptions.map(unit => {
147
+ if (unit.toLowerCase().includes(filterValue)) {
148
+ searchResults.push({ "type": "destination location", "label": unit, "value": unit });
149
+ }
150
+ });
151
+ this.jcodeOptions.map(unit => {
152
+ if (unit.job_code.toLowerCase().includes(filterValue)) {
153
+ searchResults.push({ "type": "job", "label": unit['job_code'], "value": unit });
154
+ }
155
+ });
156
+ this.driverOption.map(unit => {
157
+ if (unit.toLowerCase().includes(filterValue)) {
158
+ searchResults.push({ "type": "Driver", "label": unit, "value": unit });
159
+ }
160
+ });
161
+ this.truckingCompanayOption.map(unit => {
162
+ if (unit.toLowerCase().includes(filterValue)) {
163
+ searchResults.push({ "type": "Trucking Company", "label": unit, "value": unit });
164
+ }
165
+ });
166
+ this.routeNameOptions.map(unit => {
167
+ if (unit.toLowerCase().includes(filterValue)) {
168
+ searchResults.push({ "type": "Route name", "label": unit, "value": unit });
169
+ }
170
+ });
171
+ const searchDict = {};
172
+ filters.map((filter) => {
173
+ searchDict[filter['name'] + filter['type']] = filter;
174
+ });
175
+ const furtherFilter = [];
176
+ searchResults.map(search => {
177
+ if ((search['label'] + search['type']) in searchDict) { }
178
+ else {
179
+ furtherFilter.push(search);
180
+ }
181
+ });
182
+ return furtherFilter;
183
+ }
184
+ getSearchResults(list, filterval) {
185
+ return list.filter(element => {
186
+ const result_list_boolean = [];
187
+ if (filterval.length > 0) {
188
+ if (filterval[0]['type'] === 'unit') {
189
+ result_list_boolean.push(filterval[0]['name'] === element[filterval[0]['type']]);
190
+ }
191
+ if (filterval[0]['type'] === 'customer') {
192
+ result_list_boolean.push(filterval[0]['name'] === element['customer_name']);
193
+ }
194
+ if (filterval[0]['type'] === 'material') {
195
+ result_list_boolean.push(filterval[0]['name'] === element[filterval[0]['type']]);
196
+ }
197
+ if (filterval[0]['type'] === 'pickup location') {
198
+ result_list_boolean.push(filterval[0]['name'] === element['pickup_location']);
199
+ }
200
+ if (filterval[0]['type'] === 'destination location') {
201
+ result_list_boolean.push(filterval[0]['name'] === element['delivery_location']);
202
+ }
203
+ if (filterval[0]['type'] === 'job') {
204
+ result_list_boolean.push(filterval[0]['name'] === element['order_number']);
205
+ }
206
+ if (filterval[0]['type'] === 'Route name') {
207
+ result_list_boolean.push(filterval[0]['name'] === element['route_name']);
208
+ }
209
+ if (filterval[0]['type'] === 'Driver') {
210
+ const index = element.driver_list?.findIndex(ele => { return filterval[0]['name'] === ele['driver_name']; });
211
+ if (index !== -1)
212
+ result_list_boolean.push(true);
213
+ }
214
+ if (filterval[0]['type'] === 'Trucking Company') {
215
+ const index = element.driver_list?.findIndex(ele => { return filterval[0]['name'] === ele['trucking_company']; });
216
+ if (index !== -1)
217
+ result_list_boolean.push(true);
218
+ }
219
+ }
220
+ if (result_list_boolean.length > 0) {
221
+ return result_list_boolean.reduce((prev, curr) => prev && curr);
222
+ }
223
+ return false;
224
+ });
225
+ }
226
+ clearOptions() {
227
+ this.pickupOptions = [];
228
+ this.destOptions = [];
229
+ this.ownerOptions = [];
230
+ this.customerOptions = [];
231
+ this.unitOptions = [];
232
+ this.materialOptions = [];
233
+ this.jcodeOptions = [];
234
+ this.routeNameOptions = [];
235
+ }
236
+ setdictValue(key, value) {
237
+ this.dict.set(key, value);
238
+ }
239
+ getdictValue(key) {
240
+ return JSON.parse(this.dict.get(key));
241
+ }
242
+ removedictValue(key) {
243
+ this.dict.delete(key);
244
+ }
245
+ conveySearchIcon(value) {
246
+ if (value && typeof (value) !== 'object')
247
+ return true;
248
+ return false;
249
+ }
250
+ fetchUnitsList() {
251
+ return new Promise((resolve, reject) => {
252
+ if (!this.unitsList) {
253
+ this.getData('unit/list/view').subscribe((res) => {
254
+ if (res) {
255
+ this.unitsList = res.data;
256
+ resolve(this.unitsList);
257
+ }
258
+ });
259
+ }
260
+ else {
261
+ resolve(this.unitsList);
262
+ }
263
+ });
264
+ }
265
+ fetchMaterialsList() {
266
+ return new Promise((resolve, reject) => {
267
+ if (!this.materialsList) {
268
+ this.getData('material/list/view').subscribe(((res) => {
269
+ res.data.sort((a, b) => a.material.localeCompare(b.material));
270
+ this.materialsList = res.data;
271
+ resolve(this.materialsList);
272
+ }));
273
+ }
274
+ else {
275
+ resolve(this.materialsList);
276
+ }
277
+ });
278
+ }
279
+ fetchCustomersList() {
280
+ return new Promise((resolve, reject) => {
281
+ if (!this.customersList) {
282
+ this.getData('company/list/view').subscribe((res) => {
283
+ if (res) {
284
+ this.customersList = res.data;
285
+ resolve(this.customersList);
286
+ }
287
+ });
288
+ }
289
+ else {
290
+ resolve(this.customersList);
291
+ }
292
+ });
293
+ }
294
+ }
295
+ UtilsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, deps: [{ token: i1.HttpClient }, { token: i2.MatSnackBar }, { token: 'memberData' }], target: i0.ɵɵFactoryTarget.Injectable });
296
+ UtilsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, providedIn: 'root' });
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UtilsService, decorators: [{
298
+ type: Injectable,
299
+ args: [{ providedIn: 'root' }]
300
+ }], ctorParameters: function () { return [{ type: i1.HttpClient }, { type: i2.MatSnackBar }, { type: CoolmapConfigModel, decorators: [{
301
+ type: Inject,
302
+ args: ['memberData']
300
303
  }] }]; } });
301
304
 
302
- class CoolmapService {
303
- constructor(utils, eventManager, config) {
304
- this.utils = utils;
305
- this.eventManager = eventManager;
306
- this.config = config;
307
- this.markerOriginList = [];
308
- this.markerDestinationList = [];
309
- this.initiatecoolmap = new BehaviorSubject(true);
310
- this.reintiatecoolmap = this.initiatecoolmap.asObservable();
311
- this.bounds = new mapboxgl.LngLatBounds();
312
- this.originDestinationCordinates = [];
313
- this.eventManager.addGlobalEventListener('window', 'resize', this.onResize.bind(this));
314
- this.windowActualHeightWidth = { availHeight: 0 };
315
- }
316
- initiateMapForAddRoute(el) {
317
- return new Promise((resolve, reject) => {
318
- if (this.map)
319
- this.map.remove();
320
- this.map = new mapboxgl.Map({
321
- accessToken: this.config.mapboxAccessToken,
322
- container: el,
323
- style: this.config.mapboxStyle,
324
- center: [-77.036873, 38.907192],
325
- zoom: 10, bearing: 0, pitch: 65, interactive: true,
326
- });
327
- this.map.once('load', (res) => {
328
- resolve(res);
329
- });
330
- });
331
- }
332
- // Below method Load route with animation
333
- loadMapProperty(pinRouteGeojson, index, unit, route, bottom) {
334
- return new Promise((resolve, reject) => {
335
- let origin = pinRouteGeojson.features[0].geometry.coordinates[0];
336
- const linecolor = (unit === 'Ton') ? '#ff7272' : (unit === 'Load') ? '#a3c52e' : '#ae23d1';
337
- let destination = pinRouteGeojson.features[0].geometry.coordinates[pinRouteGeojson.features[0].geometry.coordinates.length - 1];
338
- this.extendBound(pinRouteGeojson.features[0].geometry.coordinates, true).then((res) => {
339
- const point = {
340
- 'type': 'FeatureCollection',
341
- 'features': [
342
- { 'type': 'Feature', 'properties': {}, 'geometry': { 'type': 'Point', 'coordinates': origin } }
343
- ]
344
- };
345
- const lineDistance = turf.length(pinRouteGeojson.features[0]);
346
- const arc = [];
347
- const steps = 10 * pinRouteGeojson.features[0].geometry.coordinates.length;
348
- for (let i = 0; i < lineDistance; i += lineDistance / steps) {
349
- const segment = turf.along(pinRouteGeojson.features[0], i);
350
- arc.push(segment.geometry.coordinates);
351
- }
352
- pinRouteGeojson.features[0].geometry.coordinates = arc;
353
- const pinRoute = pinRouteGeojson.features[0].geometry.coordinates;
354
- const marker = new mapboxgl.Marker(document.createElement('div'))
355
- .setLngLat(pinRoute[0]).addTo(this.map).togglePopup();
356
- if (this.map.getSource(`line${index}`)) {
357
- this.removeRouteAndMarker(index).then(() => { });
358
- }
359
- this.map.addSource(`line${index}`, { type: 'geojson', lineMetrics: true, data: pinRouteGeojson });
360
- this.map.addLayer({
361
- type: 'line',
362
- source: `line${index}`,
363
- id: `line${index}`,
364
- paint: {
365
- 'line-width': 2,
366
- 'line-gradient': [
367
- 'interpolate',
368
- ['linear'],
369
- ['line-progress'],
370
- 0, unit === 'Ton' ? '#d7f7e4' : unit === 'Load' ? '#c9d8f5' : '#f5dcc1',
371
- 1, unit === 'Ton' ? '#ff7272' : unit === 'Load' ? '#a3c52e' : '#ae23d1',
372
- ]
373
- },
374
- layout: { 'line-cap': 'round', 'line-join': 'round' }
375
- });
376
- const dataSetForMap = {
377
- counter: 0, pinRouteGeojson, steps,
378
- point, pointId: `point${index}`,
379
- marker, pinRoute, lineId: `line${index}`, index,
380
- origin, destination, lineDistance,
381
- linecolor, route, isViewRoute: true
382
- };
383
- this.createMarker(dataSetForMap);
384
- this.map.on('mouseenter', `line${index}`, (e) => {
385
- this.map.setPaintProperty(`line${index}`, 'line-width', 5);
386
- this.map.setPaintProperty(`line${index}`, 'line-opacity', 1);
387
- const datasetForPopup = {
388
- coordinate: [e.lngLat.lng, e.lngLat.lat],
389
- pickup: route.pickup_location ? route.pickup_location : '',
390
- drop: route.delivery_location ? route.delivery_location : '',
391
- routeType: route.project ? 'Project' : 'Route',
392
- title: route.project ? route.project : route.route_name ? route.route_name : '',
393
- material: route.material ? route.material : '',
394
- type: route.unit ? route.unit : ''
395
- };
396
- this.createPopup(datasetForPopup);
397
- });
398
- this.map.on('mouseleave', `line${index}`, (e) => {
399
- this.map.setPaintProperty(`line${index}`, 'line-width', 2);
400
- if (this.popup) {
401
- this.popup.remove();
402
- }
403
- });
404
- });
405
- this.map.once('idle', (res) => {
406
- resolve(true);
407
- });
408
- });
409
- }
410
- // Below method Load route without animation
411
- drawLine(cordinates, index, route, enablefitbound, routeType) {
412
- let linecolor;
413
- let origin = cordinates[0];
414
- let destination = cordinates[cordinates.length - 1];
415
- if (origin[0] && origin[1] && destination && destination[0] && destination[1]) {
416
- linecolor = this.provideLineColor(route['unit'], routeType);
417
- if (enablefitbound) {
418
- const padding = {
419
- top: this.padding.top, bottom: this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65)),
420
- left: this.padding.left, right: this.padding.right
421
- };
422
- this.map.fitBounds([origin, destination], { padding }, { fitboundCompleteJob: true });
423
- }
424
- if (this.map.getSource(`route-source-for-job-code${index}`)) {
425
- this.removeRouteAndMarker(index).then(() => { });
426
- }
427
- this.map.addSource(`route-source-for-job-code${index}`, {
428
- 'type': 'geojson',
429
- 'data': { 'type': 'Feature', 'properties': {}, 'geometry': { 'type': 'LineString', 'coordinates': cordinates } }
430
- });
431
- this.map.addLayer({
432
- 'id': `route-for-job-code${index}`, 'type': 'line', 'source': `route-source-for-job-code${index}`,
433
- paint: { 'line-color': linecolor, 'line-width': 2 },
434
- layout: { 'line-cap': 'round', 'line-join': 'round' }
435
- });
436
- const dataSetForMap = {
437
- origin, destination, index, linecolor, route
438
- };
439
- this.createMarker(dataSetForMap);
440
- this.map.on('mouseenter', `route-for-job-code${index}`, (e) => {
441
- if (this.popup) {
442
- this.popup.remove();
443
- }
444
- this.map.setPaintProperty(`route-for-job-code${index}`, 'line-width', 5);
445
- this.map.setPaintProperty(`route-for-job-code${index}`, 'line-opacity', 1);
446
- const datasetForPopup = {
447
- coordinate: [e.lngLat.lng, e.lngLat.lat],
448
- pickup: route.pickup_location ? route.pickup_location : '',
449
- drop: route.delivery_location ? route.delivery_location : '',
450
- jobCode: route.project ? route.order_number : null,
451
- customer: route.project ? route.customer_name : null,
452
- routeType: route.project ? 'Project' : 'Route',
453
- title: route.project ? route.project : route.route_name ? route.route_name : '',
454
- material: route.material ? route.material : '',
455
- type: route.unit ? route.unit : ''
456
- };
457
- this.createPopup(datasetForPopup);
458
- });
459
- this.map.on('mouseleave', `route-for-job-code${index}`, (e) => {
460
- this.map.setPaintProperty(`route-for-job-code${index}`, 'line-width', 2);
461
- if (this.popup) {
462
- this.popup.remove();
463
- }
464
- });
465
- }
466
- }
467
- provideLineColor(unitType, type) {
468
- let checkType = (type && !['jobrouteList', 'addroute'].includes(type)) ? true : false;
469
- let color;
470
- switch (unitType) {
471
- case "Ton":
472
- color = checkType ? '#39c471' : '#ff7272';
473
- break;
474
- case "Load":
475
- color = checkType ? '#326ad3' : '#a3c52e';
476
- break;
477
- case "Hourly":
478
- color = checkType ? '#ffad56' : '#ae23d1';
479
- break;
480
- }
481
- return color;
482
- }
483
- showRoutePopup(arcDetails, event, isViewRoute) {
484
- if (this.popup) {
485
- this.popup.remove();
486
- this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-width', 2);
487
- }
488
- if (arcDetails.color && this.map.getLayoutProperty(arcDetails.layer.id, 'visibility') !== 'none') {
489
- this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-width', 5);
490
- this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-opacity', 1);
491
- const datasetForPopup = {
492
- coordinate: arcDetails.coordinate,
493
- pickup: arcDetails.layer.props.data.route.pickup_location ? arcDetails.layer.props.data.route.pickup_location : '',
494
- drop: arcDetails.layer.props.data.route.delivery_location ? arcDetails.layer.props.data.route.delivery_location : '',
495
- jobCode: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.order_number : '',
496
- customer: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.customer_name : '',
497
- routeType: arcDetails.layer.props.data.route.project ? 'Project' : 'Route',
498
- title: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.project : arcDetails.layer.props.data.route.route_name ? arcDetails.layer.props.data.route.route_name : '',
499
- material: arcDetails.layer.props.data.route.material ? arcDetails.layer.props.data.route.material : '',
500
- type: arcDetails.layer.props.data.route.unit ? arcDetails.layer.props.data.route.unit : ''
501
- };
502
- this.createPopup(datasetForPopup);
503
- }
504
- }
505
- createPopup(datasetForPopup) {
506
- this.popup = new mapboxgl.Popup({
507
- closeButton: false,
508
- closeOnClick: false,
509
- closeOnMove: true,
510
- anchor: 'bottom-left'
511
- });
512
- this.popup.setLngLat(datasetForPopup.coordinate)
513
- .setHTML(`
514
- <div class="destination">
515
- <div class="duration">
516
- <p class="pickprt"><b>Pickup Location:</b> ${datasetForPopup.pickup}</p>
517
- <p class="dropprt"><b>Drop Location:</b> ${datasetForPopup.drop}</p>
518
- </div>
519
- ${datasetForPopup.jobCode ? '<span><b>Job Code:</b> ' + datasetForPopup.jobCode + '</span>' : ''}
520
- ${datasetForPopup.customer ? '<span><b>Customer:</b> ' + datasetForPopup.customer + '</span>' : ''}
521
- <span><b>${datasetForPopup.routeType} Name:</b> ${datasetForPopup.title}</span>
522
- <span><b>Material:</b> ${datasetForPopup.material}</span>
523
- <span><b>Type:</b> ${datasetForPopup.type}</span>
524
- </div>
525
- `)
526
- .addTo(this.map);
527
- }
528
- hexToRGB(hex) {
529
- return hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => '#' + r + r + g + g + b + b)
530
- .substring(1).match(/.{2}/g)
531
- .map(x => parseInt(x, 16));
532
- }
533
- createMarker(routeDetails) {
534
- if (routeDetails.origin[0] && routeDetails.origin[1] && routeDetails.destination[0] && routeDetails.destination[1]) {
535
- const popup = new mapboxgl.Popup({ closeButton: false }).setHTML('<b>Pickup: </b>' + routeDetails.route?.pickup_location);
536
- const popupForDestination = new mapboxgl.Popup({ closeButton: false })
537
- .setHTML('<b>Delivery: </b>' + routeDetails.route?.delivery_location);
538
- const el = document.createElement('div');
539
- el.className = 'marker';
540
- el.innerHTML = `<span class='markerPointer' style='background:${routeDetails.linecolor}'><b>P</b><span class='markerSpan' style='border-top: 10px solid ${routeDetails.linecolor}'></span></span>`;
541
- const originMarker = new mapboxgl.Marker(el)
542
- .setPopup(popup).setLngLat(routeDetails.origin).addTo(this.map);
543
- originMarker.getElement().addEventListener('mouseenter', () => originMarker.togglePopup());
544
- originMarker.getElement().addEventListener('mouseleave', () => originMarker.togglePopup());
545
- const elementForDestination = document.createElement('div');
546
- elementForDestination.className = 'marker';
547
- elementForDestination.innerHTML = `<span class='markerPointer' style='background:${routeDetails.linecolor}'><b>D</b><span class='markerSpan' style='border-top: 10px solid ${routeDetails.linecolor}'></span></span>`;
548
- const destinationMarker = new mapboxgl.Marker(elementForDestination).setPopup(popupForDestination).setLngLat(routeDetails.destination).addTo(this.map);
549
- destinationMarker.getElement().addEventListener('mouseenter', () => destinationMarker.togglePopup());
550
- destinationMarker.getElement().addEventListener('mouseleave', () => destinationMarker.togglePopup());
551
- this.markerOriginList[routeDetails.index] = originMarker;
552
- this.markerDestinationList[routeDetails.index] = destinationMarker;
553
- const colorArray = this.hexToRGB(routeDetails.linecolor);
554
- const arcLayer = new MapboxLayer({
555
- id: 'arc-layer' + routeDetails.index,
556
- type: ArcLayer,
557
- pickable: true,
558
- data: { route: routeDetails.route, index: routeDetails.index },
559
- getWidth: 1,
560
- getSourcePosition: routeDetails.origin,
561
- getTargetPosition: routeDetails.destination,
562
- getTargetColor: [255, 255, 255],
563
- getSourceColor: [colorArray[0], colorArray[1], colorArray[2]],
564
- onHover: (info, event) => this.showRoutePopup(info, event, routeDetails.isViewRoute),
565
- });
566
- this.map.addLayer(arcLayer);
567
- }
568
- }
569
- async removeRouteAndMarker(index) {
570
- if (this.map) {
571
- this.map.getLayer(`arc-layer${index}`) ? this.map.removeLayer(`arc-layer${index}`) : '';
572
- this.map.getLayer(`line${index}`) ? this.map.removeLayer(`line${index}`) : '';
573
- this.map.getLayer(`custom_layer${index}`) ? this.map.removeLayer(`custom_layer${index}`) : '';
574
- this.map.getSource(`line${index}`) ? this.map.removeSource(`line${index}`) : '';
575
- this.map.getLayer(`route-for-job-code${index}`) ? this.map.removeLayer(`route-for-job-code${index}`) : '';
576
- this.map.getSource(`route-source-for-job-code${index}`) ? this.map.removeSource(`route-source-for-job-code${index}`) : '';
577
- this.findMarkerBound(index);
578
- this.markerOriginList[index] ? this.markerOriginList[index].remove() : '';
579
- this.markerDestinationList[index] ? this.markerDestinationList[index].remove() : '';
580
- await true;
581
- }
582
- }
583
- findMarkerBound(index) {
584
- const indexOfCordinates = this.originDestinationCordinates.findIndex((x) => (x[0][0].toFixed(6) == this.markerOriginList[index]?.getLngLat()?.lng.toFixed(6)) && (x[0][1].toFixed(6) == this.markerOriginList[index]?.getLngLat()?.lat.toFixed(6)));
585
- if (indexOfCordinates >= 0) {
586
- this.originDestinationCordinates.splice(indexOfCordinates, 1);
587
- }
588
- }
589
- async filterRoute(ID, visibility, showAllFitbound) {
590
- if (ID) {
591
- if (this.map.getLayer(`route-for-job-code${ID}`)) {
592
- this.map.setLayoutProperty(`route-for-job-code${ID}`, 'visibility', visibility);
593
- const originM = this.markerOriginList[ID].getElement();
594
- originM.style.display = ((visibility === 'visible') ? 'block' : visibility);
595
- const destinationM = this.markerDestinationList[ID].getElement();
596
- destinationM.style.display = ((visibility === 'visible') ? 'block' : visibility);
597
- if (visibility === 'none' && showAllFitbound) {
598
- this.findMarkerBound(ID);
599
- this.extendReBound();
600
- }
601
- }
602
- if (this.map.getLayer(`arc-layer${ID}`)) {
603
- this.map.setLayoutProperty(`arc-layer${ID}`, 'visibility', visibility);
604
- }
605
- }
606
- await true;
607
- }
608
- extendBound(route, showAllFitbound) {
609
- return new Promise((resolve, reject) => {
610
- if (route) {
611
- if (typeof route === 'string') {
612
- let path = route.split(';');
613
- path = path.map((ele) => { return ele = this.formateLatLong(ele); });
614
- path.forEach((ele, index) => { if (ele.length === 1)
615
- path.splice(index, 1); });
616
- route = path;
617
- }
618
- if (route[0][0] && route[0][1] && route[route.length - 1][0] && route[route.length - 1][1]) {
619
- this.originDestinationCordinates.push(route);
620
- route.map((item) => {
621
- this.bounds.extend(item);
622
- });
623
- }
624
- }
625
- if (showAllFitbound) {
626
- const padding = { top: this.padding.top, bottom: (this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65))), left: this.padding.left, right: this.padding.right };
627
- setTimeout(() => {
628
- if (showAllFitbound && (Object.keys(this.bounds).length > 0))
629
- this.map.fitBounds(this.bounds, { padding }, { fitboundComplete: true });
630
- }, 100);
631
- this.map.once('moveend', (event) => { if (event.fitboundComplete) {
632
- resolve(true);
633
- } });
634
- }
635
- });
636
- }
637
- extendReBound(bottom) {
638
- return new Promise((resolve, reject) => {
639
- this.bounds = new mapboxgl.LngLatBounds();
640
- if (this.originDestinationCordinates.length >= 0) {
641
- this.originDestinationCordinates.map((item, index) => {
642
- item.map((route) => {
643
- this.bounds.extend(route);
644
- });
645
- if (index === (this.originDestinationCordinates.length - 1)) {
646
- const padding = { top: this.padding.top, bottom: (this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65))), left: this.padding.left, right: this.padding.right };
647
- setTimeout(() => {
648
- if (this.originDestinationCordinates.length > 0)
649
- this.map.fitBounds(this.bounds, { padding });
650
- }, 500);
651
- resolve(true);
652
- }
653
- });
654
- }
655
- else {
656
- resolve(true);
657
- }
658
- });
659
- }
660
- plotRoute(route, i, type, enablefitbound, showAllFitbound) {
661
- return new Promise((resolve, reject) => {
662
- let param = {};
663
- if (['jobcode'].includes(type)) {
664
- param['job'] = route['job_id'];
665
- this.utils.postDataWithRestUrl('schedule/job/path', param).subscribe((res) => {
666
- if (res['data']['route']) {
667
- let path = res['data']['route'].split(';');
668
- path = path.map((ele) => { return ele = this.formateLatLong(ele); });
669
- path.forEach((ele, index) => { if (ele.length === 1)
670
- path.splice(index, 1); });
671
- route['path'] = path;
672
- this.extendBound(route['path'], showAllFitbound);
673
- if (route['path'] && route['path'].length > 0)
674
- this.drawLine(route['path'], i, route, enablefitbound, type);
675
- route['index'] = i;
676
- }
677
- else {
678
- this.extendBound(null, showAllFitbound);
679
- }
680
- resolve(true);
681
- }, (err) => { if (err) {
682
- reject(false);
683
- } });
684
- }
685
- else if (['jobrouteList', 'addroute'].includes(type)) {
686
- if (route['path'] && route['path'].length > 0) {
687
- let path = route['path'].split(';');
688
- path = path.map((ele) => { return ele = this.formateLatLong(ele); });
689
- path.forEach((ele, index) => { if (ele.length === 1)
690
- path.splice(index, 1); });
691
- this.extendBound(path, showAllFitbound);
692
- this.drawLine(path, i, route, enablefitbound, type);
693
- }
694
- ;
695
- }
696
- });
697
- }
698
- clearBound() { this.bounds = new mapboxgl.LngLatBounds(); this.originDestinationCordinates = []; this.clearPadding(); }
699
- formateLatLong(latlong) { return latlong ? latlong.split(',').map(x => +x).reverse() : null; }
700
- clearBoundWithCordinates() {
701
- this.bounds = new mapboxgl.LngLatBounds();
702
- this.originDestinationCordinates = [];
703
- }
704
- onResize(event) {
705
- if (!this.bounds.isEmpty()) {
706
- this.windowActualHeightWidth.availHeight = (window.innerHeight > window.screen.availHeight) ? window.innerHeight : window.screen.availHeight;
707
- setTimeout(() => {
708
- this.map.fitBounds(this.bounds, { padding: { top: this.padding.top, bottom: this.padding.bottom + (this.windowActualHeightWidth.availHeight - (event.target.innerHeight - 65)), left: this.padding.left, right: this.padding.right } });
709
- }, 500);
710
- }
711
- }
712
- setWindowHeight(screen) {
713
- this.windowActualHeightWidth.availHeight = screen;
714
- }
715
- setPadding(padding) { this.padding = padding; }
716
- clearPadding() { this.padding = null; }
717
- removeJobFromMap(data) {
718
- data.map((ele, index) => {
719
- const id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
720
- this.removeRouteAndMarker(id);
721
- if (index === (data.length - 1)) {
722
- this.extendReBound();
723
- }
724
- });
725
- }
726
- }
727
- CoolmapService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, deps: [{ token: UtilsService }, { token: i2$1.EventManager }, { token: 'memberData' }], target: i0.ɵɵFactoryTarget.Injectable });
728
- CoolmapService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, providedIn: 'root' });
729
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, decorators: [{
730
- type: Injectable,
731
- args: [{ providedIn: 'root' }]
732
- }], ctorParameters: function () { return [{ type: UtilsService }, { type: i2$1.EventManager }, { type: CoolmapConfigModel, decorators: [{
733
- type: Inject,
734
- args: ['memberData']
305
+ class CoolmapService {
306
+ constructor(utils, eventManager, config) {
307
+ this.utils = utils;
308
+ this.eventManager = eventManager;
309
+ this.config = config;
310
+ this.markerOriginList = [];
311
+ this.markerDestinationList = [];
312
+ this.initiatecoolmap = new BehaviorSubject(true);
313
+ this.reintiatecoolmap = this.initiatecoolmap.asObservable();
314
+ this.bounds = new mapboxgl.LngLatBounds();
315
+ this.originDestinationCordinates = [];
316
+ this.customTopForCustomer = this.config.repository === 'customer' ? 65 : 0;
317
+ this.eventManager.addGlobalEventListener('window', 'resize', this.onResize.bind(this));
318
+ this.windowActualHeightWidth = { availHeight: 0 };
319
+ }
320
+ initiateMapForAddRoute(el) {
321
+ return new Promise((resolve, reject) => {
322
+ if (this.map)
323
+ this.map.remove();
324
+ this.map = new mapboxgl.Map({
325
+ accessToken: this.config.mapboxAccessToken,
326
+ container: el,
327
+ style: this.config.mapboxStyle,
328
+ center: [-77.036873, 38.907192],
329
+ zoom: 10, bearing: 0, pitch: 65, interactive: true,
330
+ });
331
+ this.map.once('load', (res) => {
332
+ resolve(res);
333
+ });
334
+ });
335
+ }
336
+ // Below method Load route with animation
337
+ loadMapProperty(pinRouteGeojson, index, unit, route, bottom) {
338
+ return new Promise((resolve, reject) => {
339
+ let origin = pinRouteGeojson.features[0].geometry.coordinates[0];
340
+ const linecolor = (unit === 'Ton') ? '#ff7272' : (unit === 'Load') ? '#a3c52e' : '#ae23d1';
341
+ let destination = pinRouteGeojson.features[0].geometry.coordinates[pinRouteGeojson.features[0].geometry.coordinates.length - 1];
342
+ this.extendBound(pinRouteGeojson.features[0].geometry.coordinates, true).then((res) => {
343
+ const point = {
344
+ 'type': 'FeatureCollection',
345
+ 'features': [
346
+ { 'type': 'Feature', 'properties': {}, 'geometry': { 'type': 'Point', 'coordinates': origin } }
347
+ ]
348
+ };
349
+ const lineDistance = turf.length(pinRouteGeojson.features[0]);
350
+ const arc = [];
351
+ const steps = 10 * pinRouteGeojson.features[0].geometry.coordinates.length;
352
+ for (let i = 0; i < lineDistance; i += lineDistance / steps) {
353
+ const segment = turf.along(pinRouteGeojson.features[0], i);
354
+ arc.push(segment.geometry.coordinates);
355
+ }
356
+ pinRouteGeojson.features[0].geometry.coordinates = arc;
357
+ const pinRoute = pinRouteGeojson.features[0].geometry.coordinates;
358
+ const marker = new mapboxgl.Marker(document.createElement('div'))
359
+ .setLngLat(pinRoute[0]).addTo(this.map).togglePopup();
360
+ if (this.map.getSource(`line${index}`)) {
361
+ this.removeRouteAndMarker(index).then(() => { });
362
+ }
363
+ this.map.addSource(`line${index}`, { type: 'geojson', lineMetrics: true, data: pinRouteGeojson });
364
+ this.map.addLayer({
365
+ type: 'line',
366
+ source: `line${index}`,
367
+ id: `line${index}`,
368
+ paint: {
369
+ 'line-width': 2,
370
+ 'line-gradient': [
371
+ 'interpolate',
372
+ ['linear'],
373
+ ['line-progress'],
374
+ 0, unit === 'Ton' ? '#d7f7e4' : unit === 'Load' ? '#c9d8f5' : '#f5dcc1',
375
+ 1, unit === 'Ton' ? '#ff7272' : unit === 'Load' ? '#a3c52e' : '#ae23d1',
376
+ ]
377
+ },
378
+ layout: { 'line-cap': 'round', 'line-join': 'round' }
379
+ });
380
+ const dataSetForMap = {
381
+ counter: 0, pinRouteGeojson, steps,
382
+ point, pointId: `point${index}`,
383
+ marker, pinRoute, lineId: `line${index}`, index,
384
+ origin, destination, lineDistance,
385
+ linecolor, route, isViewRoute: true
386
+ };
387
+ this.createMarker(dataSetForMap);
388
+ this.map.on('mouseenter', `line${index}`, (e) => {
389
+ this.map.setPaintProperty(`line${index}`, 'line-width', 5);
390
+ this.map.setPaintProperty(`line${index}`, 'line-opacity', 1);
391
+ const datasetForPopup = {
392
+ coordinate: [e.lngLat.lng, e.lngLat.lat],
393
+ pickup: route.pickup_location ? route.pickup_location : '',
394
+ drop: route.delivery_location ? route.delivery_location : '',
395
+ routeType: route.project ? 'Project' : 'Route',
396
+ title: route.project ? route.project : route.route_name ? route.route_name : '',
397
+ material: route.material ? route.material : '',
398
+ type: route.unit ? route.unit : ''
399
+ };
400
+ this.createPopup(datasetForPopup);
401
+ });
402
+ this.map.on('mouseleave', `line${index}`, (e) => {
403
+ this.map.setPaintProperty(`line${index}`, 'line-width', 2);
404
+ if (this.popup) {
405
+ this.popup.remove();
406
+ }
407
+ });
408
+ });
409
+ this.map.once('idle', (res) => {
410
+ resolve(true);
411
+ });
412
+ });
413
+ }
414
+ // Below method Load route without animation
415
+ drawLine(cordinates, index, route, enablefitbound, routeType) {
416
+ let linecolor;
417
+ let origin = cordinates[0];
418
+ let destination = cordinates[cordinates.length - 1];
419
+ if (origin[0] && origin[1] && destination && destination[0] && destination[1]) {
420
+ linecolor = this.provideLineColor(route['unit'], routeType);
421
+ if (enablefitbound) {
422
+ const padding = {
423
+ top: this.padding.top + this.customTopForCustomer, bottom: this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65)),
424
+ left: this.padding.left, right: this.padding.right
425
+ };
426
+ this.map.fitBounds([origin, destination], { padding, pitch: 65 }, { fitboundCompleteJob: true });
427
+ }
428
+ if (this.map.getSource(`route-source-for-job-code${index}`)) {
429
+ this.removeRouteAndMarker(index).then(() => { });
430
+ }
431
+ this.map.addSource(`route-source-for-job-code${index}`, {
432
+ 'type': 'geojson',
433
+ 'data': { 'type': 'Feature', 'properties': {}, 'geometry': { 'type': 'LineString', 'coordinates': cordinates } }
434
+ });
435
+ this.map.addLayer({
436
+ 'id': `route-for-job-code${index}`, 'type': 'line', 'source': `route-source-for-job-code${index}`,
437
+ paint: { 'line-color': linecolor, 'line-width': 2 },
438
+ layout: { 'line-cap': 'round', 'line-join': 'round' }
439
+ });
440
+ const dataSetForMap = {
441
+ origin, destination, index, linecolor, route
442
+ };
443
+ this.createMarker(dataSetForMap);
444
+ this.map.on('mouseenter', `route-for-job-code${index}`, (e) => {
445
+ if (this.popup) {
446
+ this.popup.remove();
447
+ }
448
+ this.map.setPaintProperty(`route-for-job-code${index}`, 'line-width', 5);
449
+ this.map.setPaintProperty(`route-for-job-code${index}`, 'line-opacity', 1);
450
+ const datasetForPopup = {
451
+ coordinate: [e.lngLat.lng, e.lngLat.lat],
452
+ pickup: route.pickup_location ? route.pickup_location : '',
453
+ drop: route.delivery_location ? route.delivery_location : '',
454
+ jobCode: route.project ? route.order_number : null,
455
+ customer: route.project ? route.customer_name : null,
456
+ routeType: route.project ? 'Project' : 'Route',
457
+ title: route.project ? route.project : route.route_name ? route.route_name : '',
458
+ material: route.material ? route.material : '',
459
+ type: route.unit ? route.unit : ''
460
+ };
461
+ this.createPopup(datasetForPopup);
462
+ });
463
+ this.map.on('mouseleave', `route-for-job-code${index}`, (e) => {
464
+ this.map.setPaintProperty(`route-for-job-code${index}`, 'line-width', 2);
465
+ if (this.popup) {
466
+ this.popup.remove();
467
+ }
468
+ });
469
+ }
470
+ }
471
+ provideLineColor(unitType, type) {
472
+ let checkType = (type && !['jobrouteList', 'addroute'].includes(type)) ? true : false;
473
+ let color;
474
+ switch (unitType) {
475
+ case "Ton":
476
+ color = checkType ? '#39c471' : '#ff7272';
477
+ break;
478
+ case "Load":
479
+ color = checkType ? '#326ad3' : '#a3c52e';
480
+ break;
481
+ case "Hourly":
482
+ color = checkType ? '#ffad56' : '#ae23d1';
483
+ break;
484
+ }
485
+ return color;
486
+ }
487
+ showRoutePopup(arcDetails, event, isViewRoute) {
488
+ if (this.popup) {
489
+ this.popup.remove();
490
+ this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-width', 2);
491
+ }
492
+ if (arcDetails.color && this.map.getLayoutProperty(arcDetails.layer.id, 'visibility') !== 'none') {
493
+ this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-width', 5);
494
+ this.map.setPaintProperty(`${isViewRoute ? 'line' : 'route-for-job-code'}${arcDetails.layer.props.data.index}`, 'line-opacity', 1);
495
+ const datasetForPopup = {
496
+ coordinate: arcDetails.coordinate,
497
+ pickup: arcDetails.layer.props.data.route.pickup_location ? arcDetails.layer.props.data.route.pickup_location : '',
498
+ drop: arcDetails.layer.props.data.route.delivery_location ? arcDetails.layer.props.data.route.delivery_location : '',
499
+ jobCode: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.order_number : '',
500
+ customer: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.customer_name : '',
501
+ routeType: arcDetails.layer.props.data.route.project ? 'Project' : 'Route',
502
+ title: arcDetails.layer.props.data.route.project ? arcDetails.layer.props.data.route.project : arcDetails.layer.props.data.route.route_name ? arcDetails.layer.props.data.route.route_name : '',
503
+ material: arcDetails.layer.props.data.route.material ? arcDetails.layer.props.data.route.material : '',
504
+ type: arcDetails.layer.props.data.route.unit ? arcDetails.layer.props.data.route.unit : ''
505
+ };
506
+ this.createPopup(datasetForPopup);
507
+ }
508
+ }
509
+ createPopup(datasetForPopup) {
510
+ this.popup = new mapboxgl.Popup({
511
+ closeButton: false,
512
+ closeOnClick: false,
513
+ closeOnMove: true,
514
+ anchor: 'bottom-left'
515
+ });
516
+ this.popup.setLngLat(datasetForPopup.coordinate)
517
+ .setHTML(`
518
+ <div class="destination">
519
+ <div class="duration">
520
+ <p class="pickprt"><b>Pickup Location:</b> ${datasetForPopup.pickup}</p>
521
+ <p class="dropprt"><b>Drop Location:</b> ${datasetForPopup.drop}</p>
522
+ </div>
523
+ ${datasetForPopup.jobCode ? '<span><b>Job Code:</b> ' + datasetForPopup.jobCode + '</span>' : ''}
524
+ ${datasetForPopup.customer ? '<span><b>Customer:</b> ' + datasetForPopup.customer + '</span>' : ''}
525
+ <span><b>${datasetForPopup.routeType} Name:</b> ${datasetForPopup.title}</span>
526
+ <span><b>Material:</b> ${datasetForPopup.material}</span>
527
+ <span><b>Type:</b> ${datasetForPopup.type}</span>
528
+ </div>
529
+ `)
530
+ .addTo(this.map);
531
+ }
532
+ hexToRGB(hex) {
533
+ return hex.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, (m, r, g, b) => '#' + r + r + g + g + b + b)
534
+ .substring(1).match(/.{2}/g)
535
+ .map(x => parseInt(x, 16));
536
+ }
537
+ createMarker(routeDetails) {
538
+ if (routeDetails.origin[0] && routeDetails.origin[1] && routeDetails.destination[0] && routeDetails.destination[1]) {
539
+ const popup = new mapboxgl.Popup({ closeButton: false }).setHTML('<b>Pickup: </b>' + routeDetails.route?.pickup_location);
540
+ const popupForDestination = new mapboxgl.Popup({ closeButton: false })
541
+ .setHTML('<b>Delivery: </b>' + routeDetails.route?.delivery_location);
542
+ const el = document.createElement('div');
543
+ el.className = 'marker';
544
+ el.innerHTML = `<span class='markerPointer' style='background:${routeDetails.linecolor}'><b>P</b><span class='markerSpan' style='border-top: 10px solid ${routeDetails.linecolor}'></span></span>`;
545
+ const originMarker = new mapboxgl.Marker(el)
546
+ .setPopup(popup).setLngLat(routeDetails.origin).addTo(this.map);
547
+ originMarker.getElement().addEventListener('mouseenter', () => originMarker.togglePopup());
548
+ originMarker.getElement().addEventListener('mouseleave', () => originMarker.togglePopup());
549
+ const elementForDestination = document.createElement('div');
550
+ elementForDestination.className = 'marker';
551
+ elementForDestination.innerHTML = `<span class='markerPointer' style='background:${routeDetails.linecolor}'><b>D</b><span class='markerSpan' style='border-top: 10px solid ${routeDetails.linecolor}'></span></span>`;
552
+ const destinationMarker = new mapboxgl.Marker(elementForDestination).setPopup(popupForDestination).setLngLat(routeDetails.destination).addTo(this.map);
553
+ destinationMarker.getElement().addEventListener('mouseenter', () => destinationMarker.togglePopup());
554
+ destinationMarker.getElement().addEventListener('mouseleave', () => destinationMarker.togglePopup());
555
+ this.markerOriginList[routeDetails.index] = originMarker;
556
+ this.markerDestinationList[routeDetails.index] = destinationMarker;
557
+ const colorArray = this.hexToRGB(routeDetails.linecolor);
558
+ const arcLayer = new MapboxLayer({
559
+ id: 'arc-layer' + routeDetails.index,
560
+ type: ArcLayer,
561
+ pickable: true,
562
+ data: { route: routeDetails.route, index: routeDetails.index },
563
+ getWidth: 1,
564
+ getSourcePosition: routeDetails.origin,
565
+ getTargetPosition: routeDetails.destination,
566
+ getTargetColor: [255, 255, 255],
567
+ getSourceColor: [colorArray[0], colorArray[1], colorArray[2]],
568
+ onHover: (info, event) => this.showRoutePopup(info, event, routeDetails.isViewRoute),
569
+ });
570
+ this.map.addLayer(arcLayer);
571
+ }
572
+ }
573
+ async removeRouteAndMarker(index) {
574
+ if (this.map) {
575
+ this.map.getLayer(`arc-layer${index}`) ? this.map.removeLayer(`arc-layer${index}`) : '';
576
+ this.map.getLayer(`line${index}`) ? this.map.removeLayer(`line${index}`) : '';
577
+ this.map.getLayer(`custom_layer${index}`) ? this.map.removeLayer(`custom_layer${index}`) : '';
578
+ this.map.getSource(`line${index}`) ? this.map.removeSource(`line${index}`) : '';
579
+ this.map.getLayer(`route-for-job-code${index}`) ? this.map.removeLayer(`route-for-job-code${index}`) : '';
580
+ this.map.getSource(`route-source-for-job-code${index}`) ? this.map.removeSource(`route-source-for-job-code${index}`) : '';
581
+ this.findMarkerBound(index);
582
+ this.markerOriginList[index] ? this.markerOriginList[index].remove() : '';
583
+ this.markerDestinationList[index] ? this.markerDestinationList[index].remove() : '';
584
+ await true;
585
+ }
586
+ }
587
+ findMarkerBound(index) {
588
+ const indexOfCordinates = this.originDestinationCordinates.findIndex((x) => (x[0][0].toFixed(6) == this.markerOriginList[index]?.getLngLat()?.lng.toFixed(6)) && (x[0][1].toFixed(6) == this.markerOriginList[index]?.getLngLat()?.lat.toFixed(6)));
589
+ if (indexOfCordinates >= 0) {
590
+ this.originDestinationCordinates.splice(indexOfCordinates, 1);
591
+ }
592
+ }
593
+ async filterRoute(ID, visibility, showAllFitbound) {
594
+ if (ID) {
595
+ if (this.map.getLayer(`route-for-job-code${ID}`)) {
596
+ this.map.setLayoutProperty(`route-for-job-code${ID}`, 'visibility', visibility);
597
+ const originM = this.markerOriginList[ID].getElement();
598
+ originM.style.display = ((visibility === 'visible') ? 'block' : visibility);
599
+ const destinationM = this.markerDestinationList[ID].getElement();
600
+ destinationM.style.display = ((visibility === 'visible') ? 'block' : visibility);
601
+ if (visibility === 'none' && showAllFitbound) {
602
+ this.findMarkerBound(ID);
603
+ this.extendReBound();
604
+ }
605
+ }
606
+ if (this.map.getLayer(`arc-layer${ID}`)) {
607
+ this.map.setLayoutProperty(`arc-layer${ID}`, 'visibility', visibility);
608
+ }
609
+ }
610
+ await true;
611
+ }
612
+ extendBound(route, showAllFitbound) {
613
+ return new Promise((resolve, reject) => {
614
+ if (route) {
615
+ if (typeof route === 'string') {
616
+ let path = route.split(';');
617
+ path = path.map((ele) => { return ele = this.formateLatLong(ele); });
618
+ path.forEach((ele, index) => { if (ele.length === 1)
619
+ path.splice(index, 1); });
620
+ route = path;
621
+ }
622
+ if (route[0][0] && route[0][1] && route[route.length - 1][0] && route[route.length - 1][1]) {
623
+ this.originDestinationCordinates.push(route);
624
+ route.map((item) => {
625
+ this.bounds.extend(item);
626
+ });
627
+ }
628
+ }
629
+ if (showAllFitbound) {
630
+ const padding = { top: this.padding.top + this.customTopForCustomer, bottom: (this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65))), left: this.padding.left, right: this.padding.right };
631
+ setTimeout(() => {
632
+ if (showAllFitbound && (Object.keys(this.bounds).length > 0))
633
+ this.map.fitBounds(this.bounds, { padding, pitch: 65 }, { fitboundComplete: true });
634
+ }, 100);
635
+ this.map.once('moveend', (event) => { if (event.fitboundComplete) {
636
+ resolve(true);
637
+ } });
638
+ }
639
+ });
640
+ }
641
+ extendReBound(bottom) {
642
+ return new Promise((resolve, reject) => {
643
+ this.bounds = new mapboxgl.LngLatBounds();
644
+ if (this.originDestinationCordinates.length >= 0) {
645
+ this.originDestinationCordinates.map((item, index) => {
646
+ item.map((route) => {
647
+ this.bounds.extend(route);
648
+ });
649
+ if (index === (this.originDestinationCordinates.length - 1)) {
650
+ const padding = { top: this.padding.top + this.customTopForCustomer, bottom: (this.padding.bottom + (this.windowActualHeightWidth.availHeight - (window.innerHeight - 65))), left: this.padding.left, right: this.padding.right };
651
+ setTimeout(() => {
652
+ if (this.originDestinationCordinates.length > 0)
653
+ this.map.fitBounds(this.bounds, { padding, pitch: 65 });
654
+ }, 500);
655
+ resolve(true);
656
+ }
657
+ });
658
+ }
659
+ else {
660
+ resolve(true);
661
+ }
662
+ });
663
+ }
664
+ plotRoute(route, i, type, enablefitbound, showAllFitbound) {
665
+ return new Promise((resolve, reject) => {
666
+ let param = {};
667
+ if (['jobcode'].includes(type)) {
668
+ param['job'] = route['job_id'];
669
+ this.utils.postDataWithRestUrl('schedule/job/path', param).subscribe((res) => {
670
+ if (res['data']['route']) {
671
+ let path = res['data']['route'].split(';');
672
+ path = path.map((ele) => { return ele = this.formateLatLong(ele); });
673
+ path.forEach((ele, index) => { if (ele.length === 1)
674
+ path.splice(index, 1); });
675
+ route['path'] = path;
676
+ this.extendBound(route['path'], showAllFitbound);
677
+ if (route['path'] && route['path'].length > 0)
678
+ this.drawLine(route['path'], i, route, enablefitbound, type);
679
+ route['index'] = i;
680
+ }
681
+ else {
682
+ this.extendBound(null, showAllFitbound);
683
+ }
684
+ resolve(true);
685
+ }, (err) => { if (err) {
686
+ reject(false);
687
+ } });
688
+ }
689
+ else if (['jobrouteList', 'addroute'].includes(type)) {
690
+ if (route['path'] && route['path'].length > 0) {
691
+ let path = route['path'].split(';');
692
+ path = path.map((ele) => { return ele = this.formateLatLong(ele); });
693
+ path.forEach((ele, index) => { if (ele.length === 1)
694
+ path.splice(index, 1); });
695
+ this.extendBound(path, showAllFitbound);
696
+ this.drawLine(path, i, route, enablefitbound, type);
697
+ }
698
+ ;
699
+ }
700
+ });
701
+ }
702
+ clearBound() { this.bounds = new mapboxgl.LngLatBounds(); this.originDestinationCordinates = []; this.clearPadding(); }
703
+ formateLatLong(latlong) { return latlong ? latlong.split(',').map(x => +x).reverse() : null; }
704
+ clearBoundWithCordinates() {
705
+ this.bounds = new mapboxgl.LngLatBounds();
706
+ this.originDestinationCordinates = [];
707
+ }
708
+ onResize(event) {
709
+ if (!this.bounds.isEmpty()) {
710
+ this.windowActualHeightWidth.availHeight = (window.innerHeight > window.screen.availHeight) ? window.innerHeight : window.screen.availHeight;
711
+ setTimeout(() => {
712
+ this.map.fitBounds(this.bounds, { padding: { top: this.padding.top + this.customTopForCustomer, bottom: this.padding.bottom + (this.windowActualHeightWidth.availHeight - (event.target.innerHeight - 65)), left: this.padding.left, right: this.padding.right }, pitch: 65 });
713
+ }, 500);
714
+ }
715
+ }
716
+ setWindowHeight(screen) {
717
+ this.windowActualHeightWidth.availHeight = screen;
718
+ }
719
+ setPadding(padding) { this.padding = padding; }
720
+ clearPadding() { this.padding = null; }
721
+ removeJobFromMap(data) {
722
+ data.map((ele, index) => {
723
+ const id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
724
+ this.removeRouteAndMarker(id);
725
+ if (index === (data.length - 1)) {
726
+ this.extendReBound();
727
+ }
728
+ });
729
+ }
730
+ }
731
+ CoolmapService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, deps: [{ token: UtilsService }, { token: i2$1.EventManager }, { token: 'memberData' }], target: i0.ɵɵFactoryTarget.Injectable });
732
+ CoolmapService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, providedIn: 'root' });
733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: CoolmapService, decorators: [{
734
+ type: Injectable,
735
+ args: [{ providedIn: 'root' }]
736
+ }], ctorParameters: function () { return [{ type: UtilsService }, { type: i2$1.EventManager }, { type: CoolmapConfigModel, decorators: [{
737
+ type: Inject,
738
+ args: ['memberData']
735
739
  }] }]; } });
736
740
 
737
- /*
738
- * Public API Surface of coolmap-services
741
+ /*
742
+ * Public API Surface of coolmap-services
739
743
  */
740
744
 
741
- /**
742
- * Generated bundle index. Do not edit.
745
+ /**
746
+ * Generated bundle index. Do not edit.
743
747
  */
744
748
 
745
749
  export { CoolmapConfigModel, CoolmapService, DriverSmsCardEnum, DriversmsCardKey, EstinationData, EstinationEnum, JobCodeOverviewData, JobCodeOverviewEnum, PopupData, Route, UtilsService };