diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json
index a82b041..3e31646 100755
--- a/Admin/Install/Navigation.install.json
+++ b/Admin/Install/Navigation.install.json
@@ -64,6 +64,98 @@
"pid": "/",
"type": 2,
"subtype": 1,
+ "name": "Drivers",
+ "uri": "{/base}/fleet/driver/list",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 2, "category": null, "element": null },
+ "parent": 1003501001,
+ "children": [
+ {
+ "id": 1003503101,
+ "pid": "/fleet/driver",
+ "type": 3,
+ "subtype": 1,
+ "name": "List",
+ "uri": "{/base}/fleet/driver/list",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 2, "category": null, "element": null },
+ "parent": 1003503001,
+ "children": []
+ },
+ {
+ "id": 1003503201,
+ "pid": "/fleet/driver",
+ "type": 3,
+ "subtype": 1,
+ "name": "Create",
+ "uri": "{/base}/fleet/driver/create?{?}",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 4, "category": null, "element": null },
+ "parent": 1003503001,
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": 1003504001,
+ "pid": "/",
+ "type": 2,
+ "subtype": 1,
+ "name": "Inspection",
+ "uri": "{/base}/fleet/inspection/list",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 2, "category": null, "element": null },
+ "parent": 1003501001,
+ "children": [
+ {
+ "id": 1003504101,
+ "pid": "/fleet/inspection",
+ "type": 3,
+ "subtype": 1,
+ "name": "List",
+ "uri": "{/base}/fleet/inspection/list",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 2, "category": null, "element": null },
+ "parent": 1003504001,
+ "children": []
+ },
+ {
+ "id": 1003504201,
+ "pid": "/fleet/inspection",
+ "type": 3,
+ "subtype": 1,
+ "name": "Create",
+ "uri": "{/base}/fleet/inspection/create?{?}",
+ "target": "self",
+ "icon": null,
+ "order": 1,
+ "from": "FleetManagement",
+ "permission": { "permission": 4, "category": null, "element": null },
+ "parent": 1003504001,
+ "children": []
+ }
+ ]
+ },
+ {
+ "id": 1003505001,
+ "pid": "/",
+ "type": 2,
+ "subtype": 1,
"name": "Attributes",
"uri": "{/base}/fleet/vehicle/attribute/type/list?{?}",
"target": "self",
@@ -74,7 +166,7 @@
"parent": 1003501001,
"children": [
{
- "id": 1003503101,
+ "id": 1003505101,
"pid": "/fleet/vehicle/attribute",
"type": 3,
"subtype": 1,
@@ -85,11 +177,11 @@
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
- "parent": 1003503001,
+ "parent": 1003505001,
"children": []
},
{
- "id": 1003503201,
+ "id": 1003505201,
"pid": "/fleet/vehicle/attribute",
"type": 3,
"subtype": 1,
@@ -100,7 +192,7 @@
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
- "parent": 1003503001,
+ "parent": 1003505001,
"children": []
}
]
diff --git a/Admin/Install/inspectiontype.json b/Admin/Install/inspectiontype.json
new file mode 100644
index 0000000..033e032
--- /dev/null
+++ b/Admin/Install/inspectiontype.json
@@ -0,0 +1,37 @@
+[
+ {
+ "name": "tire_change",
+ "l11n": {
+ "en": "Tire change",
+ "de": "Reifenwechsel"
+ }
+ },
+ {
+ "name": "oil_change",
+ "l11n": {
+ "en": "Oil change",
+ "de": "Ölwechsel"
+ }
+ },
+ {
+ "name": "mot",
+ "l11n": {
+ "en": "MOT test",
+ "de": "TÜV"
+ }
+ },
+ {
+ "name": "emissions_test",
+ "l11n": {
+ "en": "Emissions test",
+ "de": "Abgasuntersuchung"
+ }
+ },
+ {
+ "name": "general",
+ "l11n": {
+ "en": "General",
+ "de": "Allgemein"
+ }
+ }
+]
\ No newline at end of file
diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php
new file mode 100644
index 0000000..0623738
--- /dev/null
+++ b/Admin/Routes/Web/Api.php
@@ -0,0 +1,52 @@
+ [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\ApiController:apiVehicleFind',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => ApiController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+ '^.*/fleet/vehicle/attribute.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\ApiController:apiVehicleAttributeCreate',
+ 'verb' => RouteVerb::PUT,
+ 'permission' => [
+ 'module' => ApiController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\ApiController:apiVehicleAttributeUpdate',
+ 'verb' => RouteVerb::SET,
+ 'permission' => [
+ 'module' => ApiController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+];
diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php
index dcaf6fb..5ba77d1 100755
--- a/Admin/Routes/Web/Backend.php
+++ b/Admin/Routes/Web/Backend.php
@@ -40,6 +40,7 @@ return [
],
],
],
+
'^.*/fleet/vehicle/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleList',
@@ -73,4 +74,72 @@ return [
],
],
],
+
+ '^.*/fleet/driver/list.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverList',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+ '^.*/fleet/driver/create.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverCreate',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::CREATE,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+ '^.*/fleet/driver/profile.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverProfile',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+
+ '^.*/fleet/inspection/list.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleList',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+ '^.*/fleet/inspection/create.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleCreate',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::CREATE,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
+ '^.*/fleet/inspection/profile.*$' => [
+ [
+ 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleProfile',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::VEHICLE,
+ ],
+ ],
+ ],
];
diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index 031ce1b..cd8ed46 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -14,12 +14,15 @@ declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
+use Modules\Admin\Models\LocalizationMapper;
+use Modules\Admin\Models\SettingsEnum;
use Modules\FleetManagement\Models\VehicleAttributeTypeL11nMapper;
use Modules\FleetManagement\Models\VehicleAttributeTypeMapper;
use Modules\FleetManagement\Models\VehicleMapper;
use Modules\FleetManagement\Models\VehicleTypeMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
+use Modules\Organization\Models\UnitMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Message\RequestAbstract;
@@ -132,6 +135,39 @@ final class BackendController extends Controller
return $view;
}
+ /**
+ * Routing end-point for application behaviour.
+ *
+ * @param RequestAbstract $request Request
+ * @param ResponseAbstract $response Response
+ * @param mixed $data Generic data
+ *
+ * @return RenderableInterface Returns a renderable object
+ *
+ * @since 1.0.0
+ * @codeCoverageIgnore
+ */
+ public function viewFleetManagementVehicleCreate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
+ {
+ $view = new View($this->app->l11nManager, $request, $response);
+
+ $view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
+ $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
+
+ /** @var \Model\Setting $settings */
+ $settings = $this->app->appSettings->get(null, [
+ SettingsEnum::DEFAULT_LOCALIZATION,
+ ]);
+
+ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
+ $view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
+
+ $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
+ $view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
+
+ return $view;
+ }
+
/**
* Routing end-point for application behaviour.
*
@@ -197,6 +233,21 @@ final class BackendController extends Controller
$view->data['types'] = $vehicleTypes;
+ $units = UnitMapper::getAll()
+ ->execute();
+ $view->data['units'] = $units;
+
+ /** @var \Model\Setting $settings */
+ $settings = $this->app->appSettings->get(null, [
+ SettingsEnum::DEFAULT_LOCALIZATION,
+ ]);
+
+ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
+ $view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
+
+ $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
+ $view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
+
return $view;
}
}
diff --git a/Models/VehicleTypeL11nMapper.php b/Models/VehicleTypeL11nMapper.php
index 48a6eb2..5d97869 100644
--- a/Models/VehicleTypeL11nMapper.php
+++ b/Models/VehicleTypeL11nMapper.php
@@ -40,6 +40,7 @@ final class VehicleTypeL11nMapper extends DataMapperFactory
'fleetmgmt_vehicle_type_l11n_id' => ['name' => 'fleetmgmt_vehicle_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_type_l11n_title' => ['name' => 'fleetmgmt_vehicle_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_vehicle_type_l11n_type' => ['name' => 'fleetmgmt_vehicle_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
+ 'fleetmgmt_vehicle_type_l11n_lang' => ['name' => 'fleetmgmt_vehicle_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php
index 0792899..e7ff236 100755
--- a/Theme/Backend/Lang/Navigation.en.lang.php
+++ b/Theme/Backend/Lang/Navigation.en.lang.php
@@ -15,4 +15,5 @@ declare(strict_types=1);
return ['Navigation' => [
'FleetManagement' => 'Fleet Management',
'Vehicles' => 'Vehicles',
+ 'Drivers' => 'Drivers',
]];
diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php
index 12dfa07..054fdc4 100755
--- a/Theme/Backend/Lang/en.lang.php
+++ b/Theme/Backend/Lang/en.lang.php
@@ -26,6 +26,7 @@ return ['FleetManagement' => [
'Attributes' => 'Attributes',
'Files' => 'Files',
'Notes' => 'Notes',
+ 'Costs' => 'Costs',
'Inspections' => 'Inspections',
'Drivers' => 'Drivers',
'Milage' => 'Milage',
diff --git a/Theme/Backend/vehicle-create.tpl.php b/Theme/Backend/vehicle-create.tpl.php
deleted file mode 100755
index 868169a..0000000
--- a/Theme/Backend/vehicle-create.tpl.php
+++ /dev/null
@@ -1,289 +0,0 @@
-data['nav']->render(); ?>
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('Client'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('Contact'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('Address'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('PaymentTerm'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('Payment'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('Price'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
-
-
-
-
- = $this->getHtml('AreaManager'); ?>
-
-
-
-
-
-
request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
-
-
-
request->uri->fragment === 'c-tab-9' ? ' checked' : ''; ?>>
-
-
-
- l11nManager, $this->request, $this->response);
- $footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
- $footerView->setPages(20);
- $footerView->setPage(1);
- ?>
-
-
- = $this->getHtml('Logs'); ?>
-
-
- | IP
- | = $this->getHtml('ID', '0', '0'); ?>
- | = $this->getHtml('Name'); ?>
- | = $this->getHtml('Log'); ?>
- | = $this->getHtml('Date'); ?>
- |
-
- | = $this->printHtml($this->request->getOrigin()); ?>
- | = $this->printHtml((string) $this->request->header->account); ?>
- | = $this->printHtml((string) $this->request->header->account); ?>
- | Creating customer
- | = $this->printHtml((new \DateTime('now'))->format('Y-m-d H:i:s')); ?>
- |
-
-
-
-
-
-
diff --git a/Theme/Backend/vehicle-profile.tpl.php b/Theme/Backend/vehicle-profile.tpl.php
index af594f9..5195d70 100755
--- a/Theme/Backend/vehicle-profile.tpl.php
+++ b/Theme/Backend/vehicle-profile.tpl.php
@@ -24,10 +24,11 @@ $vehicleStatus = VehicleStatus::getConstants();
/**
* @var \Modules\FleetManagement\Models\Vehicle $vehicle
*/
-$vehicle = $this->getData('vehicle') ?? new NullVehicle();
+$vehicle = $this->data['vehicle'] ?? new NullVehicle();
$files = $vehicle->files;
-$vehicleImage = $this->getData('vehicleImage') ?? new NullMedia();
+$vehicleImage = $this->data['vehicleImage'] ?? new NullMedia();
$vehicleTypes = $this->data['types'] ?? [];
+$attributeView = $this->data['attributeView'];
/**
* @var \phpOMS\Views\View $this
@@ -38,12 +39,12 @@ echo $this->data['nav']->render();
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
-
+
@@ -131,5 +139,225 @@ echo $this->data['nav']->render();
+
+ request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
+
+
+ = $attributeView->render(
+ $vehicle->getAttributes(),
+ $this->data['attributeTypes'] ?? [],
+ $this->data['units'] ?? [],
+ '{/api}fleet/vehicle/attribute'
+ );
+ ?>
+
+
+
+ request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
+
+ = $this->data['media-upload']->render('vehicle-file', 'files', '', $vehicle->files); ?>
+
+
+ request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
+
+ = $this->data['vehicle-notes']->render('vehicle-notes', '', $vehicle->notes); ?>
+
+
+ request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
+
+
+
+
+
+ = $this->getHtml('Upcoming'); ?>
+
+
+
+ | = $this->getHtml('Date'); ?>
+ | = $this->getHtml('Type'); ?>
+ | = $this->getHtml('Responsible'); ?>
+ |
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+ = $this->getHtml('History'); ?>
+
+
+
+ | = $this->getHtml('Date'); ?>
+ | = $this->getHtml('Type'); ?>
+ | = $this->getHtml('Responsible'); ?>
+ |
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+ request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
+
+
+
+
+
+
+ = $this->getHtml('Milage'); ?>
+
+
+
+
+ |
+ | = $this->getHtml('ID', '0', '0'); ?>
+ | = $this->getHtml('Driver'); ?>
+ | = $this->getHtml('Milage'); ?>
+ | = $this->getHtml('Start'); ?>
+ | = $this->getHtml('End'); ?>
+ |
+
+
+ |
+
+
+
+
+
+
+
+ | |
+ |
+ |
+ |
+ |
+
+
+ $value) : ++$c; ?>
+
+ |
+
+ type->isRequired) : ?>
+
+
+
+
+
+
+
+ | = $value->id; ?>
+ | = $this->printHtml($value->type->getL11n()); ?>
+ | = $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?>
+ | = $this->printHtml($value->value->unit); ?>
+ | = $this->printHtml($value->value->unit); ?>
+
+
+ |
+ | = $this->getHtml('Empty', '0', '0'); ?>
+
+ |
+
+
+
+
+
+
+ request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
+
\ No newline at end of file