@aggdirect/coolmap 0.1.3 → 1.0.1

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 (107) hide show
  1. package/README.md +33 -0
  2. package/esm2020/aggdirect-coolmap.mjs +5 -0
  3. package/esm2020/lib/component/add-route/add-route.component.mjs +310 -0
  4. package/esm2020/lib/component/job-code/job-code.component.mjs +114 -0
  5. package/esm2020/lib/component/map/map.component.mjs +39 -0
  6. package/esm2020/lib/component/nav/layout/add-route-nav/add-route-nav.component.mjs +87 -0
  7. package/esm2020/lib/component/nav/layout/job-code-nav/job-code-nav.component.mjs +89 -0
  8. package/esm2020/lib/component/nav/nav.component.mjs +52 -0
  9. package/esm2020/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.mjs +68 -0
  10. package/esm2020/lib/component/route-jobcode-list/route-jobcode-list.component.mjs +314 -0
  11. package/esm2020/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.mjs +19 -0
  12. package/esm2020/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.mjs +29 -0
  13. package/esm2020/lib/component/shared/dialog/dialog.component.mjs +29 -0
  14. package/esm2020/lib/component/shared/job-route-list/job-route-list.component.mjs +71 -0
  15. package/esm2020/lib/component/shared/jobcode-overview/jobcode-overview.component.mjs +19 -0
  16. package/esm2020/lib/component/shared/jobcode-status/jobcode-status.component.mjs +14 -0
  17. package/esm2020/lib/coolmap.component.mjs +22 -0
  18. package/esm2020/lib/coolmap.module.mjs +156 -0
  19. package/esm2020/lib/event.service.mjs +26 -0
  20. package/esm2020/public-api.mjs +16 -0
  21. package/fesm2015/aggdirect-coolmap.mjs +1367 -0
  22. package/fesm2015/aggdirect-coolmap.mjs.map +1 -0
  23. package/fesm2020/aggdirect-coolmap.mjs +1340 -0
  24. package/fesm2020/aggdirect-coolmap.mjs.map +1 -0
  25. package/index.d.ts +5 -0
  26. package/lib/component/add-route/add-route.component.d.ts +62 -0
  27. package/lib/component/job-code/job-code.component.d.ts +31 -0
  28. package/lib/component/map/map.component.d.ts +16 -0
  29. package/lib/component/nav/layout/add-route-nav/add-route-nav.component.d.ts +40 -0
  30. package/lib/component/nav/layout/job-code-nav/job-code-nav.component.d.ts +38 -0
  31. package/lib/component/nav/nav.component.d.ts +30 -0
  32. package/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.d.ts +19 -0
  33. package/lib/component/route-jobcode-list/route-jobcode-list.component.d.ts +42 -0
  34. package/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.d.ts +9 -0
  35. package/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.d.ts +11 -0
  36. package/lib/component/shared/dialog/dialog.component.d.ts +13 -0
  37. package/lib/component/shared/job-route-list/job-route-list.component.d.ts +26 -0
  38. package/lib/component/shared/jobcode-overview/jobcode-overview.component.d.ts +9 -0
  39. package/lib/component/shared/jobcode-status/jobcode-status.component.d.ts +8 -0
  40. package/lib/coolmap.component.d.ts +8 -0
  41. package/lib/coolmap.module.d.ts +40 -0
  42. package/lib/event.service.d.ts +19 -0
  43. package/package.json +31 -5
  44. package/public-api.d.ts +12 -0
  45. package/karma.conf.js +0 -44
  46. package/ng-package.json +0 -7
  47. package/src/assets/mixin.scss +0 -28
  48. package/src/assets/palette.scss +0 -24
  49. package/src/assets/variable.scss +0 -15
  50. package/src/lib/component/add-route/add-route.component.html +0 -140
  51. package/src/lib/component/add-route/add-route.component.scss +0 -235
  52. package/src/lib/component/add-route/add-route.component.spec.ts +0 -23
  53. package/src/lib/component/add-route/add-route.component.ts +0 -270
  54. package/src/lib/component/job-code/job-code.component.html +0 -93
  55. package/src/lib/component/job-code/job-code.component.scss +0 -427
  56. package/src/lib/component/job-code/job-code.component.ts +0 -94
  57. package/src/lib/component/map/map.component.css +0 -0
  58. package/src/lib/component/map/map.component.html +0 -5
  59. package/src/lib/component/map/map.component.spec.ts +0 -23
  60. package/src/lib/component/map/map.component.ts +0 -33
  61. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.html +0 -44
  62. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.scss +0 -0
  63. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.spec.ts +0 -23
  64. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.ts +0 -70
  65. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.html +0 -43
  66. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.scss +0 -5
  67. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.ts +0 -64
  68. package/src/lib/component/nav/nav.component.html +0 -19
  69. package/src/lib/component/nav/nav.component.scss +0 -65
  70. package/src/lib/component/nav/nav.component.ts +0 -38
  71. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.html +0 -56
  72. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.scss +0 -167
  73. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.spec.ts +0 -23
  74. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ts +0 -42
  75. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.html +0 -66
  76. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.scss +0 -226
  77. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.ts +0 -234
  78. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.html +0 -7
  79. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.scss +0 -10
  80. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.spec.ts +0 -23
  81. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ts +0 -15
  82. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.html +0 -30
  83. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.scss +0 -172
  84. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.spec.ts +0 -23
  85. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ts +0 -19
  86. package/src/lib/component/shared/dialog/dialog.component.html +0 -7
  87. package/src/lib/component/shared/dialog/dialog.component.scss +0 -30
  88. package/src/lib/component/shared/dialog/dialog.component.ts +0 -18
  89. package/src/lib/component/shared/job-route-list/job-route-list.component.html +0 -27
  90. package/src/lib/component/shared/job-route-list/job-route-list.component.scss +0 -3
  91. package/src/lib/component/shared/job-route-list/job-route-list.component.spec.ts +0 -23
  92. package/src/lib/component/shared/job-route-list/job-route-list.component.ts +0 -54
  93. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.html +0 -8
  94. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.scss +0 -12
  95. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.spec.ts +0 -23
  96. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.ts +0 -15
  97. package/src/lib/component/shared/jobcode-status/jobcode-status.component.html +0 -5
  98. package/src/lib/component/shared/jobcode-status/jobcode-status.component.scss +0 -32
  99. package/src/lib/component/shared/jobcode-status/jobcode-status.component.spec.ts +0 -23
  100. package/src/lib/component/shared/jobcode-status/jobcode-status.component.ts +0 -12
  101. package/src/lib/coolmap.component.ts +0 -20
  102. package/src/lib/coolmap.module.ts +0 -92
  103. package/src/public-api.ts +0 -10
  104. package/src/test.ts +0 -27
  105. package/tsconfig.lib.json +0 -15
  106. package/tsconfig.lib.prod.json +0 -10
  107. package/tsconfig.spec.json +0 -17
