test fixes + new test data

This commit is contained in:
Dennis Eichhorn 2023-05-19 02:37:35 +00:00
parent 5505bc4c6c
commit 32d786db4c
36 changed files with 3694 additions and 770 deletions

View File

@ -5,5 +5,12 @@
"name": "FleetManagement",
"virtualPath": "/Modules",
"user": 1
},
{
"type": "collection",
"create_directory": true,
"name": "Vehicle",
"virtualPath": "/Modules/FleetManagement",
"user": 1
}
]

View File

@ -19,7 +19,7 @@
"type": 2,
"subtype": 1,
"name": "Vehicles",
"uri": "{/base}/fleet/client/list",
"uri": "{/base}/fleet/vehicle/list",
"target": "self",
"icon": null,
"order": 1,

View File

@ -0,0 +1,285 @@
[
{
"name": "license_plate",
"l11n": {
"en": "License plate",
"de": "Kennzeichen"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "insurance_provider",
"l11n": {
"en": "Insurance provider",
"de": "Versicherung"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "insurance_number",
"l11n": {
"en": "Insurance number",
"de": "Versicherungsnummer"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "leasing_provider",
"l11n": {
"en": "Leasing provider",
"de": "Leasingsnummer"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "leasing_number",
"l11n": {
"en": "Leasing number",
"de": "Leasingsnummer"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "leasing_end",
"l11n": {
"en": "Leasing end",
"de": "Leasingende"
},
"value_type": 4,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "leasing_milage",
"l11n": {
"en": "Leasing milage",
"de": "Laufleistung"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "insurance_milage",
"l11n": {
"en": "Insurance milage",
"de": "Versicherungslaufleistung"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "engine_size",
"l11n": {
"en": "Engine size",
"de": "Hubraum"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "vin",
"l11n": {
"en": "VIN",
"de": "Fahrgestellnummer"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "make",
"l11n": {
"en": "Make",
"de": "Marke"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "model",
"l11n": {
"en": "Model",
"de": "Modell"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "color",
"l11n": {
"en": "Color",
"de": "Farbe"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "build",
"l11n": {
"en": "Build year",
"de": "Baujahr"
},
"value_type": 4,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "ownership_start",
"l11n": {
"en": "Ownership start",
"de": "Besitzbeginn"
},
"value_type": 4,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "ownership_end",
"l11n": {
"en": "Ownership end",
"de": "Besitzende"
},
"value_type": 4,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "fuel_type",
"l11n": {
"en": "Fuel type",
"de": "Kraftstoffart"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": [
{
"value": 1,
"l11n": {
"en": "None",
"de": "Kein"
}
},
{
"value": 2,
"l11n": {
"en": "Gas",
"de": "Benzin"
}
},
{
"value": 3,
"l11n": {
"en": "Diesel",
"de": "Diesel"
}
},
{
"value": 4,
"l11n": {
"en": "Electric",
"de": "Elektro"
}
},
{
"value": 5,
"l11n": {
"en": "Hydrogen",
"de": "Wasserstoff"
}
}
]
},
{
"name": "purchase_price",
"l11n": {
"en": "Purchase price",
"de": "Kaufpreis"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
},
{
"name": "leasing_residual_value",
"l11n": {
"en": "Leasing residual value",
"de": "Leasing Restwert"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
}
]

View File

@ -1,4 +1,100 @@
{
"fleetmgmt_fuel_type": {
"name": "fleetmgmt_fuel_type",
"fields": {
"fleetmgmt_fuel_type_id": {
"name": "fleetmgmt_fuel_type_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"fleetmgmt_fuel_type_name": {
"name": "fleetmgmt_fuel_type_name",
"type": "VARCHAR(255)",
"null": false
}
}
},
"fleetmgmt_fuel_type_l11n": {
"name": "fleetmgmt_fuel_type_l11n",
"fields": {
"fleetmgmt_fuel_type_l11n_id": {
"name": "fleetmgmt_fuel_type_l11n_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"fleetmgmt_fuel_type_l11n_title": {
"name": "fleetmgmt_fuel_type_l11n_title",
"type": "VARCHAR(255)",
"null": false
},
"fleetmgmt_fuel_type_l11n_type": {
"name": "fleetmgmt_fuel_type_l11n_type",
"type": "INT(11)",
"null": false,
"foreignTable": "fleetmgmt_fuel_type",
"foreignKey": "fleetmgmt_fuel_type_id"
},
"fleetmgmt_fuel_type_l11n_lang": {
"name": "fleetmgmt_fuel_type_l11n_lang",
"type": "VARCHAR(2)",
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
}
}
},
"fleetmgmt_vehicle_type": {
"name": "fleetmgmt_vehicle_type",
"fields": {
"fleetmgmt_vehicle_type_id": {
"name": "fleetmgmt_vehicle_type_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_type_name": {
"name": "fleetmgmt_vehicle_type_name",
"type": "VARCHAR(255)",
"null": false
}
}
},
"fleetmgmt_vehicle_type_l11n": {
"name": "fleetmgmt_vehicle_type_l11n",
"fields": {
"fleetmgmt_vehicle_type_l11n_id": {
"name": "fleetmgmt_vehicle_type_l11n_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_type_l11n_title": {
"name": "fleetmgmt_vehicle_type_l11n_title",
"type": "VARCHAR(255)",
"null": false
},
"fleetmgmt_vehicle_type_l11n_type": {
"name": "fleetmgmt_vehicle_type_l11n_type",
"type": "INT(11)",
"null": false,
"foreignTable": "fleetmgmt_vehicle_type",
"foreignKey": "fleetmgmt_vehicle_type_id"
},
"fleetmgmt_vehicle_type_l11n_lang": {
"name": "fleetmgmt_vehicle_type_l11n_lang",
"type": "VARCHAR(2)",
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
}
}
},
"fleetmgmt_vehicle": {
"name": "fleetmgmt_vehicle",
"fields": {
@ -9,6 +105,11 @@
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_name": {
"name": "fleetmgmt_vehicle_name",
"type": "VARCHAR(255)",
"null": false
},
"fleetmgmt_vehicle_status": {
"name": "fleetmgmt_vehicle_status",
"type": "TINYINT",
@ -16,8 +117,15 @@
},
"fleetmgmt_vehicle_type": {
"name": "fleetmgmt_vehicle_type",
"type": "TINYINT",
"null": false
"type": "INT",
"foreignTable": "fleetmgmt_vehicle_type",
"foreignKey": "fleetmgmt_vehicle_type_id"
},
"fleetmgmt_vehicle_fuel": {
"name": "fleetmgmt_vehicle_fuel",
"type": "INT",
"foreignTable": "fleetmgmt_fuel_type",
"foreignKey": "fleetmgmt_fuel_type_id"
},
"fleetmgmt_vehicle_info": {
"name": "fleetmgmt_vehicle_info",
@ -32,7 +140,8 @@
"fleetmgmt_vehicle_responsible": {
"name": "fleetmgmt_vehicle_responsible",
"type": "INT",
"null": false,
"null": true,
"default": true,
"foreignTable": "account",
"foreignKey": "account_id"
},
@ -46,41 +155,6 @@
}
}
},
"fleetmgmt_vehicle_responsible": {
"name": "fleetmgmt_vehicle_responsible",
"fields": {
"fleetmgmt_vehicle_responsible_id": {
"name": "fleetmgmt_vehicle_responsible_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_responsible_description": {
"name": "fleetmgmt_vehicle_responsible_description",
"type": "TEXT",
"null": false
},
"fleetmgmt_vehicle_responsible_account": {
"name": "fleetmgmt_vehicle_responsible_account",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
},
"fleetmgmt_vehicle_responsible_start": {
"name": "fleetmgmt_vehicle_responsible_start",
"type": "DATETIME",
"null": false
},
"fleetmgmt_vehicle_responsible_end": {
"name": "fleetmgmt_vehicle_responsible_end",
"type": "DATETIME",
"null": true,
"default": null
}
}
},
"fleetmgmt_vehicle_usage": {
"name": "fleetmgmt_vehicle_usage",
"fields": {
@ -326,8 +400,8 @@
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_attr_vehicle": {
"name": "fleetmgmt_vehicle_attr_vehicle",
"fleetmgmt_vehicle_attr_item": {
"name": "fleetmgmt_vehicle_attr_item",
"type": "INT(11)",
"null": false,
"foreignTable": "fleetmgmt_vehicle",
@ -360,19 +434,19 @@
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_media_dst": {
"name": "fleetmgmt_vehicle_media_dst",
"type": "INT",
"null": false,
"foreignTable": "media",
"foreignKey": "media_id"
},
"fleetmgmt_vehicle_media_src": {
"name": "fleetmgmt_vehicle_media_src",
"fleetmgmt_vehicle_media_vehicle": {
"name": "fleetmgmt_vehicle_media_vehicle",
"type": "INT",
"null": false,
"foreignTable": "fleetmgmt_vehicle",
"foreignKey": "fleetmgmt_vehicle_id"
},
"fleetmgmt_vehicle_media_media": {
"name": "fleetmgmt_vehicle_media_media",
"type": "INT",
"null": false,
"foreignTable": "media",
"foreignKey": "media_id"
}
}
},
@ -386,19 +460,19 @@
"primary": true,
"autoincrement": true
},
"fleetmgmt_vehicle_note_dst": {
"name": "fleetmgmt_vehicle_note_dst",
"type": "INT",
"null": false,
"foreignTable": "editor_doc",
"foreignKey": "editor_doc_id"
},
"fleetmgmt_vehicle_note_src": {
"name": "fleetmgmt_vehicle_note_src",
"fleetmgmt_vehicle_note_item": {
"name": "fleetmgmt_vehicle_note_item",
"type": "INT",
"null": false,
"foreignTable": "fleetmgmt_vehicle",
"foreignKey": "fleetmgmt_vehicle_id"
},
"fleetmgmt_vehicle_note_doc": {
"name": "fleetmgmt_vehicle_note_doc",
"type": "INT",
"null": false,
"foreignTable": "editor_doc",
"foreignKey": "editor_doc_id"
}
}
}

135
Admin/Install/fueltype.json Normal file
View File

@ -0,0 +1,135 @@
[
{
"name": "gasoline",
"l11n": {
"en": "Gasoline",
"de": "Benzin"
}
},
{
"name": "diesel",
"l11n": {
"en": "Diesel",
"de": "Diesel"
}
},
{
"name": "electirc",
"l11n": {
"en": "Electric",
"de": "Elektrisch"
}
},
{
"name": "hydrogen",
"l11n": {
"en": "Hydrogen",
"de": "Wasserstoff"
}
},
{
"name": "ethanol",
"l11n": {
"en": "Ethanol",
"de": "Ethanol"
}
},
{
"name": "kerosene",
"l11n": {
"en": "Kerosene",
"de": "Kerosin"
}
},
{
"name": "lpg",
"l11n": {
"en": "LPG",
"de": "Autogas"
}
},
{
"name": "methanol",
"l11n": {
"en": "Methanol",
"de": "Methanol"
}
},
{
"name": "methane",
"l11n": {
"en": "Methane",
"de": "Methan"
}
},
{
"name": "nitromethane",
"l11n": {
"en": "Nitromethane",
"de": "Nitromethan"
}
},
{
"name": "coal",
"l11n": {
"en": "Coal",
"de": "Kohle"
}
},
{
"name": "wood",
"l11n": {
"en": "Wood",
"de": "Holz"
}
},
{
"name": "petroleum",
"l11n": {
"en": "Petroleum",
"de": "Petroleum"
}
},
{
"name": "coaltar",
"l11n": {
"en": "Coaltar",
"de": "Steinkohlenteer"
}
},
{
"name": "coke",
"l11n": {
"en": "Coke",
"de": "Koks"
}
},
{
"name": "charcoale",
"l11n": {
"en": "Charcoale",
"de": "Holzkohle"
}
},
{
"name": "naturalgas",
"l11n": {
"en": "Naturalgas",
"de": "Erdgas"
}
},
{
"name": "biogas",
"l11n": {
"en": "Biogas",
"de": "Biogas"
}
},
{
"name": "biodiesel",
"l11n": {
"en": "Biodiesel",
"de": "Biodiesel"
}
}
]

View File

@ -0,0 +1,135 @@
[
{
"name": "car",
"l11n": {
"en": "Car",
"de": "Auto"
}
},
{
"name": "truck",
"l11n": {
"en": "Truck",
"de": "LKW"
}
},
{
"name": "motorcycle",
"l11n": {
"en": "Motorcycle",
"de": "Motorrad"
}
},
{
"name": "bicycle",
"l11n": {
"en": "Bicycle",
"de": "Fahrrad"
}
},
{
"name": "bus",
"l11n": {
"en": "Bus",
"de": "Bus"
}
},
{
"name": "boat",
"l11n": {
"en": "Boat",
"de": "Boot"
}
},
{
"name": "airplane",
"l11n": {
"en": "Airplane",
"de": "Flugzeug"
}
},
{
"name": "helicopter",
"l11n": {
"en": "Helicopter",
"de": "Hubschrauber"
}
},
{
"name": "train",
"l11n": {
"en": "Train",
"de": "Zug"
}
},
{
"name": "scooter",
"l11n": {
"en": "Scooter",
"de": "Roller"
}
},
{
"name": "moped",
"l11n": {
"en": "Moped",
"de": "Moped"
}
},
{
"name": "RV",
"l11n": {
"en": "Recreational Vehicle",
"de": "Wohnmobil"
}
},
{
"name": "tractor",
"l11n": {
"en": "Tractor",
"de": "Traktor"
}
},
{
"name": "forklift",
"l11n": {
"en": "Forklift",
"de": "Gabelstapler"
}
},
{
"name": "skateboard",
"l11n": {
"en": "Skateboard",
"de": "Skateboard"
}
},
{
"name": "snowmobile",
"l11n": {
"en": "Snowmobile",
"de": "Schneemobil"
}
},
{
"name": "jet_ski",
"l11n": {
"en": "Jet Ski",
"de": "Jet Ski"
}
},
{
"name": "quad_bike",
"l11n": {
"en": "Quad Bike",
"de": "Quad Bike"
}
},
{
"name": "golf_cart",
"l11n": {
"en": "Golf Cart",
"de": "Golf Cart"
}
}
]

View File

@ -14,7 +14,13 @@ declare(strict_types=1);
namespace Modules\FleetManagement\Admin;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Config\SettingsInterface;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/**
* Installer class.
@ -33,4 +39,304 @@ final class Installer extends InstallerAbstract
* @since 1.0.0
*/
public const PATH = __DIR__;
/**
* {@inheritdoc}
*/
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
{
parent::install($app, $info, $cfgHandler);
/* Attributes */
$fileContent = \file_get_contents(__DIR__ . '/Install/attributes.json');
if ($fileContent === false) {
return;
}
/** @var array $attributes */
$attributes = \json_decode($fileContent, true);
$attrTypes = self::createAttributeTypes($app, $attributes);
$attrValues = self::createAttributeValues($app, $attrTypes, $attributes);
/* Fuel types */
$fileContent = \file_get_contents(__DIR__ . '/Install/fueltype.json');
if ($fileContent === false) {
return;
}
/** @var array $types */
$types = \json_decode($fileContent, true);
$fuelTypes = self::createFuelTypes($app, $types);
/* Fuel types */
$fileContent = \file_get_contents(__DIR__ . '/Install/vehicletype.json');
if ($fileContent === false) {
return;
}
/** @var array $types */
$types = \json_decode($fileContent, true);
$vehicleTypes = self::createVehicleTypes($app, $types);
}
/**
* Install fuel type
*
* @param ApplicationAbstract $app Application
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createFuelTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $fuelTypes */
$fuelTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement');
/** @var array $type */
foreach ($types as $type) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('name', $type['name'] ?? '');
$request->setData('title', \reset($type['l11n']));
$request->setData('language', \array_keys($type['l11n'])[0] ?? 'en');
$module->apiFuelTypeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$fuelTypes[$type['name']] = !\is_array($responseData['response'])
? $responseData['response']->toArray()
: $responseData['response'];
$isFirst = true;
foreach ($type['l11n'] as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('type', $fuelTypes[$type['name']]['id']);
$module->apiFuelTypeL11nCreate($request, $response);
}
}
return $fuelTypes;
}
/**
* Install fuel type
*
* @param ApplicationAbstract $app Application
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createVehicleTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $fuelTypes */
$vehicleTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement');
/** @var array $type */
foreach ($types as $type) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('name', $type['name'] ?? '');
$request->setData('title', \reset($type['l11n']));
$request->setData('language', \array_keys($type['l11n'])[0] ?? 'en');
$module->apiVehicleTypeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$vehicleTypes[$type['name']] = !\is_array($responseData['response'])
? $responseData['response']->toArray()
: $responseData['response'];
$isFirst = true;
foreach ($type['l11n'] as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('type', $vehicleTypes[$type['name']]['id']);
$module->apiVehicleTypeL11nCreate($request, $response);
}
}
return $vehicleTypes;
}
/**
* Install default attribute types
*
* @param ApplicationAbstract $app Application
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createAttributeTypes(ApplicationAbstract $app, array $attributes) : array
{
/** @var array<string, array> $itemAttrType */
$itemAttrType = [];
/** @var \Modules\FleetManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement');
/** @var array $attribute */
foreach ($attributes as $attribute) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('name', $attribute['name'] ?? '');
$request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
$request->setData('datatype', (int) $attribute['value_type']);
$module->apiVehicleAttributeTypeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$itemAttrType[$attribute['name']] = !\is_array($responseData['response'])
? $responseData['response']->toArray()
: $responseData['response'];
$isFirst = true;
foreach ($attribute['l11n'] as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('type', $itemAttrType[$attribute['name']]['id']);
$module->apiVehicleAttributeTypeL11nCreate($request, $response);
}
}
return $itemAttrType;
}
/**
* Create default attribute values for types
*
* @param ApplicationAbstract $app Application
* @param array $itemAttrType Attribute types
* @param array<array{name:string, l11n?:array<string, string>, is_required?:bool, is_custom_allowed?:bool, validation_pattern?:string, value_type?:string, values?:array<string, mixed>}> $attributes Attribute definition
*
* @return array<string, array>
*
* @since 1.0.0
*/
private static function createAttributeValues(ApplicationAbstract $app, array $itemAttrType, array $attributes) : array
{
/** @var array<string, array> $itemAttrValue */
$itemAttrValue = [];
/** @var \Modules\FleetManagement\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement');
foreach ($attributes as $attribute) {
$itemAttrValue[$attribute['name']] = [];
/** @var array $value */
foreach ($attribute['values'] as $value) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('value', $value['value'] ?? '');
$request->setData('unit', $value['unit'] ?? '');
$request->setData('default', true); // always true since all defined values are possible default values
$request->setData('type', $itemAttrType[$attribute['name']]['id']);
if (isset($value['l11n']) && !empty($value['l11n'])) {
$request->setData('title', \reset($value['l11n']));
$request->setData('language', \array_keys($value['l11n'])[0] ?? 'en');
}
$module->apiVehicleAttributeValueCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$attrValue = !\is_array($responseData['response'])
? $responseData['response']->toArray()
: $responseData['response'];
$itemAttrValue[$attribute['name']][] = $attrValue;
$isFirst = true;
foreach (($value['l11n'] ?? []) as $language => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n);
$request->setData('language', $language);
$request->setData('value', $attrValue['id']);
$module->apiVehicleAttributeValueL11nCreate($request, $response);
}
}
}
return $itemAttrValue;
}
}

View File

@ -26,4 +26,11 @@ use phpOMS\Module\UpdaterAbstract;
*/
final class Updater extends UpdaterAbstract
{
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
}

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,11 @@ declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
/**
* FleetManagement class.
*
@ -25,5 +30,47 @@ namespace Modules\FleetManagement\Controller;
*/
final class BackendController extends Controller
{
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementVehicleList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response));
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementVehicleProfile(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response));
return $view;
}
}

48
Models/Cost.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Cost implements \JsonSerializable
{
public int $id = 0;
public string $name = '';
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

48
Models/CostType.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class CostType implements \JsonSerializable
{
public int $id = 0;
public string $name = '';
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

121
Models/FuelType.php Normal file
View File

@ -0,0 +1,121 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO639x1Enum;
/**
* Fuel Type class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class FuelType implements \JsonSerializable
{
/**
* Id
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
/**
* Name/string identifier by which it can be found/categorized
*
* @var string
* @since 1.0.0
*/
public string $name = '';
/**
* Localization
*
* @var BaseStringL11n
*/
public string | BaseStringL11n $l11n = '';
/**
* Constructor.
*
* @param string $name Name/identifier of the attribute type
*
* @since 1.0.0
*/
public function __construct(string $name = '')
{
$this->name = $name;
}
/**
* Set l11n
*
* @param string|BaseStringL11n $l11n Tag article l11n
* @param string $lang Language
*
* @return void
*
* @since 1.0.0
*/
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
{
if ($l11n instanceof BaseStringL11n) {
$this->l11n = $l11n;
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
$this->l11n->content = $l11n;
$this->l11n->setLanguage($lang);
} else {
$this->l11n = new BaseStringL11n();
$this->l11n->content = $l11n;
$this->l11n->setLanguage($lang);
}
}
/**
* @return string
*
* @since 1.0.0
*/
public function getL11n() : string
{
if (!isset($this->l11n)) {
return '';
}
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class FuelTypeL11nMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_fuel_type_l11n_id' => ['name' => 'fleetmgmt_fuel_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_fuel_type_l11n_title' => ['name' => 'fleetmgmt_fuel_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_fuel_type_l11n_type' => ['name' => 'fleetmgmt_fuel_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_fuel_type_l11n_lang' => ['name' => 'fleetmgmt_fuel_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_fuel_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_fuel_type_l11n_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11n::class;
}

82
Models/FuelTypeMapper.php Normal file
View File

@ -0,0 +1,82 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of FuelType
* @extends DataMapperFactory<T>
*/
final class FuelTypeMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_fuel_type_id' => ['name' => 'fleetmgmt_fuel_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_fuel_type_name' => ['name' => 'fleetmgmt_fuel_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'l11n' => [
'mapper' => FuelTypeL11nMapper::class,
'table' => 'fleetmgmt_fuel_type_l11n',
'self' => 'fleetmgmt_fuel_type_l11n_type',
'column' => 'content',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = FuelType::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_fuel_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_fuel_type_id';
}

0
Models/Inspection.php Normal file
View File

View File

46
Models/NullFuelType.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* Null model
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullFuelType extends FuelType
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

46
Models/NullVehicle.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* Null model
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullVehicle extends Vehicle
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* Null model
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullVehicleType extends VehicleType
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

81
Models/Vehicle.php Normal file
View File

@ -0,0 +1,81 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
/**
* class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Vehicle implements \JsonSerializable
{
public int $id = 0;
public string $name = '';
public int $status = VehicleStatus::ACTIVE;
public VehicleType $type;
public FuelType $fuelType;
public string $info = '';
public array $drivers = [];
public array $inspections = [];
public array $attributes = [];
public array $milage = [];
public array $media = [];
public array $notes = [];
public int $unit = 0;
public ?int $responsible = null;
public \DateTimeImmutable $createdAt;
public function __construct()
{
$this->createdAt = new \DateTimeImmutable('now');
$this->type = new VehicleType();
$this->fuelType = new FuelType();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,86 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use Modules\Attribute\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Fleet mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Attribute
* @extends DataMapperFactory<T>
*/
final class VehicleAttributeMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_vehicle_attr_id' => ['name' => 'fleetmgmt_vehicle_attr_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_attr_item' => ['name' => 'fleetmgmt_vehicle_attr_item', 'type' => 'int', 'internal' => 'ref'],
'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'],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
public const OWNS_ONE = [
'type' => [
'mapper' => VehicleAttributeTypeMapper::class,
'external' => 'fleetmgmt_vehicle_attr_type',
],
'value' => [
'mapper' => VehicleAttributeValueMapper::class,
'external' => 'fleetmgmt_vehicle_attr_value',
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = Attribute::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_vehicle_attr';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_vehicle_attr_id';
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class VehicleAttributeTypeL11nMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_attr_type_l11n_id' => ['name' => 'fleetmgmt_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_attr_type_l11n_title' => ['name' => 'fleetmgmt_attr_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_attr_type_l11n_type' => ['name' => 'fleetmgmt_attr_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_attr_type_l11n_lang' => ['name' => 'fleetmgmt_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_attr_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_attr_type_l11n_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11n::class;
}

View File

@ -0,0 +1,94 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use Modules\Attribute\Models\AttributeType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of AttributeType
* @extends DataMapperFactory<T>
*/
final class VehicleAttributeTypeMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_attr_type_id' => ['name' => 'fleetmgmt_attr_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_attr_type_name' => ['name' => 'fleetmgmt_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'fleetmgmt_attr_type_datatype' => ['name' => 'fleetmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'fleetmgmt_attr_type_fields' => ['name' => 'fleetmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'fleetmgmt_attr_type_custom' => ['name' => 'fleetmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'fleetmgmt_attr_type_pattern' => ['name' => 'fleetmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'fleetmgmt_attr_type_required' => ['name' => 'fleetmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'l11n' => [
'mapper' => VehicleAttributeTypeL11nMapper::class,
'table' => 'fleetmgmt_attr_type_l11n',
'self' => 'fleetmgmt_attr_type_l11n_type',
'column' => 'content',
'external' => null,
],
'defaults' => [
'mapper' => VehicleAttributeValueMapper::class,
'table' => 'fleetmgmt_vehicle_attr_default',
'self' => 'fleetmgmt_vehicle_attr_default_type',
'external' => 'fleetmgmt_vehicle_attr_default_value',
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = AttributeType::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_attr_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_attr_type_id';
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class VehicleAttributeValueL11nMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_attr_value_l11n_id' => ['name' => 'fleetmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_attr_value_l11n_title' => ['name' => 'fleetmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_attr_value_l11n_value' => ['name' => 'fleetmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_attr_value_l11n_lang' => ['name' => 'fleetmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_attr_value_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_attr_value_l11n_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11n::class;
}

View File

@ -0,0 +1,89 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use Modules\Attribute\Models\AttributeValue;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of AttributeValue
* @extends DataMapperFactory<T>
*/
final class VehicleAttributeValueMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_attr_value_id' => ['name' => 'fleetmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_attr_value_default' => ['name' => 'fleetmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'fleetmgmt_attr_value_valueStr' => ['name' => 'fleetmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'fleetmgmt_attr_value_valueInt' => ['name' => 'fleetmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'fleetmgmt_attr_value_valueDec' => ['name' => 'fleetmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'fleetmgmt_attr_value_valueDat' => ['name' => 'fleetmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'fleetmgmt_attr_value_unit' => ['name' => 'fleetmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'fleetmgmt_attr_value_deptype' => ['name' => 'fleetmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'fleetmgmt_attr_value_depvalue' => ['name' => 'fleetmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'l11n' => [
'mapper' => VehicleAttributeValueL11nMapper::class,
'table' => 'fleetmgmt_attr_value_l11n',
'self' => 'fleetmgmt_attr_value_l11n_value',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = AttributeValue::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_attr_value';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_attr_value_id';
}

110
Models/VehicleMapper.php Normal file
View File

@ -0,0 +1,110 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Vehicle
* @extends DataMapperFactory<T>
*/
final class VehicleMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_vehicle_id' => ['name' => 'fleetmgmt_vehicle_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_name' => ['name' => 'fleetmgmt_vehicle_name', 'type' => 'string', 'internal' => 'name'],
'fleetmgmt_vehicle_status' => ['name' => 'fleetmgmt_vehicle_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_vehicle_info' => ['name' => 'fleetmgmt_vehicle_info', 'type' => 'string', 'internal' => 'info'],
'fleetmgmt_vehicle_unit' => ['name' => 'fleetmgmt_vehicle_unit', 'type' => 'int', 'internal' => 'unit'],
'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],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'media' => [
'mapper' => MediaMapper::class,
'table' => 'fleetmgmt_vehicle_media',
'external' => 'fleetmgmt_vehicle_media_media',
'self' => 'fleetmgmt_vehicle_media_vehicle',
],
'attributes' => [
'mapper' => VehicleAttributeMapper::class,
'table' => 'fleetmgmt_vehicle_attr',
'self' => 'fleetmgmt_vehicle_attr_item',
'external' => null,
],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
public const OWNS_ONE = [
'type' => [
'mapper' => VehicleTypeMapper::class,
'external' => 'fleetmgmt_vehicle_type',
],
'fuelType' => [
'mapper' => FuelTypeMapper::class,
'external' => 'fleetmgmt_vehicle_fuel',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_vehicle';
/**
* Created at.
*
* @var string
* @since 1.0.0
*/
public const CREATED_AT = 'fleetmgmt_vehicle_created_at';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_vehicle_id';
}

36
Models/VehicleStatus.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Vehicle status enum.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class VehicleStatus extends Enum
{
public const ACTIVE = 1;
public const INACTIVE = 2;
public const DAMAGED = 3;
public const OUT_OF_ORDER = 4;
}

121
Models/VehicleType.php Normal file
View File

@ -0,0 +1,121 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO639x1Enum;
/**
* Vehicle Type class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class VehicleType implements \JsonSerializable
{
/**
* Id
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
/**
* Name/string identifier by which it can be found/categorized
*
* @var string
* @since 1.0.0
*/
public string $name = '';
/**
* Localization
*
* @var BaseStringL11n
*/
public string | BaseStringL11n $l11n = '';
/**
* Constructor.
*
* @param string $name Name/identifier of the attribute type
*
* @since 1.0.0
*/
public function __construct(string $name = '')
{
$this->name = $name;
}
/**
* Set l11n
*
* @param string|BaseStringL11n $l11n Tag article l11n
* @param string $lang Language
*
* @return void
*
* @since 1.0.0
*/
public function setL11n(string | BaseStringL11n $l11n, string $lang = ISO639x1Enum::_EN) : void
{
if ($l11n instanceof BaseStringL11n) {
$this->l11n = $l11n;
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
$this->l11n->content = $l11n;
$this->l11n->setLanguage($lang);
} else {
$this->l11n = new BaseStringL11n();
$this->l11n->content = $l11n;
$this->l11n->setLanguage($lang);
}
}
/**
* @return string
*
* @since 1.0.0
*/
public function getL11n() : string
{
if (!isset($this->l11n)) {
return '';
}
return $this->l11n instanceof BaseStringL11n ? $this->l11n->content : $this->l11n;
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class VehicleTypeL11nMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'fleetmgmt_vehicle_type_l11n_id' => ['name' => 'fleetmgmt_vehicle_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_type_l11n_title' => ['name' => 'fleetmgmt_vehicle_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_vehicle_type_l11n_type' => ['name' => 'fleetmgmt_vehicle_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_vehicle_type_l11n_lang' => ['name' => 'fleetmgmt_vehicle_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_vehicle_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_vehicle_type_l11n_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11n::class;
}

View File

@ -0,0 +1,82 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of VehicleType
* @extends DataMapperFactory<T>
*/
final class VehicleTypeMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'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' => 'name', 'autocomplete' => true],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'l11n' => [
'mapper' => VehicleTypeL11nMapper::class,
'table' => 'fleetmgmt_vehicle_type_l11n',
'self' => 'fleetmgmt_vehicle_type_l11n_type',
'column' => 'content',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = VehicleType::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_vehicle_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_vehicle_type_id';
}

View File

@ -13,7 +13,6 @@
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Client',
'Region' => 'Region',
'SalesRep' => 'SalesRep',
'FleetManagement' => 'Fleet Management',
'Vehicles' => 'Vehicles',
]];

View File

@ -12,116 +12,6 @@
*/
declare(strict_types=1);
return ['ClientManagement' => [
'Accounting' => 'Accounting',
'Addition' => 'Addition',
'Address' => 'Address',
'Addresses' => 'Addresses',
'Africa' => 'Africa',
'AllCustomers' => 'All Customers',
'America' => 'America',
'Analyse' => 'Analyse',
'AreaManager' => 'Area Manager',
'Articlegroup' => 'Articlegroup',
'Articles' => 'Articles',
'Asia' => 'Asia',
'Attribute' => 'Attribute',
'Attributes' => 'Attributes',
'Balance' => 'Balance',
'BaseTime' => 'Base time',
'Bills' => 'Bills',
'Bonus' => 'Bonus',
'Business' => 'Business',
'CIS' => 'CIS',
'CLV' => 'CLV',
'Calendar' => 'Calendar',
'City' => 'City',
'Client' => 'Client',
'ClientID' => 'Client Id',
'Clients' => 'Clients',
'ComparisonTime' => 'Comparison time',
'Contact' => 'Contact',
'Country' => 'Country',
'Created' => 'Created',
'CreatedAt' => 'Created at',
'CreditRating' => 'Credit Rating',
'Creditcard' => 'Creditcard',
'Customers' => 'Customers',
'DSO' => 'DSO',
'Date' => 'Date',
'Default' => 'Default',
'Delivery' => 'Delivery',
'Discount' => 'Discount',
'DiscountBonus' => 'Discount bonus',
'DiscountP' => 'Discount %',
'Documents' => 'Documents',
'Due' => 'Due',
'Email' => 'Email',
'Europe' => 'Europe',
'Fax' => 'Fax',
'Files' => 'Files',
'Filter' => 'Filter',
'Freightage' => 'Freightage',
'Group' => 'Group',
'ID' => 'ID',
'Info' => 'Info',
'Invoice' => 'Invoice',
'Invoices' => 'Invoices',
'IsDefault' => 'Is default?',
'Items' => 'Items',
'LastContact' => 'Last Contact',
'LastOrder' => 'Last Order',
'Log' => 'Log',
'Logs' => 'Logs',
'LostCustomers' => 'Lost customers',
'MRR' => 'MRR',
'MTDSales' => 'MTD Sales',
'Margin' => 'Margin',
'Messages' => 'Messages',
'Modified' => 'Modified',
'Modules' => 'Modules',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Net' => 'Net',
'NewCustomers' => 'New customers',
'Notes' => 'Notes',
'Number' => 'Number',
'Office' => 'Office',
'Other' => 'Other',
'Payment' => 'Payment',
'PaymentTerm' => 'Payment Term',
'Permission' => 'Permission',
'Phone' => 'Phone',
'Postal' => 'Postal',
'Price' => 'Price',
'Prices' => 'Prices',
'Private' => 'Private',
'Productgroup' => 'Productgroup',
'Profile' => 'Profile',
'Profit' => 'Profit',
'Purchase' => 'Purchase',
'Quantity' => 'Quantity',
'RecentInvoices' => 'Recent Invoices',
'Region' => 'Region',
'Rep' => 'Rep',
'Retention' => 'Retention',
'Sales' => 'Sales',
'Segment' => 'Segment',
'Segments' => 'Segments',
'Subtype' => 'Subtype',
'Support' => 'Support',
'Tags' => 'Tags',
'Title' => 'Title',
'Total' => 'Total',
'TotalPrice' => 'Total price',
'Type' => 'Type',
'UnitPrice' => 'Unit price',
'Value' => 'Value',
'Website' => 'Website',
'Wire' => 'Wire',
'YTDSales' => 'YTD Sales',
'Zip' => 'Zip',
'IMG_alt_map' => 'Map',
return ['FleetManagement' => [
'Vehicle' => 'Vehicle',
]];

View File

@ -17,13 +17,13 @@ use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$clients = $this->getData('client');
$vehicles = $this->getData('vehicles') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Clients'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="portlet-head"><?= $this->getHtml('Vehicles'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="slider">
<table id="iSalesClientList" class="default sticky">
<thead>
@ -41,7 +41,7 @@ echo $this->getData('nav')->render(); ?>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Status'); ?>
<label for="iSalesClientList-sort-3">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3">
<i class="sort-asc fa fa-chevron-up"></i>
@ -53,7 +53,7 @@ echo $this->getData('nav')->render(); ?>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('City'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesClientList-sort-5">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
@ -65,7 +65,7 @@ echo $this->getData('nav')->render(); ?>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Zip'); ?>
<td><?= $this->getHtml('Type'); ?>
<label for="iSalesClientList-sort-7">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
@ -77,37 +77,13 @@ echo $this->getData('nav')->render(); ?>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Address'); ?>
<label for="iSalesClientList-sort-9">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-9">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-10">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-10">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Country'); ?>
<label for="iSalesClientList-sort-11">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-11">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-12">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-12">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php $count = 0; foreach ($clients as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('client_profile_image');
<?php $count = 0; foreach ($vehicles as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/sales/vehicle/profile?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('vehicle_profile_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_client'); ?>" width="30" loading="lazy" class="item-image"
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_vehicle'); ?>" width="30" loading="lazy" class="item-image"
src="<?= $image->id === 0 ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>

View File

@ -12,6 +12,7 @@
*/
declare(strict_types=1);
use Modules\FleetManagement\Models\NullVehicle;
use Modules\Profile\Models\ContactType;
use phpOMS\Uri\UriFactory;
@ -19,15 +20,11 @@ $countryCodes = \phpOMS\Localization\ISO3166TwoEnum::getConstants();
$countries = \phpOMS\Localization\ISO3166NameEnum::getConstants();
/**
* @var \Modules\ClientManagement\Models\Client $client
* @var \Modules\FleetManagement\Models\Vehicle $vehicle
*/
$client = $this->getData('client');
$notes = $client->getNotes();
$vehicle = $this->getData('vehicle') ?? new NullVehicle();
$files = $client->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? [];
$monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
/**
* @var \phpOMS\Views\View $this
*/
@ -37,582 +34,83 @@ echo $this->getData('nav')->render();
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Addresses'); ?></label></li>
<li><label for="c-tab-5"><?= $this->getHtml('Payment'); ?></label></li>
<li><label for="c-tab-6"><?= $this->getHtml('Prices'); ?></label></li>
<li><label for="c-tab-7"><?= $this->getHtml('Attributes'); ?></label></li>
<li><label for="c-tab-8"><?= $this->getHtml('Files'); ?></label></li>
<li><label for="c-tab-9"><?= $this->getHtml('Invoices'); ?></label>
<li><label for="c-tab-10"><?= $this->getHtml('Articles'); ?></label>
<li><label for="c-tab-11"><?= $this->getHtml('Messages'); ?></label><!-- incl. support -->
<li><label for="c-tab-11"><?= $this->getHtml('Accounting'); ?></label>
<li><label for="c-tab-11"><?= $this->getHtml('Notes'); ?></label>
<li><label for="c-tab-11"><?= $this->getHtml('Tags'); ?></label>
<li><label for="c-tab-11"><?= $this->getHtml('Calendar'); ?></label>
<li><label for="c-tab-11"><?= $this->getHtml('Permission'); ?></label>
<li><label for="c-tab-12"><?= $this->getHtml('Logs'); ?></label>
<li><label for="c-tab-6"><?= $this->getHtml('Attributes'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Files'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Notes'); ?></label></li>
<li><label for="c-tab-4"><?= $this->getHtml('Inspections'); ?></label></li>
<li><label for="c-tab-5"><?= $this->getHtml('Drivers'); ?></label>
<li><label for="c-tab-6"><?= $this->getHtml('Milage'); ?></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-lg-3 last-lg">
<div class="col-xs-12 col-md-8">
<section class="portlet">
<form>
<div class="portlet-body">
<table class="layout wf-100">
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($client->number); ?>" disabled></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->profile->account->name1); ?>" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($client->profile->account->name2); ?>">
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($client->profile->account->name3); ?>">
</table>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-client-profile"> <input type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-client-profile">
</div>
</form>
</section>
<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="iVehicleEnd"><?= $this->getHtml('Type'); ?></label>
<input type="text" id="iVehicleEnd" name="vehicle_type" value="<?= $this->printHtml($vehivle->getAttribute('vehicle_type')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehicleMake"><?= $this->getHtml('make'); ?></label>
<input type="text" id="iVehicleMake" name="make" value="<?= $this->printHtml($vehivle->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($vehivle->getAttribute('vehicle_model')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehicleStart"><?= $this->getHtml('Start'); ?></label>
<input type="text" id="iVehicleStart" name="ownership_start" value="<?= $vehivle->getAttribute('ownership_start')->value->getValue()->format('Y-m-d'); ?>">
</div>
<div class="form-group">
<label for="iVehicleEnd"><?= $this->getHtml('End'); ?></label>
<input type="text" id="iVehicleEnd" name="ownership_end" value="<?= $vehivle->getAttribute('ownership_end')->value->getValue()->format('Y-m-d'); ?>">
</div>
<div class="form-group">
<label for="iVehiclePrice"><?= $this->getHtml('PurchasePrice'); ?></label>
<input type="text" id="iVehiclePrice" name="purchase_price" value="<?= $this->printHtml($vehivle->getAttribute('purchase_price')->value->getValue()); ?>">
</div>
<div class="form-group">
<label for="iVehiclePrice"><?= $this->getHtml('LeasingFee'); ?></label>
<input type="text" id="iVehiclePrice" name="leasing_fee" value="<?= $this->printHtml($vehivle->getAttribute('leasing_fee')->value->getValue()); ?>">
</div>
</section>
</div>
<div class="col-xs-12 col-md-4 sm-hidden">
<section class="portlet">
<div class="portlet-head">
<?= $this->getHtml('Contact'); ?>
<a class="floatRight" href=""><i class="fa fa-envelope-o btn"></i></a>
</div>
<div class="portlet-body">
<table class="layout wf-100">
<tr><td><label for="iName1"><?= $this->getHtml('Phone'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->getMainContactElement(ContactType::PHONE)->content); ?>">
<tr><td><label for="iName1"><?= $this->getHtml('Email'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->getMainContactElement(ContactType::EMAIL)->content); ?>">
<tr><td><label for="iName1"><?= $this->getHtml('Website'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->getMainContactElement(ContactType::WEBSITE)->content); ?>">
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head">
<?= $this->getHtml('Address'); ?>
<span class="clickPopup floatRight">
<label for="addressDropdown"><i class="fa fa-print btn"></i></label>
<input id="addressDropdown" name="addressDropdown" type="checkbox">
<div class="popup">
<ul>
<li>
<input id="id1" type="checkbox">
<ul>
<li>
<label for="id1">
<a href="" class="button">Word</a>
<span></span>
<i class="fa fa-chevron-right expand"></i>
</label>
<li>Letter
</ul>
<li><label class="button cancel" for="addressDropdown">Cancel</label>
</ul>
</div>
</span>
</div>
<div class="portlet-body">
<table class="layout wf-100">
<?php if (!empty($client->mainAddress->addition)) : ?>
<tr><td><label for="iName1"><?= $this->getHtml('Addition'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->mainAddress->addition); ?>">
<?php endif; ?>
<tr><td><label for="iName1"><?= $this->getHtml('Address'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->mainAddress->address); ?>" required>
<tr><td><label for="iName1"><?= $this->getHtml('Postal'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->mainAddress->postal); ?>" required>
<tr><td><label for="iName1"><?= $this->getHtml('City'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($client->mainAddress->city); ?>" required>
<tr><td><label for="iName1"><?= $this->getHtml('Country'); ?></label>
<tr><td><select name="country">
<?php foreach ($countryCodes as $code3 => $code2) : ?>
<option value="<?= $this->printHtml($code2); ?>"<?= $this->printHtml($code2 === $client->mainAddress->getCountry() ? ' selected' : ''); ?>><?= $this->printHtml($countries[$code3]); ?>
<?php endforeach; ?>
</select>
<tr><td>
<?php if (\is_file(__DIR__ . '/../../../../phpOMS/Localization/Maps/svg/' . \strtolower($client->mainAddress->getCountry()) . '.svg')) : ?>
<img alt="<?= $this->getHtml('IMG_alt_map'); ?>" id="iMap" style="width: 100%;" src="<?= UriFactory::build('phpOMS/Localization/Maps/svg/' . \strtolower($client->mainAddress->getCountry()) . '.svg'); ?>">
<?php endif; ?>
</table>
</div>
</section>
<section class="portlet highlight-4">
<div class="portlet-body">
<textarea class="undecorated"><?= $this->printHtml($client->info); ?></textarea>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-9 plain-grid">
<div class="row">
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-1">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>:
<td>
<tr><td><?= $this->getHtml('MTDSales'); ?>:
<td>
<tr><td><?= $this->getHtml('CLV'); ?>:
<td>
<tr><td><?= $this->getHtml('MRR'); ?>:
<td>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('LastContact'); ?>:
<td>
<tr><td><?= $this->getHtml('LastOrder'); ?>:
<td>
<tr><td><?= $this->getHtml('Created'); ?>:
<td>
<tr><td><?= $this->getHtml('Modified'); ?>:
<td>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('DSO'); ?>:
<td>
<tr><td><?= $this->getHtml('Due'); ?>:
<td>
<tr><td><?= $this->getHtml('Balance'); ?>:
<td>
<tr><td><?= $this->getHtml('CreditRating'); ?>:
<td>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Notes'); ?></div>
<div class="slider">
<table id="iNotesItemList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $note->title; ?></a>
<td><a href="<?= $url; ?>"><?= $note->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Documents'); ?></div>
<div class="slider">
<table id="iFilesClientList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $file->name; ?></a>
<td><a href="<?= $url; ?>"><?= $file->extension; ?></a>
<td><a href="<?= $url; ?>"><?= $file->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('RecentInvoices'); ?></div>
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Number'); ?>
<td><?= $this->getHtml('Type'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Net'); ?>
<td><?= $this->getHtml('Date'); ?>
<tbody>
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->netSales->getCurrency(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Segments'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Sales'); ?></div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
"data": {
"labels": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = $monthly['month'] . '/' . \substr((string) $monthly['year'], -2);
}
?>
<?= '"' . \implode('", "', $temp) . '"'; ?>
],
"datasets": [
{
"label": "<?= $this->getHtml('Margin'); ?>",
"type": "line",
"data": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = \round(((((int) $monthly['net_sales']) - ((int) $monthly['net_costs'])) / ((int) $monthly['net_sales'])) * 100, 2);
}
?>
<?= \implode(',', $temp); ?>
],
"yAxisID": "axis-2",
"fill": false,
"borderColor": "rgb(255, 99, 132)",
"backgroundColor": "rgb(255, 99, 132)"
},
{
"label": "<?= $this->getHtml('Sales'); ?>",
"type": "bar",
"data": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = ((int) $monthly['net_sales']) / 1000;
}
?>
<?= \implode(',', $temp); ?>
],
"yAxisID": "axis-1",
"backgroundColor": "rgb(54, 162, 235)"
}
]
},
"options": {
"scales": {
"yAxes": [
{
"id": "axis-1",
"display": true,
"position": "left"
},
{
"id": "axis-2",
"display": true,
"position": "right",
"scaleLabel": {
"display": true,
"labelString": "<?= $this->getHtml('Margin'); ?> %"
},
"gridLines": {
"display": false
},
"beginAtZero": true,
"ticks": {
"min": 0,
"max": 100,
"stepSize": 10
}
}
]
}
}
}'></canvas>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Address'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iAType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iAType" name="atype">
<option><?= $this->getHtml('Default'); ?>
<option><?= $this->getHtml('Delivery'); ?>
<option><?= $this->getHtml('Invoice'); ?>
</select>
<tr><td><label for="iAddress"><?= $this->getHtml('Address'); ?></label>
<tr><td><input type="text" id="iAddress" name="address">
<tr><td><label for="iZip"><?= $this->getHtml('Zip'); ?></label>
<tr><td><input type="text" id="iZip" name="zip">
<tr><td><label for="iCountry"><?= $this->getHtml('Country'); ?></label>
<tr><td><input type="text" id="iCountry" name="country">
<tr><td><label for="iAInfo"><?= $this->getHtml('Info'); ?></label>
<tr><td><input type="text" id="iAInfo" name="ainfo">
<tr><td><span class="check"><input type="checkbox" id="iDefault" name="default" checked><label for="iDefault"><?= $this->getHtml('IsDefault'); ?></label></span>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
<!-- Notes -->
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Contact'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iCType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iCType" name="actype">
<option><?= $this->getHtml('Email'); ?>
<option><?= $this->getHtml('Fax'); ?>
<option><?= $this->getHtml('Phone'); ?>
</select>
<tr><td><label for="iCStype"><?= $this->getHtml('Subtype'); ?></label>
<tr><td><select id="iCStype" name="acstype">
<option><?= $this->getHtml('Office'); ?>
<option><?= $this->getHtml('Sales'); ?>
<option><?= $this->getHtml('Purchase'); ?>
<option><?= $this->getHtml('Accounting'); ?>
<option><?= $this->getHtml('Support'); ?>
</select>
<tr><td><label for="iCInfo"><?= $this->getHtml('Info'); ?></label>
<tr><td><input type="text" id="iCInfo" name="cinfo">
<tr><td><label for="iCData"><?= $this->getHtml('Contact'); ?></label>
<tr><td><input type="text" id="iCData" name="cdata">
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<!-- Files/Locations/??? -->
</section>
</div>
</div>
</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">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Payment'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iACType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iACType" name="actype">
<option><?= $this->getHtml('Wire'); ?>
<option><?= $this->getHtml('Creditcard'); ?>
</select>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('PaymentTerm'); ?></h1></header>
<div class="inner">
<form>
<table class="layout wf-100">
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><label for="iTerm"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iTerm" name="term" required>
<option>
</select>
<tr><td><span class="check"><input type="checkbox" id="iFreightage" name="freightage"><label for="iFreightage"><?= $this->getHtml('Freightage'); ?></label></span>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-6" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-6' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('Price'); ?></h1></header>
<div class="inner">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iPType"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iPType" name="ptye">
<option>
</select><td>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iPQuantity" name="quantity" type="text" placeholder=""><td>
<tr><td><label for="iPrice"><?= $this->getHtml('Price'); ?></label>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0" placeholder=""><td>
<tr><td><label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder=""><td>
<tr><td><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder=""><td>
<tr><td><label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</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 col-lg-4">
<section class="box wf-100">
<header><h1><?= $this->getHtml('AreaManager'); ?></h1></header>
<div class="inner">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr><td><label for="iManager"><?= $this->getHtml('AreaManager'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iManager" name="source" type="text" placeholder=""></span>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</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>
<input type="radio" id="c-tab-9" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-9' ? ' checked' : ''; ?>>
<div class="tab">
<?php include __DIR__ . '/client-profile-bills.tpl.php'; ?>
</div>
<input type="radio" id="c-tab-10" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-9' ? ' checked' : ''; ?>>
<div class="tab">
<?php include __DIR__ . '/client-profile-items.tpl.php'; ?>
</div>
<input type="radio" id="c-tab-11" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-10' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12">
<?php
$footerView = new \phpOMS\Views\PaginationView($this->l11nManager, $this->request, $this->response);
$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig');
$footerView->setPages(20);
$footerView->setPage(1);
?>
<div class="box wf-100">
<table class="default">
<caption><?= $this->getHtml('Logs'); ?><i class="fa fa-download floatRight download btn"></i></caption>
<thead>
<tr>
<td>IP
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Name'); ?>
<td class="wf-100"><?= $this->getHtml('Log'); ?>
<td><?= $this->getHtml('Date'); ?>
<tfoot>
<tr>
<td colspan="6">
<tbody>
<tr>
<td><?= $this->printHtml($this->request->getOrigin()); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td>Creating customer
<td><?= $this->printHtml((new \DateTime('now'))->format('Y-m-d H:i:s')); ?>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>