@fleetbase/fleetops-engine 0.3.8 → 0.3.9
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 +4 -1
- package/addon/components/contact-panel.hbs +1 -1
- package/addon/components/driver-form-panel.hbs +5 -12
- package/addon/components/driver-panel.hbs +4 -1
- package/addon/components/fleet-form-panel.hbs +4 -1
- package/addon/components/fleet-listing-panel.hbs +2 -2
- package/addon/components/fleet-panel.hbs +1 -1
- package/addon/components/fuel-report-form-panel.hbs +4 -1
- package/addon/components/fuel-report-panel.hbs +4 -1
- package/addon/components/issue-form-panel.hbs +4 -1
- package/addon/components/issue-panel.hbs +4 -1
- package/addon/components/layout/fleet-ops-sidebar/driver-listing.hbs +5 -0
- package/addon/components/layout/fleet-ops-sidebar/driver-listing.js +122 -0
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.hbs +2 -2
- package/addon/components/layout/fleet-ops-sidebar/fleet-listing.js +69 -49
- package/addon/components/layout/fleet-ops-sidebar.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.js +4 -3
- package/addon/components/live-map.hbs +90 -9
- package/addon/components/live-map.js +28 -11
- package/addon/components/map-container/toolbar/zones-panel.js +16 -13
- package/addon/components/place-form-panel.hbs +4 -1
- package/addon/components/place-panel.hbs +4 -1
- package/addon/components/settings-window.hbs +1 -1
- package/addon/components/vehicle-form-panel.hbs +4 -1
- package/addon/components/vehicle-panel.hbs +4 -1
- package/addon/components/vendor-form-panel.hbs +4 -1
- package/addon/components/vendor-panel.hbs +4 -1
- package/addon/controllers/management/drivers/index.js +10 -90
- package/addon/controllers/management/vehicles/index.js +11 -21
- package/addon/controllers/operations/orders/index/new.js +5 -5
- package/addon/controllers/operations/orders/index/view.js +9 -13
- package/addon/helpers/format-point.js +5 -2
- package/addon/helpers/point-to-coordinates.js +6 -2
- package/addon/services/context-panel.js +23 -18
- package/addon/services/driver-actions.js +107 -0
- package/addon/services/vehicle-actions.js +42 -0
- package/addon/styles/fleetops-engine.css +12 -2
- package/addon/templates/operations/orders/index/new.hbs +3 -3
- package/addon/utils/fly-to-leaflet-layer.js +7 -0
- package/app/components/layout/fleet-ops-sidebar/driver-listing.js +1 -0
- package/app/services/driver-actions.js +1 -0
- package/app/services/vehicle-actions.js +1 -0
- package/composer.json +2 -2
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/src/Exceptions/IntegratedVendorException.php +45 -1
- package/server/src/Http/Controllers/Api/v1/DriverController.php +2 -2
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +25 -4
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +3 -10
- package/server/src/Http/Controllers/Internal/v1/NavigatorController.php +1 -1
- package/addon/helpers/extract-coordinates.js +0 -6
- package/addon/utils/extract-coordinates.js +0 -1
- package/app/helpers/extract-coordinates.js +0 -1
- package/app/utils/extract-coordinates.js +0 -1
|
@@ -17,6 +17,7 @@ use Fleetbase\Models\Invite;
|
|
|
17
17
|
use Fleetbase\Models\User;
|
|
18
18
|
use Fleetbase\Models\VerificationCode;
|
|
19
19
|
use Fleetbase\Notifications\UserInvited;
|
|
20
|
+
use Grimzy\LaravelMysqlSpatial\Types\Point;
|
|
20
21
|
use Illuminate\Http\Request;
|
|
21
22
|
use Illuminate\Support\Facades\DB;
|
|
22
23
|
use Illuminate\Support\Facades\Validator;
|
|
@@ -79,6 +80,12 @@ class DriverController extends FleetOpsController
|
|
|
79
80
|
// if exists in organization create driver profile for user
|
|
80
81
|
$isOrganizationMember = $existingUser->companies()->where('company_uuid', session('company'))->exists();
|
|
81
82
|
|
|
83
|
+
// Check if driver profile also already exists
|
|
84
|
+
$existingDriverProfile = Driver::where(['company_uuid' => session('company'), 'user_uuid' => $existingUser->uuid])->first();
|
|
85
|
+
if ($existingDriverProfile) {
|
|
86
|
+
return ['driver' => new $this->resource($existingDriverProfile)];
|
|
87
|
+
}
|
|
88
|
+
|
|
82
89
|
// create driver profile for user
|
|
83
90
|
$input = collect($input)
|
|
84
91
|
->except(['name', 'password', 'email', 'phone', 'meta', 'avatar_uuid', 'photo_uuid'])
|
|
@@ -90,6 +97,11 @@ class DriverController extends FleetOpsController
|
|
|
90
97
|
$input['user_uuid'] = $existingUser->uuid;
|
|
91
98
|
$input['slug'] = $existingUser->slug;
|
|
92
99
|
|
|
100
|
+
// If no location provided set
|
|
101
|
+
if (empty($input['location'])) {
|
|
102
|
+
$input['location'] = new Point(0, 0);
|
|
103
|
+
}
|
|
104
|
+
|
|
93
105
|
// create the profile
|
|
94
106
|
$driverProfile = Driver::create($input);
|
|
95
107
|
|
|
@@ -109,7 +121,7 @@ class DriverController extends FleetOpsController
|
|
|
109
121
|
$existingUser->notify(new UserInvited($invitation));
|
|
110
122
|
}
|
|
111
123
|
|
|
112
|
-
return
|
|
124
|
+
return ['driver' => new $this->resource($driverProfile)];
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
127
|
|
|
@@ -138,15 +150,19 @@ class DriverController extends FleetOpsController
|
|
|
138
150
|
->filter()
|
|
139
151
|
->toArray();
|
|
140
152
|
|
|
141
|
-
|
|
142
|
-
|
|
153
|
+
// Make sure password is set
|
|
154
|
+
if (empty($userInput['password'])) {
|
|
155
|
+
$userInput['password'] = Str::random(14);
|
|
143
156
|
}
|
|
144
157
|
|
|
145
158
|
$userInput['company_uuid'] = session('company');
|
|
146
|
-
$userInput['type'] = 'driver';
|
|
147
159
|
|
|
160
|
+
// Create user account
|
|
148
161
|
$user = User::create($userInput);
|
|
149
162
|
|
|
163
|
+
// Set user type as driver
|
|
164
|
+
$user->setUserType('driver');
|
|
165
|
+
|
|
150
166
|
// send invitation to user
|
|
151
167
|
$invitation = Invite::create([
|
|
152
168
|
'company_uuid' => session('company'),
|
|
@@ -163,6 +179,11 @@ class DriverController extends FleetOpsController
|
|
|
163
179
|
|
|
164
180
|
$input['user_uuid'] = $user->uuid;
|
|
165
181
|
$input['slug'] = $user->slug;
|
|
182
|
+
|
|
183
|
+
// If no location provided set
|
|
184
|
+
if (empty($input['location'])) {
|
|
185
|
+
$input['location'] = new Point(0, 0);
|
|
186
|
+
}
|
|
166
187
|
},
|
|
167
188
|
function ($request, &$driver) {
|
|
168
189
|
$driver->load(['user']);
|
|
@@ -82,26 +82,19 @@ class LiveController extends Controller
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* Get
|
|
85
|
+
* Get drivers for the current company.
|
|
86
86
|
*
|
|
87
87
|
* @return \Illuminate\Http\JsonResponse
|
|
88
88
|
*/
|
|
89
89
|
public function drivers()
|
|
90
90
|
{
|
|
91
|
-
$drivers = Driver::where(['company_uuid' => session('company')
|
|
92
|
-
->whereHas(
|
|
93
|
-
'currentJob',
|
|
94
|
-
function ($q) {
|
|
95
|
-
$q->whereNotIn('status', ['canceled', 'completed']);
|
|
96
|
-
}
|
|
97
|
-
)
|
|
98
|
-
->get();
|
|
91
|
+
$drivers = Driver::where(['company_uuid' => session('company')])->get();
|
|
99
92
|
|
|
100
93
|
return DriverResource::collection($drivers);
|
|
101
94
|
}
|
|
102
95
|
|
|
103
96
|
/**
|
|
104
|
-
* Get
|
|
97
|
+
* Get vehicles for the current company.
|
|
105
98
|
*
|
|
106
99
|
* @return \Illuminate\Http\JsonResponse
|
|
107
100
|
*/
|
|
@@ -30,7 +30,7 @@ class NavigatorController extends Controller
|
|
|
30
30
|
]
|
|
31
31
|
);
|
|
32
32
|
|
|
33
|
-
return redirect()->away('flbnavigator://configure?key=' . $apiCredential->key . '&host=' . url()->secure('/'));
|
|
33
|
+
return redirect()->away('flbnavigator://configure?key=' . $apiCredential->key . '&host=' . url()->secure('/') . '&socketcluster_host=' . env('SOCKETCLUSTER_HOST', 'socket') . '&socketcluster_port=' . env('SOCKETCLUSTER_PORT', 8000));
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return response()->error('Organization for linking not found.');
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { helper } from '@ember/component/helper';
|
|
2
|
-
import extractCoordinatesUtil from '../utils/extract-coordinates';
|
|
3
|
-
|
|
4
|
-
export default helper(function extractCoordinates([coordinates = [], format = 'latlng']) {
|
|
5
|
-
return extractCoordinatesUtil(coordinates, format);
|
|
6
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/ember-core/utils/extract-coordinates';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default, extractCoordinates } from '@fleetbase/fleetops-engine/helpers/extract-coordinates';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/utils/extract-coordinates';
|