@fleetbase/fleetops-engine 0.3.3 → 0.3.4

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 (110) hide show
  1. package/addon/components/contact-form-panel.hbs +28 -6
  2. package/addon/components/driver-form-panel.hbs +10 -0
  3. package/addon/components/driver-form-panel.js +51 -0
  4. package/addon/components/driver-panel/details.hbs +1 -5
  5. package/addon/components/driver-panel.hbs +21 -3
  6. package/addon/components/fleet-form-panel.hbs +60 -6
  7. package/addon/components/fleet-panel/details.hbs +1 -1
  8. package/addon/components/fuel-report-form-panel.hbs +84 -8
  9. package/addon/components/fuel-report-form-panel.js +6 -0
  10. package/addon/components/fuel-report-panel/details.hbs +4 -0
  11. package/addon/components/issue-form-panel.hbs +99 -11
  12. package/addon/components/issue-form-panel.js +5 -13
  13. package/addon/components/layout/fleet-ops-sidebar.js +8 -0
  14. package/addon/components/live-map-drawer.hbs +1 -1
  15. package/addon/components/live-map.hbs +1 -1
  16. package/addon/components/modals/driver-assign-vehicle.hbs +2 -11
  17. package/addon/components/modals/driver-assign-vendor.hbs +1 -9
  18. package/addon/components/modals/fuel-report-details.hbs +4 -0
  19. package/addon/components/order/schedule-card.hbs +32 -4
  20. package/addon/components/order/schedule-card.js +155 -5
  21. package/addon/components/place-form-panel.hbs +14 -7
  22. package/addon/components/place-form-panel.js +71 -0
  23. package/addon/components/place-panel/details.hbs +9 -19
  24. package/addon/components/vehicle-form-panel.hbs +67 -7
  25. package/addon/components/vehicle-form-panel.js +37 -0
  26. package/addon/components/vehicle-panel/details.hbs +9 -5
  27. package/addon/components/vehicle-panel.hbs +18 -4
  28. package/addon/components/vendor-form-panel/create-form.hbs +72 -11
  29. package/addon/components/vendor-form-panel/edit-form.hbs +1 -1
  30. package/addon/components/vendor-form-panel.hbs +70 -30
  31. package/addon/components/vendor-form-panel.js +4 -40
  32. package/addon/components/vendor-panel/details.hbs +2 -2
  33. package/addon/components/vendor-panel.hbs +16 -2
  34. package/addon/controllers/management/contacts/index.js +42 -3
  35. package/addon/controllers/management/fleets/index.js +12 -23
  36. package/addon/controllers/management/fuel-reports/index/new.js +1 -1
  37. package/addon/controllers/management/fuel-reports/index.js +73 -20
  38. package/addon/controllers/management/issues/index/new.js +2 -2
  39. package/addon/controllers/management/issues/index.js +65 -45
  40. package/addon/controllers/management/places/index.js +59 -18
  41. package/addon/controllers/management/vehicles/index.js +67 -8
  42. package/addon/controllers/management/vendors/index.js +63 -8
  43. package/addon/controllers/operations/orders/index.js +42 -1
  44. package/addon/routes/management/contacts/index.js +8 -0
  45. package/addon/routes/management/fleets/index.js +8 -2
  46. package/addon/routes/management/fuel-reports/index.js +6 -0
  47. package/addon/routes/management/issues/index.js +9 -1
  48. package/addon/routes/management/places/index.js +11 -1
  49. package/addon/routes/management/vehicles/index.js +3 -3
  50. package/addon/routes/management/vendors/index.js +8 -0
  51. package/addon/routes/operations/scheduler/index.js +1 -1
  52. package/addon/templates/operations/orders/index.hbs +1 -1
  53. package/addon/utils/get-issue-categories.js +30 -0
  54. package/addon/utils/get-issue-types.js +3 -0
  55. package/addon/utils/get-vendor-status-options.js +3 -0
  56. package/addon/utils/get-vendor-type-options.js +41 -0
  57. package/app/utils/get-issue-categories.js +1 -0
  58. package/app/utils/get-issue-types.js +1 -0
  59. package/app/utils/get-vendor-categories.js +1 -0
  60. package/app/utils/get-vendor-status-options.js +1 -0
  61. package/app/utils/get-vendor-type-options.js +1 -0
  62. package/app/utils/get-vendor-types.js +1 -0
  63. package/composer.json +1 -1
  64. package/extension.json +1 -1
  65. package/package.json +4 -4
  66. package/server/migrations/2023_11_09_041807_add_status_column_to_fuel_reports_table.php +32 -0
  67. package/server/migrations/2023_11_15_062814_add_comments_column_and_resolved_at_column_to_vehicle_device_events_table.php +33 -0
  68. package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -2
  69. package/server/src/Http/Controllers/Api/v1/VehicleController.php +2 -2
  70. package/server/src/Http/Controllers/Internal/v1/DriverController.php +5 -13
  71. package/server/src/Http/Controllers/Internal/v1/OrderController.php +1 -3
  72. package/server/src/Http/Filter/ContactFilter.php +10 -0
  73. package/server/src/Http/Filter/FleetFilter.php +8 -6
  74. package/server/src/Http/Filter/FuelReportFilter.php +51 -0
  75. package/server/src/Http/Filter/IssueFilter.php +61 -5
  76. package/server/src/Http/Filter/PlaceFilter.php +48 -6
  77. package/server/src/Http/Filter/VehicleFilter.php +21 -6
  78. package/server/src/Http/Filter/VendorFilter.php +11 -8
  79. package/server/src/Http/Middleware/TransformLocationMiddleware.php +1 -1
  80. package/server/src/Http/Resources/Internal/v1/IntegratedVendorFacilitator.php +17 -18
  81. package/server/src/Http/Resources/v1/Contact.php +16 -19
  82. package/server/src/Http/Resources/v1/CurrentJob.php +13 -16
  83. package/server/src/Http/Resources/v1/Driver.php +59 -57
  84. package/server/src/Http/Resources/v1/Entity.php +30 -33
  85. package/server/src/Http/Resources/v1/FuelReport.php +16 -14
  86. package/server/src/Http/Resources/v1/Order.php +1 -1
  87. package/server/src/Http/Resources/v1/Payload.php +21 -24
  88. package/server/src/Http/Resources/v1/Place.php +27 -30
  89. package/server/src/Http/Resources/v1/Proof.php +13 -16
  90. package/server/src/Http/Resources/v1/PurchaseRate.php +14 -17
  91. package/server/src/Http/Resources/v1/ServiceArea.php +13 -16
  92. package/server/src/Http/Resources/v1/ServiceQuote.php +15 -18
  93. package/server/src/Http/Resources/v1/ServiceRate.php +33 -36
  94. package/server/src/Http/Resources/v1/ServiceRateFee.php +14 -17
  95. package/server/src/Http/Resources/v1/ServiceRateParcelFee.php +9 -12
  96. package/server/src/Http/Resources/v1/TrackingNumber.php +18 -21
  97. package/server/src/Http/Resources/v1/TrackingStatus.php +18 -21
  98. package/server/src/Http/Resources/v1/Vehicle.php +31 -34
  99. package/server/src/Http/Resources/v1/VehicleDevice.php +23 -25
  100. package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +38 -32
  101. package/server/src/Http/Resources/v1/Vendor.php +31 -26
  102. package/server/src/Http/Resources/v1/Zone.php +14 -17
  103. package/server/src/Models/Driver.php +7 -1
  104. package/server/src/Models/FuelReport.php +1 -0
  105. package/server/src/Models/IntegratedVendor.php +6 -1
  106. package/server/src/Models/Order.php +2 -2
  107. package/server/src/Models/Place.php +2 -2
  108. package/server/src/Models/VehicleDeviceEvent.php +1 -0
  109. package/server/src/Models/Vendor.php +1 -1
  110. package/server/src/Observers/DriverObserver.php +15 -0
