@fleetbase/fleetops-engine 0.6.55 → 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/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/layout/fleet-ops-sidebar.js +15 -9
- 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/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 +15 -0
- package/addon/instance-initializers/register-vroom-allocation.js +1 -1
- package/addon/routes/connectivity/events/details.js +26 -1
- package/addon/routes/management/vehicles/index/details.js +3 -1
- 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/styles/fleetops-engine.css +1 -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/route-colors.js +1 -1
- package/app/components/device-event/details.hbs +192 -0
- package/app/components/device-event/details.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +2 -2
- 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/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/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 +104 -5
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +550 -54
- package/server/src/Support/Telematics/TelematicService.php +28 -9
- package/server/src/routes.php +67 -14
- package/server/tests/ExportCoverageTest.php +79 -0
- package/server/tests/MetricsRegistryTest.php +45 -5
- package/server/tests/PublicFleetOpsRestEndpointsTest.php +191 -0
- package/server/tests/TelematicsHardeningTest.php +636 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/fleetops-engine",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.56",
|
|
4
4
|
"description": "Fleet & Transport Management Extension for Fleetbase",
|
|
5
5
|
"fleetbase": {
|
|
6
6
|
"route": "fleet-ops"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/core": "^7.23.2",
|
|
45
45
|
"@fleetbase/ember-core": "^0.3.23",
|
|
46
|
-
"@fleetbase/ember-ui": "^0.3.
|
|
46
|
+
"@fleetbase/ember-ui": "^0.3.38",
|
|
47
47
|
"@fleetbase/fleetops-data": "^0.1.40",
|
|
48
48
|
"@fleetbase/leaflet-routing-machine": "^3.2.17",
|
|
49
49
|
"@fortawesome/ember-fontawesome": "^2.0.0",
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Support\Facades\DB;
|
|
5
|
+
|
|
6
|
+
return new class extends Migration {
|
|
7
|
+
/**
|
|
8
|
+
* Delete malformed AFAQY telematics sensor rows created before sensor identities
|
|
9
|
+
* were normalized. AFAQY remains the source of truth and the next sync recreates
|
|
10
|
+
* one clean latest-state row per real provider sensor.
|
|
11
|
+
*/
|
|
12
|
+
public function up(): void
|
|
13
|
+
{
|
|
14
|
+
DB::table('sensors')
|
|
15
|
+
->whereIn('telematic_uuid', function ($query) {
|
|
16
|
+
$query->select('uuid')
|
|
17
|
+
->from('telematics')
|
|
18
|
+
->where('provider', 'afaqy');
|
|
19
|
+
})
|
|
20
|
+
->delete();
|
|
21
|
+
|
|
22
|
+
DB::table('sensors')
|
|
23
|
+
->whereRaw("LOWER(JSON_UNQUOTE(JSON_EXTRACT(meta, '$.provider'))) = ?", ['afaqy'])
|
|
24
|
+
->delete();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This cleanup cannot restore deleted rows. Run an AFAQY sync to recreate
|
|
29
|
+
* current sensor state from the provider.
|
|
30
|
+
*/
|
|
31
|
+
public function down(): void
|
|
32
|
+
{
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -25,10 +25,13 @@ class ContactExport implements FromCollection, WithHeadings, WithMapping, WithCo
|
|
|
25
25
|
$contact->public_id,
|
|
26
26
|
$contact->internal_id,
|
|
27
27
|
$contact->name,
|
|
28
|
-
$contact->
|
|
28
|
+
$contact->title,
|
|
29
|
+
$contact->type,
|
|
30
|
+
$contact->address,
|
|
29
31
|
$contact->email,
|
|
30
32
|
$contact->phone,
|
|
31
33
|
$contact->created_at,
|
|
34
|
+
$contact->updated_at,
|
|
32
35
|
];
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -38,18 +41,22 @@ class ContactExport implements FromCollection, WithHeadings, WithMapping, WithCo
|
|
|
38
41
|
'ID',
|
|
39
42
|
'Internal ID',
|
|
40
43
|
'Name',
|
|
44
|
+
'Title',
|
|
45
|
+
'Type',
|
|
41
46
|
'Address',
|
|
42
47
|
'Email',
|
|
43
48
|
'Phone',
|
|
44
49
|
'Date Created',
|
|
50
|
+
'Date Updated',
|
|
45
51
|
];
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
public function columnFormats(): array
|
|
49
55
|
{
|
|
50
56
|
return [
|
|
51
|
-
'
|
|
52
|
-
'
|
|
57
|
+
'H' => '+#',
|
|
58
|
+
'I' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
59
|
+
'J' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
53
60
|
];
|
|
54
61
|
}
|
|
55
62
|
|
|
@@ -59,9 +66,9 @@ class ContactExport implements FromCollection, WithHeadings, WithMapping, WithCo
|
|
|
59
66
|
public function collection()
|
|
60
67
|
{
|
|
61
68
|
if ($this->selections) {
|
|
62
|
-
return Contact::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->get();
|
|
69
|
+
return Contact::where('company_uuid', session('company'))->whereIn('uuid', $this->selections)->with(['place'])->get();
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
return Contact::where('company_uuid', session('company'))->get();
|
|
72
|
+
return Contact::where('company_uuid', session('company'))->with(['place'])->get();
|
|
66
73
|
}
|
|
67
74
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace Fleetbase\FleetOps\Exports;
|
|
4
|
+
|
|
5
|
+
use Fleetbase\FleetOps\Models\Device;
|
|
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 DeviceExport 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($device): array
|
|
23
|
+
{
|
|
24
|
+
return [
|
|
25
|
+
$device->public_id,
|
|
26
|
+
$device->name,
|
|
27
|
+
$device->device_id,
|
|
28
|
+
$device->connection_status,
|
|
29
|
+
$device->attached_to_name,
|
|
30
|
+
$device->telematic_name,
|
|
31
|
+
$device->sensors_count,
|
|
32
|
+
$device->last_online_at,
|
|
33
|
+
$device->provider,
|
|
34
|
+
$device->type,
|
|
35
|
+
$device->serial_number,
|
|
36
|
+
$device->imei,
|
|
37
|
+
$device->status,
|
|
38
|
+
$device->attachable_uuid ? 'Attached' : 'Unattached',
|
|
39
|
+
$this->yesNo($device->online),
|
|
40
|
+
$device->created_at,
|
|
41
|
+
$device->updated_at,
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public function headings(): array
|
|
46
|
+
{
|
|
47
|
+
return [
|
|
48
|
+
'ID',
|
|
49
|
+
'Name',
|
|
50
|
+
'Provider ID / IMEI',
|
|
51
|
+
'Connection Status',
|
|
52
|
+
'Attached To',
|
|
53
|
+
'Telematic Provider',
|
|
54
|
+
'Sensors Count',
|
|
55
|
+
'Last Seen',
|
|
56
|
+
'Provider',
|
|
57
|
+
'Type',
|
|
58
|
+
'Serial Number',
|
|
59
|
+
'IMEI',
|
|
60
|
+
'Status',
|
|
61
|
+
'Attachment State',
|
|
62
|
+
'Online',
|
|
63
|
+
'Date Created',
|
|
64
|
+
'Date Updated',
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public function columnFormats(): array
|
|
69
|
+
{
|
|
70
|
+
return [
|
|
71
|
+
'H' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
72
|
+
'P' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
73
|
+
'Q' => NumberFormat::FORMAT_DATE_DDMMYYYY,
|
|
74
|
+
];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public function collection()
|
|
78
|
+
{
|
|
79
|
+
$query = Device::where('company_uuid', session('company'))->with(['telematic', 'attachable'])->withCount('sensors');
|
|
80
|
+
|
|
81
|
+
if ($this->selections) {
|
|
82
|
+
$query->whereIn('uuid', $this->selections);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return $query->get();
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
protected function yesNo($value): string
|
|
89
|
+
{
|
|
90
|
+
return $value ? 'Yes' : 'No';
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -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
|
+
}
|