auto fixes + some impl.

This commit is contained in:
Dennis Eichhorn 2024-01-26 22:53:59 +00:00
parent 3c296f062b
commit 30d0aaf2ce
58 changed files with 1351 additions and 606 deletions

View File

@ -458,6 +458,11 @@
"type": "TINYINT(1)", "type": "TINYINT(1)",
"null": false "null": false
}, },
"fleetmgmt_vehicle_attr_type_internal": {
"name": "fleetmgmt_vehicle_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"fleetmgmt_vehicle_attr_type_required": { "fleetmgmt_vehicle_attr_type_required": {
"description": "Every vehicle must have this attribute type if set to true.", "description": "Every vehicle must have this attribute type if set to true.",
"name": "fleetmgmt_vehicle_attr_type_required", "name": "fleetmgmt_vehicle_attr_type_required",
@ -744,6 +749,11 @@
"type": "TINYINT(1)", "type": "TINYINT(1)",
"null": false "null": false
}, },
"fleetmgmt_driver_attr_type_internal": {
"name": "fleetmgmt_driver_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"fleetmgmt_driver_attr_type_required": { "fleetmgmt_driver_attr_type_required": {
"description": "Every driver must have this attribute type if set to true.", "description": "Every driver must have this attribute type if set to true.",
"name": "fleetmgmt_driver_attr_type_required", "name": "fleetmgmt_driver_attr_type_required",

View File

@ -20,7 +20,6 @@ use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract; use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo; use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/** /**
* Installer class. * Installer class.
@ -131,7 +130,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */ /** @var array $type */
foreach ($types as $type) { foreach ($types as $type) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $type['name'] ?? ''); $request->setData('name', $type['name'] ?? '');
@ -157,7 +156,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -192,7 +191,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */ /** @var array $type */
foreach ($types as $type) { foreach ($types as $type) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $type['name'] ?? ''); $request->setData('name', $type['name'] ?? '');
@ -218,7 +217,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -253,7 +252,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */ /** @var array $type */
foreach ($types as $type) { foreach ($types as $type) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $type['name'] ?? ''); $request->setData('name', $type['name'] ?? '');
@ -279,7 +278,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -314,7 +313,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */ /** @var array $type */
foreach ($types as $type) { foreach ($types as $type) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $type['name'] ?? ''); $request->setData('name', $type['name'] ?? '');
@ -340,7 +339,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -375,12 +374,14 @@ final class Installer extends InstallerAbstract
/** @var array $attribute */ /** @var array $attribute */
foreach ($attributes as $attribute) { foreach ($attributes as $attribute) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $attribute['name'] ?? ''); $request->setData('name', $attribute['name'] ?? '');
$request->setData('title', \reset($attribute['l11n'])); $request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en'); $request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('repeatable', $attribute['repeatable'] ?? false);
$request->setData('internal', $attribute['internal'] ?? false);
$request->setData('is_required', $attribute['is_required'] ?? false); $request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('custom', $attribute['is_custom_allowed'] ?? false); $request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? ''); $request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
@ -405,7 +406,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -444,7 +445,7 @@ final class Installer extends InstallerAbstract
/** @var array $value */ /** @var array $value */
foreach ($attribute['values'] as $value) { foreach ($attribute['values'] as $value) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('value', $value['value'] ?? ''); $request->setData('value', $value['value'] ?? '');
@ -478,7 +479,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -514,12 +515,14 @@ final class Installer extends InstallerAbstract
/** @var array $attribute */ /** @var array $attribute */
foreach ($attributes as $attribute) { foreach ($attributes as $attribute) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', $attribute['name'] ?? ''); $request->setData('name', $attribute['name'] ?? '');
$request->setData('title', \reset($attribute['l11n'])); $request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en'); $request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('repeatable', $attribute['repeatable'] ?? false);
$request->setData('internal', $attribute['internal'] ?? false);
$request->setData('is_required', $attribute['is_required'] ?? false); $request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('custom', $attribute['is_custom_allowed'] ?? false); $request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? ''); $request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
@ -544,7 +547,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);
@ -583,7 +586,7 @@ final class Installer extends InstallerAbstract
/** @var array $value */ /** @var array $value */
foreach ($attribute['values'] as $value) { foreach ($attribute['values'] as $value) {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('value', $value['value'] ?? ''); $request->setData('value', $value['value'] ?? '');
@ -617,7 +620,7 @@ final class Installer extends InstallerAbstract
} }
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', $l11n); $request->setData('title', $l11n);

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb; use phpOMS\Router\RouteVerb;
return [ return [
'^.*/fleet/vehicle/find.*$' => [ '^.*/fleet/vehicle/find(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiVehicleFind', 'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiVehicleFind',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -30,7 +30,7 @@ return [
], ],
], ],
'^.*/fleet/vehicle/attribute.*$' => [ '^.*/fleet/vehicle/attribute(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleAttributeController:apiVehicleAttributeCreate', 'dest' => '\Modules\FleetManagement\Controller\ApiVehicleAttributeController:apiVehicleAttributeCreate',
'verb' => RouteVerb::PUT, 'verb' => RouteVerb::PUT,
@ -51,7 +51,7 @@ return [
], ],
], ],
'^.*/fleet/driver/attribute.*$' => [ '^.*/fleet/driver/attribute(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\ApiDriverAttributeController:apiDriverAttributeCreate', 'dest' => '\Modules\FleetManagement\Controller\ApiDriverAttributeController:apiDriverAttributeCreate',
'verb' => RouteVerb::PUT, 'verb' => RouteVerb::PUT,
@ -72,7 +72,7 @@ return [
], ],
], ],
'^.*/fleet/vehicle/note.*$' => [ '^.*/fleet/vehicle/note(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiNoteCreate', 'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiNoteCreate',
'verb' => RouteVerb::PUT, 'verb' => RouteVerb::PUT,
@ -93,7 +93,7 @@ return [
], ],
], ],
'^.*/fleet/driver/note.*$' => [ '^.*/fleet/driver/note(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\ApiDriverController:apiNoteCreate', 'dest' => '\Modules\FleetManagement\Controller\ApiDriverController:apiNoteCreate',
'verb' => RouteVerb::PUT, 'verb' => RouteVerb::PUT,

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb; use phpOMS\Router\RouteVerb;
return [ return [
'^.*/fleet/vehicle/attribute/type/list.*$' => [ '^.*/fleet/vehicle/attribute/type/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeTypeList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeTypeList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -29,7 +29,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/vehicle/attribute/type\?.*$' => [ '^.*/fleet/vehicle/attribute/type(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeType', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeType',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -41,7 +41,7 @@ return [
], ],
], ],
'^.*/fleet/vehicle/list.*$' => [ '^.*/fleet/vehicle/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -52,7 +52,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/vehicle/create.*$' => [ '^.*/fleet/vehicle/create(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleCreate', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleCreate',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -63,9 +63,9 @@ return [
], ],
], ],
], ],
'^.*/fleet/vehicle/profile.*$' => [ '^.*/fleet/vehicle/view(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleProfile', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleView',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
@ -75,7 +75,7 @@ return [
], ],
], ],
'^.*/fleet/driver/attribute/type/list.*$' => [ '^.*/fleet/driver/attribute/type/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeTypeList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeTypeList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -86,7 +86,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/driver/attribute/type\?.*$' => [ '^.*/fleet/driver/attribute/type(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeType', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeType',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -98,7 +98,7 @@ return [
], ],
], ],
'^.*/fleet/driver/list.*$' => [ '^.*/fleet/driver/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -109,7 +109,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/driver/create.*$' => [ '^.*/fleet/driver/create(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverCreate', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverCreate',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -120,9 +120,9 @@ return [
], ],
], ],
], ],
'^.*/fleet/driver/profile.*$' => [ '^.*/fleet/driver/view(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverProfile', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverView',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,
@ -132,7 +132,7 @@ return [
], ],
], ],
'^.*/fleet/inspection/list.*$' => [ '^.*/fleet/inspection/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -143,7 +143,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/inspection/type/list.*$' => [ '^.*/fleet/inspection/type/list(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionTypeList', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionTypeList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -154,7 +154,7 @@ return [
], ],
], ],
], ],
'^.*/fleet/inspection/create.*$' => [ '^.*/fleet/inspection/create(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionCreate', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionCreate',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -165,9 +165,9 @@ return [
], ],
], ],
], ],
'^.*/fleet/inspection/profile.*$' => [ '^.*/fleet/inspection/view(\?.*$|$)' => [
[ [
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionProfile', 'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionView',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
'permission' => [ 'permission' => [
'module' => BackendController::NAME, 'module' => BackendController::NAME,

View File

@ -61,12 +61,15 @@ final class ApiDriverAttributeController extends Controller
return; return;
} }
$type = DriverAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute(); $type = DriverAttributeTypeMapper::get()
->with('defaults')
->where('id', (int) $request->getData('type'))
->execute();
if (!$type->repeatable) { if (!$type->repeatable) {
$attr = DriverAttributeMapper::count() $attr = DriverAttributeMapper::count()
->with('type') ->with('type')
->where('type/id', (int) $request->getData('type')) ->where('type/id', $type->id)
->where('ref', (int) $request->getData('ref')) ->where('ref', (int) $request->getData('ref'))
->execute(); ->execute();
@ -164,13 +167,20 @@ final class ApiDriverAttributeController extends Controller
->where('id', $request->getDataInt('type') ?? 0) ->where('id', $request->getDataInt('type') ?? 0)
->execute(); ->execute();
if ($type->isInternal) {
$response->header->status = RequestStatusCode::R_403;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrValue = $this->createAttributeValueFromRequest($request, $type); $attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, DriverAttributeValueMapper::class, 'attr_value', $request->getOrigin()); $this->createModel($request->header->account, $attrValue, DriverAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) { if ($attrValue->isDefault) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
(int) $request->getData('type'), $type->id,
$attrValue->id, $attrValue->id,
DriverAttributeTypeMapper::class, 'defaults', '', $request->getOrigin() DriverAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
); );

View File

@ -92,7 +92,7 @@ final class ApiDriverController extends Controller
$inspection = new Inspection(); $inspection = new Inspection();
$inspection->reference = (int) $request->getData('ref'); $inspection->reference = (int) $request->getData('ref');
$inspection->description = $request->getDataString('description') ?? ''; $inspection->description = $request->getDataString('description') ?? '';
$inspection->status = $request->getDataInt('status') ?? InspectionStatus::TODO; $inspection->status = InspectionStatus::tryFromValue($request->getDataInt('status')) ?? InspectionStatus::TODO;
$inspection->next = $request->getDataDateTime('next') ?? null; $inspection->next = $request->getDataDateTime('next') ?? null;
$inspection->date = $request->getDataDateTime('date') ?? null; $inspection->date = $request->getDataDateTime('date') ?? null;
$inspection->interval = $request->getDataInt('interval') ?? 0; $inspection->interval = $request->getDataInt('interval') ?? 0;
@ -168,7 +168,7 @@ final class ApiDriverController extends Controller
{ {
$driver = new Driver(); $driver = new Driver();
$driver->account = new NullAccount($request->getDataInt('account') ?? 1); $driver->account = new NullAccount($request->getDataInt('account') ?? 1);
$driver->status = $request->getDataInt('status') ?? DriverStatus::INACTIVE; $driver->status = DriverStatus::tryFromValue($request->getDataInt('status')) ?? DriverStatus::INACTIVE;
return $driver; return $driver;
} }
@ -493,7 +493,10 @@ final class ApiDriverController extends Controller
{ {
$type = new BaseStringL11nType(); $type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? ''; $type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); $type->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $type; return $type;
} }
@ -557,12 +560,10 @@ final class ApiDriverController extends Controller
*/ */
private function createDriverInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n private function createDriverInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{ {
$typeL11n = new BaseStringL11n(); $typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0; $typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage( $typeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$request->getDataString('language') ?? $request->header->l11n->language $typeL11n->content = $request->getDataString('title') ?? '';
);
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n; return $typeL11n;
} }

View File

@ -61,12 +61,15 @@ final class ApiVehicleAttributeController extends Controller
return; return;
} }
$type = VehicleAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute(); $type = VehicleAttributeTypeMapper::get()
->with('defaults')
->where('id', (int) $request->getData('type'))
->execute();
if (!$type->repeatable) { if (!$type->repeatable) {
$attr = VehicleAttributeMapper::count() $attr = VehicleAttributeMapper::count()
->with('type') ->with('type')
->where('type/id', (int) $request->getData('type')) ->where('type/id', $type->id)
->where('ref', (int) $request->getData('ref')) ->where('ref', (int) $request->getData('ref'))
->execute(); ->execute();
@ -164,13 +167,20 @@ final class ApiVehicleAttributeController extends Controller
->where('id', $request->getDataInt('type') ?? 0) ->where('id', $request->getDataInt('type') ?? 0)
->execute(); ->execute();
if ($type->isInternal) {
$response->header->status = RequestStatusCode::R_403;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrValue = $this->createAttributeValueFromRequest($request, $type); $attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, VehicleAttributeValueMapper::class, 'attr_value', $request->getOrigin()); $this->createModel($request->header->account, $attrValue, VehicleAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) { if ($attrValue->isDefault) {
$this->createModelRelation( $this->createModelRelation(
$request->header->account, $request->header->account,
(int) $request->getData('type'), $type->id,
$attrValue->id, $attrValue->id,
VehicleAttributeTypeMapper::class, 'defaults', '', $request->getOrigin() VehicleAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
); );

View File

@ -189,7 +189,7 @@ final class ApiVehicleController extends Controller
$inspection = new Inspection(); $inspection = new Inspection();
$inspection->reference = (int) $request->getData('ref'); $inspection->reference = (int) $request->getData('ref');
$inspection->description = $request->getDataString('description') ?? ''; $inspection->description = $request->getDataString('description') ?? '';
$inspection->status = $request->getDataInt('status') ?? InspectionStatus::TODO; $inspection->status = InspectionStatus::tryFromValue($request->getDataInt('status')) ?? InspectionStatus::TODO;
$inspection->next = $request->getDataDateTime('next') ?? null; $inspection->next = $request->getDataDateTime('next') ?? null;
$inspection->date = $request->getDataDateTime('date') ?? null; $inspection->date = $request->getDataDateTime('date') ?? null;
$inspection->interval = $request->getDataInt('interval') ?? 0; $inspection->interval = $request->getDataInt('interval') ?? 0;
@ -258,7 +258,10 @@ final class ApiVehicleController extends Controller
{ {
$type = new BaseStringL11nType(); $type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? ''; $type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); $type->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $type; return $type;
} }
@ -322,12 +325,10 @@ final class ApiVehicleController extends Controller
*/ */
private function createVehicleTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n private function createVehicleTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{ {
$typeL11n = new BaseStringL11n(); $typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0; $typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage( $typeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$request->getDataString('language') ?? $request->header->l11n->language $typeL11n->content = $request->getDataString('title') ?? '';
);
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n; return $typeL11n;
} }
@ -394,7 +395,10 @@ final class ApiVehicleController extends Controller
{ {
$type = new BaseStringL11nType(); $type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? ''; $type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); $type->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $type; return $type;
} }
@ -458,12 +462,10 @@ final class ApiVehicleController extends Controller
*/ */
private function createFuelTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n private function createFuelTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{ {
$typeL11n = new BaseStringL11n(); $typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0; $typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage( $typeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$request->getDataString('language') ?? $request->header->l11n->language $typeL11n->content = $request->getDataString('title') ?? '';
);
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n; return $typeL11n;
} }
@ -540,7 +542,7 @@ final class ApiVehicleController extends Controller
$vehicle->info = $request->getDataString('info') ?? ''; $vehicle->info = $request->getDataString('info') ?? '';
$vehicle->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); $vehicle->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
$vehicle->fuelType = new NullBaseStringL11nType((int) ($request->getDataInt('fuel') ?? 0)); $vehicle->fuelType = new NullBaseStringL11nType((int) ($request->getDataInt('fuel') ?? 0));
$vehicle->status = $request->getDataInt('status') ?? VehicleStatus::INACTIVE; $vehicle->status = VehicleStatus::tryFromValue($request->getDataInt('status')) ?? VehicleStatus::INACTIVE;
$vehicle->unit = $request->getDataInt('unit') ?? $this->app->unitId; $vehicle->unit = $request->getDataInt('unit') ?? $this->app->unitId;
return $vehicle; return $vehicle;
@ -867,7 +869,10 @@ final class ApiVehicleController extends Controller
{ {
$type = new BaseStringL11nType(); $type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? ''; $type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN); $type->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $type; return $type;
} }
@ -931,12 +936,10 @@ final class ApiVehicleController extends Controller
*/ */
private function createInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n private function createInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{ {
$typeL11n = new BaseStringL11n(); $typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0; $typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage( $typeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$request->getDataString('language') ?? $request->header->l11n->language $typeL11n->content = $request->getDataString('title') ?? '';
);
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n; return $typeL11n;
} }

View File

@ -14,8 +14,6 @@ declare(strict_types=1);
namespace Modules\FleetManagement\Controller; namespace Modules\FleetManagement\Controller;
use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\FleetManagement\Models\Attribute\DriverAttributeTypeMapper; use Modules\FleetManagement\Models\Attribute\DriverAttributeTypeMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeL11nMapper; use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeL11nMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeMapper; use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeMapper;
@ -332,14 +330,11 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile'); $view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
/** @var \Model\Setting $settings */ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = 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['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); $view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
@ -363,17 +358,14 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile'); $view->setTemplate('/Modules/FleetManagement/Theme/Backend/driver-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
/** @var \Model\Setting $settings */ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); $view->data['driver-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
$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; return $view;
} }
@ -390,11 +382,11 @@ final class BackendController extends Controller
* @since 1.0.0 * @since 1.0.0
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function viewFleetManagementInspectionProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewFleetManagementInspectionView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-profile'); $view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
return $view; return $view;
@ -412,11 +404,11 @@ final class BackendController extends Controller
* @since 1.0.0 * @since 1.0.0
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function viewFleetManagementVehicleProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewFleetManagementVehicleView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile'); $view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
// @todo This language filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query. // @todo This language filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query.
@ -425,6 +417,7 @@ final class BackendController extends Controller
->with('attributes/type') ->with('attributes/type')
->with('attributes/value') ->with('attributes/value')
->with('attributes/type/l11n') ->with('attributes/type/l11n')
//->with('attributes/value/l11n')
->with('files') ->with('files')
->with('files/types') ->with('files/types')
->with('type') ->with('type')
@ -435,6 +428,7 @@ final class BackendController extends Controller
->where('type/l11n/language', $response->header->l11n->language) ->where('type/l11n/language', $response->header->l11n->language)
->where('fuelType/l11n/language', $response->header->l11n->language) ->where('fuelType/l11n/language', $response->header->l11n->language)
->where('attributes/type/l11n/language', $response->header->l11n->language) ->where('attributes/type/l11n/language', $response->header->l11n->language)
//->where('attributes/value/l11n/language', $response->header->l11n->language)
->execute(); ->execute();
$view->data['vehicle'] = $vehicle; $view->data['vehicle'] = $vehicle;
@ -482,11 +476,8 @@ final class BackendController extends Controller
$view->data['units'] = $units; $view->data['units'] = $units;
/** @var \Model\Setting $settings */ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = 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['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); $view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
@ -506,11 +497,11 @@ final class BackendController extends Controller
* @since 1.0.0 * @since 1.0.0
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
public function viewFleetManagementDriverProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface public function viewFleetManagementDriverView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/driver-profile'); $view->setTemplate('/Modules/FleetManagement/Theme/Backend/driver-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
// @todo This language filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query. // @todo This language filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query.
@ -519,10 +510,12 @@ final class BackendController extends Controller
->with('attributes/type') ->with('attributes/type')
->with('attributes/value') ->with('attributes/value')
->with('attributes/type/l11n') ->with('attributes/type/l11n')
//->with('attributes/value/l11n')
->with('files') ->with('files')
->with('files/types') ->with('files/types')
->where('id', (int) $request->getData('id')) ->where('id', (int) $request->getData('id'))
->where('attributes/type/l11n/language', $response->header->l11n->language) ->where('attributes/type/l11n/language', $response->header->l11n->language)
//->where('attributes/value/l11n/language', $response->header->l11n->language)
->execute(); ->execute();
$view->data['driver'] = $driver; $view->data['driver'] = $driver;
@ -558,11 +551,8 @@ final class BackendController extends Controller
$view->data['driverImage'] = $driverImage; $view->data['driverImage'] = $driverImage;
/** @var \Model\Setting $settings */ $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = 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['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['driver-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response); $view->data['driver-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);

View File

@ -37,10 +37,10 @@ final class DriverAttributeMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_driver_attr_id' => ['name' => 'fleetmgmt_driver_attr_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_driver_attr_id' => ['name' => 'fleetmgmt_driver_attr_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_attr_driver' => ['name' => 'fleetmgmt_driver_attr_driver', 'type' => 'int', 'internal' => 'ref'], 'fleetmgmt_driver_attr_driver' => ['name' => 'fleetmgmt_driver_attr_driver', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_driver_attr_type' => ['name' => 'fleetmgmt_driver_attr_type', 'type' => 'int', 'internal' => 'type'], 'fleetmgmt_driver_attr_type' => ['name' => 'fleetmgmt_driver_attr_type', 'type' => 'int', 'internal' => 'type'],
'fleetmgmt_driver_attr_value' => ['name' => 'fleetmgmt_driver_attr_value', 'type' => 'int', 'internal' => 'value'], 'fleetmgmt_driver_attr_value' => ['name' => 'fleetmgmt_driver_attr_value', 'type' => 'int', 'internal' => 'value'],
]; ];
/** /**

View File

@ -42,7 +42,8 @@ final class DriverAttributeTypeMapper extends DataMapperFactory
'fleetmgmt_driver_attr_type_datatype' => ['name' => 'fleetmgmt_driver_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'fleetmgmt_driver_attr_type_datatype' => ['name' => 'fleetmgmt_driver_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'fleetmgmt_driver_attr_type_fields' => ['name' => 'fleetmgmt_driver_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'fleetmgmt_driver_attr_type_fields' => ['name' => 'fleetmgmt_driver_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'fleetmgmt_driver_attr_type_custom' => ['name' => 'fleetmgmt_driver_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], 'fleetmgmt_driver_attr_type_custom' => ['name' => 'fleetmgmt_driver_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'fleetmgmt_driver_attr_type_repeatable' => ['name' => 'fleetmgmt_driver_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], 'fleetmgmt_driver_attr_type_repeatable' => ['name' => 'fleetmgmt_driver_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'fleetmgmt_driver_attr_type_internal' => ['name' => 'fleetmgmt_driver_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
'fleetmgmt_driver_attr_type_pattern' => ['name' => 'fleetmgmt_driver_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'fleetmgmt_driver_attr_type_pattern' => ['name' => 'fleetmgmt_driver_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'fleetmgmt_driver_attr_type_required' => ['name' => 'fleetmgmt_driver_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], 'fleetmgmt_driver_attr_type_required' => ['name' => 'fleetmgmt_driver_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
]; ];

View File

@ -37,10 +37,10 @@ final class DriverAttributeValueL11nMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_driver_attr_value_l11n_id' => ['name' => 'fleetmgmt_driver_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_driver_attr_value_l11n_id' => ['name' => 'fleetmgmt_driver_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_attr_value_l11n_title' => ['name' => 'fleetmgmt_driver_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true], 'fleetmgmt_driver_attr_value_l11n_title' => ['name' => 'fleetmgmt_driver_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_driver_attr_value_l11n_value' => ['name' => 'fleetmgmt_driver_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'], 'fleetmgmt_driver_attr_value_l11n_value' => ['name' => 'fleetmgmt_driver_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_driver_attr_value_l11n_lang' => ['name' => 'fleetmgmt_driver_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'], 'fleetmgmt_driver_attr_value_l11n_lang' => ['name' => 'fleetmgmt_driver_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
]; ];
/** /**

View File

@ -37,15 +37,15 @@ final class DriverAttributeValueMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_driver_attr_value_id' => ['name' => 'fleetmgmt_driver_attr_value_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_driver_attr_value_id' => ['name' => 'fleetmgmt_driver_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_attr_value_default' => ['name' => 'fleetmgmt_driver_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'], 'fleetmgmt_driver_attr_value_default' => ['name' => 'fleetmgmt_driver_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'fleetmgmt_driver_attr_value_valueStr' => ['name' => 'fleetmgmt_driver_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'], 'fleetmgmt_driver_attr_value_valueStr' => ['name' => 'fleetmgmt_driver_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'fleetmgmt_driver_attr_value_valueInt' => ['name' => 'fleetmgmt_driver_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'], 'fleetmgmt_driver_attr_value_valueInt' => ['name' => 'fleetmgmt_driver_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'fleetmgmt_driver_attr_value_valueDec' => ['name' => 'fleetmgmt_driver_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'], 'fleetmgmt_driver_attr_value_valueDec' => ['name' => 'fleetmgmt_driver_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'fleetmgmt_driver_attr_value_valueDat' => ['name' => 'fleetmgmt_driver_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'], 'fleetmgmt_driver_attr_value_valueDat' => ['name' => 'fleetmgmt_driver_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'fleetmgmt_driver_attr_value_unit' => ['name' => 'fleetmgmt_driver_attr_value_unit', 'type' => 'string', 'internal' => 'unit'], 'fleetmgmt_driver_attr_value_unit' => ['name' => 'fleetmgmt_driver_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'fleetmgmt_driver_attr_value_deptype' => ['name' => 'fleetmgmt_driver_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'], 'fleetmgmt_driver_attr_value_deptype' => ['name' => 'fleetmgmt_driver_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'fleetmgmt_driver_attr_value_depvalue' => ['name' => 'fleetmgmt_driver_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'], 'fleetmgmt_driver_attr_value_depvalue' => ['name' => 'fleetmgmt_driver_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
]; ];
/** /**

View File

@ -37,10 +37,10 @@ final class VehicleAttributeMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_vehicle_attr_id' => ['name' => 'fleetmgmt_vehicle_attr_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_vehicle_attr_id' => ['name' => 'fleetmgmt_vehicle_attr_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_attr_vehicle' => ['name' => 'fleetmgmt_vehicle_attr_vehicle', 'type' => 'int', 'internal' => 'ref'], 'fleetmgmt_vehicle_attr_vehicle' => ['name' => 'fleetmgmt_vehicle_attr_vehicle', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_vehicle_attr_type' => ['name' => 'fleetmgmt_vehicle_attr_type', 'type' => 'int', 'internal' => 'type'], 'fleetmgmt_vehicle_attr_type' => ['name' => 'fleetmgmt_vehicle_attr_type', 'type' => 'int', 'internal' => 'type'],
'fleetmgmt_vehicle_attr_value' => ['name' => 'fleetmgmt_vehicle_attr_value', 'type' => 'int', 'internal' => 'value'], 'fleetmgmt_vehicle_attr_value' => ['name' => 'fleetmgmt_vehicle_attr_value', 'type' => 'int', 'internal' => 'value'],
]; ];
/** /**

View File

@ -42,7 +42,8 @@ final class VehicleAttributeTypeMapper extends DataMapperFactory
'fleetmgmt_vehicle_attr_type_datatype' => ['name' => 'fleetmgmt_vehicle_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'fleetmgmt_vehicle_attr_type_datatype' => ['name' => 'fleetmgmt_vehicle_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'fleetmgmt_vehicle_attr_type_fields' => ['name' => 'fleetmgmt_vehicle_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'fleetmgmt_vehicle_attr_type_fields' => ['name' => 'fleetmgmt_vehicle_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'fleetmgmt_vehicle_attr_type_custom' => ['name' => 'fleetmgmt_vehicle_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], 'fleetmgmt_vehicle_attr_type_custom' => ['name' => 'fleetmgmt_vehicle_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'fleetmgmt_vehicle_attr_type_repeatable' => ['name' => 'fleetmgmt_vehicle_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], 'fleetmgmt_vehicle_attr_type_repeatable' => ['name' => 'fleetmgmt_vehicle_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'fleetmgmt_vehicle_attr_type_internal' => ['name' => 'fleetmgmt_vehicle_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
'fleetmgmt_vehicle_attr_type_pattern' => ['name' => 'fleetmgmt_vehicle_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'fleetmgmt_vehicle_attr_type_pattern' => ['name' => 'fleetmgmt_vehicle_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'fleetmgmt_vehicle_attr_type_required' => ['name' => 'fleetmgmt_vehicle_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], 'fleetmgmt_vehicle_attr_type_required' => ['name' => 'fleetmgmt_vehicle_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
]; ];

View File

@ -37,10 +37,10 @@ final class VehicleAttributeValueL11nMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_vehicle_attr_value_l11n_id' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_vehicle_attr_value_l11n_id' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_attr_value_l11n_title' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true], 'fleetmgmt_vehicle_attr_value_l11n_title' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_vehicle_attr_value_l11n_value' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'], 'fleetmgmt_vehicle_attr_value_l11n_value' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_vehicle_attr_value_l11n_lang' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'], 'fleetmgmt_vehicle_attr_value_l11n_lang' => ['name' => 'fleetmgmt_vehicle_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
]; ];
/** /**

View File

@ -37,15 +37,15 @@ final class VehicleAttributeValueMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_vehicle_attr_value_id' => ['name' => 'fleetmgmt_vehicle_attr_value_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_vehicle_attr_value_id' => ['name' => 'fleetmgmt_vehicle_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_attr_value_default' => ['name' => 'fleetmgmt_vehicle_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'], 'fleetmgmt_vehicle_attr_value_default' => ['name' => 'fleetmgmt_vehicle_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'fleetmgmt_vehicle_attr_value_valueStr' => ['name' => 'fleetmgmt_vehicle_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'], 'fleetmgmt_vehicle_attr_value_valueStr' => ['name' => 'fleetmgmt_vehicle_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'fleetmgmt_vehicle_attr_value_valueInt' => ['name' => 'fleetmgmt_vehicle_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'], 'fleetmgmt_vehicle_attr_value_valueInt' => ['name' => 'fleetmgmt_vehicle_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'fleetmgmt_vehicle_attr_value_valueDec' => ['name' => 'fleetmgmt_vehicle_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'], 'fleetmgmt_vehicle_attr_value_valueDec' => ['name' => 'fleetmgmt_vehicle_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'fleetmgmt_vehicle_attr_value_valueDat' => ['name' => 'fleetmgmt_vehicle_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'], 'fleetmgmt_vehicle_attr_value_valueDat' => ['name' => 'fleetmgmt_vehicle_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'fleetmgmt_vehicle_attr_value_unit' => ['name' => 'fleetmgmt_vehicle_attr_value_unit', 'type' => 'string', 'internal' => 'unit'], 'fleetmgmt_vehicle_attr_value_unit' => ['name' => 'fleetmgmt_vehicle_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'fleetmgmt_vehicle_attr_value_deptype' => ['name' => 'fleetmgmt_vehicle_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'], 'fleetmgmt_vehicle_attr_value_deptype' => ['name' => 'fleetmgmt_vehicle_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'fleetmgmt_vehicle_attr_value_depvalue' => ['name' => 'fleetmgmt_vehicle_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'], 'fleetmgmt_vehicle_attr_value_depvalue' => ['name' => 'fleetmgmt_vehicle_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
]; ];
/** /**

View File

@ -34,7 +34,7 @@ class Cost implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -34,7 +34,7 @@ class CostType implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -60,8 +60,8 @@ class Driver
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
'status' => $this->status, 'status' => $this->status,
]; ];
} }

View File

@ -18,7 +18,7 @@ use Modules\FleetManagement\Models\Inspection;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/** /**
* mapper class. * Driver inspection mapper class.
* *
* @package Modules\FleetManagement\Models\Driver * @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
/** /**
* mapper class. * Driver inspection type l11n mapper class.
* *
* @package Modules\FleetManagement\Models\Driver * @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -40,9 +40,9 @@ final class DriverMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_driver_id' => ['name' => 'fleetmgmt_driver_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_driver_id' => ['name' => 'fleetmgmt_driver_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_status' => ['name' => 'fleetmgmt_driver_status', 'type' => 'int', 'internal' => 'status'], 'fleetmgmt_driver_status' => ['name' => 'fleetmgmt_driver_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_driver_account' => ['name' => 'fleetmgmt_driver_account', 'type' => 'int', 'internal' => 'account'], 'fleetmgmt_driver_account' => ['name' => 'fleetmgmt_driver_account', 'type' => 'int', 'internal' => 'account'],
]; ];
/** /**
@ -52,7 +52,7 @@ final class DriverMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const HAS_MANY = [ public const HAS_MANY = [
'files' => [ 'files' => [
'mapper' => MediaMapper::class, 'mapper' => MediaMapper::class,
'table' => 'fleetmgmt_driver_media', 'table' => 'fleetmgmt_driver_media',
'external' => 'fleetmgmt_driver_media_media', 'external' => 'fleetmgmt_driver_media_media',

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
/** /**
* mapper class. * Fuel type l11n mapper class.
* *
* @package Modules\FleetManagement\Models * @package Modules\FleetManagement\Models
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -74,7 +74,7 @@ class Inspection implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -17,7 +17,7 @@ namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/** /**
* mapper class. * Inspection mapper class.
* *
* @package Modules\FleetManagement\Models * @package Modules\FleetManagement\Models
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
/** /**
* mapper class. * Inspection type l11n mapper class.
* *
* @package Modules\FleetManagement\Models * @package Modules\FleetManagement\Models
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -32,7 +32,7 @@ class License implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -32,7 +32,7 @@ class LicenseType implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -64,7 +64,7 @@ class Milage implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -18,7 +18,7 @@ use Modules\FleetManagement\Models\Driver\DriverMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory; use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/** /**
* mapper class. * Milage mapper class.
* *
* @package Modules\FleetManagement\Models * @package Modules\FleetManagement\Models
* @license OMS License 2.0 * @license OMS License 2.0
@ -37,15 +37,15 @@ final class MilageMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_milage_id' => ['name' => 'fleetmgmt_milage_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_milage_id' => ['name' => 'fleetmgmt_milage_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_milage_description' => ['name' => 'fleetmgmt_milage_description', 'type' => 'string', 'internal' => 'description'], 'fleetmgmt_milage_description' => ['name' => 'fleetmgmt_milage_description', 'type' => 'string', 'internal' => 'description'],
'fleetmgmt_milage_status' => ['name' => 'fleetmgmt_milage_status', 'type' => 'int', 'internal' => 'status'], 'fleetmgmt_milage_status' => ['name' => 'fleetmgmt_milage_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_milage_driver' => ['name' => 'fleetmgmt_milage_driver', 'type' => 'int', 'internal' => 'driver'], 'fleetmgmt_milage_driver' => ['name' => 'fleetmgmt_milage_driver', 'type' => 'int', 'internal' => 'driver'],
'fleetmgmt_milage_vehicle' => ['name' => 'fleetmgmt_milage_vehicle', 'type' => 'int', 'internal' => 'vehicle'], 'fleetmgmt_milage_vehicle' => ['name' => 'fleetmgmt_milage_vehicle', 'type' => 'int', 'internal' => 'vehicle'],
'fleetmgmt_milage_start' => ['name' => 'fleetmgmt_milage_start', 'type' => 'DateTime', 'internal' => 'start'], 'fleetmgmt_milage_start' => ['name' => 'fleetmgmt_milage_start', 'type' => 'DateTime', 'internal' => 'start'],
'fleetmgmt_milage_end' => ['name' => 'fleetmgmt_milage_end', 'type' => 'DateTime', 'internal' => 'end'], 'fleetmgmt_milage_end' => ['name' => 'fleetmgmt_milage_end', 'type' => 'DateTime', 'internal' => 'end'],
'fleetmgmt_milage_milage' => ['name' => 'fleetmgmt_milage_milage', 'type' => 'int', 'internal' => 'milage'], 'fleetmgmt_milage_milage' => ['name' => 'fleetmgmt_milage_milage', 'type' => 'int', 'internal' => 'milage'],
'fleetmgmt_milage_fuel' => ['name' => 'fleetmgmt_milage_fuel', 'type' => 'int', 'internal' => 'fuelUsage'], 'fleetmgmt_milage_fuel' => ['name' => 'fleetmgmt_milage_fuel', 'type' => 'int', 'internal' => 'fuelUsage'],
]; ];
/** /**

View File

@ -68,7 +68,7 @@ class Vehicle implements \JsonSerializable
public function toArray() : array public function toArray() : array
{ {
return [ return [
'id' => $this->id, 'id' => $this->id,
]; ];
} }

View File

@ -39,15 +39,15 @@ final class VehicleMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_vehicle_id' => ['name' => 'fleetmgmt_vehicle_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_vehicle_id' => ['name' => 'fleetmgmt_vehicle_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_name' => ['name' => 'fleetmgmt_vehicle_name', 'type' => 'string', 'internal' => 'name'], 'fleetmgmt_vehicle_name' => ['name' => 'fleetmgmt_vehicle_name', 'type' => 'string', 'internal' => 'name'],
'fleetmgmt_vehicle_status' => ['name' => 'fleetmgmt_vehicle_status', 'type' => 'int', 'internal' => 'status'], 'fleetmgmt_vehicle_status' => ['name' => 'fleetmgmt_vehicle_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_vehicle_info' => ['name' => 'fleetmgmt_vehicle_info', 'type' => 'string', 'internal' => 'info'], 'fleetmgmt_vehicle_info' => ['name' => 'fleetmgmt_vehicle_info', 'type' => 'string', 'internal' => 'info'],
'fleetmgmt_vehicle_unit' => ['name' => 'fleetmgmt_vehicle_unit', 'type' => 'int', 'internal' => 'unit'], 'fleetmgmt_vehicle_unit' => ['name' => 'fleetmgmt_vehicle_unit', 'type' => 'int', 'internal' => 'unit'],
'fleetmgmt_vehicle_type' => ['name' => 'fleetmgmt_vehicle_type', 'type' => 'int', 'internal' => 'type'], 'fleetmgmt_vehicle_type' => ['name' => 'fleetmgmt_vehicle_type', 'type' => 'int', 'internal' => 'type'],
'fleetmgmt_vehicle_fuel' => ['name' => 'fleetmgmt_vehicle_fuel', 'type' => 'int', 'internal' => 'fuelType'], 'fleetmgmt_vehicle_fuel' => ['name' => 'fleetmgmt_vehicle_fuel', 'type' => 'int', 'internal' => 'fuelType'],
'fleetmgmt_vehicle_responsible' => ['name' => 'fleetmgmt_vehicle_responsible', 'type' => 'int', 'internal' => 'responsible'], 'fleetmgmt_vehicle_responsible' => ['name' => 'fleetmgmt_vehicle_responsible', 'type' => 'int', 'internal' => 'responsible'],
'fleetmgmt_vehicle_created_at' => ['name' => 'fleetmgmt_vehicle_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true], 'fleetmgmt_vehicle_created_at' => ['name' => 'fleetmgmt_vehicle_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
]; ];
/** /**
@ -57,7 +57,7 @@ final class VehicleMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const HAS_MANY = [ public const HAS_MANY = [
'files' => [ 'files' => [
'mapper' => MediaMapper::class, 'mapper' => MediaMapper::class,
'table' => 'fleetmgmt_vehicle_media', 'table' => 'fleetmgmt_vehicle_media',
'external' => 'fleetmgmt_vehicle_media_media', 'external' => 'fleetmgmt_vehicle_media_media',
@ -85,12 +85,12 @@ final class VehicleMapper extends DataMapperFactory
*/ */
public const OWNS_ONE = [ public const OWNS_ONE = [
'type' => [ 'type' => [
'mapper' => VehicleTypeMapper::class, 'mapper' => VehicleTypeMapper::class,
'external' => 'fleetmgmt_vehicle_type', 'external' => 'fleetmgmt_vehicle_type',
], ],
'fuelType' => [ 'fuelType' => [
'mapper' => FuelTypeMapper::class, 'mapper' => FuelTypeMapper::class,
'external' => 'fleetmgmt_vehicle_fuel', 'external' => 'fleetmgmt_vehicle_fuel',
], ],
]; ];

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
/** /**
* mapper class. * Vehicle type l11n mapper class.
* *
* @package Modules\FleetManagement\Models * @package Modules\FleetManagement\Models
* @license OMS License 2.0 * @license OMS License 2.0

View File

@ -37,8 +37,8 @@ final class VehicleTypeMapper extends DataMapperFactory
* @since 1.0.0 * @since 1.0.0
*/ */
public const COLUMNS = [ public const COLUMNS = [
'fleetmgmt_vehicle_type_id' => ['name' => 'fleetmgmt_vehicle_type_id', 'type' => 'int', 'internal' => 'id'], 'fleetmgmt_vehicle_type_id' => ['name' => 'fleetmgmt_vehicle_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_type_name' => ['name' => 'fleetmgmt_vehicle_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true], 'fleetmgmt_vehicle_type_name' => ['name' => 'fleetmgmt_vehicle_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
]; ];

View File

@ -13,35 +13,35 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
':status1' => 'Aktiv', ':status1' => 'Aktiv',
':status2' => 'Inaktiv', ':status2' => 'Inaktiv',
':status3' => 'Beschädigt', ':status3' => 'Beschädigt',
':status4' => 'Außer Betrieb', ':status4' => 'Außer Betrieb',
':status-d1' => 'Aktiv', ':status-d1' => 'Aktiv',
':status-d2' => 'Inaktiv', ':status-d2' => 'Inaktiv',
':status-d3' => 'Fahrunfähig', ':status-d3' => 'Fahrunfähig',
'Attributes' => 'Attribute', 'Attributes' => 'Attribute',
'Costs' => 'Kosten', 'Costs' => 'Kosten',
'Date' => 'Datum', 'Date' => 'Datum',
'Driver' => 'Fahrer', 'Driver' => 'Fahrer',
'Drivers' => 'Fahrer', 'Drivers' => 'Fahrer',
'End' => 'Ende', 'End' => 'Ende',
'Files' => 'Dateien', 'Files' => 'Dateien',
'History' => 'Historie', 'History' => 'Historie',
'Inspections' => 'Inspektionen', 'Inspections' => 'Inspektionen',
'LeasingFee' => 'Leasingkosten', 'LeasingFee' => 'Leasingkosten',
'Make' => 'Marke', 'Make' => 'Marke',
'Milage' => 'Tacho', 'Milage' => 'Tacho',
'Model' => 'Modell', 'Model' => 'Modell',
'Name' => 'Name', 'Name' => 'Name',
'Notes' => 'Notizen', 'Notes' => 'Notizen',
'Profile' => 'Profile', 'Profile' => 'Profile',
'PurchasePrice' => 'Kaufpreis', 'PurchasePrice' => 'Kaufpreis',
'Responsible' => 'Verantwortlich', 'Responsible' => 'Verantwortlich',
'Start' => 'Start', 'Start' => 'Start',
'Status' => 'Status', 'Status' => 'Status',
'Type' => 'Typ', 'Type' => 'Typ',
'Upcoming' => 'Upcoming', 'Upcoming' => 'Upcoming',
'Vehicles' => 'Fahrzeuge', 'Vehicles' => 'Fahrzeuge',
'Vin' => 'Vin', 'Vin' => 'Vin',
]]; ]];

