@fleetbase/fleetops-engine 0.6.63 → 0.6.65
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/RELEASE.md +7 -6
- package/addon/components/attachment-list.hbs +65 -0
- package/addon/components/attachment-list.js +8 -0
- package/addon/components/cell/attached-vehicle.hbs +1 -1
- package/addon/components/cell/attached-vehicle.js +3 -3
- package/addon/components/cell/driver-identity.js +4 -4
- package/addon/components/cell/driver-name.hbs +1 -1
- package/addon/components/cell/translated-value.hbs +9 -0
- package/addon/components/cell/translated-value.js +57 -0
- package/addon/components/contact/card.hbs +58 -0
- package/addon/components/contact/card.js +19 -0
- package/addon/components/contact/form.hbs +1 -1
- package/addon/components/contact/panel-header.hbs +1 -1
- package/addon/components/customer/form.hbs +2 -2
- package/addon/components/device/manager.hbs +26 -28
- package/addon/components/device/manager.js +28 -2
- package/addon/components/device/panel-tabs/vehicle.hbs +13 -13
- package/addon/components/device/panel-tabs/vehicle.js +8 -0
- package/addon/components/driver/card.hbs +24 -13
- package/addon/components/driver/card.js +20 -6
- package/addon/components/driver/form.hbs +3 -3
- package/addon/components/driver/panel-header.hbs +2 -2
- package/addon/components/driver/pill.hbs +2 -2
- package/addon/components/equipment/form.js +11 -4
- package/addon/components/equipment/pill.hbs +20 -0
- package/addon/components/equipment/pill.js +3 -0
- package/addon/components/filter/multi-model.hbs +19 -0
- package/addon/components/filter/multi-model.js +90 -0
- package/addon/components/fleet/driver-listing.hbs +1 -1
- package/addon/components/fleet/vehicle-listing.hbs +1 -1
- package/addon/components/fleet-panel/driver-listing.hbs +1 -1
- package/addon/components/fleet-panel/vehicle-listing.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.js +9 -7
- package/addon/components/maintenance/form.js +12 -4
- package/addon/components/maintenance-schedule/form.js +13 -7
- package/addon/components/map/leaflet-live-map.hbs +52 -0
- package/addon/components/map/order-list-overlay/order.hbs +4 -4
- package/addon/components/modals/attach-equipment.hbs +22 -0
- package/addon/components/modals/attach-equipment.js +3 -0
- package/addon/components/modals/attach-telematic-device.hbs +13 -8
- package/addon/components/modals/attach-telematic-device.js +11 -1
- package/addon/components/modals/attach-trailer.hbs +30 -0
- package/addon/components/modals/attach-trailer.js +3 -0
- package/addon/components/modals/contact-form.hbs +2 -2
- package/addon/components/modals/convert-customer-to-vendor.hbs +1 -1
- package/addon/components/modals/driver-form.hbs +2 -2
- package/addon/components/modals/select-trailer.hbs +35 -0
- package/addon/components/modals/select-trailer.js +3 -0
- package/addon/components/modals/vehicle-form.hbs +2 -2
- package/addon/components/orchestrator/resource-panel.hbs +2 -2
- package/addon/components/order/customer-avatar-stack.hbs +2 -2
- package/addon/components/order/details/detail.hbs +4 -4
- package/addon/components/order/details/payload.hbs +2 -2
- package/addon/components/order/kanban-card.hbs +4 -4
- package/addon/components/order-list-overlay/order.hbs +4 -4
- package/addon/components/trailer/card.hbs +68 -0
- package/addon/components/trailer/card.js +22 -0
- package/addon/components/trailer/details/connections.hbs +57 -0
- package/addon/components/trailer/details/connections.js +59 -0
- package/addon/components/trailer/details/equipment.hbs +25 -0
- package/addon/components/trailer/details/equipment.js +52 -0
- package/addon/components/trailer/details/maintenance-history.hbs +47 -0
- package/addon/components/trailer/details/maintenance-history.js +40 -0
- package/addon/components/trailer/details/schedules.hbs +45 -0
- package/addon/components/trailer/details/schedules.js +40 -0
- package/addon/components/trailer/details/work-orders.hbs +47 -0
- package/addon/components/trailer/details/work-orders.js +40 -0
- package/addon/components/trailer/details.hbs +399 -0
- package/addon/components/trailer/details.js +118 -0
- package/addon/components/trailer/form.hbs +447 -0
- package/addon/components/trailer/form.js +165 -0
- package/addon/components/trailer/panel-header.hbs +45 -0
- package/addon/components/trailer/panel-header.js +3 -0
- package/addon/components/trailer/pill.hbs +21 -0
- package/addon/components/trailer/pill.js +3 -0
- package/addon/components/vehicle/card.hbs +42 -11
- package/addon/components/vehicle/card.js +31 -0
- package/addon/components/vehicle/details/equipment.hbs +25 -0
- package/addon/components/vehicle/details/equipment.js +55 -0
- package/addon/components/vehicle/details/trailers.hbs +35 -0
- package/addon/components/vehicle/details/trailers.js +55 -0
- package/addon/components/vehicle/form.hbs +2 -2
- package/addon/components/vehicle/panel-header.hbs +2 -2
- package/addon/components/vehicle/pill.hbs +2 -2
- package/addon/components/vendor/card.hbs +58 -0
- package/addon/components/vendor/card.js +6 -0
- package/addon/components/vendor/panel-header.hbs +2 -2
- package/addon/components/vendor/personnel-manager.hbs +2 -2
- package/addon/components/work-order/form.js +12 -4
- package/addon/controllers/connectivity/devices/index/details/vehicle.js +11 -0
- package/addon/controllers/connectivity/devices/index/details.js +3 -3
- package/addon/controllers/connectivity/devices/index.js +1 -0
- package/addon/controllers/connectivity/telematics/details/attachments.js +28 -47
- package/addon/controllers/connectivity/telematics/details/devices.js +1 -0
- package/addon/controllers/management/contacts/customers.js +4 -0
- package/addon/controllers/management/contacts/index.js +32 -0
- package/addon/controllers/management/trailers/index/details.js +119 -0
- package/addon/controllers/management/trailers/index/edit.js +67 -0
- package/addon/controllers/management/trailers/index/new.js +43 -0
- package/addon/controllers/management/trailers/index.js +599 -0
- package/addon/controllers/management/vehicles/index/details.js +16 -0
- package/addon/controllers/management/vehicles/index.js +78 -4
- package/addon/controllers/management/vendors/index.js +32 -0
- package/addon/controllers/operations/orders/index.js +3 -1
- package/addon/controllers/settings/custom-fields.js +8 -0
- package/addon/extension.js +7 -0
- package/addon/helpers/placeholder-image.js +6 -0
- package/addon/helpers/resource-image.js +10 -0
- package/addon/helpers/trailer-placeholder-image.js +6 -0
- package/addon/routes/management/trailers/index/details/connections.js +2 -0
- package/addon/routes/management/trailers/index/details/devices.js +2 -0
- package/addon/routes/management/trailers/index/details/equipment.js +2 -0
- package/addon/routes/management/trailers/index/details/index.js +2 -0
- package/addon/routes/management/trailers/index/details/maintenance-history.js +2 -0
- package/addon/routes/management/trailers/index/details/positions.js +2 -0
- package/addon/routes/management/trailers/index/details/schedules.js +2 -0
- package/addon/routes/management/trailers/index/details/work-orders.js +2 -0
- package/addon/routes/management/trailers/index/details.js +30 -0
- package/addon/routes/management/trailers/index/edit.js +23 -0
- package/addon/routes/management/trailers/index/new.js +14 -0
- package/addon/routes/management/trailers/index.js +42 -0
- package/addon/routes/management/vehicles/index/details/trailers.js +2 -0
- package/addon/routes/management/vehicles/index.js +7 -1
- package/addon/routes.js +17 -0
- package/addon/services/device-actions.js +26 -16
- package/addon/services/trailer-actions.js +394 -0
- package/addon/services/vehicle-actions.js +111 -0
- package/addon/styles/fleetops-engine.css +349 -0
- package/addon/templates/connectivity/devices/index/details/vehicle.hbs +19 -19
- package/addon/templates/connectivity/telematics/details/attachments.hbs +15 -15
- package/addon/templates/management/contacts/customers.hbs +48 -29
- package/addon/templates/management/contacts/index.hbs +52 -33
- package/addon/templates/management/trailers/index/details/connections.hbs +1 -0
- package/addon/templates/management/trailers/index/details/devices.hbs +1 -0
- package/addon/templates/management/trailers/index/details/equipment.hbs +1 -0
- package/addon/templates/management/trailers/index/details/index.hbs +1 -0
- package/addon/templates/management/trailers/index/details/maintenance-history.hbs +1 -0
- package/addon/templates/management/trailers/index/details/positions.hbs +1 -0
- package/addon/templates/management/trailers/index/details/schedules.hbs +1 -0
- package/addon/templates/management/trailers/index/details/work-orders.hbs +1 -0
- package/addon/templates/management/trailers/index/details.hbs +15 -0
- package/addon/templates/management/trailers/index/edit.hbs +12 -0
- package/addon/templates/management/trailers/index/new.hbs +11 -0
- package/addon/templates/management/trailers/index.hbs +67 -0
- package/addon/templates/management/vehicles/index/details/equipment.hbs +1 -1
- package/addon/templates/management/vehicles/index/details/trailers.hbs +1 -0
- package/addon/templates/management/vehicles/index/details.hbs +1 -1
- package/addon/templates/management/vendors/index.hbs +66 -32
- package/addon/utils/device-table-columns.js +10 -6
- package/addon/utils/live-map-card-content.js +56 -0
- package/addon/utils/placeholder-images.js +71 -0
- package/addon/utils/trailer-placeholder-image.js +11 -0
- package/app/components/attachment-list.js +1 -0
- package/app/components/cell/translated-value.js +1 -0
- package/app/components/contact/card.js +1 -0
- package/app/components/equipment/pill.js +1 -0
- package/app/components/filter/multi-model.js +1 -0
- package/app/components/modals/attach-equipment.js +1 -0
- package/app/components/modals/attach-trailer.js +1 -0
- package/app/components/modals/select-trailer.js +1 -0
- package/app/components/trailer/card.js +1 -0
- package/app/components/trailer/details/connections.js +1 -0
- package/app/components/trailer/details/equipment.js +1 -0
- package/app/components/trailer/details/maintenance-history.js +1 -0
- package/app/components/trailer/details/schedules.js +1 -0
- package/app/components/trailer/details/work-orders.js +1 -0
- package/app/components/trailer/details.js +1 -0
- package/app/components/trailer/form.js +1 -0
- package/app/components/trailer/panel-header.js +1 -0
- package/app/components/trailer/pill.js +1 -0
- package/app/components/vehicle/details/equipment.js +1 -0
- package/app/components/vehicle/details/trailers.js +1 -0
- package/app/components/vendor/card.js +1 -0
- package/app/controllers/management/trailers/index/details.js +1 -0
- package/app/controllers/management/trailers/index/edit.js +1 -0
- package/app/controllers/management/trailers/index/new.js +1 -0
- package/app/controllers/management/trailers/index.js +1 -0
- package/app/helpers/placeholder-image.js +1 -0
- package/app/helpers/resource-image.js +1 -0
- package/app/helpers/trailer-placeholder-image.js +1 -0
- package/app/routes/management/trailers/index/details/connections.js +1 -0
- package/app/routes/management/trailers/index/details/devices.js +1 -0
- package/app/routes/management/trailers/index/details/equipment.js +1 -0
- package/app/routes/management/trailers/index/details/index.js +1 -0
- package/app/routes/management/trailers/index/details/maintenance-history.js +1 -0
- package/app/routes/management/trailers/index/details/positions.js +1 -0
- package/app/routes/management/trailers/index/details/schedules.js +1 -0
- package/app/routes/management/trailers/index/details/work-orders.js +1 -0
- package/app/routes/management/trailers/index/details.js +1 -0
- package/app/routes/management/trailers/index/edit.js +1 -0
- package/app/routes/management/trailers/index/new.js +1 -0
- package/app/routes/management/trailers/index.js +1 -0
- package/app/routes/management/vehicles/index/details/trailers.js +1 -0
- package/app/services/trailer-actions.js +1 -0
- package/app/templates/management/trailers/index/details/connections.js +1 -0
- package/app/templates/management/trailers/index/details/devices.js +1 -0
- package/app/templates/management/trailers/index/details/equipment.js +1 -0
- package/app/templates/management/trailers/index/details/index.js +1 -0
- package/app/templates/management/trailers/index/details/maintenance-history.js +1 -0
- package/app/templates/management/trailers/index/details/positions.js +1 -0
- package/app/templates/management/trailers/index/details/schedules.js +1 -0
- package/app/templates/management/trailers/index/details/work-orders.js +1 -0
- package/app/templates/management/trailers/index/details.js +1 -0
- package/app/templates/management/trailers/index/edit.js +1 -0
- package/app/templates/management/trailers/index/new.js +1 -0
- package/app/templates/management/trailers/index.js +1 -0
- package/app/templates/management/vehicles/index/details/trailers.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +1 -1
- package/server/migrations/2026_09_03_000001_add_first_class_trailer_columns_to_assets_table.php +58 -0
- package/server/migrations/2026_09_03_000002_create_asset_connections_table.php +43 -0
- package/server/migrations/2026_09_03_000003_create_device_installations_table.php +33 -0
- package/server/src/Auth/Schemas/FleetOps.php +7 -0
- package/server/src/Events/TrailerLocationChanged.php +70 -0
- package/server/src/Exceptions/DeviceAlreadyAttachedException.php +18 -0
- package/server/src/Exports/TrailerExport.php +31 -0
- package/server/src/Http/Controllers/Api/v1/Concerns/ResolvesFleetOpsApiResources.php +8 -2
- package/server/src/Http/Controllers/Api/v1/DeviceController.php +22 -15
- package/server/src/Http/Controllers/Api/v1/EquipmentController.php +47 -0
- package/server/src/Http/Controllers/Api/v1/TrailerController.php +362 -0
- package/server/src/Http/Controllers/Api/v1/VehicleController.php +1 -0
- package/server/src/Http/Controllers/Internal/v1/DeviceController.php +3 -0
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/SearchController.php +16 -0
- package/server/src/Http/Controllers/Internal/v1/TrailerController.php +360 -0
- package/server/src/Http/Controllers/Internal/v1/VehicleController.php +74 -0
- package/server/src/Http/Filter/EquipmentFilter.php +51 -0
- package/server/src/Http/Filter/OrderFilter.php +15 -0
- package/server/src/Http/Filter/TrailerFilter.php +269 -0
- package/server/src/Http/Filter/VehicleFilter.php +70 -3
- package/server/src/Http/Requests/CreateDeviceRequest.php +1 -1
- package/server/src/Http/Requests/CreateEquipmentRequest.php +1 -1
- package/server/src/Http/Requests/CreateTrailerRequest.php +54 -0
- package/server/src/Http/Requests/UpdateTrailerRequest.php +7 -0
- package/server/src/Http/Resources/v1/AssetConnection.php +90 -0
- package/server/src/Http/Resources/v1/Concerns/ResolvesPublicRelationFields.php +29 -3
- package/server/src/Http/Resources/v1/Device.php +3 -1
- package/server/src/Http/Resources/v1/Equipment.php +3 -1
- package/server/src/Http/Resources/v1/Fleet.php +3 -1
- package/server/src/Http/Resources/v1/Index/Vehicle.php +10 -0
- package/server/src/Http/Resources/v1/Trailer.php +199 -0
- package/server/src/Http/Resources/v1/Vehicle.php +2 -0
- package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +3 -0
- package/server/src/Imports/TrailerImport.php +33 -0
- package/server/src/Models/Asset.php +39 -10
- package/server/src/Models/AssetConnection.php +43 -0
- package/server/src/Models/Device.php +39 -8
- package/server/src/Models/DeviceInstallation.php +27 -0
- package/server/src/Models/Equipment.php +2 -0
- package/server/src/Models/Trailer.php +181 -0
- package/server/src/Models/Vehicle.php +13 -0
- package/server/src/Providers/FleetOpsServiceProvider.php +4 -2
- package/server/src/Support/Ai/FleetOpsAiQueryResources.php +22 -0
- package/server/src/Support/Reporting/FleetOpsReportSchema.php +38 -0
- package/server/src/Support/Telematics/TelematicService.php +35 -0
- package/server/src/Support/TrailerSummary.php +35 -0
- package/server/src/routes.php +29 -0
- package/server/tests/CompactResourceSerializationTest.php +36 -0
- package/server/tests/ControllerFilterContractsTest.php +29 -0
- package/server/tests/Feature/Http/Api/DeviceControllerContractsTest.php +30 -13
- package/server/tests/Feature/Http/Api/TrailerControllerLifecycleTest.php +640 -0
- package/server/tests/Feature/Http/Api/VehiclePublicContractTest.php +23 -0
- package/server/tests/Feature/Http/Internal/DeviceControllerContractsTest.php +20 -5
- package/server/tests/Feature/Http/Internal/LiveControllerEndpointsTest.php +19 -0
- package/server/tests/ModelAccessorContractsTest.php +10 -0
- package/server/tests/OrderFilterExecutionTest.php +5 -0
- package/server/tests/PublicApiControllerInputContractsTest.php +11 -0
- package/server/tests/PublicFleetOpsRestEndpointsTest.php +15 -3
- package/server/tests/ReportSchemaContractsTest.php +4 -0
- package/server/tests/TelematicsHardeningTest.php +4 -2
- package/server/tests/TrailerSupportCoverageTest.php +524 -0
- package/server/tests/Unit/Http/Resources/FleetResourceTest.php +17 -0
- package/server/tests/Unit/Http/Resources/IndexVehicleResourceTest.php +35 -0
- package/server/tests/Unit/Models/EquipmentTest.php +22 -0
- package/server/tests/Unit/Models/ModelLookupFallbackSeamsTest.php +7 -3
- package/server/tests/Unit/Models/TrailerTest.php +204 -0
- package/server/tests/Unit/Support/Telematics/TelematicServiceTelemetryTest.php +93 -0
- package/server/tests/VehicleControllerHelperContractsTest.php +14 -0
- package/server/tests/VehicleResourceContractsTest.php +39 -0
- package/translations/ar-ae.yml +396 -0
- package/translations/bg-bg.yaml +424 -0
- package/translations/en-us.yaml +423 -0
- package/translations/es-pa.yaml +425 -0
- package/translations/fr-fr.yaml +424 -0
- package/translations/mn-mn.yaml +424 -0
- package/translations/pt-br.yaml +424 -0
- package/translations/ru-ru.yaml +424 -0
- package/translations/vi-vn.yaml +435 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<Layout::Resource::Card ...attributes as |Card|>
|
|
1
|
+
<Layout::Resource::Card class="fleetops-resource-card driver-card" ...attributes as |Card|>
|
|
2
2
|
<Card.header class="{{@headerClass}}">
|
|
3
3
|
<RegistryYield @registry="fleet-ops:component:driver:card:header:start" as |RegistryComponent|>
|
|
4
4
|
<RegistryComponent @order={{@resource}} @resource={{@resource}} />
|
|
5
5
|
</RegistryYield>
|
|
6
|
-
<div class="
|
|
6
|
+
<div class="fleetops-card-title">
|
|
7
7
|
<div class="font-semibold flex-1 truncate" data-test-driver-name>{{or @resource.name @resource.display_name}}</div>
|
|
8
|
-
<FaIcon @icon="circle" @size="xs" class="
|
|
8
|
+
<FaIcon @icon="circle" @size="xs" class="fleetops-card-title-indicator {{if @resource.online 'text-green-500' 'text-gray-400'}}" data-test-driver-online-indicator />
|
|
9
9
|
</div>
|
|
10
10
|
<div class="text-gray-400 dark:text-gray-500 text-sm w-full truncate">{{n-a @resource.phone @resource.public_id}}</div>
|
|
11
11
|
{{#if (has-block "header")}}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</RegistryYield>
|
|
17
17
|
</Card.header>
|
|
18
18
|
<Card.body class="{{@bodyClass}} h-40 overflow-hidden">
|
|
19
|
-
<Image src={{
|
|
19
|
+
<Image src={{resource-image @resource.photo_url "driver"}} @fallbackSrc={{(placeholder-image "driver")}} alt={{or @resource.name @resource.display_name}} class="fleetops-card-image fleetops-card-image--cover" data-test-driver-photo />
|
|
20
20
|
{{#if (has-block "body")}}
|
|
21
21
|
{{yield to="body"}}
|
|
22
22
|
{{/if}}
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
<RegistryComponent @order={{@resource}} @resource={{@resource}} />
|
|
27
27
|
</RegistryYield>
|
|
28
28
|
<div class="flex flex-row items-center justify-between w-full">
|
|
29
|
-
<Badge @status={{or this.statusValue "default"}} @size="xs" data-test-driver-status-badge
|
|
29
|
+
<Badge @status={{or this.statusValue "default"}} @text={{this.statusLabel}} @size="xs" data-test-driver-status-badge />
|
|
30
30
|
<div class="flex flex-row items-center space-x-1">
|
|
31
|
-
<Button @icon="eye" @size="xs" @onClick={{fn this.driverActions.transition.view @resource}} />
|
|
32
|
-
<Button @icon="pencil" @size="xs" @onClick={{fn this.driverActions.transition.edit @resource}} />
|
|
33
|
-
<Button @icon="trash" @size="xs" @type="danger" @onClick={{fn this.driverActions.delete @resource}} />
|
|
31
|
+
<Button @icon="eye" @size="xs" @helpText={{t "common.view"}} @onClick={{fn this.driverActions.transition.view @resource}} @permission="fleet-ops view driver" />
|
|
32
|
+
<Button @icon="pencil" @size="xs" @helpText={{t "common.edit"}} @onClick={{fn this.driverActions.transition.edit @resource}} @permission="fleet-ops update driver" />
|
|
33
|
+
<Button @icon="trash" @size="xs" @type="danger" @helpText={{t "common.delete"}} @onClick={{fn this.driverActions.delete @resource}} @permission="fleet-ops delete driver" />
|
|
34
34
|
</div>
|
|
35
35
|
</div>
|
|
36
36
|
<RegistryYield @registry="fleet-ops:component:driver:card:footer:end" as |RegistryComponent|>
|
|
@@ -39,11 +39,22 @@
|
|
|
39
39
|
{{#if (has-block "footer")}}
|
|
40
40
|
{{yield to="footer"}}
|
|
41
41
|
{{/if}}
|
|
42
|
-
<div class="
|
|
43
|
-
<div class="
|
|
44
|
-
<FaIcon @icon="car" @prefix="fas"
|
|
42
|
+
<div class="fleetops-card-meta-list">
|
|
43
|
+
<div class="fleetops-card-meta">
|
|
44
|
+
<FaIcon @icon="car" @prefix="fas" />
|
|
45
|
+
<span class="fleetops-card-meta-value">
|
|
46
|
+
{{#if this.assignedVehicleLabel}}
|
|
47
|
+
{{#if this.hasVehicle}}
|
|
48
|
+
<a href="javascript:;" class="fleetops-card-meta-link" {{on "click" this.viewVehicle}}>{{this.assignedVehicleLabel}}</a>
|
|
49
|
+
{{else}}
|
|
50
|
+
{{this.assignedVehicleLabel}}
|
|
51
|
+
{{/if}}
|
|
52
|
+
{{else}}
|
|
53
|
+
{{t "common.no-vehicle-assigned"}}
|
|
54
|
+
{{/if}}
|
|
55
|
+
</span>
|
|
45
56
|
</div>
|
|
46
|
-
<div class="
|
|
57
|
+
<div class="fleetops-card-meta">{{t "common.last-modified"}}: {{@resource.updatedAt}}</div>
|
|
47
58
|
</div>
|
|
48
59
|
</Card.footer>
|
|
49
|
-
</Layout::Resource::Card>
|
|
60
|
+
</Layout::Resource::Card>
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { inject as service } from '@ember/service';
|
|
3
|
-
import { get } from '@ember/object';
|
|
4
|
-
import config from 'ember-get-config';
|
|
3
|
+
import { action, get } from '@ember/object';
|
|
5
4
|
|
|
6
5
|
export default class DriverCardComponent extends Component {
|
|
7
6
|
@service driverActions;
|
|
7
|
+
@service vehicleActions;
|
|
8
8
|
|
|
9
9
|
get resource() {
|
|
10
10
|
return this.args.resource;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
get fallbackImage() {
|
|
14
|
-
return config?.defaultValues?.driverImage;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
13
|
get statusValue() {
|
|
18
14
|
return get(this.resource, 'status') ?? '';
|
|
19
15
|
}
|
|
@@ -27,4 +23,22 @@ export default class DriverCardComponent extends Component {
|
|
|
27
23
|
|
|
28
24
|
return get(driver, 'vehicle_assigned.display_name') ?? get(driver, 'vehicle.display_name') ?? get(driver, 'vehicle_name');
|
|
29
25
|
}
|
|
26
|
+
|
|
27
|
+
get hasVehicle() {
|
|
28
|
+
return Boolean(get(this.resource, 'vehicle_uuid') ?? get(this.resource, 'vehicle_assigned') ?? get(this.resource, 'vehicle'));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@action async viewVehicle() {
|
|
32
|
+
const vehicle = (await get(this.resource, 'vehicle')) ?? get(this.resource, 'vehicle_assigned');
|
|
33
|
+
|
|
34
|
+
if (!vehicle) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (this.vehicleActions.panel?.view) {
|
|
39
|
+
return this.vehicleActions.panel.view(vehicle);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return this.vehicleActions.transition.view(vehicle);
|
|
43
|
+
}
|
|
30
44
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
>
|
|
17
17
|
<div class="flex flex-row">
|
|
18
18
|
<div class="mr-2 w-6">
|
|
19
|
-
<Image src={{model.avatar_url}} @fallbackSrc={{
|
|
19
|
+
<Image src={{resource-image model.avatar_url "contact"}} @fallbackSrc={{(placeholder-image "contact")}} alt={{model.name}} class="w-6 h-6 rounded-md" />
|
|
20
20
|
</div>
|
|
21
21
|
<div class="flex flex-col">
|
|
22
22
|
<div class="font-semibold">{{model.name}}</div>
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
<div class="flex flex-row space-x-3 mb-3">
|
|
53
53
|
<div class="flex items-center justify-start rounded-full">
|
|
54
54
|
<Image
|
|
55
|
-
src={{@resource.photo_url}}
|
|
56
|
-
@fallbackSrc={{
|
|
55
|
+
src={{resource-image @resource.photo_url "driver"}}
|
|
56
|
+
@fallbackSrc={{(placeholder-image "driver")}}
|
|
57
57
|
alt={{@resource.name}}
|
|
58
58
|
height="48"
|
|
59
59
|
width="48"
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
<div class="flex flex-row space-x-3">
|
|
4
4
|
<div class="flex items-start justify-start rounded-full">
|
|
5
5
|
<Image
|
|
6
|
-
src={{@resource.photo_url}}
|
|
7
|
-
@fallbackSrc={{
|
|
6
|
+
src={{resource-image @resource.photo_url "driver"}}
|
|
7
|
+
@fallbackSrc={{(placeholder-image "driver")}}
|
|
8
8
|
alt={{@resource.name}}
|
|
9
9
|
height="48"
|
|
10
10
|
width="48"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<Pill
|
|
2
2
|
@resource={{this.resource}}
|
|
3
|
-
@imageSrc={{
|
|
3
|
+
@imageSrc={{resource-image this.resource.photo_url "driver"}}
|
|
4
4
|
@titleFallback={{or @titleFallback "No driver"}}
|
|
5
5
|
@subtitle={{n-a this.resource.phone (if this.resource "No phone" "-")}}
|
|
6
|
-
@
|
|
6
|
+
@imageFallback={{(placeholder-image "driver")}}
|
|
7
7
|
@showOnlineIndicator={{if this.resource true false}}
|
|
8
8
|
@onClick={{@onClick}}
|
|
9
9
|
@anchorClass={{@anchorClass}}
|
|
@@ -11,20 +11,24 @@ import { task } from 'ember-concurrency';
|
|
|
11
11
|
const TYPE_TO_MODEL = {
|
|
12
12
|
'fleet-ops:vehicle': 'vehicle',
|
|
13
13
|
'fleet-ops:driver': 'driver',
|
|
14
|
+
'fleet-ops:trailer': 'trailer',
|
|
14
15
|
'Fleetbase\\FleetOps\\Models\\Vehicle': 'vehicle',
|
|
15
16
|
'Fleetbase\\FleetOps\\Models\\Driver': 'driver',
|
|
17
|
+
'Fleetbase\\FleetOps\\Models\\Trailer': 'trailer',
|
|
16
18
|
'fleet-ops:equipment': 'equipment',
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
const TYPE_TO_OPTION_VALUE = {
|
|
20
22
|
'Fleetbase\\FleetOps\\Models\\Vehicle': 'fleet-ops:vehicle',
|
|
21
23
|
'Fleetbase\\FleetOps\\Models\\Driver': 'fleet-ops:driver',
|
|
24
|
+
'Fleetbase\\FleetOps\\Models\\Trailer': 'fleet-ops:trailer',
|
|
22
25
|
};
|
|
23
26
|
|
|
24
27
|
export default class EquipmentFormComponent extends Component {
|
|
25
28
|
@service fetch;
|
|
26
29
|
@service currentUser;
|
|
27
30
|
@service notifications;
|
|
31
|
+
@service intl;
|
|
28
32
|
|
|
29
33
|
/** Equipment type options. */
|
|
30
34
|
equipmentTypeOptions = ['ppe', 'refrigeration_unit', 'tool', 'liftgate', 'ramp', 'container', 'pallet_jack', 'forklift', 'safety_equipment', 'communication_device', 'other'];
|
|
@@ -36,10 +40,13 @@ export default class EquipmentFormComponent extends Component {
|
|
|
36
40
|
* Polymorphic equipable type options — the asset this equipment is attached to.
|
|
37
41
|
* Each entry has a `value` (stored on the model) and a `label` (displayed in the UI).
|
|
38
42
|
*/
|
|
39
|
-
equipableTypeOptions
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
get equipableTypeOptions() {
|
|
44
|
+
return [
|
|
45
|
+
{ value: 'fleet-ops:vehicle', label: this.intl.t('resource.vehicle') },
|
|
46
|
+
{ value: 'fleet-ops:trailer', label: this.intl.t('resource.trailer') },
|
|
47
|
+
{ value: 'fleet-ops:driver', label: this.intl.t('resource.driver') },
|
|
48
|
+
];
|
|
49
|
+
}
|
|
43
50
|
|
|
44
51
|
/** Derived Ember Data model name for the currently selected equipable type. */
|
|
45
52
|
@tracked equipableModelName = null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{{#let (or @equipment @resource) as |resource|}}
|
|
2
|
+
<Pill
|
|
3
|
+
@resource={{resource}}
|
|
4
|
+
@imageSrc={{resource.photo_url}}
|
|
5
|
+
@fallbackImageType="placeholderImage"
|
|
6
|
+
@noTooltip={{true}}
|
|
7
|
+
@onClick={{@onClick}}
|
|
8
|
+
@anchorClass={{@anchorClass}}
|
|
9
|
+
@imageClass={{@imageClass}}
|
|
10
|
+
@imageWrapperClass={{@imageWrapperClass}}
|
|
11
|
+
@contentWrapperClass="min-w-0 {{@contentWrapperClass}}"
|
|
12
|
+
...attributes
|
|
13
|
+
>
|
|
14
|
+
<div class="text-sm truncate {{@titleClass}}">{{or resource.name resource.public_id}}</div>
|
|
15
|
+
<div class="text-xs text-gray-400 dark:text-gray-500 truncate {{@subtitleClass}}">
|
|
16
|
+
{{#if resource.type}}{{smart-humanize resource.type}}{{/if}}
|
|
17
|
+
{{#if (or resource.serial_number resource.code)}}<span class="mx-1">·</span>{{or resource.serial_number resource.code}}{{/if}}
|
|
18
|
+
</div>
|
|
19
|
+
</Pill>
|
|
20
|
+
{{/let}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="filter-multi-model flex flex-row items-center" ...attributes>
|
|
2
|
+
<ModelSelectMultiple
|
|
3
|
+
@modelName={{@filter.model}}
|
|
4
|
+
@query={{@filter.query}}
|
|
5
|
+
@optionLabel={{or @filter.modelNamePath "name"}}
|
|
6
|
+
@selectedModel={{this.selectedModels}}
|
|
7
|
+
@placeholder={{@placeholder}}
|
|
8
|
+
@triggerClass="form-select form-input form-input-sm flex-1"
|
|
9
|
+
@infiniteScroll={{false}}
|
|
10
|
+
@renderInPlace={{true}}
|
|
11
|
+
@onChange={{this.onChange}}
|
|
12
|
+
as |model|
|
|
13
|
+
>
|
|
14
|
+
{{get model (or @filter.modelNamePath "name")}}
|
|
15
|
+
</ModelSelectMultiple>
|
|
16
|
+
<button type="button" class="clear-button" disabled={{not this.selectedModels.length}} aria-label={{t "common.clear"}} {{on "click" this.clear}}>
|
|
17
|
+
<FaIcon @icon="times" />
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { tracked } from '@glimmer/tracking';
|
|
3
|
+
import { action } from '@ember/object';
|
|
4
|
+
import { inject as service } from '@ember/service';
|
|
5
|
+
import { isArray } from '@ember/array';
|
|
6
|
+
import { task } from 'ember-concurrency';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Table filter that selects several records of one model (drivers, trailers,
|
|
10
|
+
* devices). The filter value travels as a comma-separated list of ids so it
|
|
11
|
+
* survives the URL round trip; the matching records are re-fetched on init so
|
|
12
|
+
* the chips show names rather than ids after a reload.
|
|
13
|
+
*/
|
|
14
|
+
export default class FilterMultiModelComponent extends Component {
|
|
15
|
+
@service store;
|
|
16
|
+
@tracked selectedModels = [];
|
|
17
|
+
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.restoreSelection.perform(this.args.value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get modelName() {
|
|
24
|
+
return this.args.filter?.model;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
parseIds(value) {
|
|
28
|
+
if (isArray(value)) {
|
|
29
|
+
return value.filter(Boolean);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof value === 'string' && value.trim()) {
|
|
33
|
+
return value
|
|
34
|
+
.split(',')
|
|
35
|
+
.map((id) => id.trim())
|
|
36
|
+
.filter(Boolean);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@task *restoreSelection(value) {
|
|
43
|
+
const ids = this.parseIds(value);
|
|
44
|
+
|
|
45
|
+
if (!ids.length || !this.modelName) {
|
|
46
|
+
this.selectedModels = [];
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const records = [];
|
|
51
|
+
|
|
52
|
+
for (const id of ids) {
|
|
53
|
+
try {
|
|
54
|
+
records.push(this.store.peekRecord(this.modelName, id) ?? (yield this.store.findRecord(this.modelName, id)));
|
|
55
|
+
} catch {
|
|
56
|
+
// An id that no longer resolves simply drops out of the chips.
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
this.selectedModels = records.filter(Boolean);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@action onChange(selection) {
|
|
64
|
+
const { onChange, onClear, filter } = this.args;
|
|
65
|
+
const models = isArray(selection) ? selection : [];
|
|
66
|
+
|
|
67
|
+
this.selectedModels = models;
|
|
68
|
+
|
|
69
|
+
if (!models.length) {
|
|
70
|
+
if (typeof onClear === 'function') {
|
|
71
|
+
onClear(filter);
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof onChange === 'function') {
|
|
77
|
+
onChange(filter, models.map((model) => model.id).join(','));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@action clear() {
|
|
82
|
+
const { onClear, filter } = this.args;
|
|
83
|
+
|
|
84
|
+
this.selectedModels = [];
|
|
85
|
+
|
|
86
|
+
if (typeof onClear === 'function') {
|
|
87
|
+
onClear(filter);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<div class="flex flex-row items-start">
|
|
60
60
|
<div class="mr-2">
|
|
61
61
|
<div class="relative">
|
|
62
|
-
<Image src={{driver.photo_url}} alt={{driver.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{
|
|
62
|
+
<Image src={{resource-image driver.photo_url "driver"}} alt={{driver.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{(placeholder-image "driver")}} />
|
|
63
63
|
<FaIcon @icon="circle" class="absolute right-0 top-0 -mr-1 -mt-1 {{if driver.online 'text-green-500' 'text-yellow-200'}}" />
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
<div class="flex flex-row items-start">
|
|
60
60
|
<div class="mr-2">
|
|
61
61
|
<div class="relative">
|
|
62
|
-
<Image src={{vehicle.photo_url}} alt={{vehicle.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{
|
|
62
|
+
<Image src={{resource-image vehicle.photo_url "vehicle"}} alt={{vehicle.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{(placeholder-image "vehicle")}} />
|
|
63
63
|
<FaIcon @icon="circle" class="absolute right-0 top-0 -mr-1 -mt-1 {{if vehicle.online 'text-green-500' 'text-yellow-200'}}" />
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<div class="flex flex-row items-start">
|
|
58
58
|
<div class="mr-2">
|
|
59
59
|
<div class="relative">
|
|
60
|
-
<Image src={{driver.photo_url}} alt={{driver.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{
|
|
60
|
+
<Image src={{resource-image driver.photo_url "driver"}} alt={{driver.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{(placeholder-image "driver")}} />
|
|
61
61
|
<FaIcon @icon="circle" class="absolute right-0 top-0 -mr-1 -mt-1 {{if driver.online 'text-green-500' 'text-yellow-200'}}" />
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<div class="flex flex-row items-start">
|
|
58
58
|
<div class="mr-2">
|
|
59
59
|
<div class="relative">
|
|
60
|
-
<Image src={{vehicle.photo_url}} alt={{vehicle.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{
|
|
60
|
+
<Image src={{resource-image vehicle.photo_url "vehicle"}} alt={{vehicle.name}} class="w-5 h-5 rounded-md" @fallbackSrc={{(placeholder-image "vehicle")}} />
|
|
61
61
|
<FaIcon @icon="circle" class="absolute right-0 top-0 -mr-1 -mt-1 {{if vehicle.online 'text-green-500' 'text-yellow-200'}}" />
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
@@ -142,6 +142,7 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
|
|
|
142
142
|
]),
|
|
143
143
|
this.createItem('menu.drivers', 'id-card', 'management.drivers', 'fleet-ops list driver', 'fleet-ops see driver', ['driver', 'online drivers']),
|
|
144
144
|
this.createItem('menu.vehicles', 'truck', 'management.vehicles', 'fleet-ops list vehicle', 'fleet-ops see vehicle', ['vehicle', 'track vehicles', 'online vehicles']),
|
|
145
|
+
this.createItem('menu.trailers', 'trailer', 'management.trailers', 'fleet-ops list trailer', 'fleet-ops see trailer', ['trailer', 'towed asset', 'reefer', 'flatbed']),
|
|
145
146
|
this.createItem('menu.fleets', 'user-group', 'management.fleets', 'fleet-ops list fleet', 'fleet-ops see fleet', ['fleet', 'teams']),
|
|
146
147
|
this.createItem('menu.vendors', 'warehouse', 'management.vendors', 'fleet-ops list vendor', 'fleet-ops see vendor'),
|
|
147
148
|
this.createItem('menu.contacts', 'address-book', 'management.contacts', 'fleet-ops list contact', 'fleet-ops see contact'),
|
|
@@ -346,13 +347,14 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
|
|
|
346
347
|
'management.index': 0,
|
|
347
348
|
'management.drivers': 1,
|
|
348
349
|
'management.vehicles': 2,
|
|
349
|
-
'management.
|
|
350
|
-
'management.
|
|
351
|
-
'management.
|
|
352
|
-
'management.
|
|
353
|
-
'management.
|
|
354
|
-
'management.fuel-
|
|
355
|
-
'management.
|
|
350
|
+
'management.trailers': 3,
|
|
351
|
+
'management.fleets': 4,
|
|
352
|
+
'management.vendors': 5,
|
|
353
|
+
'management.contacts': 6,
|
|
354
|
+
'management.places': 7,
|
|
355
|
+
'management.fuel-reports': 8,
|
|
356
|
+
'management.fuel-transactions': 9,
|
|
357
|
+
'management.issues': 10,
|
|
356
358
|
'maintenance.index': 0,
|
|
357
359
|
'maintenance.schedules': 1,
|
|
358
360
|
'maintenance.work-orders': 2,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import Component from '@glimmer/component';
|
|
2
2
|
import { tracked } from '@glimmer/tracking';
|
|
3
3
|
import { action } from '@ember/object';
|
|
4
|
+
import { inject as service } from '@ember/service';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Maps a polymorphic type value to the Ember Data model name used by ModelSelect.
|
|
7
8
|
*/
|
|
8
9
|
const TYPE_TO_MODEL = {
|
|
9
10
|
'fleet-ops:vehicle': 'vehicle',
|
|
11
|
+
'fleet-ops:trailer': 'trailer',
|
|
10
12
|
'fleet-ops:driver': 'driver',
|
|
11
13
|
'fleet-ops:equipment': 'equipment',
|
|
12
14
|
'fleet-ops:vendor': 'vendor',
|
|
@@ -20,9 +22,11 @@ const TYPE_TO_MODEL = {
|
|
|
20
22
|
*/
|
|
21
23
|
const MAINTAINABLE_MODEL_TO_TYPE = {
|
|
22
24
|
'maintenance-subject-vehicle': 'fleet-ops:vehicle',
|
|
25
|
+
'maintenance-subject-trailer': 'fleet-ops:trailer',
|
|
23
26
|
'maintenance-subject-equipment': 'fleet-ops:equipment',
|
|
24
27
|
// Fall-through for raw models passed from vehicle-actions.js
|
|
25
28
|
vehicle: 'fleet-ops:vehicle',
|
|
29
|
+
trailer: 'fleet-ops:trailer',
|
|
26
30
|
equipment: 'fleet-ops:equipment',
|
|
27
31
|
};
|
|
28
32
|
|
|
@@ -40,6 +44,7 @@ const PERFORMED_BY_MODEL_TO_TYPE = {
|
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
export default class MaintenanceFormComponent extends Component {
|
|
47
|
+
@service intl;
|
|
43
48
|
/** Maintenance type options — the category of maintenance activity. */
|
|
44
49
|
maintenanceTypeOptions = ['preventive', 'corrective', 'predictive', 'routine', 'emergency', 'inspection', 'repair', 'replacement', 'calibration'];
|
|
45
50
|
|
|
@@ -54,10 +59,13 @@ export default class MaintenanceFormComponent extends Component {
|
|
|
54
59
|
* Uses label/value objects so the PowerSelect trigger shows a human-readable
|
|
55
60
|
* label instead of the raw model type string.
|
|
56
61
|
*/
|
|
57
|
-
maintainableTypeOptions
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
get maintainableTypeOptions() {
|
|
63
|
+
return [
|
|
64
|
+
{ value: 'fleet-ops:vehicle', label: this.intl.t('resource.vehicle') },
|
|
65
|
+
{ value: 'fleet-ops:trailer', label: this.intl.t('resource.trailer') },
|
|
66
|
+
{ value: 'fleet-ops:equipment', label: this.intl.t('resource.equipment') },
|
|
67
|
+
];
|
|
68
|
+
}
|
|
61
69
|
|
|
62
70
|
/**
|
|
63
71
|
* Polymorphic performed-by type options — who carried out the maintenance.
|
|
@@ -2,12 +2,14 @@ import Component from '@glimmer/component';
|
|
|
2
2
|
import { tracked } from '@glimmer/tracking';
|
|
3
3
|
import { isArray } from '@ember/array';
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
|
+
import { inject as service } from '@ember/service';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Maps a polymorphic type string to the Ember Data model name used by ModelSelect.
|
|
8
9
|
*/
|
|
9
10
|
const TYPE_TO_MODEL = {
|
|
10
11
|
'fleet-ops:vehicle': 'vehicle',
|
|
12
|
+
'fleet-ops:trailer': 'trailer',
|
|
11
13
|
'fleet-ops:equipment': 'equipment',
|
|
12
14
|
'fleet-ops:vendor': 'vendor',
|
|
13
15
|
'fleet-ops:contact': 'contact',
|
|
@@ -21,9 +23,11 @@ const TYPE_TO_MODEL = {
|
|
|
21
23
|
*/
|
|
22
24
|
const MODEL_TO_TYPE = {
|
|
23
25
|
'maintenance-subject-vehicle': 'fleet-ops:vehicle',
|
|
26
|
+
'maintenance-subject-trailer': 'fleet-ops:trailer',
|
|
24
27
|
'maintenance-subject-equipment': 'fleet-ops:equipment',
|
|
25
28
|
// Fall-through for raw vehicle/equipment models passed from vehicle-actions.js
|
|
26
29
|
vehicle: 'fleet-ops:vehicle',
|
|
30
|
+
trailer: 'fleet-ops:trailer',
|
|
27
31
|
equipment: 'fleet-ops:equipment',
|
|
28
32
|
vendor: 'fleet-ops:vendor',
|
|
29
33
|
contact: 'fleet-ops:contact',
|
|
@@ -44,11 +48,6 @@ const ASSIGNEE_MODEL_TO_TYPE = {
|
|
|
44
48
|
driver: 'fleet-ops:driver',
|
|
45
49
|
};
|
|
46
50
|
|
|
47
|
-
const SUBJECT_TYPE_OPTIONS = [
|
|
48
|
-
{ label: 'Vehicle', value: 'fleet-ops:vehicle' },
|
|
49
|
-
{ label: 'Equipment', value: 'fleet-ops:equipment' },
|
|
50
|
-
];
|
|
51
|
-
|
|
52
51
|
const ASSIGNEE_TYPE_OPTIONS = [
|
|
53
52
|
{ label: 'Vendor', value: 'fleet-ops:vendor' },
|
|
54
53
|
{ label: 'Contact', value: 'fleet-ops:contact' },
|
|
@@ -62,6 +61,7 @@ const INTERVAL_METHOD_OPTIONS = [
|
|
|
62
61
|
];
|
|
63
62
|
|
|
64
63
|
export default class MaintenanceScheduleFormComponent extends Component {
|
|
64
|
+
@service intl;
|
|
65
65
|
@tracked selectedSubjectType = null;
|
|
66
66
|
@tracked selectedAssigneeType = null;
|
|
67
67
|
@tracked subjectModelName = null;
|
|
@@ -70,7 +70,13 @@ export default class MaintenanceScheduleFormComponent extends Component {
|
|
|
70
70
|
@tracked reminderOffsets = [];
|
|
71
71
|
@tracked newReminderOffset = '';
|
|
72
72
|
|
|
73
|
-
subjectTypeOptions
|
|
73
|
+
get subjectTypeOptions() {
|
|
74
|
+
return [
|
|
75
|
+
{ label: this.intl.t('resource.vehicle'), value: 'fleet-ops:vehicle' },
|
|
76
|
+
{ label: this.intl.t('resource.trailer'), value: 'fleet-ops:trailer' },
|
|
77
|
+
{ label: this.intl.t('resource.equipment'), value: 'fleet-ops:equipment' },
|
|
78
|
+
];
|
|
79
|
+
}
|
|
74
80
|
assigneeTypeOptions = ASSIGNEE_TYPE_OPTIONS;
|
|
75
81
|
intervalMethodOptions = INTERVAL_METHOD_OPTIONS;
|
|
76
82
|
|
|
@@ -103,7 +109,7 @@ export default class MaintenanceScheduleFormComponent extends Component {
|
|
|
103
109
|
const modelName = subject.constructor?.modelName ?? subject.modelName;
|
|
104
110
|
const typeValue = MODEL_TO_TYPE[modelName] ?? null;
|
|
105
111
|
if (typeValue) {
|
|
106
|
-
this.selectedSubjectType =
|
|
112
|
+
this.selectedSubjectType = this.subjectTypeOptions.find((o) => o.value === typeValue) ?? null;
|
|
107
113
|
this.subjectModelName = TYPE_TO_MODEL[typeValue] ?? null;
|
|
108
114
|
}
|
|
109
115
|
}
|
|
@@ -229,6 +229,32 @@
|
|
|
229
229
|
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">Driver</div>
|
|
230
230
|
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">{{n-a vehicle.driver_name}}</div>
|
|
231
231
|
</div>
|
|
232
|
+
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
233
|
+
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">{{t "resource.trailers"}}</div>
|
|
234
|
+
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">
|
|
235
|
+
{{#each vehicle.trailers as |trailer|}}
|
|
236
|
+
<div class="flex items-center gap-1 min-w-0">
|
|
237
|
+
<span class="inline-block w-1.5 h-1.5 rounded-full shrink-0 {{if trailer.online 'bg-green-400' 'bg-gray-500'}}"></span>
|
|
238
|
+
<span class="truncate">{{or trailer.displayName trailer.display_name trailer.name trailer.public_id}}</span>
|
|
239
|
+
</div>
|
|
240
|
+
{{else}}
|
|
241
|
+
-
|
|
242
|
+
{{/each}}
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
246
|
+
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">{{t "resource.devices"}}</div>
|
|
247
|
+
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">
|
|
248
|
+
{{#each vehicle.devices as |device|}}
|
|
249
|
+
<div class="flex items-center gap-1 min-w-0">
|
|
250
|
+
<span class="inline-block w-1.5 h-1.5 rounded-full shrink-0 {{if device.online 'bg-green-400' 'bg-gray-500'}}"></span>
|
|
251
|
+
<span class="truncate">{{or device.displayName device.display_name device.name device.device_id device.public_id}}</span>
|
|
252
|
+
</div>
|
|
253
|
+
{{else}}
|
|
254
|
+
-
|
|
255
|
+
{{/each}}
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
232
258
|
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
233
259
|
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">Order</div>
|
|
234
260
|
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">{{n-a vehicle.meta.current_order_reference}}</div>
|
|
@@ -276,6 +302,32 @@
|
|
|
276
302
|
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">Driver</div>
|
|
277
303
|
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">{{n-a vehicle.driver_name}}</div>
|
|
278
304
|
</div>
|
|
305
|
+
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
306
|
+
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">{{t "resource.trailers"}}</div>
|
|
307
|
+
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">
|
|
308
|
+
{{#each vehicle.trailers as |trailer|}}
|
|
309
|
+
<div class="flex items-center gap-1 min-w-0">
|
|
310
|
+
<span class="inline-block w-1.5 h-1.5 rounded-full shrink-0 {{if trailer.online 'bg-green-400' 'bg-gray-500'}}"></span>
|
|
311
|
+
<span class="truncate">{{or trailer.displayName trailer.display_name trailer.name trailer.public_id}}</span>
|
|
312
|
+
</div>
|
|
313
|
+
{{else}}
|
|
314
|
+
-
|
|
315
|
+
{{/each}}
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
319
|
+
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">{{t "resource.devices"}}</div>
|
|
320
|
+
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">
|
|
321
|
+
{{#each vehicle.devices as |device|}}
|
|
322
|
+
<div class="flex items-center gap-1 min-w-0">
|
|
323
|
+
<span class="inline-block w-1.5 h-1.5 rounded-full shrink-0 {{if device.online 'bg-green-400' 'bg-gray-500'}}"></span>
|
|
324
|
+
<span class="truncate">{{or device.displayName device.display_name device.name device.device_id device.public_id}}</span>
|
|
325
|
+
</div>
|
|
326
|
+
{{else}}
|
|
327
|
+
-
|
|
328
|
+
{{/each}}
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
279
331
|
<div class="rounded bg-gray-900 shadow-md px-1.5 py-1 min-w-0">
|
|
280
332
|
<div class="text-[9px] font-semibold uppercase text-gray-400 leading-none">Order</div>
|
|
281
333
|
<div class="text-[11px] text-white leading-tight whitespace-normal break-words">{{n-a vehicle.meta.current_order_reference}}</div>
|
|
@@ -75,8 +75,8 @@
|
|
|
75
75
|
<div class="resource-assigned">
|
|
76
76
|
<div class="resource-assigned-photo">
|
|
77
77
|
<Image
|
|
78
|
-
src={{
|
|
79
|
-
@fallbackSrc={{
|
|
78
|
+
src={{resource-image @order.customer.photo_url "customer"}}
|
|
79
|
+
@fallbackSrc={{(placeholder-image "customer")}}
|
|
80
80
|
width="32"
|
|
81
81
|
height="32"
|
|
82
82
|
class="w-8 h-8 rounded-lg shadow-sm mr-2"
|
|
@@ -94,8 +94,8 @@
|
|
|
94
94
|
<div class="resource-assigned">
|
|
95
95
|
<div class="resource-assigned-photo">
|
|
96
96
|
<Image
|
|
97
|
-
src={{
|
|
98
|
-
@fallbackSrc={{
|
|
97
|
+
src={{resource-image @order.driver_assigned.photo_url "driver"}}
|
|
98
|
+
@fallbackSrc={{(placeholder-image "driver")}}
|
|
99
99
|
width="32"
|
|
100
100
|
height="32"
|
|
101
101
|
class="w-8 h-8 rounded-lg shadow-sm mr-2"
|