Skip to content

Commit 77b5f59

Browse files
authored
Merge pull request #195 from fleetbase/dev-v0.6.30
v0.6.30
2 parents 0b5acce + 149e343 commit 77b5f59

92 files changed

Lines changed: 2225 additions & 523 deletions

File tree

Some content is hidden

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

addon/components/customer/create-order-form.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<ModelSelect
7676
@modelName="place"
7777
@selectedModel={{waypoint.place}}
78-
@placeholder={{concat (t "order.fields.select-waypoint-placeholder") " " (add index 1)}}
78+
@placeholder={{concat (t "order.fields.select-waypoint") " " (add index 1)}}
7979
@triggerClass="form-select form-input truncate max-w-250px"
8080
@infiniteScroll={{false}}
8181
@customSearchEndpoint="places/search"

addon/components/customer/order-form.hbs

Lines changed: 34 additions & 34 deletions
Large diffs are not rendered by default.

addon/components/customer/orders.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
</div>
156156
{{else}}
157157
<div class="px-10 py-2 flex items-center justify-center">
158-
<p class="text-red-600 dark:text-red-100">{{t "fleet-ops.operations.orders.index.view.no-order-activity"}}</p>
158+
<p class="text-red-600 dark:text-red-100">{{t "order.fields.no-order-activity"}}</p>
159159
</div>
160160
{{/each}}
161161
</div>
@@ -179,7 +179,7 @@
179179
@value={{group.waypoint.tracking}}
180180
class="rounded-md bg-yellow-300 text-yellow-900 px-2 py-0.5 text-xs flex-grow-0 truncate"
181181
>
182-
<span>{{t "fleet-ops.operations.orders.index.view.tracking"}}</span>
182+
<span>{{t "order.fields.tracking"}}</span>
183183
<span>{{group.waypoint.tracking}}</span>
184184
</ClickToCopy>
185185
<Badge @status={{group.waypoint.status_code}} />

addon/components/display-place.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<div class="next-dd-menu mt-1 mx-0" aria-labelledby="user-menu">
2424
<div class="px-1">
2525
<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"}}
26+
{{t "order.fields.waypoint-actions"}}
2727
</div>
2828
</div>
2929
<div class="next-dd-menu-seperator"></div>