@@ -16,21 +16,18 @@ class Proof extends FleetbaseResource
16
16
  */
17
17
  public function toArray($request)
18
18
  {
19
- return array_merge(
20
- $this->getInternalIds(),
21
- [
22
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
23
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
25
- 'subject_id' => $this->subject ? $this->subject->public_id : null,
26
- 'order_id' => $this->order ? $this->order->public_id : null,
27
- 'url' => $this->file_url,
28
- 'remarks' => $this->remarks,
29
- 'raw' => $this->raw_data,
30
- 'data' => $this->data,
31
- 'updated_at' => $this->updated_at,
32
- 'created_at' => $this->created_at,
33
- ]
34
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
23
+ 'subject_id' => $this->subject ? $this->subject->public_id : null,
24
+ 'order_id' => $this->order ? $this->order->public_id : null,
25
+ 'url' => $this->file_url,
26
+ 'remarks' => $this->remarks,
27
+ 'raw' => $this->raw_data,
28
+ 'data' => $this->data,
29
+ 'updated_at' => $this->updated_at,
30
+ 'created_at' => $this->created_at,
31
+ ];
35
32
  }
36
33
  }
@@ -17,23 +17,20 @@ class PurchaseRate extends FleetbaseResource
17
17
  */
18
18
  public function toArray($request)
