@fleetbase/fleetops-engine 0.2.9 → 0.3.1

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.
Files changed (70) hide show
  1. package/addon/components/context-panel.hbs +1 -1
  2. package/addon/components/driver-card-mini.js +34 -13
  3. package/addon/components/driver-form-panel.hbs +3 -3
  4. package/addon/components/driver-form-panel.js +87 -29
  5. package/addon/components/driver-panel.hbs +5 -5
  6. package/addon/components/driver-panel.js +118 -31
  7. package/addon/components/live-map.js +221 -10
  8. package/addon/components/map-container/toolbar/visibility-control-panel.hbs +66 -0
  9. package/addon/components/map-container/toolbar/visibility-control-panel.js +74 -0
  10. package/addon/components/map-container/toolbar/zones-panel.hbs +10 -10
  11. package/addon/components/map-container/toolbar/zones-panel.js +90 -61
  12. package/addon/components/map-container/toolbar.hbs +12 -7
  13. package/addon/components/modals/vehicle-form.hbs +35 -35
  14. package/addon/components/vehicle-form-panel.hbs +6 -7
  15. package/addon/components/vehicle-form-panel.js +86 -26
  16. package/addon/components/vehicle-panel.hbs +5 -5
  17. package/addon/components/vehicle-panel.js +124 -31
  18. package/addon/controllers/management/drivers/index/details.js +53 -0
  19. package/addon/controllers/management/drivers/index/edit.js +77 -46
  20. package/addon/controllers/management/drivers/index/new.js +39 -79
  21. package/addon/controllers/management/drivers/index.js +17 -221
  22. package/addon/controllers/management/fleets/index/edit.js +1 -1
  23. package/addon/controllers/management/fleets/index/new.js +1 -1
  24. package/addon/controllers/management/fuel-reports/index.js +2 -2
  25. package/addon/controllers/management/vehicles/index/details.js +49 -0
  26. package/addon/controllers/management/vehicles/index/edit.js +104 -1
  27. package/addon/controllers/management/vehicles/index/new.js +71 -0
  28. package/addon/controllers/operations/orders/index/new.js +1 -1
  29. package/addon/controllers/operations/orders/index/view.js +17 -7
  30. package/addon/controllers/operations/orders/index.js +109 -48
  31. package/addon/controllers/operations/service-rates/index/edit.js +1 -1
  32. package/addon/controllers/operations/service-rates/index/new.js +1 -1
  33. package/addon/helpers/is-visibility-control-visible.js +18 -0
  34. package/addon/routes/application.js +1 -1
  35. package/addon/routes/home.js +1 -1
  36. package/addon/routes/management/drivers/index/details.js +5 -0
  37. package/addon/routes/operations/service-rates/index.js +1 -1
  38. package/addon/routes/operations/zones/index.js +1 -1
  39. package/addon/services/context-panel.js +81 -14
  40. package/addon/templates/management/drivers/index/details.hbs +1 -1
  41. package/addon/templates/management/drivers/index/edit.hbs +1 -1
  42. package/addon/templates/management/drivers/index/new.hbs +1 -1
  43. package/addon/templates/management/vehicles/index/details.hbs +1 -1
  44. package/addon/templates/management/vehicles/index/edit.hbs +1 -1
  45. package/addon/templates/management/vehicles/index/new.hbs +1 -1
  46. package/addon/templates/operations/orders/index/view.hbs +2 -2
  47. package/addon/templates/operations/orders/index.hbs +1 -1
  48. package/addon/utils/apply-context-component-arguments.js +31 -0
  49. package/addon/utils/context-component-callback.js +16 -0
  50. package/app/components/map-container/toolbar/visibility-control-panel.js +1 -0
  51. package/app/helpers/is-visibility-control-visible.js +1 -0
  52. package/app/utils/apply-context-component-arguments.js +1 -0
  53. package/app/utils/context-component-callback.js +1 -0
  54. package/composer.json +2 -2
  55. package/extension.json +1 -1
  56. package/package.json +3 -3
  57. package/server/migrations/2023_09_14_074512_update_vehicles_table.php +89 -88
  58. package/server/migrations/2023_10_25_093014_create_vehicle_device_events_table.php +56 -0
  59. package/server/src/Http/Resources/v1/Vehicle.php +1 -0
  60. package/server/src/Models/Fleet.php +2 -0
  61. package/server/src/Models/VehicleDevice.php +17 -3
  62. package/server/src/Models/VehicleDeviceEvent.php +90 -0
  63. package/server/src/Notifications/OrderAssigned.php +21 -0
  64. package/server/src/Notifications/OrderCanceled.php +21 -0
  65. package/server/src/Notifications/OrderDispatchFailed.php +21 -0
  66. package/server/src/Notifications/OrderDispatched.php +21 -0
  67. package/server/src/Notifications/OrderPing.php +21 -0
  68. package/server/src/Notifications/OrderSplit.php +32 -5
  69. package/server/src/Providers/FleetOpsServiceProvider.php +22 -0
  70. package/server/src/Providers/NotificationServiceProvider.php +43 -0
