Skip to content

Commit 46bb8bf

Browse files
feat: click pre solve visits (#210)
1 parent ec39704 commit 46bb8bf

File tree

3 files changed

+42
-17
lines changed

3 files changed

+42
-17
lines changed

application/frontend/src/app/core/components/base-visit-request-info-window/base-visit-request-info-window.component.html

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
title="Pickup"></mat-icon>
2020
</span>
2121
<!-- title -->
22-
<ng-container *ngIf="postSolve && visit; else visitRequestTitleTemplate">
22+
<ng-container *ngIf="shipment; else visitRequestTitleTemplate">
2323
<span>
2424
Shipment:
2525
<span [ngClass]="{ link: navigation }" (click)="onShipmentClick()">
@@ -32,26 +32,39 @@
3232
</ng-template>
3333
</div>
3434
<div class="text__caption mt-1">
35-
<div>
36-
<span>{{ visit | entityName: 'Visit:' }}</span>
37-
</div>
38-
<div *ngIf="visit">
39-
Visit Type: <span class="strong">{{ visit.isPickup ? 'Pickup' : 'Delivery' }}</span>
40-
</div>
41-
<div *ngIf="shipment?.shipmentType">
42-
Shipment Type: <span class="strong">{{ shipment.shipmentType }}</span>
43-
</div>
44-
<div *ngIf="visit">
35+
<div *ngIf="postSolve; else preSolve">
4536
<div>
46-
Arrival: <span class="strong">{{ buildFormattedArrival() }}</span>
37+
<span>{{ visit | entityName: 'Visit:' }}</span>
4738
</div>
48-
<div *ngIf="buildFormattedDeparture() as formattedDeparture">
49-
Departure: <span class="strong">{{ formattedDeparture }}</span>
39+
<div *ngIf="visit">
40+
Visit Type: <span class="strong">{{ visit.isPickup ? 'Pickup' : 'Delivery' }}</span>
5041
</div>
51-
<div>
52-
Vehicle: <span class="strong">{{ getVehicleName(vehicle) }}</span>
42+
<div *ngIf="shipment?.shipmentType">
43+
Shipment Type: <span class="strong">{{ shipment.shipmentType }}</span>
44+
</div>
45+
<div *ngIf="visit">
46+
<div>
47+
Arrival: <span class="strong">{{ buildFormattedArrival() }}</span>
48+
</div>
49+
<div *ngIf="buildFormattedDeparture() as formattedDeparture">
50+
Departure: <span class="strong">{{ formattedDeparture }}</span>
51+
</div>
52+
<div>
53+
Vehicle: <span class="strong">{{ getVehicleName(vehicle) }}</span>
54+
</div>
5355
</div>
5456
</div>
57+
<ng-template #preSolve>
58+
<div *ngIf="visitRequest">
59+
<div>
60+
Visit Request Type:
61+
<span class="strong">{{ visitRequest.pickup ? 'Pickup' : 'Delivery' }}</span>
62+
</div>
63+
<div *ngIf="visitRequest.duration">
64+
Duration: {{ formattedDurationSeconds(durationSeconds(visitRequest.duration)) }}
65+
</div>
66+
</div>
67+
</ng-template>
5568
</div>
5669
<div *ngIf="savePending" class="updating-overlay">
5770
<mat-spinner [diameter]="50"></mat-spinner>

application/frontend/src/app/core/components/base-visit-request-info-window/base-visit-request-info-window.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { MatSelect } from '@angular/material/select';
3131
import { ConfirmDialogComponent } from 'src/app/shared/components/confirm-dialog/confirm-dialog.component';
3232
import {
3333
durationSeconds,
34+
formattedDurationSeconds,
3435
getChosenTimeWindow,
3536
getEntityName,
3637
getSoftEndTimeMissedCost,
@@ -65,6 +66,9 @@ export class BaseVisitRequestInfoWindowComponent {
6566
readonly vehicleCtrl: UntypedFormControl;
6667
readonly optionItemSize = 48;
6768

69+
readonly formattedDurationSeconds = formattedDurationSeconds;
70+
readonly durationSeconds = durationSeconds;
71+
6872
get visitCategory(): number {
6973
return this.shipment?.deliveries.includes(this.visitRequest?.id)
7074
? VisitCategory.Delivery

application/frontend/src/app/core/services/base-visit-request-layer.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,15 @@ export abstract class BaseVisitRequestLayer {
179179
getSize: 10,
180180
sizeScale: this.getSizeScale(),
181181
getPosition: (d) => d.arrivalPosition,
182-
pickable: false,
182+
pickable: true,
183+
onHover: ({ object }) => {
184+
this.mapService.map.setOptions({ draggableCursor: object ? 'pointer' : 'grab' });
185+
},
186+
onClick: ({ object }) => {
187+
this.zone.run(() => {
188+
this.store.dispatch(UIActions.mapVisitRequestClicked({ id: object.id }));
189+
});
190+
},
183191
});
184192
this.updateLayers();
185193
}

0 commit comments

Comments
 (0)