@aggdirect/coolmap 2.9.6 → 2.9.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 (115) hide show
  1. package/karma.conf.js +44 -0
  2. package/ng-package.json +7 -0
  3. package/package.json +10 -19
  4. package/src/assets/mixin.scss +28 -0
  5. package/src/assets/palette.scss +24 -0
  6. package/src/assets/variable.scss +15 -0
  7. package/src/lib/component/add-route/add-route.component.html +172 -0
  8. package/src/lib/component/add-route/add-route.component.scss +243 -0
  9. package/src/lib/component/add-route/add-route.component.spec.ts +23 -0
  10. package/src/lib/component/add-route/add-route.component.ts +394 -0
  11. package/src/lib/component/job-code/job-code.component.html +79 -0
  12. package/src/lib/component/job-code/job-code.component.scss +396 -0
  13. package/src/lib/component/job-code/job-code.component.ts +146 -0
  14. package/src/lib/component/map/map.component.css +0 -0
  15. package/src/lib/component/map/map.component.html +4 -0
  16. package/src/lib/component/map/map.component.spec.ts +23 -0
  17. package/src/lib/component/map/map.component.ts +34 -0
  18. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.html +46 -0
  19. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.scss +18 -0
  20. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.spec.ts +23 -0
  21. package/src/lib/component/nav/layout/add-route-nav/add-route-nav.component.ts +130 -0
  22. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.html +48 -0
  23. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.scss +24 -0
  24. package/src/lib/component/nav/layout/job-code-nav/job-code-nav.component.ts +143 -0
  25. package/src/lib/component/nav/nav.component.html +19 -0
  26. package/src/lib/component/nav/nav.component.scss +67 -0
  27. package/src/lib/component/nav/nav.component.ts +38 -0
  28. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.html +56 -0
  29. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.scss +168 -0
  30. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.spec.ts +23 -0
  31. package/src/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.ts +43 -0
  32. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.html +73 -0
  33. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.scss +227 -0
  34. package/src/lib/component/route-jobcode-list/route-jobcode-list.component.ts +233 -0
  35. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.html +7 -0
  36. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.scss +10 -0
  37. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.spec.ts +23 -0
  38. package/src/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.ts +15 -0
  39. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.html +28 -0
  40. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.scss +172 -0
  41. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.spec.ts +23 -0
  42. package/src/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.ts +20 -0
  43. package/src/lib/component/shared/dialog/dialog.component.html +7 -0
  44. package/src/lib/component/shared/dialog/dialog.component.scss +30 -0
  45. package/src/lib/component/shared/dialog/dialog.component.ts +18 -0
  46. package/src/lib/component/shared/estimation-display/estimation-display.component.html +7 -0
  47. package/src/lib/component/shared/estimation-display/estimation-display.component.scss +7 -0
  48. package/src/lib/component/shared/estimation-display/estimation-display.component.ts +13 -0
  49. package/src/lib/component/shared/job-route-list/job-route-list.component.html +46 -0
  50. package/src/lib/component/shared/job-route-list/job-route-list.component.scss +15 -0
  51. package/src/lib/component/shared/job-route-list/job-route-list.component.spec.ts +23 -0
  52. package/src/lib/component/shared/job-route-list/job-route-list.component.ts +54 -0
  53. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.html +11 -0
  54. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.scss +13 -0
  55. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.spec.ts +23 -0
  56. package/src/lib/component/shared/jobcode-overview/jobcode-overview.component.ts +19 -0
  57. package/src/lib/component/shared/jobcode-status/jobcode-status.component.html +5 -0
  58. package/src/lib/component/shared/jobcode-status/jobcode-status.component.scss +40 -0
  59. package/src/lib/component/shared/jobcode-status/jobcode-status.component.spec.ts +23 -0
  60. package/src/lib/component/shared/jobcode-status/jobcode-status.component.ts +11 -0
  61. package/src/lib/component/shared/route-info-card/route-info-card.component.html +19 -0
  62. package/src/lib/component/shared/route-info-card/route-info-card.component.scss +50 -0
  63. package/src/lib/component/shared/route-info-card/route-info-card.component.spec.ts +23 -0
  64. package/src/lib/component/shared/route-info-card/route-info-card.component.ts +74 -0
  65. package/src/lib/component/shared/searchoptiongroup/searchoptiongroup.component.css +3 -0
  66. package/src/lib/component/shared/searchoptiongroup/searchoptiongroup.component.html +6 -0
  67. package/src/lib/component/shared/searchoptiongroup/searchoptiongroup.component.spec.ts +23 -0
  68. package/src/lib/component/shared/searchoptiongroup/searchoptiongroup.component.ts +21 -0
  69. package/src/lib/coolmap.module.ts +120 -0
  70. package/{public-api.d.ts → src/public-api.ts} +8 -0
  71. package/src/test.ts +27 -0
  72. package/tsconfig.lib.json +15 -0
  73. package/tsconfig.lib.prod.json +10 -0
  74. package/tsconfig.spec.json +17 -0
  75. package/esm2022/aggdirect-coolmap.mjs +0 -5
  76. package/esm2022/lib/component/add-route/add-route.component.mjs +0 -433
  77. package/esm2022/lib/component/job-code/job-code.component.mjs +0 -181
  78. package/esm2022/lib/component/map/map.component.mjs +0 -39
  79. package/esm2022/lib/component/nav/layout/add-route-nav/add-route-nav.component.mjs +0 -151
  80. package/esm2022/lib/component/nav/layout/job-code-nav/job-code-nav.component.mjs +0 -150
  81. package/esm2022/lib/component/nav/nav.component.mjs +0 -54
  82. package/esm2022/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.mjs +0 -77
  83. package/esm2022/lib/component/route-jobcode-list/route-jobcode-list.component.mjs +0 -319
  84. package/esm2022/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.mjs +0 -19
  85. package/esm2022/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.mjs +0 -37
  86. package/esm2022/lib/component/shared/dialog/dialog.component.mjs +0 -31
  87. package/esm2022/lib/component/shared/estimation-display/estimation-display.component.mjs +0 -18
  88. package/esm2022/lib/component/shared/job-route-list/job-route-list.component.mjs +0 -79
  89. package/esm2022/lib/component/shared/jobcode-overview/jobcode-overview.component.mjs +0 -24
  90. package/esm2022/lib/component/shared/jobcode-status/jobcode-status.component.mjs +0 -15
  91. package/esm2022/lib/component/shared/route-info-card/route-info-card.component.mjs +0 -62
  92. package/esm2022/lib/component/shared/searchoptiongroup/searchoptiongroup.component.mjs +0 -25
  93. package/esm2022/lib/coolmap.module.mjs +0 -193
  94. package/esm2022/public-api.mjs +0 -19
  95. package/fesm2022/aggdirect-coolmap.mjs +0 -1778
  96. package/fesm2022/aggdirect-coolmap.mjs.map +0 -1
  97. package/index.d.ts +0 -5
  98. package/lib/component/add-route/add-route.component.d.ts +0 -73
  99. package/lib/component/job-code/job-code.component.d.ts +0 -41
  100. package/lib/component/map/map.component.d.ts +0 -15
  101. package/lib/component/nav/layout/add-route-nav/add-route-nav.component.d.ts +0 -49
  102. package/lib/component/nav/layout/job-code-nav/job-code-nav.component.d.ts +0 -42
  103. package/lib/component/nav/nav.component.d.ts +0 -31
  104. package/lib/component/route-jobcode-list/job-code-list-card/job-code-list-card.component.d.ts +0 -20
  105. package/lib/component/route-jobcode-list/route-jobcode-list.component.d.ts +0 -42
  106. package/lib/component/route-jobcode-list/sms-card-details-overview/sms-card-details-overview.component.d.ts +0 -9
  107. package/lib/component/route-jobcode-list/view-route-list-card/view-route-list-card.component.d.ts +0 -12
  108. package/lib/component/shared/dialog/dialog.component.d.ts +0 -13
  109. package/lib/component/shared/estimation-display/estimation-display.component.d.ts +0 -8
  110. package/lib/component/shared/job-route-list/job-route-list.component.d.ts +0 -26
  111. package/lib/component/shared/jobcode-overview/jobcode-overview.component.d.ts +0 -10
  112. package/lib/component/shared/jobcode-status/jobcode-status.component.d.ts +0 -7
  113. package/lib/component/shared/route-info-card/route-info-card.component.d.ts +0 -32
  114. package/lib/component/shared/searchoptiongroup/searchoptiongroup.component.d.ts +0 -14
  115. package/lib/coolmap.module.d.ts +0 -46
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { JobCodeListCardComponent } from './job-code-list-card.component';
4
+
5
+ describe('JobCodeListCardComponent', () => {
6
+ let component: JobCodeListCardComponent;
7
+ let fixture: ComponentFixture<JobCodeListCardComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ JobCodeListCardComponent ]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(JobCodeListCardComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,43 @@
1
+ import { Component, EventEmitter, Input, Output, Inject } from '@angular/core';
2
+ import { CoolmapConfigModel, Route, UtilsService } from '@aggdirect/coolmap-services';
3
+
4
+ @Component({
5
+ selector: 'app-job-code-list-card',
6
+ templateUrl: './job-code-list-card.component.html',
7
+ styleUrls: ['./job-code-list-card.component.scss']
8
+ })
9
+ export class JobCodeListCardComponent {
10
+ @Input() public route!: Route;
11
+ @Output() public routeSeletion = new EventEmitter();
12
+ @Output() public toggleDrivermenu = new EventEmitter();
13
+ @Input() public emitJobdetails: any;
14
+ @Input() public preventCloseDetails!: boolean;
15
+ constructor(public utils: UtilsService,
16
+ @Inject('memberData') public config: CoolmapConfigModel) { }
17
+
18
+ selectRoute(route: Route) { this.routeSeletion.emit(route) }
19
+ toggleDriverlist(mouseevntType: boolean | string, route: Route, isHoverOut?: boolean) {
20
+ const data = { mouseevntType, route, isHoverOut }
21
+ this.toggleDrivermenu.emit(data);
22
+ if (mouseevntType === 'click') this.utils.setdictValue('driver-details', JSON.stringify(this.route));
23
+ }
24
+ toggleJobCodeDetails(mouseEventType: boolean, route: Route) {
25
+ if (mouseEventType) { route['type'] = 'jobcode'; this.emitJobdetails.emitroute.emit(route) }
26
+ else if(!mouseEventType && this.preventCloseDetails){
27
+ route = this.utils.getdictValue('route-details');
28
+ route['type'] = 'jobcode'; this.emitJobdetails.emitroute.emit(route)
29
+ }
30
+ else if (!mouseEventType && !this.preventCloseDetails) this.emitJobdetails.clearJobDetailsFromList.emit(true);
31
+ }
32
+ calculateStatusPercentage(type: string, route: any) {
33
+ const total = route['Done'] + route['Ongoing'] + route['Open'];
34
+ if (type === 'done') { return Math.round((100 * route['Done']) / total) }
35
+ else if (type === 'ongoing') { return Math.round((100 * route['Ongoing']) / total) }
36
+ else if (type === 'open') { return Math.round((100 * route['Open']) / total) }
37
+ else { return null }
38
+ }
39
+ setRouteItem(){
40
+ this.utils.preVentJobdetailclose.next(true);
41
+ this.utils.setdictValue('route-details', JSON.stringify(this.route));
42
+ }
43
+ }
@@ -0,0 +1,73 @@
1
+ <div class="scrollprt addroutelist" [class.viewroute]="visiblesection('addroute')"
2
+ [class.jobList]="visiblesection('jobcode')">
3
+ <button (click)="showRoute()" [disabled]="loader" *ngIf="selectedRoute.selected.length" class="show_routebtn">Show all
4
+ route</button>
5
+ <cdk-virtual-scroll-viewport itemSize="50" [class.jobscroll]="visiblesection('jobcode')" class="example-viewport">
6
+ <mat-spinner *ngIf="loader"></mat-spinner>
7
+ <ul *ngIf="!loader && data.length > 0">
8
+ <li [class.active]="route['isActive'] && visiblesection('addroute')" *ngFor="let route of data">
9
+ <app-job-code-list-card *ngIf="visiblesection('jobcode')"
10
+ (toggleDrivermenu)="toggleDrivermenu($event)"
11
+ (routeSeletion)="selectRoute($event)"
12
+ [preventCloseDetails]="preventDetailsClose"
13
+ [emitJobdetails]="{emitroute, clearJobDetailsFromList}"
14
+ [route]="checkroutes(route)">
15
+ </app-job-code-list-card>
16
+ <app-view-route-list-card *ngIf="visiblesection('addroute')"
17
+ [emitrouteevent]="emitroute"
18
+ [route]="route">
19
+ </app-view-route-list-card>
20
+ </li>
21
+ </ul>
22
+ <p *ngIf="!loader && data.length === 0">{{visiblesection('addroute') ? 'No Route found' : 'No Job code found.'}}</p>
23
+ </cdk-virtual-scroll-viewport>
24
+ </div>
25
+
26
+ <div class="driver_list" *ngIf="isDriverList">
27
+ <div class="driver_headingprt">
28
+ <h2>Driver List</h2>
29
+ <button *ngIf="driverList.driver_list?.length > 0" (click)="isSmsList = true">SMS</button>
30
+ <div class="closebtn" (click)="isDriverList = false; preventMouseout = false; isSmsList = false">
31
+ <mat-icon>clear</mat-icon>
32
+ </div>
33
+ </div>
34
+ <ul class="driverList" *ngIf="driverList && driverList.driver_list">
35
+ <li *ngFor="let driver of driverList?.driver_list">
36
+ <img src="assets/images/driver_icon.png" [alt]="driver['driver_name']" />
37
+ <div class="driver_detail">
38
+ <b>{{driver['driver_name']}}</b> <span>{{driver['trucking_company']}}</span>
39
+ <div class="cont_del">
40
+ <small>Driver contact: <b>{{driver['driver_phone'] ? driver['driver_phone'] : 'N/A'}}</b></small>
41
+ <small>Company contact: <b>{{driver['trucking_company_phone'] ? driver['trucking_company_phone'] : 'N/A'}}</b></small>
42
+ </div>
43
+ </div>
44
+ </li>
45
+ <p *ngIf="driverList.driver_list?.length === 0" style="font-weight:700; text-align:center;">
46
+ No Driver found
47
+ </p>
48
+ </ul>
49
+ <div class="smslist" *ngIf="isSmsList">
50
+ <div class="heading">
51
+ <h2>SMS All Drivers</h2>
52
+ <div class="closebtn" (click)="isSmsList = false">
53
+ <mat-icon>clear</mat-icon>
54
+ </div>
55
+ </div>
56
+ <div class="detailprt">
57
+ <app-sms-card-details-overview [jobValue]="driverList"></app-sms-card-details-overview>
58
+ <div class="form_input">
59
+ <mat-form-field class="example-full-width">
60
+ <textarea matInput placeholder="Text here..." autocomplete="nope" column="10"
61
+ [formControl]="driverMessage"></textarea>
62
+ <mat-hint>{{driverMessage.value?.length}} / 256</mat-hint>
63
+ </mat-form-field>
64
+ <button *ngIf="!messageLoader" [disabled]="!driverMessage.value || driverMessage.invalid" (click)="sendMessage()">
65
+ Send SMS
66
+ </button>
67
+ </div>
68
+ </div>
69
+ <div class="loader">
70
+ <mat-spinner *ngIf="messageLoader"></mat-spinner>
71
+ </div>
72
+ </div>
73
+ </div>
@@ -0,0 +1,227 @@
1
+ @import "../../../assets/variable.scss";
2
+ .driver_iconprt{
3
+ position: absolute;
4
+ right: 10px;
5
+ top: 12px;
6
+ z-index: 9999;
7
+ img{
8
+ width: 25px;
9
+ height: 25px;
10
+ }
11
+ }
12
+ .driver_list{
13
+ background: $white;
14
+ position: fixed;
15
+ width: 300px;
16
+ top: 10px;
17
+ left: 360px;
18
+ border-top-left-radius: 20px;
19
+ border-top-right-radius: 20px;
20
+ .driver_headingprt{
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ padding: 0 15px;
25
+ button{
26
+ background: none;
27
+ border: 1px solid #ccc;
28
+ border-radius: 10px;
29
+ padding: 5px 20px;
30
+ &:hover{
31
+ background: $blue;
32
+ color: $white;
33
+ }
34
+ }
35
+ }
36
+ h2{
37
+ font-size: 20px;
38
+ }
39
+ .driverList{
40
+ height: 300px;
41
+ overflow: auto;
42
+ li{
43
+ display: flex;
44
+ padding: 10px;
45
+ align-items: flex-start;
46
+ cursor: pointer;
47
+ border-bottom: 1px solid $white;
48
+ background: #eee;
49
+ img{
50
+ width: 35px;
51
+ height: 35px;
52
+ border-radius: 100%;
53
+ margin-right: 10px;
54
+ }
55
+ .driver_detail{
56
+ width: calc(100% - 45px);
57
+ display: flex;
58
+ flex-direction: column;
59
+ justify-content: flex-start;
60
+ b{
61
+ white-space: nowrap;
62
+ overflow: hidden;
63
+ text-overflow: ellipsis;
64
+ max-width: 135px;
65
+ font-size: 0.9rem;
66
+ }
67
+ span{
68
+ white-space: nowrap;
69
+ overflow: hidden;
70
+ text-overflow: ellipsis;
71
+ max-width: 150px;
72
+ font-size: 0.8rem;
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ &:after{
79
+ height: 10px;
80
+ background: $white;
81
+ border-bottom-right-radius: 20px;
82
+ border-bottom-left-radius: 20px;
83
+ content: "";
84
+ position: absolute;
85
+ bottom: -9px;
86
+ width: 100%;
87
+ }
88
+ }
89
+ .smslist{
90
+ background: $white;
91
+ position: absolute;
92
+ width: 480px;
93
+ top: 0px;
94
+ left: 105%;
95
+ border-radius: 20px;
96
+ padding-bottom: 20px;
97
+ .heading{
98
+ display: flex;
99
+ justify-content: space-between;
100
+ align-items: center;
101
+ padding: 0 15px;
102
+ }
103
+ .detailprt{
104
+ padding: 0 15px;
105
+ span{
106
+ display: flex;
107
+ margin-bottom: 12px;
108
+ font-size: 0.8rem;
109
+ align-items: center;
110
+ label{
111
+ font-weight: 600;
112
+ width: 37%;
113
+ }
114
+ }
115
+ .form_input{
116
+ display: flex;
117
+ flex-direction: column;
118
+ font-size: 0.8rem;
119
+ button{
120
+ background: $blue;
121
+ padding: 10px 18px 10px 18px;
122
+ color: white;
123
+ font-size: 0.8125rem;
124
+ border-radius: 30px;
125
+ display: flex;
126
+ align-self: flex-end;
127
+ }
128
+ }
129
+ }
130
+ }
131
+ .closebtn{
132
+ box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.11);
133
+ border-radius: 100%;
134
+ width: 30px;
135
+ height: 30px;
136
+ display: flex;
137
+ justify-content: center;
138
+ align-items: center;
139
+ cursor: pointer;
140
+ background: #f5f5f5;
141
+ }
142
+ .show_routebtn{
143
+ font-size: 0.9rem;
144
+ margin-bottom: 20px;
145
+ padding: 6px 11px;
146
+ border-radius: 5%;
147
+ position: absolute;
148
+ top: 8px;
149
+ right: 10px;
150
+ background-color: transparent;
151
+ color: $buttoncolor;
152
+ border: 1px solid $buttoncolor;
153
+ border-radius: 10px;
154
+ box-shadow: none;
155
+ &:hover{
156
+ background-color: $buttoncolor;
157
+ color: $white;
158
+ }
159
+ }
160
+ .cont_del{
161
+ margin-top: 10px;
162
+ small{
163
+ display: block;
164
+ }
165
+ }
166
+ .jobList{
167
+ ul {
168
+ margin: 0 0.93em 0 0px;
169
+ width: 100%;
170
+ li{
171
+ position: relative;
172
+ background: $softwhite;
173
+ padding: 10px 10px;
174
+ border-radius: 15px;
175
+ margin-bottom: 5px;
176
+ border: 1px solid $softwhite;
177
+ border-left: 3px solid $softwhite;
178
+ cursor: pointer;
179
+ height: inherit;
180
+ width: 15.62em;
181
+
182
+ }
183
+ }
184
+ }
185
+ .viewroute{
186
+ ul {
187
+ // margin: 0 15px 0 15px;
188
+ width: 100%;
189
+ li{
190
+ position: relative;
191
+ background: $softwhite;
192
+ padding: 7px 10px;
193
+ border-radius: 15px;
194
+ margin-bottom: 5px;
195
+ border: 1px solid $softwhite;
196
+ border-left: 3px solid $softwhite;
197
+ cursor: pointer;
198
+ // height: 16.4vh;
199
+ width: 15.62em;
200
+ // @media (min-width:1600px) {
201
+ // height: 12.4vh;
202
+ // }
203
+
204
+ &.active{
205
+ border: 1px solid $green;
206
+ border-left: 3px solid $green;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ .loader{
212
+ position: absolute;
213
+ height: 100%;
214
+ top: 0;
215
+ left: 0;
216
+ width: 100%;
217
+ display: flex;
218
+ align-items: center;
219
+ justify-content: center;
220
+ pointer-events: none;
221
+ }
222
+
223
+
224
+ .example-viewport {
225
+ height: 74vh;
226
+ }
227
+
@@ -0,0 +1,233 @@
1
+ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core';
2
+ import { SelectionModel } from '@angular/cdk/collections';
3
+ import { FormControl, Validators } from '@angular/forms';
4
+ import { CoolmapService, Route, UtilsService } from '@aggdirect/coolmap-services';
5
+
6
+ @Component({
7
+ selector: 'app-route-jobcode-list',
8
+ templateUrl: './route-jobcode-list.component.html',
9
+ styleUrls: ['./route-jobcode-list.component.scss']
10
+ })
11
+ export class RouteJobCodeListComponent implements OnInit, OnChanges {
12
+ @Input() public loader = true;
13
+ @Input() public type: string = '';
14
+ @Input() public data: Route[] = [];
15
+ @Input() public currentNav: string = ''
16
+ @Output() public emitroute = new EventEmitter();
17
+ @Output() public showAllRoute = new EventEmitter();
18
+ preventMouseout: boolean = false;
19
+ filterList: Route[] = this.data;
20
+ @Input() public searchTerm!: any;
21
+ isDriverList: boolean = false;
22
+ public selectedRoute = new SelectionModel<any>(true, [])
23
+ driverList!: any;
24
+ preventListSelect: boolean = false;
25
+ @Output() public clearJobDetailsFromList = new EventEmitter();
26
+ preventDetailsClose = false;
27
+ messageLoader: boolean = false;
28
+ driverMessage = new FormControl('', [Validators.maxLength(256)]);
29
+ @Input() public clearListSeletion: boolean;
30
+ isSmsList: boolean = false;
31
+ constructor(public coolMap: CoolmapService, public utils: UtilsService) { this.driverList = [] }
32
+ ngOnInit(): void {
33
+ this.utils.getpreVentJobdetailclose.subscribe(res => { this.preventDetailsClose = res });
34
+ this.utils.removeMapEntityUtility.subscribe((res: Route) => {this.passRoute(res)});
35
+ }
36
+ passRoute(job: Route) {
37
+ this.data.forEach((each) => { if (each['route_id'] !== job['route_id']) { each['isActive'] = false } else { each['isActive'] = true } });
38
+ if (this.type == 'addroute') this.filterList.forEach(ele => this.coolMap.filterRoute(ele['route_id'], 'none'));
39
+ }
40
+ selectRoute(route: any) {
41
+ if (!this.preventListSelect) {
42
+ this.preventListSelect = true;
43
+ this.selectedRoute.toggle(route);
44
+ this.clearJobDetailsFromList.emit(true);
45
+ this.utils.preVentJobdetailclose.next(false);
46
+ this.filterList.forEach(ele => this.coolMap.filterRoute(ele['job_id'], 'none'));
47
+ this.clearList();
48
+ this.selectedRoute.selected.forEach((ele, index) => {
49
+ this.coolMap.filterRoute(ele['job_id'], 'visible', ((this.selectedRoute.selected.length - 1) === index)).then(() => {
50
+ this.preventListSelect = false;
51
+ })
52
+ });
53
+ if (!this.selectedRoute.selected.length) {
54
+ this.preventListSelect = false
55
+ this.data.forEach(ele => this.coolMap.filterRoute(ele['job_id'], 'visible'));
56
+ };
57
+ }
58
+ }
59
+ checkroutes(route: Route) {
60
+ const selectedRoute = this.selectedRoute.selected;
61
+ this.filterList = this.filterList.map(ele => { ele['isSelected'] = false; return ele })
62
+ if (selectedRoute.length > 0) {
63
+ selectedRoute.forEach(ele => {
64
+ if (route['order_number'] === ele['order_number']) { ele['isSelected'] = true }
65
+ });
66
+ } return route
67
+ }
68
+ ngOnChanges(changes: SimpleChanges) {
69
+ setTimeout(() => {
70
+ if (this.currentNav === 'Addroute' && (this.data.length < this.filterList.length)) {
71
+ const index = this.filterList.findIndex(ele => ele.isActive);
72
+ if (index > 0) this.filterList[index].isActive = false;
73
+ this.data.forEach((ele: Route, indexForData: number) => {
74
+ const id = (ele['job_id'] ? ele['job_id'] : ele['route_id'])
75
+ this.coolMap.plotRoute(ele, id, this.type, false, (indexForData === (this.data.length - 1))).then((res) => {
76
+ });
77
+ });
78
+ }
79
+ }, 500);
80
+ if (changes['data'] && changes['data']['currentValue']) {
81
+ this.filterList = changes['data']['currentValue'];
82
+ if (this.searchTerm) {
83
+ if (this.searchTerm.length > 0) {
84
+ this.data = this.utils.getSearchResults(changes['data']['currentValue'], this.searchTerm);
85
+ this.filterList = this.data;
86
+ } else {
87
+ this.filterList = changes['data']['currentValue'];
88
+ }
89
+ }
90
+
91
+ if (this.type === 'jobcode') {
92
+ this.loader = true; this.clearList();
93
+ if (this.filterList.length === 0) this.loader = false;
94
+ }
95
+
96
+ if (this.type !== 'jobcode') {
97
+ if (changes['data']['previousValue'] && this.currentNav === 'addForm') {
98
+ const activeRoute = changes['data']['previousValue'].find((ele: Route) => ele.isActive);
99
+ if (activeRoute) {
100
+ this.filterList.map((item: any) => {
101
+ if (item.route_id === activeRoute.route_id) {
102
+ item.isActive = true;
103
+ }
104
+ })
105
+ }
106
+ }
107
+ }
108
+ if (changes['data']['previousValue'] && this.currentNav !== 'addForm') {
109
+ this.coolMap.removeJobFromMap(changes['data']['previousValue']);
110
+ this.selectedRoute.clear();
111
+ };
112
+ if (this.currentNav !== 'addForm') {
113
+ changes['data']['currentValue'].forEach((ele: Route, indexForData: number) => {
114
+ const id = (ele['job_id'] ? ele['job_id'] : ele['route_id'])
115
+ this.coolMap.plotRoute(ele, id, this.type, false, (indexForData === (this.data.length - 1))).then((res) => {
116
+ if (indexForData === (this.data.length - 1)) {
117
+ this.loader = false;
118
+ this.utils.preventnavChange.next(true);
119
+ }
120
+ });
121
+ });
122
+ }
123
+ }
124
+ if (changes['searchTerm']) {
125
+ if (this.filterList) {
126
+ this.data = this.filterList;
127
+ this.clearList();
128
+ if (changes['searchTerm']['currentValue'].length > 0) {
129
+ this.coolMap.removeRouteAndMarker(1);
130
+ this.data = this.utils.getSearchResults(this.data, changes['searchTerm']['currentValue']);
131
+ } else { this.data = this.filterList; }
132
+ setTimeout(() => {
133
+ this.coolMap.clearBoundWithCordinates();
134
+ if (this.currentNav !== 'addForm' && !this.selectedRoute['selected'].length) {
135
+ this.coolMap.removeRouteAndMarker(1);
136
+ this.toggleFilterRoute(this.filterList);
137
+ }
138
+ }, 500);
139
+ if (this.currentNav !== 'addForm' && this.selectedRoute['selected'].length) {
140
+ if (this.data && this.data.length > 0) {
141
+ this.clearList();
142
+ this.clearJobDetailsFromList.emit(true)
143
+ this.coolMap.removeJobFromMap(this.selectedRoute.selected);
144
+ setTimeout(() => {
145
+ this.data.forEach((ele, indexForData) => {
146
+ this.coolMap.plotRoute(ele, ele['job_id'], this.type, false, (indexForData === (this.data.length - 1))).then(() => {
147
+ if (indexForData === (this.data.length - 1)) { this.loader = false; this.utils.preventnavChange.next(true) }
148
+ if (this.selectedRoute['selected'].length && this.selectedRoute['selected'][0]['job_id'] === ele['job_id']) {
149
+ this.selectedRoute.clear()
150
+ }
151
+ });
152
+ })
153
+ }, 500);
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ showRoute() {
160
+ this.utils.preventnavChange.next(false);
161
+ this.loader = true; this.clearList();
162
+ this.showAllRoute.emit(true);
163
+ if (this.filterList && this.filterList.length > 0) {
164
+ this.coolMap.removeJobFromMap(this.selectedRoute.selected);
165
+ setTimeout(() => {
166
+ this.filterList.forEach((ele, indexForData) => {
167
+ this.coolMap.plotRoute(ele, ele['job_id'], this.type, false, (indexForData === this.filterList.length - 1)).then(() => {
168
+ if (indexForData === this.filterList.length - 1) { this.loader = false; this.utils.preventnavChange.next(true) }
169
+ if (this.selectedRoute['selected'].length && this.selectedRoute['selected'][0]['job_id'] === ele['job_id']) {
170
+ this.selectedRoute.clear();
171
+ }
172
+ });
173
+ })
174
+ }, 500);
175
+ }
176
+ }
177
+ toggleDrivermenu(event: any) {
178
+ const mouseevntType = event.mouseevntType; let route = event.route;
179
+ const isHoverOut = event.isHoverOut;
180
+ if(typeof(mouseevntType) === 'string') {if(this.preventMouseout){this.isDriverList = !this.isDriverList}; this.preventMouseout = true}
181
+ if (typeof(mouseevntType) === 'boolean' &&!mouseevntType && !this.preventMouseout) { this.isDriverList = mouseevntType };
182
+ if (typeof(mouseevntType) === 'boolean' && mouseevntType && !this.preventMouseout) { this.isDriverList = mouseevntType };
183
+ if(this.preventMouseout && !this.isDriverList) this.preventMouseout = false;
184
+ if (isHoverOut) {
185
+ if (this.preventMouseout) {
186
+ route = this.utils.getdictValue('driver-details');
187
+ this.driverList = route;
188
+ }
189
+ if (!this.preventMouseout) {
190
+ this.driverList = route
191
+ }
192
+ } else {
193
+ this.driverList = route
194
+ }
195
+ }
196
+ visiblesection(value: string) { if (this.type === value) { return true } else return false }
197
+ toggleFilterRoute(filterList: Route[]) {
198
+ filterList.forEach((ele) => {
199
+ const filterItem = (this.type === 'jobcode') ? 'job_id' : 'route_id';
200
+ const index = this.data.findIndex((ele1) => { return (ele1[`${filterItem}`] === ele[`${filterItem}`]) });
201
+ const id = (ele['job_id'] ? ele['job_id'] : ele['route_id']);
202
+ if (id && index < 0) this.coolMap.filterRoute(id, 'none');
203
+ if (id && index >= 0) {
204
+ this.data[index].isActive = false;
205
+ this.coolMap.filterRoute(id, 'visible');
206
+ this.coolMap.extendBound(ele['path'], (index === (this.data.length - 1)));
207
+ };
208
+ });
209
+ }
210
+ clearList() {
211
+ this.isDriverList = false; this.driverList = null; this.preventMouseout = false; this.isSmsList = false;
212
+ }
213
+ sendMessage() {
214
+ this.messageLoader = true
215
+ if (this.driverMessage.valid) {
216
+ const data = {
217
+ order_number: this.driverList['order_number'],
218
+ date: this.driverList['date'],
219
+ message: this.driverMessage.value,
220
+ }
221
+ this.utils.postdata('jobs_report_chat', data).subscribe((res: any) => {
222
+ if (res['data']['status'] === 'Success.') {
223
+ this.messageLoader = false;
224
+ this.driverMessage.reset();
225
+ this.utils.openSnackBar('Message Sent', 'success');
226
+ } else {
227
+ this.messageLoader = false;
228
+ this.utils.openSnackBar('Message not sent', 'error');
229
+ }
230
+ }, err => {if(err) {this.messageLoader = false}})
231
+ }
232
+ }
233
+ }
@@ -0,0 +1,7 @@
1
+ <ng-container *ngFor="let item of label">
2
+ <span>
3
+ <label>{{overViewEnum[item]}}</label>
4
+ <ng-container *ngIf="item !== 'values'">{{jobValue[item] ? jobValue[item] : 'N/A'}}</ng-container>
5
+ <ng-container *ngIf="item === 'values'">{{jobValue[item]['Done'] + jobValue[item]['Ongoing'] + jobValue[item]['Open']}}</ng-container>
6
+ </span>
7
+ </ng-container>
@@ -0,0 +1,10 @@
1
+ span{
2
+ display: flex;
3
+ margin-bottom: 12px;
4
+ font-size: 0.8rem;
5
+ align-items: center;
6
+ label{
7
+ font-weight: 600;
8
+ width: 37%;
9
+ }
10
+ }
@@ -0,0 +1,23 @@
1
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
2
+
3
+ import { SmsCardDetailsOverviewComponent } from './sms-card-details-overview.component';
4
+
5
+ describe('SmsCardDetailsOverviewComponent', () => {
6
+ let component: SmsCardDetailsOverviewComponent;
7
+ let fixture: ComponentFixture<SmsCardDetailsOverviewComponent>;
8
+
9
+ beforeEach(async () => {
10
+ await TestBed.configureTestingModule({
11
+ declarations: [ SmsCardDetailsOverviewComponent ]
12
+ })
13
+ .compileComponents();
14
+
15
+ fixture = TestBed.createComponent(SmsCardDetailsOverviewComponent);
16
+ component = fixture.componentInstance;
17
+ fixture.detectChanges();
18
+ });
19
+
20
+ it('should create', () => {
21
+ expect(component).toBeTruthy();
22
+ });
23
+ });
@@ -0,0 +1,15 @@
1
+ import { Component, Input } from '@angular/core';
2
+ import { DriverSmsCardEnum, DriversmsCardKey } from '@aggdirect/coolmap-services';
3
+
4
+ @Component({
5
+ selector: 'app-sms-card-details-overview',
6
+ templateUrl: './sms-card-details-overview.component.html',
7
+ styleUrls: ['./sms-card-details-overview.component.scss']
8
+ })
9
+ export class SmsCardDetailsOverviewComponent {
10
+ @Input() public jobValue: any;
11
+ label = DriversmsCardKey;
12
+ overViewEnum: any = DriverSmsCardEnum;
13
+ constructor() { }
14
+
15
+ }