@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
|
@@ -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
|
];
|
|
@@ -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
|
/**
|
|
@@ -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;
|
|
@@ -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
|
}
|