addon/components/driver/pill.hbs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
{{#let (or @driver @resource) as |resource|}}
2-
<Pill
3-
@resource={{resource}}
4-
@imageSrc={{avatar-url resource.photo_url}}
5-
@subtitle={{n-a resource.phone "No Phone"}}
6-
@fallbackImageType="driverImage"
7-
@showOnlineIndicator={{true}}
8-
@onClick={{@onClick}}
9-
@anchorClass={{@anchorClass}}
10-
@imageClass={{@imageClass}}
11-
@imageWrapperClass={{@imageWrapperClass}}
12-
@contentWrapperClass={{@contentWrapperClass}}
13-
@titleClass={{@titleClass}}
14-
@subtitleClass={{@subtitleClass}}
15-
...attributes
16-
/>
17-
{{/let}}
1+
<Pill
2+
@resource={{this.resource}}
3+
@imageSrc={{avatar-url this.resource.photo_url}}
4+
@titleFallback={{or @titleFallback "No driver"}}
5+
@subtitle={{n-a this.resource.phone (if this.resource "No phone" "-")}}
6+
@fallbackImageType="driverImage"
7+
@showOnlineIndicator={{if this.resource true false}}
8+
@onClick={{@onClick}}
9+
@anchorClass={{@anchorClass}}
10+
@imageClass={{@imageClass}}
11+
@imageWrapperClass={{@imageWrapperClass}}
12+
@contentWrapperClass={{@contentWrapperClass}}
13+
@titleClass={{@titleClass}}
14+
@subtitleClass={{@subtitleClass}}
15+
...attributes
16+
/>

addon/components/driver/pill.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
import Component from '@glimmer/component';
22

3-
export default class DriverPillComponent extends Component {}
3+
export default class DriverPillComponent extends Component {
4+
get resource() {
5+
return this.args.driver ?? this.args.resource;
6+
}
7+
}

addon/components/map/leaflet-live-map.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ export default class MapLeafletLiveMapComponent extends Component {
7474
this.#createMapContextMenu(map);
7575
this.trigger('onLoad', ...arguments);
7676
this.load.perform();
77+
78+
// Listen for map move/zoom events to trigger viewport-based resource reload
79+
map.on('moveend', () => this.reloadResourcesInViewport.perform());
80+
map.on('zoomend', () => this.reloadResourcesInViewport.perform());
7781
}
7882

7983
@action trigger(name, ...rest) {
@@ -160,11 +164,19 @@ export default class MapLeafletLiveMapComponent extends Component {
160164
/** load resources and wait for stuff here and trigger map ready **/
161165
@task *load() {
162166
try {
167+
// Get initial map bounds for spatial filtering
168+
const bounds = this.map ? this.map.getBounds() : null;
169+
const params = bounds
170+
? {
171+
bounds: [bounds.getSouth(), bounds.getWest(), bounds.getNorth(), bounds.getEast()],
172+
}
173+
: {};
174+
163175
const data = yield all([
164176
this.loadResource.perform('routes'),
165-
this.loadResource.perform('vehicles'),
166-
this.loadResource.perform('drivers'),
167-
this.loadResource.perform('places'),
177+
this.loadResource.perform('vehicles', { params }),
178+
this.loadResource.perform('drivers', { params }),
179+
this.loadResource.perform('places', { params }),
168180
this.loadResource.perform('service-areas'),
169181
]);
170182

@@ -176,6 +188,26 @@ export default class MapLeafletLiveMapComponent extends Component {
176188
}
177189
}
178190

191+
@task({ restartable: true }) *reloadResourcesInViewport() {
192+
if (!this.map) {
193+
return;
194+
}
195+
196+
// Get current map bounds
197+
const bounds = this.map.getBounds();
198+
const params = {
199+
bounds: [bounds.getSouth(), bounds.getWest(), bounds.getNorth(), bounds.getEast()],
200+
};
201+
202+
// Reload spatially-filtered resources (drivers, vehicles, places)
203+
// Orders, routes, and service-areas are not spatially filtered
204+
try {
205+
yield all([this.loadResource.perform('vehicles', { params }), this.loadResource.perform('drivers', { params }), this.loadResource.perform('places', { params })]);
206+
} catch (err) {
207+
debug('Failed to reload resources in viewport: ' + err.message);
208+
}
209+
}
210+
179211
@task *loadResource(path, options = {}) {
180212
if (this.abilities.cannot(`fleet-ops list ${path}`)) return [];
181213

addon/components/map/order-list-overlay/order.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{{on "dblclick" (fn this.onDoubleClick @order)}}
66
{{on "mouseenter" (fn this.onMouseEnter @order)}}
77
{{on "mouseleave" (fn this.onMouseLeave @order)}}
8+
{{did-insert this.setupIntersectionObserver}}
89
...attributes
910
>
1011
<div class="order-listing-row">

addon/components/map/order-list-overlay/order.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import Component from '@glimmer/component';
22
import { action } from '@ember/object';
3+
import { tracked } from '@glimmer/tracking';
34

45
export default class MapOrderListOverlayOrderComponent extends Component {
6+
@tracked trackerDataLoaded = false;
7+
observer = null;
58
@action onClick(order, event) {
69
//Don't run callback if action button is clicked
710
if (event.target.closest('span.order-listing-action-button')) {
@@ -32,4 +35,43 @@ export default class MapOrderListOverlayOrderComponent extends Component {
3235
this.args.onMouseLeave(...arguments);
3336
}
3437
}
38+
39+
@action setupIntersectionObserver(element) {
40+
// Create IntersectionObserver to detect when order becomes visible
41+
this.observer = new IntersectionObserver(
42+
(entries) => {
43+
entries.forEach((entry) => {
44+
if (entry.isIntersecting && !this.trackerDataLoaded) {
45+
this.loadTrackerData();
46+
}
47+
});
48+
},
49+
{
50+
root: null, // viewport
51+
rootMargin: '50px', // start loading slightly before visible
52+
threshold: 0.1, // trigger when 10% visible
53+
}
54+
);
55+
56+
this.observer.observe(element);
57+
}
58+
59+
loadTrackerData() {
60+
const { order } = this.args;
61+
62+
if (order && typeof order.loadTrackerData === 'function' && !this.trackerDataLoaded) {
63+
this.trackerDataLoaded = true;
64+
order.loadTrackerData();
65+
}
66+
}
67+
68+
willDestroy() {
69+
super.willDestroy(...arguments);
70+
71+
// Clean up observer
72+
if (this.observer) {
73+
this.observer.disconnect();
74+
this.observer = null;
75+
}
76+
}
3577
}

addon/components/modals/bulk-assign-driver.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<Modals::BulkActionModel @options={{@options}} @onConfirm={{@onConfirm}} @onDecline={{@onDecline}} as |options|>
22
<div>
3-
<InputGroup @name={{t "common.select-driver"}} @helpText={{t "fleet-ops.operations.orders.index.bulk-assign-driver-helptext"}}>
3+
<InputGroup @name={{t "common.select-field" field=(t "resource.driver")}} @helpText={{t "fleet-ops.operations.orders.index.bulk-assign-driver-helptext"}}>
44
<ModelSelect
55
@modelName="driver"
66
@selectedModel={{options.driverAssigned}}
77
@query={{options.driversQuery}}
8-
@placeholder={{t "fleet-ops.operations.orders.index.new.assign-driver-placeholder"}}
8+
@placeholder={{t "order.fields.assign-driver-placeholder"}}
99
@triggerClass="form-select form-input"
1010
@infiniteScroll={{false}}
1111
@renderInPlace={{true}}

0 commit comments

Comments
 (0)