Skip to content

Commit dfff83b

Browse files
authored
Merge pull request #154 from fleetbase/dev-v0.6.8-feature-patches
v0.6.8 ~ New features, and patches
2 parents 9a8447c + 8e6c31e commit dfff83b

59 files changed

Lines changed: 4260 additions & 3269 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.
Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
{{#if this.driver}}
2-
<div class="relative flex items-center" ...attributes>
3-
<img src={{this.driver.photo_url}} alt={{this.driver.name}} {{fallback-img-src (config "defaultValues.driverImage")}} class="w-5 h-5 mr-2 rounded-md" />
4-
<a href="javascript:;" class="relative flex flex-row items-center" disabled={{and @column.permission (cannot @column.permission)}} {{on "click" (fn this.onClick this.driver)}}>
5-
<span>{{get-default-value this.driver.name}}</span>
6-
{{#if @row.vehicle_assigned}}
7-
<div class="ml-2 rounded-lg bg-gray-300 dark:bg-gray-800 opacity-50 px-1 text-xs">
8-
<FaIcon @icon="car" @size="xs" class="mr-0.5" />
9-
<span>{{n-a @row.vehicle_assigned.display_name}}</span>
10-
</div>
11-
{{else if this.driver.vehicle}}
12-
<div class="ml-2 rounded-lg bg-gray-300 dark:bg-gray-800 opacity-50 px-1 text-xs">
13-
<FaIcon @icon="car" @size="xs" class="mr-0.5" />
14-
<span>{{n-a this.driver.vehicle_name}}</span>
15-
</div>
16-
{{/if}}
17-
</a>
18-
<FaIcon @icon="circle" @size="2xs" class="absolute left-0 top-0 -mt-1 -ml-1 {{if this.driver.online 'text-green-500' 'text-yellow-200'}}" />
19-
</div>
20-
{{else}}
21-
<div class="flex items-center">
22-
<span>{{t "fleet-ops.component.cell.driver-name.not-assigned"}}</span>
23-
</div>
24-
{{/if}}
1+
{{#let (or @row.driver this.driver) as |driver|}}
2+
{{#if driver}}
3+
<div class="relative flex items-center" ...attributes>
4+
<img src={{driver.photo_url}} alt={{driver.name}} {{fallback-img-src (config "defaultValues.driverImage")}} class="w-5 h-5 mr-2 rounded-md" />
5+
<a href="javascript:;" class="relative flex flex-row items-center" disabled={{and @column.permission (cannot @column.permission)}} {{on "click" (fn this.onClick driver)}}>
6+
<span>{{get-default-value driver.name}}</span>
7+
{{#if @row.vehicle_assigned}}
8+
<div class="ml-2 rounded-lg bg-gray-300 dark:bg-gray-800 opacity-50 px-1 text-xs">
9+
<FaIcon @icon="car" @size="xs" class="mr-0.5" />
10+
<span>{{n-a @row.vehicle_assigned.display_name}}</span>
11+
</div>
12+
{{else if driver.vehicle}}
13+
<div class="ml-2 rounded-lg bg-gray-300 dark:bg-gray-800 opacity-50 px-1 text-xs">
14+
<FaIcon @icon="car" @size="xs" class="mr-0.5" />
15+
<span>{{n-a driver.vehicle_name}}</span>
16+
</div>
17+
{{/if}}
18+
</a>
19+
<FaIcon @icon="circle" @size="2xs" class="absolute left-0 top-0 -mt-1 -ml-1 {{if driver.online 'text-green-500' 'text-yellow-200'}}" />
20+
</div>
21+
{{else}}
22+
<div class="flex items-center">
23+
<span>{{t "fleet-ops.component.cell.driver-name.not-assigned"}}</span>
24+
</div>
25+
{{/if}}
26+
{{/let}}

addon/components/cell/driver-name.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Component from '@glimmer/component';
22
import { action, get, computed } from '@ember/object';
33

44
export default class CellDriverNameComponent extends Component {
5-
@computed('args.{column.modelPath,args.row}') get driver() {
5+
@computed('args.{column.modelPath,row,row.driver_assigned}') get driver() {
66
const { column, row } = this.args;
77

88
if (typeof column?.modelPath === 'string') {

addon/components/custom-field-form-panel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ export default class CustomFieldFormPanelComponent extends Component {
124124
this.customField.set('meta', {});
125125
}
126126

127-
this.customField.meta[key] = value;
127+
const currentMeta = this.customField.meta ?? {};
128+
this.customField.set('meta', { ...currentMeta, [key]: value });
128129
}
129130

130131
/**

addon/components/fuel-report-form-panel.hbs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,14 @@
145145
/>
146146
</InputGroup>
147147
<InputGroup @name={{t "fleet-ops.common.coordinates"}} @wrapperClass="col-span-2">
148-
<CoordinatesInput @value={{this.fuelReport.location}} @onChange={{fn (mut this.fuelReport.location)}} @disabled={{unauthorized}} />
148+
<CoordinatesInput
149+
@value={{this.fuelReport.location}}
150+
@onChange={{this.onCoordinatesChanged}}
151+
@onGeocode={{this.onAutocomplete}}
152+
@onUpdatedFromMap={{this.onCoordinatesChanged}}
153+
@onInit={{this.setCoordinatesInput}}
154+
@disabled={{unauthorized}}
155+
/>
149156
</InputGroup>
150157

151158
<RegistryYield @registry="fleet-ops:component:fuel-report-form-panel:details" as |RegistryComponent|>

addon/components/fuel-report-form-panel.js

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { action } from '@ember/object';
55
import { task } from 'ember-concurrency';
66
import contextComponentCallback from '@fleetbase/ember-core/utils/context-component-callback';
77
import applyContextComponentArguments from '@fleetbase/ember-core/utils/apply-context-component-arguments';
8+
import Point from '@fleetbase/fleetops-data/utils/geojson/point';
89

910
export default class FuelReportFormPanelComponent extends Component {
1011
@service store;
@@ -39,6 +40,13 @@ export default class FuelReportFormPanelComponent extends Component {
3940
*/
4041
@tracked controller;
4142

43+
/**
44+
* The coordinates input component context instance.
45+
*
46+
* @memberof FuelReportFormPanelComponent
47+
*/
48+
@tracked coordinatesInputComponent;
49+
4250
/**
4351
* Constructs the component and applies initial state.
4452
*/
@@ -104,8 +112,56 @@ export default class FuelReportFormPanelComponent extends Component {
104112
return contextComponentCallback(this, 'onPressCancel', this.fuelReport);
105113
}
106114

115+
/**
116+
* Set the ruel report reporter
117+
*
118+
* @param {UserModel} user
119+
* @memberof FuelReportFormPanelComponent
120+
*/
107121
@action setReporter(user) {
108-
this.issue.set('reporter', user);
109-
this.issue.set('reported_by_uuid', user.id);
122+
this.fuelReport.set('reporter', user);
123+
this.fuelReport.set('reported_by_uuid', user.id);
124+
}
125+
126+
/**
127+
* Sets the coordinates input component.
128+
*
129+
* @action
130+
* @param {Object} coordinatesInputComponent - The coordinates input component to be set.
131+
* @memberof PlaceFormPanelComponent
132+
*/
133+
@action setCoordinatesInput(coordinatesInputComponent) {
134+
this.coordinatesInputComponent = coordinatesInputComponent;
135+
}
136+
137+
/**
138+
* Handle autocomplete callback
139+
*
140+
* @param {AutocompleteEvent} { location }
141+
* @memberof VehicleFormPanelComponent
142+
*/
143+
@action onAutocomplete({ location }) {
144+
if (location) {
145+
this.fuelReport.setProperties({ location });
146+
147+
if (this.coordinatesInputComponent) {
148+
this.coordinatesInputComponent.updateCoordinates(location);
149+
}
150+
}
151+
}
152+
153+
/**
154+
* Updates the Vehicle coordinates with the given latitude and longitude.
155+
*
156+
* @action
157+
* @param {Object} coordinates - The latitude and longitude coordinates.
158+
* @param {number} coordinates.latitude - Latitude value.
159+
* @param {number} coordinates.longitude - Longitude value.
160+
* @memberof PlaceFormPanelComponent
161+
*/
162+
@action onCoordinatesChanged({ latitude, longitude }) {
163+
const location = new Point(longitude, latitude);
164+
165+
this.fuelReport.setProperties({ location });
110166
}
111167
}

addon/components/layout/fleet-ops-sidebar.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,14 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
154154
permission: 'fleet-ops view payments',
155155
visible: this.abilities.can('fleet-ops see payments'),
156156
},
157+
{
158+
intl: 'fleet-ops.component.layout.fleet-ops-sidebar.notifications',
159+
title: this.intl.t('fleet-ops.component.layout.fleet-ops-sidebar.notifications'),
160+
icon: 'bell',
161+
route: 'settings.notifications',
162+
permission: 'fleet-ops view notification-settings',
163+
visible: this.abilities.can('fleet-ops see notification-settings'),
164+
},
157165
];
158166

159167
const createPanel = (intl, routePrefix, items = []) => ({
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Modals::BulkActionModel @options={{@options}} @onConfirm={{@onConfirm}} @onDecline={{@onDecline}} as |options|>
2+
<div>
3+
<InputGroup @name={{t "fleet-ops.common.select-driver"}} @helpText={{t "fleet-ops.operations.orders.index.bulk-assign-driver-helptext"}}>
4+
<ModelSelect
5+
@modelName="driver"
6+
@selectedModel={{options.driverAssigned}}
7+
@query={{options.driversQuery}}
8+
@placeholder={{t "fleet-ops.operations.orders.index.new.assign-driver-placeholder"}}
9+
@triggerClass="form-select form-input"
10+
@infiniteScroll={{false}}
11+
@renderInPlace={{true}}
12+
@allowClear={{true}}
13+
@permission="fleet-ops assign-driver-for order"
14+
@onChange={{options.selectDriver}}
15+
as |model|
16+
>
17+
<div class="flex items-center">
18+
<div class="w-7 flex-grow-0 flex-shrink-0">
19+
<FaIcon @icon="id-card-alt" />
20+
</div>
21+
<div class="flex-1 flex flex-row truncate">
22+
<span class="uppercase mr-2">{{model.name}}</span>
23+
<span class="uppercase">{{model.phone}}</span>
24+
</div>
25+
</div>
26+
</ModelSelect>
27+
</InputGroup>
28+
<InputGroup>
29+
<Checkbox @value={{@options.notifyDriver}} @label="Notify driver" @onToggle={{@options.toggleNotifyDriver}} @alignItems="center" @labelClass="mb-0i" />
30+
</InputGroup>
31+
</div>
32+
</Modals::BulkActionModel>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Component from '@glimmer/component';
2+
3+
export default class ModalsBulkAssignDriverComponent extends Component {}

addon/controllers/management/contacts/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@ export default class ManagementContactsIndexController extends BaseController {
337337
onImportCompleted: () => {
338338
this.hostRouter.refresh();
339339
},
340+
onImportTemplate: () => {
341+
window.open('https://flb-assets.s3.ap-southeast-1.amazonaws.com/import-templates/Fleetbase_Contact_Import_Template.xlsx');
342+
},
340343
});
341344
}
342345

addon/controllers/management/drivers/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ export default class ManagementDriversIndexController extends BaseController {
468468
onImportCompleted: () => {
469469
this.hostRouter.refresh();
470470
},
471+
onImportTemplate: () => {
472+
window.open('https://flb-assets.s3.ap-southeast-1.amazonaws.com/import-templates/Fleetbase_Driver_Import_Template.xlsx');
473+
},
471474
});
472475
}
473476

0 commit comments

Comments
 (0)