@fleetbase/fleetops-engine 0.6.55 → 0.6.57
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/ai/create-order-preview.hbs +297 -0
- package/addon/components/ai/create-order-preview.js +362 -0
- package/addon/components/ai/route-preview-map.hbs +79 -0
- package/addon/components/ai/route-preview-map.js +527 -0
- package/addon/components/device/details.js +1 -1
- 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/fleet/details.hbs +21 -8
- package/addon/components/fleet/details.js +55 -1
- package/addon/components/fleet/hierarchy-tree.hbs +137 -0
- package/addon/components/fleet/hierarchy-tree.js +528 -0
- package/addon/components/layout/fleet-ops-sidebar.js +15 -9
- package/addon/components/map/drawer/device-event-listing.js +1 -0
- package/addon/components/map/drawer/driver-listing.js +1 -0
- package/addon/components/map/drawer/place-listing.js +1 -0
- package/addon/components/map/drawer/vehicle-listing.js +1 -0
- package/addon/components/order/details.hbs +34 -1
- package/addon/components/order/form/details.hbs +4 -0
- package/addon/components/order/form.hbs +9 -1
- 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/vehicle/card.hbs +14 -2
- package/addon/components/vehicle/form.hbs +13 -1
- package/addon/controllers/connectivity/devices/index/details/events.js +1 -1
- package/addon/controllers/connectivity/devices/index/details/vehicle.js +2 -2
- package/addon/controllers/connectivity/events/details.js +68 -1
- package/addon/controllers/connectivity/sensors/index.js +4 -0
- package/addon/controllers/connectivity/telematics/details/events.js +1 -1
- package/addon/controllers/connectivity/telematics/details/sensors.js +4 -0
- package/addon/controllers/settings/map.js +19 -0
- package/addon/extension.js +14 -0
- package/addon/instance-initializers/register-vroom-allocation.js +1 -1
- package/addon/routes/connectivity/events/details.js +26 -1
- package/addon/routes/management/fleets/index/details.js +1 -1
- package/addon/routes/management/vehicles/index/details.js +3 -1
- package/addon/services/map-adapter/google.js +66 -1
- package/addon/services/map-adapter/leaflet.js +1 -1
- package/addon/services/map-adapter-interface.js +1 -1
- package/addon/services/map-manager.js +16 -1
- package/addon/services/map-settings.js +15 -0
- package/addon/styles/fleetops-engine.css +487 -1
- package/addon/templates/connectivity/devices/index/details/vehicle.hbs +2 -1
- package/addon/templates/connectivity/events/details.hbs +40 -1
- package/addon/templates/settings/map.hbs +38 -9
- package/addon/utils/leaflet-plugin-loader.js +5 -5
- package/addon/utils/map-drawer-dropdown-position.js +11 -13
- package/addon/utils/route-colors.js +1 -1
- package/app/components/ai/create-order-preview.js +1 -0
- package/app/components/ai/route-preview-map.js +1 -0
- package/app/components/device-event/details.hbs +192 -0
- package/app/components/device-event/details.js +1 -0
- package/app/components/fleet/hierarchy-tree.js +1 -0
- package/app/services/route-engine.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +6 -4
- package/scripts/normalize-rgba-alpha.js +90 -0
- package/server/migrations/2026_06_23_000001_delete_bad_afaqy_telematics_sensors.php +34 -0
- 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 +18 -0
- package/server/src/Http/Controllers/Internal/v1/EquipmentController.php +17 -0
- 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/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/DeviceFilter.php +33 -10
- 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/Fleet.php +8 -2
- package/server/src/Http/Resources/v1/FuelTransaction.php +69 -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/Driver.php +6 -0
- package/server/src/Models/Order.php +20 -7
- package/server/src/Models/Place.php +11 -3
- package/server/src/Observers/PurchaseRateObserver.php +2 -1
- package/server/src/Providers/FleetOpsServiceProvider.php +26 -0
- package/server/src/Support/Ai/Capabilities/AbstractFleetOpsAICapability.php +88 -0
- package/server/src/Support/Ai/Capabilities/AssetStatusCapability.php +108 -0
- package/server/src/Support/Ai/Capabilities/ConsoleNavigationCapability.php +55 -0
- package/server/src/Support/Ai/Capabilities/CreateOrderPreviewCapability.php +508 -0
- package/server/src/Support/Ai/Capabilities/DocsHelpCapability.php +49 -0
- package/server/src/Support/Ai/Capabilities/ImportOrdersPreviewCapability.php +66 -0
- package/server/src/Support/Ai/Capabilities/OperationalQueryCapability.php +319 -0
- package/server/src/Support/Ai/Capabilities/OptimizeOrderRouteCapability.php +240 -0
- package/server/src/Support/Ai/Capabilities/OrderInsightsCapability.php +95 -0
- package/server/src/Support/Ai/Capabilities/SearchResourcesCapability.php +195 -0
- package/server/src/Support/Ai/FleetOpsAiQueryResources.php +150 -0
- 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 +104 -5
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +550 -54
- package/server/src/Support/Telematics/TelematicService.php +28 -9
- package/server/src/Support/Utils.php +52 -0
- package/server/src/routes.php +67 -14
- package/server/tests/AiCreateOrderPreviewCapabilityTest.php +131 -0
- package/server/tests/AiOperationalQueryCapabilityTest.php +75 -0
- package/server/tests/ExportCoverageTest.php +79 -0
- package/server/tests/FleetHierarchyResourceTest.php +12 -0
- package/server/tests/MetricsRegistryTest.php +45 -5
- package/server/tests/OrderPayloadPlaceResolutionTest.php +53 -0
- package/server/tests/PointResolutionTest.php +63 -0
- package/server/tests/PublicFleetOpsRestEndpointsTest.php +191 -0
- package/server/tests/TelematicsHardeningTest.php +636 -1
- package/addon/components/table/cell/dropdown/action-item.hbs +0 -31
- package/addon/components/table/cell/dropdown/action-item.js +0 -62
- package/addon/components/table/cell/dropdown.hbs +0 -28
- package/addon/components/table/cell/dropdown.js +0 -91
- package/app/components/table/cell/dropdown/action-item.js +0 -1
- package/app/components/table/cell/dropdown.js +0 -1
|
@@ -25,12 +25,21 @@ class DriverExport implements FromCollection, WithHeadings, WithMapping, WithCol
|
|
|
25
25
|
$driver->public_id,
|
|
26
26
|
$driver->internal_id,
|
|
27
27
|
$driver->name,
|
|
28
|
+
$driver->email,
|
|
28
29
|
$driver->vendor_name,
|
|
29
30
|
$driver->vehicle_name,
|
|
30
31
|
$driver->phone,
|
|
31
32
|
$driver->drivers_license_number,
|
|
33
|
+
$driver->license_expiry,
|
|
32
34
|
$driver->country,
|
|
35
|
+
$driver->city,
|
|
36
|
+
$driver->currency,
|
|
37
|
+
$this->yesNo($driver->online),
|
|
38
|
+
$driver->status,
|
|
39
|
+
$driver->orders()->count(),
|
|
40
|
+
data_get($driver, 'currentOrder.tracking') ?? data_get($driver, 'currentOrder.public_id'),
|
|
33
41
|
$driver->created_at,
|
|
42
|
+
$driver->updated_at,
|
|
34
43
|
];
|
|
35
44
|
}
|
|
36
45
|
|
|
@@ -40,32 +49,48 @@ class DriverExport implements FromCollection, WithHeadings, WithMapping, WithCol
|
|
|
40
49
|
'ID',
|
|
41
50
|
'Internal ID',
|
|
42
51
|
'Name',
|
|
52
|
+
'Email',
|
|
43
53
|
'Vendor',
|
|
44
54
|
'Vehicle',
|
|
45
55
|
'Phone',
|
|
46
56
|
'License #',
|
|
57
|
+
'License Expiry',
|
|
47
58
|
'Country',
|
|
59
|
+
'City',
|
|
60
|
+
'Currency',
|
|
61
|
+
'Online',
|
|
62
|
+
'Status',
|
|
63
|
+
'Assigned Orders Count',
|
|
64
|
+
'Current Order',
|
|
48
65
|
'Date Created',
|
|
66
|
+
'Date Updated',
|
|
49
67
|
];
|
|
50
68
|
}
|
|
51
69
|
|
|
52
70
|
public function columnFormats(): array
|
|
53
71
|
{
|
|
54
72
|
return [
|
|
55
|
-
'
|
|
73
|
+
'G' => '+#',
|
|
56
74
|
'I' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
75
|
+
'Q' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
76
|
+
'R' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
57
77
|
];
|
|
58
78
|
}
|
|
59
79
|
|
|
80
|
+
protected function yesNo($value): string
|
|
81
|
+
{
|
|
82
|
+
return $value ? 'Yes' : 'No';
|
|
83
|
+
}
|
|
84
|
+
|
|
60
85
|
/**
|
|
61
86
|
* @return \Illuminate\Support\Collection
|
|
62
87
|
*/
|
|
63
88
|
public function collection()
|
|
64
89
|
{
|
|
65
90
|
if ($this->selections) {
|
|
66
|
-
return Driver::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->get();
|
|
91
|
+
return Driver::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['vehicle', 'currentOrder'])->get();
|
|
67
92
|
}
|
|
68
93
|
|
|
69
|
-
return Driver::where('company_uuid', session('company'))->get();
|
|
94
|
+
return Driver::where('company_uuid', session('company'))->with(['vehicle', 'currentOrder'])->get();
|
|
70
95
|
}
|
|
71
96
|
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Exports;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Equipment;
|
|
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 EquipmentExport 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($equipment): array
|
|
23
|
+
{
|
|
24
|
+
return [
|
|
25
|
+
$equipment->public_id,
|
|
26
|
+
$equipment->name,
|
|
27
|
+
$equipment->code,
|
|
28
|
+
$equipment->type,
|
|
29
|
+
$equipment->status,
|
|
30
|
+
$equipment->serial_number,
|
|
31
|
+
$equipment->manufacturer,
|
|
32
|
+
$equipment->model,
|
|
33
|
+
$equipment->equipped_to_name,
|
|
34
|
+
$this->yesNo($equipment->is_equipped),
|
|
35
|
+
$equipment->warranty_name,
|
|
36
|
+
$equipment->purchased_at,
|
|
37
|
+
$equipment->purchase_price,
|
|
38
|
+
$equipment->currency,
|
|
39
|
+
$equipment->age_in_days,
|
|
40
|
+
$equipment->depreciated_value,
|
|
41
|
+
$equipment->created_at,
|
|
42
|
+
$equipment->updated_at,
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public function headings(): array
|
|
47
|
+
{
|
|
48
|
+
return [
|
|
49
|
+
'ID',
|
|
50
|
+
'Name',
|
|
51
|
+
'Code',
|
|
52
|
+
'Type',
|
|
53
|
+
'Status',
|
|
54
|
+
'Serial Number',
|
|
55
|
+
'Manufacturer',
|
|
56
|
+
'Model',
|
|
57
|
+
'Equipped To',
|
|
58
|
+
'Is Equipped',
|
|
59
|
+
'Warranty',
|
|
60
|
+
'Purchased At',
|
|
61
|
+
'Purchase Price',
|
|
62
|
+
'Currency',
|
|
63
|
+
'Age In Days',
|
|
64
|
+
'Depreciated Value',
|
|
65
|
+
'Date Created',
|
|
66
|
+
'Date Updated',
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public function columnFormats(): array
|
|
71
|
+
{
|
|
72
|
+
return [
|
|
73
|
+
'L' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
74
|
+
'Q' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
75
|
+
'R' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public function collection()
|
|
80
|
+
{
|
|
81
|
+
$query = Equipment::where('company_uuid', session('company'))->with(['warranty', 'equipable']);
|
|
82
|
+
|
|
83
|
+
if ($this->selections) {
|
|
84
|
+
$query->whereIn('uuid', $this->selections);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return $query->get();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected function yesNo($value): string
|
|
91
|
+
{
|
|
92
|
+
return $value ? 'Yes' : 'No';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -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
|
}
|