19
19
  {
20
- return array_merge(
21
- $this->getInternalIds(),
22
- [
23
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
24
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
25
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
26
- 'service_quote' => $this->service_quote_id,
27
- 'order' => $this->order_id,
28
- 'customer' => $this->customer_id,
29
- 'transaction' => $this->transaction_id,
30
- 'amount' => $this->amount,
31
- 'currency' => $this->currency,
32
- 'status' => $this->status,
33
- 'updated_at' => $this->updated_at,
34
- 'created_at' => $this->created_at,
35
- ]
36
- );
20
+ return [
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'service_quote' => $this->service_quote_id,
25
+ 'order' => $this->order_id,
26
+ 'customer' => $this->customer_id,
27
+ 'transaction' => $this->transaction_id,
28
+ 'amount' => $this->amount,
29
+ 'currency' => $this->currency,
30
+ 'status' => $this->status,
31
+ 'updated_at' => $this->updated_at,
32
+ 'created_at' => $this->created_at,
33
+ ];
37
34
  }
38
35
 
39
36
  /**
@@ -16,22 +16,19 @@ class ServiceArea extends FleetbaseResource
16
16
  */
17
17
  public function toArray($request)
18
18
  {
19
- return array_merge(
20
- $this->getInternalIds(),
21
- [
22
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
23
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
25
- 'name' => $this->name,
26
- 'type' => $this->type,
27
- 'location' => $this->location,
28
- 'border' => $this->border,
29
- 'zones' => $this->whenLoaded('zones', Zone::collection($this->zones)),
30
- 'status' => $this->status,
31
- 'updated_at' => $this->updated_at,
32
- 'created_at' => $this->created_at,
33
- ]
34
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
23
+ 'name' => $this->name,
24
+ 'type' => $this->type,
25
+ 'location' => $this->location,
26
+ 'border' => $this->border,
27
+ 'zones' => $this->whenLoaded('zones', Zone::collection($this->zones)),
28
+ 'status' => $this->status,
29
+ 'updated_at' => $this->updated_at,
30
+ 'created_at' => $this->created_at,
31
+ ];
35
32
  }
36
33
 
37
34
  /**
@@ -16,24 +16,21 @@ class ServiceQuote extends FleetbaseResource
16
16
  */
17
17
  public function toArray($request)
18
18
  {
19
- return array_merge(
20
- $this->getInternalIds(),
21
- [
22
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
23
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
25
- 'service_rate_uuid' => $this->when(Http::isInternalRequest(), $this->service_rate_uuid),
26
- 'payload_uuid' => $this->when(Http::isInternalRequest(), $this->payload_uuid),
27
- 'service_rate_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceRate.name')),
28
- 'service_rate' => $this->when(Http::isPublicRequest(), data_get($this, 'serviceRate.public_id')),
29
- 'facilitator' => $this->when(Http::isPublicRequest(), data_get($this, 'integratedVendor.public_id')),
30
- 'request_id' => $this->request_id,
31
- 'amount' => $this->amount,
32
- 'currency' => $this->currency,
33
- 'updated_at' => $this->updated_at,
34
- 'created_at' => $this->created_at,
35
- ]
36
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
23
+ 'service_rate_uuid' => $this->when(Http::isInternalRequest(), $this->service_rate_uuid),
24
+ 'payload_uuid' => $this->when(Http::isInternalRequest(), $this->payload_uuid),
25
+ 'service_rate_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceRate.name')),
26
+ 'service_rate' => $this->when(Http::isPublicRequest(), data_get($this, 'serviceRate.public_id')),
27
+ 'facilitator' => $this->when(Http::isPublicRequest(), data_get($this, 'integratedVendor.public_id')),
28
+ 'request_id' => $this->request_id,
29
+ 'amount' => $this->amount,
30
+ 'currency' => $this->currency,
31
+ 'updated_at' => $this->updated_at,
32
+ 'created_at' => $this->created_at,
33
+ ];
37
34
  }