@@ -150,7 +150,7 @@
150
150
  <span>Driver Assigned</span>
151
151
  </div>
152
152
  <div>
153
- <div class="flex flex-row">
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
- </div>
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}} @map={{this.leafletMap}} @onPressDisplayPlaces={{this.viewPlacesOnMap}} @onPressViewOrders={{this.toggleOrdersPanel}} @onPressSearch={{this.toggleSearch}} @onPressCreateOrder={{this.createOrder}} @onPressCreateDriver={{this.driversController.createDriver}} @onPressDriverProfile={{this.driversController.viewDriver}} />
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/composer.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbase/fleetops-api",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "keywords": [
6
6
  "fleetbase-extension",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "require": {
24
24
  "php": "^7.4|^8.0",
25
- "fleetbase/core-api": "^1.3.1",
25
+ "fleetbase/core-api": "^1.3.2",
26
26
  "barryvdh/laravel-dompdf": "^2.0",
27
27
  "brick/geo": "0.7.2",
28
28
  "cknow/laravel-money": "^7.1",
package/extension.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Fleet-Ops",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
4
4
  "description": "Fleet & Transport Management Extension for Fleetbase",
5
5
  "repository": "https://github.com/fleetbase/fleetops",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetbase/fleetops-engine",
3
- "version": "0.2.9",
3
+ "version": "0.3.1",
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.5",
43
- "@fleetbase/ember-ui": "^0.2.0",
42
+ "@fleetbase/ember-core": "^0.1.6",
43
+ "@fleetbase/ember-ui": "^0.2.2",
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
- 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
- }
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
- $table->dropColumn([
26
- 'model_0_to_100_kph',
27
- 'model_body',
28
- 'model_co2',
29
- 'model_doors',
30
- 'model_drive',
31
- 'model_engine_bore_mm',
32
- 'model_engine_cc',
33
- 'model_engine_compression',
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
- public function down()
61
- {
62
- Schema::table('vehicles', function (Blueprint $table) {
63
- $table->dropColumn('location');
64
- $table->dropColumn('model');
65
- $table->dropColumn('model_data');
66
- $table->dropColumn('telematics');
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
- $table->string('model_0_to_100_kph')->nullable();
69
- $table->string('model_body')->nullable();
70
- $table->string('model_co2')->nullable();
71
- $table->string('model_doors')->nullable();
72
- $table->string('model_drive')->nullable();
73
- $table->string('model_engine_bore_mm')->nullable();
74
- $table->string('model_engine_cc')->nullable();
75
- $table->string('model_engine_compression')->nullable();
76
- $table->string('model_engine_cyl')->nullable();
77
- $table->string('model_engine_fuel')->nullable();
78
- $table->string('model_engine_position')->nullable();
79
- $table->string('model_engine_power_ps')->nullable();
80
- $table->string('model_engine_power_rpm')->nullable();
81
- $table->string('model_engine_stroke_mm')->nullable();
82
- $table->string('model_engine_torque_nm')->nullable();
83
- $table->string('model_engine_torque_rpm')->nullable();
84
- $table->string('model_engine_valves_per_cyl')->nullable();
85
- $table->string('model_fuel_cap_l')->nullable();
86
- $table->string('model_length_mm')->nullable();
87
- $table->string('model_lkm_city')->nullable();
88
- $table->string('model_lkm_hwy')->nullable();
89
- $table->string('model_lkm_mixed')->nullable();
90
- $table->string('model_make_display')->nullable();
91
- $table->string('model_seats')->nullable();
92
- $table->string('model_sold_in_us')->nullable();
93
- $table->string('model_top_speed_kph')->nullable();
94
- $table->string('model_transmission_type')->nullable();
95
- $table->string('model_weight_kg')->nullable();
96
- $table->string('model_wheelbase_mm')->nullable();
97
- $table->string('model_width_mm')->nullable();
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,
@@ -9,6 +9,7 @@ use Fleetbase\Traits\HasUuid;
9
9
  use Fleetbase\Traits\Searchable;
10
10
  use Fleetbase\Traits\SendsWebhooks;
11
11
  use Fleetbase\Traits\TracksApiCredential;
12
+ use Illuminate\Notifications\Notifiable;
12
13
  use Spatie\Activitylog\Traits\LogsActivity;
13
14
  use Spatie\Sluggable\HasSlug;
14
15
  use Spatie\Sluggable\SlugOptions;
@@ -23,6 +24,7 @@ class Fleet extends Model
23
24
  use Searchable;
24
25
  use HasSlug;
25
26
  use LogsActivity;
27
+ use Notifiable;
26
28
 
27
29
  /**
28
30
  * The database table used by the model.
@@ -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
+ }
@@ -30,6 +30,27 @@ class OrderAssigned extends Notification implements ShouldQueue
30
30
  */
31
31
  public $order;
32
32
 
33
+ /**
34
+ * Notification name.
35
+ *
36
+ * @var string
37
+ */
38
+ public static string $name = 'Order Assigned';
39
+
40
+ /**
41
+ * Notification description.
42
+ *
43
+ * @var string
44
+ */
45
+ public static string $description = 'Notify when an order has been assigned to a driver.';
46
+
47
+ /**
48
+ * Notification package.
49
+ *
50
+ * @var string
51
+ */
52
+ public static string $package = 'fleet-ops';
53
+
33
54
  /**
34
55
  * Create a new notification instance.
35
56
  *
@@ -30,6 +30,27 @@ class OrderCanceled extends Notification implements ShouldQueue
30
30
  */
31
31
  public $order;
32
32
 
33
+ /**
34
+ * Notification name.
35
+ *
36
+ * @var string
37
+ */
38
+ public static string $name = 'Order Canceled';
39
+
40
+ /**
41
+ * Notification description.
42
+ *
43
+ * @var string
44
+ */
45
+ public static string $description = 'Notify when an order has been canceled.';
46
+
47
+ /**
48
+ * Notification package.
49
+ *
50
+ * @var string
51
+ */
52
+ public static string $package = 'fleet-ops';
53
+
33
54
  /**
34
55
  * Create a new notification instance.
35
56
  *
@@ -29,6 +29,27 @@ class OrderDispatchFailed extends Notification implements ShouldQueue
29
29
  */
30
30
  public $reason;
31
31
 
32
+ /**
33
+ * Notification name.
34
+ *
35
+ * @var string
36
+ */
37
+ public static string $name = 'Order dispatch Failed';
38
+
39
+ /**
40
+ * Notification description.
41
+ *
42
+ * @var string
43
+ */
44
+ public static string $description = 'Notify when an order dispatch has been failed.';
45
+
46
+ /**
47
+ * Notification package.
48
+ *
49
+ * @var string
50
+ */
51
+ public static string $package = 'fleet-ops';
52
+
32
53
  /**
33
54
  * Create a new notification instance.
34
55
  *
@@ -33,6 +33,27 @@ class OrderDispatched extends Notification implements ShouldQueue
33
33
  */
34
34
  public $order;
35
35
 
36
+ /**
37
+ * Notification name.
38
+ *
39
+ * @var string
40
+ */
41
+ public static string $name = 'Order Dispatched';
42
+
43
+ /**
44
+ * Notification description.
45
+ *
46
+ * @var string
47
+ */
48
+ public static string $description = 'Notify when an order has been dispatched.';
49
+
50
+ /**
51
+ * Notification package.
52
+ *
53
+ * @var string
54
+ */
55
+ public static string $package = 'fleet-ops';
56
+
36
57
  /**
37
58
  * Create a new notification instance.
38
59
  *