@fleetbase/fleetops-engine 0.3.4 → 0.3.5
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/fleet-listing-panel.hbs +2 -2
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.hbs +1 -0
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.js +3 -0
- package/addon/components/layout/fleet-ops-sidebar.hbs +4 -4
- package/addon/components/layout/fleet-ops-sidebar.js +2 -0
- package/addon/controllers/management/contacts/index.js +7 -0
- package/addon/controllers/management/drivers/index.js +7 -0
- package/addon/controllers/management/fleets/index.js +7 -0
- package/addon/controllers/management/fuel-reports/index.js +7 -0
- package/addon/controllers/management/issues/index.js +7 -0
- package/addon/controllers/management/places/index.js +6 -0
- package/addon/controllers/management/vehicles/index.js +13 -20
- package/addon/controllers/management/vendors/index.js +7 -0
- package/addon/controllers/operations/service-rates/index.js +7 -0
- package/addon/routes/management/vehicles/index.js +2 -2
- package/addon/templates/management/contacts/index.hbs +1 -0
- package/addon/templates/management/drivers/index.hbs +2 -1
- package/addon/templates/management/fleets/index.hbs +23 -3
- package/addon/templates/management/fuel-reports/index.hbs +1 -0
- package/addon/templates/management/issues/index.hbs +22 -2
- package/addon/templates/management/places/index.hbs +9 -1
- package/addon/templates/management/vehicles/index.hbs +22 -2
- package/addon/templates/management/vendors/index.hbs +22 -2
- package/addon/templates/operations/service-rates/index.hbs +11 -3
- package/app/components/layout/fleet-ops-sidebar/fleet-listing.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +3 -3
- package/server/migrations/2023_04_27_053456_create_contacts_table.php +2 -2
- package/server/migrations/2023_04_27_053456_create_drivers_table.php +5 -5
- package/server/migrations/2023_04_27_053456_create_entities_table.php +5 -5
- package/server/migrations/2023_04_27_053456_create_fleet_drivers_table.php +2 -2
- package/server/migrations/2023_04_27_053456_create_fleets_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_fuel_reports_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_issues_table.php +4 -4
- package/server/migrations/2023_04_27_053456_create_orders_table.php +8 -8
- package/server/migrations/2023_04_27_053456_create_payloads_table.php +5 -5
- package/server/migrations/2023_04_27_053456_create_places_table.php +1 -1
- package/server/migrations/2023_04_27_053456_create_purchase_rates_table.php +4 -4
- package/server/migrations/2023_04_27_053456_create_service_areas_table.php +2 -2
- package/server/migrations/2023_04_27_053456_create_service_quote_items_table.php +1 -1
- package/server/migrations/2023_04_27_053456_create_service_quotes_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_service_rate_fees_table.php +1 -1
- package/server/migrations/2023_04_27_053456_create_service_rate_parcel_fees_table.php +1 -1
- package/server/migrations/2023_04_27_053456_create_service_rates_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_tracking_numbers_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_tracking_statuses_table.php +2 -2
- package/server/migrations/2023_04_27_053456_create_vehicles_table.php +3 -3
- package/server/migrations/2023_04_27_053456_create_vendors_table.php +5 -5
- package/server/migrations/2023_04_27_053456_create_waypoints_table.php +4 -4
- package/server/migrations/2023_04_27_053456_create_zones_table.php +2 -2
- package/server/migrations/2023_11_17_053001_add_category_uuid_to_entities_table.php +33 -0
- package/server/src/Http/Controllers/Api/v1/EntityController.php +2 -0
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +0 -1
- package/server/src/Http/Resources/v1/Fleet.php +19 -17
- package/server/src/Models/Driver.php +16 -0
- package/server/src/Models/Entity.php +18 -23
- package/server/src/Models/Vehicle.php +4 -2
- package/server/src/Models/VehicleDeviceEvent.php +1 -1
|
@@ -19,10 +19,10 @@ return new class extends Migration
|
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
21
|
$table->string('issue_id', 191)->nullable()->unique();
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
24
|
-
$table->
|
|
25
|
-
$table->
|
|
22
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
23
|
+
$table->uuid('driver_uuid')->nullable()->index('issues_driver_uuid_foreign');
|
|
24
|
+
$table->uuid('vehicle_uuid')->nullable()->index('issues_vehicle_uuid_foreign');
|
|
25
|
+
$table->uuid('assigned_to_uuid')->nullable()->index('issues_assigned_to_uuid_foreign');
|
|
26
26
|
$table->string('odometer')->nullable();
|
|
27
27
|
$table->point('location');
|
|
28
28
|
$table->string('latitude')->nullable();
|
|
@@ -18,21 +18,21 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->unique();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
22
|
$table->char('created_by_uuid', 36)->nullable()->index();
|
|
23
23
|
$table->char('updated_by_uuid', 36)->nullable()->index();
|
|
24
24
|
$table->string('internal_id')->nullable();
|
|
25
|
-
$table->
|
|
25
|
+
$table->uuid('customer_uuid')->nullable()->index();
|
|
26
26
|
$table->string('customer_type')->nullable();
|
|
27
27
|
$table->string('facilitator_uuid')->nullable();
|
|
28
28
|
$table->string('facilitator_type')->nullable();
|
|
29
|
-
$table->
|
|
30
|
-
$table->
|
|
29
|
+
$table->uuid('session_uuid')->nullable()->index('orders_session_uuid_foreign');
|
|
30
|
+
$table->uuid('payload_uuid')->nullable()->index('orders_payload_uuid_foreign');
|
|
31
31
|
$table->char('route_uuid', 36)->nullable()->index('orders_route_uuid_foreign');
|
|
32
|
-
$table->
|
|
33
|
-
$table->
|
|
34
|
-
$table->
|
|
35
|
-
$table->
|
|
32
|
+
$table->uuid('transaction_uuid')->nullable()->index('orders_transaction_uuid_foreign');
|
|
33
|
+
$table->uuid('purchase_rate_uuid')->nullable()->index('orders_purchase_rate_uuid_foreign');
|
|
34
|
+
$table->uuid('tracking_number_uuid')->nullable()->index('orders_tracking_number_uuid_foreign');
|
|
35
|
+
$table->uuid('driver_assigned_uuid')->nullable()->index('orders_driver_assigned_uuid_foreign');
|
|
36
36
|
$table->json('meta')->nullable();
|
|
37
37
|
$table->json('options')->nullable();
|
|
38
38
|
$table->boolean('dispatched')->default(false);
|
|
@@ -18,11 +18,11 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->index();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
24
|
-
$table->
|
|
25
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
|
+
$table->uuid('pickup_uuid')->nullable()->index('payloads_from_place_uuid_index');
|
|
23
|
+
$table->uuid('dropoff_uuid')->nullable()->index('payloads_to_place_uuid_index');
|
|
24
|
+
$table->uuid('return_uuid')->nullable()->index('payloads_return_uuid_foreign');
|
|
25
|
+
$table->uuid('current_waypoint_uuid')->nullable()->index();
|
|
26
26
|
$table->string('provider', 191)->nullable()->index();
|
|
27
27
|
$table->string('payment_method')->nullable();
|
|
28
28
|
$table->integer('cod_amount')->nullable();
|
|
@@ -19,7 +19,7 @@ return new class extends Migration
|
|
|
19
19
|
$table->string('uuid', 191)->nullable()->unique();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
21
|
$table->string('_import_id', 191)->nullable()->index();
|
|
22
|
-
$table->
|
|
22
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
23
23
|
$table->char('owner_uuid', 36)->nullable()->index();
|
|
24
24
|
$table->string('owner_type')->nullable();
|
|
25
25
|
$table->string('name')->nullable();
|
|
@@ -21,10 +21,10 @@ return new class extends Migration
|
|
|
21
21
|
$table->json('meta')->nullable();
|
|
22
22
|
$table->string('customer_uuid')->nullable();
|
|
23
23
|
$table->string('customer_type')->nullable();
|
|
24
|
-
$table->
|
|
25
|
-
$table->
|
|
26
|
-
$table->
|
|
27
|
-
$table->
|
|
24
|
+
$table->uuid('company_uuid')->nullable()->index('purchase_rates_company_uuid_foreign');
|
|
25
|
+
$table->uuid('transaction_uuid')->nullable()->index('purchase_rates_transaction_uuid_foreign');
|
|
26
|
+
$table->uuid('service_quote_uuid')->nullable()->index('purchase_rates_service_quote_uuid_foreign');
|
|
27
|
+
$table->uuid('payload_uuid')->nullable()->index('purchase_rates_payload_uuid_foreign');
|
|
28
28
|
$table->string('status')->nullable();
|
|
29
29
|
$table->softDeletes();
|
|
30
30
|
$table->timestamp('created_at')->nullable()->index();
|
|
@@ -18,14 +18,14 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index('service_areas_company_uuid_foreign');
|
|
22
22
|
$table->string('name')->nullable();
|
|
23
23
|
$table->string('type')->nullable();
|
|
24
24
|
$table->string('country')->nullable();
|
|
25
25
|
$table->multiPolygon('border')->nullable();
|
|
26
26
|
$table->string('color')->nullable();
|
|
27
27
|
$table->string('stroke_color')->nullable();
|
|
28
|
-
$table->
|
|
28
|
+
$table->uuid('parent_uuid')->nullable()->index('service_areas_parent_uuid_foreign');
|
|
29
29
|
$table->string('status')->nullable();
|
|
30
30
|
$table->softDeletes();
|
|
31
31
|
$table->timestamp('created_at')->nullable()->index();
|
|
@@ -17,7 +17,7 @@ return new class extends Migration
|
|
|
17
17
|
$table->increments('id');
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
|
-
$table->
|
|
20
|
+
$table->uuid('service_quote_uuid')->nullable()->index();
|
|
21
21
|
$table->string('amount')->nullable();
|
|
22
22
|
$table->string('currency')->nullable();
|
|
23
23
|
$table->string('details')->nullable();
|
|
@@ -19,9 +19,9 @@ return new class extends Migration
|
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
21
|
$table->string('request_id', 191)->nullable()->index('service_quotes_request_id_foreign');
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
24
|
-
$table->
|
|
22
|
+
$table->uuid('company_uuid')->nullable()->index('service_quotes_company_uuid_foreign');
|
|
23
|
+
$table->uuid('payload_uuid')->nullable()->index('service_quotes_payload_uuid_foreign');
|
|
24
|
+
$table->uuid('service_rate_uuid')->nullable()->index();
|
|
25
25
|
$table->integer('amount')->nullable();
|
|
26
26
|
$table->string('currency')->nullable();
|
|
27
27
|
$table->json('meta')->nullable();
|
|
@@ -17,7 +17,7 @@ return new class extends Migration
|
|
|
17
17
|
$table->increments('id');
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
|
-
$table->
|
|
20
|
+
$table->uuid('service_rate_uuid')->nullable()->index();
|
|
21
21
|
$table->integer('distance')->nullable();
|
|
22
22
|
$table->integer('min')->nullable();
|
|
23
23
|
$table->integer('max')->nullable();
|
|
@@ -17,7 +17,7 @@ return new class extends Migration
|
|
|
17
17
|
$table->increments('id');
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
|
-
$table->
|
|
20
|
+
$table->uuid('service_rate_uuid')->nullable()->index();
|
|
21
21
|
$table->string('size')->nullable();
|
|
22
22
|
$table->string('length')->nullable();
|
|
23
23
|
$table->string('width')->nullable();
|
|
@@ -18,9 +18,9 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
|
+
$table->uuid('service_area_uuid')->nullable()->index();
|
|
23
|
+
$table->uuid('zone_uuid')->nullable()->index();
|
|
24
24
|
$table->string('service_name')->nullable();
|
|
25
25
|
$table->string('service_type', 191)->nullable()->index();
|
|
26
26
|
$table->integer('base_fee')->default(0)->nullable();
|
|
@@ -18,10 +18,10 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
|
+
$table->uuid('owner_uuid')->nullable()->index('tracking_numbers_owner_uuid_foreign');
|
|
23
23
|
$table->string('owner_type')->nullable();
|
|
24
|
-
$table->
|
|
24
|
+
$table->uuid('status_uuid')->nullable()->index('tracking_numbers_status_uuid_foreign');
|
|
25
25
|
$table->string('tracking_number', 191)->nullable()->index();
|
|
26
26
|
$table->string('region')->nullable();
|
|
27
27
|
$table->mediumText('qr_code')->nullable();
|
|
@@ -18,8 +18,8 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->index();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index('tracking_statuses_company_uuid_foreign');
|
|
22
|
+
$table->uuid('tracking_number_uuid')->nullable()->index('tracking_statuses_tracking_number_uuid_foreign');
|
|
23
23
|
$table->char('proof_uuid', 36)->nullable();
|
|
24
24
|
$table->json('meta')->nullable();
|
|
25
25
|
$table->string('status', 191)->nullable()->index();
|
|
@@ -18,9 +18,9 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->index();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
|
+
$table->uuid('vendor_uuid')->nullable()->index('vehicles_vendor_uuid_foreign');
|
|
23
|
+
$table->uuid('photo_uuid')->nullable()->index('vehicles_photo_uuid_foreign');
|
|
24
24
|
$table->string('avatar_url', 300)->nullable();
|
|
25
25
|
$table->string('make', 191)->nullable()->index();
|
|
26
26
|
$table->string('model', 191)->nullable()->index();
|
|
@@ -18,11 +18,11 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
24
|
-
$table->
|
|
25
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index();
|
|
22
|
+
$table->uuid('place_uuid')->nullable()->index('vendors_place_uuid_foreign');
|
|
23
|
+
$table->uuid('type_uuid')->nullable()->index('vendors_type_uuid_foreign');
|
|
24
|
+
$table->uuid('connect_company_uuid')->nullable()->index('vendors_connect_company_uuid_foreign');
|
|
25
|
+
$table->uuid('logo_uuid')->nullable()->index('vendors_logo_uuid_foreign');
|
|
26
26
|
$table->string('name')->nullable();
|
|
27
27
|
$table->string('internal_id', 191)->nullable()->index();
|
|
28
28
|
$table->string('business_id')->nullable();
|
|
@@ -18,10 +18,10 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id')->nullable();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
23
|
-
$table->
|
|
24
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index('waypoints_company_uuid_foreign');
|
|
22
|
+
$table->uuid('place_uuid')->nullable()->index('waypoints_place_uuid_foreign');
|
|
23
|
+
$table->uuid('payload_uuid')->nullable()->index('waypoints_payload_uuid_foreign');
|
|
24
|
+
$table->uuid('tracking_number_uuid')->nullable()->index();
|
|
25
25
|
$table->string('_import_id', 191)->nullable()->index();
|
|
26
26
|
$table->string('type')->nullable();
|
|
27
27
|
$table->integer('order')->nullable();
|
|
@@ -18,8 +18,8 @@ return new class extends Migration
|
|
|
18
18
|
$table->string('_key')->nullable();
|
|
19
19
|
$table->string('uuid', 191)->nullable()->index();
|
|
20
20
|
$table->string('public_id', 191)->nullable()->unique();
|
|
21
|
-
$table->
|
|
22
|
-
$table->
|
|
21
|
+
$table->uuid('company_uuid')->nullable()->index('zones_company_uuid_foreign');
|
|
22
|
+
$table->uuid('service_area_uuid')->nullable()->index();
|
|
23
23
|
$table->string('name')->nullable();
|
|
24
24
|
$table->mediumText('description')->nullable();
|
|
25
25
|
$table->polygon('border')->nullable();
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Database\Schema\Blueprint;
|
|
5
|
+
use Illuminate\Support\Facades\Schema;
|
|
6
|
+
|
|
7
|
+
class AddCategoryUuidToEntitiesTable extends Migration
|
|
8
|
+
{
|
|
9
|
+
/**
|
|
10
|
+
* Run the migrations.
|
|
11
|
+
*
|
|
12
|
+
* @return void
|
|
13
|
+
*/
|
|
14
|
+
public function up()
|
|
15
|
+
{
|
|
16
|
+
Schema::table('entities', function (Blueprint $table) {
|
|
17
|
+
$table->foreignUuid('category_uuid')->nullable()->after('photo_uuid')->references('uuid')->on('categories');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Reverse the migrations.
|
|
23
|
+
*
|
|
24
|
+
* @return void
|
|
25
|
+
*/
|
|
26
|
+
public function down()
|
|
27
|
+
{
|
|
28
|
+
Schema::table('entities', function (Blueprint $table) {
|
|
29
|
+
$table->dropForeign(['category_uuid']);
|
|
30
|
+
$table->dropColumn(['category_uuid']);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -41,6 +41,7 @@ class EntityController extends Controller
|
|
|
41
41
|
'sku',
|
|
42
42
|
'currency',
|
|
43
43
|
'meta',
|
|
44
|
+
'supplier_uuid',
|
|
44
45
|
]);
|
|
45
46
|
|
|
46
47
|
// payload assignment
|
|
@@ -126,6 +127,7 @@ class EntityController extends Controller
|
|
|
126
127
|
'sku',
|
|
127
128
|
'currency',
|
|
128
129
|
'meta',
|
|
130
|
+
'supplier_uuid',
|
|
129
131
|
]);
|
|
130
132
|
|
|
131
133
|
// payload assignment
|
|
@@ -13,7 +13,6 @@ use Fleetbase\Http\Requests\ExportRequest;
|
|
|
13
13
|
use Fleetbase\Models\Invite;
|
|
14
14
|
use Fleetbase\Models\User;
|
|
15
15
|
use Fleetbase\Notifications\UserInvited;
|
|
16
|
-
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
17
16
|
use Illuminate\Http\Request;
|
|
18
17
|
use Illuminate\Support\Facades\DB;
|
|
19
18
|
use Illuminate\Support\Facades\Validator;
|
|
@@ -17,23 +17,25 @@ class Fleet extends FleetbaseResource
|
|
|
17
17
|
public function toArray($request)
|
|
18
18
|
{
|
|
19
19
|
return [
|
|
20
|
-
'id'
|
|
21
|
-
'uuid'
|
|
22
|
-
'public_id'
|
|
23
|
-
'name'
|
|
24
|
-
'task'
|
|
25
|
-
'status'
|
|
26
|
-
'drivers_count'
|
|
27
|
-
'drivers_online_count'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
33
|
-
'
|
|
34
|
-
'
|
|
35
|
-
'
|
|
36
|
-
'
|
|
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
|
+
'task' => $this->task ?? null,
|
|
25
|
+
'status' => $this->status ?? null,
|
|
26
|
+
'drivers_count' => $this->when(Http::isInternalRequest(), $this->drivers_count),
|
|
27
|
+
'drivers_online_count' => $this->when(Http::isInternalRequest(), $this->drivers_online_count),
|
|
28
|
+
'vehicles_count' => $this->when(Http::isInternalRequest(), $this->vehicles_count),
|
|
29
|
+
'vehicles_online_count' => $this->when(Http::isInternalRequest(), $this->vehicles_online_count),
|
|
30
|
+
'service_area' => $this->whenLoaded('serviceArea', new ServiceArea($this->serviceArea)),
|
|
31
|
+
'zone' => $this->whenLoaded('zone', new Zone($this->zone)),
|
|
32
|
+
'vendor' => $this->whenLoaded('vendor', new Vendor($this->vendor)),
|
|
33
|
+
'parent_fleet' => $this->whenLoaded('parentFleet', new ParentFleet($this->parentFleet)),
|
|
34
|
+
'subfleets' => $this->whenLoaded('subFleets', SubFleet::collection($this->subFleets)),
|
|
35
|
+
'drivers' => $this->whenLoaded('drivers', Driver::collection($this->drivers()->without(['driverAssigned'])->with(Http::isInternalRequest() ? ['jobs'] : [])->get())),
|
|
36
|
+
'vehicles' => $this->whenLoaded('vehicles', Vehicle::collection($this->vehicles)),
|
|
37
|
+
'updated_at' => $this->updated_at,
|
|
38
|
+
'created_at' => $this->created_at,
|
|
37
39
|
];
|
|
38
40
|
}
|
|
39
41
|
|
|
@@ -18,6 +18,7 @@ use Grimzy\LaravelMysqlSpatial\Eloquent\SpatialTrait;
|
|
|
18
18
|
use Illuminate\Broadcasting\Channel;
|
|
19
19
|
use Illuminate\Notifications\Notifiable;
|
|
20
20
|
use Illuminate\Support\Facades\DB;
|
|
21
|
+
use Illuminate\Support\Str;
|
|
21
22
|
use Spatie\Activitylog\Traits\CausesActivity;
|
|
22
23
|
use Spatie\Activitylog\Traits\LogsActivity;
|
|
23
24
|
use Spatie\Sluggable\HasSlug;
|
|
@@ -546,4 +547,19 @@ class Driver extends Model
|
|
|
546
547
|
|
|
547
548
|
return $position;
|
|
548
549
|
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Get the user relationship from the driver.
|
|
553
|
+
*/
|
|
554
|
+
public function getUser(): ?\Fleetbase\Models\User
|
|
555
|
+
{
|
|
556
|
+
// get user
|
|
557
|
+
$user = $this->load(['user'])->user;
|
|
558
|
+
|
|
559
|
+
if (empty($user) && Str::isUuid($this->user_uuid)) {
|
|
560
|
+
$user = \Fleetbase\Models\User::where('uuid', $this->user_uuid)->first();
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
return $user;
|
|
564
|
+
}
|
|
549
565
|
}
|
|
@@ -68,6 +68,7 @@ class Entity extends Model
|
|
|
68
68
|
'customer_type',
|
|
69
69
|
'tracking_number_uuid',
|
|
70
70
|
'destination_uuid',
|
|
71
|
+
'supplier_uuid',
|
|
71
72
|
'photo_uuid',
|
|
72
73
|
'_import_id',
|
|
73
74
|
'internal_id',
|
|
@@ -160,9 +161,7 @@ class Entity extends Model
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @var Model
|
|
164
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
166
165
|
*/
|
|
167
166
|
public function photo()
|
|
168
167
|
{
|
|
@@ -170,9 +169,7 @@ class Entity extends Model
|
|
|
170
169
|
}
|
|
171
170
|
|
|
172
171
|
/**
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @var Model
|
|
172
|
+
* @var \Illuminate\Database\Eloquent\Relations\HasMany
|
|
176
173
|
*/
|
|
177
174
|
public function files()
|
|
178
175
|
{
|
|
@@ -180,7 +177,7 @@ class Entity extends Model
|
|
|
180
177
|
}
|
|
181
178
|
|
|
182
179
|
/**
|
|
183
|
-
*
|
|
180
|
+
* @var \Illuminate\Database\Eloquent\Relations\HasMany
|
|
184
181
|
*/
|
|
185
182
|
public function proofs()
|
|
186
183
|
{
|
|
@@ -188,9 +185,7 @@ class Entity extends Model
|
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* @var Model
|
|
188
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
194
189
|
*/
|
|
195
190
|
public function destination()
|
|
196
191
|
{
|
|
@@ -198,9 +193,7 @@ class Entity extends Model
|
|
|
198
193
|
}
|
|
199
194
|
|
|
200
195
|
/**
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
* @var Model
|
|
196
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
204
197
|
*/
|
|
205
198
|
public function payload()
|
|
206
199
|
{
|
|
@@ -208,9 +201,15 @@ class Entity extends Model
|
|
|
208
201
|
}
|
|
209
202
|
|
|
210
203
|
/**
|
|
211
|
-
*
|
|
212
|
-
|
|
213
|
-
|
|
204
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
205
|
+
*/
|
|
206
|
+
public function supplier()
|
|
207
|
+
{
|
|
208
|
+
return $this->belongsTo(Vendor::class, 'supplier_uuid');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
214
213
|
*/
|
|
215
214
|
public function driver()
|
|
216
215
|
{
|
|
@@ -218,9 +217,7 @@ class Entity extends Model
|
|
|
218
217
|
}
|
|
219
218
|
|
|
220
219
|
/**
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
* @var Model
|
|
220
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
224
221
|
*/
|
|
225
222
|
public function company()
|
|
226
223
|
{
|
|
@@ -228,7 +225,7 @@ class Entity extends Model
|
|
|
228
225
|
}
|
|
229
226
|
|
|
230
227
|
/**
|
|
231
|
-
*
|
|
228
|
+
* @var \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
232
229
|
*/
|
|
233
230
|
public function trackingNumber()
|
|
234
231
|
{
|
|
@@ -236,9 +233,7 @@ class Entity extends Model
|
|
|
236
233
|
}
|
|
237
234
|
|
|
238
235
|
/**
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* @var Model
|
|
236
|
+
* @var \Illuminate\Database\Eloquent\Relations\MorphTo
|
|
242
237
|
*/
|
|
243
238
|
public function customer()
|
|
244
239
|
{
|
|
@@ -7,6 +7,7 @@ use Fleetbase\FleetOps\Casts\Point;
|
|
|
7
7
|
use Fleetbase\FleetOps\Support\Utils;
|
|
8
8
|
use Fleetbase\Models\Model;
|
|
9
9
|
use Fleetbase\Traits\HasApiModelBehavior;
|
|
10
|
+
use Fleetbase\Traits\HasMetaAttributes;
|
|
10
11
|
use Fleetbase\Traits\HasPublicId;
|
|
11
12
|
use Fleetbase\Traits\HasUuid;
|
|
12
13
|
use Fleetbase\Traits\Searchable;
|
|
@@ -27,6 +28,7 @@ class Vehicle extends Model
|
|
|
27
28
|
use Searchable;
|
|
28
29
|
use HasSlug;
|
|
29
30
|
use LogsActivity;
|
|
31
|
+
use HasMetaAttributes;
|
|
30
32
|
|
|
31
33
|
/**
|
|
32
34
|
* The database table used by the model.
|
|
@@ -54,7 +56,7 @@ class Vehicle extends Model
|
|
|
54
56
|
*
|
|
55
57
|
* @var array
|
|
56
58
|
*/
|
|
57
|
-
protected $filterParams = ['vendor', 'driver', 'driver_uuid'];
|
|
59
|
+
protected $filterParams = ['vendor', 'driver', 'driver_uuid', 'vehicle_make', 'vehicle_model'];
|
|
58
60
|
|
|
59
61
|
/**
|
|
60
62
|
* Relationships to auto load with driver.
|
|
@@ -165,7 +167,7 @@ class Vehicle extends Model
|
|
|
165
167
|
'location' => Point::class,
|
|
166
168
|
'meta' => Json::class,
|
|
167
169
|
'telematics' => Json::class,
|
|
168
|
-
'
|
|
170
|
+
'model_data' => Json::class,
|
|
169
171
|
'vin_data' => Json::class,
|
|
170
172
|
'online' => 'boolean',
|
|
171
173
|
];
|