38
35
 
39
36
  /**
@@ -17,42 +17,39 @@ class ServiceRate extends FleetbaseResource
17
17
  */
18
18
  public function toArray($request)
19
19
  {
20
- return array_merge(
21
- $this->getInternalIds(),
22
- [
23
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
24
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
25
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
26
- 'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
27
- 'service_area_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceArea.name')),
28
- 'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
29
- 'zone_name' => $this->when(Http::isInternalRequest(), data_get($this, 'zone.name')),
30
- 'service_name' => $this->service_name,
31
- 'service_type' => $this->service_type,
32
- 'base_fee' => $this->base_fee,
33
- 'rate_calculation_method' => $this->rate_calculation_method,
34
- 'per_meter_flat_rate_fee' => $this->per_meter_flat_rate_fee,
35
- 'per_meter_unit' => $this->per_meter_unit,
36
- 'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
37
- 'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
38
- 'algorithm' => $this->algorithm,
39
- 'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
40
- 'cod_calculation_method' => $this->cod_calculation_method,
41
- 'cod_flat_fee' => $this->cod_flat_fee,
42
- 'cod_percent' => $this->cod_percent,
43
- 'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
44
- 'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
45
- 'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
46
- 'peak_hours_percent' => $this->peak_hours_percent,
47
- 'peak_hours_start' => $this->peak_hours_start,
48
- 'peak_hours_end' => $this->peak_hours_end,
49
- 'currency' => $this->currency,
50
- 'duration_terms' => $this->duration_terms,
51
- 'estimated_days' => $this->estimated_days,
52
- 'updated_at' => $this->updated_at,
53
- 'created_at' => $this->created_at,
54
- ]
55
- );
20
+ return [
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
25
+ 'service_area_name' => $this->when(Http::isInternalRequest(), data_get($this, 'serviceArea.name')),
26
+ 'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
27
+ 'zone_name' => $this->when(Http::isInternalRequest(), data_get($this, 'zone.name')),
28
+ 'service_name' => $this->service_name,
29
+ 'service_type' => $this->service_type,
30
+ 'base_fee' => $this->base_fee,
31
+ 'rate_calculation_method' => $this->rate_calculation_method,
32
+ 'per_meter_flat_rate_fee' => $this->per_meter_flat_rate_fee,
33
+ 'per_meter_unit' => $this->per_meter_unit,
34
+ 'meter_fees' => ServiceRateFee::collection($this->rateFees ?? []),
35
+ 'parcel_fees' => ServiceRateParcelFee::collection($this->rateFees ?? []),
36
+ 'algorithm' => $this->algorithm,
37
+ 'has_cod_fee' => Utils::castBoolean($this->has_cod_fee),
38
+ 'cod_calculation_method' => $this->cod_calculation_method,
39
+ 'cod_flat_fee' => $this->cod_flat_fee,
40
+ 'cod_percent' => $this->cod_percent,
41
+ 'has_peak_hours_fee' => Utils::castBoolean($this->has_peak_hours_fee),
42
+ 'peak_hours_calculation_method' => $this->peak_hours_calculation_method,
43
+ 'peak_hours_flat_fee' => $this->peak_hours_flat_fee,
44
+ 'peak_hours_percent' => $this->peak_hours_percent,
45
+ 'peak_hours_start' => $this->peak_hours_start,
46
+ 'peak_hours_end' => $this->peak_hours_end,
47
+ 'currency' => $this->currency,
48
+ 'duration_terms' => $this->duration_terms,
49
+ 'estimated_days' => $this->estimated_days,
50
+ 'updated_at' => $this->updated_at,
51
+ 'created_at' => $this->created_at,
52
+ ];
56
53
  }
