@aggdirect/coolmap 2.0.7 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/bundles/coolmap.umd.js +1383 -0
  2. package/bundles/coolmap.umd.js.map +1 -0
  3. package/bundles/coolmap.umd.min.js +2 -0
  4. package/bundles/coolmap.umd.min.js.map +1 -0
  5. package/coolmap.d.ts +5 -0
  6. package/coolmap.metadata.json +1 -0
  7. package/esm2015/coolmap.js +6 -0
  8. package/esm2015/coolmap.ngsummary.json +1 -0
  9. package/esm2015/lib/component/add-route/add-route.component.js +309 -0
  10. package/esm2015/lib/component/add-route/add-route.component.ngfactory.js +304 -0
  11. package/esm2015/lib/component/add-route/add-route.component.ngsummary.json +1 -0
  12. package/esm2015/lib/component/job-code/job-code.component.js +116 -0
  13. package/esm2015/lib/component/job-code/job-code.component.ngfactory.js +77 -0
  14. package/esm2015/lib/component/job-code/job-code.component.ngsummary.json +1 -0
  15. package/esm2015/lib/component/map/map.component.js +39 -0
  16. package/esm2015/lib/component/map/map.component.ngfactory.js +23 -0
  17. package/esm2015/lib/component/map/map.component.ngsummary.json +1 -0
  18. package/esm2015/lib/component/nav/layout/add-route-nav/add-route-nav.component.js +79 -0
  19. package/esm2015/lib/component/nav/layout/add-route-nav/add-route-nav.component.ngfactory.js +142 -0
  20. package/esm2015/lib/component/nav/layout/add-route-nav/add-route-nav.component.ngsummary.json +1 -0
  21. package/esm2015/lib/component/nav/layout/job-code-nav/job-code-nav.component.js +82 -0
  22. package/esm2015/lib/component/nav/layout/job-code-nav/job-code-nav.component.ngfactory.js +194 -0
  23. package/esm2015/lib/component/nav/layout/job-code-nav/job-code-nav.component.ngsummary.json +1 -0
  24. package/esm2015/lib/component/nav/nav.component.js +54 -0
  25. package/esm2015/lib/component/nav/nav.component.ngfactory.js +43 -0
  26. package/esm2015/lib/component/nav/nav.component.ngsummary.json +1 -0
  27. package/esm2015/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.js +66 -0
  28. package/esm2015/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ngfactory.js +46 -0
  29. package/esm2015/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ngsummary.json +1 -0
  30. package/esm2015/lib/component/route-jobcode-list/route-jobcode-list.component.js +301 -0
  31. package/esm2015/lib/component/route-jobcode-list/route-jobcode-list.component.ngfactory.js +99 -0
  32. package/esm2015/lib/component/route-jobcode-list/route-jobcode-list.component.ngsummary.json +1 -0
  33. package/esm2015/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.js +20 -0
  34. package/esm2015/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ngfactory.js +21 -0
  35. package/esm2015/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ngsummary.json +1 -0
  36. package/esm2015/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.js +30 -0
  37. package/esm2015/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ngfactory.js +30 -0
  38. package/esm2015/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ngsummary.json +1 -0
  39. package/esm2015/lib/component/shared/dialog/dialog.component.js +29 -0
  40. package/esm2015/lib/component/shared/dialog/dialog.component.ngfactory.js +24 -0
  41. package/esm2015/lib/component/shared/dialog/dialog.component.ngsummary.json +1 -0
  42. package/esm2015/lib/component/shared/estimation-display/estimation-display.component.js +20 -0
  43. package/esm2015/lib/component/shared/estimation-display/estimation-display.component.ngfactory.js +23 -0
  44. package/esm2015/lib/component/shared/estimation-display/estimation-display.component.ngsummary.json +1 -0
  45. package/esm2015/lib/component/shared/job-route-list/job-route-list.component.js +63 -0
  46. package/esm2015/lib/component/shared/job-route-list/job-route-list.component.ngfactory.js +134 -0
  47. package/esm2015/lib/component/shared/job-route-list/job-route-list.component.ngsummary.json +1 -0
  48. package/esm2015/lib/component/shared/jobcode-overview/jobcode-overview.component.js +20 -0
  49. package/esm2015/lib/component/shared/jobcode-overview/jobcode-overview.component.ngfactory.js +19 -0
  50. package/esm2015/lib/component/shared/jobcode-overview/jobcode-overview.component.ngsummary.json +1 -0
  51. package/esm2015/lib/component/shared/jobcode-status/jobcode-status.component.js +16 -0
  52. package/esm2015/lib/component/shared/jobcode-status/jobcode-status.component.ngfactory.js +17 -0
  53. package/esm2015/lib/component/shared/jobcode-status/jobcode-status.component.ngsummary.json +1 -0
  54. package/esm2015/lib/coolmap.component.js +18 -0
  55. package/esm2015/lib/coolmap.component.ngfactory.js +16 -0
  56. package/esm2015/lib/coolmap.component.ngsummary.json +1 -0
  57. package/esm2015/lib/coolmap.module.js +108 -0
  58. package/esm2015/lib/coolmap.module.ngfactory.js +46 -0
  59. package/esm2015/lib/coolmap.module.ngsummary.json +1 -0
  60. package/esm2015/public-api.ngsummary.json +1 -0
  61. package/fesm2015/coolmap.js +1317 -0
  62. package/fesm2015/coolmap.js.map +1 -0
  63. package/lib/component/add-route/add-route.component.d.ts +0 -3
  64. package/lib/component/add-route/add-route.component.ngfactory.d.ts +1 -0
  65. package/lib/component/job-code/job-code.component.d.ts +0 -3
  66. package/lib/component/job-code/job-code.component.ngfactory.d.ts +1 -0
  67. package/lib/component/map/map.component.d.ts +0 -3
  68. package/lib/component/map/map.component.ngfactory.d.ts +1 -0
  69. package/lib/component/nav/layout/add-route-nav/add-route-nav.component.d.ts +3 -8
  70. package/lib/component/nav/layout/add-route-nav/add-route-nav.component.ngfactory.d.ts +1 -0
  71. package/lib/component/nav/layout/job-code-nav/job-code-nav.component.d.ts +4 -9
  72. package/lib/component/nav/layout/job-code-nav/job-code-nav.component.ngfactory.d.ts +1 -0
  73. package/lib/component/nav/nav.component.d.ts +0 -3
  74. package/lib/component/nav/nav.component.ngfactory.d.ts +1 -0
  75. package/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.d.ts +0 -3
  76. package/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ngfactory.d.ts +1 -0
  77. package/lib/component/route-jobcode-list/route-jobcode-list.component.d.ts +1 -4
  78. package/lib/component/route-jobcode-list/route-jobcode-list.component.ngfactory.d.ts +1 -0
  79. package/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.d.ts +0 -3
  80. package/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ngfactory.d.ts +1 -0
  81. package/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.d.ts +0 -3
  82. package/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ngfactory.d.ts +1 -0
  83. package/lib/component/shared/dialog/dialog.component.d.ts +0 -3
  84. package/lib/component/shared/dialog/dialog.component.ngfactory.d.ts +1 -0
  85. package/lib/component/shared/estimation-display/estimation-display.component.d.ts +6 -0
  86. package/lib/component/shared/estimation-display/estimation-display.component.ngfactory.d.ts +1 -0
  87. package/lib/component/shared/job-route-list/job-route-list.component.d.ts +2 -7
  88. package/lib/component/shared/job-route-list/job-route-list.component.ngfactory.d.ts +1 -0
  89. package/lib/component/shared/jobcode-overview/jobcode-overview.component.d.ts +0 -3
  90. package/lib/component/shared/jobcode-overview/jobcode-overview.component.ngfactory.d.ts +1 -0
  91. package/lib/component/shared/jobcode-status/jobcode-status.component.d.ts +0 -3
  92. package/lib/component/shared/jobcode-status/jobcode-status.component.ngfactory.d.ts +1 -0
  93. package/lib/coolmap.component.d.ts +0 -3
  94. package/lib/coolmap.component.ngfactory.d.ts +1 -0
  95. package/lib/coolmap.module.d.ts +0 -38
  96. package/lib/coolmap.module.ngfactory.d.ts +3 -0
  97. package/package.json +8 -21
  98. package/esm2020/aggdirect-coolmap.mjs +0 -5
  99. package/esm2020/coolmap.mjs +0 -5
  100. package/esm2020/lib/component/add-route/add-route.component.mjs +0 -318
  101. package/esm2020/lib/component/job-code/job-code.component.mjs +0 -119
  102. package/esm2020/lib/component/map/map.component.mjs +0 -38
  103. package/esm2020/lib/component/nav/layout/add-route-nav/add-route-nav.component.mjs +0 -87
  104. package/esm2020/lib/component/nav/layout/job-code-nav/job-code-nav.component.mjs +0 -89
  105. package/esm2020/lib/component/nav/nav.component.mjs +0 -53
  106. package/esm2020/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.mjs +0 -68
  107. package/esm2020/lib/component/route-jobcode-list/route-jobcode-list.component.mjs +0 -314
  108. package/esm2020/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.mjs +0 -19
  109. package/esm2020/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.mjs +0 -29
  110. package/esm2020/lib/component/shared/dialog/dialog.component.mjs +0 -29
  111. package/esm2020/lib/component/shared/job-route-list/job-route-list.component.mjs +0 -71
  112. package/esm2020/lib/component/shared/jobcode-overview/jobcode-overview.component.mjs +0 -19
  113. package/esm2020/lib/component/shared/jobcode-status/jobcode-status.component.mjs +0 -14
  114. package/esm2020/lib/coolmap.component.mjs +0 -22
  115. package/esm2020/lib/coolmap.module.mjs +0 -178
  116. package/fesm2015/aggdirect-coolmap.mjs +0 -1373
  117. package/fesm2015/aggdirect-coolmap.mjs.map +0 -1
  118. package/fesm2015/coolmap.mjs +0 -1374
  119. package/fesm2015/coolmap.mjs.map +0 -1
  120. package/fesm2020/aggdirect-coolmap.mjs +0 -1349
  121. package/fesm2020/aggdirect-coolmap.mjs.map +0 -1
  122. package/fesm2020/coolmap.mjs +0 -1350
  123. package/fesm2020/coolmap.mjs.map +0 -1
  124. package/index.d.ts +0 -5
  125. /package/{esm2020/public-api.mjs → esm2015/public-api.js} +0 -0
