@fleetbase/fleetops-engine 0.6.54 → 0.6.56
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/admin/map-settings.hbs +1 -1
- package/addon/components/admin/routing-settings.hbs +2 -1
- package/addon/components/cell/attached-vehicle.hbs +10 -0
- package/addon/components/cell/attached-vehicle.js +58 -0
- package/addon/components/cell/device-identity.hbs +24 -0
- package/addon/components/cell/device-identity.js +129 -0
- package/addon/components/cell/driver-identity.hbs +33 -0
- package/addon/components/cell/driver-identity.js +143 -0
- package/addon/components/cell/equipment-identity.hbs +5 -0
- package/addon/components/cell/equipment-identity.js +48 -0
- package/addon/components/cell/part-identity.hbs +5 -0
- package/addon/components/cell/part-identity.js +63 -0
- package/addon/components/cell/telematic-device.hbs +38 -0
- package/addon/components/cell/telematic-device.js +44 -0
- package/addon/components/cell/telematic-provider.hbs +33 -16
- package/addon/components/cell/telematic-provider.js +50 -8
- package/addon/components/cell/vehicle-identity.hbs +33 -0
- package/addon/components/cell/vehicle-identity.js +138 -0
- package/addon/components/device/details.js +1 -1
- package/addon/components/device/form.hbs +2 -2
- package/addon/components/device/form.js +7 -0
- package/addon/components/device/panel-header.hbs +45 -20
- package/addon/components/device/panel-header.js +49 -1
- package/addon/components/device/panel-tabs/events.hbs +30 -0
- package/addon/components/device/panel-tabs/events.js +128 -0
- package/addon/components/device/panel-tabs/sensors.hbs +30 -0
- package/addon/components/device/panel-tabs/sensors.js +93 -0
- package/addon/components/device/panel-tabs/vehicle.hbs +68 -0
- package/addon/components/device/panel-tabs/vehicle.js +90 -0
- package/addon/components/device-event/details.hbs +192 -0
- package/addon/components/device-event/details.js +151 -0
- package/addon/components/driver/schedule.js +1 -1
- package/addon/components/equipment/form.js +8 -1
- package/addon/components/layout/fleet-ops-sidebar.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.js +20 -6
- package/addon/components/map/drawer/device-event-listing.js +2 -0
- package/addon/components/map/drawer/driver-listing.js +2 -0
- package/addon/components/map/drawer/place-listing.js +2 -0
- package/addon/components/map/drawer/position-listing.hbs +11 -6
- package/addon/components/map/drawer/position-listing.js +17 -4
- package/addon/components/map/drawer/vehicle-listing.js +2 -0
- package/addon/components/sensor/panel-header.hbs +47 -15
- package/addon/components/sensor/panel-header.js +59 -1
- package/addon/components/table/cell/dropdown/action-item.hbs +31 -0
- package/addon/components/table/cell/dropdown/action-item.js +62 -0
- package/addon/components/table/cell/dropdown.hbs +28 -0
- package/addon/components/table/cell/dropdown.js +91 -0
- package/addon/components/telematic/details.hbs +1 -1
- package/addon/components/telematic/form.hbs +2 -2
- package/addon/components/telematic/settings.hbs +1 -1
- package/addon/components/vendor/panel-header.hbs +82 -0
- package/addon/components/vendor/panel-header.js +48 -0
- package/addon/controllers/connectivity/devices/index/details/events.js +1 -1
- package/addon/controllers/connectivity/devices/index/details/vehicle.js +50 -2
- package/addon/controllers/connectivity/devices/index.js +144 -129
- package/addon/controllers/connectivity/events/details.js +70 -0
- package/addon/controllers/connectivity/events/index.js +187 -11
- package/addon/controllers/connectivity/sensors/index.js +160 -14
- package/addon/controllers/connectivity/telematics/details/devices.js +126 -134
- package/addon/controllers/connectivity/telematics/details/events.js +1 -1
- package/addon/controllers/connectivity/telematics/details/sensors.js +4 -0
- package/addon/controllers/maintenance/equipment/index.js +1 -2
- package/addon/controllers/maintenance/parts/index.js +1 -2
- package/addon/controllers/management/drivers/index.js +82 -42
- package/addon/controllers/management/fuel-reports/index.js +63 -4
- package/addon/controllers/management/issues/index.js +63 -4
- package/addon/controllers/management/vehicles/index.js +33 -6
- package/addon/controllers/settings/map.js +15 -0
- package/addon/instance-initializers/register-vroom-allocation.js +1 -1
- package/addon/routes/connectivity/devices/index/details/vehicle.js +24 -2
- package/addon/routes/connectivity/devices/index.js +7 -0
- package/addon/routes/connectivity/events/details.js +28 -0
- package/addon/routes/connectivity/events/index.js +6 -2
- package/addon/routes/connectivity/sensors/index.js +7 -2
- package/addon/routes/connectivity/telematics/details/devices.js +2 -0
- package/addon/routes/management/vehicles/index/details.js +3 -1
- package/addon/services/device-actions.js +30 -0
- package/addon/services/device-event-actions.js +1 -1
- package/addon/services/equipment-actions.js +1 -0
- package/addon/services/map-adapter/google.js +25 -0
- package/addon/services/map-adapter/leaflet.js +1 -1
- package/addon/services/map-adapter-interface.js +1 -1
- package/addon/services/map-manager.js +4 -1
- package/addon/services/map-settings.js +15 -0
- package/addon/services/sensor-actions.js +3 -0
- package/addon/services/service-rate-actions.js +39 -1
- package/addon/services/vehicle-actions.js +24 -12
- package/addon/services/vendor-actions.js +3 -0
- package/addon/styles/fleetops-engine.css +9 -1
- package/addon/templates/connectivity/devices/index/details/vehicle.hbs +66 -2
- package/addon/templates/connectivity/events/details.hbs +40 -0
- package/addon/templates/management/vendors/index/details.hbs +2 -2
- package/addon/templates/settings/map.hbs +38 -9
- package/addon/templates/settings/notifications.hbs +2 -1
- package/addon/templates/settings/routing.hbs +1 -0
- package/addon/utils/device-table-columns.js +288 -0
- package/addon/utils/identity-cell-resource.js +20 -0
- package/addon/utils/leaflet-plugin-loader.js +5 -5
- package/addon/utils/map-drawer-dropdown-position.js +47 -0
- package/addon/utils/route-colors.js +1 -1
- package/addon/utils/trackable-option.js +93 -0
- package/app/components/cell/attached-vehicle.js +1 -0
- package/app/components/cell/device-identity.js +1 -0
- package/app/components/cell/driver-identity.js +1 -0
- package/app/components/cell/equipment-identity.js +1 -0
- package/app/components/cell/part-identity.js +1 -0
- package/app/components/cell/telematic-device.js +1 -0
- package/app/components/cell/vehicle-identity.js +1 -0
- package/app/components/device/panel-tabs/events.hbs +30 -0
- package/app/components/device/panel-tabs/events.js +128 -0
- package/app/components/device/panel-tabs/sensors.hbs +30 -0
- package/app/components/device/panel-tabs/sensors.js +93 -0
- package/app/components/device/panel-tabs/vehicle.hbs +68 -0
- package/app/components/device/panel-tabs/vehicle.js +90 -0
- package/app/components/device-event/details.hbs +192 -0
- package/app/components/device-event/details.js +1 -0
- package/app/components/table/cell/dropdown/action-item.js +1 -0
- package/app/components/table/cell/dropdown.js +1 -0
- package/app/components/vendor/panel-header.js +1 -0
- package/app/controllers/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/routes/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/templates/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/utils/map-drawer-dropdown-position.js +1 -0
- package/app/utils/trackable-option.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/migrations/2026_06_23_000001_delete_bad_afaqy_telematics_sensors.php +34 -0
- package/server/src/Console/Commands/SyncTelematics.php +4 -4
- package/server/src/Exports/ContactExport.php +12 -5
- package/server/src/Exports/DeviceExport.php +92 -0
- package/server/src/Exports/DriverExport.php +28 -3
- package/server/src/Exports/EquipmentExport.php +94 -0
- package/server/src/Exports/FleetExport.php +22 -7
- package/server/src/Exports/FuelReportExport.php +16 -1
- package/server/src/Exports/IssueExport.php +25 -3
- package/server/src/Exports/MaintenanceExport.php +106 -0
- package/server/src/Exports/MaintenanceScheduleExport.php +99 -0
- package/server/src/Exports/OrderExport.php +24 -5
- package/server/src/Exports/PartExport.php +99 -0
- package/server/src/Exports/PlaceExport.php +33 -7
- package/server/src/Exports/SensorExport.php +94 -0
- package/server/src/Exports/ServiceAreaExport.php +31 -7
- package/server/src/Exports/ServiceRateExport.php +41 -1
- package/server/src/Exports/TelematicExport.php +90 -0
- package/server/src/Exports/VehicleExport.php +274 -8
- package/server/src/Exports/VendorExport.php +15 -2
- package/server/src/Exports/WorkOrderExport.php +92 -0
- package/server/src/Http/Controllers/Api/v1/Concerns/ResolvesFleetOpsApiResources.php +176 -0
- package/server/src/Http/Controllers/Api/v1/DeviceController.php +225 -0
- package/server/src/Http/Controllers/Api/v1/EquipmentController.php +114 -0
- package/server/src/Http/Controllers/Api/v1/FuelTransactionController.php +185 -0
- package/server/src/Http/Controllers/Api/v1/PartController.php +120 -0
- package/server/src/Http/Controllers/Api/v1/SensorController.php +132 -0
- package/server/src/Http/Controllers/Api/v1/WorkOrderController.php +161 -0
- package/server/src/Http/Controllers/Internal/v1/DeviceController.php +36 -1
- package/server/src/Http/Controllers/Internal/v1/DeviceEventController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/EquipmentController.php +17 -0
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/MaintenanceController.php +17 -0
- package/server/src/Http/Controllers/Internal/v1/MaintenanceScheduleController.php +17 -0
- package/server/src/Http/Controllers/Internal/v1/PartController.php +17 -0
- package/server/src/Http/Controllers/Internal/v1/SensorController.php +18 -0
- package/server/src/Http/Controllers/Internal/v1/ServiceRateController.php +82 -13
- package/server/src/Http/Controllers/Internal/v1/SettingController.php +29 -5
- package/server/src/Http/Controllers/Internal/v1/TelematicController.php +18 -0
- package/server/src/Http/Controllers/Internal/v1/WorkOrderController.php +17 -0
- package/server/src/Http/Filter/DeviceEventFilter.php +21 -0
- package/server/src/Http/Filter/DeviceFilter.php +50 -4
- package/server/src/Http/Filter/EquipmentFilter.php +23 -0
- package/server/src/Http/Filter/FuelProviderTransactionFilter.php +57 -2
- package/server/src/Http/Filter/PartFilter.php +47 -0
- package/server/src/Http/Filter/SensorFilter.php +34 -6
- package/server/src/Http/Filter/WorkOrderFilter.php +23 -0
- package/server/src/Http/Requests/CreateDeviceRequest.php +51 -0
- package/server/src/Http/Requests/CreateEquipmentRequest.php +35 -0
- package/server/src/Http/Requests/CreateFuelTransactionRequest.php +50 -0
- package/server/src/Http/Requests/CreatePartRequest.php +40 -0
- package/server/src/Http/Requests/CreateSensorRequest.php +47 -0
- package/server/src/Http/Requests/CreateWorkOrderRequest.php +42 -0
- package/server/src/Http/Requests/UpdateDeviceRequest.php +7 -0
- package/server/src/Http/Requests/UpdateEquipmentRequest.php +7 -0
- package/server/src/Http/Requests/UpdateFuelTransactionRequest.php +7 -0
- package/server/src/Http/Requests/UpdatePartRequest.php +7 -0
- package/server/src/Http/Requests/UpdateSensorRequest.php +7 -0
- package/server/src/Http/Requests/UpdateWorkOrderRequest.php +7 -0
- package/server/src/Http/Resources/v1/Device.php +72 -0
- package/server/src/Http/Resources/v1/Equipment.php +57 -0
- package/server/src/Http/Resources/v1/FuelTransaction.php +69 -0
- package/server/src/Http/Resources/v1/Index/Vehicle.php +19 -0
- package/server/src/Http/Resources/v1/Part.php +64 -0
- package/server/src/Http/Resources/v1/Sensor.php +68 -0
- package/server/src/Jobs/SyncTelematicDevicesJob.php +194 -38
- package/server/src/Models/Device.php +2 -0
- package/server/src/Models/DeviceEvent.php +81 -0
- package/server/src/Models/Equipment.php +55 -0
- package/server/src/Models/Order.php +2 -1
- package/server/src/Observers/PurchaseRateObserver.php +2 -1
- package/server/src/Support/Analytics/RevenueTrend.php +3 -8
- package/server/src/Support/Metrics/ActiveRevenueQuery.php +121 -0
- package/server/src/Support/Metrics/AvgOrderValueMetric.php +1 -7
- package/server/src/Support/Metrics/EarningsMetric.php +1 -10
- package/server/src/Support/Telematics/Providers/AfaqyProvider.php +105 -5
- package/server/src/Support/Telematics/Providers/FlespiProvider.php +89 -15
- package/server/src/Support/Telematics/Providers/GeotabProvider.php +123 -35
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +567 -47
- package/server/src/Support/Telematics/Providers/SamsaraProvider.php +122 -14
- package/server/src/Support/Telematics/TelematicService.php +28 -9
- package/server/src/routes.php +67 -15
- package/server/tests/DeviceFilterTest.php +9 -0
- package/server/tests/DriverVehicleStatusDefaultTest.php +19 -2
- package/server/tests/EquipmentAssignmentMorphTypeTest.php +35 -0
- package/server/tests/ExportCoverageTest.php +79 -0
- package/server/tests/MetricsRegistryTest.php +45 -5
- package/server/tests/PublicFleetOpsRestEndpointsTest.php +191 -0
- package/server/tests/ServiceRateRouteValidationTest.php +101 -0
- package/server/tests/TelematicsHardeningTest.php +873 -7
- package/addon/controllers/connectivity/events/index/details.js +0 -3
- package/addon/routes/connectivity/events/index/details.js +0 -3
- package/addon/templates/connectivity/events/index/details.hbs +0 -1
|
@@ -23,12 +23,19 @@ class FleetExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
23
23
|
{
|
|
24
24
|
return [
|
|
25
25
|
$fleet->public_id,
|
|
26
|
-
$fleet->internal_id,
|
|
27
26
|
$fleet->name,
|
|
27
|
+
data_get($fleet, 'serviceArea.name'),
|
|
28
|
+
data_get($fleet, 'parentFleet.name'),
|
|
29
|
+
data_get($fleet, 'vendor.name'),
|
|
30
|
+
data_get($fleet, 'zone.name'),
|
|
28
31
|
$fleet->drivers_count,
|
|
32
|
+
$fleet->drivers_online_count,
|
|
29
33
|
$fleet->vehicles_count,
|
|
30
|
-
$fleet->
|
|
34
|
+
$fleet->vehicles_online_count,
|
|
35
|
+
$fleet->task,
|
|
36
|
+
$fleet->status,
|
|
31
37
|
$fleet->created_at,
|
|
38
|
+
$fleet->updated_at,
|
|
32
39
|
];
|
|
33
40
|
}
|
|
34
41
|
|
|
@@ -36,19 +43,27 @@ class FleetExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
36
43
|
{
|
|
37
44
|
return [
|
|
38
45
|
'ID',
|
|
39
|
-
'Internal ID',
|
|
40
46
|
'Name',
|
|
47
|
+
'Service Area',
|
|
48
|
+
'Parent Fleet',
|
|
49
|
+
'Vendor',
|
|
50
|
+
'Zone',
|
|
41
51
|
'Drivers Count',
|
|
52
|
+
'Drivers Online Count',
|
|
42
53
|
'Vehicles Count',
|
|
43
|
-
'
|
|
54
|
+
'Vehicles Online Count',
|
|
55
|
+
'Task',
|
|
56
|
+
'Status',
|
|
44
57
|
'Date Created',
|
|
58
|
+
'Date Updated',
|
|
45
59
|
];
|
|
46
60
|
}
|
|
47
61
|
|
|
48
62
|
public function columnFormats(): array
|
|
49
63
|
{
|
|
50
64
|
return [
|
|
51
|
-
'
|
|
65
|
+
'L' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
66
|
+
'M' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
52
67
|
];
|
|
53
68
|
}
|
|
54
69
|
|
|
@@ -58,9 +73,9 @@ class FleetExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
58
73
|
public function collection()
|
|
59
74
|
{
|
|
60
75
|
if ($this->selections) {
|
|
61
|
-
return Fleet::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->get();
|
|
76
|
+
return Fleet::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['serviceArea', 'parentFleet', 'vendor', 'zone'])->get();
|
|
62
77
|
}
|
|
63
78
|
|
|
64
|
-
return Fleet::where('company_uuid', session('company'))->get();
|
|
79
|
+
return Fleet::where('company_uuid', session('company'))->with(['serviceArea', 'parentFleet', 'vendor', 'zone'])->get();
|
|
65
80
|
}
|
|
66
81
|
}
|
|
@@ -27,9 +27,16 @@ class FuelReportExport implements FromCollection, WithHeadings, WithMapping, Wit
|
|
|
27
27
|
$fuelReport->driver_name,
|
|
28
28
|
$fuelReport->vehicle_name,
|
|
29
29
|
$fuelReport->status,
|
|
30
|
+
$fuelReport->amount,
|
|
31
|
+
$fuelReport->currency,
|
|
30
32
|
$fuelReport->volume,
|
|
33
|
+
$fuelReport->metric_unit,
|
|
31
34
|
$fuelReport->odometer,
|
|
35
|
+
$fuelReport->type,
|
|
36
|
+
$fuelReport->source,
|
|
37
|
+
$fuelReport->provider,
|
|
32
38
|
$fuelReport->created_at,
|
|
39
|
+
$fuelReport->updated_at,
|
|
33
40
|
];
|
|
34
41
|
}
|
|
35
42
|
|
|
@@ -41,16 +48,24 @@ class FuelReportExport implements FromCollection, WithHeadings, WithMapping, Wit
|
|
|
41
48
|
'Driver',
|
|
42
49
|
'Vehicle',
|
|
43
50
|
'Status',
|
|
51
|
+
'Amount',
|
|
52
|
+
'Currency',
|
|
44
53
|
'Volume',
|
|
54
|
+
'Metric Unit',
|
|
45
55
|
'Odometer',
|
|
56
|
+
'Type',
|
|
57
|
+
'Source',
|
|
58
|
+
'Provider',
|
|
46
59
|
'Date Created',
|
|
60
|
+
'Date Updated',
|
|
47
61
|
];
|
|
48
62
|
}
|
|
49
63
|
|
|
50
64
|
public function columnFormats(): array
|
|
51
65
|
{
|
|
52
66
|
return [
|
|
53
|
-
'
|
|
67
|
+
'M' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
68
|
+
'N' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
54
69
|
];
|
|
55
70
|
}
|
|
56
71
|
|
|
@@ -23,15 +23,25 @@ class IssueExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
23
23
|
{
|
|
24
24
|
return [
|
|
25
25
|
$issue->public_id,
|
|
26
|
+
$issue->issue_id,
|
|
27
|
+
$issue->title,
|
|
28
|
+
$issue->report,
|
|
26
29
|
$issue->priority,
|
|
27
30
|
$issue->type,
|
|
28
31
|
$issue->category,
|
|
32
|
+
collect($issue->tags ?? [])->join(', '),
|
|
29
33
|
$issue->reporter_name,
|
|
34
|
+
$issue->reporter_id,
|
|
30
35
|
$issue->assignee_name,
|
|
36
|
+
$issue->assignee_id,
|
|
31
37
|
$issue->driver_name,
|
|
32
38
|
$issue->vehicle_name,
|
|
39
|
+
$issue->vehicle_id,
|
|
40
|
+
data_get($issue, 'order.public_id') ?? data_get($issue, 'order.tracking'),
|
|
33
41
|
$issue->status,
|
|
42
|
+
$issue->resolved_at,
|
|
34
43
|
$issue->created_at,
|
|
44
|
+
$issue->updated_at,
|
|
35
45
|
];
|
|
36
46
|
}
|
|
37
47
|
|
|
@@ -39,22 +49,34 @@ class IssueExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
39
49
|
{
|
|
40
50
|
return [
|
|
41
51
|
'ID',
|
|
52
|
+
'Issue ID',
|
|
53
|
+
'Title',
|
|
54
|
+
'Report',
|
|
42
55
|
'Priority',
|
|
43
56
|
'Type',
|
|
44
57
|
'Category',
|
|
58
|
+
'Tags',
|
|
45
59
|
'Reporter',
|
|
60
|
+
'Reporter ID',
|
|
46
61
|
'Assignee',
|
|
62
|
+
'Assignee ID',
|
|
47
63
|
'Driver',
|
|
48
64
|
'Vehicle',
|
|
65
|
+
'Vehicle ID',
|
|
66
|
+
'Linked Order',
|
|
49
67
|
'Status',
|
|
68
|
+
'Resolved At',
|
|
50
69
|
'Date Created',
|
|
70
|
+
'Date Updated',
|
|
51
71
|
];
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
public function columnFormats(): array
|
|
55
75
|
{
|
|
56
76
|
return [
|
|
57
|
-
'
|
|
77
|
+
'R' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
78
|
+
'S' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
79
|
+
'T' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
58
80
|
];
|
|
59
81
|
}
|
|
60
82
|
|
|
@@ -64,9 +86,9 @@ class IssueExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
64
86
|
public function collection()
|
|
65
87
|
{
|
|
66
88
|
if (!empty($this->selections)) {
|
|
67
|
-
return Issue::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->get();
|
|
89
|
+
return Issue::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['order'])->get();
|
|
68
90
|
}
|
|
69
91
|
|
|
70
|
-
return Issue::where('company_uuid', session('company'))->get();
|
|
92
|
+
return Issue::where('company_uuid', session('company'))->with(['order'])->get();
|
|
71
93
|
}
|
|
72
94
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Exports;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Maintenance;
|
|
6
|
+
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
7
|
+
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
8
|
+
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
9
|
+
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
10
|
+
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
11
|
+
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
12
|
+
|
|
13
|
+
class MaintenanceExport implements FromCollection, WithHeadings, WithMapping, WithColumnFormatting, ShouldAutoSize
|
|
14
|
+
{
|
|
15
|
+
protected array $selections = [];
|
|
16
|
+
|
|
17
|
+
public function __construct(array $selections = [])
|
|
18
|
+
{
|
|
19
|
+
$this->selections = $selections;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public function map($maintenance): array
|
|
23
|
+
{
|
|
24
|
+
return [
|
|
25
|
+
$maintenance->public_id,
|
|
26
|
+
$maintenance->summary,
|
|
27
|
+
$maintenance->maintainable_name,
|
|
28
|
+
$maintenance->performed_by_name,
|
|
29
|
+
$maintenance->work_order_subject,
|
|
30
|
+
$maintenance->type,
|
|
31
|
+
$maintenance->status,
|
|
32
|
+
$maintenance->priority,
|
|
33
|
+
$maintenance->odometer,
|
|
34
|
+
$maintenance->engine_hours,
|
|
35
|
+
$maintenance->scheduled_at,
|
|
36
|
+
$maintenance->started_at,
|
|
37
|
+
$maintenance->completed_at,
|
|
38
|
+
$maintenance->labor_cost,
|
|
39
|
+
$maintenance->parts_cost,
|
|
40
|
+
$maintenance->tax,
|
|
41
|
+
$maintenance->total_cost,
|
|
42
|
+
$maintenance->currency,
|
|
43
|
+
$maintenance->duration_hours,
|
|
44
|
+
$this->yesNo($maintenance->is_overdue),
|
|
45
|
+
$maintenance->days_until_due,
|
|
46
|
+
$maintenance->created_at,
|
|
47
|
+
$maintenance->updated_at,
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public function headings(): array
|
|
52
|
+
{
|
|
53
|
+
return [
|
|
54
|
+
'ID',
|
|
55
|
+
'Summary',
|
|
56
|
+
'Asset',
|
|
57
|
+
'Performed By',
|
|
58
|
+
'Work Order',
|
|
59
|
+
'Type',
|
|
60
|
+
'Status',
|
|
61
|
+
'Priority',
|
|
62
|
+
'Odometer',
|
|
63
|
+
'Engine Hours',
|
|
64
|
+
'Scheduled At',
|
|
65
|
+
'Started At',
|
|
66
|
+
'Completed At',
|
|
67
|
+
'Labor Cost',
|
|
68
|
+
'Parts Cost',
|
|
69
|
+
'Tax',
|
|
70
|
+
'Total Cost',
|
|
71
|
+
'Currency',
|
|
72
|
+
'Duration Hours',
|
|
73
|
+
'Overdue',
|
|
74
|
+
'Days Until Due',
|
|
75
|
+
'Date Created',
|
|
76
|
+
'Date Updated',
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public function columnFormats(): array
|
|
81
|
+
{
|
|
82
|
+
return [
|
|
83
|
+
'K' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
84
|
+
'L' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
85
|
+
'M' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
86
|
+
'V' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
87
|
+
'W' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public function collection()
|
|
92
|
+
{
|
|
93
|
+
$query = Maintenance::where('company_uuid', session('company'))->with(['maintainable', 'performedBy', 'workOrder']);
|
|
94
|
+
|
|
95
|
+
if ($this->selections) {
|
|
96
|
+
$query->whereIn('uuid', $this->selections);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return $query->get();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
protected function yesNo($value): string
|
|
103
|
+
{
|
|
104
|
+
return $value ? 'Yes' : 'No';
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Exports;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\MaintenanceSchedule;
|
|
6
|
+
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
7
|
+
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
8
|
+
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
9
|
+
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
10
|
+
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
11
|
+
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
12
|
+
|
|
13
|
+
class MaintenanceScheduleExport implements FromCollection, WithHeadings, WithMapping, WithColumnFormatting, ShouldAutoSize
|
|
14
|
+
{
|
|
15
|
+
protected array $selections = [];
|
|
16
|
+
|
|
17
|
+
public function __construct(array $selections = [])
|
|
18
|
+
{
|
|
19
|
+
$this->selections = $selections;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public function map($schedule): array
|
|
23
|
+
{
|
|
24
|
+
return [
|
|
25
|
+
$schedule->public_id,
|
|
26
|
+
$schedule->name,
|
|
27
|
+
$schedule->subject_name,
|
|
28
|
+
$schedule->type,
|
|
29
|
+
$schedule->status,
|
|
30
|
+
$schedule->interval_method,
|
|
31
|
+
$schedule->interval_type,
|
|
32
|
+
$schedule->interval_value,
|
|
33
|
+
$schedule->interval_unit,
|
|
34
|
+
$schedule->interval_distance,
|
|
35
|
+
$schedule->interval_engine_hours,
|
|
36
|
+
$schedule->last_service_odometer,
|
|
37
|
+
$schedule->last_service_engine_hours,
|
|
38
|
+
$schedule->last_service_date,
|
|
39
|
+
$schedule->next_due_date,
|
|
40
|
+
$schedule->next_due_odometer,
|
|
41
|
+
$schedule->next_due_engine_hours,
|
|
42
|
+
$schedule->default_priority,
|
|
43
|
+
$schedule->default_assignee_name,
|
|
44
|
+
$schedule->last_triggered_at,
|
|
45
|
+
$schedule->created_at,
|
|
46
|
+
$schedule->updated_at,
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public function headings(): array
|
|
51
|
+
{
|
|
52
|
+
return [
|
|
53
|
+
'ID',
|
|
54
|
+
'Name',
|
|
55
|
+
'Subject',
|
|
56
|
+
'Type',
|
|
57
|
+
'Status',
|
|
58
|
+
'Interval Method',
|
|
59
|
+
'Interval Type',
|
|
60
|
+
'Interval Value',
|
|
61
|
+
'Interval Unit',
|
|
62
|
+
'Interval Distance',
|
|
63
|
+
'Interval Engine Hours',
|
|
64
|
+
'Last Service Odometer',
|
|
65
|
+
'Last Service Engine Hours',
|
|
66
|
+
'Last Service Date',
|
|
67
|
+
'Next Due Date',
|
|
68
|
+
'Next Due Odometer',
|
|
69
|
+
'Next Due Engine Hours',
|
|
70
|
+
'Default Priority',
|
|
71
|
+
'Default Assignee',
|
|
72
|
+
'Last Triggered At',
|
|
73
|
+
'Date Created',
|
|
74
|
+
'Date Updated',
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public function columnFormats(): array
|
|
79
|
+
{
|
|
80
|
+
return [
|
|
81
|
+
'N' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
82
|
+
'O' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
83
|
+
'T' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
84
|
+
'U' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
85
|
+
'V' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public function collection()
|
|
90
|
+
{
|
|
91
|
+
$query = MaintenanceSchedule::where('company_uuid', session('company'))->with(['subject', 'defaultAssignee']);
|
|
92
|
+
|
|
93
|
+
if ($this->selections) {
|
|
94
|
+
$query->whereIn('uuid', $this->selections);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return $query->get();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -21,18 +21,23 @@ class OrderExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
21
21
|
|
|
22
22
|
public function map($order): array
|
|
23
23
|
{
|
|
24
|
-
$order->loadMissing(['trackingNumber', 'payload', 'customer', 'driverAssigned', 'vehicleAssigned']);
|
|
24
|
+
$order->loadMissing(['trackingNumber', 'payload', 'customer', 'facilitator', 'driverAssigned', 'vehicleAssigned']);
|
|
25
25
|
|
|
26
26
|
return [
|
|
27
27
|
$order->public_id,
|
|
28
28
|
data_get($order, 'trackingNumber.tracking_number'),
|
|
29
29
|
$order->internal_id,
|
|
30
|
+
data_get($order, 'payload.public_id'),
|
|
30
31
|
$order->driver_name,
|
|
31
32
|
$order->vehicle_name,
|
|
32
33
|
$order->customer_name,
|
|
34
|
+
$order->facilitator_name,
|
|
33
35
|
collect(data_get($order, 'payload.entities'))->map(function ($entity) {
|
|
34
36
|
return $entity->sku ?? $entity->public_id;
|
|
35
37
|
})->join('|'),
|
|
38
|
+
$order->total_entities,
|
|
39
|
+
$order->transaction_amount,
|
|
40
|
+
$order->transaction_currency,
|
|
36
41
|
$order->pickup_name,
|
|
37
42
|
$order->dropoff_name,
|
|
38
43
|
$order->return_name,
|
|
@@ -40,8 +45,12 @@ class OrderExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
40
45
|
return $waypoint->address;
|
|
41
46
|
})->join('|'),
|
|
42
47
|
$order->scheduled_at,
|
|
48
|
+
$order->type,
|
|
43
49
|
$order->status,
|
|
50
|
+
$order->created_by_name,
|
|
51
|
+
$order->updated_by_name,
|
|
44
52
|
$order->created_at,
|
|
53
|
+
$order->updated_at,
|
|
45
54
|
];
|
|
46
55
|
}
|
|
47
56
|
|
|
@@ -51,25 +60,35 @@ class OrderExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
51
60
|
'ID',
|
|
52
61
|
'Tracking Number',
|
|
53
62
|
'Internal ID',
|
|
63
|
+
'Payload ID',
|
|
54
64
|
'Driver',
|
|
55
65
|
'Vehicle',
|
|
56
66
|
'Customer',
|
|
67
|
+
'Facilitator',
|
|
57
68
|
'SKU',
|
|
69
|
+
'Item Count',
|
|
70
|
+
'Transaction Amount',
|
|
71
|
+
'Transaction Currency',
|
|
58
72
|
'Pick Up',
|
|
59
73
|
'Drop Off',
|
|
60
74
|
'Return',
|
|
61
75
|
'Waypoints',
|
|
62
76
|
'Date Scheduled',
|
|
77
|
+
'Type',
|
|
63
78
|
'Status',
|
|
79
|
+
'Created By',
|
|
80
|
+
'Updated By',
|
|
64
81
|
'Date Created',
|
|
82
|
+
'Date Updated',
|
|
65
83
|
];
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
public function columnFormats(): array
|
|
69
87
|
{
|
|
70
88
|
return [
|
|
71
|
-
'
|
|
72
|
-
'
|
|
89
|
+
'Q' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
90
|
+
'V' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
91
|
+
'W' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
73
92
|
];
|
|
74
93
|
}
|
|
75
94
|
|
|
@@ -79,9 +98,9 @@ class OrderExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
79
98
|
public function collection()
|
|
80
99
|
{
|
|
81
100
|
if (!empty($this->selections)) {
|
|
82
|
-
return Order::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['trackingNumber', 'customer', 'driverAssigned', 'payload'])->get();
|
|
101
|
+
return Order::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['trackingNumber', 'customer', 'facilitator', 'driverAssigned', 'vehicleAssigned', 'payload'])->get();
|
|
83
102
|
}
|
|
84
103
|
|
|
85
|
-
return Order::where('company_uuid', session('company'))->get();
|
|
104
|
+
return Order::where('company_uuid', session('company'))->with(['trackingNumber', 'customer', 'facilitator', 'driverAssigned', 'vehicleAssigned', 'payload'])->get();
|
|
86
105
|
}
|
|
87
106
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Exports;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Part;
|
|
6
|
+
use Maatwebsite\Excel\Concerns\FromCollection;
|
|
7
|
+
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
|
8
|
+
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
|
9
|
+
use Maatwebsite\Excel\Concerns\WithHeadings;
|
|
10
|
+
use Maatwebsite\Excel\Concerns\WithMapping;
|
|
11
|
+
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
|
12
|
+
|
|
13
|
+
class PartExport implements FromCollection, WithHeadings, WithMapping, WithColumnFormatting, ShouldAutoSize
|
|
14
|
+
{
|
|
15
|
+
protected array $selections = [];
|
|
16
|
+
|
|
17
|
+
public function __construct(array $selections = [])
|
|
18
|
+
{
|
|
19
|
+
$this->selections = $selections;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public function map($part): array
|
|
23
|
+
{
|
|
24
|
+
return [
|
|
25
|
+
$part->public_id,
|
|
26
|
+
$part->name,
|
|
27
|
+
$part->sku,
|
|
28
|
+
$part->type,
|
|
29
|
+
$part->status,
|
|
30
|
+
$part->quantity_on_hand,
|
|
31
|
+
$part->unit_cost,
|
|
32
|
+
$part->msrp,
|
|
33
|
+
$part->currency,
|
|
34
|
+
$part->manufacturer,
|
|
35
|
+
$part->model,
|
|
36
|
+
$part->serial_number,
|
|
37
|
+
$part->barcode,
|
|
38
|
+
$part->vendor_name,
|
|
39
|
+
$part->asset_name,
|
|
40
|
+
$part->warranty_name,
|
|
41
|
+
$part->total_value,
|
|
42
|
+
$this->yesNo($part->is_in_stock),
|
|
43
|
+
$this->yesNo($part->is_low_stock),
|
|
44
|
+
$part->created_at,
|
|
45
|
+
$part->updated_at,
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public function headings(): array
|
|
50
|
+
{
|
|
51
|
+
return [
|
|
52
|
+
'ID',
|
|
53
|
+
'Name',
|
|
54
|
+
'Part Number',
|
|
55
|
+
'Type',
|
|
56
|
+
'Status',
|
|
57
|
+
'Quantity On Hand',
|
|
58
|
+
'Unit Cost',
|
|
59
|
+
'MSRP',
|
|
60
|
+
'Currency',
|
|
61
|
+
'Manufacturer',
|
|
62
|
+
'Model',
|
|
63
|
+
'Serial Number',
|
|
64
|
+
'Barcode',
|
|
65
|
+
'Vendor',
|
|
66
|
+
'Asset',
|
|
67
|
+
'Warranty',
|
|
68
|
+
'Total Value',
|
|
69
|
+
'In Stock',
|
|
70
|
+
'Low Stock',
|
|
71
|
+
'Date Created',
|
|
72
|
+
'Date Updated',
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public function columnFormats(): array
|
|
77
|
+
{
|
|
78
|
+
return [
|
|
79
|
+
'T' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
80
|
+
'U' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public function collection()
|
|
85
|
+
{
|
|
86
|
+
$query = Part::where('company_uuid', session('company'))->with(['vendor', 'warranty', 'asset']);
|
|
87
|
+
|
|
88
|
+
if ($this->selections) {
|
|
89
|
+
$query->whereIn('uuid', $this->selections);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return $query->get();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
protected function yesNo($value): string
|
|
96
|
+
{
|
|
97
|
+
return $value ? 'Yes' : 'No';
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -25,11 +25,21 @@ class PlaceExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
25
25
|
$place->public_id,
|
|
26
26
|
$place->name,
|
|
27
27
|
$place->phone,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
$this->upper($place->address),
|
|
29
|
+
$place->street1,
|
|
30
|
+
$place->street2,
|
|
31
|
+
$this->upper($place->city),
|
|
32
|
+
$this->upper($place->province),
|
|
30
33
|
$place->postal_code,
|
|
31
|
-
|
|
34
|
+
$place->neighborhood,
|
|
35
|
+
$place->district,
|
|
36
|
+
$place->building,
|
|
37
|
+
$place->security_access_code,
|
|
38
|
+
$this->upper($place->country_name),
|
|
39
|
+
data_get($place, 'owner.name') ?? data_get($place, 'owner.public_id'),
|
|
40
|
+
$place->type,
|
|
32
41
|
$place->created_at,
|
|
42
|
+
$place->updated_at,
|
|
33
43
|
];
|
|
34
44
|
}
|
|
35
45
|
|
|
@@ -40,10 +50,20 @@ class PlaceExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
40
50
|
'Name',
|
|
41
51
|
'Phone',
|
|
42
52
|
'Address',
|
|
53
|
+
'Street 1',
|
|
54
|
+
'Street 2',
|
|
43
55
|
'City',
|
|
56
|
+
'Province',
|
|
44
57
|
'Postal Code',
|
|
58
|
+
'Neighborhood',
|
|
59
|
+
'District',
|
|
60
|
+
'Building',
|
|
61
|
+
'Security Access Code',
|
|
45
62
|
'Country',
|
|
63
|
+
'Owner',
|
|
64
|
+
'Type',
|
|
46
65
|
'Date Created',
|
|
66
|
+
'Date Updated',
|
|
47
67
|
];
|
|
48
68
|
}
|
|
49
69
|
|
|
@@ -51,20 +71,26 @@ class PlaceExport implements FromCollection, WithHeadings, WithMapping, WithColu
|
|
|
51
71
|
{
|
|
52
72
|
return [
|
|
53
73
|
'C' => '+#',
|
|
54
|
-
'
|
|
55
|
-
'
|
|
74
|
+
'I' => NumberFormat::FORMAT_GENERAL,
|
|
75
|
+
'P' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
76
|
+
'Q' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
56
77
|
];
|
|
57
78
|
}
|
|
58
79
|
|
|
80
|
+
protected function upper($value): ?string
|
|
81
|
+
{
|
|
82
|
+
return $value ? strtoupper($value) : null;
|
|
83
|
+
}
|
|
84
|
+
|
|
59
85
|
/**
|
|
60
86
|
* @return \Illuminate\Support\Collection
|
|
61
87
|
*/
|
|
62
88
|
public function collection()
|
|
63
89
|
{
|
|
64
90
|
if ($this->selections) {
|
|
65
|
-
return Place::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->get();
|
|
91
|
+
return Place::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['owner'])->get();
|
|
66
92
|
}
|
|
67
93
|
|
|
68
|
-
return Place::where('company_uuid', session('company'))->get();
|
|
94
|
+
return Place::where('company_uuid', session('company'))->with(['owner'])->get();
|
|
69
95
|
}
|
|
70
96
|
}
|