57
54
 
58
55
  /**
@@ -16,23 +16,20 @@ class ServiceRateFee extends FleetbaseResource
16
16
  */
17
17
  public function toArray($request)
18
18
  {
19
- return array_merge(
20
- $this->getInternalIds(),
21
- [
22
- 'id' => $this->when(Http::isInternalRequest(), $this->id),
23
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
- 'fee' => $this->fee,
25
- 'currency' => $this->currency,
26
- 'size' => $this->size,
27
- 'length' => $this->length,
28
- 'height' => $this->height,
29
- 'dimensions_unit' => $this->dimensions_unit,
30
- 'weight' => $this->weight,
31
- 'weight_unit' => $this->weight_unit,
32
- 'updated_at' => $this->updated_at,
33
- 'created_at' => $this->created_at,
34
- ]
35
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'fee' => $this->fee,
23
+ 'currency' => $this->currency,
24
+ 'size' => $this->size,
25
+ 'length' => $this->length,
26
+ 'height' => $this->height,
27
+ 'dimensions_unit' => $this->dimensions_unit,
28
+ 'weight' => $this->weight,
29
+ 'weight_unit' => $this->weight_unit,
30
+ 'updated_at' => $this->updated_at,
31
+ 'created_at' => $this->created_at,
32
+ ];
36
33
  }
37
34
 
38
35
  /**
@@ -16,18 +16,15 @@ class ServiceRateParcelFee extends FleetbaseResource
16
16
  */
17
17
  public function toArray($request)
18
18
  {
19
- return array_merge(
20
- $this->getInternalIds(),
21
- [
22
- 'id' => $this->when(Http::isInternalRequest(), $this->id),
23
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
- 'fee' => $this->fee,
25
- 'currency' => $this->currency,
26
- 'distance' => $this->distance,
27
- 'updated_at' => $this->updated_at,
28
- 'created_at' => $this->created_at,
29
- ]
30
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'fee' => $this->fee,
23
+ 'currency' => $this->currency,
24
+ 'distance' => $this->distance,
25
+ 'updated_at' => $this->updated_at,
26
+ 'created_at' => $this->created_at,
27
+ ];
31
28
  }
32
29
 
33
30
  /**
@@ -17,27 +17,24 @@ class TrackingNumber extends FleetbaseResource
17
17
  */
18
18
  public function toArray($request)
19
19
  {
20
- return array_merge(
21
- $this->getInternalIds(),
22
- [
23
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
24
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
25
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
26
- 'status_uuid' => $this->when(Http::isInternalRequest(), $this->status_uuid),
27
- 'owner_uuid' => $this->when(Http::isInternalRequest(), $this->owner_uuid),
28
- 'owner_type' => $this->when(Http::isInternalRequest(), $this->owner_type),
29
- 'tracking_number' => $this->tracking_number,
30
- 'subject' => Utils::get($this->owner, 'public_id'),
31
- 'region' => $this->region,
32
- 'status' => $this->last_status,
33
- 'status_code' => $this->last_status_code,
34
- 'qr_code' => $this->qr_code,
35
- 'barcode' => $this->barcode,
36
- 'type' => Utils::getTypeFromClassName($this->owner_type),
37
- 'updated_at' => $this->updated_at,
38
- 'created_at' => $this->created_at,
39
- ]
40
- );
20
+ return [
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'status_uuid' => $this->when(Http::isInternalRequest(), $this->status_uuid),
25
+ 'owner_uuid' => $this->when(Http::isInternalRequest(), $this->owner_uuid),
26
+ 'owner_type' => $this->when(Http::isInternalRequest(), $this->owner_type),
27
+ 'tracking_number' => $this->tracking_number,
28
+ 'subject' => Utils::get($this->owner, 'public_id'),
29
+ 'region' => $this->region,
30
+ 'status' => $this->last_status,
31
+ 'status_code' => $this->last_status_code,
32
+ 'qr_code' => $this->qr_code,
33
+ 'barcode' => $this->barcode,
34
+ 'type' => Utils::getTypeFromClassName($this->owner_type),
35
+ 'updated_at' => $this->updated_at,
36
+ 'created_at' => $this->created_at,
37
+ ];
41
38
  }
