@fleetbase/fleetops-engine 0.2.8 → 0.3.0
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/context-panel.hbs +5 -0
- package/addon/components/context-panel.js +6 -0
- package/addon/components/driver-card-mini.js +34 -13
- package/addon/components/driver-form-panel.hbs +23 -23
- package/addon/components/driver-form-panel.js +96 -13
- package/addon/components/driver-panel.hbs +12 -12
- package/addon/components/driver-panel.js +125 -21
- package/addon/components/fleet-vehicle-listing.hbs +1 -1
- package/addon/components/live-map.hbs +20 -9
- package/addon/components/live-map.js +1255 -353
- package/addon/components/map-container/toolbar/visibility-control-panel.hbs +66 -0
- package/addon/components/map-container/toolbar/visibility-control-panel.js +74 -0
- package/addon/components/map-container/toolbar/zones-panel.hbs +10 -10
- package/addon/components/map-container/toolbar/zones-panel.js +90 -61
- package/addon/components/map-container/toolbar.hbs +12 -7
- package/addon/components/modals/vehicle-form.hbs +35 -35
- package/addon/components/settings-window.hbs +1 -1
- package/addon/components/vehicle-form-panel.hbs +25 -26
- package/addon/components/vehicle-form-panel.js +95 -12
- package/addon/components/vehicle-panel.hbs +12 -13
- package/addon/components/vehicle-panel.js +130 -20
- package/addon/controllers/management/drivers/index/details.js +53 -0
- package/addon/controllers/management/drivers/index/edit.js +77 -46
- package/addon/controllers/management/drivers/index/new.js +39 -79
- package/addon/controllers/management/drivers/index.js +17 -221
- package/addon/controllers/management/fleets/index/edit.js +1 -1
- package/addon/controllers/management/fleets/index/new.js +1 -1
- package/addon/controllers/management/fuel-reports/index.js +2 -2
- package/addon/controllers/management/vehicles/index/details.js +49 -0
- package/addon/controllers/management/vehicles/index/edit.js +104 -1
- package/addon/controllers/management/vehicles/index/new.js +71 -0
- package/addon/controllers/operations/orders/index/new.js +4 -6
- package/addon/controllers/operations/orders/index/view.js +22 -14
- package/addon/controllers/operations/orders/index.js +124 -50
- package/addon/controllers/operations/service-rates/index/edit.js +1 -1
- package/addon/controllers/operations/service-rates/index/new.js +1 -1
- package/addon/engine.js +6 -0
- package/addon/helpers/is-visibility-control-visible.js +18 -0
- package/addon/routes/application.js +1 -1
- package/addon/routes/home.js +1 -1
- package/addon/routes/management/drivers/index/details.js +5 -0
- package/addon/routes/operations/orders/index/view.js +4 -2
- package/addon/routes/operations/orders/index.js +5 -1
- package/addon/routes/operations/service-rates/index.js +1 -1
- package/addon/routes/operations/zones/index.js +1 -1
- package/addon/services/context-panel.js +173 -0
- package/addon/services/leaflet-contextmenu-manager.js +311 -0
- package/addon/services/leaflet-map-manager.js +61 -0
- package/addon/services/service-areas.js +242 -32
- package/addon/templates/application.hbs +2 -1
- package/addon/templates/management/drivers/index/details.hbs +1 -1
- package/addon/templates/management/drivers/index/edit.hbs +1 -1
- package/addon/templates/management/drivers/index/new.hbs +1 -1
- package/addon/templates/management/vehicles/index/details.hbs +1 -1
- package/addon/templates/management/vehicles/index/edit.hbs +1 -1
- package/addon/templates/management/vehicles/index/new.hbs +1 -1
- package/addon/templates/operations/orders/index/view.hbs +2 -2
- package/addon/templates/operations/orders/index.hbs +1 -1
- package/addon/utils/apply-context-component-arguments.js +31 -0
- package/addon/utils/context-component-callback.js +16 -0
- package/addon/utils/find-leaflet-layer.js +13 -0
- package/addon/utils/fly-to-leaflet-layer.js +25 -0
- package/addon/utils/get-leaflet-layer-by-id.js +12 -0
- package/addon/utils/layer-can-bind-contextmenu.js +3 -0
- package/app/components/context-panel.js +1 -0
- package/app/components/map-container/toolbar/visibility-control-panel.js +1 -0
- package/app/helpers/is-visibility-control-visible.js +1 -0
- package/app/services/context-panel.js +1 -0
- package/app/services/leaflet-contextmenu-manager.js +1 -0
- package/app/services/leaflet-map-manager.js +1 -0
- package/app/utils/apply-context-component-arguments.js +1 -0
- package/app/utils/context-component-callback.js +1 -0
- package/app/utils/find-leaflet-layer.js +1 -0
- package/app/utils/fly-to-leaflet-layer.js +1 -0
- package/app/utils/get-leaflet-layer-by-id.js +1 -0
- package/app/utils/layer-can-bind-contextmenu.js +1 -0
- package/composer.json +11 -1
- package/extension.json +1 -1
- package/package.json +3 -3
- package/server/migrations/2023_09_14_074512_update_vehicles_table.php +89 -88
- package/server/migrations/2023_10_25_093014_create_vehicle_device_events_table.php +56 -0
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +7 -4
- package/server/src/Http/Filter/VehicleFilter.php +7 -0
- package/server/src/Http/Resources/v1/Vehicle.php +52 -39
- package/server/src/Models/VehicleDevice.php +17 -3
- package/server/src/Models/VehicleDeviceEvent.php +90 -0
- package/addon/services/map-manager.js +0 -3
- package/app/services/map-manager.js +0 -1
|
@@ -12,42 +12,42 @@
|
|
|
12
12
|
<label>
|
|
13
13
|
Internal ID
|
|
14
14
|
</label>
|
|
15
|
-
<Input @value={{@options.vehicle.internal_id}}
|
|
15
|
+
<Input @value={{@options.vehicle.internal_id}} @type="text" class="w-full form-input" placeholder="Internal ID" />
|
|
16
16
|
</div>
|
|
17
17
|
|
|
18
18
|
<div class="input-group mb-2">
|
|
19
19
|
<label>
|
|
20
20
|
Plate Number
|
|
21
21
|
</label>
|
|
22
|
-
<Input @value={{@options.vehicle.plate_number}}
|
|
22
|
+
<Input @value={{@options.vehicle.plate_number}} @type="text" class="w-full form-input" placeholder="Plate Number" />
|
|
23
23
|
</div>
|
|
24
24
|
|
|
25
25
|
<div class="input-group mb-2">
|
|
26
26
|
<label>
|
|
27
27
|
VIN Number
|
|
28
28
|
</label>
|
|
29
|
-
<Input @value={{@options.vehicle.vin}}
|
|
29
|
+
<Input @value={{@options.vehicle.vin}} @type="text" class="w-full form-input" placeholder="VIN Number" />
|
|
30
30
|
</div>
|
|
31
31
|
|
|
32
32
|
<div class="input-group mb-2">
|
|
33
33
|
<label>
|
|
34
34
|
Make
|
|
35
35
|
</label>
|
|
36
|
-
<Input @value={{@options.vehicle.make}}
|
|
36
|
+
<Input @value={{@options.vehicle.make}} @type="text" class="w-full form-input" placeholder="Vehicle Make" />
|
|
37
37
|
</div>
|
|
38
38
|
|
|
39
39
|
<div class="input-group mb-2">
|
|
40
40
|
<label>
|
|
41
41
|
Model
|
|
42
42
|
</label>
|
|
43
|
-
<Input @value={{@options.vehicle.model}}
|
|
43
|
+
<Input @value={{@options.vehicle.model}} @type="text" class="w-full form-input" placeholder="Vehicle Model" />
|
|
44
44
|
</div>
|
|
45
45
|
|
|
46
46
|
<div class="input-group mb-2">
|
|
47
47
|
<label>
|
|
48
48
|
Year
|
|
49
49
|
</label>
|
|
50
|
-
<Input @value={{@options.vehicle.year}}
|
|
50
|
+
<Input @value={{@options.vehicle.year}} @type="text" class="w-full form-input" placeholder="Vehicle Year" />
|
|
51
51
|
</div>
|
|
52
52
|
|
|
53
53
|
<div class="input-group mb-2">
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
|
|
66
66
|
<div class="input-group mb-2">
|
|
67
67
|
<InputLabel @labelText="Select map avatar" @helpText="Select an avatar to be used for rendering on maps when using geolocation tracking features." />
|
|
68
|
-
<FetchSelect
|
|
69
|
-
{{titleize (humanize key)}}
|
|
68
|
+
<FetchSelect @wrapperClass="w-60" @placeholder="Select avatar" @endpoint="vehicles/avatars" @selected={{this.vehicle.avatar_url}} @optionValue="value" @onChange={{fn (mut this.vehicle.avatar_url)}} as |option|>
|
|
69
|
+
{{titleize (humanize option.key)}}
|
|
70
70
|
</FetchSelect>
|
|
71
71
|
</div>
|
|
72
72
|
<div>
|
|
@@ -81,77 +81,77 @@
|
|
|
81
81
|
<label>
|
|
82
82
|
0 To 100 kph
|
|
83
83
|
</label>
|
|
84
|
-
<Input @value={{@options.vehicle.model_0_to_100_kph}}
|
|
84
|
+
<Input @value={{@options.vehicle.model_0_to_100_kph}} @type="text" class="w-full form-input" placeholder="0 To 100 kph" />
|
|
85
85
|
</div>
|
|
86
86
|
|
|
87
87
|
<div class="input-group mb-2">
|
|
88
88
|
<label>
|
|
89
89
|
Body
|
|
90
90
|
</label>
|
|
91
|
-
<Input @value={{@options.vehicle.model_body}}
|
|
91
|
+
<Input @value={{@options.vehicle.model_body}} @type="text" class="w-full form-input" placeholder="Vehicle Body Type" />
|
|
92
92
|
</div>
|
|
93
93
|
|
|
94
94
|
<div class="input-group mb-2">
|
|
95
95
|
<label>
|
|
96
96
|
Doors
|
|
97
97
|
</label>
|
|
98
|
-
<Input @value={{@options.vehicle.model_doors}}
|
|
98
|
+
<Input @value={{@options.vehicle.model_doors}} @type="text" class="w-full form-input" placeholder="Number of Doors" />
|
|
99
99
|
</div>
|
|
100
100
|
|
|
101
101
|
<div class="input-group mb-2">
|
|
102
102
|
<label>
|
|
103
103
|
Drive
|
|
104
104
|
</label>
|
|
105
|
-
<Input @value={{@options.vehicle.model_drive}}
|
|
105
|
+
<Input @value={{@options.vehicle.model_drive}} @type="text" class="w-full form-input" placeholder="Vehicle Drive Type" />
|
|
106
106
|
</div>
|
|
107
107
|
|
|
108
108
|
<div class="input-group mb-2">
|
|
109
109
|
<label>
|
|
110
110
|
Length (mm)
|
|
111
111
|
</label>
|
|
112
|
-
<Input @value={{@options.vehicle.model_length_mm}}
|
|
112
|
+
<Input @value={{@options.vehicle.model_length_mm}} @type="text" class="w-full form-input" placeholder="Vehicle Length (mm)" />
|
|
113
113
|
</div>
|
|
114
114
|
|
|
115
115
|
<div class="input-group mb-2">
|
|
116
116
|
<label>
|
|
117
117
|
Seats
|
|
118
118
|
</label>
|
|
119
|
-
<Input @value={{@options.vehicle.model_seats}}
|
|
119
|
+
<Input @value={{@options.vehicle.model_seats}} @type="text" class="w-full form-input" placeholder="Number of Seats" />
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
<div class="input-group mb-2">
|
|
123
123
|
<label>
|
|
124
124
|
Top Speed (kph)
|
|
125
125
|
</label>
|
|
126
|
-
<Input @value={{@options.vehicle.model_top_speed_kph}}
|
|
126
|
+
<Input @value={{@options.vehicle.model_top_speed_kph}} @type="text" class="w-full form-input" placeholder="Vehicle Top Speed (kph)" />
|
|
127
127
|
</div>
|
|
128
128
|
|
|
129
129
|
<div class="input-group mb-2">
|
|
130
130
|
<label>
|
|
131
131
|
Transmission Type
|
|
132
132
|
</label>
|
|
133
|
-
<Input @value={{@options.vehicle.model_transmission_type}}
|
|
133
|
+
<Input @value={{@options.vehicle.model_transmission_type}} @type="text" class="w-full form-input" placeholder=" Vehicle Transmission Type" />
|
|
134
134
|
</div>
|
|
135
135
|
|
|
136
136
|
<div class="input-group mb-2">
|
|
137
137
|
<label>
|
|
138
138
|
Weight (kg)
|
|
139
139
|
</label>
|
|
140
|
-
<Input @value={{@options.vehicle.model_weight_kg}}
|
|
140
|
+
<Input @value={{@options.vehicle.model_weight_kg}} @type="text" class="w-full form-input" placeholder="Vehicle Weight (kg)" />
|
|
141
141
|
</div>
|
|
142
142
|
|
|
143
143
|
<div class="input-group mb-2">
|
|
144
144
|
<label>
|
|
145
145
|
Wheelbase (mm)
|
|
146
146
|
</label>
|
|
147
|
-
<Input @value={{@options.vehicle.model_wheelbase_mm}}
|
|
147
|
+
<Input @value={{@options.vehicle.model_wheelbase_mm}} @type="text" class="w-full form-input" placeholder="Vehicle Wheelbase Length (mm)" />
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
<div class="input-group mb-2">
|
|
151
151
|
<label>
|
|
152
152
|
Width (mm)
|
|
153
153
|
</label>
|
|
154
|
-
<Input @value={{@options.vehicle.model_width_mm}}
|
|
154
|
+
<Input @value={{@options.vehicle.model_width_mm}} @type="text" class="w-full form-input" placeholder="Vehicle Width (mm)" />
|
|
155
155
|
</div>
|
|
156
156
|
</div>
|
|
157
157
|
</ContentPanel>
|
|
@@ -162,77 +162,77 @@
|
|
|
162
162
|
<label>
|
|
163
163
|
Engine Bore (mm)
|
|
164
164
|
</label>
|
|
165
|
-
<Input @value={{@options.vehicle.model_engine_bore_mm}}
|
|
165
|
+
<Input @value={{@options.vehicle.model_engine_bore_mm}} @type="text" class="w-full form-input" placeholder="Engine Bore (mm)" />
|
|
166
166
|
</div>
|
|
167
167
|
|
|
168
168
|
<div class="input-group mb-2">
|
|
169
169
|
<label>
|
|
170
170
|
CC
|
|
171
171
|
</label>
|
|
172
|
-
<Input @value={{@options.vehicle.model_engine_cc}}
|
|
172
|
+
<Input @value={{@options.vehicle.model_engine_cc}} @type="text" class="w-full form-input" placeholder="Engine CC" />
|
|
173
173
|
</div>
|
|
174
174
|
|
|
175
175
|
<div class="input-group mb-2">
|
|
176
176
|
<label>
|
|
177
177
|
Compression
|
|
178
178
|
</label>
|
|
179
|
-
<Input @value={{@options.vehicle.model_engine_compression}}
|
|
179
|
+
<Input @value={{@options.vehicle.model_engine_compression}} @type="text" class="w-full form-input" placeholder=" Engine Compression" />
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<div class="input-group mb-2">
|
|
183
183
|
<label>
|
|
184
184
|
Cylinders
|
|
185
185
|
</label>
|
|
186
|
-
<Input @value={{@options.vehicle.model_engine_cyl}}
|
|
186
|
+
<Input @value={{@options.vehicle.model_engine_cyl}} @type="text" class="w-full form-input" placeholder="Number of Cylinders" />
|
|
187
187
|
</div>
|
|
188
188
|
|
|
189
189
|
<div class="input-group mb-2">
|
|
190
190
|
<label>
|
|
191
191
|
Position
|
|
192
192
|
</label>
|
|
193
|
-
<Input @value={{@options.vehicle.model_engine_position}}
|
|
193
|
+
<Input @value={{@options.vehicle.model_engine_position}} @type="text" class="w-full form-input" placeholder="Engine Position" />
|
|
194
194
|
</div>
|
|
195
195
|
|
|
196
196
|
<div class="input-group mb-2">
|
|
197
197
|
<label>
|
|
198
198
|
Power (ps)
|
|
199
199
|
</label>
|
|
200
|
-
<Input @value={{@options.vehicle.model_engine_power_ps}}
|
|
200
|
+
<Input @value={{@options.vehicle.model_engine_power_ps}} @type="text" class="w-full form-input" placeholder="Engine Power (ps)" />
|
|
201
201
|
</div>
|
|
202
202
|
|
|
203
203
|
<div class="input-group mb-2">
|
|
204
204
|
<label>
|
|
205
205
|
Power (rpm)
|
|
206
206
|
</label>
|
|
207
|
-
<Input @value={{@options.vehicle.model_engine_power_rpm}}
|
|
207
|
+
<Input @value={{@options.vehicle.model_engine_power_rpm}} @type="text" class="w-full form-input" placeholder="Engine Power (rpm)" />
|
|
208
208
|
</div>
|
|
209
209
|
|
|
210
210
|
<div class="input-group mb-2">
|
|
211
211
|
<label>
|
|
212
212
|
Stroke (mm)
|
|
213
213
|
</label>
|
|
214
|
-
<Input @value={{@options.vehicle.model_engine_stroke_mm}}
|
|
214
|
+
<Input @value={{@options.vehicle.model_engine_stroke_mm}} @type="text" class="w-full form-input" placeholder="Stroke Length (mm)" />
|
|
215
215
|
</div>
|
|
216
216
|
|
|
217
217
|
<div class="input-group mb-2">
|
|
218
218
|
<label>
|
|
219
219
|
Torque (nm)
|
|
220
220
|
</label>
|
|
221
|
-
<Input @value={{@options.vehicle.model_engine_torque_nm}}
|
|
221
|
+
<Input @value={{@options.vehicle.model_engine_torque_nm}} @type="text" class="w-full form-input" placeholder="Engine Torque (nm)" />
|
|
222
222
|
</div>
|
|
223
223
|
|
|
224
224
|
<div class="input-group mb-2">
|
|
225
225
|
<label>
|
|
226
226
|
Torque (rpm)
|
|
227
227
|
</label>
|
|
228
|
-
<Input @value={{@options.vehicle.model_engine_torque_rpm}}
|
|
228
|
+
<Input @value={{@options.vehicle.model_engine_torque_rpm}} @type="text" class="w-full form-input" placeholder="Engine Torque (rpm)" />
|
|
229
229
|
</div>
|
|
230
230
|
|
|
231
231
|
<div class="input-group mb-2">
|
|
232
232
|
<label>
|
|
233
233
|
Valves per Cylinder
|
|
234
234
|
</label>
|
|
235
|
-
<Input @value={{@options.vehicle.model_engine_valves_per_cyl}}
|
|
235
|
+
<Input @value={{@options.vehicle.model_engine_valves_per_cyl}} @type="text" class="w-full form-input" placeholder="Valves per Cylinder" />
|
|
236
236
|
</div>
|
|
237
237
|
</div>
|
|
238
238
|
</ContentPanel>
|
|
@@ -243,35 +243,35 @@
|
|
|
243
243
|
<label>
|
|
244
244
|
Fuel
|
|
245
245
|
</label>
|
|
246
|
-
<Input @value={{@options.vehicle.model_engine_fuel}}
|
|
246
|
+
<Input @value={{@options.vehicle.model_engine_fuel}} @type="text" class="w-full form-input" placeholder="Fuel Type" />
|
|
247
247
|
</div>
|
|
248
248
|
|
|
249
249
|
<div class="input-group mb-2">
|
|
250
250
|
<label>
|
|
251
251
|
Fuel Cap (L)
|
|
252
252
|
</label>
|
|
253
|
-
<Input @value={{@options.vehicle.model_fuel_cap_l}}
|
|
253
|
+
<Input @value={{@options.vehicle.model_fuel_cap_l}} @type="text" class="w-full form-input" placeholder="Fuel Cap Volume (L)" />
|
|
254
254
|
</div>
|
|
255
255
|
|
|
256
256
|
<div class="input-group mb-2">
|
|
257
257
|
<label>
|
|
258
258
|
Liters Per km City
|
|
259
259
|
</label>
|
|
260
|
-
<Input @value={{@options.vehicle.model_lkm_city}}
|
|
260
|
+
<Input @value={{@options.vehicle.model_lkm_city}} @type="text" class="w-full form-input" placeholder="Liters Per km City" />
|
|
261
261
|
</div>
|
|
262
262
|
|
|
263
263
|
<div class="input-group mb-2">
|
|
264
264
|
<label>
|
|
265
265
|
Liters Per km Highway
|
|
266
266
|
</label>
|
|
267
|
-
<Input @value={{@options.vehicle.model_lkm_hwy}}
|
|
267
|
+
<Input @value={{@options.vehicle.model_lkm_hwy}} @type="text" class="w-full form-input" placeholder="Liters Per km Highway" />
|
|
268
268
|
</div>
|
|
269
269
|
|
|
270
270
|
<div class="input-group mb-2">
|
|
271
271
|
<label>
|
|
272
272
|
Liters Per km Mixed
|
|
273
273
|
</label>
|
|
274
|
-
<Input @value={{@options.vehicle.model_lkm_mixed}}
|
|
274
|
+
<Input @value={{@options.vehicle.model_lkm_mixed}} @type="text" class="w-full form-input" placeholder="Liters Per km Mixed" />
|
|
275
275
|
</div>
|
|
276
276
|
</div>
|
|
277
277
|
</ContentPanel>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<Overlay @onLoad={{this.onLoad}} @isOpen={{@isOpen}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} as |overlay|>
|
|
1
|
+
<Overlay @onLoad={{this.onLoad}} @isOpen={{@isOpen}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{true}} @isMaximizable={{true}} @isMinimizable={{true}} @width="600px" as |overlay|>
|
|
2
2
|
<Overlay::Header @overlay={{overlay}} @title="FleetOps Settings" @onPressCancel={{@onPressCancel}}>
|
|
3
3
|
<Button @icon="save" @type="primary" @text={{if (media 'isMobile') "" "Save Changes"}} @onClick={{this.saveSettings}} @isLoading={{this.isSaving}} @disabled={{or this.isLoading this.isSaving}} />
|
|
4
4
|
</Overlay::Header>
|
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
<Overlay @position="right" @noBackdrop={{true}} @fullHeight={{true}} @width="
|
|
1
|
+
<Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizeble={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
|
|
2
2
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
|
|
3
3
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
4
4
|
<div class="flex flex-1 space-x-2">
|
|
5
|
-
{{#if
|
|
6
|
-
<Button @type="default" @icon="car" @helpText="View vehicle details" @onClick={{this.
|
|
5
|
+
{{#if this.vehicle.id}}
|
|
6
|
+
<Button @type="default" @icon="car" @helpText="View vehicle details" @onClick={{this.onViewDetails}} @disabled={{this.isLoading}} />
|
|
7
7
|
{{/if}}
|
|
8
8
|
</div>
|
|
9
9
|
<div class="flex flex-1 justify-end">
|
|
10
10
|
<div class="mr-2">
|
|
11
|
-
<Button @icon={{if
|
|
11
|
+
<Button @icon={{if this.vehicle.id "save" "check"}} @type="primary" @text={{if this.vehicle.id "Save Vehicle" "Create Vehicle"}} @onClick={{this.save}} @isLoading={{this.isLoading}} />
|
|
12
12
|
</div>
|
|
13
|
-
<Button @type="default" @icon="times" @helpText={{if
|
|
13
|
+
<Button @type="default" @icon="times" @helpText={{if this.vehicle.id "Cancel edit vehicle" "Cancel new vehicle"}} @onClick={{this.onPressCancel}} @disabled={{this.isLoading}} />
|
|
14
14
|
</div>
|
|
15
15
|
</div>
|
|
16
16
|
<div class="flex flex-row justify-between w-full">
|
|
17
17
|
<div class="flex flex-col flex-1 w-3/4">
|
|
18
18
|
<div class="flex flex-row">
|
|
19
19
|
<div class="w-14 flex items-center justify-center">
|
|
20
|
-
<Image src={{
|
|
20
|
+
<Image src={{this.vehicle.photo_url}} @fallbackSrc={{config "defaultValues.vehicleImage"}} alt={{this.vehicle.name}} height="48" width="48" class="h-12 w-12" />
|
|
21
21
|
<Attach::Tooltip @class="clean" @animation="scale" @placement={{"top"}}>
|
|
22
|
-
<InputInfo @text={{
|
|
22
|
+
<InputInfo @text={{this.vehicle.public_id}} />
|
|
23
23
|
</Attach::Tooltip>
|
|
24
24
|
</div>
|
|
25
25
|
<div class="flex flex-col">
|
|
26
26
|
<h1 class="text-gray-900 dark:text-white text-2xl">
|
|
27
|
-
{{#if
|
|
28
|
-
{{
|
|
27
|
+
{{#if this.vehicle.id}}
|
|
28
|
+
{{this.vehicle.displayName}}
|
|
29
29
|
{{else}}
|
|
30
|
-
{{#if
|
|
31
|
-
{{
|
|
30
|
+
{{#if this.vehicle.displayName}}
|
|
31
|
+
{{this.vehicle.displayName}}
|
|
32
32
|
{{else}}
|
|
33
33
|
<span>New Vehicle</span>
|
|
34
34
|
{{/if}}
|
|
35
35
|
{{/if}}
|
|
36
36
|
</h1>
|
|
37
37
|
<div class="-mt-1">
|
|
38
|
-
{{#if
|
|
38
|
+
{{#if this.vehicle.driver}}
|
|
39
39
|
<div class="flex flex-row items-center">
|
|
40
|
-
<span class="text-sm dark:text-gray-500 text-gray-700 mr-3">{{
|
|
40
|
+
<span class="text-sm dark:text-gray-500 text-gray-700 mr-3">{{this.vehicle.driver.name}}</span>
|
|
41
41
|
</div>
|
|
42
42
|
{{else}}
|
|
43
43
|
<div class="flex flex-row items-center">
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
<div class="flex justify-end w-1/4">
|
|
52
|
-
<Badge @status={{
|
|
52
|
+
<Badge @status={{this.vehicle.status}} />
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
</Overlay::Header>
|
|
@@ -62,50 +62,50 @@
|
|
|
62
62
|
<label>
|
|
63
63
|
Internal ID
|
|
64
64
|
</label>
|
|
65
|
-
<Input @value={{
|
|
65
|
+
<Input @value={{this.vehicle.internal_id}} @type="text" class="w-full form-input" placeholder="Internal ID" />
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
68
|
<div class="input-group mb-2">
|
|
69
69
|
<label>
|
|
70
70
|
Plate Number
|
|
71
71
|
</label>
|
|
72
|
-
<Input @value={{
|
|
72
|
+
<Input @value={{this.vehicle.plate_number}} @type="text" class="w-full form-input" placeholder="Plate Number" />
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
75
|
<div class="input-group mb-2">
|
|
76
76
|
<label>
|
|
77
77
|
VIN Number
|
|
78
78
|
</label>
|
|
79
|
-
<Input @value={{
|
|
79
|
+
<Input @value={{this.vehicle.vin}} @type="text" class="w-full form-input" placeholder="VIN Number" />
|
|
80
80
|
</div>
|
|
81
81
|
|
|
82
82
|
<div class="input-group mb-2">
|
|
83
83
|
<label>
|
|
84
84
|
Make
|
|
85
85
|
</label>
|
|
86
|
-
<Input @value={{
|
|
86
|
+
<Input @value={{this.vehicle.make}} @type="text" class="w-full form-input" placeholder="Vehicle Make" />
|
|
87
87
|
</div>
|
|
88
88
|
|
|
89
89
|
<div class="input-group mb-2">
|
|
90
90
|
<label>
|
|
91
91
|
Model
|
|
92
92
|
</label>
|
|
93
|
-
<Input @value={{
|
|
93
|
+
<Input @value={{this.vehicle.model}} @type="text" class="w-full form-input" placeholder="Vehicle Model" />
|
|
94
94
|
</div>
|
|
95
95
|
|
|
96
96
|
<div class="input-group mb-2">
|
|
97
97
|
<label>
|
|
98
98
|
Year
|
|
99
99
|
</label>
|
|
100
|
-
<Input @value={{
|
|
100
|
+
<Input @value={{this.vehicle.year}} @type="text" class="w-full form-input" placeholder="Vehicle Year" />
|
|
101
101
|
</div>
|
|
102
102
|
|
|
103
103
|
<div class="input-group mb-2">
|
|
104
104
|
<label>
|
|
105
105
|
Driver Assigned
|
|
106
106
|
</label>
|
|
107
|
-
<ModelSelect @modelName="driver" @selectedModel={{
|
|
108
|
-
|
|
107
|
+
<ModelSelect @modelName="driver" @selectedModel={{this.vehicle.driver}} @placeholder="Select Driver" @triggerClass="form-select form-input" @infiniteScroll={{false}} @renderInPlace={{true}} @onChange={{fn (mut
|
|
108
|
+
this.vehicle.driver)}} as |model|>
|
|
109
109
|
{{model.name}}
|
|
110
110
|
</ModelSelect>
|
|
111
111
|
</div>
|
|
@@ -116,13 +116,12 @@
|
|
|
116
116
|
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-2">
|
|
117
117
|
<div class="input-group mb-2">
|
|
118
118
|
<InputLabel @labelText="Select map avatar" @helpText="Select an avatar to be used for rendering on maps when using geolocation tracking features." />
|
|
119
|
-
<FetchSelect
|
|
120
|
-
|
|
121
|
-
{{titleize (humanize key)}}
|
|
119
|
+
<FetchSelect @wrapperClass="w-60" @placeholder="Select avatar" @endpoint="vehicles/avatars" @selected={{this.vehicle.avatar_url}} @optionValue="value" @onChange={{fn (mut this.vehicle.avatar_url)}} as |option|>
|
|
120
|
+
{{titleize (humanize option.key)}}
|
|
122
121
|
</FetchSelect>
|
|
123
122
|
</div>
|
|
124
123
|
<div>
|
|
125
|
-
<img alt={{
|
|
124
|
+
<img alt={{this.vehicle.public_id}} src={{this.vehicle.avatar_url}} class="w-24 h-24" />
|
|
126
125
|
</div>
|
|
127
126
|
</div>
|
|
128
127
|
</ContentPanel>
|
|
@@ -1,39 +1,122 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
2
3
|
import { inject as service } from '@ember/service';
|
|
3
4
|
import { action } from '@ember/object';
|
|
5
|
+
import contextComponentCallback from '../utils/context-component-callback';
|
|
6
|
+
import applyContextComponentArguments from '../utils/apply-context-component-arguments';
|
|
4
7
|
|
|
5
8
|
export default class VehicleFormPanelComponent extends Component {
|
|
9
|
+
/**
|
|
10
|
+
* @service store
|
|
11
|
+
*/
|
|
6
12
|
@service store;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @service notifications
|
|
16
|
+
*/
|
|
7
17
|
@service notifications;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @service hostRouter
|
|
21
|
+
*/
|
|
8
22
|
@service hostRouter;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @service loader
|
|
26
|
+
*/
|
|
9
27
|
@service loader;
|
|
10
28
|
|
|
29
|
+
/**
|
|
30
|
+
* @service contextPanel
|
|
31
|
+
*/
|
|
32
|
+
@service contextPanel;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Overlay context.
|
|
36
|
+
* @type {any}
|
|
37
|
+
*/
|
|
38
|
+
@tracked context;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Indicates whether the component is in a loading state.
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
*/
|
|
44
|
+
@tracked isLoading = false;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Constructs the component and applies initial state.
|
|
48
|
+
*/
|
|
49
|
+
constructor() {
|
|
50
|
+
super(...arguments);
|
|
51
|
+
this.vehicle = this.args.vehicle;
|
|
52
|
+
applyContextComponentArguments(this);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Sets the overlay context.
|
|
57
|
+
*
|
|
58
|
+
* @action
|
|
59
|
+
* @param {OverlayContextObject} overlayContext
|
|
60
|
+
*/
|
|
61
|
+
@action setOverlayContext(overlayContext) {
|
|
62
|
+
this.context = overlayContext;
|
|
63
|
+
contextComponentCallback(this, 'onLoad', ...arguments);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Saves the vehicle changes.
|
|
68
|
+
*
|
|
69
|
+
* @action
|
|
70
|
+
* @returns {Promise<any>}
|
|
71
|
+
*/
|
|
11
72
|
@action save() {
|
|
12
|
-
const { vehicle
|
|
73
|
+
const { vehicle } = this;
|
|
74
|
+
|
|
75
|
+
this.loader.showLoader('.next-content-overlay-panel-container', { loadingMessage: 'Saving vehicle...', preserveTargetPosition: true });
|
|
76
|
+
this.isLoading = true;
|
|
13
77
|
|
|
14
|
-
this
|
|
78
|
+
contextComponentCallback(this, 'onBeforeSave', vehicle);
|
|
15
79
|
|
|
16
80
|
try {
|
|
17
81
|
return vehicle
|
|
18
82
|
.save()
|
|
19
83
|
.then((vehicle) => {
|
|
20
84
|
this.notifications.success(`Vehicle (${vehicle.displayName}) saved successfully.`);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
85
|
+
contextComponentCallback(this, 'onAfterSave', vehicle);
|
|
86
|
+
})
|
|
87
|
+
.catch((error) => {
|
|
88
|
+
this.notifications.serverError(error);
|
|
25
89
|
})
|
|
26
|
-
.catch(this.notifications.serverError)
|
|
27
90
|
.finally(() => {
|
|
28
|
-
this.loader.removeLoader();
|
|
91
|
+
this.loader.removeLoader('.next-content-overlay-panel-container ');
|
|
92
|
+
this.isLoading = false;
|
|
29
93
|
});
|
|
30
94
|
} catch (error) {
|
|
31
|
-
this.loader.removeLoader();
|
|
95
|
+
this.loader.removeLoader('.next-content-overlay-panel-container ');
|
|
96
|
+
this.isLoading = false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* View the details of the vehicle.
|
|
102
|
+
*
|
|
103
|
+
* @action
|
|
104
|
+
*/
|
|
105
|
+
@action onViewDetails() {
|
|
106
|
+
const isActionOverrided = contextComponentCallback(this, 'onViewDetails', this.vehicle);
|
|
107
|
+
|
|
108
|
+
if (!isActionOverrided) {
|
|
109
|
+
this.contextPanel.focus(this.vehicle, 'viewing');
|
|
32
110
|
}
|
|
33
111
|
}
|
|
34
112
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
113
|
+
/**
|
|
114
|
+
* Handles cancel button press.
|
|
115
|
+
*
|
|
116
|
+
* @action
|
|
117
|
+
* @returns {any}
|
|
118
|
+
*/
|
|
119
|
+
@action onPressCancel() {
|
|
120
|
+
return contextComponentCallback(this, 'onPressCancel', this.vehicle);
|
|
38
121
|
}
|
|
39
122
|
}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
<Overlay @position="right" @noBackdrop={{true}} @fullHeight={{true}} @width="
|
|
1
|
+
<Overlay @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @isResizable={{or this.isResizable @isResizable}} @width={{or this.width @width "600px"}}>
|
|
2
2
|
<Overlay::Header @hideLeftSection={{true}} @actionsWrapperClass="flex-1 flex-col py-3" class="h-auto-i min-h-[127px]">
|
|
3
3
|
<div class="flex flex-row items-center justify-between w-full mb-4">
|
|
4
4
|
<div class="flex flex-1 space-x-2">
|
|
5
|
-
|
|
6
|
-
<Button @type="default" @icon="pen" @helpText="Edit vehicle" @onClick={{this.editVehicle}} />
|
|
5
|
+
<Button @type="default" @icon="pen" @helpText="Edit vehicle" @onClick={{this.onEdit}} />
|
|
7
6
|
</div>
|
|
8
7
|
<div class="flex flex-1 justify-end">
|
|
9
|
-
<Button @type="default" @icon="times" @helpText="Close vehicle details" @onClick={{
|
|
8
|
+
<Button @type="default" @icon="times" @helpText="Close vehicle details" @onClick={{this.onPressCancel}} />
|
|
10
9
|
</div>
|
|
11
10
|
</div>
|
|
12
11
|
<div class="flex flex-row justify-between w-full">
|
|
13
12
|
<div class="flex flex-col flex-1 w-3/4">
|
|
14
13
|
<div class="flex flex-row">
|
|
15
14
|
<div class="w-14 flex items-center justify-center">
|
|
16
|
-
<Image src={{
|
|
15
|
+
<Image src={{this.vehicle.photo_url}} @fallbackSrc={{this.vehicle.avatar_url}} alt={{this.vehicle.name}} height="48" width="48" class="h-12 w-12" />
|
|
17
16
|
<Attach::Tooltip @class="clean" @animation="scale" @placement={{"top"}}>
|
|
18
|
-
<InputInfo @text={{
|
|
17
|
+
<InputInfo @text={{this.vehicle.public_id}} />
|
|
19
18
|
</Attach::Tooltip>
|
|
20
19
|
</div>
|
|
21
20
|
<div class="flex flex-col">
|
|
22
|
-
<h1 class="text-gray-900 dark:text-white text-2xl">{{
|
|
21
|
+
<h1 class="text-gray-900 dark:text-white text-2xl">{{this.vehicle.display_name}}</h1>
|
|
23
22
|
<div class="-mt-1">
|
|
24
|
-
{{#if
|
|
23
|
+
{{#if this.vehicle.driver}}
|
|
25
24
|
<div class="flex flex-row items-center">
|
|
26
|
-
<span class="text-sm dark:text-gray-500 text-gray-700 mr-3">{{
|
|
25
|
+
<span class="text-sm dark:text-gray-500 text-gray-700 mr-3">{{this.vehicle.driver.name}}</span>
|
|
27
26
|
</div>
|
|
28
27
|
{{else}}
|
|
29
28
|
<div class="flex flex-row items-center">
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
</div>
|
|
37
36
|
</div>
|
|
38
37
|
<div class="flex justify-end w-1/4">
|
|
39
|
-
<Badge @status={{
|
|
38
|
+
<Badge @status={{this.vehicle.status}} />
|
|
40
39
|
</div>
|
|
41
40
|
</div>
|
|
42
41
|
</Overlay::Header>
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
<div class="ui-tabs mt-4">
|
|
46
45
|
<nav>
|
|
47
46
|
{{#each this.tabs as |tab|}}
|
|
48
|
-
<a href="javascript:;" class="ui-tab {{if (eq this.
|
|
47
|
+
<a href="javascript:;" class="ui-tab {{if (eq this.tab.slug tab.slug) 'active' }}" {{on "click" (fn this.onTabChanged tab.slug)}}>
|
|
49
48
|
<FaIcon @icon={{tab.icon}} class="mr-1" />
|
|
50
49
|
<span>{{tab.title}}</span>
|
|
51
50
|
</a>
|
|
@@ -53,8 +52,8 @@
|
|
|
53
52
|
</nav>
|
|
54
53
|
</div>
|
|
55
54
|
</div>
|
|
56
|
-
<div class="tab-content tab-{{this.
|
|
57
|
-
{{component this.tab.component vehicle
|
|
55
|
+
<div class="tab-content tab-{{this.tab.slug}}">
|
|
56
|
+
{{component this.tab.component vehicle=this.vehicle tabOptions=this.tab params=this.tab.componentParams}}
|
|
58
57
|
</div>
|
|
59
58
|
</Overlay::Body>
|
|
60
59
|
</Overlay>
|