@aggdirect/coolmap 2.6.6 → 2.6.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.
- package/karma.conf.js +44 -0
- package/ng-package.json +7 -0
- package/package.json +5 -30
- package/src/assets/mixin.scss +28 -0
- package/src/assets/palette.scss +24 -0
- package/src/assets/variable.scss +15 -0
- package/src/lib/component/add-route/add-route.component.html +136 -0
- package/src/lib/component/add-route/add-route.component.scss +236 -0
- package/src/lib/component/add-route/add-route.component.spec.ts +23 -0
- package/src/lib/component/add-route/add-route.component.ts +295 -0
- package/src/lib/component/job-code/job-code.component.html +79 -0
- package/src/lib/component/job-code/job-code.component.scss +396 -0
- package/src/lib/component/job-code/job-code.component.ts +157 -0
- package/src/lib/component/map/map.component.css +0 -0
- package/src/lib/component/map/map.component.html +4 -0
- package/src/lib/component/map/map.component.spec.ts +23 -0
- package/src/lib/component/map/map.component.ts +34 -0
- package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.html +46 -0
- package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.scss +18 -0
- package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.spec.ts +23 -0
- package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.ts +131 -0
- package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.html +48 -0
- package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.scss +24 -0
- package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.ts +154 -0
- package/src/lib/component/nav/nav.component.html +19 -0
- package/src/lib/component/nav/nav.component.scss +67 -0
- package/src/lib/component/nav/nav.component.ts +38 -0
- package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.html +56 -0
- package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.scss +168 -0
- package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.spec.ts +23 -0
- package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ts +43 -0
- package/src/lib/component/route-jobcode-list/route-jobcode-list.component.html +66 -0
- package/src/lib/component/route-jobcode-list/route-jobcode-list.component.scss +232 -0
- package/src/lib/component/route-jobcode-list/route-jobcode-list.component.ts +234 -0
- package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.html +7 -0
- package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.scss +10 -0
- package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.spec.ts +23 -0
- package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ts +15 -0
- package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.html +28 -0
- package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.scss +172 -0
- package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.spec.ts +23 -0
- package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ts +20 -0
- package/src/lib/component/shared/dialog/dialog.component.html +7 -0
- package/src/lib/component/shared/dialog/dialog.component.scss +30 -0
- package/src/lib/component/shared/dialog/dialog.component.ts +18 -0
- package/src/lib/component/shared/estimation-display/estimation-display.component.html +7 -0
- package/src/lib/component/shared/estimation-display/estimation-display.component.scss +7 -0
- package/src/lib/component/shared/estimation-display/estimation-display.component.ts +13 -0
- package/src/lib/component/shared/job-route-list/job-route-list.component.html +30 -0
- package/src/lib/component/shared/job-route-list/job-route-list.component.scss +15 -0
- package/src/lib/component/shared/job-route-list/job-route-list.component.spec.ts +23 -0
- package/src/lib/component/shared/job-route-list/job-route-list.component.ts +54 -0
- package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.html +11 -0
- package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.scss +13 -0
- package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.spec.ts +23 -0
- package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.ts +19 -0
- package/src/lib/component/shared/jobcode-status/jobcode-status.component.html +5 -0
- package/src/lib/component/shared/jobcode-status/jobcode-status.component.scss +40 -0
- package/src/lib/component/shared/jobcode-status/jobcode-status.component.spec.ts +23 -0
- package/src/lib/component/shared/jobcode-status/jobcode-status.component.ts +11 -0
- package/src/lib/component/shared/route-info-card/route-info-card.component.html +11 -0
- package/src/lib/component/shared/route-info-card/route-info-card.component.scss +50 -0
- package/src/lib/component/shared/route-info-card/route-info-card.component.spec.ts +23 -0
- package/src/lib/component/shared/route-info-card/route-info-card.component.ts +69 -0
- package/src/lib/coolmap.module.ts +117 -0
- package/{public-api.d.ts → src/public-api.ts} +8 -0
- package/src/test.ts +27 -0
- package/tsconfig.lib.json +15 -0
- package/tsconfig.lib.prod.json +10 -0
- package/tsconfig.spec.json +17 -0
- package/esm2022/aggdirect-coolmap.mjs +0 -5
- package/esm2022/lib/component/add-route/add-route.component.mjs +0 -348
- package/esm2022/lib/component/job-code/job-code.component.mjs +0 -192
- package/esm2022/lib/component/map/map.component.mjs +0 -39
- package/esm2022/lib/component/nav/layout/add-route-nav/add-route-nav.component.mjs +0 -152
- package/esm2022/lib/component/nav/layout/job-code-nav/job-code-nav.component.mjs +0 -119
- package/esm2022/lib/component/nav/nav.component.mjs +0 -54
- package/esm2022/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.mjs +0 -77
- package/esm2022/lib/component/route-jobcode-list/route-jobcode-list.component.mjs +0 -321
- package/esm2022/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.mjs +0 -19
- package/esm2022/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.mjs +0 -37
- package/esm2022/lib/component/shared/dialog/dialog.component.mjs +0 -31
- package/esm2022/lib/component/shared/estimation-display/estimation-display.component.mjs +0 -18
- package/esm2022/lib/component/shared/job-route-list/job-route-list.component.mjs +0 -79
- package/esm2022/lib/component/shared/jobcode-overview/jobcode-overview.component.mjs +0 -24
- package/esm2022/lib/component/shared/jobcode-status/jobcode-status.component.mjs +0 -15
- package/esm2022/lib/component/shared/route-info-card/route-info-card.component.mjs +0 -57
- package/esm2022/lib/coolmap.module.mjs +0 -186
- package/esm2022/public-api.mjs +0 -19
- package/fesm2022/aggdirect-coolmap.mjs +0 -1644
- package/fesm2022/aggdirect-coolmap.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/component/add-route/add-route.component.d.ts +0 -61
- package/lib/component/job-code/job-code.component.d.ts +0 -42
- package/lib/component/map/map.component.d.ts +0 -15
- package/lib/component/nav/layout/add-route-nav/add-route-nav.component.d.ts +0 -49
- package/lib/component/nav/layout/job-code-nav/job-code-nav.component.d.ts +0 -42
- package/lib/component/nav/nav.component.d.ts +0 -31
- package/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.d.ts +0 -20
- package/lib/component/route-jobcode-list/route-jobcode-list.component.d.ts +0 -42
- package/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.d.ts +0 -9
- package/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.d.ts +0 -12
- package/lib/component/shared/dialog/dialog.component.d.ts +0 -13
- package/lib/component/shared/estimation-display/estimation-display.component.d.ts +0 -8
- package/lib/component/shared/job-route-list/job-route-list.component.d.ts +0 -26
- package/lib/component/shared/jobcode-overview/jobcode-overview.component.d.ts +0 -10
- package/lib/component/shared/jobcode-status/jobcode-status.component.d.ts +0 -7
- package/lib/component/shared/route-info-card/route-info-card.component.d.ts +0 -29
- package/lib/coolmap.module.d.ts +0 -44
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { Component, ElementRef, OnInit, ViewChild, Output, EventEmitter, SimpleChanges, OnChanges, Input, OnDestroy, Inject } 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 { DialogComponent } from '../shared/dialog/dialog.component';
|
|
6
|
+
import { CoolmapConfigModel, CoolmapService, CustomerRepoDetailsModel, Route, UtilsService } from '@aggdirect/coolmap-services';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'app-add-route',
|
|
12
|
+
templateUrl: './add-route.component.html',
|
|
13
|
+
styleUrls: ['./add-route.component.scss']
|
|
14
|
+
})
|
|
15
|
+
export class AddRouteComponent implements OnInit, OnChanges, OnDestroy {
|
|
16
|
+
@ViewChild('filterPickup') public filterPickup!: ElementRef;
|
|
17
|
+
@ViewChild('filterDelivery') public filterDelivery!: ElementRef;
|
|
18
|
+
@Output() public changeNav = new EventEmitter<string>();
|
|
19
|
+
@Output() public updateRouteList = new EventEmitter<boolean>();
|
|
20
|
+
pickupOptions: any = [];
|
|
21
|
+
deliveryOptions: any = [];
|
|
22
|
+
requestParmsForRouteDetails = { pickup_lat_lng: '', delivery_lat_lng: '' }
|
|
23
|
+
customersList: any = [];
|
|
24
|
+
unitsList: any = [];
|
|
25
|
+
materialsList: any = [];
|
|
26
|
+
addRouteForm!: FormGroup;
|
|
27
|
+
@Input() public routeData!: Route;
|
|
28
|
+
@Input() public customerRepoDetails!: CustomerRepoDetailsModel;
|
|
29
|
+
routeId: string | null | undefined;
|
|
30
|
+
preventSave: boolean = false;
|
|
31
|
+
preventInitialSave: boolean = false;
|
|
32
|
+
customersList$!: Observable<any>;
|
|
33
|
+
routeDetails!: { pickup_location: string | null | undefined; delivery_location: string | null | undefined; } | null;
|
|
34
|
+
public destroyer$ = new Subject<boolean>();
|
|
35
|
+
popupDetails: Route;
|
|
36
|
+
enablePopUp: boolean = false;
|
|
37
|
+
prevantPopupClose = false;
|
|
38
|
+
enableForm: boolean = false;
|
|
39
|
+
|
|
40
|
+
constructor(public coolMapService: CoolmapService, public utils: UtilsService, public dialog: MatDialog,
|
|
41
|
+
@Inject('memberData') public config: CoolmapConfigModel) {
|
|
42
|
+
if (this.config.repository === 'customer') {
|
|
43
|
+
this.utils.fetchMaterialsListForCustomer().then((res)=>{
|
|
44
|
+
this.materialsList = res;
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
this.utils.fetchMaterialsList().then((res)=>{
|
|
48
|
+
this.materialsList = res;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
this.utils.fetchUnitsList().then((res)=>{
|
|
53
|
+
this.unitsList = res;
|
|
54
|
+
});
|
|
55
|
+
this.formInit();
|
|
56
|
+
this.utils.getrouteDetailsUtility.subscribe(res => {
|
|
57
|
+
if (res) {
|
|
58
|
+
if (res['event'] !== 'click' && !this.prevantPopupClose) { this.enablePopUp = res['event'] }
|
|
59
|
+
else if (this.enablePopUp && !this.prevantPopupClose) { this.prevantPopupClose = true; }
|
|
60
|
+
if (res['event'] !== 'click' && !res['event'] && this.prevantPopupClose) {
|
|
61
|
+
this.popupDetails = this.utils.getdictValue('route-detailsv2');
|
|
62
|
+
} else { this.popupDetails = res['route'] }
|
|
63
|
+
if (this.enablePopUp) this.popupDetails['created_at'] = this.utils.getDateFormat(new Date(this.popupDetails['created_at']), '/');
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
filterCustomerList() {
|
|
68
|
+
this.customersList$ = this.addRouteForm.controls['customer_name'].valueChanges.pipe(
|
|
69
|
+
startWith(''),
|
|
70
|
+
map(value => this._filter(value || '')),
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
public _filter(value: string): string[] {
|
|
74
|
+
const filterValue = value.toLowerCase();
|
|
75
|
+
return this.customersList.filter((option: any) => option['customer_name'].toLowerCase().includes(filterValue));
|
|
76
|
+
}
|
|
77
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
78
|
+
if (changes['routeData'] && !changes['routeData']['currentValue']) this.inIt(null);
|
|
79
|
+
}
|
|
80
|
+
openDialog(): void {
|
|
81
|
+
const dialogRef = this.dialog.open(DialogComponent, {
|
|
82
|
+
data: { body: 'Are you sure you want to delete this route?' },
|
|
83
|
+
});
|
|
84
|
+
dialogRef.afterClosed().subscribe(res => { if (res) { this.deleteRoute() } });
|
|
85
|
+
}
|
|
86
|
+
editEvent() {
|
|
87
|
+
this.prevantPopupClose = false;
|
|
88
|
+
this.enableForm = true; this.enablePopUp = false;
|
|
89
|
+
this.popupDetails['prevent'] = false;
|
|
90
|
+
this.utils.removeMapEntity.next(this.popupDetails);
|
|
91
|
+
this.inIt(this.popupDetails);
|
|
92
|
+
}
|
|
93
|
+
inIt(changes: Route) {
|
|
94
|
+
if (changes) {
|
|
95
|
+
if (!changes['prevent']) {
|
|
96
|
+
this.preventSave = false;
|
|
97
|
+
this.formControlValue();
|
|
98
|
+
this.patchFormValue(changes).then(() => {
|
|
99
|
+
this.checkAndFetchRouteInformation(true)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (!changes) {
|
|
104
|
+
this.enableForm = true; this.preventSave = true;
|
|
105
|
+
this.patchFormValue().then(() => {
|
|
106
|
+
this.checkAndFetchRouteInformation()
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
ngOnInit(): void {
|
|
111
|
+
this.formControlValue();
|
|
112
|
+
if (this.config.repository === 'customer') {
|
|
113
|
+
this.addRouteForm.patchValue({
|
|
114
|
+
customer_id: this.customerRepoDetails.customer.id,
|
|
115
|
+
customer_name: this.customerRepoDetails.customer.name,
|
|
116
|
+
})
|
|
117
|
+
} else {
|
|
118
|
+
this.utils.fetchCustomersList().then((res)=>{
|
|
119
|
+
this.customersList = res; this.filterCustomerList(); this.addRouteForm.controls['customer_name'].enable();
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
ngAfterViewInit() {
|
|
125
|
+
fromEvent(this.filterPickup.nativeElement, 'keyup').pipe(
|
|
126
|
+
distinctUntilChanged(), debounceTime(150)).pipe(takeUntil(this.destroyer$)).subscribe(() => {
|
|
127
|
+
this.utils.fetchAutoCompleteLocations(this.filterPickup.nativeElement.value).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
128
|
+
this.pickupOptions = res.features;
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
fromEvent(this.filterDelivery.nativeElement, 'keyup').pipe(
|
|
133
|
+
distinctUntilChanged(), debounceTime(150)).pipe(takeUntil(this.destroyer$)).subscribe(() => {
|
|
134
|
+
this.utils.fetchAutoCompleteLocations(this.filterDelivery.nativeElement.value).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
135
|
+
this.deliveryOptions = res.features;
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
formControlValue() {
|
|
141
|
+
this.addRouteForm.controls['pickup_location']?.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
142
|
+
if (this.addRouteForm.value.pickup_location && res !== this.addRouteForm.value.pickup_location) {
|
|
143
|
+
this.addRouteForm.patchValue({ pickup_lat_lng: '' });
|
|
144
|
+
this.addRouteForm.controls['pickup_lat_lng'].markAsTouched();
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
this.addRouteForm.controls['delivery_location']?.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
149
|
+
if (this.addRouteForm.value.delivery_location && res !== this.addRouteForm.value.delivery_location) {
|
|
150
|
+
this.addRouteForm.patchValue({ delivery_lat_lng: '' });
|
|
151
|
+
this.addRouteForm.controls['delivery_lat_lng'].markAsTouched();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
formInit() {
|
|
157
|
+
this.addRouteForm = new FormGroup({
|
|
158
|
+
route_name: new FormControl('', [Validators.required]),
|
|
159
|
+
customer_name: new FormControl({ value: '', disabled: true }, [Validators.required]),
|
|
160
|
+
customer_id: new FormControl(''),
|
|
161
|
+
materials_id: new FormControl('', [Validators.required]),
|
|
162
|
+
unit_id: new FormControl('', [Validators.required]),
|
|
163
|
+
path: new FormControl('', [Validators.required]),
|
|
164
|
+
pickup_location: new FormControl('', [Validators.required]),
|
|
165
|
+
pickup_lat_lng: new FormControl('', [Validators.required]),
|
|
166
|
+
delivery_location: new FormControl('', [Validators.required]),
|
|
167
|
+
delivery_lat_lng: new FormControl('', [Validators.required]),
|
|
168
|
+
estimated_distance: new FormControl('', [Validators.required]),
|
|
169
|
+
estimated_time: new FormControl('', [Validators.required]),
|
|
170
|
+
note: new FormControl('', [Validators.maxLength(2048)]),
|
|
171
|
+
trucker_pay_estimate: new FormControl(null),
|
|
172
|
+
customer_price_estimate: new FormControl(null),
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async patchFormValue(data?: Route) {
|
|
177
|
+
this.addRouteForm.reset();
|
|
178
|
+
this.addRouteForm.patchValue(data!);
|
|
179
|
+
if (this.config.repository === 'customer') {
|
|
180
|
+
this.addRouteForm.patchValue({
|
|
181
|
+
customer_id: this.customerRepoDetails.customer.id,
|
|
182
|
+
customer_name: this.customerRepoDetails.customer.name,
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
this.routeId = data?.route_id;
|
|
186
|
+
this.routeDetails = data ? { pickup_location: data.pickup_location, delivery_location: data.delivery_location } : null;
|
|
187
|
+
this.addRouteForm.valueChanges.pipe(takeUntil(this.destroyer$)).subscribe(res => {
|
|
188
|
+
if (res) { if (this.preventInitialSave) this.preventInitialSave = false }
|
|
189
|
+
});
|
|
190
|
+
this.filterCustomerList();
|
|
191
|
+
await true;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
selectedLongLat(type: string, event: any) {
|
|
195
|
+
if (type === 'pickup') {
|
|
196
|
+
this.addRouteForm.patchValue({
|
|
197
|
+
pickup_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
|
|
198
|
+
});
|
|
199
|
+
this.coolMapService.clearBoundWithCordinates();
|
|
200
|
+
} else if (type === 'delivery') {
|
|
201
|
+
this.addRouteForm.patchValue({
|
|
202
|
+
delivery_lat_lng: (event.geometry.coordinates[1] + ',' + event.geometry.coordinates[0]).toString()
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
this.checkAndFetchRouteInformation();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
checkAndFetchRouteInformation(isinitial?: boolean) {
|
|
209
|
+
if (this.addRouteForm.value?.delivery_lat_lng?.length > 0 && this.addRouteForm.value?.pickup_lat_lng?.length > 0 && this.addRouteForm.value.unit_id) {
|
|
210
|
+
let unit = this.unitsList.find((x: any) => x.id === this.addRouteForm.value.unit_id);
|
|
211
|
+
const param = {
|
|
212
|
+
delivery_lat_lng: this.addRouteForm.value.delivery_lat_lng,
|
|
213
|
+
pickup_lat_lng: this.addRouteForm.value.pickup_lat_lng,
|
|
214
|
+
unit: unit?.type
|
|
215
|
+
};
|
|
216
|
+
this.utils.postdata('calculate/routes/estimation', param).pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
217
|
+
if (res && res['path']) {
|
|
218
|
+
this.addRouteForm.patchValue({
|
|
219
|
+
estimated_distance: res['dist'],
|
|
220
|
+
estimated_time: res['time'],
|
|
221
|
+
path: res['path'],
|
|
222
|
+
trucker_pay_estimate: res['trucker_haul_cost'],
|
|
223
|
+
customer_price_estimate: (+(+res['trucker_haul_cost'] / 0.80).toFixed(2))
|
|
224
|
+
});
|
|
225
|
+
let path = res['path'].split(';');
|
|
226
|
+
path = path.map((ele: string | any) => { return ele = this.formateLatLong(ele) });
|
|
227
|
+
res['path'] = path;
|
|
228
|
+
const element: any = {
|
|
229
|
+
type: 'FeatureCollection',
|
|
230
|
+
features: [{ type: 'Feature', properties: {}, geometry: { type: 'LineString', coordinates: res['path'] } }]
|
|
231
|
+
}
|
|
232
|
+
this.coolMapService.removeRouteAndMarker(1).then(() => {
|
|
233
|
+
const unit = this.unitsList.find((x: any) => x.id === this.addRouteForm.value.unit_id);
|
|
234
|
+
const materialDetails = this.materialsList.find((x: any) => x.sub_material_id === this.addRouteForm.value.materials_id);
|
|
235
|
+
this.coolMapService.loadMapProperty(element, 1, unit?.type,
|
|
236
|
+
{
|
|
237
|
+
pickup_location: this.addRouteForm.get('pickup_location')?.value,
|
|
238
|
+
delivery_location: this.addRouteForm.get('delivery_location')?.value,
|
|
239
|
+
route_name: this.addRouteForm.get('route_name')?.value,
|
|
240
|
+
materialLabel: materialDetails?.label,
|
|
241
|
+
unit: unit?.type
|
|
242
|
+
}).then((res) => { this.preventSave = true });
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
this.coolMapService.removeRouteAndMarker(1);
|
|
246
|
+
this.utils.openSnackBar(res['status'], 'error');
|
|
247
|
+
}
|
|
248
|
+
if (this.routeId && isinitial) this.preventInitialSave = true;
|
|
249
|
+
});
|
|
250
|
+
} else { this.coolMapService.removeRouteAndMarker(1) }
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
formateLatLong(latlong: string) { return latlong ? latlong.split(',').map(x => +x).reverse() : null }
|
|
254
|
+
saveRoute() {
|
|
255
|
+
if (this.addRouteForm.valid) {
|
|
256
|
+
this.preventSave = false;
|
|
257
|
+
const data = this.addRouteForm.getRawValue();
|
|
258
|
+
const url = this.routeId ? this.utils.postdata('update/routes', data) : this.utils.postdata('add/routes', data)
|
|
259
|
+
if (this.routeId) data['id'] = this.routeId;
|
|
260
|
+
url.pipe(takeUntil(this.destroyer$)).subscribe((res: any) => {
|
|
261
|
+
if (res.success) {
|
|
262
|
+
this.updateRouteList.emit(true);
|
|
263
|
+
this.utils.openSnackBar(res.message, 'success');
|
|
264
|
+
this.preventInitialSave = true;
|
|
265
|
+
this.preventSave = true;
|
|
266
|
+
if (!this.routeId) this.changeNav.next('Addroute');
|
|
267
|
+
} else {
|
|
268
|
+
this.utils.openSnackBar(res.message, 'error');
|
|
269
|
+
this.preventSave = true;
|
|
270
|
+
}
|
|
271
|
+
}, (err) => { if (err) { this.preventSave = true; } });
|
|
272
|
+
} else {
|
|
273
|
+
this.addRouteForm.markAllAsTouched();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
deleteRoute() {
|
|
277
|
+
this.preventSave = false;
|
|
278
|
+
this.utils.postdata('delete/routes', { uuid: this.routeId }).subscribe(res => {
|
|
279
|
+
if (res['data']['success']) {
|
|
280
|
+
this.utils.openSnackBar(res['data']['message'], 'success');
|
|
281
|
+
this.updateRouteList.emit(true);
|
|
282
|
+
this.changeNav.next('Addroute');
|
|
283
|
+
this.preventInitialSave = true;
|
|
284
|
+
this.preventSave = true;
|
|
285
|
+
} else {
|
|
286
|
+
this.utils.openSnackBar('Somthing went wrong', 'error');
|
|
287
|
+
this.preventSave = true;
|
|
288
|
+
}
|
|
289
|
+
}, (err) => { this.preventSave = true })
|
|
290
|
+
}
|
|
291
|
+
ngOnDestroy(): void {
|
|
292
|
+
this.destroyer$.next(true);
|
|
293
|
+
this.destroyer$.unsubscribe();
|
|
294
|
+
}
|
|
295
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<div class="jobcode_detailprt" (click)="isOverlapRouteSection = false" *ngIf="jobdetail" [ngClass]="{'overlap': !isOverlapRouteSection}" cdkDrag>
|
|
2
|
+
<span class="close"><mat-icon (click)="clearJob()">clear</mat-icon></span>
|
|
3
|
+
<div class="job_details_area">
|
|
4
|
+
<div class="detailnameprt">
|
|
5
|
+
<app-jobcode-status [jobValue]="jobdetail"></app-jobcode-status>
|
|
6
|
+
</div>
|
|
7
|
+
<app-jobcode-overview [jobValue]="jobdetail"></app-jobcode-overview>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
|
|
11
|
+
<div class="route_listprt" (click)="isOverlapRouteSection = true" [ngClass]="{ 'show': isVisible, 'overlap': isOverlapRouteSection}">
|
|
12
|
+
<div class="listing_toggle" (click)="toggleSidemenu()">
|
|
13
|
+
<img src="assets/images/route.svg" alt="" />
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="listing_box">
|
|
17
|
+
<div class="closebtn" (click)="toggleSidemenu()">
|
|
18
|
+
<mat-icon>clear</mat-icon>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="btnprt">
|
|
22
|
+
<h2> List of Routes </h2>
|
|
23
|
+
<button (click)="masterToggle()">{{routes && routes.length > 0 && routes.length === selectedRoute.selected.length ? 'Uncheck' : 'Check'}} All</button>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<app-job-route-list [routes]="routes" [masterRoutes]="masterRoutes" [selectedRoute]="selectedRoute" (changeRoutes)="routes = $event" (changeSelectedRoute)="selectedRoute = $event"></app-job-route-list>
|
|
27
|
+
<cdk-virtual-scroll-viewport itemSize="50" class="routeList-viewport">
|
|
28
|
+
<ul *ngIf="routes['length'] > 0">
|
|
29
|
+
<li *ngFor="let list of routes">
|
|
30
|
+
<div class="iconprt">
|
|
31
|
+
<span>
|
|
32
|
+
<input type="checkbox" [checked]="selectedRoute.isSelected(list)"
|
|
33
|
+
(change)="$event ? selectRoute(list) : null" /><label> </label>
|
|
34
|
+
<div class="border"></div>
|
|
35
|
+
</span>
|
|
36
|
+
<div class="statusunit" [ngClass]="list['unit']">{{list['unit']}}</div>
|
|
37
|
+
<div class="infoicon">
|
|
38
|
+
<img (mouseenter)="togglerouteDetails(true, list)" (mouseout)="togglerouteDetails(false, list, true)"
|
|
39
|
+
(click)="togglerouteDetails('click', list)" src="assets/images/info_icon.png" [alt]="" />
|
|
40
|
+
</div>
|
|
41
|
+
<div class="infoicon" *ngIf="config.repository === 'customer'">
|
|
42
|
+
<img src="assets/images/share_icon.png" (click)="openShareRouteModal(list)" [alt]="" />
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div class="pickprtbox">
|
|
46
|
+
<h2> {{list['route_name']}} </h2>
|
|
47
|
+
<h3><ng-container *ngIf="config?.repository === 'coolmap'">{{list['customer_name']}} | </ng-container>{{config.repository === 'coolmap' ? list['material'] : list['materialLabel']}}</h3>
|
|
48
|
+
<div class="pickdropprt">
|
|
49
|
+
<div class="pickprt">
|
|
50
|
+
<b>
|
|
51
|
+
<h4>{{list['pickup_location']}}</h4>
|
|
52
|
+
</b>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="dropprt">
|
|
55
|
+
<b>
|
|
56
|
+
<h4>{{list['delivery_location']}}</h4>
|
|
57
|
+
</b>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</li>
|
|
62
|
+
</ul>
|
|
63
|
+
<p style="color: #fff;" *ngIf="routes.length === 0">No Route found</p>
|
|
64
|
+
</cdk-virtual-scroll-viewport>
|
|
65
|
+
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class="route_detail" *ngIf="detailsCardEnable">
|
|
69
|
+
<div class="closebtnroutedetail" (click)="detailsCardEnable = false; preventMouseout = false">
|
|
70
|
+
<mat-icon>clear</mat-icon>
|
|
71
|
+
</div>
|
|
72
|
+
<lib-route-info-card [propData]="{className: 'listRoutecard', repository: config['repository']}" [popupData]="routeCardDetail"></lib-route-info-card>
|
|
73
|
+
<div class="createTxt">
|
|
74
|
+
<small>
|
|
75
|
+
Created by {{routeCardDetail?.created_by_name}} on {{routeCardDetail?.created_at}}
|
|
76
|
+
</small>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|