42
39
 
43
40
  /**
@@ -18,27 +18,24 @@ class TrackingStatus extends FleetbaseResource
18
18
  */
19
19
  public function toArray($request)
20
20
  {
21
- return array_merge(
22
- $this->getInternalIds(),
23
- [
24
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
25
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
26
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
27
- 'tracking_number_uuid' => $this->when(Http::isInternalRequest(), $this->tracking_number_uuid),
28
- 'proof_uuid' => $this->when(Http::isInternalRequest(), $this->proof_uuid),
29
- 'status' => $this->status,
30
- 'details' => $this->details,
31
- 'code' => $this->code,
32
- 'tracking_number' => $this->trackingNumber(),
33
- 'city' => $this->city,
34
- 'province' => $this->province,
35
- 'postal_code' => $this->postal_code,
36
- 'country' => $this->country,
37
- 'location' => $this->location ?? new Point(0, 0),
38
- 'updated_at' => $this->updated_at,
39
- 'created_at' => $this->created_at,
40
- ]
41
- );
21
+ return [
22
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
23
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
24
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
25
+ 'tracking_number_uuid' => $this->when(Http::isInternalRequest(), $this->tracking_number_uuid),
26
+ 'proof_uuid' => $this->when(Http::isInternalRequest(), $this->proof_uuid),
27
+ 'status' => $this->status,
28
+ 'details' => $this->details,
29
+ 'code' => $this->code,
30
+ 'tracking_number' => $this->trackingNumber(),
31
+ 'city' => $this->city,
32
+ 'province' => $this->province,
33
+ 'postal_code' => $this->postal_code,
34
+ 'country' => $this->country,
35
+ 'location' => $this->location ?? new Point(0, 0),
36
+ 'updated_at' => $this->updated_at,
37
+ 'created_at' => $this->created_at,
38
+ ];
42
39
  }
43
40
 
44
41
  /**
@@ -17,40 +17,37 @@ class Vehicle extends FleetbaseResource
17
17
  */
18
18
  public function toArray($request)
19
19
  {
20
- return array_merge(
21
- $this->getInternalIds(),
22
- [
23
- 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
24
- 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
25
- 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
26
- 'photo_uuid' => $this->when(Http::isInternalRequest(), $this->photo_uuid),
27
- 'internal_id' => $this->internal_id,
28
- 'name' => $this->display_name,
29
- 'display_name' => $this->when(Http::isInternalRequest(), $this->display_name),
30
- 'vin' => $this->vin ?? null,
31
- 'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
32
- 'devices' => $this->whenLoaded('devices', $this->devices),
33
- 'photo_url' => $this->photoUrl,
34
- 'avatar_url' => $this->avatar_url,
35
- 'make' => $this->make,
36
- 'model' => $this->model,
37
- 'year' => $this->year,
38
- 'trim' => $this->trim,
39
- 'type' => $this->type,
40
- 'plate_number' => $this->plate_number,
41
- 'vin' => $this->vin,
42
- 'vin_data' => $this->vin_data,
43
- 'status' => $this->status,
44
- 'online' => $this->online,
45
- 'location' => data_get($this, 'location', new Point(0, 0)),
46
- 'heading' => (int) data_get($this, 'heading', 0),
47
- 'altitude' => (int) data_get($this, 'altitude', 0),
48
- 'speed' => (int) data_get($this, 'speed', 0),
49
- 'meta' => $this->meta ?? [],
50
- 'updated_at' => $this->updated_at,
51
- 'created_at' => $this->created_at,
52
- ]
53
- );
20
+ return [
21
+ 'id' => $this->when(Http::isInternalRequest(), $this->id, $this->public_id),
22
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
23
+ 'public_id' => $this->when(Http::isInternalRequest(), $this->public_id),
24
+ 'photo_uuid' => $this->when(Http::isInternalRequest(), $this->photo_uuid),
25
+ 'internal_id' => $this->internal_id,
26
+ 'name' => $this->display_name,
27
+ 'display_name' => $this->when(Http::isInternalRequest(), $this->display_name),
28
+ 'vin' => $this->vin ?? null,
29
+ 'driver' => $this->whenLoaded('driver', new Driver($this->driver)),
30
+ 'devices' => $this->whenLoaded('devices', $this->devices),
31
+ 'photo_url' => $this->photo_url,
32
+ 'avatar_url' => $this->avatar_url,
33
+ 'make' => $this->make,
34
+ 'model' => $this->model,
35
+ 'year' => $this->year,
36
+ 'trim' => $this->trim,
37
+ 'type' => $this->type,
38
+ 'plate_number' => $this->plate_number,
39
+ 'vin' => $this->vin,
40
+ 'vin_data' => $this->vin_data,
41
+ 'status' => $this->status,
42
+ 'online' => $this->online,
43
+ 'location' => data_get($this, 'location', new Point(0, 0)),
44
+ 'heading' => (int) data_get($this, 'heading', 0),
45
+ 'altitude' => (int) data_get($this, 'altitude', 0),
46
+ 'speed' => (int) data_get($this, 'speed', 0),
47
+ 'meta' => data_get($this, 'meta', []),
48
+ 'updated_at' => $this->updated_at,
49
+ 'created_at' => $this->created_at,
50
+ ];
54
51
  }