@@ -0,0 +1,1383 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@aggdirect/coolmap-services'), require('rxjs'), require('rxjs/operators'), require('@angular/material/sidenav'), require('@angular/material/snack-bar'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('@angular/material/input'), require('@angular/material/select'), require('@angular/material/icon'), require('@angular/material/autocomplete'), require('@angular/material/form-field'), require('@angular/material/progress-spinner'), require('@angular/material/chips'), require('@angular/material/dialog'), require('@angular/common'), require('@angular/material/tooltip'), require('@angular/material/datepicker'), require('@angular/material/core'), require('ngx-perfect-scrollbar'), require('@angular/material/button'), require('@angular/material/progress-bar'), require('@angular/cdk/collections')) :
3
+ typeof define === 'function' && define.amd ? define('coolmap', ['exports', '@angular/core', '@aggdirect/coolmap-services', 'rxjs', 'rxjs/operators', '@angular/material/sidenav', '@angular/material/snack-bar', '@angular/cdk/drag-drop', '@angular/forms', '@angular/material/input', '@angular/material/select', '@angular/material/icon', '@angular/material/autocomplete', '@angular/material/form-field', '@angular/material/progress-spinner', '@angular/material/chips', '@angular/material/dialog', '@angular/common', '@angular/material/tooltip', '@angular/material/datepicker', '@angular/material/core', 'ngx-perfect-scrollbar', '@angular/material/button', '@angular/material/progress-bar', '@angular/cdk/collections'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.coolmap = {}, global.ng.core, global.coolmapServices, global.rxjs, global.rxjs.operators, global.ng.material.sidenav, global.ng.material.snackBar, global.ng.cdk.dragDrop, global.ng.forms, global.ng.material.input, global.ng.material.select, global.ng.material.icon, global.ng.material.autocomplete, global.ng.material.formField, global.ng.material.progressSpinner, global.ng.material.chips, global.ng.material.dialog, global.ng.common, global.ng.material.tooltip, global.ng.material.datepicker, global.ng.material.core, global.ngxPerfectScrollbar, global.ng.material.button, global.ng.material.progressBar, global.ng.cdk.collections));
5
+ }(this, (function (exports, core, coolmapServices, rxjs, operators, sidenav, snackBar, dragDrop, forms, input, select, icon, autocomplete, formField, progressSpinner, chips, dialog, common, tooltip, datepicker, core$1, ngxPerfectScrollbar, button, progressBar, collections) { 'use strict';
6
+
7
+ var CoolmapComponent = /** @class */ (function () {
8
+ function CoolmapComponent() {
9
+ }
10
+ CoolmapComponent.prototype.ngOnInit = function () {
11
+ };
12
+ return CoolmapComponent;
13
+ }());
14
+ CoolmapComponent.decorators = [
15
+ { type: core.Component, args: [{
16
+ selector: 'lib-coolmap',
17
+ template: "\n <p>\n coolmap works!\n </p>\n "
18
+ },] }
19
+ ];
20
+ CoolmapComponent.ctorParameters = function () { return []; };
21
+
22
+ var MapComponent = /** @class */ (function () {
23
+ function MapComponent(coolmapService) {
24
+ this.coolmapService = coolmapService;
25
+ this.enableProgress = true;
26
+ this.destroyer$ = new rxjs.Subject();
27
+ }
28
+ MapComponent.prototype.ngAfterViewInit = function () {
29
+ var _this = this;
30
+ this.coolmapService.reintiatecoolmap.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
31
+ _this.enableProgress = true;
32
+ if (res) {
33
+ _this.coolmapService.initiateMapForAddRoute(_this.mapDiv.nativeElement).then(function (res) {
34
+ _this.enableProgress = false;
35
+ });
36
+ }
37
+ });
38
+ };
39
+ MapComponent.prototype.ngOnDestroy = function () {
40
+ this.destroyer$.next(true);
41
+ this.destroyer$.unsubscribe();
42
+ };
43
+ return MapComponent;
44
+ }());
45
+ MapComponent.decorators = [
46
+ { type: core.Component, args: [{
47
+ selector: 'app-map',
48
+ template: "<div>\r\n <mat-progress-bar *ngIf=\"enableProgress\" mode=\"indeterminate\"></mat-progress-bar>\r\n <div #map class=\"coolmap\" style=\"height: 100vh;\"></div>\r\n</div>\r\n",
49
+ styles: [""]
50
+ },] }
51
+ ];
52
+ MapComponent.ctorParameters = function () { return [
53
+ { type: coolmapServices.CoolmapService }
54
+ ]; };
55
+ MapComponent.propDecorators = {
56
+ mapDiv: [{ type: core.ViewChild, args: ['map', { static: true },] }]
57
+ };
58
+
59
+ var NavComponent = /** @class */ (function () {
60
+ function NavComponent(utils, coolMap) {
61
+ var _this = this;
62
+ this.utils = utils;
63
+ this.coolMap = coolMap;
64
+ this.drawer = new core.EventEmitter();
65
+ this.changeNav = new core.EventEmitter();
66
+ this.navValue = 'Jobcode';
67
+ this.isnavChange = true;
68
+ this.paddinForJobCode = { top: 0, bottom: 250, left: 500, right: 400 };
69
+ this.paddinForViewRoute = { top: 0, bottom: 400, left: 400, right: 0 };
70
+ this.destroyer$ = new rxjs.Subject();
71
+ this.utils.navChangeObserve.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) { _this.isnavChange = res; });
72
+ this.coolMap.setPadding(this.paddinForJobCode);
73
+ }
74
+ NavComponent.prototype.openDrawer = function () { this.drawer.emit(true); };
75
+ NavComponent.prototype.chnageNav = function (name) {
76
+ if (this.isnavChange) {
77
+ this.changeNav.emit(name);
78
+ this.navValue = name;
79
+ this.coolMap.clearBound();
80
+ if (name === 'Addroute') {
81
+ this.coolMap.setPadding(this.paddinForViewRoute);
82
+ }
83
+ else {
84
+ this.coolMap.setPadding(this.paddinForJobCode);
85
+ }
86
+ this.utils.clearOptions();
87
+ }
88
+ };
89
+ NavComponent.prototype.ngOnDestroy = function () {
90
+ this.destroyer$.next(true);
91
+ this.destroyer$.unsubscribe();
92
+ };
93
+ return NavComponent;
94
+ }());
95
+ NavComponent.decorators = [
96
+ { type: core.Component, args: [{
97
+ selector: 'app-nav',
98
+ template: "<div class=\"nav\">\r\n <button (click)=\"openDrawer()\" class=\"toggle\">\r\n <img src=\"assets/images/toggle.svg\" alt=\"\" />\r\n </button>\r\n\r\n <ul class=\"m-100\">\r\n <li [ngClass]=\"{'active': navValue === 'Jobcode'}\">\r\n <a mat-raised-button #tooltip=\"matTooltip\" matTooltip=\"Job Code\" aria-label=\"Job-code\" (click)=\"chnageNav('Jobcode')\">\r\n <img src=\"assets/images/job-code.svg\" alt=\"\" />\r\n </a>\r\n </li>\r\n\r\n <li [ngClass]=\"{'active': navValue === 'Addroute', 'disabled': !isnavChange }\">\r\n <a mat-raised-button #tooltip=\"matTooltip\" matTooltip=\"View Route\" aria-label=\"View-route\" (click)=\"chnageNav('Addroute')\">\r\n <img src=\"assets/images/route.svg\" alt=\"\" />\r\n </a>\r\n </li>\r\n </ul>\r\n</div>\r\n",
99
+ styles: [".nav{background:#e8e8e8;height:100vh;padding:15px 0;display:flex;align-items:center;flex-direction:column}.nav button{background:#fff;border-radius:15px;padding:5px 6px}.nav button img{width:28px}.nav ul{display:flex;flex-direction:column;align-items:center}.nav ul li{margin:10px 0;padding:0 5px;border-right:2px solid #e8e8e8}.nav ul li:hover{border-right:2px solid #326ad3;padding:0 5px}.nav ul li.disabled a{pointer-events:none;opacity:.5}.nav ul li.disabled:hover{border-right:2px solid #e8e8e8}.nav ul li a{padding:6px 0;display:block;border-radius:15px;min-width:42px;box-shadow:none;line-height:30px}.nav ul li a img{width:27px}.nav ul li a:hover{background:#fff}.nav ul li a:hover img{filter:invert(.2) sepia(1) saturate(8) hue-rotate(180deg)}.nav ul li.active{border-right:2px solid #326ad3}.nav ul li.active a{background:#fff}"]
100
+ },] }
101
+ ];
102
+ NavComponent.ctorParameters = function () { return [
103
+ { type: coolmapServices.UtilsService },
104
+ { type: coolmapServices.CoolmapService }
105
+ ]; };
106
+ NavComponent.propDecorators = {
107
+ drawer: [{ type: core.Output }],
108
+ changeNav: [{ type: core.Output }]
109
+ };
110
+
111
+ var RouteJobCodeListComponent = /** @class */ (function () {
112
+ function RouteJobCodeListComponent(coolMap, utils) {
113
+ this.coolMap = coolMap;
114
+ this.utils = utils;
115
+ this.loader = true;
116
+ this.type = '';
117
+ this.data = [];
118
+ this.currentNav = '';
119
+ this.emitroute = new core.EventEmitter();
120
+ this.showAllRoute = new core.EventEmitter();
121
+ this.preventMouseout = false;
122
+ this.filterList = this.data;
123
+ this.isDriverList = false;
124
+ this.selectedRoute = new collections.SelectionModel(true, []);
125
+ this.preventListSelect = false;
126
+ this.clearJobDetailsFromList = new core.EventEmitter();
127
+ this.preventDetailsClose = false;
128
+ this.messageLoader = false;
129
+ this.driverMessage = new forms.FormControl('', [forms.Validators.maxLength(256)]);
130
+ this.isSmsList = false;
131
+ this.driverList = [];
132
+ }
133
+ RouteJobCodeListComponent.prototype.ngOnInit = function () {
134
+ var _this = this;
135
+ this.utils.getpreVentJobdetailclose.subscribe(function (res) { _this.preventDetailsClose = res; });
136
+ this.utils.removeMapEntityUtility.subscribe(function (res) { _this.passRoute(res); });
137
+ };
138
+ RouteJobCodeListComponent.prototype.passRoute = function (job) {
139
+ var _this = this;
140
+ this.data.forEach(function (each) {
141
+ if (each['route_id'] !== job['route_id']) {
142
+ each['isActive'] = false;
143
+ }
144
+ else {
145
+ each['isActive'] = true;
146
+ }
147
+ });
148
+ if (this.type == 'addroute')
149
+ this.filterList.forEach(function (ele) { return _this.coolMap.filterRoute(ele['route_id'], 'none'); });
150
+ };
151
+ RouteJobCodeListComponent.prototype.selectRoute = function (route) {
152
+ var _this = this;
153
+ if (!this.preventListSelect) {
154
+ this.preventListSelect = true;
155
+ this.selectedRoute.toggle(route);
156
+ this.clearJobDetailsFromList.emit(true);
157
+ this.utils.preVentJobdetailclose.next(false);
158
+ this.filterList.forEach(function (ele) { return _this.coolMap.filterRoute(ele['job_id'], 'none'); });
159
+ this.clearList();
160
+ this.selectedRoute.selected.forEach(function (ele, index) {
161
+ _this.coolMap.filterRoute(ele['job_id'], 'visible', ((_this.selectedRoute.selected.length - 1) === index)).then(function () {
162
+ _this.preventListSelect = false;
163
+ });
164
+ });
165
+ if (!this.selectedRoute.selected.length) {
166
+ this.preventListSelect = false;
167
+ this.data.forEach(function (ele) { return _this.coolMap.filterRoute(ele['job_id'], 'visible'); });
168
+ }
169
+ ;
170
+ }
171
+ };
172
+ RouteJobCodeListComponent.prototype.checkroutes = function (route) {
173
+ var selectedRoute = this.selectedRoute.selected;
174
+ this.filterList = this.filterList.map(function (ele) { ele['isSelected'] = false; return ele; });
175
+ if (selectedRoute.length > 0) {
176
+ selectedRoute.forEach(function (ele) {
177
+ if (route['order_number'] === ele['order_number']) {
178
+ ele['isSelected'] = true;
179
+ }
180
+ });
181
+ }
182
+ return route;
183
+ };
184
+ RouteJobCodeListComponent.prototype.ngOnChanges = function (changes) {
185
+ var _this = this;
186
+ setTimeout(function () {
187
+ if (_this.currentNav === 'Addroute' && (_this.data.length < _this.filterList.length)) {
188
+ var index = _this.filterList.findIndex(function (ele) { return ele.isActive; });
189
+ if (index > 0)
190
+ _this.filterList[index].isActive = false;
191
+ _this.data.forEach(function (ele, indexForData) {
192
+ var id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
193
+ _this.coolMap.plotRoute(ele, id, _this.type, false, (indexForData === (_this.data.length - 1))).then(function (res) {
194
+ });
195
+ });
196
+ }
197
+ }, 500);
198
+ if (changes['data'] && changes['data']['currentValue']) {
199
+ this.filterList = changes['data']['currentValue'];
200
+ if (this.searchTerm) {
201
+ if (this.searchTerm.length > 0) {
202
+ this.data = this.utils.getSearchResults(changes['data']['currentValue'], this.searchTerm);
203
+ this.filterList = this.data;
204
+ }
205
+ else {
206
+ this.filterList = changes['data']['currentValue'];
207
+ }
208
+ }
209
+ if (this.type === 'jobcode') {
210
+ this.loader = true;
211
+ this.clearList();
212
+ if (this.filterList.length === 0)
213
+ this.loader = false;
214
+ }
215
+ if (this.type !== 'jobcode') {
216
+ if (changes['data']['previousValue'] && this.currentNav === 'addForm') {
217
+ var activeRoute_1 = changes['data']['previousValue'].find(function (ele) { return ele.isActive; });
218
+ if (activeRoute_1) {
219
+ this.filterList.map(function (item) {
220
+ if (item.route_id === activeRoute_1.route_id) {
221
+ item.isActive = true;
222
+ }
223
+ });
224
+ }
225
+ }
226
+ }
227
+ if (changes['data']['previousValue'] && this.currentNav !== 'addForm') {
228
+ this.coolMap.removeJobFromMap(changes['data']['previousValue']);
229
+ this.selectedRoute.clear();
230
+ }
231
+ ;
232
+ if (this.currentNav !== 'addForm') {
233
+ changes['data']['currentValue'].forEach(function (ele, indexForData) {
234
+ var id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
235
+ _this.coolMap.plotRoute(ele, id, _this.type, false, (indexForData === (_this.data.length - 1))).then(function (res) {
236
+ if (indexForData === (_this.data.length - 1)) {
237
+ _this.loader = false;
238
+ _this.utils.preventnavChange.next(true);
239
+ }
240
+ });
241
+ });
242
+ }
243
+ }
244
+ if (changes['searchTerm']) {
245
+ if (this.filterList) {
246
+ this.data = this.filterList;
247
+ this.clearList();
248
+ if (changes['searchTerm']['currentValue'].length > 0) {
249
+ this.coolMap.removeRouteAndMarker(1);
250
+ this.data = this.utils.getSearchResults(this.data, changes['searchTerm']['currentValue']);
251
+ }
252
+ else {
253
+ this.data = this.filterList;
254
+ }
255
+ setTimeout(function () {
256
+ _this.coolMap.clearBoundWithCordinates();
257
+ if (_this.currentNav !== 'addForm' && !_this.selectedRoute['selected'].length) {
258
+ _this.coolMap.removeRouteAndMarker(1);
259
+ _this.toggleFilterRoute(_this.filterList);
260
+ }
261
+ }, 500);
262
+ if (this.currentNav !== 'addForm' && this.selectedRoute['selected'].length) {
263
+ if (this.data && this.data.length > 0) {
264
+ this.clearList();
265
+ this.clearJobDetailsFromList.emit(true);
266
+ this.coolMap.removeJobFromMap(this.selectedRoute.selected);
267
+ setTimeout(function () {
268
+ _this.data.forEach(function (ele, indexForData) {
269
+ _this.coolMap.plotRoute(ele, ele['job_id'], _this.type, false, (indexForData === (_this.data.length - 1))).then(function () {
270
+ if (indexForData === (_this.data.length - 1)) {
271
+ _this.loader = false;
272
+ _this.utils.preventnavChange.next(true);
273
+ }
274
+ if (_this.selectedRoute['selected'].length && _this.selectedRoute['selected'][0]['job_id'] === ele['job_id']) {
275
+ _this.selectedRoute.clear();
276
+ }
277
+ });
278
+ });
279
+ }, 500);
280
+ }
281
+ }
282
+ }
283
+ }
284
+ };
285
+ RouteJobCodeListComponent.prototype.showRoute = function () {
286
+ var _this = this;
287
+ this.utils.preventnavChange.next(false);
288
+ this.loader = true;
289
+ this.clearList();
290
+ this.showAllRoute.emit(true);
291
+ if (this.filterList && this.filterList.length > 0) {
292
+ this.coolMap.removeJobFromMap(this.selectedRoute.selected);
293
+ setTimeout(function () {
294
+ _this.filterList.forEach(function (ele, indexForData) {
295
+ _this.coolMap.plotRoute(ele, ele['job_id'], _this.type, false, (indexForData === _this.filterList.length - 1)).then(function () {
296
+ if (indexForData === _this.filterList.length - 1) {
297
+ _this.loader = false;
298
+ _this.utils.preventnavChange.next(true);
299
+ }
300
+ if (_this.selectedRoute['selected'].length && _this.selectedRoute['selected'][0]['job_id'] === ele['job_id']) {
301
+ _this.selectedRoute.clear();
302
+ }
303
+ });
304
+ });
305
+ }, 500);
306
+ }
307
+ };
308
+ RouteJobCodeListComponent.prototype.toggleDrivermenu = function (event) {
309
+ var mouseevntType = event.mouseevntType;
310
+ var route = event.route;
311
+ var isHoverOut = event.isHoverOut;
312
+ if (typeof (mouseevntType) === 'string') {
313
+ if (this.preventMouseout) {
314
+ this.isDriverList = !this.isDriverList;
315
+ }
316
+ ;
317
+ this.preventMouseout = true;
318
+ }
319
+ if (typeof (mouseevntType) === 'boolean' && !mouseevntType && !this.preventMouseout) {
320
+ this.isDriverList = mouseevntType;
321
+ }
322
+ ;
323
+ if (typeof (mouseevntType) === 'boolean' && mouseevntType && !this.preventMouseout) {
324
+ this.isDriverList = mouseevntType;
325
+ }
326
+ ;
327
+ if (this.preventMouseout && !this.isDriverList)
328
+ this.preventMouseout = false;
329
+ if (isHoverOut) {
330
+ if (this.preventMouseout) {
331
+ route = this.utils.getdictValue('driver-details');
332
+ this.driverList = route;
333
+ }
334
+ if (!this.preventMouseout) {
335
+ this.driverList = route;
336
+ }
337
+ }
338
+ else {
339
+ this.driverList = route;
340
+ }
341
+ };
342
+ RouteJobCodeListComponent.prototype.visiblesection = function (value) {
343
+ if (this.type === value) {
344
+ return true;
345
+ }
346
+ else
347
+ return false;
348
+ };
349
+ RouteJobCodeListComponent.prototype.toggleFilterRoute = function (filterList) {
350
+ var _this = this;
351
+ filterList.forEach(function (ele) {
352
+ var filterItem = (_this.type === 'jobcode') ? 'job_id' : 'route_id';
353
+ var index = _this.data.findIndex(function (ele1) { return (ele1["" + filterItem] === ele["" + filterItem]); });
354
+ var id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
355
+ if (id && index < 0)
356
+ _this.coolMap.filterRoute(id, 'none');
357
+ if (id && index >= 0) {
358
+ _this.data[index].isActive = false;
359
+ _this.coolMap.filterRoute(id, 'visible');
360
+ _this.coolMap.extendBound(ele['path'], (index === (_this.data.length - 1)));
361
+ }
362
+ ;
363
+ });
364
+ };
365
+ RouteJobCodeListComponent.prototype.clearList = function () {
366
+ this.isDriverList = false;
367
+ this.driverList = null;
368
+ this.preventMouseout = false;
369
+ this.isSmsList = false;
370
+ };
371
+ RouteJobCodeListComponent.prototype.sendMessage = function () {
372
+ var _this = this;
373
+ this.messageLoader = true;
374
+ if (this.driverMessage.valid) {
375
+ var data = {
376
+ order_number: this.driverList['order_number'],
377
+ date: this.driverList['date'],
378
+ message: this.driverMessage.value,
379
+ };
380
+ this.utils.postdata('coolmap/jobs_report_chat', data).subscribe(function (res) {
381
+ if (res['data']['status'] === 'Success.') {
382
+ _this.messageLoader = false;
383
+ _this.driverMessage.reset();
384
+ _this.utils.openSnackBar('Message Sent', 'success');
385
+ }
386
+ else {
387
+ _this.messageLoader = false;
388
+ _this.utils.openSnackBar('Message not sent', 'error');
389
+ }
390
+ }, function (err) {
391
+ if (err) {
392
+ _this.messageLoader = false;
393
+ }
394
+ });
395
+ }
396
+ };
397
+ return RouteJobCodeListComponent;
398
+ }());
399
+ RouteJobCodeListComponent.decorators = [
400
+ { type: core.Component, args: [{
401
+ selector: 'app-route-jobcode-list',
402
+ template: "<div class=\"scrollprt addroutelist\" [class.viewroute]=\"visiblesection('addroute')\"\r\n [class.jobList]=\"visiblesection('jobcode')\">\r\n <button (click)=\"showRoute()\" [disabled]=\"loader\" *ngIf=\"selectedRoute.selected.length\" class=\"show_routebtn\">Show all\r\n route</button>\r\n <perfect-scrollbar [class.jobscroll]=\"visiblesection('jobcode')\">\r\n <mat-spinner *ngIf=\"loader\"></mat-spinner>\r\n <ul *ngIf=\"!loader && data.length > 0\">\r\n <li [class.active]=\"route['isActive'] && visiblesection('addroute')\" *ngFor=\"let route of data\">\r\n <app-job-code-list-card *ngIf=\"visiblesection('jobcode')\" (toggleDrivermenu)=\"toggleDrivermenu($event)\"\r\n (routeSeletion)=\"selectRoute($event)\" [preventCloseDetails]=\"preventDetailsClose\"\r\n [emitJobdetails]=\"{'emitroute': emitroute, 'clearJobDetailsFromList':clearJobDetailsFromList}\" [route]=\"checkroutes(route)\"></app-job-code-list-card>\r\n <app-view-route-list-card [emitrouteevent]=\"emitroute\" *ngIf=\"visiblesection('addroute')\"\r\n [route]=\"route\"></app-view-route-list-card>\r\n </li>\r\n </ul>\r\n <p *ngIf=\"!loader && data.length === 0\">{{visiblesection('addroute') ? 'No Route found' : 'No Job code found.'}}</p>\r\n </perfect-scrollbar>\r\n</div>\r\n<div class=\"driver_list\" *ngIf=\"isDriverList\">\r\n <div class=\"driver_headingprt\">\r\n <h2>Driver List</h2>\r\n <button *ngIf=\"driverList.driver_list?.length > 0\" (click)=\"isSmsList = true\">SMS</button>\r\n <div class=\"closebtn\" (click)=\"isDriverList = false; preventMouseout = false; isSmsList = false\">\r\n <mat-icon>clear</mat-icon>\r\n </div>\r\n </div>\r\n <ul class=\"driverList\" *ngIf=\"driverList && driverList.driver_list\">\r\n <li *ngFor=\"let driver of driverList?.driver_list\">\r\n <img src=\"assets/images/driver_icon.png\" [alt]=\"driver['driver_name']\" />\r\n <div class=\"driver_detail\">\r\n <b>{{driver['driver_name']}}</b> <span>{{driver['trucking_company']}}</span>\r\n <div class=\"cont_del\">\r\n <small>Driver contact: <b>{{driver['driver_phone'] ? driver['driver_phone'] : 'N/A'}}</b></small>\r\n <small>Company contact: <b>{{driver['trucking_company_phone'] ? driver['trucking_company_phone'] :\r\n 'N/A'}}</b></small>\r\n </div>\r\n </div>\r\n </li>\r\n <p *ngIf=\"driverList.driver_list?.length === 0\" style=\"font-weight:700; text-align:center;\">\r\n No Driver found\r\n </p>\r\n </ul>\r\n <div class=\"smslist\" *ngIf=\"isSmsList\">\r\n <div class=\"heading\">\r\n <h2>SMS All Drivers</h2>\r\n <div class=\"closebtn\" (click)=\"isSmsList = false\">\r\n <mat-icon>clear</mat-icon>\r\n </div>\r\n </div>\r\n <div class=\"detailprt\">\r\n <app-sms-card-details-overview [jobValue]=\"driverList\"></app-sms-card-details-overview>\r\n <div class=\"form_input\">\r\n <mat-form-field class=\"example-full-width\">\r\n <textarea matInput placeholder=\"Text here...\" autocomplete=\"nope\" column=\"10\"\r\n [formControl]=\"driverMessage\"></textarea>\r\n <mat-hint>{{driverMessage.value?.length}} / 256</mat-hint>\r\n </mat-form-field>\r\n <button *ngIf=\"!messageLoader\" [disabled]=\"!driverMessage.value || driverMessage.invalid\"\r\n (click)=\"sendMessage()\">\r\n Send SMS\r\n </button>\r\n </div>\r\n </div>\r\n <div class=\"loader\">\r\n <mat-spinner *ngIf=\"messageLoader\"></mat-spinner>\r\n </div>\r\n </div>\r\n</div>",
403
+ styles: [".driver_iconprt{position:absolute;right:10px;top:12px;z-index:9999}.driver_iconprt img{width:25px;height:25px}.driver_list{background:#fff;position:fixed;width:300px;top:10px;left:360px;border-top-left-radius:20px;border-top-right-radius:20px}.driver_list .driver_headingprt{display:flex;justify-content:space-between;align-items:center;padding:0 15px}.driver_list .driver_headingprt button{background:none;border:1px solid #ccc;border-radius:10px;padding:5px 20px}.driver_list .driver_headingprt button:hover{background:#326ad3;color:#fff}.driver_list h2{font-size:20px}.driver_list .driverList{height:300px;overflow:auto}.driver_list .driverList li{display:flex;padding:10px;align-items:flex-start;cursor:pointer;border-bottom:1px solid #fff;background:#eee}.driver_list .driverList li img{width:35px;height:35px;border-radius:100%;margin-right:10px}.driver_list .driverList li .driver_detail{width:calc(100% - 45px);display:flex;flex-direction:column;justify-content:flex-start}.driver_list .driverList li .driver_detail b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:135px;font-size:.9rem}.driver_list .driverList li .driver_detail span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px;font-size:.8rem}.driver_list:after{height:10px;border-bottom-right-radius:20px;border-bottom-left-radius:20px;content:\"\";bottom:-9px;width:100%}.driver_list:after,.smslist{background:#fff;position:absolute}.smslist{width:480px;top:0;left:105%;border-radius:20px;padding-bottom:20px}.smslist .heading{display:flex;justify-content:space-between;align-items:center;padding:0 15px}.smslist .detailprt{padding:0 15px}.smslist .detailprt span{display:flex;margin-bottom:12px;font-size:.8rem;align-items:center}.smslist .detailprt span label{font-weight:600;width:37%}.smslist .detailprt .form_input{display:flex;flex-direction:column;font-size:.8rem}.smslist .detailprt .form_input button{background:#326ad3;padding:10px 18px;color:#fff;font-size:.8125rem;border-radius:30px;display:flex;align-self:flex-end}.closebtn{box-shadow:0 0 5px 0 rgba(0,0,0,.11);border-radius:100%;width:30px;height:30px;display:flex;justify-content:center;align-items:center;cursor:pointer;background:#f5f5f5}.show_routebtn{font-size:.9rem;margin-bottom:20px;padding:6px 11px;border-radius:5%;position:absolute;top:8px;right:10px;background-color:initial;color:#3f51b5;border:1px solid #3f51b5;border-radius:10px;box-shadow:none}.show_routebtn:hover{background-color:#3f51b5;color:#fff}.cont_del{margin-top:10px}.cont_del small{display:block}.jobList ul{margin:0 15px 0 10px;width:100%}.jobList ul li{position:relative;background:#fbfbfb;padding:10px;border-radius:15px;margin-bottom:5px;border:1px solid #fbfbfb;border-left-width:3px;cursor:pointer;height:inherit}@media (min-width:2500px){.jobList ul li{height:7.65vh}}@media (min-width:3300px){.jobList ul li{height:5.61vh}}.viewroute ul{margin:0 15px;width:100%}.viewroute ul li{position:relative;background:#fbfbfb;padding:7px 10px;border-radius:15px;margin-bottom:5px;border:1px solid #fbfbfb;border-left-width:3px;cursor:pointer;height:16.4vh}@media (min-width:1600px){.viewroute ul li{height:12.4vh}}.viewroute ul li.active{border:1px solid #39c471;border-left-width:3px}.loader{position:absolute;height:100%;top:0;left:0;width:100%;display:flex;align-items:center;justify-content:center;pointer-events:none}"]
404
+ },] }
405
+ ];
406
+ RouteJobCodeListComponent.ctorParameters = function () { return [
407
+ { type: coolmapServices.CoolmapService },
408
+ { type: coolmapServices.UtilsService }
409
+ ]; };
410
+ RouteJobCodeListComponent.propDecorators = {
411
+ loader: [{ type: core.Input }],
412
+ type: [{ type: core.Input }],
413
+ data: [{ type: core.Input }],
414
+ currentNav: [{ type: core.Input }],
415
+ emitroute: [{ type: core.Output }],
416
+ showAllRoute: [{ type: core.Output }],
417
+ searchTerm: [{ type: core.Input }],
418
+ clearJobDetailsFromList: [{ type: core.Output }],
419
+ clearListSeletion: [{ type: core.Input }]
420
+ };
421
+
422
+ var ViewRouteListCardComponent = /** @class */ (function () {
423
+ function ViewRouteListCardComponent(utils) {
424
+ this.utils = utils;
425
+ }
426
+ ViewRouteListCardComponent.prototype.detailsDict = function (event, route) {
427
+ if (event === 'click')
428
+ this.utils.setdictValue('route-detailsv2', JSON.stringify(route));
429
+ route['type'] = 'editroute';
430
+ route['prevent'] = true;
431
+ this.emitrouteevent.emit(route);
432
+ this.utils.routeDetailsUtility.next({ event: event, route: route });
433
+ };
434
+ return ViewRouteListCardComponent;
435
+ }());
436
+ ViewRouteListCardComponent.decorators = [
437
+ { type: core.Component, args: [{
438
+ selector: 'app-view-route-list-card',
439
+ template: "<div class=\"routebox\">\r\n <span>\r\n <mat-icon>directions</mat-icon>\r\n <h2 [ngClass]=\"{'routeheading': route['route_name']}\">\r\n {{route['route_name']}}\r\n </h2>\r\n </span>\r\n <h3>{{route['customer_name']}} | {{route['material']}}</h3>\r\n\r\n <div class=\"pickdropprt\">\r\n <div class=\"pickprt\">\r\n <b>\r\n <h4>{{route['pickup_location']}}</h4>\r\n </b>\r\n </div>\r\n <div class=\"dropprt\">\r\n <b>\r\n <h4>{{route['delivery_location']}}</h4>\r\n </b>\r\n </div>\r\n </div>\r\n <div class=\"infoicon\" (click)=\"detailsDict('click', route)\" (mouseover)=\"detailsDict(true, route)\"\r\n (mouseleave)=\"detailsDict(false, route)\">\r\n <img src=\"assets/images/info_icon.png\" [alt]=\"\" />\r\n </div>\r\n <div class=\"status routestatus\" [ngClass]=\"route['unit']\">{{route['unit']}}</div>\r\n</div>\r\n\r\n\r\n\r\n",
440
+ styles: [".routebox span{display:flex;align-items:center}.routebox span h2{margin-left:5px;max-width:180px;margin-bottom:5px;margin-top:5px;font-size:.95rem}.routebox h3,.routebox span h2{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.routebox h3{font-size:.85rem;color:#767676;font-weight:400;margin-top:0;max-width:325px;margin-bottom:10px}.routebox .pickdropprt{font-size:.8125rem}.routebox .pickdropprt .pickprt{position:relative;display:flex;align-items:center;padding-bottom:6px}.routebox .pickdropprt .pickprt span{padding-left:0;padding-right:20px;display:block}.routebox .pickdropprt .pickprt b{position:relative;font-weight:400}.routebox .pickdropprt .pickprt b:after{background:#000;width:1px;height:100%;left:3px;content:\"\";position:absolute;top:10px}.routebox .pickdropprt .pickprt h4{position:relative;padding-left:15px;margin:0;line-height:18px;font-weight:400;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;max-width:215px}@media (min-width:1600px){.routebox .pickdropprt .pickprt h4{max-width:265px}}.routebox .pickdropprt .pickprt h4:before{background:#000;top:4px;left:0;position:absolute;content:\"\";width:7px;height:7px;border-radius:100%}.routebox .pickdropprt .dropprt{position:relative;padding-bottom:10px;display:flex;align-items:center}.routebox .pickdropprt .dropprt span{padding-left:0;padding-right:20px;display:block}.routebox .pickdropprt .dropprt b{position:relative;font-weight:400}.routebox .pickdropprt .dropprt b:after{background:#000;width:1px;height:12px;left:3px;content:\"\";position:absolute;top:-7px}.routebox .pickdropprt .dropprt h4{position:relative;padding-left:15px;margin:0;line-height:18px;font-weight:400;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;max-width:215px}.routebox .pickdropprt .dropprt h4:before{background:#000;top:4px;left:0;position:absolute;content:\"\";width:7px;height:7px;border-radius:100%}.routebox .infoicon{position:absolute;right:10px;bottom:10px}.routebox .infoicon img{width:20px;height:20px}.routebox .status{position:absolute;border-radius:30px;top:12px;right:40px;font-size:0;color:#fff;text-transform:capitalize;font-weight:500;padding:3px 10px}.routebox .status.routestatus{right:10px;width:20px;height:20px;text-align:center;line-height:20px;padding:0 0 0 1px}.routebox .status.routestatus:first-letter{font-size:.8rem}@media (min-width:1600px){.routebox .status.routestatus{padding:0;line-height:22px}}.routebox .status.Ton{background:#ff7272}.routebox .status.Load{background:#a3c52e}.routebox .status.Hourly{background:#ae23d1}"]
441
+ },] }
442
+ ];
443
+ ViewRouteListCardComponent.ctorParameters = function () { return [
444
+ { type: coolmapServices.UtilsService }
445
+ ]; };
446
+ ViewRouteListCardComponent.propDecorators = {
447
+ route: [{ type: core.Input }],
448
+ emitrouteevent: [{ type: core.Input }]
449
+ };
450
+
451
+ var SmsCardDetailsOverviewComponent = /** @class */ (function () {
452
+ function SmsCardDetailsOverviewComponent() {
453
+ this.label = coolmapServices.DriversmsCardKey;
454
+ this.overViewEnum = coolmapServices.DriverSmsCardEnum;
455
+ }
456
+ return SmsCardDetailsOverviewComponent;
457
+ }());
458
+ SmsCardDetailsOverviewComponent.decorators = [
459
+ { type: core.Component, args: [{
460
+ selector: 'app-sms-card-details-overview',
461
+ template: "<ng-container *ngFor=\"let item of label\">\r\n <span>\r\n <label>{{overViewEnum[item]}}</label>\r\n <ng-container *ngIf=\"item !== 'values'\">{{jobValue[item] ? jobValue[item] : 'N/A'}}</ng-container>\r\n <ng-container *ngIf=\"item === 'values'\">{{jobValue[item]['Done'] + jobValue[item]['Ongoing'] + jobValue[item]['Open']}}</ng-container>\r\n </span>\r\n</ng-container>\r\n",
462
+ styles: ["span{display:flex;margin-bottom:12px;font-size:.8rem;align-items:center}span label{font-weight:600;width:37%}"]
463
+ },] }
464
+ ];
465
+ SmsCardDetailsOverviewComponent.ctorParameters = function () { return []; };
466
+ SmsCardDetailsOverviewComponent.propDecorators = {
467
+ jobValue: [{ type: core.Input }]
468
+ };
469
+
470
+ var JobCodeListCardComponent = /** @class */ (function () {
471
+ function JobCodeListCardComponent(utils) {
472
+ this.utils = utils;
473
+ this.routeSeletion = new core.EventEmitter();
474
+ this.toggleDrivermenu = new core.EventEmitter();
475
+ }
476
+ JobCodeListCardComponent.prototype.selectRoute = function (route) { this.routeSeletion.emit(route); };
477
+ JobCodeListCardComponent.prototype.toggleDriverlist = function (mouseevntType, route, isHoverOut) {
478
+ var data = { mouseevntType: mouseevntType, route: route, isHoverOut: isHoverOut };
479
+ this.toggleDrivermenu.emit(data);
480
+ if (mouseevntType === 'click')
481
+ this.utils.setdictValue('driver-details', JSON.stringify(this.route));
482
+ };
483
+ JobCodeListCardComponent.prototype.toggleJobCodeDetails = function (mouseEventType, route) {
484
+ if (mouseEventType) {
485
+ route['type'] = 'jobcode';
486
+ this.emitJobdetails.emitroute.emit(route);
487
+ }
488
+ else if (!mouseEventType && this.preventCloseDetails) {
489
+ route = this.utils.getdictValue('route-details');
490
+ route['type'] = 'jobcode';
491
+ this.emitJobdetails.emitroute.emit(route);
492
+ }
493
+ else if (!mouseEventType && !this.preventCloseDetails)
494
+ this.emitJobdetails.clearJobDetailsFromList.emit(true);
495
+ };
496
+ JobCodeListCardComponent.prototype.calculateStatusPercentage = function (type, route) {
497
+ var total = route['Done'] + route['Ongoing'] + route['Open'];
498
+ if (type === 'done') {
499
+ return Math.round((100 * route['Done']) / total);
500
+ }
501
+ else if (type === 'ongoing') {
502
+ return Math.round((100 * route['Ongoing']) / total);
503
+ }
504
+ else if (type === 'open') {
505
+ return Math.round((100 * route['Open']) / total);
506
+ }
507
+ else {
508
+ return null;
509
+ }
510
+ };
511
+ JobCodeListCardComponent.prototype.setRouteItem = function () {
512
+ this.utils.preVentJobdetailclose.next(true);
513
+ this.utils.setdictValue('route-details', JSON.stringify(this.route));
514
+ };
515
+ return JobCodeListCardComponent;
516
+ }());
517
+ JobCodeListCardComponent.decorators = [
518
+ { type: core.Component, args: [{
519
+ selector: 'app-job-code-list-card',
520
+ template: "<div class=\"innerbox\">\r\n <div class=\"inputarea\">\r\n <input type=\"checkbox\" name=\"selectroute\" [checked]=\"route['isSelected']\" (change)=\"$event ? selectRoute(route) : null\" />\r\n <label>&nbsp;</label>\r\n <div class=\"border\"></div>\r\n </div>\r\n <div class=\"job_intro\">\r\n <div class=\"heading\">\r\n <h2>\r\n {{route['order_number'] ? route['order_number'] : ''}}\r\n </h2>\r\n |\r\n <span>\r\n {{route['customer_name']}}\r\n </span>\r\n |\r\n <span>\r\n {{route['project']}}\r\n </span>\r\n </div>\r\n <div class=\"destinationprt\">\r\n <span style=\"padding-left: 0;\">\r\n {{route['pickup_location']}}\r\n </span>\r\n <b>></b>\r\n <span>\r\n {{route['delivery_location']}}\r\n </span>\r\n </div>\r\n <div class=\"mat_cat\">\r\n <span>\r\n {{route['material']}}\r\n </span>\r\n </div>\r\n\r\n <div class=\"statusbar\">\r\n <div class=\"status_percent\">\r\n <span class=\"done\" [style]=\"'width:'+calculateStatusPercentage('done',route['values'])+'%'\"></span>\r\n <span class=\"ongoing\" [style]=\"'width:'+calculateStatusPercentage('ongoing', route['values'])+'%'\"> </span>\r\n <span class=\"open\" [style]=\"'width:'+calculateStatusPercentage('open', route['values'])+'%'\"> </span>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"statusarea\">\r\n <div class=\"statusunit\" [ngClass]=\"route['unit']\">{{route['unit']}}</div>\r\n <div class=\"driver_icon\" (mouseover)=\"toggleDriverlist(true, route)\" (mouseout)=\"toggleDriverlist(false, route, true)\"\r\n mat-raised-button #tooltip=\"matTooltip\" matTooltip=\"Click on icon to show the driver list\" matTooltipPosition=\"above\"\r\n (click)=\"toggleDriverlist('click', route)\">\r\n <img src=\"assets/images/driver_icon.png\" [alt]=\"\" />\r\n </div>\r\n <div class=\"infoicon\" (click)=\"setRouteItem()\" (mouseover)=\"toggleJobCodeDetails(true, route)\"\r\n (mouseout)=\"toggleJobCodeDetails(false, route)\">\r\n <img src=\"assets/images/info_icon.png\" [alt]=\"\" />\r\n </div>\r\n </div>\r\n</div>\r\n",
521
+ styles: [".innerbox{display:flex;justify-content:space-between}.innerbox .inputarea{display:flex;align-items:center;width:6%}.innerbox .inputarea input[type=checkbox]{width:100%;height:100%;margin-right:10px;opacity:0;position:absolute;left:0;margin-left:0;top:0;z-index:3;cursor:pointer}.innerbox .inputarea input[type=checkbox]:checked+label{background:url(../../../../../assets/images/fill-radio.png) 10px 11px no-repeat}.innerbox .inputarea label{background:url(../../../../../assets/images/blank-radio.png) 10px 11px no-repeat;width:100%;position:relative;z-index:2;font-size:12px;color:#878787;height:100%;position:absolute;top:0;left:0}.innerbox .inputarea .border{position:absolute;width:100%;height:100%;left:0;right:0;top:-1px;border-radius:15px}.innerbox .inputarea input:checked~.border{border:1px solid #39c471;border-left-width:3px}.innerbox .inputarea h2{margin-left:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:214px;padding-left:16px;margin-bottom:5px;margin-top:0}.innerbox .job_intro{width:80%}.innerbox .job_intro .heading{display:flex;font-size:.8rem}.innerbox .job_intro .heading h2{margin:0 4px 0 0;font-size:.8rem}.innerbox .job_intro .heading span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100px;padding:0 3px;display:block}.innerbox .job_intro .destinationprt{display:flex;margin-top:10px;font-size:.8rem}.innerbox .job_intro .destinationprt span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:132px;padding:0 5px;display:block}.innerbox .job_intro .mat_cat{margin-top:10px;font-size:.8rem}.innerbox .job_intro .statusbar{width:100%;position:relative;height:5px;margin-top:10px}.innerbox .job_intro .statusbar .status_percent{position:absolute;left:0;display:flex;width:100%;height:100%}.innerbox .job_intro .statusbar .status_percent span{display:block}.innerbox .job_intro .statusbar .status_percent .done{background:green}.innerbox .job_intro .statusbar .status_percent .ongoing{background:#fc0}.innerbox .job_intro .statusbar .status_percent .open{background:#bfbfbf}.innerbox .statusarea{display:flex;flex-direction:column;align-items:center;width:10%}.innerbox .statusarea .statusunit{border-radius:30px;font-size:0;color:#fff;text-transform:capitalize;font-weight:500;width:20px;height:20px;text-align:center;line-height:20px}.innerbox .statusarea .statusunit:first-letter{font-size:.8rem}.innerbox .statusarea .statusunit.routestatus{right:10px}.innerbox .statusarea .statusunit.Ton{background:#39c471}.innerbox .statusarea .statusunit.Load{background:#326ad3}.innerbox .statusarea .statusunit.Hourly{background:#ffad56}.innerbox .statusarea .driver_icon,.innerbox .statusarea .infoicon{z-index:9999}.innerbox .statusarea .driver_icon img,.innerbox .statusarea .infoicon img{width:20px;height:20px}.innerbox .statusarea .driver_icon{margin:5px 0}"]
522
+ },] }
523
+ ];
524
+ JobCodeListCardComponent.ctorParameters = function () { return [
525
+ { type: coolmapServices.UtilsService }
526
+ ]; };
527
+ JobCodeListCardComponent.propDecorators = {
528
+ route: [{ type: core.Input }],
529
+ routeSeletion: [{ type: core.Output }],
530
+ toggleDrivermenu: [{ type: core.Output }],
531
+ emitJobdetails: [{ type: core.Input }],
532
+ preventCloseDetails: [{ type: core.Input }]
533
+ };
534
+
535
+ var JobCodeComponent = /** @class */ (function () {
536
+ function JobCodeComponent(utils, coolMap) {
537
+ var _this = this;
538
+ this.utils = utils;
539
+ this.coolMap = coolMap;
540
+ this.isVisible = false;
541
+ this.routes = [];
542
+ this.selectedRoute = new collections.SelectionModel(true, []);
543
+ this.clearJobDetails = new core.EventEmitter();
544
+ this.isOverlapRouteSection = false;
545
+ this.destroyer$ = new rxjs.Subject();
546
+ this.preventMouseout = false;
547
+ this.utils.clearViewRouteforJobCodeObserve.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
548
+ if (res)
549
+ _this.coolMap.removeJobFromMap(_this.selectedRoute.selected);
550
+ _this.selectedRoute.clear();
551
+ });
552
+ }
553
+ JobCodeComponent.prototype.ngOnInit = function () { this.getRouteList(); };
554
+ JobCodeComponent.prototype.getRouteList = function () {
555
+ var _this = this;
556
+ this.utils.getData('coolmap/routes/all').pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
557
+ if (res) {
558
+ _this.routes = res.data;
559
+ _this.masterRoutes = res.data;
560
+ _this.preventListUpdate = false;
561
+ _this.utils.clearOptions();
562
+ _this.routes.forEach(function (ele) { _this.utils.makeOptions(ele); });
563
+ }
564
+ });
565
+ };
566
+ JobCodeComponent.prototype.toggleSidemenu = function () {
567
+ this.isVisible = !this.isVisible;
568
+ this.detailsCardEnable = false;
569
+ this.preventMouseout = false;
570
+ };
571
+ JobCodeComponent.prototype.clearJob = function () { this.clearJobDetails.emit(true); this.utils.preVentJobdetailclose.next(false); };
572
+ JobCodeComponent.prototype.selectRoute = function (event) {
573
+ var _this = this;
574
+ var i = this.selectedRoute.selected.findIndex(function (ele) { return ele['order_number'] === event['order_number']; });
575
+ this.selectedRoute.toggle(event);
576
+ if (!this.selectedRoute.isSelected(event) && event['route_id']) {
577
+ this.coolMap.removeRouteAndMarker(event['route_id']).then(function (res) {
578
+ _this.coolMap.extendReBound();
579
+ });
580
+ }
581
+ else {
582
+ this.coolMap.plotRoute(event, event['route_id'], 'jobrouteList', false, true);
583
+ }
584
+ };
585
+ JobCodeComponent.prototype.masterToggle = function () {
586
+ var _this = this;
587
+ if (this.routes.length === this.selectedRoute.selected.length) {
588
+ this.selectedRoute.clear();
589
+ this.routes.forEach(function (row) {
590
+ _this.coolMap.removeRouteAndMarker(row['route_id']).then(function (res) { _this.coolMap.extendReBound(); });
591
+ });
592
+ }
593
+ else {
594
+ this.routes.forEach(function (row) {
595
+ _this.selectedRoute.select(row);
596
+ _this.coolMap.plotRoute(row, row['route_id'], 'jobrouteList', false, true);
597
+ });
598
+ }
599
+ };
600
+ JobCodeComponent.prototype.togglerouteDetails = function (eventType, route, mouseOut) {
601
+ if (typeof (eventType) === 'string') {
602
+ this.preventMouseout = true;
603
+ this.utils.setdictValue('route-details', JSON.stringify(route));
604
+ }
605
+ if (typeof (eventType) === 'boolean' && eventType && !this.preventMouseout) {
606
+ this.detailsCardEnable = eventType;
607
+ }
608
+ ;
609
+ if (typeof (eventType) === 'boolean' && !eventType && !this.preventMouseout) {
610
+ this.detailsCardEnable = eventType;
611
+ }
612
+ ;
613
+ if (this.preventMouseout && !this.detailsCardEnable)
614
+ this.preventMouseout = false;
615
+ if (mouseOut) {
616
+ if (this.preventMouseout) {
617
+ route = this.utils.getdictValue('route-details');
618
+ this.routeCardDetail = route;
619
+ }
620
+ if (!this.preventMouseout) {
621
+ this.routeCardDetail = route;
622
+ }
623
+ }
624
+ else {
625
+ this.routeCardDetail = route;
626
+ }
627
+ this.routeCardDetail['created_at'] = this.utils.getDateFormat(new Date(this.routeCardDetail['created_at']), '/');
628
+ };
629
+ JobCodeComponent.prototype.ngOnDestroy = function () {
630
+ this.destroyer$.next(true);
631
+ this.destroyer$.unsubscribe();
632
+ };
633
+ return JobCodeComponent;
634
+ }());
635
+ JobCodeComponent.decorators = [
636
+ { type: core.Component, args: [{
637
+ selector: 'app-job-code',
638
+ template: "<div class=\"jobcode_detailprt\" (click)=\"isOverlapRouteSection = false\" *ngIf=\"jobdetail\" [ngClass]=\"{'overlap': !isOverlapRouteSection}\" cdkDrag>\r\n <div class=\"topheadingprt\" *ngIf=\"jobdetail['order_number']\">\r\n <h2>{{jobdetail['order_number']}}</h2>\r\n </div>\r\n <span class=\"close\"><mat-icon (click)=\"clearJob()\">clear</mat-icon></span>\r\n <div class=\"job_details_area\">\r\n <div class=\"detailnameprt\">\r\n <span> <b> {{jobdetail.customer_name}} </b> Customer </span>\r\n <app-jobcode-status [jobValue]=\"jobdetail\"></app-jobcode-status>\r\n </div>\r\n <app-jobcode-overview [jobValue]=\"jobdetail\"></app-jobcode-overview>\r\n </div>\r\n</div>\r\n\r\n<div class=\"route_listprt\" (click)=\"isOverlapRouteSection = true\" [ngClass]=\"{ 'show': isVisible, 'overlap': isOverlapRouteSection}\">\r\n <div class=\"listing_toggle\" (click)=\"toggleSidemenu()\">\r\n <img src=\"assets/images/route.svg\" alt=\"\" />\r\n </div>\r\n\r\n <div class=\"listing_box\">\r\n <div class=\"closebtn\" (click)=\"toggleSidemenu()\">\r\n <mat-icon>clear</mat-icon>\r\n </div>\r\n\r\n <div class=\"btnprt\">\r\n <h2> List of Routes </h2>\r\n <button (click)=\"masterToggle()\">{{routes && routes.length > 0 && routes.length === selectedRoute.selected.length ? 'Uncheck' : 'Check'}} All</button>\r\n </div>\r\n\r\n <app-job-route-list [routes]=\"routes\" [masterRoutes]=\"masterRoutes\" [selectedRoute]=\"selectedRoute\" (changeRoutes)=\"routes = $event\" (changeSelectedRoute)=\"selectedRoute = $event\"></app-job-route-list>\r\n\r\n <perfect-scrollbar>\r\n <ul *ngIf=\"routes['length'] > 0\">\r\n <li *ngFor=\"let list of routes\">\r\n <div class=\"iconprt\">\r\n <span>\r\n <input type=\"checkbox\" [checked]=\"selectedRoute.isSelected(list)\"\r\n (change)=\"$event ? selectRoute(list) : null\" /><label>&nbsp;</label>\r\n <div class=\"border\"></div>\r\n </span>\r\n <div class=\"statusunit\" [ngClass]=\"list['unit']\">{{list['unit']}}</div>\r\n <div class=\"infoicon\">\r\n <img (mouseenter)=\"togglerouteDetails(true, list)\" (mouseout)=\"togglerouteDetails(false, list, true)\"\r\n (click)=\"togglerouteDetails('click', list)\" src=\"assets/images/info_icon.png\" [alt]=\"\" />\r\n </div>\r\n </div>\r\n <div class=\"pickprtbox\">\r\n <h2> {{list['route_name']}} </h2>\r\n <h3>{{list['customer_name']}} | {{list['material']}}</h3>\r\n <div class=\"pickdropprt\">\r\n <div class=\"pickprt\">\r\n <b>\r\n <h4>{{list['pickup_location']}}</h4>\r\n </b>\r\n </div>\r\n <div class=\"dropprt\">\r\n <b>\r\n <h4>{{list['delivery_location']}}</h4>\r\n </b>\r\n </div>\r\n </div>\r\n </div>\r\n </li>\r\n </ul>\r\n <p style=\"color: #fff;\" *ngIf=\"routes.length === 0\">No Route found</p>\r\n </perfect-scrollbar>\r\n </div>\r\n\r\n <div class=\"route_detail\" *ngIf=\"detailsCardEnable\">\r\n <div class=\"closebtnroutedetail\" (click)=\"detailsCardEnable = false; preventMouseout = false\">\r\n <mat-icon>clear</mat-icon>\r\n </div>\r\n <div class=\"destination\">\r\n <div class=\"duration\">\r\n <p class=\"pickprt\"><b>Pickup:</b> {{routeCardDetail?.pickup_location}}</p>\r\n <p class=\"dropprt\"><b>Delivery:</b> {{routeCardDetail?.delivery_location}} </p>\r\n </div>\r\n <span><b>Name:</b> {{routeCardDetail?.route_name}}</span>\r\n <span><b>Customer:</b> {{routeCardDetail?.customer_name}}</span>\r\n <span><b>Material:</b> {{routeCardDetail?.material}}</span>\r\n <span><b>Type:</b> {{routeCardDetail?.unit}}</span>\r\n <span><b>Distance:</b> {{routeCardDetail?.estimated_distance}}</span>\r\n <span><b>Travel Time:</b> {{routeCardDetail?.estimated_time}}</span>\r\n <span class=\"notes\"><b>Notes:</b> {{routeCardDetail?.note}}</span>\r\n </div>\r\n\r\n <div class=\"createTxt\">\r\n <small>\r\n Created by {{routeCardDetail?.created_by_name}} on {{routeCardDetail?.created_at}}\r\n </small>\r\n </div>\r\n </div>\r\n</div>\r\n",
639
+ styles: [".jobcode_detailprt{position:absolute;left:300px;bottom:10px;background:#fff;padding:10px 20px;border-radius:20px;width:calc(100% - 315px);z-index:999;box-shadow:0 0 5px 0 rgba(0,0,0,.1);height:250px;cursor:move}@media (min-width:1600px){.jobcode_detailprt{left:307px;width:calc(100% - 325px)}}.jobcode_detailprt .topheadingprt .driver_list ul{display:flex;width:450px;justify-content:flex-end}.jobcode_detailprt .topheadingprt .driver_list ul li{position:relative;margin:0 -6px 2px 0;cursor:pointer}.jobcode_detailprt .topheadingprt .driver_list ul li img{width:30px;height:30px;border-radius:100%;border:1px solid #fff}.jobcode_detailprt .topheadingprt .driver_list ul li:hover .driver_detail{display:flex}.jobcode_detailprt .topheadingprt .driver_list ul li .driver_detail{position:absolute;top:-70px;left:-50px;display:none;will-change:transform;pointer-events:none;border-radius:10px;box-shadow:0 4px 4px 0 rgba(0,0,0,.14);width:133px;background:#fff;text-align:center;padding:10px;flex-direction:column;font-size:.8125rem}.jobcode_detailprt .topheadingprt .driver_list ul li .driver_detail b{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:135px}.jobcode_detailprt .topheadingprt .driver_list ul li .driver_detail span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:117px;display:block}.jobcode_detailprt .topheadingprt .driver_list ul li .driver_detail:after{width:0;height:0;border-top:15px solid #fff;border-left:10px solid transparent;border-right:10px solid transparent;z-index:1;content:\"\";position:absolute;filter:drop-shadow(0 3px 1px rgba(0,0,0,.2));bottom:-14px;left:50%;transform:translateX(-50%)}.jobcode_detailprt .topheadingprt .driver_list ul li.extraicon{background:#fff;width:30px;height:30px;border-radius:100%;display:flex;justify-content:center;align-items:center;margin:0 0 0 10px;border:1px solid #eee}.jobcode_detailprt .close{position:absolute;top:10px;right:20px;background:#e8e8e8;border-radius:100%;width:30px;height:30px;display:flex;justify-content:center;align-items:center;cursor:pointer}@keyframes autoslide{to{transform:translateX(calc(90vw - 100%))}0%{transform:translateX(0)}}.jobcode_detailprt .job_details_area{padding:15px 0}.jobcode_detailprt .job_details_area .detailnameprt{display:flex;justify-content:space-between}.jobcode_detailprt .job_details_area .detailnameprt span{display:flex;flex-direction:column;font-size:.875rem;color:#767676}.jobcode_detailprt .job_details_area .detailnameprt span b{font-size:.9375rem;font-weight:500;color:#000}.route_listprt .listing_toggle{background:#fff;border-radius:15px;padding:5px;position:absolute;right:10px;top:20px;cursor:pointer}.route_listprt .listing_toggle img{width:28px}.route_listprt .listing_box{background:#282828;height:100vh;position:fixed;right:0;top:0;z-index:1111;box-shadow:-3px 0 5px 0 hsla(0,0%,100%,.08);transition:.5s;-webkit-transition:.5s;-moz-transition:.5s;width:0;border-radius:40px 0 0 0;opacity:0}.route_listprt .listing_box .closebtn{display:none}.route_listprt .listing_box ul{padding:0 20px 0 0}.route_listprt .listing_box ul li{background:#4a4a4a;padding:10px 15px;border-radius:15px;display:flex;margin-bottom:10px;position:relative;height:inherit}@media (min-width:1600px){.route_listprt .listing_box ul li{padding:6px 15px;margin-bottom:5px}}.route_listprt .listing_box ul li .iconprt{display:flex;flex-direction:column}.route_listprt .listing_box ul li .iconprt span{display:flex;align-items:center;margin-bottom:32px}.route_listprt .listing_box ul li .iconprt span input[type=checkbox]{width:100%;height:100%;margin-right:10px;opacity:0;position:absolute;left:0;margin-left:0;top:0;z-index:3;cursor:pointer}.route_listprt .listing_box ul li .iconprt span input[type=checkbox]:checked+label{background:url(../../../assets/images/fill-check.png) 16px 15px no-repeat}.route_listprt .listing_box ul li .iconprt span label{background:url(../../../assets/images/blank-check.png) 16px 15px no-repeat;width:100%;position:relative;z-index:2;font-size:12px;color:#878787;height:100%;position:absolute;top:0;left:0}.route_listprt .listing_box ul li .iconprt span .border{position:absolute;width:100%;height:100%;left:0;right:0;top:0;border-radius:15px}.route_listprt .listing_box ul li .iconprt span input:checked~.border{border:1px solid #fff}.route_listprt .listing_box ul li .iconprt span h2{margin-left:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px;padding-left:16px;font-size:.9rem;margin-bottom:0;font-weight:400;margin-top:0}.route_listprt .listing_box ul li .iconprt .statusunit{border-radius:30px;font-size:0;color:#fff;text-transform:capitalize;font-weight:500;width:20px;height:20px;text-align:center;line-height:20px;margin-bottom:7px}.route_listprt .listing_box ul li .iconprt .statusunit:first-letter{font-size:.8rem}.route_listprt .listing_box ul li .iconprt .statusunit.Ton{background:#ff7272}.route_listprt .listing_box ul li .iconprt .statusunit.Load{background:#a3c52e}.route_listprt .listing_box ul li .iconprt .statusunit.Hourly{background:#ae23d1}@media (min-width:1600px){.route_listprt .listing_box ul li .iconprt .statusunit{line-height:21px}}.route_listprt .listing_box ul li .iconprt .infoicon{z-index:5;cursor:pointer}.route_listprt .listing_box ul li .iconprt .infoicon img{width:20px;height:20px}.route_listprt .listing_box ul li .pickprtbox{margin-left:10px}.route_listprt .listing_box ul li .pickprtbox h2{font-size:.9rem;margin:3px 0 5px;white-space:nowrap;text-overflow:ellipsis;max-width:195px;overflow:hidden}.route_listprt .listing_box ul li h3{font-size:.8rem;color:#979797;font-weight:600;margin-top:0;white-space:nowrap;text-overflow:ellipsis;max-width:195px;overflow:hidden;margin-bottom:5px}.route_listprt .listing_box ul li .pickdropprt{font-size:.75rem}.route_listprt .listing_box ul li .pickdropprt .pickprt{position:relative;display:flex;align-items:center;padding-bottom:10px}.route_listprt .listing_box ul li .pickdropprt .pickprt span{padding-left:0;padding-right:20px;display:block}.route_listprt .listing_box ul li .pickdropprt .pickprt b{position:relative}.route_listprt .listing_box ul li .pickdropprt .pickprt b:after{background:#bcbcbc;width:1px;height:100%;left:3px;content:\"\";position:absolute;top:10px}.route_listprt .listing_box ul li .pickdropprt .pickprt h4{position:relative;padding-left:15px;margin:0;line-height:18px;color:#bcbcbc;font-weight:400;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}.route_listprt .listing_box ul li .pickdropprt .pickprt h4:before{background:#bcbcbc;top:4px;left:0;position:absolute;content:\"\";width:7px;height:7px;border-radius:100%}.route_listprt .listing_box ul li .pickdropprt .dropprt{position:relative;padding-bottom:10px;display:flex;align-items:center}.route_listprt .listing_box ul li .pickdropprt .dropprt span{padding-left:0;padding-right:20px;display:block}.route_listprt .listing_box ul li .pickdropprt .dropprt b{position:relative}.route_listprt .listing_box ul li .pickdropprt .dropprt b:after{background:#bcbcbc;width:1px;height:12px;left:3px;content:\"\";position:absolute;top:-7px}.route_listprt .listing_box ul li .pickdropprt .dropprt h4{position:relative;padding-left:15px;margin:0;line-height:18px;color:#bcbcbc;font-weight:400;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical}.route_listprt .listing_box ul li .pickdropprt .dropprt h4:before{background:#bcbcbc;top:4px;left:0;position:absolute;content:\"\";width:7px;height:7px;border-radius:100%}.route_listprt.show .listing_box{width:300px;max-width:300px;flex:0 0 350px;transition:.5s;-webkit-transition:.5s;-moz-transition:.5s;padding:40px 0 40px 20px;opacity:1}.route_listprt.show .listing_box h2{color:#fff;white-space:nowrap}.route_listprt.show .listing_box .closebtn{position:absolute;left:-33px;top:50px;background:#282828;color:#fff;padding:8px;border-top-left-radius:15px;border-bottom-left-radius:15px;cursor:pointer;box-shadow:-4px 2px 5px 0 hsla(0,0%,100%,.08);display:block}.overlap{z-index:9999}.btnprt{display:flex;justify-content:space-between;align-items:center;padding-right:20px}.btnprt h2{margin:0}.btnprt button{font-size:15px;padding:8px 20px;border-radius:5%;background-color:#326ad3;color:#fff;border:none;border-radius:10px;box-shadow:none;outline:none}.hidden{display:none}.route_detail{background:#282828;position:absolute;width:260px;top:50%;transform:translateY(-50%);right:310px;border-radius:20px;padding:10px;box-shadow:0 0 5px 0 hsla(0,0%,100%,.21)}.route_detail .destination .duration{background:#444343;border:1px solid #918e8e;padding:10px;color:#fff}.route_detail .destination .duration b{color:#fff}.route_detail .destination .dropprt:before,.route_detail .destination .dropprt b:before,.route_detail .destination .pickprt:before,.route_detail .destination .pickprt b:before{background:#fff}.route_detail .destination span{line-height:20px;color:#fff;padding:3px 0}.route_detail .destination span b{color:#fff}.route_detail .destination span.notes{max-height:200px;overflow:auto}.createTxt small{color:#fff;font-size:.7rem}.closebtnroutedetail{box-shadow:0 0 5px 0 rgba(0,0,0,.11);border-radius:100%;width:30px;height:30px;display:flex;justify-content:center;align-items:center;cursor:pointer;background:#f5f5f5;position:absolute;top:-7px;left:-11px}"]
640
+ },] }
641
+ ];
642
+ JobCodeComponent.ctorParameters = function () { return [
643
+ { type: coolmapServices.UtilsService },
644
+ { type: coolmapServices.CoolmapService }
645
+ ]; };
646
+ JobCodeComponent.propDecorators = {
647
+ jobdetail: [{ type: core.Input }],
648
+ clearJobDetails: [{ type: core.Output }]
649
+ };
650
+
651
+ var JobcodeStatusComponent = /** @class */ (function () {
652
+ function JobcodeStatusComponent() {
653
+ }
654
+ return JobcodeStatusComponent;
655
+ }());
656
+ JobcodeStatusComponent.decorators = [
657
+ { type: core.Component, args: [{
658
+ selector: 'app-jobcode-status',
659
+ template: "<div class=\"statusprt\">\r\n <span class=\"done\"> Done - {{jobValue['values']['Done']}} </span>\r\n <span class=\"ongoing\"> Ongoing - {{jobValue['values']['Ongoing']}} </span>\r\n <span class=\"open\"> Open - {{jobValue['values']['Open']}} </span>\r\n</div>\r\n",
660
+ styles: [".statusprt span{padding:10px;font-size:.9rem}.statusprt span.done{border:2px solid #0b843c;color:#0b843c}.statusprt span.done:hover{background:#0b843c;color:#fff}.statusprt span.ongoing{border:2px solid #eecb27;color:#eecb27}.statusprt span.ongoing:hover{background:#eecb27;color:#fff}.statusprt span.open{border:2px solid #12afcb;color:#12afcb}.statusprt span.open:hover{background:#12afcb;color:#fff}"]
661
+ },] }
662
+ ];
663
+ JobcodeStatusComponent.ctorParameters = function () { return []; };
664
+ JobcodeStatusComponent.propDecorators = {
665
+ jobValue: [{ type: core.Input }]
666
+ };
667
+
668
+ var JobRouteListComponent = /** @class */ (function () {
669
+ function JobRouteListComponent(utils, coolMap) {
670
+ var _this = this;
671
+ var _a;
672
+ this.utils = utils;
673
+ this.coolMap = coolMap;
674
+ this.changeNav = new core.EventEmitter();
675
+ this.filterForm = new forms.FormGroup({ search: new forms.FormControl() });
676
+ this.changeRoutes = new core.EventEmitter();
677
+ this.changeSelectedRoute = new core.EventEmitter();
678
+ this.filters = [];
679
+ this.filteredOptions = (_a = this.filterForm.get('search')) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(operators.startWith(''), operators.map(function (value) { return _this.utils.filter(value, _this.filters); }));
680
+ }
681
+ JobRouteListComponent.prototype.filterSearch = function (e) {
682
+ var _this = this;
683
+ this.changeNav.emit({ type: 'Addroute' });
684
+ this.preventListUpdate = true;
685
+ this.filterForm.controls.search.setValue(null);
686
+ this.filters = [{ name: e.source.value.label, type: e.source.value.type, value: e.source.value }];
687
+ var filteredRoutes = this.utils.getSearchResults(this.masterRoutes, [{ name: e.source.value.label, type: e.source.value.type, value: e.source.value }]);
688
+ this.changeRoutes.emit(filteredRoutes);
689
+ this.selectedRoute.selected.forEach(function (item) {
690
+ var routeData = filteredRoutes.find(function (x) { return x.route_id === item.route_id; });
691
+ if (!routeData) {
692
+ _this.selectedRoute.toggle(item);
693
+ _this.changeSelectedRoute.emit(_this.selectedRoute);
694
+ _this.coolMap.removeRouteAndMarker(item['route_id']).then(function (res) {
695
+ _this.coolMap.extendReBound();
696
+ });
697
+ }
698
+ });
699
+ };
700
+ JobRouteListComponent.prototype.removeFromFilter = function (filter) {
701
+ this.changeNav.emit({ type: 'Addroute' });
702
+ var index = this.filters.indexOf(filter);
703
+ if (index >= 0) {
704
+ this.filters = [];
705
+ this.changeRoutes.emit(this.masterRoutes);
706
+ }
707
+ };
708
+ return JobRouteListComponent;
709
+ }());
710
+ JobRouteListComponent.decorators = [
711
+ { type: core.Component, args: [{
712
+ selector: 'app-job-route-list',
713
+ template: "<div class=\"searchprt\">\r\n <form [formGroup]=\"filterForm\">\r\n <mat-form-field class=\"full-width\">\r\n <input matInput [matChipInputFor]=\"chipList\" formControlName=\"search\" [matAutocomplete]=\"auto\" placeholder=\"Search\">\r\n <mat-icon matSuffix *ngIf=\"!utils.conveySearchIcon(filterForm.value.search)\">search</mat-icon>\r\n <button mat-button matSuffix mat-icon-button aria-label=\"Clear\" (click)=\"filterForm.reset()\" *ngIf=\"utils.conveySearchIcon(filterForm.value.search)\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" (onSelectionChange)=\"filterSearch($event)\"\r\n [value]=\"option\">\r\n {{option.type | titlecase }}: {{option['label']}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n</form>\r\n</div>\r\n<div class=\"chip-list\">\r\n <mat-chip-list #chipList aria-label=\"Filter selection\">\r\n <mat-chip *ngFor=\"let filter of filters\" (removed)=\"removeFromFilter(filter)\">\r\n {{filter.type | titlecase }}: {{filter.name}}\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n </mat-chip-list>\r\n</div>\r\n",
714
+ styles: [".searchprt{padding-right:20px}"]
715
+ },] }
716
+ ];
717
+ JobRouteListComponent.ctorParameters = function () { return [
718
+ { type: coolmapServices.UtilsService },
719
+ { type: coolmapServices.CoolmapService }
720
+ ]; };
721
+ JobRouteListComponent.propDecorators = {
722
+ changeNav: [{ type: core.Output }],
723
+ routes: [{ type: core.Input }],
724
+ selectedRoute: [{ type: core.Input }],
725
+ changeRoutes: [{ type: core.Output }],
726
+ changeSelectedRoute: [{ type: core.Output }],
727
+ masterRoutes: [{ type: core.Input }]
728
+ };
729
+
730
+ var JobcodeOverviewComponent = /** @class */ (function () {
731
+ function JobcodeOverviewComponent() {
732
+ this.label = coolmapServices.JobCodeOverviewData;
733
+ this.overViewEnum = coolmapServices.JobCodeOverviewEnum;
734
+ }
735
+ return JobcodeOverviewComponent;
736
+ }());
737
+ JobcodeOverviewComponent.decorators = [
738
+ { type: core.Component, args: [{
739
+ selector: 'app-jobcode-overview',
740
+ template: "<div class=\"detail_view m-40\">\r\n <ng-container *ngFor=\"let item of label\">\r\n <span [class.pickprt]=\"item === 'pickup_location'\" [class.dropprt]=\"item === 'delivery_location'\">\r\n <label>{{overViewEnum[item]}}</label>\r\n <b> {{jobValue[item] ? jobValue[item] : 'N/A'}} </b>\r\n </span>\r\n </ng-container>\r\n</div>\r\n",
741
+ styles: [".detail_view{display:flex;flex-direction:row;justify-content:space-between}.detail_view span{display:flex;flex-direction:column;font-size:.8125rem;width:15%;margin:0 7px 0 0}.detail_view span.dropprt,.detail_view span.pickprt{width:20%}.detail_view span label{font-size:.8125rem;font-weight:400;color:#767676;padding-bottom:8px}.detail_view span b{font-weight:500}"]
742
+ },] }
743
+ ];
744
+ JobcodeOverviewComponent.ctorParameters = function () { return []; };
745
+ JobcodeOverviewComponent.propDecorators = {
746
+ jobValue: [{ type: core.Input }]
747
+ };
748
+
749
+ var DialogComponent = /** @class */ (function () {
750
+ function DialogComponent(dialogRef, data) {
751
+ var _this = this;
752
+ this.dialogRef = dialogRef;
753
+ this.data = data;
754
+ this.body = 'Are you sure you want to delete?';
755
+ this.positive = 'Delete';
756
+ this.negative = 'Cancel';
757
+ ['body', 'positive', 'negative'].map(function (elem) {
758
+ if (_this.data[elem] !== undefined) {
759
+ _this[elem] = _this.data[elem];
760
+ }
761
+ });
762
+ }
763
+ DialogComponent.prototype.onClose = function (result) { this.dialogRef.close(result); };
764
+ return DialogComponent;
765
+ }());
766
+ DialogComponent.decorators = [
767
+ { type: core.Component, args: [{
768
+ selector: 'app-dialog',
769
+ template: "<div class=\"dialogbox\">\r\n <h2>{{body}}</h2>\r\n <div class=\"twobtnprt\">\r\n <button class=\"delbtn\" (click)=\"onClose(true)\">{{positive}}</button>\r\n <button class=\"closebtn\" (click)=\"onClose(false)\">{{negative}}</button>\r\n </div>\r\n</div>\r\n",
770
+ styles: [".dialogbox{display:flex;flex-direction:column}.dialogbox h2{font-size:1.5rem}.dialogbox .twobtnprt{display:flex;justify-content:center;margin-top:10px}.closebtn{background:#000}.closebtn,.delbtn{color:#fff;border-radius:30px;padding:10px 18px;margin:0 10px;font-size:1rem}.delbtn{background:red}"]
771
+ },] }
772
+ ];
773
+ DialogComponent.ctorParameters = function () { return [
774
+ { type: dialog.MatDialogRef },
775
+ { type: undefined, decorators: [{ type: core.Inject, args: [dialog.MAT_DIALOG_DATA,] }] }
776
+ ]; };
777
+
778
+ var AddRouteComponent = /** @class */ (function () {
779
+ function AddRouteComponent(coolMapService, utils, dialog) {
780
+ var _this = this;
781
+ this.coolMapService = coolMapService;
782
+ this.utils = utils;
783
+ this.dialog = dialog;
784
+ this.changeNav = new core.EventEmitter();
785
+ this.updateRouteList = new core.EventEmitter();
786
+ this.pickupOptions = [];
787
+ this.deliveryOptions = [];
788
+ this.requestParmsForRouteDetails = { pickup_lat_lng: '', delivery_lat_lng: '' };
789
+ this.customersList = [];
790
+ this.unitsList = [];
791
+ this.materialsList = [];
792
+ this.preventSave = false;
793
+ this.preventInitialSave = false;
794
+ this.destroyer$ = new rxjs.Subject();
795
+ this.enablePopUp = false;
796
+ this.prevantPopupClose = false;
797
+ this.enableForm = false;
798
+ this.formInit();
799
+ this.utils.getrouteDetailsUtility.subscribe(function (res) {
800
+ if (res) {
801
+ if (res['event'] !== 'click' && !_this.prevantPopupClose) {
802
+ _this.enablePopUp = res['event'];
803
+ }
804
+ else if (_this.enablePopUp && !_this.prevantPopupClose) {
805
+ _this.prevantPopupClose = true;
806
+ }
807
+ if (res['event'] !== 'click' && !res['event'] && _this.prevantPopupClose) {
808
+ _this.popupDetails = _this.utils.getdictValue('route-detailsv2');
809
+ }
810
+ else {
811
+ _this.popupDetails = res['route'];
812
+ }
813
+ if (_this.enablePopUp)
814
+ _this.popupDetails['created_at'] = _this.utils.getDateFormat(new Date(_this.popupDetails['created_at']), '/');
815
+ }
816
+ });
817
+ }
818
+ AddRouteComponent.prototype.filterCustomerList = function () {
819
+ var _this = this;
820
+ this.customersList$ = this.addRouteForm.controls['customer_name'].valueChanges.pipe(operators.startWith(''), operators.map(function (value) { return _this._filter(value || ''); }));
821
+ };
822
+ AddRouteComponent.prototype._filter = function (value) {
823
+ var filterValue = value.toLowerCase();
824
+ return this.customersList.filter(function (option) { return option['customer_name'].toLowerCase().includes(filterValue); });
825
+ };
826
+ AddRouteComponent.prototype.ngOnChanges = function (changes) {
827
+ if (changes['routeData'] && !changes['routeData']['currentValue'])
828
+ this.inIt(null);
829
+ };
830
+ AddRouteComponent.prototype.openDialog = function () {
831
+ var _this = this;
832
+ var dialogRef = this.dialog.open(DialogComponent, {
833
+ data: { body: 'Are you sure you want to delete this route?' },
834
+ });
835
+ dialogRef.afterClosed().subscribe(function (res) {
836
+ if (res) {
837
+ _this.deleteRoute();
838
+ }
839
+ });
840
+ };
841
+ AddRouteComponent.prototype.editEvent = function () {
842
+ this.prevantPopupClose = false;
843
+ this.enableForm = true;
844
+ this.enablePopUp = false;
845
+ this.popupDetails['prevent'] = false;
846
+ this.utils.removeMapEntity.next(this.popupDetails);
847
+ this.inIt(this.popupDetails);
848
+ };
849
+ AddRouteComponent.prototype.inIt = function (changes) {
850
+ if (changes) {
851
+ if (!changes['prevent']) {
852
+ this.preventSave = false;
853
+ this.formControlValue();
854
+ this.patchFormValue(changes);
855
+ this.checkAndFetchRouteInformation(true);
856
+ }
857
+ }
858
+ if (!changes) {
859
+ this.enableForm = true;
860
+ this.preventSave = true;
861
+ this.patchFormValue();
862
+ this.checkAndFetchRouteInformation();
863
+ }
864
+ };
865
+ AddRouteComponent.prototype.ngOnInit = function () {
866
+ this.fetchCustomersList();
867
+ this.fetchUnitsList();
868
+ this.fetchMaterialsList();
869
+ this.formControlValue();
870
+ };
871
+ AddRouteComponent.prototype.ngAfterViewInit = function () {
872
+ var _this = this;
873
+ rxjs.fromEvent(this.filterPickup.nativeElement, 'keyup').pipe(operators.distinctUntilChanged(), operators.debounceTime(150)).pipe(operators.takeUntil(this.destroyer$)).subscribe(function () {
874
+ _this.utils.fetchAutoCompleteLocations(_this.filterPickup.nativeElement.value).pipe(operators.takeUntil(_this.destroyer$)).subscribe(function (res) {
875
+ _this.pickupOptions = res.features;
876
+ });
877
+ });
878
+ rxjs.fromEvent(this.filterDelivery.nativeElement, 'keyup').pipe(operators.distinctUntilChanged(), operators.debounceTime(150)).pipe(operators.takeUntil(this.destroyer$)).subscribe(function () {
879
+ _this.utils.fetchAutoCompleteLocations(_this.filterDelivery.nativeElement.value).pipe(operators.takeUntil(_this.destroyer$)).subscribe(function (res) {
880
+ _this.deliveryOptions = res.features;
881
+ });
882
+ });
883
+ };
884
+ AddRouteComponent.prototype.formControlValue = function () {
885
+ var _this = this;
886
+ var _a, _b;
887
+ (_a = this.addRouteForm.controls['pickup_location']) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
888
+ if (_this.addRouteForm.value.pickup_location && res !== _this.addRouteForm.value.pickup_location) {
889
+ _this.addRouteForm.patchValue({
890
+ pickup_lat_lng: '',
891
+ });
892
+ _this.addRouteForm.controls['pickup_lat_lng'].markAsTouched();
893
+ }
894
+ });
895
+ (_b = this.addRouteForm.controls['delivery_location']) === null || _b === void 0 ? void 0 : _b.valueChanges.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
896
+ if (_this.addRouteForm.value.delivery_location && res !== _this.addRouteForm.value.delivery_location) {
897
+ _this.addRouteForm.patchValue({
898
+ delivery_lat_lng: '',
899
+ });
900
+ _this.addRouteForm.controls['delivery_lat_lng'].markAsTouched();
901
+ }
902
+ });
903
+ };
904
+ AddRouteComponent.prototype.formInit = function () {
905
+ this.addRouteForm = new forms.FormGroup({
906
+ route_name: new forms.FormControl('', [forms.Validators.required]),
907
+ customer_name: new forms.FormControl({ value: '', disabled: true }, [forms.Validators.required]),
908
+ materials_id: new forms.FormControl('', [forms.Validators.required]),
909
+ unit_id: new forms.FormControl('', [forms.Validators.required]),
910
+ path: new forms.FormControl('', [forms.Validators.required]),
911
+ pickup_location: new forms.FormControl('', [forms.Validators.required]),
912
+ pickup_lat_lng: new forms.FormControl('', [forms.Validators.required]),
913
+ delivery_location: new forms.FormControl('', [forms.Validators.required]),
914
+ delivery_lat_lng: new forms.FormControl('', [forms.Validators.required]),
915
+ estimated_distance: new forms.FormControl('', [forms.Validators.required]),
916
+ estimated_time: new forms.FormControl('', [forms.Validators.required]),
917
+ note: new forms.FormControl('', [forms.Validators.maxLength(2048)]),
918
+ });
919
+ };
920
+ AddRouteComponent.prototype.patchFormValue = function (data) {
921
+ var _this = this;
922
+ this.addRouteForm.reset();
923
+ this.addRouteForm.patchValue(data);
924
+ this.routeId = data === null || data === void 0 ? void 0 : data.route_id;
925
+ this.routeDetails = data ? { pickup_location: data.pickup_location, delivery_location: data.delivery_location } : null;
926
+ this.addRouteForm.valueChanges.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
927
+ if (res) {
928
+ if (_this.preventInitialSave)
929
+ _this.preventInitialSave = false;
930
+ }
931
+ });
932
+ this.filterCustomerList();
933
+ };
934
+ AddRouteComponent.prototype.fetchCustomersList = function () {
935
+ var _this = this;
936
+ this.utils.getData(this.portalName + "/company/list/view").pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
937
+ if (res) {
938
+ _this.customersList = res.data;
939
+ _this.filterCustomerList();
940
+ _this.addRouteForm.controls['customer_name'].enable();
941
+ }
942
+ });
943
+ };
944
+ AddRouteComponent.prototype.fetchUnitsList = function () {
945
+ var _this = this;
946
+ this.utils.getData(this.portalName + "/unit/list/view").pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
947
+ if (res) {
948
+ _this.unitsList = res.data;
949
+ }
950
+ });
951
+ };
952
+ AddRouteComponent.prototype.fetchMaterialsList = function () {
953
+ var _this = this;
954
+ this.utils.getData(this.portalName + "/material/list/view").pipe(operators.takeUntil(this.destroyer$)).subscribe((function (res) {
955
+ res.data.sort(function (a, b) { return a.material.localeCompare(b.material); });
956
+ _this.materialsList = res.data;
957
+ }));
958
+ };
959
+ AddRouteComponent.prototype.selectedLongLat = function (type, event) {
960
+ if (type === 'pickup') {
961
+ this.addRouteForm.patchValue({
962
+ pickup_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
963
+ });
964
+ this.coolMapService.clearBoundWithCordinates();
965
+ }
966
+ else if (type === 'delivery') {
967
+ this.addRouteForm.patchValue({
968
+ delivery_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
969
+ });
970
+ }
971
+ this.checkAndFetchRouteInformation();
972
+ };
973
+ AddRouteComponent.prototype.checkAndFetchRouteInformation = function (isinitial) {
974
+ var _this = this;
975
+ var _a, _b, _c, _d;
976
+ if (((_b = (_a = this.addRouteForm.value) === null || _a === void 0 ? void 0 : _a.delivery_lat_lng) === null || _b === void 0 ? void 0 : _b.length) > 0 && ((_d = (_c = this.addRouteForm.value) === null || _c === void 0 ? void 0 : _c.pickup_lat_lng) === null || _d === void 0 ? void 0 : _d.length) > 0 && this.addRouteForm.value.unit_id) {
977
+ var unit = this.unitsList.find(function (x) { return x.id === _this.addRouteForm.value.unit_id; });
978
+ var param = {
979
+ delivery_lat_lng: this.addRouteForm.value.delivery_lat_lng,
980
+ pickup_lat_lng: this.addRouteForm.value.pickup_lat_lng,
981
+ unit: unit === null || unit === void 0 ? void 0 : unit.type
982
+ };
983
+ this.utils.postdata('coolmap/calculate/routes/estimation', param).pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
984
+ if (res && res['path']) {
985
+ _this.addRouteForm.patchValue({
986
+ estimated_distance: res.dist, estimated_time: res.time, path: res.path
987
+ });
988
+ var path = res['path'].split(';');
989
+ path = path.map(function (ele) { return ele = _this.formateLatLong(ele); });
990
+ res['path'] = path;
991
+ var element_1 = {
992
+ type: 'FeatureCollection',
993
+ features: [{ type: 'Feature', properties: {}, geometry: { type: 'LineString', coordinates: res['path'] } }]
994
+ };
995
+ _this.coolMapService.removeRouteAndMarker(1).then(function () {
996
+ var _a, _b, _c;
997
+ var unit = _this.unitsList.find(function (x) { return x.id === _this.addRouteForm.value.unit_id; });
998
+ var materialDetails = _this.materialsList.find(function (x) { return x.material_id === _this.addRouteForm.value.materials_id; });
999
+ _this.coolMapService.loadMapProperty(element_1, 1, unit === null || unit === void 0 ? void 0 : unit.type, {
1000
+ pickup_location: (_a = _this.addRouteForm.get('pickup_location')) === null || _a === void 0 ? void 0 : _a.value,
1001
+ delivery_location: (_b = _this.addRouteForm.get('delivery_location')) === null || _b === void 0 ? void 0 : _b.value,
1002
+ route_name: (_c = _this.addRouteForm.get('route_name')) === null || _c === void 0 ? void 0 : _c.value,
1003
+ material: materialDetails === null || materialDetails === void 0 ? void 0 : materialDetails.material, unit: unit === null || unit === void 0 ? void 0 : unit.type
1004
+ }).then(function (res) { _this.preventSave = true; });
1005
+ });
1006
+ }
1007
+ else {
1008
+ _this.coolMapService.removeRouteAndMarker(1);
1009
+ _this.utils.openSnackBar(res['status'], 'error');
1010
+ }
1011
+ if (_this.routeId && isinitial)
1012
+ _this.preventInitialSave = true;
1013
+ });
1014
+ }
1015
+ else {
1016
+ this.coolMapService.removeRouteAndMarker(1);
1017
+ }
1018
+ };
1019
+ AddRouteComponent.prototype.formateLatLong = function (latlong) { return latlong ? latlong.split(',').map(function (x) { return +x; }).reverse() : null; };
1020
+ AddRouteComponent.prototype.saveRoute = function () {
1021
+ var _this = this;
1022
+ if (this.addRouteForm.valid) {
1023
+ this.preventSave = false;
1024
+ var data = this.addRouteForm.value;
1025
+ data['trucker_pay_estimate'] = null;
1026
+ data['customer_price_estimate'] = null;
1027
+ var url = this.routeId ? this.utils.postdata('coolmap/update/routes', data) : this.utils.postdata('coolmap/add/routes', data);
1028
+ if (this.routeId)
1029
+ data['id'] = this.routeId;
1030
+ url.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
1031
+ if (res.success) {
1032
+ _this.updateRouteList.emit(true);
1033
+ _this.utils.openSnackBar(res.message, 'success');
1034
+ _this.preventInitialSave = true;
1035
+ _this.preventSave = true;
1036
+ if (!_this.routeId)
1037
+ _this.changeNav.next('Addroute');
1038
+ }
1039
+ else {
1040
+ _this.utils.openSnackBar(res.message, 'error');
1041
+ _this.preventSave = true;
1042
+ }
1043
+ }, function (err) {
1044
+ if (err) {
1045
+ _this.preventSave = true;
1046
+ }
1047
+ });
1048
+ }
1049
+ else {
1050
+ this.addRouteForm.markAllAsTouched();
1051
+ }
1052
+ };
1053
+ AddRouteComponent.prototype.deleteRoute = function () {
1054
+ var _this = this;
1055
+ this.preventSave = false;
1056
+ this.utils.postdata('coolmap/delete/routes', { uuid: this.routeId }).subscribe(function (res) {
1057
+ if (res['data']['success']) {
1058
+ _this.utils.openSnackBar(res['data']['message'], 'success');
1059
+ _this.updateRouteList.emit(true);
1060
+ _this.changeNav.next('Addroute');
1061
+ _this.preventInitialSave = true;
1062
+ _this.preventSave = true;
1063
+ }
1064
+ else {
1065
+ _this.utils.openSnackBar('Somthing went wrong', 'error');
1066
+ _this.preventSave = true;
1067
+ }
1068
+ }, function (err) { _this.preventSave = true; });
1069
+ };
1070
+ AddRouteComponent.prototype.ngOnDestroy = function () {
1071
+ this.destroyer$.next(true);
1072
+ this.destroyer$.unsubscribe();
1073
+ };
1074
+ return AddRouteComponent;
1075
+ }());
1076
+ AddRouteComponent.decorators = [
1077
+ { type: core.Component, args: [{
1078
+ selector: 'app-add-route',
1079
+ template: "<div class=\"addroutebox\">\r\n <div class=\"routedetailbox\" *ngIf=\"enablePopUp\">\r\n <div class=\"closebtnroutedetail\">\r\n <mat-icon (click)=\"prevantPopupClose = false; enablePopUp = false;\">clear</mat-icon>\r\n </div>\r\n <div class=\"destination\">\r\n <div class=\"duration\">\r\n <p class=\"pickprt\"><b>Pickup:</b>{{popupDetails['pickup_location']}}</p>\r\n <p class=\"dropprt\"><b>Delivery:</b>{{popupDetails['delivery_location']}}</p>\r\n </div>\r\n <span><b>Name:</b> {{popupDetails['route_name']}}</span>\r\n <span><b>Customer:</b> {{popupDetails['customer_name']}}</span>\r\n <span><b>Material:</b> {{popupDetails['material']}}</span>\r\n <span><b>Type:</b> {{popupDetails['unit']}}</span>\r\n <span><b>Distance:</b> {{popupDetails['estimated_distance']}}</span>\r\n <span><b>Travel Time:</b> {{popupDetails['estimated_time']}}</span>\r\n\r\n <span class=\"routenotes\"><b>Notes:</b> {{popupDetails['note']}}</span>\r\n </div>\r\n <div class=\"createTxt\">\r\n <small>\r\n Created by {{popupDetails['created_by_name']}} on {{popupDetails['created_at']}}\r\n </small>\r\n <button class=\"editbtn\" (click)=\"editEvent()\">Edit</button>\r\n </div>\r\n </div>\r\n <div class=\"add_add_route_box\" cdkDrag [style.visibility]=\"!enableForm ? 'hidden' : 'visible'\">\r\n <div class=\"topheadingprt\">\r\n <h2> {{routeId? 'EDIT' : 'ADD'}} ROUTE </h2>\r\n <div class=\"buttonprt\">\r\n <button *ngIf=\"routeId\" class=\"delbtn\" (click)=\"openDialog()\">Delete</button>\r\n <button mat-raised-button type=\"submit\" class=\"closebtn\" (click)=\"changeNav.next('Addroute')\">Close</button>\r\n </div>\r\n </div>\r\n <form [formGroup]=\"addRouteForm\">\r\n <div class=\"route_form_area\">\r\n <div class=\"col-6\">\r\n <mat-form-field>\r\n <mat-label>Route Name</mat-label>\r\n <input matInput formControlName=\"route_name\" autocomplete=\"nope\" (mousedown)=\"$event.stopPropagation()\">\r\n <mat-error *ngIf=\"addRouteForm.controls['route_name'].hasError('required')\">\r\n Route Name is required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-6\">\r\n <mat-form-field>\r\n <input type=\"text\" placeholder=\"Customer Name\" matInput formControlName=\"customer_name\" [matAutocomplete]=\"auto\" (mousedown)=\"$event.stopPropagation()\">\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let customer of customersList$ | async\" [value]=\"customer['customer_name']\">\r\n {{customer['customer_name']}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n <mat-error *ngIf=\"addRouteForm.controls['customer_name'].hasError('required')\">\r\n Customer name is required.\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"col-6\">\r\n <mat-form-field>\r\n <mat-label>Pickup</mat-label>\r\n <input type=\"text\" placeholder=\"Search...\" matInput #filterPickup [matAutocomplete]=\"pickupAutocomplete\"\r\n formControlName=\"pickup_location\" (mousedown)=\"$event.stopPropagation()\">\r\n\r\n <mat-autocomplete #pickupAutocomplete=\"matAutocomplete\">\r\n <mat-option (click)=\"selectedLongLat('pickup', option)\" *ngFor=\"let option of pickupOptions\"\r\n [value]=\"option?.place_name\">\r\n {{option?.place_name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n <mat-error *ngIf=\"addRouteForm.controls['pickup_lat_lng'].touched && addRouteForm.controls['pickup_lat_lng'].hasError('required')\">\r\n Please select pickup location from the list.\r\n </mat-error>\r\n </div>\r\n <div class=\"col-6\">\r\n <mat-form-field>\r\n <mat-label>Delivery</mat-label>\r\n <input type=\"text\" placeholder=\"Search...\" matInput #filterDelivery [matAutocomplete]=\"deliveryAutocomplete\"\r\n formControlName=\"delivery_location\" (mousedown)=\"$event.stopPropagation()\">\r\n <mat-autocomplete #deliveryAutocomplete=\"matAutocomplete\">\r\n <mat-option (click)=\"selectedLongLat('delivery', option)\" *ngFor=\"let option of deliveryOptions\"\r\n [value]=\"option?.place_name\">\r\n {{option?.place_name}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n <mat-error *ngIf=\"addRouteForm.controls['delivery_lat_lng'].touched && addRouteForm.controls['delivery_lat_lng'].hasError('required')\">\r\n Please select delivery location from the list.\r\n </mat-error>\r\n </div>\r\n <div class=\"col-6\">\r\n <mat-form-field>\r\n <mat-label>Notes</mat-label>\r\n <textarea style=\"height: 18px; resize: none;\" matInput name=\"\" id=\"\" cols=\"30\" rows=\"10\" formControlName=\"note\" autocomplete=\"nope\" (mousedown)=\"$event.stopPropagation()\"></textarea>\r\n <mat-error *ngIf=\"addRouteForm.controls['note'].hasError('maxlength')\">\r\n Notes should be within 2048 characters.\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"col-6 d-flex\">\r\n <div class=\"inputbox m-0\">\r\n <mat-form-field>\r\n <mat-label>Unit type</mat-label>\r\n <mat-select formControlName=\"unit_id\" (selectionChange)=\"checkAndFetchRouteInformation()\" (mousedown)=\"$event.stopPropagation()\">\r\n <mat-option *ngFor=\"let unit of unitsList\" [value]=\"unit?.id\"> {{unit?.type}} </mat-option>\r\n </mat-select>\r\n <mat-error *ngIf=\"addRouteForm.controls['unit_id'].hasError('required')\">\r\n Unit is required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div class=\"inputbox m-0\">\r\n <mat-form-field>\r\n <mat-label>Material</mat-label>\r\n <mat-select formControlName=\"materials_id\" (mousedown)=\"$event.stopPropagation()\">\r\n <mat-option *ngFor=\"let material of materialsList\" [value]=\"material?.material_id\"> {{material?.material}}\r\n </mat-option>\r\n </mat-select>\r\n <mat-error *ngIf=\"addRouteForm.controls['materials_id'].hasError('required')\">\r\n Meterial is required\r\n </mat-error>\r\n </mat-form-field>\r\n </div>\r\n </div>\r\n <div class=\"col-6\">\r\n <app-estimation-display *ngIf=\"addRouteForm?.value?.pickup_lat_lng && addRouteForm?.value?.delivery_lat_lng\" [value]=\"addRouteForm['value']\"></app-estimation-display>\r\n </div>\r\n <button mat-raised-button type=\"submit\" (click)=\"saveRoute()\" *ngIf=\"preventSave\"\r\n [disabled]=\"addRouteForm.invalid && preventSave || preventInitialSave\">{{routeId? 'Update' : 'Save'}}\r\n </button>\r\n <div class=\"loader\">\r\n <mat-spinner *ngIf=\"!preventSave\"></mat-spinner>\r\n </div>\r\n </div>\r\n </form>\r\n </div>\r\n</div>\r\n",
1080
+ styles: [".addroutebox{width:calc(100% - 315px);position:absolute;left:300px;bottom:10px;z-index:999;display:flex;justify-content:space-between;align-items:flex-start}.addroutebox .routedetailbox{max-width:300px;padding:10px;background-color:#fff;border-radius:20px;margin-right:20px}@media (min-width:1600px){.addroutebox .routedetailbox{max-width:280px}}.addroutebox .editbtn{background:#326ad3;padding:10px 25px;color:#fff;font-size:.8125rem;border-radius:30px;float:right}.add_add_route_box{background:#fff;padding:10px 20px;border-radius:20px;box-shadow:2px 4px 4px 2px rgba(0,0,0,.14);height:370px;width:100%;position:relative;cursor:move}.add_add_route_box .route_form_area{display:flex;flex-wrap:wrap;justify-content:space-between}.add_add_route_box .route_form_area .col-6{width:48%;margin-top:15px;justify-content:space-between}.add_add_route_box .route_form_area .col-6 .inputbox{width:47%}.add_add_route_box .route_form_area .col-6 span{font-size:.875rem}.add_add_route_box .route_form_area button{background:#326ad3;padding:0 18px;color:#fff;font-size:.8125rem;border-radius:30px;position:absolute;right:18px;top:20px}.closebtn{background:#000;padding:0 18px;margin-left:10px}.closebtn,.delbtn{color:#fff;border-radius:30px}.delbtn{background:red;padding:10px 18px}.add_route_listingpart .listing_toggle{background:#fff;border-radius:15px;padding:8px 10px;position:absolute;right:10px;top:30px;cursor:pointer}.listing_box{background:#282828;height:100vh;position:fixed;right:0;top:0;z-index:1111;box-shadow:-3px 0 5px 0 hsla(0,0%,100%,.08);transition:.5s;-webkit-transition:.5s;-moz-transition:.5s;width:0;border-radius:40px 0 0 40px;opacity:0}.listing_box .closebtn{display:none}.show .listing_box{width:250px;max-width:250px;flex:0 0 250px;transition:.5s;-webkit-transition:.5s;-moz-transition:.5s;padding:40px 0 40px 20px;opacity:1}@media (min-width:1600px){.show .listing_box{width:320px;max-width:320px;flex:0 0 320px}}.show .listing_box h2{color:#fff;white-space:nowrap}.show .listing_box ul{padding:0 20px 0 0}.show .listing_box ul li{background:#4a4a4a;padding:15px;border-radius:15px;display:flex;margin-bottom:15px}.show .listing_box ul li .companayIcon{width:40px;height:40px;border-radius:10px;background:#fff;margin-right:10px;display:flex;justify-content:center;align-items:center}.show .listing_box ul li .company_cont{width:calc(100% - 50px)}.show .listing_box ul li .company_cont h3{color:#fff;font-size:15px;font-weight:400;margin:0;text-overflow:ellipsis;max-width:129px;-webkit-box-orient:vertical;white-space:nowrap;overflow:hidden}@media (min-width:1600px){.show .listing_box ul li .company_cont h3{max-width:170px}}.show .listing_box ul li .company_cont p{color:#bcbcbc;font-size:12px;margin:5px 0;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;line-height:16px}.show .closebtn{position:absolute;left:-33px;top:50px;background:#282828;color:#fff;padding:8px;border-top-left-radius:15px;border-bottom-left-radius:15px;cursor:pointer;box-shadow:-4px 2px 5px 0 hsla(0,0%,100%,.08);display:block}.loader{position:absolute;width:95%;height:100%;display:flex;justify-content:center;align-items:center;pointer-events:none}.buttonprt{margin-right:83px}.destination .duration{padding:10px}.destination span{padding:5px 0}.closebtnroutedetail{box-shadow:0 0 5px 0 rgba(0,0,0,.11);border-radius:100%;width:30px;height:30px;display:flex;justify-content:center;align-items:center;cursor:pointer;background:#fff;position:absolute;top:-11px;left:-11px}.routenotes{max-height:170px;overflow:auto}"]
1081
+ },] }
1082
+ ];
1083
+ AddRouteComponent.ctorParameters = function () { return [
1084
+ { type: coolmapServices.CoolmapService },
1085
+ { type: coolmapServices.UtilsService },
1086
+ { type: dialog.MatDialog }
1087
+ ]; };
1088
+ AddRouteComponent.propDecorators = {
1089
+ filterPickup: [{ type: core.ViewChild, args: ['filterPickup',] }],
1090
+ filterDelivery: [{ type: core.ViewChild, args: ['filterDelivery',] }],
1091
+ changeNav: [{ type: core.Output }],
1092
+ updateRouteList: [{ type: core.Output }],
1093
+ routeData: [{ type: core.Input }],
1094
+ portalName: [{ type: core.Input }]
1095
+ };
1096
+
1097
+ var AddRouteNavComponent = /** @class */ (function () {
1098
+ function AddRouteNavComponent(utils) {
1099
+ var _this = this;
1100
+ var _a;
1101
+ this.utils = utils;
1102
+ this.filterForm = new forms.FormGroup({ search: new forms.FormControl() });
1103
+ this.filters = [];
1104
+ this.loaderVal = false;
1105
+ this.routes = [];
1106
+ this.changeNav = new core.EventEmitter();
1107
+ this.navValue = '';
1108
+ this.addemit = new core.EventEmitter();
1109
+ this.updateRouteList = false;
1110
+ this.destroyer$ = new rxjs.Subject();
1111
+ this.preventListUpdate = false;
1112
+ this.filteredOptions = (_a = this.filterForm.get('search')) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(operators.startWith(''), operators.map(function (value) { return _this.utils.filter(value, _this.filters); }));
1113
+ }
1114
+ AddRouteNavComponent.prototype.showAddForm = function () { this.changeNav.emit('addForm'); this.addemit.emit(''); };
1115
+ AddRouteNavComponent.prototype.filterSearch = function (e) {
1116
+ this.changeNav.emit({ type: 'Addroute' });
1117
+ this.preventListUpdate = true;
1118
+ this.filterForm.controls.search.setValue(null);
1119
+ this.filters = [{ name: e.source.value.label, type: e.source.value.type, value: e.source.value }];
1120
+ };
1121
+ AddRouteNavComponent.prototype.removeFromFilter = function (filter) {
1122
+ this.changeNav.emit({ type: 'Addroute' });
1123
+ var index = this.filters.indexOf(filter);
1124
+ if (index >= 0) {
1125
+ this.filters = [];
1126
+ }
1127
+ };
1128
+ AddRouteNavComponent.prototype.ngAfterViewInit = function () { this.getRouteList(); };
1129
+ AddRouteNavComponent.prototype.ngOnChanges = function (changes) {
1130
+ if (changes['updateRouteList'] && changes['updateRouteList']['currentValue'])
1131
+ this.getRouteList();
1132
+ if (changes['navValue'] && (changes['navValue']['previousValue'] === 'addForm') && !this.preventListUpdate)
1133
+ this.getRouteList();
1134
+ };
1135
+ AddRouteNavComponent.prototype.getRoute = function (event) {
1136
+ if (event['type'] === 'editroute') {
1137
+ this.addemit.emit(event);
1138
+ }
1139
+ };
1140
+ AddRouteNavComponent.prototype.getRouteList = function () {
1141
+ var _this = this;
1142
+ this.utils.getData('coolmap/routes/all').pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
1143
+ if (res) {
1144
+ _this.filters = [];
1145
+ _this.routes = res['data'];
1146
+ _this.preventListUpdate = false;
1147
+ _this.utils.clearOptions();
1148
+ _this.routes.forEach(function (ele) { _this.utils.makeOptions(ele); });
1149
+ }
1150
+ });
1151
+ };
1152
+ AddRouteNavComponent.prototype.resetSearch = function () { this.changeNav.emit('Addroute'); };
1153
+ AddRouteNavComponent.prototype.ngOnDestroy = function () {
1154
+ this.destroyer$.next(true);
1155
+ this.destroyer$.unsubscribe();
1156
+ };
1157
+ return AddRouteNavComponent;
1158
+ }());
1159
+ AddRouteNavComponent.decorators = [
1160
+ { type: core.Component, args: [{
1161
+ selector: 'app-add-route-nav',
1162
+ template: "<div class=\"nav_body\">\r\n <div class=\"logo\">\r\n <img src=\"assets/images/logo.png\" alt=\"logo\" />\r\n </div>\r\n <div class=\"heading m-20\">\r\n <h1>View Route</h1>\r\n <button mat-raised-button color=\"primary\" (click)=\"showAddForm()\">\r\n <mat-icon>add_circle_outline</mat-icon> Add route\r\n </button>\r\n </div>\r\n\r\n <div class=\"search-panel\">\r\n <div class=\"w-100\">\r\n <form [formGroup]=\"filterForm\">\r\n <mat-form-field class=\"full-width\" [class.disabled]=\"loaderVal\">\r\n <input matInput [matChipInputFor]=\"chipList\" formControlName=\"search\" [matAutocomplete]=\"auto\"\r\n [disabled]=\"loaderVal\" placeholder=\"Search\">\r\n <mat-icon matSuffix *ngIf=\"!utils.conveySearchIcon(filterForm.value.search)\">search</mat-icon>\r\n <button mat-button matSuffix mat-icon-button aria-label=\"Clear\" *ngIf=\"utils.conveySearchIcon(filterForm.value.search)\"\r\n (click)=\"filterForm.reset()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" (onSelectionChange)=\"filterSearch($event)\"\r\n [value]=\"option\">\r\n {{option.type | titlecase }}: {{option['label']}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </form>\r\n <div class=\"chip-list\">\r\n <mat-chip-list #chipList aria-label=\"Filter selection\">\r\n <mat-chip *ngFor=\"let filter of filters\" (removed)=\"removeFromFilter(filter)\">\r\n {{filter.type | titlecase }}: {{filter.name}}\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n </mat-chip-list>\r\n </div>\r\n </div>\r\n </div>\r\n <app-route-jobcode-list [type]=\"'addroute'\" [currentNav]=\"navValue\" [searchTerm]=\"filters\" [data]=\"routes\" [loader]=\"loaderVal\" (emitroute)=\"getRoute($event)\"></app-route-jobcode-list>\r\n</div>\r\n",
1163
+ styles: [""]
1164
+ },] }
1165
+ ];
1166
+ AddRouteNavComponent.ctorParameters = function () { return [
1167
+ { type: coolmapServices.UtilsService }
1168
+ ]; };
1169
+ AddRouteNavComponent.propDecorators = {
1170
+ changeNav: [{ type: core.Output }],
1171
+ navValue: [{ type: core.Input }],
1172
+ addemit: [{ type: core.Output }],
1173
+ updateRouteList: [{ type: core.Input }]
1174
+ };
1175
+
1176
+ var JobCodeNavComponent = /** @class */ (function () {
1177
+ function JobCodeNavComponent(utils) {
1178
+ var _this = this;
1179
+ this.utils = utils;
1180
+ this.filterForm = new forms.FormGroup({ search: new forms.FormControl() });
1181
+ this.listData = [];
1182
+ this.loaderVal = false;
1183
+ this.dateValue = new Date();
1184
+ this.jobemit = new core.EventEmitter();
1185
+ this.value = '';
1186
+ this.filters = [];
1187
+ this.clearJobDetails = new core.EventEmitter();
1188
+ this.destroyer$ = new rxjs.Subject();
1189
+ utils.navChangeObserve.pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
1190
+ if (res) {
1191
+ _this.loaderVal = false;
1192
+ }
1193
+ else
1194
+ _this.loaderVal = true;
1195
+ });
1196
+ }
1197
+ JobCodeNavComponent.prototype.ngOnInit = function () { this.loadData(this.utils.getDateFormat(new Date())); };
1198
+ JobCodeNavComponent.prototype.loadData = function (value) {
1199
+ var _this = this;
1200
+ var _a;
1201
+ this.filteredOptions = (_a = this.filterForm.get('search')) === null || _a === void 0 ? void 0 : _a.valueChanges.pipe(operators.startWith(''), operators.map(function (value) { return _this.utils.filter(value, _this.filters); }));
1202
+ this.utils.preventnavChange.next(false);
1203
+ this.loaderVal = true;
1204
+ this.utils.postdata('coolmap/jobs_report_v2', { date: value }).pipe(operators.takeUntil(this.destroyer$)).subscribe(function (res) {
1205
+ if (typeof res['data'] !== 'string') {
1206
+ if (res['data'].length > 0)
1207
+ _this.listData = res['data'].map(function (ele) { ele['date'] = value; return ele; });
1208
+ _this.listData.forEach(function (ele) { _this.utils.makeOptions(ele); });
1209
+ }
1210
+ else
1211
+ _this.listData = [];
1212
+ _this.clearJobDetails.emit(true);
1213
+ _this.utils.clearViewRouteforJobCode.next(true);
1214
+ _this.filters = [];
1215
+ if (typeof res['data'] === 'string')
1216
+ _this.utils.preventnavChange.next(true);
1217
+ }, function (err) {
1218
+ if (err)
1219
+ _this.utils.preventnavChange.next(true);
1220
+ });
1221
+ };
1222
+ JobCodeNavComponent.prototype.getRoute = function (job) {
1223
+ if (job['type'] === 'jobcode') {
1224
+ this.jobemit.emit(job);
1225
+ }
1226
+ };
1227
+ JobCodeNavComponent.prototype.getDate = function (ev) { this.loadData(this.utils.getDateFormat(ev.value)); };
1228
+ JobCodeNavComponent.prototype.filterSearch = function (e) {
1229
+ this.filterForm.controls.search.setValue(null);
1230
+ this.filterForm.controls.search.updateValueAndValidity();
1231
+ this.filters = [{ name: e.source.value.label, type: e.source.value.type, value: e.source.value }];
1232
+ };
1233
+ JobCodeNavComponent.prototype.removeFromFilter = function (filter) {
1234
+ var index = this.filters.indexOf(filter);
1235
+ if (index >= 0) {
1236
+ this.filters = [];
1237
+ }
1238
+ };
1239
+ JobCodeNavComponent.prototype.ngOnDestroy = function () {
1240
+ this.destroyer$.next(true);
1241
+ this.destroyer$.unsubscribe();
1242
+ };
1243
+ return JobCodeNavComponent;
1244
+ }());
1245
+ JobCodeNavComponent.decorators = [
1246
+ { type: core.Component, args: [{
1247
+ selector: 'app-job-code-nav',
1248
+ template: "<div class=\"nav_body\">\r\n <div class=\"search-panel\">\r\n <div class=\"datepicker\">\r\n <mat-form-field>\r\n <mat-label>Choose a date</mat-label>\r\n <input readonly matInput (click)=\"picker.open()\" [disabled]=\"loaderVal\" [(ngModel)]=\"dateValue\" [matDatepicker]=\"picker\" (dateChange)=\"getDate($event)\">\r\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-datepicker #picker></mat-datepicker>\r\n </mat-form-field>\r\n </div>\r\n <div class=\"search\">\r\n <form [formGroup]=\"filterForm\">\r\n <mat-form-field class=\"full-width\" [class.disabled]=\"loaderVal\">\r\n <input matInput [matChipInputFor]=\"chipList\" formControlName=\"search\" [matAutocomplete]=\"auto\"\r\n [disabled]=\"loaderVal\" placeholder=\"Search\">\r\n <mat-icon matSuffix *ngIf=\"!utils.conveySearchIcon(filterForm.value.search)\">search</mat-icon>\r\n <button mat-button matSuffix mat-icon-button aria-label=\"Clear\" *ngIf=\"utils.conveySearchIcon(filterForm.value.search)\" (click)=\"filterForm.reset()\">\r\n <mat-icon>close</mat-icon>\r\n </button>\r\n <mat-autocomplete autoActiveFirstOption #auto=\"matAutocomplete\">\r\n <mat-option *ngFor=\"let option of filteredOptions | async\" (onSelectionChange)=\"filterSearch($event)\"\r\n [value]=\"option\">\r\n {{option.type | titlecase }}: {{option['label']}}\r\n </mat-option>\r\n </mat-autocomplete>\r\n </mat-form-field>\r\n </form>\r\n\r\n </div>\r\n\r\n <div class=\"chip-list\">\r\n <mat-chip-list #chipList aria-label=\"Filter selection\">\r\n <mat-chip *ngFor=\"let filter of filters\" (removed)=\"removeFromFilter(filter)\">\r\n {{filter.type | titlecase }}: {{filter.name}}\r\n <button matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip>\r\n </mat-chip-list>\r\n </div>\r\n </div>\r\n <app-route-jobcode-list [type]=\"'jobcode'\" [searchTerm]=\"filters\" [data]=\"listData\" [loader]=\"loaderVal\" (clearJobDetailsFromList)=\"clearJobDetails.emit(true)\" (showAllRoute)=\"filters = []; clearJobDetails.emit(true)\" (emitroute)=\"getRoute($event)\"></app-route-jobcode-list>\r\n</div>\r\n",
1249
+ styles: [".search-panel .datepicker,.search-panel .search{width:47%}"]
1250
+ },] }
1251
+ ];
1252
+ JobCodeNavComponent.ctorParameters = function () { return [
1253
+ { type: coolmapServices.UtilsService }
1254
+ ]; };
1255
+ JobCodeNavComponent.propDecorators = {
1256
+ jobemit: [{ type: core.Output }],
1257
+ clearJobDetails: [{ type: core.Output }]
1258
+ };
1259
+
1260
+ var EstimationDisplayComponent = /** @class */ (function () {
1261
+ function EstimationDisplayComponent() {
1262
+ this.label = coolmapServices.EstinationData;
1263
+ this.Estinationlabel = coolmapServices.EstinationEnum;
1264
+ }
1265
+ return EstimationDisplayComponent;
1266
+ }());
1267
+ EstimationDisplayComponent.decorators = [
1268
+ { type: core.Component, args: [{
1269
+ selector: 'app-estimation-display',
1270
+ template: "<div class=\"d-flex\">\r\n <ng-container *ngFor=\"let item of label\">\r\n <span *ngIf=\"value[item]\" class=\"estimate\" (mousedown)=\"$event.stopPropagation()\">\r\n Estimation of {{Estinationlabel[item]}} - <b>{{value[item]}}</b>\r\n </span>\r\n </ng-container>\r\n</div>\r\n",
1271
+ styles: [".estimate{margin-right:20px;font-size:.7rem}@media (min-width:1600px){.estimate{font-size:.95rem}}"]
1272
+ },] }
1273
+ ];
1274
+ EstimationDisplayComponent.ctorParameters = function () { return []; };
1275
+ EstimationDisplayComponent.propDecorators = {
1276
+ value: [{ type: core.Input }]
1277
+ };
1278
+
1279
+ var CoolmapModule = /** @class */ (function () {
1280
+ function CoolmapModule() {
1281
+ }
1282
+ return CoolmapModule;
1283
+ }());
1284
+ CoolmapModule.decorators = [
1285
+ { type: core.NgModule, args: [{
1286
+ declarations: [
1287
+ CoolmapComponent,
1288
+ MapComponent,
1289
+ NavComponent,
1290
+ AddRouteNavComponent,
1291
+ JobCodeNavComponent,
1292
+ RouteJobCodeListComponent,
1293
+ ViewRouteListCardComponent,
1294
+ SmsCardDetailsOverviewComponent,
1295
+ JobCodeListCardComponent,
1296
+ JobCodeComponent,
1297
+ JobRouteListComponent,
1298
+ JobcodeStatusComponent,
1299
+ JobcodeOverviewComponent,
1300
+ DialogComponent,
1301
+ AddRouteComponent,
1302
+ EstimationDisplayComponent
1303
+ ],
1304
+ imports: [
1305
+ common.CommonModule,
1306
+ snackBar.MatSnackBarModule,
1307
+ sidenav.MatSidenavModule,
1308
+ dragDrop.DragDropModule,
1309
+ forms.FormsModule,
1310
+ input.MatInputModule,
1311
+ select.MatSelectModule,
1312
+ icon.MatIconModule,
1313
+ forms.ReactiveFormsModule,
1314
+ autocomplete.MatAutocompleteModule,
1315
+ formField.MatFormFieldModule,
1316
+ progressSpinner.MatProgressSpinnerModule,
1317
+ chips.MatChipsModule,
1318
+ dialog.MatDialogModule,
1319
+ tooltip.MatTooltipModule,
1320
+ datepicker.MatDatepickerModule,
1321
+ core$1.MatNativeDateModule,
1322
+ ngxPerfectScrollbar.PerfectScrollbarModule,
1323
+ core$1.MatPseudoCheckboxModule,
1324
+ button.MatButtonModule,
1325
+ progressBar.MatProgressBarModule,
1326
+ ],
1327
+ exports: [
1328
+ CoolmapComponent,
1329
+ MapComponent,
1330
+ NavComponent,
1331
+ AddRouteNavComponent,
1332
+ JobCodeNavComponent,
1333
+ RouteJobCodeListComponent,
1334
+ ViewRouteListCardComponent,
1335
+ SmsCardDetailsOverviewComponent,
1336
+ JobCodeListCardComponent,
1337
+ JobCodeComponent,
1338
+ JobRouteListComponent,
1339
+ JobcodeStatusComponent,
1340
+ JobcodeOverviewComponent,
1341
+ DialogComponent,
1342
+ AddRouteComponent,
1343
+ EstimationDisplayComponent
1344
+ ],
1345
+ entryComponents: [
1346
+ DialogComponent,
1347
+ JobCodeComponent,
1348
+ AddRouteComponent
1349
+ ],
1350
+ providers: []
1351
+ },] }
1352
+ ];
1353
+
1354
+ /*
1355
+ * Public API Surface of coolmap
1356
+ */
1357
+
1358
+ /**
1359
+ * Generated bundle index. Do not edit.
1360
+ */
1361
+
1362
+ exports.AddRouteComponent = AddRouteComponent;
1363
+ exports.AddRouteNavComponent = AddRouteNavComponent;
1364
+ exports.CoolmapComponent = CoolmapComponent;
1365
+ exports.CoolmapModule = CoolmapModule;
1366
+ exports.DialogComponent = DialogComponent;
1367
+ exports.JobCodeComponent = JobCodeComponent;
1368
+ exports.JobCodeListCardComponent = JobCodeListCardComponent;
1369
+ exports.JobCodeNavComponent = JobCodeNavComponent;
1370
+ exports.JobRouteListComponent = JobRouteListComponent;
1371
+ exports.JobcodeOverviewComponent = JobcodeOverviewComponent;
1372
+ exports.JobcodeStatusComponent = JobcodeStatusComponent;
1373
+ exports.MapComponent = MapComponent;
1374
+ exports.NavComponent = NavComponent;
1375
+ exports.RouteJobCodeListComponent = RouteJobCodeListComponent;
1376
+ exports.SmsCardDetailsOverviewComponent = SmsCardDetailsOverviewComponent;
1377
+ exports.ViewRouteListCardComponent = ViewRouteListCardComponent;
1378
+ exports.ɵa = EstimationDisplayComponent;
1379
+
1380
+ Object.defineProperty(exports, '__esModule', { value: true });
1381
+
1382
+ })));
1383
+ //# sourceMappingURL=coolmap.umd.js.map