@fleetbase/fleetops-engine 0.2.9 → 0.3.0
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.
- package/addon/components/context-panel.hbs +1 -1
- package/addon/components/driver-card-mini.js +34 -13
- package/addon/components/driver-form-panel.hbs +3 -3
- package/addon/components/driver-form-panel.js +87 -29
- package/addon/components/driver-panel.hbs +5 -5
- package/addon/components/driver-panel.js +118 -31
- package/addon/components/live-map.js +221 -10
- package/addon/components/map-container/toolbar/visibility-control-panel.hbs +66 -0
- package/addon/components/map-container/toolbar/visibility-control-panel.js +74 -0
- package/addon/components/map-container/toolbar/zones-panel.hbs +10 -10
- package/addon/components/map-container/toolbar/zones-panel.js +90 -61
- package/addon/components/map-container/toolbar.hbs +12 -7
- package/addon/components/modals/vehicle-form.hbs +35 -35
- package/addon/components/vehicle-form-panel.hbs +6 -7
- package/addon/components/vehicle-form-panel.js +86 -26
- package/addon/components/vehicle-panel.hbs +5 -5
- package/addon/components/vehicle-panel.js +124 -31
- package/addon/controllers/management/drivers/index/details.js +53 -0
- package/addon/controllers/management/drivers/index/edit.js +77 -46
- package/addon/controllers/management/drivers/index/new.js +39 -79
- package/addon/controllers/management/drivers/index.js +17 -221
- package/addon/controllers/management/fleets/index/edit.js +1 -1
- package/addon/controllers/management/fleets/index/new.js +1 -1
- package/addon/controllers/management/fuel-reports/index.js +2 -2
- package/addon/controllers/management/vehicles/index/details.js +49 -0
- package/addon/controllers/management/vehicles/index/edit.js +104 -1
- package/addon/controllers/management/vehicles/index/new.js +71 -0
- package/addon/controllers/operations/orders/index/new.js +1 -1
- package/addon/controllers/operations/orders/index/view.js +17 -7
- package/addon/controllers/operations/orders/index.js +109 -48
- package/addon/controllers/operations/service-rates/index/edit.js +1 -1
- package/addon/controllers/operations/service-rates/index/new.js +1 -1
- package/addon/helpers/is-visibility-control-visible.js +18 -0
- package/addon/routes/application.js +1 -1
- package/addon/routes/home.js +1 -1
- package/addon/routes/management/drivers/index/details.js +5 -0
- package/addon/routes/operations/service-rates/index.js +1 -1
- package/addon/routes/operations/zones/index.js +1 -1
- package/addon/services/context-panel.js +81 -14
- package/addon/templates/management/drivers/index/details.hbs +1 -1
- package/addon/templates/management/drivers/index/edit.hbs +1 -1
- package/addon/templates/management/drivers/index/new.hbs +1 -1
- package/addon/templates/management/vehicles/index/details.hbs +1 -1
- package/addon/templates/management/vehicles/index/edit.hbs +1 -1
- package/addon/templates/management/vehicles/index/new.hbs +1 -1
- package/addon/templates/operations/orders/index/view.hbs +2 -2
- package/addon/templates/operations/orders/index.hbs +1 -1
- package/addon/utils/apply-context-component-arguments.js +31 -0
- package/addon/utils/context-component-callback.js +16 -0
- package/app/components/map-container/toolbar/visibility-control-panel.js +1 -0
- package/app/helpers/is-visibility-control-visible.js +1 -0
- package/app/utils/apply-context-component-arguments.js +1 -0
- package/app/utils/context-component-callback.js +1 -0
- package/package.json +3 -3
- package/server/migrations/2023_09_14_074512_update_vehicles_table.php +89 -88
- package/server/migrations/2023_10_25_093014_create_vehicle_device_events_table.php +56 -0
- package/server/src/Http/Resources/v1/Vehicle.php +1 -0
- package/server/src/Models/VehicleDevice.php +17 -3
- package/server/src/Models/VehicleDeviceEvent.php +90 -0
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
<span>Driver Assigned</span>
|
|
151
151
|
</div>
|
|
152
152
|
<div>
|
|
153
|
-
<
|
|
153
|
+
<a href="javascript:;" class="flex flex-row" {{on "click" (fn this.focusOrderAssignedDriver @model)}}>
|
|
154
154
|
<div>
|
|
155
155
|
<Image src={{avatar-url @model.driver_assigned.photo_url}} @fallbackSrc={{config "defaultValues.driverImage"}} width="32" height="32" class="w-8 h-8 rounded-md shadow-sm mr-3 lg:mr-2" alt={{@model.driver_assigned.name}} />
|
|
156
156
|
</div>
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
<div>{{@model.driver_assigned.phone}}</div>
|
|
161
161
|
{{/if}}
|
|
162
162
|
</div>
|
|
163
|
-
</
|
|
163
|
+
</a>
|
|
164
164
|
<div class="mt-1">
|
|
165
165
|
<Button @size="xs" @type="default" @icon="edit" @text={{if @model.has_driver_assigned "Change Driver" "Assign Driver"}} @onClick={{fn this.assignDriver @model}} />
|
|
166
166
|
</div>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
{{#if this.isMapLayout}}
|
|
14
14
|
<MapContainer @layout={{this.layout}} @onReady={{this.onMapContainerReady}}>
|
|
15
15
|
<GlobalSearch @visible={{this.isSearchVisible}} @onPressOrder={{this.viewOrder}} />
|
|
16
|
-
<MapContainer::Toolbar @activeOrdersCount={{this.activeOrdersCount}} @
|
|
16
|
+
<MapContainer::Toolbar @activeOrdersCount={{this.activeOrdersCount}} @liveMap={{this.liveMap}} @map={{this.leafletMap}} @onPressViewOrders={{this.toggleOrdersPanel}} @onPressSearch={{this.toggleSearch}} @onPressCreateOrder={{this.createOrder}} @onPressCreateDriver={{this.driversController.createDriver}} @onPressDriverProfile={{this.driversController.viewDriver}} />
|
|
17
17
|
<OrderListOverlay @noBackdrop={{true}} @fullHeight={{true}} @outView={{not this.isOrdersPanelVisible}} @width={{if (media 'isMobile') "100%" "338px"}} @onPressCancel={{this.hideOrdersPanel}} @onPressCreateOrder={{this.createOrder}} @onPressViewOrder={{this.viewOrder}} @onPressCreateFleet={{this.fleetController.createFleet}} @onPressManageFleet={{this.fleetController.viewFleet}} @onPressCancelOrders={{this.bulkCancelOrders}} @onPressDeleteOrders={{this.bulkDeleteOrders}} />
|
|
18
18
|
<LiveMap id="leafletMap" class="next-leaflet-container-map" @lat={{1.3521}} @lng={{103.8198}} @zoom={{12}} @zoomControl={{false}} @onLoad={{this.setMapReference}} {{set-container-dimensions}} />
|
|
19
19
|
</MapContainer>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import getModelName from '@fleetbase/ember-core/utils/get-model-name';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Applies context and dynamic arguments to a given component.
|
|
5
|
+
*
|
|
6
|
+
* @param {Component} component - The component to which context and arguments will be applied.
|
|
7
|
+
*/
|
|
8
|
+
export default function applyContextComponentArguments(component) {
|
|
9
|
+
const { context, dynamicArgs = {} } = component.args;
|
|
10
|
+
|
|
11
|
+
// Apply context model if available
|
|
12
|
+
if (context) {
|
|
13
|
+
const contextModelName = getModelName(context);
|
|
14
|
+
if (contextModelName) {
|
|
15
|
+
component[contextModelName] = context;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Execute any apply callback present in dynamic arguments
|
|
20
|
+
const { applyCallback } = dynamicArgs;
|
|
21
|
+
if (typeof applyCallback === 'function') {
|
|
22
|
+
applyCallback(component);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Apply other dynamic arguments to the component
|
|
26
|
+
for (const [key, value] of Object.entries(dynamicArgs)) {
|
|
27
|
+
if (key !== 'applyCallback') {
|
|
28
|
+
component[key] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default function contextComponentCallback(component, name, ...params) {
|
|
2
|
+
let callbackInvoked = false;
|
|
3
|
+
|
|
4
|
+
if (typeof component.args[name] === 'function') {
|
|
5
|
+
component.args[name](...params);
|
|
6
|
+
callbackInvoked = true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// now do for context options
|
|
10
|
+
if (typeof component.args.options === 'object' && typeof component.args.options[name] === 'function') {
|
|
11
|
+
component.args.options[name](...params);
|
|
12
|
+
callbackInvoked = true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return callbackInvoked;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/map-container/toolbar/visibility-control-panel';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/helpers/is-visibility-control-visible';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/utils/apply-context-component-arguments';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/utils/context-component-callback';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/fleetops-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Fleet & Transport Management Extension for Fleetbase",
|
|
5
5
|
"fleetbase": {
|
|
6
6
|
"route": "fleet-ops",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"publish:github": "npm config set '@fleetbase:registry' https://npm.pkg.github.com/ && npm publish"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@fleetbase/ember-core": "^0.1.
|
|
43
|
-
"@fleetbase/ember-ui": "^0.2.
|
|
42
|
+
"@fleetbase/ember-core": "^0.1.6",
|
|
43
|
+
"@fleetbase/ember-ui": "^0.2.1",
|
|
44
44
|
"@fleetbase/fleetops-data": "^0.1.1",
|
|
45
45
|
"@fleetbase/leaflet-routing-machine": "^3.2.16",
|
|
46
46
|
"@fortawesome/ember-fontawesome": "^0.4.1",
|
|
@@ -6,95 +6,96 @@ use Illuminate\Support\Facades\Schema;
|
|
|
6
6
|
|
|
7
7
|
class UpdateVehiclesTable extends Migration
|
|
8
8
|
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (!Schema::hasColumn('vehicles', 'model')) {
|
|
16
|
-
$table->string('model')->nullable()->after('make');
|
|
17
|
-
}
|
|
18
|
-
if (!Schema::hasColumn('vehicles', 'model_data')) {
|
|
19
|
-
$table->json('model_data')->nullable()->after('meta');
|
|
20
|
-
}
|
|
21
|
-
if (!Schema::hasColumn('vehicles', 'telematics')) {
|
|
22
|
-
$table->json('telematics')->nullable()->after('meta');
|
|
23
|
-
}
|
|
9
|
+
public function up()
|
|
10
|
+
{
|
|
11
|
+
Schema::table('vehicles', function (Blueprint $table) {
|
|
12
|
+
if (!Schema::hasColumn('vehicles', 'location')) {
|
|
13
|
+
$table->point('location')->nullable()->after('avatar_url');
|
|
14
|
+
}
|
|
24
15
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
'model_engine_cyl',
|
|
35
|
-
'model_engine_fuel',
|
|
36
|
-
'model_engine_position',
|
|
37
|
-
'model_engine_power_ps',
|
|
38
|
-
'model_engine_power_rpm',
|
|
39
|
-
'model_engine_stroke_mm',
|
|
40
|
-
'model_engine_torque_nm',
|
|
41
|
-
'model_engine_torque_rpm',
|
|
42
|
-
'model_engine_valves_per_cyl',
|
|
43
|
-
'model_fuel_cap_l',
|
|
44
|
-
'model_length_mm',
|
|
45
|
-
'model_lkm_city',
|
|
46
|
-
'model_lkm_hwy',
|
|
47
|
-
'model_lkm_mixed',
|
|
48
|
-
'model_make_display',
|
|
49
|
-
'model_seats',
|
|
50
|
-
'model_sold_in_us',
|
|
51
|
-
'model_top_speed_kph',
|
|
52
|
-
'model_transmission_type',
|
|
53
|
-
'model_weight_kg',
|
|
54
|
-
'model_wheelbase_mm',
|
|
55
|
-
'model_width_mm',
|
|
56
|
-
]);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
16
|
+
if (!Schema::hasColumn('vehicles', 'model')) {
|
|
17
|
+
$table->string('model')->nullable()->after('make');
|
|
18
|
+
}
|
|
19
|
+
if (!Schema::hasColumn('vehicles', 'model_data')) {
|
|
20
|
+
$table->json('model_data')->nullable()->after('meta');
|
|
21
|
+
}
|
|
22
|
+
if (!Schema::hasColumn('vehicles', 'telematics')) {
|
|
23
|
+
$table->json('telematics')->nullable()->after('meta');
|
|
24
|
+
}
|
|
59
25
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
26
|
+
$table->dropColumn([
|
|
27
|
+
'model_0_to_100_kph',
|
|
28
|
+
'model_body',
|
|
29
|
+
'model_co2',
|
|
30
|
+
'model_doors',
|
|
31
|
+
'model_drive',
|
|
32
|
+
'model_engine_bore_mm',
|
|
33
|
+
'model_engine_cc',
|
|
34
|
+
'model_engine_compression',
|
|
35
|
+
'model_engine_cyl',
|
|
36
|
+
'model_engine_fuel',
|
|
37
|
+
'model_engine_position',
|
|
38
|
+
'model_engine_power_ps',
|
|
39
|
+
'model_engine_power_rpm',
|
|
40
|
+
'model_engine_stroke_mm',
|
|
41
|
+
'model_engine_torque_nm',
|
|
42
|
+
'model_engine_torque_rpm',
|
|
43
|
+
'model_engine_valves_per_cyl',
|
|
44
|
+
'model_fuel_cap_l',
|
|
45
|
+
'model_length_mm',
|
|
46
|
+
'model_lkm_city',
|
|
47
|
+
'model_lkm_hwy',
|
|
48
|
+
'model_lkm_mixed',
|
|
49
|
+
'model_make_display',
|
|
50
|
+
'model_seats',
|
|
51
|
+
'model_sold_in_us',
|
|
52
|
+
'model_top_speed_kph',
|
|
53
|
+
'model_transmission_type',
|
|
54
|
+
'model_weight_kg',
|
|
55
|
+
'model_wheelbase_mm',
|
|
56
|
+
'model_width_mm',
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
61
|
+
public function down()
|
|
62
|
+
{
|
|
63
|
+
Schema::table('vehicles', function (Blueprint $table) {
|
|
64
|
+
$table->dropColumn('location');
|
|
65
|
+
$table->dropColumn('model');
|
|
66
|
+
$table->dropColumn('model_data');
|
|
67
|
+
$table->dropColumn('telematics');
|
|
68
|
+
|
|
69
|
+
$table->string('model_0_to_100_kph')->nullable();
|
|
70
|
+
$table->string('model_body')->nullable();
|
|
71
|
+
$table->string('model_co2')->nullable();
|
|
72
|
+
$table->string('model_doors')->nullable();
|
|
73
|
+
$table->string('model_drive')->nullable();
|
|
74
|
+
$table->string('model_engine_bore_mm')->nullable();
|
|
75
|
+
$table->string('model_engine_cc')->nullable();
|
|
76
|
+
$table->string('model_engine_compression')->nullable();
|
|
77
|
+
$table->string('model_engine_cyl')->nullable();
|
|
78
|
+
$table->string('model_engine_fuel')->nullable();
|
|
79
|
+
$table->string('model_engine_position')->nullable();
|
|
80
|
+
$table->string('model_engine_power_ps')->nullable();
|
|
81
|
+
$table->string('model_engine_power_rpm')->nullable();
|
|
82
|
+
$table->string('model_engine_stroke_mm')->nullable();
|
|
83
|
+
$table->string('model_engine_torque_nm')->nullable();
|
|
84
|
+
$table->string('model_engine_torque_rpm')->nullable();
|
|
85
|
+
$table->string('model_engine_valves_per_cyl')->nullable();
|
|
86
|
+
$table->string('model_fuel_cap_l')->nullable();
|
|
87
|
+
$table->string('model_length_mm')->nullable();
|
|
88
|
+
$table->string('model_lkm_city')->nullable();
|
|
89
|
+
$table->string('model_lkm_hwy')->nullable();
|
|
90
|
+
$table->string('model_lkm_mixed')->nullable();
|
|
91
|
+
$table->string('model_make_display')->nullable();
|
|
92
|
+
$table->string('model_seats')->nullable();
|
|
93
|
+
$table->string('model_sold_in_us')->nullable();
|
|
94
|
+
$table->string('model_top_speed_kph')->nullable();
|
|
95
|
+
$table->string('model_transmission_type')->nullable();
|
|
96
|
+
$table->string('model_weight_kg')->nullable();
|
|
97
|
+
$table->string('model_wheelbase_mm')->nullable();
|
|
98
|
+
$table->string('model_width_mm')->nullable();
|
|
99
|
+
});
|
|
100
|
+
}
|
|
100
101
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
class CreateVehicleDeviceEventsTable extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
// fix indexes on vehicle_devices table
|
|
17
|
+
Schema::table('vehicle_devices', function (Blueprint $table) {
|
|
18
|
+
$table->index('uuid');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// create events table
|
|
22
|
+
Schema::create('vehicle_device_events', function (Blueprint $table) {
|
|
23
|
+
$table->increments('id');
|
|
24
|
+
$table->uuid('uuid')->nullable();
|
|
25
|
+
$table->uuid('vehicle_device_uuid');
|
|
26
|
+
$table->foreign('vehicle_device_uuid')->references('uuid')->on('vehicle_devices');
|
|
27
|
+
$table->json('payload')->nullable();
|
|
28
|
+
$table->json('meta')->nullable();
|
|
29
|
+
$table->string('ident')->nullable();
|
|
30
|
+
$table->string('protocol')->nullable();
|
|
31
|
+
$table->string('provider')->nullable();
|
|
32
|
+
$table->point('location')->nullable();
|
|
33
|
+
$table->string('mileage')->nullable();
|
|
34
|
+
$table->string('state')->nullable();
|
|
35
|
+
$table->string('code')->nullable();
|
|
36
|
+
$table->string('reason')->nullable();
|
|
37
|
+
$table->softDeletes();
|
|
38
|
+
$table->timestamps();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Reverse the migrations.
|
|
44
|
+
*
|
|
45
|
+
* @return void
|
|
46
|
+
*/
|
|
47
|
+
public function down()
|
|
48
|
+
{
|
|
49
|
+
Schema::dropIfExists('vehicle_device_events');
|
|
50
|
+
|
|
51
|
+
// fix indexes on vehicle_devices table
|
|
52
|
+
Schema::table('vehicle_devices', function (Blueprint $table) {
|
|
53
|
+
$table->dropIndex(['uuid']);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -30,6 +30,7 @@ class Vehicle extends FleetbaseResource
|
|
|
30
30
|
'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
|
|
31
31
|
'devices' => $this->whenLoaded('devices', $this->devices),
|
|
32
32
|
'photo' => $this->photoUrl,
|
|
33
|
+
'avatar_url' => $this->avatar_url,
|
|
33
34
|
'make' => $this->make,
|
|
34
35
|
'model' => $this->model,
|
|
35
36
|
'year' => $this->year,
|
|
@@ -10,9 +10,7 @@ use Fleetbase\Traits\TracksApiCredential;
|
|
|
10
10
|
|
|
11
11
|
class VehicleDevice extends Model
|
|
12
12
|
{
|
|
13
|
-
use HasUuid;
|
|
14
|
-
use TracksApiCredential;
|
|
15
|
-
use HasApiModelBehavior;
|
|
13
|
+
use HasUuid, TracksApiCredential, HasApiModelBehavior;
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* The database table used by the model.
|
|
@@ -76,4 +74,20 @@ class VehicleDevice extends Model
|
|
|
76
74
|
* @var array
|
|
77
75
|
*/
|
|
78
76
|
protected $hidden = [];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
80
|
+
*/
|
|
81
|
+
public function vehicle()
|
|
82
|
+
{
|
|
83
|
+
return $this->belongsTo(Vehicle::class);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
88
|
+
*/
|
|
89
|
+
public function events()
|
|
90
|
+
{
|
|
91
|
+
return $this->hasMany(VehicleDeviceEvent::class);
|
|
92
|
+
}
|
|
79
93
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Models;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\Casts\Json;
|
|
6
|
+
use Fleetbase\FleetOps\Casts\Point;
|
|
7
|
+
use Fleetbase\Models\Model;
|
|
8
|
+
use Fleetbase\Traits\HasApiModelBehavior;
|
|
9
|
+
use Fleetbase\Traits\HasUuid;
|
|
10
|
+
use Fleetbase\Traits\Searchable;
|
|
11
|
+
use Fleetbase\Traits\TracksApiCredential;
|
|
12
|
+
use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
|
|
13
|
+
|
|
14
|
+
class VehicleDeviceEvent extends Model
|
|
15
|
+
{
|
|
16
|
+
use HasUuid, TracksApiCredential, HasApiModelBehavior, SpatialTrait, Searchable;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The database table used by the model.
|
|
20
|
+
*
|
|
21
|
+
* @var string
|
|
22
|
+
*/
|
|
23
|
+
protected $table = 'vehicle_device_events';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Attributes that is filterable on this model.
|
|
27
|
+
*
|
|
28
|
+
* @var array
|
|
29
|
+
*/
|
|
30
|
+
protected $fillable = [
|
|
31
|
+
'uuid',
|
|
32
|
+
'vehicle_device_uuid',
|
|
33
|
+
'payload',
|
|
34
|
+
'meta',
|
|
35
|
+
'location',
|
|
36
|
+
'ident',
|
|
37
|
+
'protocol',
|
|
38
|
+
'provider',
|
|
39
|
+
'mileage',
|
|
40
|
+
'state',
|
|
41
|
+
'code',
|
|
42
|
+
'reason',
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* The attributes that should be cast to native types.
|
|
46
|
+
*
|
|
47
|
+
* @var array
|
|
48
|
+
*/
|
|
49
|
+
protected $casts = [
|
|
50
|
+
'payload' => Json::class,
|
|
51
|
+
'meta' => Json::class,
|
|
52
|
+
'location' => Point::class,
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The attributes that are spatial columns.
|
|
57
|
+
*
|
|
58
|
+
* @var array
|
|
59
|
+
*/
|
|
60
|
+
protected $spatialFields = ['location'];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Dynamic attributes that are appended to object.
|
|
64
|
+
*
|
|
65
|
+
* @var array
|
|
66
|
+
*/
|
|
67
|
+
protected $appends = [];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Filterable params.
|
|
71
|
+
*
|
|
72
|
+
* @var array
|
|
73
|
+
*/
|
|
74
|
+
protected $filterParams = [];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The attributes excluded from the model's JSON form.
|
|
78
|
+
*
|
|
79
|
+
* @var array
|
|
80
|
+
*/
|
|
81
|
+
protected $hidden = [];
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
85
|
+
*/
|
|
86
|
+
public function device()
|
|
87
|
+
{
|
|
88
|
+
return $this->belongsTo(VehicleDevice::class);
|
|
89
|
+
}
|
|
90
|
+
}
|