Skip to content

Commit b422dbb

Browse files
authored
Merge pull request #157 from fleetbase/dev-v0.6.9
v0.6.9 ~ Fix Activity Flow, Events & Notifications, and other patches
2 parents dfff83b + 6388bba commit b422dbb

42 files changed

Lines changed: 1098 additions & 332 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

addon/components/activity-event-selector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ export default class ActivityEventSelectorComponent extends Component {
4545
name: 'order.canceled',
4646
description: 'Triggers when an order is canceled by a user, driver, or system process.',
4747
},
48+
'order.completed': {
49+
name: 'order.completed',
50+
description: 'Triggers when an order is completed by a driver, or system process.',
51+
},
4852
};
4953

5054
/**

addon/components/display-place.hbs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,33 @@
1111
</span>
1212
</div>
1313
{{else}}
14-
{{#if @eta}}
15-
<Badge @status="warning" @hideStatusDot={{true}} class="my-1"><span class="font-bold">ETA:</span> {{format-duration @eta}}</Badge>
16-
{{/if}}
14+
<div class="flex flex-row item-center space-x-2 {{if (or place.status_code @eta) 'mb-2'}}">
15+
{{#if place.status_code}}
16+
<Badge @status={{place.status_code}} />
17+
{{/if}}
18+
{{#if @eta}}
19+
<Badge @status="warning" @hideStatusDot={{true}}><span class="font-bold">ETA:</span> {{format-duration @eta}}</Badge>
20+
{{/if}}
21+
{{#if @waypointActions}}
22+
<DropdownButton @iconClass="icon-text-height" @size="xs" @buttonClass="fleetops-btn-xxs" @icon="ellipsis-h" @iconPrefix="fas" @contentClass="dropdown-menu" as |dd|>
23+
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
24+
<div class="px-1">
25+
<div class="text-sm flex flex-row items-center px-3 py-1 rounded-md my-1 text-gray-300">
26+
{{t "fleet-ops.operations.orders.index.view.waypoint-actions"}}
27+
</div>
28+
</div>
29+
<div class="next-dd-menu-seperator"></div>
30+
{{#each-in @waypointActions as |actionId action|}}
31+
<div class="px-1">
32+
<a href="javascript:;" class="next-dd-item" disabled={{cannot "fleet-ops view order"}} {{on "click" (fn action.fn place dd)}}>
33+
{{action.label}}
34+
</a>
35+
</div>
36+
{{/each-in}}
37+
</div>
38+
</DropdownButton>
39+
{{/if}}
40+
</div>
1741
<address class={{@addressClass}}>
1842
{{#if place.name}}
1943
{{place.name}}<br />

addon/components/route-list.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div class="index-count">1</div>
77
</div>
88
<div class="order-route-location {{@routeLocationClass}} dark:text-gray-100">
9-
<DisplayPlace @place={{@order.payload.firstWaypoint}} @eta={{get @eta @order.payload.firstWaypoint.id}} />
9+
<DisplayPlace @place={{@order.payload.firstWaypoint}} @eta={{get @eta @order.payload.firstWaypoint.id}} @waypointActions={{@waypointActions}} />
1010
</div>
1111
</div>
1212
{{/if}}
@@ -28,7 +28,7 @@
2828
<div class="index-count">{{add index 2}}</div>
2929
</div>
3030
<div class="order-route-location {{@routeLocationClass}} dark:text-gray-100">
31-
<DisplayPlace @place={{waypoint}} @eta={{get @eta waypoint.id}} />
31+
<DisplayPlace @place={{waypoint}} @eta={{get @eta waypoint.id}} @waypointActions={{@waypointActions}} />
3232
</div>
3333
</div>
3434
{{/each}}
@@ -41,7 +41,7 @@
4141
<div class="index-count">{{add @order.payload.middleWaypoints.length 2}}</div>
4242
</div>
4343
<div class="order-route-location {{@routeLocationClass}} dark:text-gray-100">
44-
<DisplayPlace @place={{@order.payload.lastWaypoint}} @eta={{get @eta @order.payload.lastWaypoint.id}} />
44+
<DisplayPlace @place={{@order.payload.lastWaypoint}} @eta={{get @eta @order.payload.lastWaypoint.id}} @waypointActions={{@waypointActions}} />
4545
</div>
4646
</div>
4747
{{/if}}

addon/controllers/operations/orders/index.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ export default class OperationsOrdersIndexController extends BaseController {
10471047
selected = selected.length > 0 ? selected : this.table.selectedRows;
10481048

10491049
this.crud.bulkDelete(selected, {
1050-
modelNamePath: `public_id`,
10511050
acceptButtonText: 'Delete Orders',
10521051
resolveModelName: (model) => `${model.get('tracking_number.tracking_number')} - ${model.get('public_id')}`,
10531052
onSuccess: async () => {
@@ -1075,7 +1074,6 @@ export default class OperationsOrdersIndexController extends BaseController {
10751074
acceptButtonText: 'Cancel Orders',
10761075
acceptButtonScheme: 'danger',
10771076
acceptButtonIcon: 'ban',
1078-
modelNamePath: `public_id`,
10791077
actionPath: `orders/bulk-cancel`,
10801078
actionMethod: `PATCH`,
10811079
resolveModelName: (model) => `${model.get('tracking_number.tracking_number')} - ${model.get('public_id')}`,
@@ -1109,7 +1107,6 @@ export default class OperationsOrdersIndexController extends BaseController {
11091107
acceptButtonText: 'Dispatch Orders',
11101108
acceptButtonScheme: 'magic',
11111109
acceptButtonIcon: 'rocket',
1112-
modelNamePath: 'public_id',
11131110
actionPath: 'orders/bulk-dispatch',
11141111
actionMethod: 'POST',
11151112
resolveModelName: (model) => `${model.get('tracking_number.tracking_number')} - ${model.get('public_id')}`,
@@ -1152,7 +1149,6 @@ export default class OperationsOrdersIndexController extends BaseController {
11521149
acceptButtonScheme: 'magic',
11531150
acceptButtonIcon: 'user-plus',
11541151
acceptButtonDisabled: true,
1155-
modelNamePath: 'public_id',
11561152
actionPath: 'orders/bulk-assign-driver',
11571153
actionMethod: 'PATCH',
11581154
driverAssigned: null,

addon/routes/operations/orders/index/view.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Route from '@ember/routing/route';
22
import { inject as service } from '@ember/service';
33
import { action } from '@ember/object';
4+
import { debug } from '@ember/debug';
45

56
export default class OperationsOrdersIndexViewRoute extends Route {
67
@service currentUser;
@@ -66,7 +67,23 @@ export default class OperationsOrdersIndexViewRoute extends Route {
6667
// Listen for channel subscription
6768
(async () => {
6869
for await (let output of channel) {
69-
this.refresh();
70+
const { event, data } = output;
71+
72+
// debug output
73+
debug(`Socket Event : ${event} : ${JSON.stringify(output)}`);
74+
75+
// Only reload if the order has a status change stemming from an updated event OR
76+
// if a waypoint has been completed which will trigger `order.completed`
77+
const statusChanged = event === 'order.updated' && data.status !== model.status;
78+
const shouldReload = ['order.completed', 'waypoint.activity', 'order.created'].includes(event);
79+
if (statusChanged || shouldReload) {
80+
this.refresh();
81+
82+
// reload the controller stuff as well
83+
if (this.controller) {
84+
this.controller.loadOrderRelations.perform(model);
85+
}
86+
}
7087

7188
if (typeof this.onOrderEvent === 'function') {
7289
this.onOrderEvent(output);

addon/services/movement-tracker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export default class MovementTrackerService extends Service {
155155

156156
if (event === `${type}.location_changed` || event === `${type}.simulated_location_changed`) {
157157
eventBuffer.add(output);
158-
debug(`Incoming socket event added to buffer: ${event}`);
158+
debug(`Socket Event : ${event} : Added to EventBuffer : ${JSON.stringify(output)}`);
159159
}
160160
}
161161
})();

addon/styles/fleetops-engine.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,3 +1623,10 @@ body[data-theme='dark']
16231623
.justify-end-i {
16241624
justify-content: end !important;
16251625
}
1626+
1627+
button.fleetops-btn-xxs.btn,
1628+
button.fleetops-btn-xxs,
1629+
.fleetops-btn-xxs {
1630+
padding-top: 0.2rem !important;
1631+
padding-bottom: 0.2rem !important;
1632+
}

addon/templates/operations/orders/index.hbs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,12 @@
7272
<h4>Bulk Search</h4>
7373
</div>
7474
<div class="filters-dropdown-body">
75-
<Textarea @value={{this.bulkSearchValue}} class="form-input w-full" rows="8" placeholder="Input comma delimited order ID's or tracking numbers to perform a bulk search" />
75+
<Textarea
76+
@value={{this.bulkSearchValue}}
77+
class="form-input w-full"
78+
rows="8"
79+
placeholder="Input comma delimited order ID's or tracking numbers to perform a bulk search"
80+
/>
7681
</div>
7782
<div class="filters-dropdown-footer space-x-2">
7883
<Button @text="Clear" @icon="trash" @size="xs" @onClick={{dropdown-fn dd this.removeBulkQuery}} />

addon/templates/operations/orders/index/new.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@
405405
</div>
406406
<div>
407407
<div class="flex flex-row items-center space-x-4 text-sm mt-2">
408-
<div class={{if (eq waypoint.type "dropoff") 'is-checked'}}>
408+
<div class={{if (eq waypoint.type "dropoff") "is-checked"}}>
409409
<div class="flex flex-row items-center">
410410
<RadioButton
411411
@radioClass="focus:ring-blue-500 h-4 w-4 text-blue-500"
@@ -418,7 +418,7 @@
418418
<label for={{concat "waypoint_" index "_dropoff"}} class="ml-2">Dropoff</label>
419419
</div>
420420
</div>
421-
<div class={{if (eq waypoint.type "pickup") 'is-checked'}}>
421+
<div class={{if (eq waypoint.type "pickup") "is-checked"}}>
422422
<div class="flex flex-row items-center">
423423
<RadioButton
424424
@radioClass="focus:ring-blue-500 h-4 w-4 text-blue-500"

addon/templates/operations/orders/index/view.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,11 @@
579579
>
580580
{{#if @model.payload.isMultiDrop}}
581581
<div>
582-
<RouteList @order={{@model}} @eta={{@model.eta}} />
582+
<RouteList
583+
@order={{@model}}
584+
@eta={{@model.eta}}
585+
@waypointActions={{hash viewWaypointLabel=(hash label=(t "fleet-ops.operations.orders.index.view.get-label") fn=this.viewWaypointLabel)}}
586+
/>
583587
</div>
584588
{{else}}
585589
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4 lg:gap-2">

0 commit comments

Comments
 (0)