View File

@ -13,35 +13,35 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
':status1' => 'Active', ':status1' => 'Active',
':status2' => 'Inactive', ':status2' => 'Inactive',
':status3' => 'Damaged', ':status3' => 'Damaged',
':status4' => 'Out of order', ':status4' => 'Out of order',
':status-d1' => 'Active', ':status-d1' => 'Active',
':status-d2' => 'Inactive', ':status-d2' => 'Inactive',
':status-d3' => 'Suspended', ':status-d3' => 'Suspended',
'Attributes' => 'Attributes', 'Attributes' => 'Attributes',
'Costs' => 'Costs', 'Costs' => 'Costs',
'Date' => 'Date', 'Date' => 'Date',
'Driver' => 'Driver', 'Driver' => 'Driver',
'Drivers' => 'Drivers', 'Drivers' => 'Drivers',
'End' => 'End', 'End' => 'End',
'Files' => 'Files', 'Files' => 'Files',
'History' => 'History', 'History' => 'History',
'Inspections' => 'Inspections', 'Inspections' => 'Inspections',
'LeasingFee' => 'Leasing Fee', 'LeasingFee' => 'Leasing Fee',
'Make' => 'Make', 'Make' => 'Make',
'Milage' => 'Milage', 'Milage' => 'Milage',
'Model' => 'Model', 'Model' => 'Model',
'Name' => 'Name', 'Name' => 'Name',
'Notes' => 'Notes', 'Notes' => 'Notes',
'Profile' => 'Profile', 'Profile' => 'Profile',
'PurchasePrice' => 'Purchase Price', 'PurchasePrice' => 'Purchase Price',
'Responsible' => 'Responsible', 'Responsible' => 'Responsible',
'Start' => 'Start', 'Start' => 'Start',
'Status' => 'Status', 'Status' => 'Status',
'Type' => 'Type', 'Type' => 'Type',
'Upcoming' => 'Upcoming', 'Upcoming' => 'Upcoming',
'Vehicles' => 'Vehicles', 'Vehicles' => 'Vehicles',
'Vin' => 'Vin', 'Vin' => 'Vin',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Dato', 'Date' => 'Dato',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Filer', 'Files' => 'Filer',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'Navn', 'Name' => 'Navn',
'Notes' => 'Notater', 'Notes' => 'Notater',
'Profile' => 'Profil', 'Profile' => 'Profil',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Type', 'Type' => 'Type',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Data', 'Date' => 'Data',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Pliki', 'Files' => 'Pliki',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'Nazwa', 'Name' => 'Nazwa',
'Notes' => 'Notatki', 'Notes' => 'Notatki',
'Profile' => 'Profil', 'Profile' => 'Profil',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Rodzaj', 'Type' => 'Rodzaj',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Encontro', 'Date' => 'Encontro',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'arquivos', 'Files' => 'arquivos',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'Nome', 'Name' => 'Nome',
'Notes' => 'Notas', 'Notes' => 'Notas',
'Profile' => 'Perfil', 'Profile' => 'Perfil',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Modelo', 'Type' => 'Modelo',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Дата', 'Date' => 'Дата',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Файлы', 'Files' => 'Файлы',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'Имя', 'Name' => 'Имя',
'Notes' => 'Примечания', 'Notes' => 'Примечания',
'Profile' => 'Профиль', 'Profile' => 'Профиль',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Тип', 'Type' => 'Тип',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Datum', 'Date' => 'Datum',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Filer', 'Files' => 'Filer',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'namn', 'Name' => 'namn',
'Notes' => 'Anteckningar', 'Notes' => 'Anteckningar',
'Profile' => 'Profil', 'Profile' => 'Profil',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Typ', 'Type' => 'Typ',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'วันที่', 'Date' => 'วันที่',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'ไฟล์', 'Files' => 'ไฟล์',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'ชื่อ', 'Name' => 'ชื่อ',
'Notes' => 'หมายเหตุ', 'Notes' => 'หมายเหตุ',
'Profile' => 'ประวัติโดยย่อ', 'Profile' => 'ประวัติโดยย่อ',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'พิมพ์', 'Type' => 'พิมพ์',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Tarih', 'Date' => 'Tarih',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Dosyalar', 'Files' => 'Dosyalar',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'İsim', 'Name' => 'İsim',
'Notes' => 'Notalar', 'Notes' => 'Notalar',
'Profile' => 'Profil', 'Profile' => 'Profil',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Tip', 'Type' => 'Tip',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => 'Дата', 'Date' => 'Дата',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => 'Файли', 'Files' => 'Файли',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => 'Назва', 'Name' => 'Назва',
'Notes' => 'Ноти', 'Notes' => 'Ноти',
'Profile' => 'Профіль', 'Profile' => 'Профіль',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => 'Тип', 'Type' => 'Тип',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -13,32 +13,32 @@
declare(strict_types=1); declare(strict_types=1);
return ['FleetManagement' => [ return ['FleetManagement' => [
'Attributes' => '', 'Attributes' => '',
'Costs' => '', 'Costs' => '',
'Date' => '日期', 'Date' => '日期',
'Description' => '', 'Description' => '',
'Driver' => '', 'Driver' => '',
'Drivers' => '', 'Drivers' => '',
'End' => '', 'End' => '',
'Files' => '文件', 'Files' => '文件',
'From' => '', 'From' => '',
'History' => '', 'History' => '',
'Inspections' => '', 'Inspections' => '',
'LeasingFee' => '', 'LeasingFee' => '',
'Make' => '', 'Make' => '',
'Milage' => '', 'Milage' => '',
'Model' => '', 'Model' => '',
'Name' => '名称', 'Name' => '名称',
'Notes' => '笔记', 'Notes' => '笔记',
'Profile' => '轮廓', 'Profile' => '轮廓',
'PurchasePrice' => '', 'PurchasePrice' => '',
'Responsible' => '', 'Responsible' => '',
'Start' => '', 'Start' => '',
'Status' => '', 'Status' => '',
'To' => '', 'To' => '',
'Type' => '类型', 'Type' => '类型',
'Upcoming' => '', 'Upcoming' => '',
'VIN' => '', 'VIN' => '',
'Vehicles' => '', 'Vehicles' => '',
'Vin' => '', 'Vin' => '',
]]; ]];