@@ -1,235 +0,0 @@
1
- @import "../../../assets/variable.scss";
2
- .addroutebox{
3
- width: calc(100% - 315px);
4
- position: absolute;
5
- left: 300px;
6
- bottom: 10px;
7
- z-index: 999;
8
- display: flex;
9
- justify-content: space-between;
10
- align-items: flex-start;
11
-
12
- .routedetailbox{
13
- max-width: 300px;
14
- padding: 10px;
15
- background-color: #fff;
16
- border-radius: 20px;
17
- margin-right: 20px;
18
- @media (min-width:1600px) {
19
- max-width: 280px;
20
- }
21
- }
22
- .editbtn{
23
- background: #326ad3;
24
- padding: 10px 25px 10px 25px;
25
- color: white;
26
- font-size: 0.8125rem;
27
- border-radius: 30px;
28
- float: right;
29
- }
30
- }
31
- .add_add_route_box {
32
- background: $white;
33
- padding: 10px 20px;
34
- border-radius: 20px;
35
- box-shadow: 2px 4px 4px 2px rgb(0 0 0 / 14%);
36
- height: 370px;
37
- width: 100%;
38
- position: relative;
39
- cursor: move;
40
-
41
- .route_form_area {
42
- display: flex;
43
- flex-wrap: wrap;
44
- justify-content: space-between;
45
- .col-6 {
46
- width: 48%;
47
- margin-top: 15px;
48
- justify-content: space-between;
49
- .inputbox {
50
- width: 47%;
51
- }
52
- span {
53
- font-size: 0.875rem;
54
- }
55
- }
56
- button {
57
- background: $blue;
58
- padding: 10px 18px 10px 18px;
59
- color: $white;
60
- font-size: 0.8125rem;
61
- border-radius: 30px;
62
- position: absolute;
63
- right: 18px;
64
- top: 20px;
65
- }
66
- }
67
- }
68
- .closebtn{
69
- background: $black;
70
- color: $white;
71
- border-radius: 30px;
72
- padding: 10px 18px 10px 18px;
73
- margin-left: 10px;
74
- }
75
- .delbtn{
76
- background:red;
77
- color: $white;
78
- border-radius: 30px;
79
- padding: 10px 18px 10px 18px;
80
- }
81
- .add_route_listingpart {
82
- .listing_toggle {
83
- background: $white;
84
- border-radius: 15px;
85
- padding: 8px 10px;
86
- position: absolute;
87
- right: 10px;
88
- top: 30px;
89
- cursor: pointer;
90
- }
91
- }
92
- .listing_box {
93
- background: #282828;
94
- height: 100vh;
95
- position: fixed;
96
- right: 0;
97
- top: 0;
98
- z-index: 1111;
99
- box-shadow: -3px 0px 5px 0px rgba(255, 255, 255, 0.08);
100
- transition: 0.5s;
101
- -webkit-transition: 0.5s;
102
- transition: 0.5s;
103
- -webkit-transition: 0.5s;
104
- -moz-transition: 0.5s;
105
- width: 0;
106
- border-radius: 40px 0px 0px 40px;
107
- opacity: 0;
108
- .closebtn {
109
- display: none;
110
- }
111
- }
112
- .show {
113
- .listing_box {
114
- width: 250px;
115
- max-width: 250px;
116
- -webkit-box-flex: 0;
117
- flex: 0 0 250px;
118
- transition: 0.5s;
119
- -webkit-transition: 0.5s;
120
- transition: 0.5s;
121
- -webkit-transition: 0.5s;
122
- -moz-transition: 0.5s;
123
- padding: 40px 0px 40px 20px;
124
- opacity: 1;
125
- @media (min-width:1600px) {
126
- width: 320px;
127
- max-width: 320px;
128
- -webkit-box-flex: 0;
129
- flex: 0 0 320px;
130
- }
131
- h2 {
132
- color: $white;
133
- white-space: nowrap;
134
- }
135
- ul {
136
- padding: 0 20px 0 0;
137
- li {
138
- background: #4a4a4a;
139
- padding: 15px;
140
- border-radius: 15px;
141
- display: flex;
142
- margin-bottom: 15px;
143
- .companayIcon {
144
- width: 40px;
145
- height: 40px;
146
- border-radius: 10px;
147
- background: $white;
148
- margin-right: 10px;
149
- display: flex;
150
- justify-content: center;
151
- align-items: center;
152
- }
153
- .company_cont {
154
- width: calc(100% - 50px);
155
- h3 {
156
- color: $white;
157
- font-size: 15px;
158
- font-weight: normal;
159
- margin: 0;
160
- text-overflow: ellipsis;
161
- max-width: 129px;
162
- -webkit-box-orient: vertical;
163
- white-space: nowrap;
164
- overflow: hidden;
165
- @media (min-width:1600px) {
166
- max-width: 170px;
167
- }
168
- }
169
- p {
170
- color: #bcbcbc;
171
- font-size: 12px;
172
- margin: 5px 0;
173
- overflow: hidden;
174
- text-overflow: ellipsis;
175
- display: -webkit-box;
176
- -webkit-line-clamp: 2;
177
- -webkit-box-orient: vertical;
178
- line-height: 16px;
179
- }
180
- }
181
- }
182
- }
183
- }
184
- .closebtn {
185
- position: absolute;
186
- left: -33px;
187
- top: 50px;
188
- background: #282828;
189
- color: $white;
190
- padding: 8px;
191
- border-top-left-radius: 15px;
192
- border-bottom-left-radius: 15px;
193
- cursor: pointer;
194
- box-shadow: -4px 2px 5px 0px rgba(255, 255, 255, 0.08);
195
- display: block;
196
- }
197
- }
198
- .loader{
199
- position: absolute;
200
- width: 95%;
201
- height: 100%;
202
- display: flex;
203
- justify-content: center;
204
- align-items: center;
205
- pointer-events: none;
206
- }
207
- .buttonprt{
208
- margin-right: 83px;
209
- }
210
- .destination{
211
- .duration{
212
- padding: 10px;
213
- }
214
- span{
215
- padding: 5px 0;
216
- }
217
- }
218
- .closebtnroutedetail{
219
- box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.11);
220
- border-radius: 100%;
221
- width: 30px;
222
- height: 30px;
223
- display: flex;
224
- justify-content: center;
225
- align-items: center;
226
- cursor: pointer;
227
- background: #fff;
228
- position: absolute;
229
- top: -11px;
230
- left: -11px;
231
- }
232
- .routenotes{
233
- max-height: 170px;
234
- overflow: auto;
235
- }
@@ -1,23 +0,0 @@
1
- import { ComponentFixture, TestBed } from '@angular/core/testing';
2
-
3
- import { AddRouteComponent } from './add-route.component';
4
-
5
- describe('AddRouteComponent', () => {
6
- let component: AddRouteComponent;
7
- let fixture: ComponentFixture<AddRouteComponent>;
8
-
9
- beforeEach(async () => {
10
- await TestBed.configureTestingModule({
11
- declarations: [ AddRouteComponent ]
12
- })
13
- .compileComponents();
14
-
15
- fixture = TestBed.createComponent(AddRouteComponent);
16
- component = fixture.componentInstance;
17
- fixture.detectChanges();
18
- });
19
-
20
- it('should create', () => {
21
- expect(component).toBeTruthy();
22
- });
23
- });
@@ -1,270 +0,0 @@
1
- import { Component, ElementRef, OnInit, ViewChild, Output, EventEmitter, SimpleChanges, OnChanges, Input, OnDestroy } from '@angular/core';
2
- import { FormControl, FormGroup, Validators } from '@angular/forms';
3
- import { debounceTime, distinctUntilChanged, fromEvent, map, Observable, startWith, Subject, takeUntil } from 'rxjs';
4
- import {MatDialog} from '@angular/material/dialog';
5
- import { CoolmapService, Route, UtilsService } from 'coolmap-services';
6
- import { DialogComponent } from '../shared/dialog/dialog.component';
7
-
8
-
9
- @Component({
10
- selector: 'app-add-route',
11
- templateUrl: './add-route.component.html',
12
- styleUrls: ['./add-route.component.scss']
13
- })
14
- export class AddRouteComponent implements OnInit, OnChanges, OnDestroy {
15
- @ViewChild('filterPickup') filterPickup!: ElementRef;
16
- @ViewChild('filterDelivery') filterDelivery!: ElementRef;
17
- @Output() changeNav = new EventEmitter<string>();
18
- @Output() updateRouteList = new EventEmitter<boolean>();
19
- pickupOptions: any = [];
20
- deliveryOptions: any = [];
21
- requestParmsForRouteDetails = { pickup_lat_lng: '', delivery_lat_lng: '' }
22
- customersList: any = [];
23
- unitsList: any = [];
24
- materialsList: any = [];
25
- addRouteForm!: FormGroup;
26
- @Input() routeData!: Route;
27
- routeId: string | null | undefined;
28
- preventSave: boolean = false;
29
- preventInitialSave: boolean = false;
30
- customersList$!: Observable<any>;
31
- routeDetails!: { pickup_location: string | null | undefined; delivery_location: string | null | undefined; } | null;
32
- private destroyer$ = new Subject<boolean>();
33
- popupDetails: Route;
34
- enablePopUp: boolean = false;
35
- prevantPopupClose = false;
36
- enableForm: boolean = false;
37
-
38
- constructor(private coolMapService: CoolmapService, private utils: UtilsService, public dialog: MatDialog) {
39
- this.fetchCustomersList();
40
- this.fetchUnitsList();
41
- this.fetchMaterialsList(); this.formInit();
42
- this.utils.getrouteDetailsUtility.subscribe(res => {
43
- if (res) {
44
- if (res['event'] !== 'click' && !this.prevantPopupClose) { this.enablePopUp = res['event'] }
45
- else if(this.enablePopUp && !this.prevantPopupClose) { this.prevantPopupClose = true; }
46
- if (res['event'] !== 'click' && !res['event'] && this.prevantPopupClose) {
47
- this.popupDetails = this.utils.getdictValue('route-detailsv2');
48
- } else { this.popupDetails = res['route'] }
49
- this.popupDetails['created_at'] = this.utils.getDateFormat(new Date(this.popupDetails['created_at']), '/');
50
- }
51
- });
52
- }
53
- filterCustomerList() {
54
- this.customersList$ = this.addRouteForm.controls['customer_name'].valueChanges.pipe(
55
- startWith(''),
56
- map(value => this._filter(value || '')),
57
- );
58
- }
59
- private _filter(value: string): string[] {
60
- const filterValue = value.toLowerCase();
61
- return this.customersList.filter((option: any) => option['customer_name'].toLowerCase().includes(filterValue));
62
- }
63
- ngOnChanges(changes: SimpleChanges): void {
64
- if (changes['routeData'] && !changes['routeData']['currentValue']) this.inIt(null);
65
- }
66
- openDialog(): void {
67
- const dialogRef = this.dialog.open(DialogComponent, {
68
- data: { body: 'Are you sure you want to delete this route?' },
69
- });
70
- dialogRef.afterClosed().subscribe(res => { if (res) { this.deleteRoute() } });
71
- }
72
- editEvent(){
73
- this.prevantPopupClose = false;
74
- this.enableForm = true; this.enablePopUp = false;
75
- this.popupDetails['prevent'] = false;
76
- this.utils.removeMapEntity.next(this.popupDetails);
77
- this.inIt(this.popupDetails);
78
- }
79
- inIt(changes: Route) {
80
- if (changes) {
81
- if (!changes['prevent']) {
82
- this.preventSave = false;
83
- this.formControlValue();
84
- this.patchFormValue(changes); this.checkAndFetchRouteInformation(true)
85
- }
86
- }
87
- if (!changes) { this.enableForm = true; this.preventSave = true; this.patchFormValue(); this.checkAndFetchRouteInformation() }
88
- }
89
- ngOnInit(): void {
90
- this.formControlValue();
91
- }
92
-
93
- ngAfterViewInit() {
94
- fromEvent(this.filterPickup.nativeElement, 'keyup').pipe(
95
- distinctUntilChanged(), debounceTime(150)).pipe(takeUntil(this.destroyer$)).subscribe(() => {
96
- this.utils.fetchAutoCompleteLocations(this.filterPickup.nativeElement.value).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
97
- this.pickupOptions = res.features;
98
- });
99
- });
100
-
101
- fromEvent(this.filterDelivery.nativeElement, 'keyup').pipe(
102
- distinctUntilChanged(), debounceTime(150)).pipe(takeUntil(this.destroyer$)).subscribe(() => {
103
- this.utils.fetchAutoCompleteLocations(this.filterDelivery.nativeElement.value).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
104
- this.deliveryOptions = res.features;
105
- });
106
- });
107
- }
108
-
109
- formControlValue() {
110
- this.addRouteForm.controls['pickup_location']?.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
111
- if (this.addRouteForm.value.pickup_location && res !== this.addRouteForm.value.pickup_location) {
112
- this.addRouteForm.patchValue({
113
- pickup_lat_lng: '',
114
- });
115
- this.addRouteForm.controls['pickup_lat_lng'].markAsTouched();
116
- }
117
- });
118
-
119
- this.addRouteForm.controls['delivery_location']?.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
120
- if (this.addRouteForm.value.delivery_location && res !== this.addRouteForm.value.delivery_location) {
121
- this.addRouteForm.patchValue({
122
- delivery_lat_lng: '',
123
- });
124
- this.addRouteForm.controls['delivery_lat_lng'].markAsTouched();
125
- }
126
- });
127
- }
128
-
129
- formInit() {
130
- this.addRouteForm = new FormGroup({
131
- route_name: new FormControl('', [Validators.required]),
132
- customer_name: new FormControl({value: '', disabled: true}, [Validators.required]),
133
- materials_id: new FormControl('', [Validators.required]),
134
- unit_id: new FormControl('', [Validators.required]),
135
- path: new FormControl('', [Validators.required]),
136
- pickup_location: new FormControl('', [Validators.required]),
137
- pickup_lat_lng: new FormControl('', [Validators.required]),
138
- delivery_location: new FormControl('', [Validators.required]),
139
- delivery_lat_lng: new FormControl('', [Validators.required]),
140
- estimated_distance: new FormControl('', [Validators.required]),
141
- estimated_time: new FormControl('', [Validators.required]),
142
- note: new FormControl('', [Validators.maxLength(2048)]),
143
- });
144
- }
145
-
146
- patchFormValue(data?: Route) {
147
- this.addRouteForm.reset();
148
- this.addRouteForm.patchValue(data!);
149
- this.routeId = data?.route_id;
150
- this.routeDetails = data ? { pickup_location: data.pickup_location, delivery_location: data.delivery_location } : null;
151
- this.addRouteForm.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe(res => {
152
- if (res) { if (this.preventInitialSave) this.preventInitialSave = false }
153
- });
154
- this.filterCustomerList();
155
- }
156
-
157
- fetchCustomersList() {
158
- this.utils.getData('coolmap/company/list/view').pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
159
- if (res) { this.customersList = res.data; this.filterCustomerList(); this.addRouteForm.controls['customer_name'].enable(); }
160
- })
161
- }
162
-
163
- async fetchUnitsList() {
164
- await this.utils.getData('coolmap/unit/list/view').pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
165
- if (res) { this.unitsList = res.data }
166
- })
167
- }
168
-
169
- fetchMaterialsList() {
170
- this.utils.getData('coolmap/material/list/view').pipe(takeUntil(this.destroyer$)).subscribe(((res: any) => {
171
- res.data.sort((a: any, b: any) => a.material.localeCompare(b.material))
172
- this.materialsList = res.data
173
- }))
174
- }
175
-
176
- selectedLongLat(type: string, event: any) {
177
- if (type === 'pickup') {
178
- this.addRouteForm.patchValue({
179
- pickup_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
180
- });
181
- this.coolMapService.clearBoundWithCordinates();
182
- } else if (type === 'delivery') {
183
- this.addRouteForm.patchValue({
184
- delivery_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
185
- })
186
- }
187
- this.checkAndFetchRouteInformation();
188
- }
189
-
190
- checkAndFetchRouteInformation(isinitial?: boolean) {
191
- if (this.addRouteForm.value?.delivery_lat_lng?.length > 0 && this.addRouteForm.value?.pickup_lat_lng?.length > 0) {
192
- const param = {
193
- delivery_lat_lng: this.addRouteForm.value.delivery_lat_lng,
194
- pickup_lat_lng: this.addRouteForm.value.pickup_lat_lng
195
- };
196
- this.utils.postdata('coolmap/calculate/routes/estimation', param).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
197
- if (res && res['path']) {
198
- this.addRouteForm.patchValue({
199
- estimated_distance: res.dist, estimated_time: res.time, path: res.path
200
- });
201
- let path = res['path'].split(';');
202
- path = path.map((ele: string | any) => { return ele = this.formateLatLong(ele) });
203
- res['path'] = path;
204
- const element: any = {
205
- type: 'FeatureCollection',
206
- features: [{ type: 'Feature', properties: {}, geometry: { type: 'LineString', coordinates: res['path'] } }]
207
- }
208
- this.coolMapService.removeRouteAndMarker(1).then(() => {
209
- const unit = this.unitsList.find((x: any) => x.id === this.addRouteForm.value.unit_id);
210
- const materialDetails = this.materialsList.find((x: any) => x.material_id === this.addRouteForm.value.materials_id);
211
- this.coolMapService.loadMapProperty(element, 1, unit?.type,
212
- {
213
- pickup_location: this.addRouteForm.get('pickup_location')?.value,
214
- delivery_location: this.addRouteForm.get('delivery_location')?.value,
215
- route_name: this.addRouteForm.get('route_name')?.value,
216
- material: materialDetails?.material, unit: unit?.type
217
- }).then((res) =>{this.preventSave = true});
218
- });
219
- } else {
220
- this.coolMapService.removeRouteAndMarker(1);
221
- this.utils.openSnackBar(res['status'], 'error');
222
- }
223
- if (this.routeId && isinitial) this.preventInitialSave = true;
224
- });
225
- } else { this.coolMapService.removeRouteAndMarker(1) }
226
- }
227
-
228
- formateLatLong(latlong: string) { return latlong ? latlong.split(',').map(x => +x).reverse() : null }
229
- saveRoute() {
230
- if (this.addRouteForm.valid) {
231
- this.preventSave = false;
232
- const data = this.addRouteForm.value;
233
- const url = this.routeId ? this.utils.postdata('coolmap/update/routes', data) : this.utils.postdata('coolmap/add/routes', data)
234
- if (this.routeId) data['id'] = this.routeId;
235
- url.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
236
- if (res.success) {
237
- this.updateRouteList.emit(true);
238
- this.utils.openSnackBar(res.message, 'success');
239
- this.preventInitialSave = true;
240
- this.preventSave = true;
241
- if(!this.routeId)this.changeNav.next('Addroute');
242
- } else {
243
- this.utils.openSnackBar(res.message, 'error');
244
- this.preventSave = true;
245
- }
246
- }, (err) => { if (err) { this.preventSave = true; } });
247
- } else {
248
- this.addRouteForm.markAllAsTouched();
249
- }
250
- }
251
- deleteRoute() {
252
- this.preventSave = false;
253
- this.utils.postdata('coolmap/delete/routes', { uuid: this.routeId }).subscribe(res => {
254
- if (res['data']['success']) {
255
- this.utils.openSnackBar(res['data']['message'], 'success');
256
- this.updateRouteList.emit(true);
257
- this.changeNav.next('Addroute');
258
- this.preventInitialSave = true;
259
- this.preventSave = true;
260
- } else {
261
- this.utils.openSnackBar('Somthing went wrong', 'error');
262
- this.preventSave = true;
263
- }
264
- }, (err) =>{this.preventSave = true})
265
- }
266
- ngOnDestroy(): void {
267
- this.destroyer$.next(true);
268
- this.destroyer$.unsubscribe();
269
- }
270
- }
@@ -1,93 +0,0 @@
1
- <div class="jobcode_detailprt" (click)="isOverlapRouteSection = false" *ngIf="jobdetail" [ngClass]="{'overlap': !isOverlapRouteSection}" cdkDrag>
2
- <div class="topheadingprt" *ngIf="jobdetail['order_number']">
3
- <h2>{{jobdetail['order_number']}}</h2>
4
- </div>
5
- <span class="close"><mat-icon (click)="clearJob()">clear</mat-icon></span>
6
- <div class="job_details_area">
7
- <div class="detailnameprt">
8
- <span> <b> {{jobdetail.customer_name}} </b> Customer </span>
9
- <app-jobcode-status [jobValue]="jobdetail"></app-jobcode-status>
10
- </div>
11
- <app-jobcode-overview [jobValue]="jobdetail"></app-jobcode-overview>
12
- </div>
13
- </div>
14
-
15
- <div class="route_listprt" (click)="isOverlapRouteSection = true" [ngClass]="{ 'show': isVisible, 'overlap': isOverlapRouteSection}">
16
- <div class="listing_toggle" (click)="toggleSidemenu()">
17
- <img src="assets/images/route.svg" alt="" />
18
- </div>
19
-
20
- <div class="listing_box">
21
- <div class="closebtn" (click)="toggleSidemenu()">
22
- <mat-icon>clear</mat-icon>
23
- </div>
24
-
25
- <div class="btnprt">
26
- <h2> List of Routes </h2>
27
- <button (click)="masterToggle()">{{routes && routes.length > 0 && routes.length === selectedRoute.selected.length ? 'Uncheck' : 'Check'}} All</button>
28
- </div>
29
-
30
- <app-job-route-list [routes]="routes" [masterRoutes]="masterRoutes" [selectedRoute]="selectedRoute" (changeRoutes)="routes = $event" (changeSelectedRoute)="selectedRoute = $event"></app-job-route-list>
31
-
32
- <perfect-scrollbar>
33
- <ul *ngIf="routes['length'] > 0">
34
- <li *ngFor="let list of routes">
35
- <div class="iconprt">
36
- <span>
37
- <input type="checkbox" [checked]="selectedRoute.isSelected(list)"
38
- (change)="$event ? selectRoute(list) : null" /><label>&nbsp;</label>
39
- <div class="border"></div>
40
- </span>
41
- <div class="statusunit" [ngClass]="list['unit']">{{list['unit']}}</div>
42
- <div class="infoicon">
43
- <img (mouseenter)="togglerouteDetails(true, list)" (mouseout)="togglerouteDetails(false, list, true)"
44
- (click)="togglerouteDetails('click', list)" src="assets/images/info_icon.png" [alt]="" />
45
- </div>
46
- </div>
47
- <div class="pickprtbox">
48
- <h2> {{list['route_name']}} </h2>
49
- <h3>{{list['customer_name']}} | {{list['material']}}</h3>
50
- <div class="pickdropprt">
51
- <div class="pickprt">
52
- <b>
53
- <h4>{{list['pickup_location']}}</h4>
54
- </b>
55
- </div>
56
- <div class="dropprt">
57
- <b>
58
- <h4>{{list['delivery_location']}}</h4>
59
- </b>
60
- </div>
61
- </div>
62
- </div>
63
- </li>
64
- </ul>
65
- <p style="color: #fff;" *ngIf="routes.length === 0">No Route found</p>
66
- </perfect-scrollbar>
67
- </div>
68
-
69
- <div class="route_detail" *ngIf="detailsCardEnable">
70
- <div class="closebtnroutedetail" (click)="detailsCardEnable = false; preventMouseout = false">
71
- <mat-icon>clear</mat-icon>
72
- </div>
73
- <div class="destination">
74
- <div class="duration">
75
- <p class="pickprt"><b>Pickup:</b> {{routeCardDetail?.pickup_location}}</p>
76
- <p class="dropprt"><b>Delivery:</b> {{routeCardDetail?.delivery_location}} </p>
77
- </div>
78
- <span><b>Name:</b> {{routeCardDetail?.route_name}}</span>
79
- <span><b>Customer:</b> {{routeCardDetail?.customer_name}}</span>
80
- <span><b>Material:</b> {{routeCardDetail?.material}}</span>
81
- <span><b>Type:</b> {{routeCardDetail?.unit}}</span>
82
- <span><b>Distance:</b> {{routeCardDetail?.estimated_distance}}</span>
83
- <span><b>Travel Time:</b> {{routeCardDetail?.estimated_time}}</span>
84
- <span class="notes"><b>Notes:</b> {{routeCardDetail?.note}}</span>
85
- </div>
86
-
87
- <div class="createTxt">
88
- <small>
89
- Created by {{routeCardDetail?.created_by_name}} on {{routeCardDetail?.created_at}}
90
- </small>
91
- </div>
92
- </div>
93
- </div>