@fleetbase/fleetops-engine 0.3.2 → 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/admin/visibility-controls.js +1 -0
- 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 +10 -1
- package/addon/components/live-map-drawer/driver-listing.hbs +6 -0
- package/addon/components/live-map-drawer/driver-listing.js +240 -0
- package/addon/components/live-map-drawer/place-listing.hbs +6 -0
- package/addon/components/live-map-drawer/place-listing.js +204 -0
- package/addon/components/live-map-drawer/vehicle-listing.hbs +6 -0
- package/addon/components/live-map-drawer/vehicle-listing.js +216 -0
- package/addon/components/live-map-drawer.hbs +17 -0
- package/addon/components/live-map-drawer.js +104 -0
- package/addon/components/live-map.hbs +5 -1
- package/addon/components/live-map.js +107 -15
- package/addon/components/map-container/toolbar.hbs +6 -0
- 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/modals/order-event.hbs +1 -1
- package/addon/components/order/schedule-card.hbs +35 -7
- package/addon/components/order/schedule-card.js +163 -6
- 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 +11 -21
- 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 +70 -15
- package/addon/controllers/operations/scheduler/index.js +45 -30
- 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 +26 -1
- package/addon/styles/fleetops-engine.css +28 -0
- package/addon/templates/operations/orders/index.hbs +2 -2
- package/addon/templates/operations/scheduler/index.hbs +33 -9
- package/addon/utils/create-full-calendar-event-from-order.js +8 -0
- 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/components/live-map-drawer/driver-listing.js +1 -0
- package/app/components/live-map-drawer/place-listing.js +1 -0
- package/app/components/live-map-drawer/vehicle-listing.js +1 -0
- package/app/components/live-map-drawer.js +1 -0
- package/app/utils/create-full-calendar-event-from-order.js +1 -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 +2 -1
- package/server/src/Models/IntegratedVendor.php +6 -1
- package/server/src/Models/Order.php +24 -2
- package/server/src/Models/Place.php +2 -2
- package/server/src/Models/VehicleDevice.php +1 -1
- package/server/src/Models/VehicleDeviceEvent.php +2 -1
- package/server/src/Models/Vendor.php +1 -1
- package/server/src/Observers/DriverObserver.php +15 -0
- package/server/src/Observers/FleetObserver.php +19 -0
- package/server/src/Providers/FleetOpsServiceProvider.php +1 -0
- package/addon/components/full-calendar/draggable.js +0 -1
- package/addon/components/full-calendar.js +0 -1
- package/app/components/full-calendar/draggable.js +0 -1
- package/app/components/full-calendar.js +0 -1
|
@@ -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
|
}
|
|
@@ -4,6 +4,7 @@ namespace Fleetbase\FleetOps\Http\Resources\v1;
|
|
|
4
4
|
|
|
5
5
|
use Fleetbase\Http\Resources\FleetbaseResource;
|
|
6
6
|
use Fleetbase\Support\Http;
|
|
7
|
+
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
7
8
|
|
|
8
9
|
class VehicleWithoutDriver extends FleetbaseResource
|
|
9
10
|
{
|
|
@@ -16,30 +17,35 @@ class VehicleWithoutDriver extends FleetbaseResource
|
|
|
16
17
|
*/
|
|
17
18
|
public function toArray($request)
|
|
18
19
|
{
|
|
19
|
-
return
|
|
20
|
-
$this->
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
+
'internal_id' => $this->internal_id,
|
|
25
|
+
'name' => $this->display_name,
|
|
26
|
+
'display_name' => $this->when(Http::isInternalRequest(), $this->display_name),
|
|
27
|
+
'vin' => $this->vin ?? null,
|
|
28
|
+
'devices' => $this->whenLoaded('devices', $this->devices),
|
|
29
|
+
'photo_url' => $this->photo_url,
|
|
30
|
+
'avatar_url' => $this->avatar_url,
|
|
31
|
+
'make' => $this->make,
|
|
32
|
+
'model' => $this->model,
|
|
33
|
+
'year' => $this->year,
|
|
34
|
+
'trim' => $this->trim,
|
|
35
|
+
'type' => $this->type,
|
|
36
|
+
'plate_number' => $this->plate_number,
|
|
37
|
+
'vin' => $this->vin,
|
|
38
|
+
'vin_data' => $this->vin_data,
|
|
39
|
+
'status' => $this->status,
|
|
40
|
+
'online' => $this->online,
|
|
41
|
+
'location' => data_get($this, 'location', new Point(0, 0)),
|
|
42
|
+
'heading' => (int) data_get($this, 'heading', 0),
|
|
43
|
+
'altitude' => (int) data_get($this, 'altitude', 0),
|
|
44
|
+
'speed' => (int) data_get($this, 'speed', 0),
|
|
45
|
+
'meta' => data_get($this, 'meta', []),
|
|
46
|
+
'updated_at' => $this->updated_at,
|
|
47
|
+
'created_at' => $this->created_at,
|
|
48
|
+
];
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
/**
|
|
@@ -53,14 +59,14 @@ class VehicleWithoutDriver extends FleetbaseResource
|
|
|
53
59
|
'id' => $this->public_id,
|
|
54
60
|
'internal_id' => $this->internal_id,
|
|
55
61
|
'name' => $this->name,
|
|
56
|
-
'vin' => $this
|
|
57
|
-
'photo' => $this
|
|
58
|
-
'make' => $this
|
|
59
|
-
'model' => $this
|
|
60
|
-
'year' => $this
|
|
61
|
-
'trim' => $this
|
|
62
|
-
'type' => $this
|
|
63
|
-
'plate_number' => $this
|
|
62
|
+
'vin' => data_get($this, 'vin'),
|
|
63
|
+
'photo' => data_get($this, 'photoUrl'),
|
|
64
|
+
'make' => data_get($this, 'make'),
|
|
65
|
+
'model' => data_get($this, 'model'),
|
|
66
|
+
'year' => data_get($this, 'year'),
|
|
67
|
+
'trim' => data_get($this, 'trim'),
|
|
68
|
+
'type' => data_get($this, 'type'),
|
|
69
|
+
'plate_number' => data_get($this, 'plate_number'),
|
|
64
70
|
'vin_data' => $this->vin_data,
|
|
65
71
|
'status' => $this->status,
|
|
66
72
|
'online' => $this->online,
|
|
@@ -17,32 +17,33 @@ class Vendor 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
|
-
|
|
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
|
+
'place_uuid' => $this->when(Http::isInternalRequest(), $this->place_uuid),
|
|
25
|
+
'connect_company_uuid' => $this->when(Http::isInternalRequest(), $this->connect_company_uuid),
|
|
26
|
+
'logo_uuid' => $this->when(Http::isInternalRequest(), $this->logo_uuid),
|
|
27
|
+
'type_uuid' => $this->when(Http::isInternalRequest(), $this->type_uuid),
|
|
28
|
+
'internal_id' => $this->internal_id,
|
|
29
|
+
'business_id' => $this->business_id,
|
|
30
|
+
'name' => $this->name,
|
|
31
|
+
'email' => $this->email,
|
|
32
|
+
'phone' => $this->phone,
|
|
33
|
+
'logo_url' => $this->logo_url,
|
|
34
|
+
'photo_url' => Utils::or($this, ['logo_url', 'photo_url']),
|
|
35
|
+
'place' => $this->whenLoaded('place', new Place($this->place)),
|
|
36
|
+
'address' => $this->when(Http::isInternalRequest(), data_get($this, 'place.address')),
|
|
37
|
+
'address_street' => $this->when(Http::isInternalRequest(), data_get($this, 'place.street1')),
|
|
38
|
+
'country' => $this->country,
|
|
39
|
+
'type' => $this->type,
|
|
40
|
+
'meta' => $this->meta ?? [],
|
|
41
|
+
'status' => $this->status,
|
|
42
|
+
'slug' => $this->slug,
|
|
43
|
+
'updated_at' => $this->updated_at,
|
|
44
|
+
'created_at' => $this->created_at,
|
|
45
|
+
'website_url' => $this->website_url,
|
|
46
|
+
];
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
/**
|
|
@@ -58,15 +59,19 @@ class Vendor extends FleetbaseResource
|
|
|
58
59
|
'name' => $this->name,
|
|
59
60
|
'email' => $this->email,
|
|
60
61
|
'phone' => $this->phone,
|
|
62
|
+
'logo_url' => $this->logo_url,
|
|
61
63
|
'photo_url' => Utils::or($this, ['logo_url', 'photo_url']),
|
|
62
64
|
'place' => $this->whenLoaded('place', new Place($this->place)),
|
|
63
65
|
'address' => data_get($this, 'place.address'),
|
|
64
66
|
'address_street' => data_get($this, 'place.street1'),
|
|
67
|
+
'country' => $this->country,
|
|
65
68
|
'type' => $this->type,
|
|
66
69
|
'meta' => $this->meta ?? [],
|
|
70
|
+
'status' => $this->status,
|
|
67
71
|
'slug' => $this->slug,
|
|
68
72
|
'updated_at' => $this->updated_at,
|
|
69
73
|
'created_at' => $this->created_at,
|
|
74
|
+
'website_url' => $this->website_url,
|
|
70
75
|
];
|
|
71
76
|
}
|
|
72
77
|
}
|
|
@@ -18,23 +18,20 @@ class Zone 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
|
-
'created_at' => $this->created_at,
|
|
36
|
-
]
|
|
37
|
-
);
|
|
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
|
+
'name' => $this->name,
|
|
26
|
+
'description' => $this->description,
|
|
27
|
+
'coordinates' => $this->when($this->border instanceof Polygon, Utils::getCoordinatesFromPolygon($this->border), []),
|
|
28
|
+
'border' => $this->border,
|
|
29
|
+
'color' => $this->color,
|
|
30
|
+
'stroke_color' => $this->stroke_color,
|
|
31
|
+
'status' => $this->status,
|
|
32
|
+
'updated_at' => $this->updated_at,
|
|
33
|
+
'created_at' => $this->created_at,
|
|
34
|
+
];
|
|
38
35
|
}
|
|
39
36
|
|
|
40
37
|
/**
|
|
@@ -88,6 +88,13 @@ class Driver extends Model
|
|
|
88
88
|
'status',
|
|
89
89
|
];
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* The attributes that are guarded and not mass assignable.
|
|
93
|
+
*
|
|
94
|
+
* @var array
|
|
95
|
+
*/
|
|
96
|
+
protected $guarded = [];
|
|
97
|
+
|
|
91
98
|
/**
|
|
92
99
|
* The attributes that are spatial columns.
|
|
93
100
|
*
|
|
@@ -101,7 +108,6 @@ class Driver extends Model
|
|
|
101
108
|
* @var array
|
|
102
109
|
*/
|
|
103
110
|
protected $casts = [
|
|
104
|
-
'meta' => Json::class,
|
|
105
111
|
'location' => Point::class,
|
|
106
112
|
'online' => 'boolean',
|
|
107
113
|
];
|
|
@@ -61,6 +61,7 @@ class FuelReport extends Model
|
|
|
61
61
|
'volume',
|
|
62
62
|
'metric_unit',
|
|
63
63
|
'meta',
|
|
64
|
+
'status',
|
|
64
65
|
];
|
|
65
66
|
|
|
66
67
|
/**
|
|
@@ -99,7 +100,7 @@ class FuelReport extends Model
|
|
|
99
100
|
*
|
|
100
101
|
* @var array
|
|
101
102
|
*/
|
|
102
|
-
protected $filterParams = ['type', 'reporter'];
|
|
103
|
+
protected $filterParams = ['type', 'status', 'reporter'];
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
106
|
* Set the parcel fee as only numbers.
|
|
@@ -69,7 +69,7 @@ class IntegratedVendor extends Model
|
|
|
69
69
|
*
|
|
70
70
|
* @var array
|
|
71
71
|
*/
|
|
72
|
-
protected $appends = ['name', 'status', 'type', 'photo_url', 'service_types', 'supported_countries', 'provider_settings'];
|
|
72
|
+
protected $appends = ['name', 'status', 'type', 'photo_url', 'logo_url', 'service_types', 'supported_countries', 'provider_settings'];
|
|
73
73
|
|
|
74
74
|
/**
|
|
75
75
|
* The attributes excluded from the model's JSON form.
|
|
@@ -207,6 +207,11 @@ class IntegratedVendor extends Model
|
|
|
207
207
|
return $this->provider()->getLogo();
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
public function getLogoUrlAttribute()
|
|
211
|
+
{
|
|
212
|
+
return $this->provider()->getLogo();
|
|
213
|
+
}
|
|
214
|
+
|
|
210
215
|
public function getStatusAttribute()
|
|
211
216
|
{
|
|
212
217
|
return 'active';
|
|
@@ -312,7 +312,7 @@ class Order extends Model
|
|
|
312
312
|
*/
|
|
313
313
|
public function driverAssigned()
|
|
314
314
|
{
|
|
315
|
-
return $this->belongsTo(Driver::class)->without(['devices', '
|
|
315
|
+
return $this->belongsTo(Driver::class)->without(['devices', 'vendor']);
|
|
316
316
|
}
|
|
317
317
|
|
|
318
318
|
/**
|
|
@@ -320,7 +320,7 @@ class Order extends Model
|
|
|
320
320
|
*/
|
|
321
321
|
public function driver()
|
|
322
322
|
{
|
|
323
|
-
return $this->belongsTo(Driver::class)->without(['devices', '
|
|
323
|
+
return $this->belongsTo(Driver::class)->without(['devices', 'vendor']);
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
/**
|
|
@@ -947,6 +947,28 @@ class Order extends Model
|
|
|
947
947
|
$this->customer_type = Utils::getModelClassName($model);
|
|
948
948
|
}
|
|
949
949
|
|
|
950
|
+
public function setCustomerTypeAttribute($type)
|
|
951
|
+
{
|
|
952
|
+
if (is_string($type)) {
|
|
953
|
+
if ($type === 'customer' || $type === 'vendor' || !Str::startsWith($type, 'fleet-ops')) {
|
|
954
|
+
$type = 'fleet-ops:' . $type;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
$this->attributes['customer_type'] = Utils::getMutationType($type);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
public function setFacilitatorTypeAttribute($type)
|
|
962
|
+
{
|
|
963
|
+
if (is_string($type)) {
|
|
964
|
+
if ($type === 'customer' || $type === 'vendor' || !Str::startsWith($type, 'fleet-ops')) {
|
|
965
|
+
$type = 'fleet-ops:' . $type;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
$this->attributes['facilitator_type'] = Utils::getMutationType($type);
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
950
972
|
public function setDriverLocationAsPickup($force = false)
|
|
951
973
|
{
|
|
952
974
|
if ($force === true) {
|
|
@@ -213,7 +213,7 @@ class Place extends Model
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
if (empty($this->country) && $address) {
|
|
216
|
-
$this->setAttribute('country', $address->getCountry()->getCode());
|
|
216
|
+
$this->setAttribute('country', $address->getCountry() instanceof \Geocoder\Model\Country ? $address->getCountry()->getCode() : null);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
if ($coordinates = $address->getCoordinates()) {
|
|
@@ -243,7 +243,7 @@ class Place extends Model
|
|
|
243
243
|
$attributes['neighborhood'] = $address->getNeighborhood();
|
|
244
244
|
$attributes['city'] = $address->getLocality();
|
|
245
245
|
$attributes['building'] = $address->getStreetNumber();
|
|
246
|
-
$attributes['country'] = $address->getCountry()->getCode();
|
|
246
|
+
$attributes['country'] = $address->getCountry() instanceof \Geocoder\Model\Country ? $address->getCountry()->getCode() : null;
|
|
247
247
|
$attributes['location'] = new \Grimzy\LaravelMysqlSpatial\Types\Point($coordinates->getLatitude(), $coordinates->getLongitude());
|
|
248
248
|
|
|
249
249
|
return $attributes;
|
|
@@ -44,6 +44,7 @@ class VehicleDeviceEvent extends Model
|
|
|
44
44
|
'state',
|
|
45
45
|
'code',
|
|
46
46
|
'reason',
|
|
47
|
+
'comment'
|
|
47
48
|
];
|
|
48
49
|
/**
|
|
49
50
|
* The attributes that should be cast to native types.
|
|
@@ -89,6 +90,6 @@ class VehicleDeviceEvent extends Model
|
|
|
89
90
|
*/
|
|
90
91
|
public function device()
|
|
91
92
|
{
|
|
92
|
-
return $this->belongsTo(VehicleDevice::class);
|
|
93
|
+
return $this->belongsTo(VehicleDevice::class, 'vehicle_device_uuid');
|
|
93
94
|
}
|
|
94
95
|
}
|
|
@@ -72,7 +72,7 @@ class Vendor extends Model
|
|
|
72
72
|
*
|
|
73
73
|
* @var array
|
|
74
74
|
*/
|
|
75
|
-
protected $searchableColumns = ['name', 'email', 'business_id', '
|
|
75
|
+
protected $searchableColumns = ['name', 'email', 'business_id', 'connectCompany.name'];
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Dynamic attributes that are appended to object.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
namespace Fleetbase\FleetOps\Observers;
|
|
4
4
|
|
|
5
5
|
use Fleetbase\FleetOps\Models\Driver;
|
|
6
|
+
use Fleetbase\FleetOps\Models\Order;
|
|
6
7
|
use Fleetbase\Models\User;
|
|
7
8
|
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
8
9
|
|
|
@@ -21,6 +22,17 @@ class DriverObserver
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Handle the Driver "deleting" event.
|
|
27
|
+
*
|
|
28
|
+
* @return void
|
|
29
|
+
*/
|
|
30
|
+
public function deleting(Driver $driver)
|
|
31
|
+
{
|
|
32
|
+
// unassign the vehicle from the driver
|
|
33
|
+
$driver->vehicle_uuid = null;
|
|
34
|
+
}
|
|
35
|
+
|
|
24
36
|
/**
|
|
25
37
|
* Handle the Driver "deleted" event.
|
|
26
38
|
*
|
|
@@ -30,5 +42,8 @@ class DriverObserver
|
|
|
30
42
|
{
|
|
31
43
|
// if the driver is deleted, delete their user account assosciated as well
|
|
32
44
|
User::where(['uuid' => $driver->user_uuid, 'type' => 'driver'])->delete();
|
|
45
|
+
|
|
46
|
+
// also unassign them from any order they are assigned to
|
|
47
|
+
Order::where(['driver_assigned_uui' => $driver->uuid])->update(['driver_assigned_uui' => null]);
|
|
33
48
|
}
|
|
34
49
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Observers;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Fleet;
|
|
6
|
+
|
|
7
|
+
class FleetObserver
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Handle the Driver "deleted" event.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function deleted(Fleet $fleet)
|
|
15
|
+
{
|
|
16
|
+
// If the fleet being deleted is set as parent fleet, remove it as the parent fleet
|
|
17
|
+
$subFleets = Fleet::where(['parent_fleet_uuid' => $fleet->uuid])->update(['parent_fleet_uuid' => null]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -31,6 +31,7 @@ class FleetOpsServiceProvider extends CoreServiceProvider
|
|
|
31
31
|
\Fleetbase\FleetOps\Models\TrackingNumber::class => \Fleetbase\FleetOps\Observers\TrackingNumberObserver::class,
|
|
32
32
|
\Fleetbase\FleetOps\Models\Driver::class => \Fleetbase\FleetOps\Observers\DriverObserver::class,
|
|
33
33
|
\Fleetbase\FleetOps\Models\Vehicle::class => \Fleetbase\FleetOps\Observers\VehicleObserver::class,
|
|
34
|
+
\Fleetbase\FleetOps\Models\Fleet::class => \Fleetbase\FleetOps\Observers\FleetObserver::class,
|
|
34
35
|
\Fleetbase\Models\User::class => \Fleetbase\FleetOps\Observers\UserObserver::class,
|
|
35
36
|
];
|
|
36
37
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/console/components/full-calendar/draggable';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/console/components/full-calendar';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/components/full-calendar/draggable';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/components/full-calendar';
|