View File

@ -86,7 +86,7 @@ echo $this->data['nav']->render(); ?>
<tr> <tr>
<td><a href="#"><i class="g-icon">close</i></a> <td><a href="#"><i class="g-icon">close</i></a>
<td><a href="#"><i class="g-icon">settings</i></a> <td><a href="#"><i class="g-icon">settings</i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?> <td><?= ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
<td><?= $value->content; ?> <td><?= $value->content; ?>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($c === 0) : ?> <?php if ($c === 0) : ?>

View File

@ -24,41 +24,41 @@ echo $this->data['nav']->render(); ?>
<section class="portlet"> <section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Drivers'); ?><i class="g-icon download btn end-xs">download</i></div> <div class="portlet-head"><?= $this->getHtml('Drivers'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider"> <div class="slider">
<table id="iSalesClientList" class="default sticky"> <table id="iDriverList" class="default sticky">
<thead> <thead>
<tr> <tr>
<td> <td>
<td><?= $this->getHtml('ID', '0', '0'); ?> <td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="iSalesClientList-sort-1"> <label for="iDriverList-sort-1">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-1">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-2"> <label for="iDriverList-sort-2">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-2"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-2">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
<i class="filter g-icon">filter_alt</i> <i class="filter g-icon">filter_alt</i>
</label> </label>
<td><?= $this->getHtml('Status'); ?> <td><?= $this->getHtml('Status'); ?>
<label for="iSalesClientList-sort-3"> <label for="iDriverList-sort-3">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-3">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-4"> <label for="iDriverList-sort-4">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-4"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-4">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
<i class="filter g-icon">filter_alt</i> <i class="filter g-icon">filter_alt</i>
</label> </label>
<td class="wf-100"><?= $this->getHtml('Name'); ?> <td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesClientList-sort-5"> <label for="iDriverList-sort-5">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-5">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-6"> <label for="iDriverList-sort-6">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-6"> <input type="radio" name="iDriverList-sort" id="iDriverList-sort-6">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
@ -69,7 +69,7 @@ echo $this->data['nav']->render(); ?>
$count = 0; $count = 0;
foreach ($drivers as $key => $value) : foreach ($drivers as $key => $value) :
++$count; ++$count;
$url = UriFactory::build('{/base}/fleet/driver/profile?{?}&id=' . $value->id); $url = UriFactory::build('{/base}/fleet/driver/view?{?}&id=' . $value->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td> <td>

View File

@ -17,17 +17,15 @@ use Modules\FleetManagement\Models\Driver\NullDriver;
use Modules\Media\Models\NullMedia; use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
$countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants(); $countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants(); $countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
$driverStatus = DriverStatus::getConstants(); $driverStatus = DriverStatus::getConstants();
/** /**
* @var \Modules\FleetManagement\Models\Driver $driver * @var \Modules\FleetManagement\Models\Driver $driver
*/ */
$driver = $this->data['driver'] ?? new NullDriver(); $driver = $this->data['driver'] ?? new NullDriver();
$files = $driver->files; $driverImage = $this->data['driverImage'] ?? new NullMedia();
$driverImage = $this->data['driverImage'] ?? new NullMedia();
$attributeView = $this->data['attributeView'];
/** /**
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
@ -98,7 +96,7 @@ echo $this->data['nav']->render();
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<?= $attributeView->render( <?= $this->data['attributeView']->render(
$driver->attributes, $driver->attributes,
$this->data['attributeTypes'] ?? [], $this->data['attributeTypes'] ?? [],
[], [],
@ -201,7 +199,7 @@ echo $this->data['nav']->render();
</div> </div>
<?php if (0 > 0) : ?> <?php if (0 > 0) : ?>
<div class="ipt-second"> <div class="ipt-second">
<a class="button" href="<?= UriFactory::build('{/base}/sales/client/profile?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a> <a class="button" href="<?= UriFactory::build('{/base}/sales/client/view?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -0,0 +1,326 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\ClientManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\FleetManagement\Models\Driver\DriverStatus;
use Modules\FleetManagement\Models\Driver\NullDriver;
use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
$countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
$driverStatus = DriverStatus::getConstants();
/**
* @var \Modules\FleetManagement\Models\Driver $driver
*/
$driver = $this->data['driver'] ?? new NullDriver();
$driverImage = $this->data['driverImage'] ?? new NullMedia();
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Attributes'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('Notes'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Inspections'); ?></label>
<li><label for="c-tab-7"><?= $this->getHtml('Milage'); ?></label>
<li><label for="c-tab-8"><?= $this->getHtml('Costs'); ?></label>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Profile'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iFleetDriverProfileName"><?= $this->getHtml('Name'); ?></label>
<input type="text" id="iFleetDriverProfileName" name="name" value="<?= $this->printHtml($driver->account->name1); ?>">
</div>
<div class="form-group">
<label for="iDriverStatus"><?= $this->getHtml('Status'); ?></label>
<select id="iDriverStatus" name="driver_status">
<?php foreach ($driverStatus as $status) : ?>
<option value="<?= $status; ?>"<?= $status === $driver->status ? ' selected' : ''; ?>><?= $this->getHtml(':status-d' . $status); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iDriverMake"><?= $this->getHtml('Make'); ?></label>
<input type="text" id="iDriverMake" name="make" value="<?= $this->printHtml($driver->getAttribute('maker')->value->getValue()); ?>">
</div>
</div>
<div class="portlet-foot">
<?php if ($driver->id === 0) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</section>
</div>
<div class="md-hidden col-md-6">
<section class="portlet">
<div class="portlet-body">
<img width="100%" src="<?= $driverImage->id === 0
? 'Web/Backend/img/logo_grey.png'
: UriFactory::build($driverImage->getPath()); ?>"></a>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<?= $this->data['attributeView']->render(
$driver->attributes,
$this->data['attributeTypes'] ?? [],
[],
'{/api}fleet/driver/attribute',
$driver->id
);
?>
</div>
</div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab col-simple">
<?= $this->data['media-upload']->render('driver-file', 'files', '', $driver->files); ?>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<?= $this->data['driver-notes']->render('driver-notes', '', $driver->notes); ?>
</div>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<a class="button" href="<?= UriFactory::build('{/base}/fleet/inspection/create?driver=' . $driver->id); ?>"><?= $this->getHtml('Create', '0', '0'); ?></a>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Upcoming'); ?></div>
<table id="upcomingInspections" class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Date'); ?>
<td class="wf-100"><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Responsible'); ?>
<tbody>
<?php foreach ($this->data['inspections'] as $inspection) :
// @todo handle old inspections in the past? maybe use a status?!
if ($inspection->next === null) {
continue;
}
?>
<tr>
<td><?= $inspection->next->format('Y-m-d H:i'); ?>
<td><?= $this->printHtml($inspection->type->getL11n()); ?>
<td>
<?php endforeach; ?>
</table>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('History'); ?></div>
<table id="historicInspections" class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Date'); ?>
<td class="wf-100"><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Responsible'); ?>
<tbody>
<?php foreach ($this->data['inspections'] as $inspection) : ?>
<tr>
<td><?= $inspection->date->format('Y-m-d H:i'); ?>
<td><?= $this->printHtml($inspection->type->getL11n()); ?>
<td>
<?php endforeach; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="milageForm" action="<?= UriFactory::build(''); ?>" method="post"
data-ui-container="#milageTable tbody"
data-add-form="milageForm"
data-add-tpl="#milageTable tbody .oms-add-tpl-milage">
<div class="portlet-head"><?= $this->getHtml('Milage'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iAttributeId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" id="iAttributeId" name="id" data-tpl-text="/id" data-tpl-value="/id" disabled>
</div>
<div class="form-group">
<label for="iDriver"><?= $this->getHtml('Driver'); ?></label>
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" formaction="">
<i class="g-icon">book</i>
</button>
<input type="text" id="iDriver" name="bill_client" value="">
</span>
</div>
<?php if (0 > 0) : ?>
<div class="ipt-second">
<a class="button" href="<?= UriFactory::build('{/base}/sales/client/view?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a>
</div>
<?php endif; ?>
</div>
</div>
<div class="form-group">
<label for="iStartDate"><?= $this->getHtml('Start'); ?></label>
<input type="datetime-local" id="iStartDate" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iEndDate"><?= $this->getHtml('End'); ?></label>
<input type="datetime-local" id="iEndDate" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iFrom"><?= $this->getHtml('From'); ?></label>
<input type="text" id="iFrom" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iTo"><?= $this->getHtml('To'); ?></label>
<input type="text" id="iTo" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iMilage"><?= $this->getHtml('Milage'); ?></label>
<input type="number" id="iMilage" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iMilageDescription"><?= $this->getHtml('Description'); ?></label>
<pre class="textarea contenteditable" id="iMilageDescription" data-name="description" data-tpl-value="/value" contenteditable></pre>
</div>
</div>
<div class="portlet-foot">
<input id="bAttributeAdd" formmethod="put" type="submit" class="add-form" value="<?= $this->getHtml('Add', '0', '0'); ?>">
<input id="bAttributeSave" formmethod="post" type="submit" class="save-form hidden button save" value="<?= $this->getHtml('Update', '0', '0'); ?>">
<input type="submit" class="cancel-form hidden button close" value="<?= $this->getHtml('Cancel', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Milage'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="milageTable" class="default sticky"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-milage"
data-update-form="milageForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Driver'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Milage'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Start'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('End'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<tbody>
<template class="oms-add-tpl-milage">
<tr data-id="" draggable="false">
<td>
<i class="g-icon btn update-form">settings</i>
<input id="milageTable-remove-0" type="checkbox" class="hidden">
<label for="milageTable-remove-0" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="milageTable-remove-0" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="milageTable-remove-0" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<td data-tpl-text="/id" data-tpl-value="/id"></td>
<td data-tpl-text="/type" data-tpl-value="/type" data-value=""></td>
<td data-tpl-text="/value" data-tpl-value="/value"></td>
<td data-tpl-text="/unit" data-tpl-value="/unit"></td>
<td data-tpl-text="/unit" data-tpl-value="/unit"></td>
</tr>
</template>
<?php $c = 0;
$milage = [];
foreach ($milage as $key => $value) : ++$c; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if (!$value->type->isRequired) : ?>
<input id="milageTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="milageTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="milageTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="milageTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<?php endif; ?>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/type" data-tpl-value="/type" data-value="<?= $value->type->id; ?>"><?= $this->printHtml($value->type->getL11n()); ?>
<td data-tpl-text="/value" data-tpl-value="/value"><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $value->value->unit; ?>"><?= $this->printHtml($value->value->unit); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $value->value->unit; ?>"><?= $this->printHtml($value->value->unit); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="6" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-8" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
</div>
</div>
</div>
</div>
</div>

View File

@ -24,53 +24,53 @@ echo $this->data['nav']->render(); ?>
<section class="portlet"> <section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Vehicles'); ?><i class="g-icon download btn end-xs">download</i></div> <div class="portlet-head"><?= $this->getHtml('Vehicles'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider"> <div class="slider">
<table id="iSalesClientList" class="default sticky"> <table id="iVehicleList" class="default sticky">
<thead> <thead>
<tr> <tr>
<td> <td>
<td><?= $this->getHtml('ID', '0', '0'); ?> <td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="iSalesClientList-sort-1"> <label for="iVehicleList-sort-1">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-1">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-2"> <label for="iVehicleList-sort-2">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-2"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-2">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
<i class="filter g-icon">filter_alt</i> <i class="filter g-icon">filter_alt</i>
</label> </label>
<td><?= $this->getHtml('Status'); ?> <td><?= $this->getHtml('Status'); ?>
<label for="iSalesClientList-sort-3"> <label for="iVehicleList-sort-3">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-3">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-4"> <label for="iVehicleList-sort-4">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-4"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-4">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
<i class="filter g-icon">filter_alt</i> <i class="filter g-icon">filter_alt</i>
</label> </label>
<td class="wf-100"><?= $this->getHtml('Name'); ?> <td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesClientList-sort-5"> <label for="iVehicleList-sort-5">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-5">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-6"> <label for="iVehicleList-sort-6">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-6"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-6">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
<i class="filter g-icon">filter_alt</i> <i class="filter g-icon">filter_alt</i>
</label> </label>
<td><?= $this->getHtml('Type'); ?> <td><?= $this->getHtml('Type'); ?>
<label for="iSalesClientList-sort-7"> <label for="iVehicleList-sort-7">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-7"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-7">
<i class="sort-asc g-icon">expand_less</i> <i class="sort-asc g-icon">expand_less</i>
</label> </label>
<label for="iSalesClientList-sort-8"> <label for="iVehicleList-sort-8">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-8"> <input type="radio" name="iVehicleList-sort" id="iVehicleList-sort-8">
<i class="sort-desc g-icon">expand_more</i> <i class="sort-desc g-icon">expand_more</i>
</label> </label>
<label> <label>
@ -81,7 +81,7 @@ echo $this->data['nav']->render(); ?>
$count = 0; $count = 0;
foreach ($vehicles as $key => $value) : foreach ($vehicles as $key => $value) :
++$count; ++$count;
$url = UriFactory::build('{/base}/fleet/vehicle/profile?{?}&id=' . $value->id); $url = UriFactory::build('{/base}/fleet/vehicle/view?{?}&id=' . $value->id);
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td> <td>

View File

@ -24,11 +24,9 @@ $vehicleStatus = VehicleStatus::getConstants();
/** /**
* @var \Modules\FleetManagement\Models\Vehicle $vehicle * @var \Modules\FleetManagement\Models\Vehicle $vehicle
*/ */
$vehicle = $this->data['vehicle'] ?? new NullVehicle(); $vehicle = $this->data['vehicle'] ?? new NullVehicle();
$files = $vehicle->files; $vehicleImage = $this->data['vehicleImage'] ?? new NullMedia();
$vehicleImage = $this->data['vehicleImage'] ?? new NullMedia(); $vehicleTypes = $this->data['types'] ?? [];
$vehicleTypes = $this->data['types'] ?? [];
$attributeView = $this->data['attributeView'];
/** /**
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
@ -143,7 +141,7 @@ echo $this->data['nav']->render();
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>> <input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab"> <div class="tab">
<div class="row"> <div class="row">
<?= $attributeView->render( <?= $this->data['attributeView']->render(
$vehicle->attributes, $vehicle->attributes,
$this->data['attributeTypes'] ?? [], $this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [], $this->data['units'] ?? [],
@ -246,7 +244,7 @@ echo $this->data['nav']->render();
</div> </div>
<?php if (0 > 0) : ?> <?php if (0 > 0) : ?>
<div class="ipt-second"> <div class="ipt-second">
<a class="button" href="<?= UriFactory::build('{/base}/sales/client/profile?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a> <a class="button" href="<?= UriFactory::build('{/base}/sales/client/view?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a>
</div> </div>
<?php endif; ?> <?php endif; ?>
</div> </div>

View File

@ -0,0 +1,385 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\ClientManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\FleetManagement\Models\NullVehicle;
use Modules\FleetManagement\Models\VehicleStatus;
use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
$countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
$vehicleStatus = VehicleStatus::getConstants();
/**
* @var \Modules\FleetManagement\Models\Vehicle $vehicle
*/
$vehicle = $this->data['vehicle'] ?? new NullVehicle();
$vehicleImage = $this->data['vehicleImage'] ?? new NullMedia();
$vehicleTypes = $this->data['types'] ?? [];
/**
* @var \phpOMS\Views\View $this
*/
echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Attributes'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('Notes'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Inspections'); ?></label>
<li><label for="c-tab-7"><?= $this->getHtml('Milage'); ?></label>
<li><label for="c-tab-8"><?= $this->getHtml('Costs'); ?></label>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Profile'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iFleetVehicleProfileName"><?= $this->getHtml('Name'); ?></label>
<input type="text" id="iFleetVehicleProfileName" name="name" value="<?= $this->printHtml($vehicle->name); ?>">
</div>
<div class="form-group">
<label for="iVehicleDriver"><?= $this->getHtml('Driver'); ?></label>
<input type="text" id="iVehicleDriver" name="driver" value="" disabled>
</div>
<div class="form-group">
<label for="iVehicleVin"><?= $this->getHtml('VIN'); ?></label>
<input type="text" id="iVehicleVin" name="vin" value="<?= $this->printHtml($vehicle->getAttribute('vin')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehicleStatus"><?= $this->getHtml('Status'); ?></label>
<select id="iVehicleStatus" name="vehicle_status">
<?php foreach ($vehicleStatus as $status) : ?>
<option value="<?= $status; ?>"<?= $status === $vehicle->status ? ' selected' : ''; ?>><?= $this->getHtml(':status' . $status); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iVehicleEnd"><?= $this->getHtml('Type'); ?></label>
<select id="iVehicleEnd" name="vehicle_type">
<?php foreach ($vehicleTypes as $type) : ?>
<option value="<?= $type->id; ?>"<?= $vehicle->type->id === $type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iVehicleMake"><?= $this->getHtml('Make'); ?></label>
<input type="text" id="iVehicleMake" name="make" value="<?= $this->printHtml($vehicle->getAttribute('maker')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehicleModel"><?= $this->getHtml('Model'); ?></label>
<input type="text" id="iVehicleModel" name="vehicle_model" value="<?= $this->printHtml($vehicle->getAttribute('vehicle_model')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehicleStart"><?= $this->getHtml('Start'); ?></label>
<input type="datetime-local" id="iVehicleStart" name="ownership_start" value="<?= $vehicle->getAttribute('ownership_start')->value->getValue()?->format('Y-m-d\TH:i') ?? $vehicle->createdAt->format('Y-m-d\TH:i'); ?>">
</div>
<div class="form-group">
<label for="iVehicleEnd"><?= $this->getHtml('End'); ?></label>
<input type="datetime-local" id="iVehicleEnd" name="ownership_end" value="<?= $vehicle->getAttribute('ownership_end')->value->getValue()?->format('Y-m-d\TH:i'); ?>">
</div>
<div class="form-group">
<label for="iVehiclePrice"><?= $this->getHtml('PurchasePrice'); ?></label>
<input type="number" step="0.01" id="iVehiclePrice" name="purchase_price" value="<?= $this->printHtml($vehicle->getAttribute('purchase_price')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehiclePrice"><?= $this->getHtml('LeasingFee'); ?></label>
<input type="number" step="0.01" id="iVehiclePrice" name="leasing_fee" value="<?= $this->printHtml($vehicle->getAttribute('leasing_fee')->value->getValue()); ?>">
</div>
</div>
<div class="portlet-foot">
<?php if ($vehicle->id === 0) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-body">
<img width="100%" src="<?= $vehicleImage->id === 0
? 'Web/Backend/img/logo_grey.png'
: UriFactory::build($vehicleImage->getPath()); ?>"></a>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<?= $this->data['attributeView']->render(
$vehicle->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}fleet/vehicle/attribute',
$vehicle->id
);
?>
</div>
</div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab col-simple">
<?= $this->data['media-upload']->render('vehicle-file', 'files', '', $vehicle->files); ?>
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<?= $this->data['vehicle-notes']->render('vehicle-notes', '', $vehicle->notes); ?>
</div>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<a class="button" href="<?= UriFactory::build('{/base}/fleet/inspection/create?vehicle=' . $vehicle->id); ?>"><?= $this->getHtml('Create', '0', '0'); ?></a>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Upcoming'); ?></div>
<table id="upcomingInspections" class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Date'); ?>
<td class="wf-100"><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Responsible'); ?>
<tbody>
<?php
$count = 0;
foreach ($this->data['inspections'] as $inspection) :
// @todo handle old inspections in the past? maybe use a status?!
if ($inspection->next === null) {
continue;
}
++$count;
?>
<tr>
<td><?= $inspection->next->format('Y-m-d H:i'); ?>
<td><?= $this->printHtml($inspection->type->getL11n()); ?>
<td>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('History'); ?></div>
<table id="historicInspections" class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('Date'); ?>
<td class="wf-100"><?= $this->getHtml('Type'); ?>
<td><?= $this->getHtml('Responsible'); ?>
<tbody>
<?php
$count = 0;
foreach ($this->data['inspections'] as $inspection) :
++$count;
?>
<tr>
<td><?= $inspection->date->format('Y-m-d H:i'); ?>
<td><?= $this->printHtml($inspection->type->getL11n()); ?>
<td>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-7" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-7' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="milageForm" action="<?= UriFactory::build(''); ?>" method="post"
data-ui-container="#milageTable tbody"
data-add-form="milageForm"
data-add-tpl="#milageTable tbody .oms-add-tpl-milage">
<div class="portlet-head"><?= $this->getHtml('Milage'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iAttributeId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" id="iAttributeId" name="id" data-tpl-text="/id" data-tpl-value="/id" disabled>
</div>
<div class="form-group">
<label for="iDriver"><?= $this->getHtml('Driver'); ?></label>
<div class="ipt-wrap">
<div class="ipt-first">
<span class="input">
<button type="button" formaction="">
<i class="g-icon">book</i>
</button>
<input type="text" id="iDriver" name="bill_client" value="">
</span>
</div>
<?php if (0 > 0) : ?>
<div class="ipt-second">
<a class="button" href="<?= UriFactory::build('{/base}/sales/client/view?id=' . 0); ?>"><?= $this->getHtml('Driver'); ?></a>
</div>
<?php endif; ?>
</div>
</div>
<div class="form-group">
<label for="iStartDate"><?= $this->getHtml('Start'); ?></label>
<input type="datetime-local" id="iStartDate" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iEndDate"><?= $this->getHtml('End'); ?></label>
<input type="datetime-local" id="iEndDate" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iFrom"><?= $this->getHtml('From'); ?></label>
<input type="text" id="iFrom" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iTo"><?= $this->getHtml('To'); ?></label>
<input type="text" id="iTo" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iMilage"><?= $this->getHtml('Milage'); ?></label>
<input type="number" id="iMilage" name="bill_invoice_date"
value="">
</div>
<div class="form-group">
<label for="iMilageDescription"><?= $this->getHtml('Description'); ?></label>
<pre class="textarea contenteditable" id="iMilageDescription" data-name="description" data-tpl-value="/value" contenteditable></pre>
</div>
</div>
<div class="portlet-foot">
<input id="bAttributeAdd" formmethod="put" type="submit" class="add-form" value="<?= $this->getHtml('Add', '0', '0'); ?>">
<input id="bAttributeSave" formmethod="post" type="submit" class="save-form hidden button save" value="<?= $this->getHtml('Update', '0', '0'); ?>">
<input type="submit" class="cancel-form hidden button close" value="<?= $this->getHtml('Cancel', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Milage'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="milageTable" class="default sticky"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-milage"
data-update-form="milageForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Driver'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Milage'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Start'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('End'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<tbody>
<template class="oms-add-tpl-milage">
<tr data-id="" draggable="false">
<td>
<i class="g-icon btn update-form">settings</i>
<input id="milageTable-remove-0" type="checkbox" class="hidden">
<label for="milageTable-remove-0" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="milageTable-remove-0" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="milageTable-remove-0" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<td data-tpl-text="/id" data-tpl-value="/id"></td>
<td data-tpl-text="/type" data-tpl-value="/type" data-value=""></td>
<td data-tpl-text="/value" data-tpl-value="/value"></td>
<td data-tpl-text="/unit" data-tpl-value="/unit"></td>
<td data-tpl-text="/unit" data-tpl-value="/unit"></td>
</tr>
</template>
<?php $c = 0;
$milage = [];
foreach ($milage as $key => $value) : ++$c; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if (!$value->type->isRequired) : ?>
<input id="milageTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="milageTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="milageTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="milageTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<?php endif; ?>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/type" data-tpl-value="/type" data-value="<?= $value->type->id; ?>"><?= $this->printHtml($value->type->getL11n()); ?>
<td data-tpl-text="/value" data-tpl-value="/value"><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $value->value->unit; ?>"><?= $this->printHtml($value->value->unit); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $value->value->unit; ?>"><?= $this->printHtml($value->value->unit); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="6" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-8" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-8' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
</div>
</div>
</div>
</div>
</div>

View File

@ -75,8 +75,8 @@ final class Autoloader
*/ */
public static function defaultAutoloader(string $class) : void public static function defaultAutoloader(string $class) : void
{ {
$class = \ltrim($class, '\\'); $class = \ltrim($class, '\\');
$class = \strtr($class, '_\\', '//'); $class = \strtr($class, '_\\', '//');
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) { if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class); $class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);

View File

@ -1,4 +1,15 @@
<?php <?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1); declare(strict_types=1);
\ini_set('memory_limit', '2048M'); \ini_set('memory_limit', '2048M');
@ -67,10 +78,10 @@ $GLOBALS['is_github'] = $IS_GITHUB;
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs'); $tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
$CONFIG = [ $CONFIG = [
'db' => [ 'db' => [
'core' => [ 'core' => [
'masters' => [ 'masters' => [
'admin' => [ 'admin' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -80,7 +91,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'insert' => [ 'insert' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -90,7 +101,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'select' => [ 'select' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -100,7 +111,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'update' => [ 'update' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -110,7 +121,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'delete' => [ 'delete' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -120,7 +131,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'schema' => [ 'schema' => [
'db' => 'mysql', /* db type */ 'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */ 'port' => '3306', /* db host port */
@ -132,7 +143,7 @@ $CONFIG = [
], ],
], ],
'postgresql' => [ 'postgresql' => [
'admin' => [ 'admin' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -142,7 +153,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'insert' => [ 'insert' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -152,7 +163,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'select' => [ 'select' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -162,7 +173,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'update' => [ 'update' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -172,7 +183,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'delete' => [ 'delete' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -182,7 +193,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'schema' => [ 'schema' => [
'db' => 'pgsql', /* db type */ 'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */ 'port' => '5432', /* db host port */
@ -194,37 +205,37 @@ $CONFIG = [
], ],
], ],
'sqlite' => [ 'sqlite' => [
'admin' => [ 'admin' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'insert' => [ 'insert' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'select' => [ 'select' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'update' => [ 'update' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'delete' => [ 'delete' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'schema' => [ 'schema' => [
'db' => 'sqlite', /* db type */ 'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */ 'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
@ -232,7 +243,7 @@ $CONFIG = [
], ],
], ],
'mssql' => [ 'mssql' => [
'admin' => [ 'admin' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -242,7 +253,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'insert' => [ 'insert' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -252,7 +263,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'select' => [ 'select' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -262,7 +273,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'update' => [ 'update' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -272,7 +283,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'delete' => [ 'delete' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -282,7 +293,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */ 'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s', 'datetimeformat' => 'Y-m-d H:i:s',
], ],
'schema' => [ 'schema' => [
'db' => 'mssql', /* db type */ 'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */ 'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */ 'port' => '1433', /* db host port */
@ -322,16 +333,16 @@ $CONFIG = [
'password' => '123456', 'password' => '123456',
], ],
], ],
'log' => [ 'log' => [
'file' => [ 'file' => [
'path' => __DIR__ . '/Logs', 'path' => __DIR__ . '/Logs',
], ],
], ],
'page' => [ 'page' => [
'root' => '/', 'root' => '/',
'https' => false, 'https' => false,
], ],
'app' => [ 'app' => [
'path' => __DIR__, 'path' => __DIR__,
'default' => [ 'default' => [
'app' => 'Backend', 'app' => 'Backend',
@ -350,7 +361,7 @@ $CONFIG = [
], ],
], ],
], ],
'socket' => [ 'socket' => [
'master' => [ 'master' => [
'host' => '127.0.0.1', 'host' => '127.0.0.1',
'limit' => 300, 'limit' => 300,
@ -360,7 +371,7 @@ $CONFIG = [
'language' => [ 'language' => [
'en', 'en',
], ],
'apis' => [ 'apis' => [
], ],
]; ];

View File

@ -19,7 +19,6 @@ use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode; use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Uri\HttpUri;
include_once __DIR__ . '/../../Autoloader.php'; include_once __DIR__ . '/../../Autoloader.php';
@ -32,7 +31,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeTypeCreate() : void public function testApiVehicleAttributeTypeCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('name', 'test_attribute'); $request->setData('name', 'test_attribute');
@ -50,7 +49,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeTypeL11nCreate() : void public function testApiVehicleAttributeTypeL11nCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('title', 'DE:2'); $request->setData('title', 'DE:2');
@ -68,7 +67,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeValueIntCreate() : void public function testApiVehicleAttributeValueIntCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('default', '1'); $request->setData('default', '1');
@ -88,7 +87,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeValueStrCreate() : void public function testApiVehicleAttributeValueStrCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('type', '1'); $request->setData('type', '1');
@ -107,7 +106,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeValueFloatCreate() : void public function testApiVehicleAttributeValueFloatCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('type', '1'); $request->setData('type', '1');
@ -126,7 +125,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeValueDatCreate() : void public function testApiVehicleAttributeValueDatCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('type', '1'); $request->setData('type', '1');
@ -145,7 +144,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeCreate() : void public function testApiVehicleAttributeCreate() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('ref', '1'); $request->setData('ref', '1');
@ -163,7 +162,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeValueCreateInvalidData() : void public function testApiVehicleAttributeValueCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('invalid', '1'); $request->setData('invalid', '1');
@ -179,7 +178,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeTypeCreateInvalidData() : void public function testApiVehicleAttributeTypeCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('invalid', '1'); $request->setData('invalid', '1');
@ -195,7 +194,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeTypeL11nCreateInvalidData() : void public function testApiVehicleAttributeTypeL11nCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('invalid', '1'); $request->setData('invalid', '1');
@ -211,7 +210,7 @@ trait ApiControllerAttributeTrait
public function testApiVehicleAttributeCreateInvalidData() : void public function testApiVehicleAttributeCreateInvalidData() : void
{ {
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$request->header->account = 1; $request->header->account = 1;
$request->setData('invalid', '1'); $request->setData('invalid', '1');

View File

@ -18,7 +18,6 @@ use Modules\FleetManagement\Models\FuelTypeMapper;
use Modules\FleetManagement\Models\VehicleTypeMapper; use Modules\FleetManagement\Models\VehicleTypeMapper;
use phpOMS\Message\Http\HttpRequest; use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse; use phpOMS\Message\Http\HttpResponse;
use phpOMS\Uri\HttpUri;
use phpOMS\Utils\RnG\Text; use phpOMS\Utils\RnG\Text;
trait ApiControllerVehicleTrait trait ApiControllerVehicleTrait
@ -34,7 +33,7 @@ trait ApiControllerVehicleTrait
$fuelTypeCount = FuelTypeMapper::count()->execute(); $fuelTypeCount = FuelTypeMapper::count()->execute();
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(new HttpUri('')); $request = new HttpRequest();
$LOREM = \array_slice(Text::LOREM_IPSUM, 0, 25); $LOREM = \array_slice(Text::LOREM_IPSUM, 0, 25);
$LOREM_COUNT = \count($LOREM) - 1; $LOREM_COUNT = \count($LOREM) - 1;

View File

@ -57,13 +57,13 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
protected string $appName = 'Api'; protected string $appName = 'Api';
}; };
$this->app->dbPool = $GLOBALS['dbpool']; $this->app->dbPool = $GLOBALS['dbpool'];
$this->app->unitId = 1; $this->app->unitId = 1;
$this->app->accountManager = new AccountManager($GLOBALS['session']); $this->app->accountManager = new AccountManager($GLOBALS['session']);
$this->app->appSettings = new CoreSettings(); $this->app->appSettings = new CoreSettings();
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/'); $this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
$this->app->dispatcher = new Dispatcher($this->app); $this->app->dispatcher = new Dispatcher($this->app);
$this->app->eventManager = new EventManager($this->app->dispatcher); $this->app->eventManager = new EventManager($this->app->dispatcher);
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php'); $this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
$this->app->sessionManager = new HttpSession(36000); $this->app->sessionManager = new HttpSession(36000);
$this->app->l11nManager = new L11nManager(); $this->app->l11nManager = new L11nManager();