@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.
- package/addon/components/contact-form-panel.hbs +28 -6
- package/addon/components/driver-form-panel.hbs +10 -0
- package/addon/components/driver-form-panel.js +51 -0
- package/addon/components/driver-panel/details.hbs +1 -5
- package/addon/components/driver-panel.hbs +21 -3
- package/addon/components/fleet-form-panel.hbs +60 -6
- package/addon/components/fleet-panel/details.hbs +1 -1
- package/addon/components/fuel-report-form-panel.hbs +84 -8
- package/addon/components/fuel-report-form-panel.js +6 -0
- package/addon/components/fuel-report-panel/details.hbs +4 -0
- package/addon/components/issue-form-panel.hbs +99 -11
- package/addon/components/issue-form-panel.js +5 -13
- package/addon/components/layout/fleet-ops-sidebar.js +8 -0
- package/addon/components/live-map-drawer.hbs +1 -1
- package/addon/components/live-map.hbs +1 -1
- package/addon/components/modals/driver-assign-vehicle.hbs +2 -11
- package/addon/components/modals/driver-assign-vendor.hbs +1 -9
- package/addon/components/modals/fuel-report-details.hbs +4 -0
- package/addon/components/order/schedule-card.hbs +32 -4
- package/addon/components/order/schedule-card.js +155 -5
- package/addon/components/place-form-panel.hbs +14 -7
- package/addon/components/place-form-panel.js +71 -0
- package/addon/components/place-panel/details.hbs +9 -19
- package/addon/components/vehicle-form-panel.hbs +67 -7
- package/addon/components/vehicle-form-panel.js +37 -0
- package/addon/components/vehicle-panel/details.hbs +9 -5
- package/addon/components/vehicle-panel.hbs +18 -4
- package/addon/components/vendor-form-panel/create-form.hbs +72 -11
- package/addon/components/vendor-form-panel/edit-form.hbs +1 -1
- package/addon/components/vendor-form-panel.hbs +70 -30
- package/addon/components/vendor-form-panel.js +4 -40
- package/addon/components/vendor-panel/details.hbs +2 -2
- package/addon/components/vendor-panel.hbs +16 -2
- package/addon/controllers/management/contacts/index.js +42 -3
- package/addon/controllers/management/fleets/index.js +12 -23
- package/addon/controllers/management/fuel-reports/index/new.js +1 -1
- package/addon/controllers/management/fuel-reports/index.js +73 -20
- package/addon/controllers/management/issues/index/new.js +2 -2
- package/addon/controllers/management/issues/index.js +65 -45
- package/addon/controllers/management/places/index.js +59 -18
- package/addon/controllers/management/vehicles/index.js +67 -8
- package/addon/controllers/management/vendors/index.js +63 -8
- package/addon/controllers/operations/orders/index.js +42 -1
- package/addon/routes/management/contacts/index.js +8 -0
- package/addon/routes/management/fleets/index.js +8 -2
- package/addon/routes/management/fuel-reports/index.js +6 -0
- package/addon/routes/management/issues/index.js +9 -1
- package/addon/routes/management/places/index.js +11 -1
- package/addon/routes/management/vehicles/index.js +3 -3
- package/addon/routes/management/vendors/index.js +8 -0
- package/addon/routes/operations/scheduler/index.js +1 -1
- package/addon/templates/operations/orders/index.hbs +1 -1
- package/addon/utils/get-issue-categories.js +30 -0
- package/addon/utils/get-issue-types.js +3 -0
- package/addon/utils/get-vendor-status-options.js +3 -0
- package/addon/utils/get-vendor-type-options.js +41 -0
- package/app/utils/get-issue-categories.js +1 -0
- package/app/utils/get-issue-types.js +1 -0
- package/app/utils/get-vendor-categories.js +1 -0
- package/app/utils/get-vendor-status-options.js +1 -0
- package/app/utils/get-vendor-type-options.js +1 -0
- package/app/utils/get-vendor-types.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/migrations/2023_11_09_041807_add_status_column_to_fuel_reports_table.php +32 -0
- package/server/migrations/2023_11_15_062814_add_comments_column_and_resolved_at_column_to_vehicle_device_events_table.php +33 -0
- package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -2
- package/server/src/Http/Controllers/Api/v1/VehicleController.php +2 -2
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +5 -13
- package/server/src/Http/Controllers/Internal/v1/OrderController.php +1 -3
- package/server/src/Http/Filter/ContactFilter.php +10 -0
- package/server/src/Http/Filter/FleetFilter.php +8 -6
- package/server/src/Http/Filter/FuelReportFilter.php +51 -0
- package/server/src/Http/Filter/IssueFilter.php +61 -5
- package/server/src/Http/Filter/PlaceFilter.php +48 -6
- package/server/src/Http/Filter/VehicleFilter.php +21 -6
- package/server/src/Http/Filter/VendorFilter.php +11 -8
- package/server/src/Http/Middleware/TransformLocationMiddleware.php +1 -1
- package/server/src/Http/Resources/Internal/v1/IntegratedVendorFacilitator.php +17 -18
- package/server/src/Http/Resources/v1/Contact.php +16 -19
- package/server/src/Http/Resources/v1/CurrentJob.php +13 -16
- package/server/src/Http/Resources/v1/Driver.php +59 -57
- package/server/src/Http/Resources/v1/Entity.php +30 -33
- package/server/src/Http/Resources/v1/FuelReport.php +16 -14
- package/server/src/Http/Resources/v1/Order.php +1 -1
- package/server/src/Http/Resources/v1/Payload.php +21 -24
- package/server/src/Http/Resources/v1/Place.php +27 -30
- package/server/src/Http/Resources/v1/Proof.php +13 -16
- package/server/src/Http/Resources/v1/PurchaseRate.php +14 -17
- package/server/src/Http/Resources/v1/ServiceArea.php +13 -16
- package/server/src/Http/Resources/v1/ServiceQuote.php +15 -18
- package/server/src/Http/Resources/v1/ServiceRate.php +33 -36
- package/server/src/Http/Resources/v1/ServiceRateFee.php +14 -17
- package/server/src/Http/Resources/v1/ServiceRateParcelFee.php +9 -12
- package/server/src/Http/Resources/v1/TrackingNumber.php +18 -21
- package/server/src/Http/Resources/v1/TrackingStatus.php +18 -21
- package/server/src/Http/Resources/v1/Vehicle.php +31 -34
- package/server/src/Http/Resources/v1/VehicleDevice.php +23 -25
- package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +38 -32
- package/server/src/Http/Resources/v1/Vendor.php +31 -26
- package/server/src/Http/Resources/v1/Zone.php +14 -17
- package/server/src/Models/Driver.php +7 -1
- package/server/src/Models/FuelReport.php +1 -0
- package/server/src/Models/IntegratedVendor.php +6 -1
- package/server/src/Models/Order.php +2 -2
- package/server/src/Models/Place.php +2 -2
- package/server/src/Models/VehicleDeviceEvent.php +1 -0
- package/server/src/Models/Vendor.php +1 -1
- 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
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
21
|
-
$this->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
21
|
-
$this->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
21
|
-
$this->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
22
|
-
$this->
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
21
|
-
$this->
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
19
|
-
$this->
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
}
|