55
52
 
56
53
  /**
@@ -3,6 +3,7 @@
3
3
  namespace Fleetbase\FleetOps\Http\Resources\v1;
4
4
 
5
5
  use Fleetbase\Http\Resources\FleetbaseResource;
6
+ use Fleetbase\Support\Http;
6
7
 
7
8
  class VehicleDevice extends FleetbaseResource
8
9
  {
@@ -15,30 +16,27 @@ class VehicleDevice extends FleetbaseResource
15
16
  */
16
17
  public function toArray($request)
17
18
  {
18
- return array_merge(
19
- $this->getInternalIds(),
20
- [
21
- 'id' => $this->id,
22
- 'uuid' => $this->uuid,
23
- 'vehicle_uuid' => $this->vehicle_uuid,
24
- 'device_id' => $this->device_id,
25
- 'device_provider' => $this->device_provider,
26
- 'device_type' => $this->device_type,
27
- 'device_name' => $this->device_name,
28
- 'device_model' => $this->device_model,
29
- 'device_location' => $this->device_location,
30
- 'manufacturer' => $this->manufacturer,
31
- 'serial_number' => $this->serial_number,
32
- 'installation_date' => $this->installation_date,
33
- 'last_maintenance_date' => $this->last_maintenance_date,
34
- 'meta' => $this->meta ?? [],
35
- 'data' => $this->data ?? [],
36
- 'status' => $this->status,
37
- 'data_frequency' => $this->data_frequency,
38
- 'notes' => $this->notes,
39
- 'updated_at' => $this->updated_at,
40
- 'created_at' => $this->created_at,
41
- ]
42
- );
19
+ return [
20
+ 'id' => $this->when(Http::isInternalRequest(), $this->id),
21
+ 'uuid' => $this->when(Http::isInternalRequest(), $this->uuid),
22
+ 'vehicle_uuid' => $this->vehicle_uuid,
23
+ 'device_id' => $this->device_id,
24
+ 'device_provider' => $this->device_provider,
25
+ 'device_type' => $this->device_type,
26
+ 'device_name' => $this->device_name,
27
+ 'device_model' => $this->device_model,
28
+ 'device_location' => $this->device_location,
29
+ 'manufacturer' => $this->manufacturer,
30
+ 'serial_number' => $this->serial_number,
31
+ 'installation_date' => $this->installation_date,
32
+ 'last_maintenance_date' => $this->last_maintenance_date,
33
+ 'meta' => $this->meta ?? [],
34
+ 'data' => $this->data ?? [],
35
+ 'status' => $this->status,
36
+ 'data_frequency' => $this->data_frequency,
37
+ 'notes' => $this->notes,
38
+ 'updated_at' => $this->updated_at,
39
+ 'created_at' => $this->created_at,
40
+ ];
43
41
  }
44
42
  }