Merge pull request #2 from Karaka-Management/develop

Merge
This commit is contained in:
Dennis Eichhorn 2023-09-30 02:02:18 +02:00 committed by GitHub
commit 0c05a4f49b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
136 changed files with 20277 additions and 0 deletions

35
.github/dev_bug_report.md vendored Executable file
View File

@ -0,0 +1,35 @@
---
name: Dev Bug Report
about: Create a report to help us improve
title: ''
labels: stat_backlog, type_bug
assignees: ''
---
# Bug Description
A clear and concise description of what the bug is.
# How to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Minimal Code Example
```
// your code ...
```
# Expected Behavior
A clear and concise description of what you expected to happen.
# Screenshots
If applicable, add screenshots to help explain your problem.
# Additional Information
Add any other context about the problem here.

18
.github/dev_feature_request.md vendored Executable file
View File

@ -0,0 +1,18 @@
---
name: Dev Feature Request
about: Suggest an idea for this project
title: ''
labels: stat_backlog, type_feature
assignees: ''
---
# What is the feature you request
* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
* A clear and concise description of what you want to happen.
# Alternatives
A clear and concise description of any alternative solutions or features you've considered.
# Additional Information
Add any other context or screenshots about the feature request here.

40
.github/user_bug_report.md vendored Executable file
View File

@ -0,0 +1,40 @@
---
name: User Bug Report
about: Create a report to help us improve
title: ''
labels: stat_backlog, type_bug
assignees: ''
---
# Bug Description
A clear and concise description of what the bug is.
# How to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
# Expected Behavior
A clear and concise description of what you expected to happen.
# Screenshots
If applicable, add screenshots to help explain your problem.
# System Information
- System: [e.g. PC or iPhone11, ...]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- KarakaVersion [e.g. 22]
# Additional Information
Add any other context about the problem here.

21
.github/user_feature_request.md vendored Executable file
View File

@ -0,0 +1,21 @@
---
name: User Feature Request
about: Suggest an idea for this project
title: ''
labels: stat_backlog, type_feature
assignees: ''
---
# What is the feature you request
* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
* A clear and concise description of what you want to happen.
# Alternatives
A clear and concise description of any alternative solutions or features you've considered.
# Additional Information
Add any other context or screenshots about the feature request here.

13
.github/workflows/greetings.yml vendored Executable file
View File

@ -0,0 +1,13 @@
name: Greetings
on: [pull_request, issues]
jobs:
greeting:
runs-on: ubuntu-latest
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
pr-message: 'Thank you for your pull request. We will check it as soon as possible.'

10
.github/workflows/image.yml vendored Executable file
View File

@ -0,0 +1,10 @@
name: Image optimization
on: [push, pull_request]
jobs:
general_image_workflow:
uses: Karaka-Management/Karaka/.github/workflows/image.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}

20
.github/workflows/main.yml vendored Executable file
View File

@ -0,0 +1,20 @@
name: CI
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
schedule:
- cron: '0 0 1,15 * *'
jobs:
general_module_workflow:
uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}

15
.gitignore vendored Executable file
View File

@ -0,0 +1,15 @@
Build
*.cache
.directory
Vagrantfile
vendor
bower_components
node_modules
*.log
.vagrant
.vscode
.sass-cache
cache
Cache
Libraries
.idea

View File

@ -0,0 +1,30 @@
[
{
"type": "type",
"name": "vehicle_profile_image",
"l11n": [
{
"title": "Profile image",
"lang": "en"
},
{
"title": "Profilbild",
"lang": "de"
}
]
},
{
"type": "collection",
"create_directory": true,
"name": "FleetManagement",
"virtualPath": "/Modules",
"user": 1
},
{
"type": "collection",
"create_directory": true,
"name": "Vehicle",
"virtualPath": "/Modules/FleetManagement",
"user": 1
}
]

43
Admin/Install/Media.php Executable file
View File

@ -0,0 +1,43 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Admin\Install;
use phpOMS\Application\ApplicationAbstract;
/**
* Media class.
*
* @package Modules\FleetManagement\Admin\Install
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Media
{
/**
* Install media providing
*
* @param ApplicationAbstract $app Application
* @param string $path Module path
*
* @return void
*
* @since 1.0.0
*/
public static function install(ApplicationAbstract $app, string $path) : void
{
\Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
}
}

View File

@ -0,0 +1,248 @@
[
{
"id": 1003501001,
"pid": "/",
"type": 2,
"subtype": 0,
"name": "FleetManagement",
"uri": null,
"target": "self",
"icon": "fa fa-car",
"order": 80,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 0,
"children": [
{
"id": 1003502001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Vehicles",
"uri": "{/base}/fleet/vehicle/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003501001,
"children": [
{
"id": 1003502101,
"pid": "/fleet/vehicle",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/base}/fleet/vehicle/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003502001,
"children": []
},
{
"id": 1003502201,
"pid": "/fleet/vehicle",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "{/base}/fleet/vehicle/create?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 4, "category": null, "element": null },
"parent": 1003502001,
"children": []
}
]
},
{
"id": 1003503001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Drivers",
"uri": "{/base}/fleet/driver/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003501001,
"children": [
{
"id": 1003503101,
"pid": "/fleet/driver",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/base}/fleet/driver/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003503001,
"children": []
},
{
"id": 1003503201,
"pid": "/fleet/driver",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "{/base}/fleet/driver/create?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 4, "category": null, "element": null },
"parent": 1003503001,
"children": []
}
]
},
{
"id": 1003504001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Inspections",
"uri": "{/base}/fleet/inspection/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003501001,
"children": [
{
"id": 1003504101,
"pid": "/fleet/inspection",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/base}/fleet/inspection/list",
"target": "self",
"icon": null,
"order": 1,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003504001,
"children": []
},
{
"id": 1003504201,
"pid": "/fleet/inspection",
"type": 3,
"subtype": 1,
"name": "VehicleInspectionTypes",
"uri": "{/base}/fleet/inspection/type/list?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "FleetManagement",
"permission": { "permission": 4, "category": null, "element": null },
"parent": 1003504001,
"children": []
}
]
},
{
"id": 1003505001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "VehicleAttributes",
"uri": "{/base}/fleet/vehicle/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003501001,
"children": [
{
"id": 1003505101,
"pid": "/fleet/vehicle/attribute",
"type": 3,
"subtype": 1,
"name": "Types",
"uri": "{/base}/fleet/vehicle/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003505001,
"children": []
},
{
"id": 1003505201,
"pid": "/fleet/vehicle/attribute",
"type": 3,
"subtype": 1,
"name": "Values",
"uri": "{/base}/fleet/vehicle/attribute/value/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003505001,
"children": []
}
]
},
{
"id": 1003506001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "DriverAttributes",
"uri": "{/base}/fleet/driver/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003501001,
"children": [
{
"id": 1003506101,
"pid": "/fleet/driver/attribute",
"type": 3,
"subtype": 1,
"name": "Types",
"uri": "{/base}/fleet/driver/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003506001,
"children": []
},
{
"id": 1003506201,
"pid": "/fleet/driver/attribute",
"type": 3,
"subtype": 1,
"name": "Values",
"uri": "{/base}/fleet/driver/attribute/value/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "FleetManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1003506001,
"children": []
}
]
}
]
}
]

43
Admin/Install/Navigation.php Executable file
View File

@ -0,0 +1,43 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Admin\Install;
use phpOMS\Application\ApplicationAbstract;
/**
* Navigation class.
*
* @package Modules\FleetManagement\Admin\Install
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Navigation
{
/**
* Install navigation providing
*
* @param ApplicationAbstract $app Application
* @param string $path Module path
*
* @return void
*
* @since 1.0.0
*/
public static function install(ApplicationAbstract $app, string $path) : void
{
\Modules\Navigation\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Navigation.install.json']);
}
}

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": []
}
]

1046
Admin/Install/db.json Executable file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
[
{
"name": "license",
"l11n": {
"en": "License",
"de": "Führerschein"
}
}
]

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,37 @@
[
{
"name": "tire_change",
"l11n": {
"en": "Tire change",
"de": "Reifenwechsel"
}
},
{
"name": "oil_change",
"l11n": {
"en": "Oil change",
"de": "Ölwechsel"
}
},
{
"name": "mot",
"l11n": {
"en": "MOT test",
"de": "TÜV"
}
},
{
"name": "emissions_test",
"l11n": {
"en": "Emissions test",
"de": "Abgasuntersuchung"
}
},
{
"name": "general",
"l11n": {
"en": "General",
"de": "Allgemein"
}
}
]

View File

@ -0,0 +1,93 @@
[
{
"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": "tractor",
"l11n": {
"en": "Tractor",
"de": "Traktor"
}
},
{
"name": "forklift",
"l11n": {
"en": "Forklift",
"de": "Gabelstapler"
}
}
]

484
Admin/Installer.php Executable file
View File

@ -0,0 +1,484 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
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.
*
* @package Modules\FleetManagement\Admin
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Installer extends InstallerAbstract
{
/**
* Path of the file
*
* @var string
* @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);
/* Vehicle 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);
/* Inspection types */
$fileContent = \file_get_contents(__DIR__ . '/Install/inspectiontype.json');
if ($fileContent === false) {
return;
}
/** @var array $types */
$types = \json_decode($fileContent, true);
$inspectionTypes = self::createInspectionTypes($app, $types);
/* Inspection types */
$fileContent = \file_get_contents(__DIR__ . '/Install/driverinspectiontype.json');
if ($fileContent === false) {
return;
}
/** @var array $types */
$types = \json_decode($fileContent, true);
$inspectionTypes = self::createDriverInspectionTypes($app, $types);
}
/**
* Install fuel type
*
* @param ApplicationAbstract $app Application
* @param array $types Attribute definition
*
* @return array
*
* @since 1.0.0
*/
private static function createFuelTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $fuelTypes */
$fuelTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiVehicleController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiVehicle');
/** @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']
: $responseData['response']->toArray();
$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 vehicle type
*
* @param ApplicationAbstract $app Application
* @param array $types Attribute definition
*
* @return array
*
* @since 1.0.0
*/
private static function createVehicleTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $vehicleTypes */
$vehicleTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiVehicleController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiVehicle');
/** @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']
: $responseData['response']->toArray();
$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 inspection type
*
* @param ApplicationAbstract $app Application
* @param array $types Attribute definition
*
* @return array
*
* @since 1.0.0
*/
private static function createInspectionTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $inspectionTypes */
$inspectionTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiVehicleController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiVehicle');
/** @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->apiInspectionTypeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$inspectionTypes[$type['name']] = \is_array($responseData['response'])
? $responseData['response']
: $responseData['response']->toArray();
$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', $inspectionTypes[$type['name']]['id']);
$module->apiInspectionTypeL11nCreate($request, $response);
}
}
return $inspectionTypes;
}
/**
* Install inspection type
*
* @param ApplicationAbstract $app Application
* @param array $types Attribute definition
*
* @return array
*
* @since 1.0.0
*/
private static function createDriverInspectionTypes(ApplicationAbstract $app, array $types) : array
{
/** @var array<string, array> $inspectionTypes */
$inspectionTypes = [];
/** @var \Modules\FleetManagement\Controller\ApiDriverController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiDriver');
/** @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->apiDriverInspectionTypeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$inspectionTypes[$type['name']] = \is_array($responseData['response'])
? $responseData['response']
: $responseData['response']->toArray();
$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', $inspectionTypes[$type['name']]['id']);
$module->apiDriverInspectionTypeL11nCreate($request, $response);
}
}
return $inspectionTypes;
}
/**
* Install default attribute types
*
* @param ApplicationAbstract $app Application
* @param array $attributes Attribute definition
*
* @return array
*
* @since 1.0.0
*/
private static function createAttributeTypes(ApplicationAbstract $app, array $attributes) : array
{
/** @var array<string, array> $itemAttrType */
$itemAttrType = [];
/** @var \Modules\FleetManagement\Controller\ApiVehicleAttributeController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiVehicleAttribute');
/** @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']
: $responseData['response']->toArray();
$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
*
* @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\ApiVehicleAttributeController $module */
$module = $app->moduleManager->getModuleInstance('FleetManagement', 'ApiVehicleAttribute');
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']
: $responseData['response']->toArray();
$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;
}
}

116
Admin/Routes/Web/Api.php Normal file
View File

@ -0,0 +1,116 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\FleetManagement\Controller\Controller;
use Modules\FleetManagement\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/fleet/vehicle/find.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiVehicleFind',
'verb' => RouteVerb::GET,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/vehicle/attribute.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleAttributeController:apiVehicleAttributeCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
[
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleAttributeController:apiVehicleAttributeUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/attribute.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\ApiDriverAttributeController:apiDriverAttributeCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
],
],
[
'dest' => '\Modules\FleetManagement\Controller\ApiDriverAttributeController:apiDriverAttributeUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
],
],
],
'^.*/fleet/vehicle/note.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiNoteCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
[
'dest' => '\Modules\FleetManagement\Controller\ApiVehicleController:apiNoteUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/note.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\ApiDriverController:apiNoteCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
],
],
[
'dest' => '\Modules\FleetManagement\Controller\ApiDriverController:apiNoteUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::DRIVER,
],
],
],
];

179
Admin/Routes/Web/Backend.php Executable file
View File

@ -0,0 +1,179 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\FleetManagement\Controller\BackendController;
use Modules\FleetManagement\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/fleet/vehicle/attribute/type/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeTypeList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/vehicle/attribute/type\?.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementAttributeType',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/vehicle/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/vehicle/create.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/vehicle/profile.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementVehicleProfile',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/attribute/type/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeTypeList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/attribute/type\?.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverAttributeType',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/create.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/driver/profile.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementDriverProfile',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/inspection/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/inspection/type/list.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionTypeList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/inspection/create.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::VEHICLE,
],
],
],
'^.*/fleet/inspection/profile.*$' => [
[
'dest' => '\Modules\FleetManagement\Controller\BackendController:viewFleetManagementInspectionProfile',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::VEHICLE,
],
],
],
];

36
Admin/Status.php Executable file
View File

@ -0,0 +1,36 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Admin;
use phpOMS\Module\StatusAbstract;
/**
* Status class.
*
* @package Modules\FleetManagement\Admin
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Status extends StatusAbstract
{
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
}

36
Admin/Uninstaller.php Executable file
View File

@ -0,0 +1,36 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Admin;
use phpOMS\Module\UninstallerAbstract;
/**
* Uninstaller class.
*
* @package Modules\FleetManagement\Admin
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Uninstaller extends UninstallerAbstract
{
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
}

36
Admin/Updater.php Executable file
View File

@ -0,0 +1,36 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Admin
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Admin;
use phpOMS\Module\UpdaterAbstract;
/**
* Updater class.
*
* @package Modules\FleetManagement\Admin
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Updater extends UpdaterAbstract
{
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
}

0
Controller.js Executable file
View File

View File

@ -0,0 +1,523 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use Modules\Attribute\Models\Attribute;
use Modules\Attribute\Models\AttributeType;
use Modules\Attribute\Models\AttributeValue;
use Modules\FleetManagement\Models\Attribute\DriverAttributeMapper;
use Modules\FleetManagement\Models\Attribute\DriverAttributeTypeL11nMapper;
use Modules\FleetManagement\Models\Attribute\DriverAttributeTypeMapper;
use Modules\FleetManagement\Models\Attribute\DriverAttributeValueL11nMapper;
use Modules\FleetManagement\Models\Attribute\DriverAttributeValueMapper;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
/**
* FleetManagement class.
*
* @package Modules\FleetManagement
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class ApiDriverAttributeController extends Controller
{
use \Modules\Attribute\Controller\ApiAttributeTraitController;
/**
* Api method to create item attribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attribute = $this->createAttributeFromRequest($request);
$this->createModel($request->header->account, $attribute, DriverAttributeMapper::class, 'attribute', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attribute);
}
/**
* Api method to create driver attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrL11n = $this->createAttributeTypeL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, DriverAttributeTypeL11nMapper::class, 'attr_type_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrL11n);
}
/**
* Api method to create driver attribute type
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrType = $this->createAttributeTypeFromRequest($request);
$this->createModel($request->header->account, $attrType, DriverAttributeTypeMapper::class, 'attr_type', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrType);
}
/**
* Api method to create driver attribute value
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
/** @var \Modules\Attribute\Models\AttributeType $type */
$type = DriverAttributeTypeMapper::get()
->where('id', $request->getDataInt('type') ?? 0)
->execute();
$attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, DriverAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) {
$this->createModelRelation(
$request->header->account,
(int) $request->getData('type'),
$attrValue->id,
DriverAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
);
}
$this->createStandardCreateResponse($request, $response, $attrValue);
}
/**
* Api method to create driver attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrL11n = $this->createAttributeValueL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, DriverAttributeValueL11nMapper::class, 'attr_value_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrL11n);
}
/**
* Api method to update DriverAttribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var Attribute $old */
$old = DriverAttributeMapper::get()
->with('type')
->with('type/defaults')
->with('value')
->where('id', (int) $request->getData('id'))
->execute();
$new = $this->updateAttributeFromRequest($request, clone $old);
if ($new->id === 0) {
// Set response header to invalid request because of invalid data
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $new);
return;
}
$this->updateModel($request->header->account, $old, $new, DriverAttributeMapper::class, 'driver_attribute', $request->getOrigin());
if ($new->value->getValue() !== $old->value->getValue()
&& $new->type->custom
) {
$this->updateModel($request->header->account, $old->value, $new->value, DriverAttributeValueMapper::class, 'attribute_value', $request->getOrigin());
}
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete DriverAttribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
$driverAttribute = DriverAttributeMapper::get()
->with('type')
->where('id', (int) $request->getData('id'))
->execute();
if ($driverAttribute->type->isRequired) {
$this->createInvalidDeleteResponse($request, $response, []);
return;
}
$this->deleteModel($request->header->account, $driverAttribute, DriverAttributeMapper::class, 'driver_attribute', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $driverAttribute);
}
/**
* Api method to update DriverAttributeTypeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $old */
$old = DriverAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateAttributeTypeL11nFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, DriverAttributeTypeL11nMapper::class, 'driver_attribute_type_l11n', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete DriverAttributeTypeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $driverAttributeTypeL11n */
$driverAttributeTypeL11n = DriverAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $driverAttributeTypeL11n, DriverAttributeTypeL11nMapper::class, 'driver_attribute_type_l11n', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $driverAttributeTypeL11n);
}
/**
* Api method to update DriverAttributeType
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var AttributeType $old */
$old = DriverAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateAttributeTypeFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, DriverAttributeTypeMapper::class, 'driver_attribute_type', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete DriverAttributeType
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @todo: implement
*
* @since 1.0.0
*/
public function apiDriverAttributeTypeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var AttributeType $driverAttributeType */
$driverAttributeType = DriverAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $driverAttributeType, DriverAttributeTypeMapper::class, 'driver_attribute_type', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $driverAttributeType);
}
/**
* Api method to update DriverAttributeValue
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var AttributeValue $old */
$old = DriverAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
/** @var \Modules\Attribute\Models\Attribute $attr */
$attr = DriverAttributeMapper::get()
->with('type')
->where('id', $request->getDataInt('attribute') ?? 0)
->execute();
$new = $this->updateAttributeValueFromRequest($request, clone $old, $attr);
$this->updateModel($request->header->account, $old, $new, DriverAttributeValueMapper::class, 'driver_attribute_value', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete DriverAttributeValue
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
// @todo: I don't think values can be deleted? Only Attributes
// However, It should be possible to remove UNUSED default values
// either here or other function?
// if (!empty($val = $this->validateAttributeValueDelete($request))) {
// $response->header->status = RequestStatusCode::R_400;
// $this->createInvalidDeleteResponse($request, $response, $val);
// return;
// }
// /** @var \Modules\FleetManagement\Models\DriverAttributeValue $driverAttributeValue */
// $driverAttributeValue = DriverAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
// $this->deleteModel($request->header->account, $driverAttributeValue, DriverAttributeValueMapper::class, 'driver_attribute_value', $request->getOrigin());
// $this->createStandardDeleteResponse($request, $response, $driverAttributeValue);
}
/**
* Api method to update DriverAttributeValueL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $old */
$old = DriverAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'));
$new = $this->updateAttributeValueL11nFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, DriverAttributeValueL11nMapper::class, 'driver_attribute_value_l11n', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete DriverAttributeValueL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverAttributeValueL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $driverAttributeValueL11n */
$driverAttributeValueL11n = DriverAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $driverAttributeValueL11n, DriverAttributeValueL11nMapper::class, 'driver_attribute_value_l11n', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $driverAttributeValueL11n);
}
}

View File

@ -0,0 +1,673 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use Modules\Admin\Models\NullAccount;
use Modules\FleetManagement\Models\Driver\Driver;
use Modules\FleetManagement\Models\Driver\DriverInspectionMapper;
use Modules\FleetManagement\Models\Driver\DriverInspectionTypeL11nMapper;
use Modules\FleetManagement\Models\Driver\DriverInspectionTypeMapper;
use Modules\FleetManagement\Models\Driver\DriverMapper;
use Modules\FleetManagement\Models\Driver\DriverStatus;
use Modules\FleetManagement\Models\Inspection;
use Modules\FleetManagement\Models\InspectionStatus;
use Modules\Media\Models\CollectionMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\NullMedia;
use Modules\Media\Models\PathSettings;
use Modules\Media\Models\Reference;
use Modules\Media\Models\ReferenceMapper;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\BaseStringL11nType;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\NullBaseStringL11nType;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\NotificationLevel;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
/**
* FleetManagement class.
*
* @package Modules\FleetManagement
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class ApiDriverController extends Controller
{
/**
* Api method to create a vehicle
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiInspectionCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateInspectionCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
/** @var Inspection $inspection */
$inspection = $this->createInspectionFromRequest($request);
$this->createModel($request->header->account, $inspection, DriverInspectionMapper::class, 'inspection', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $inspection);
}
/**
* Method to create vehicle from request.
*
* @param RequestAbstract $request Request
*
* @return Inspection Returns the created vehicle from the request
*
* @since 1.0.0
*/
public function createInspectionFromRequest(RequestAbstract $request) : Inspection
{
$inspection = new Inspection();
$inspection->reference = (int) $request->getData('ref');
$inspection->description = $request->getDataString('description') ?? '';
$inspection->status = $request->getDataInt('status') ?? InspectionStatus::TODO;
$inspection->next = $request->getDataDateTime('next') ?? null;
$inspection->date = $request->getDataDateTime('date') ?? null;
$inspection->interval = $request->getDataInt('interval') ?? 0;
$inspection->type = new NullBaseStringL11nType((int) $request->getData('type'));
return $inspection;
}
/**
* Validate vehicle create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool> Returns the validation array of the request
*
* @since 1.0.0
*/
private function validateInspectionCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['ref'] = !$request->hasData('ref'))) {
return $val;
}
return [];
}
/**
* Api method to create a driver
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateDriverCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
/** @var Driver $driver */
$driver = $this->createDriverFromRequest($request);
$this->createModel($request->header->account, $driver, DriverMapper::class, 'driver', $request->getOrigin());
if (!empty($request->files)
|| !empty($request->getDataJson('media'))
) {
$this->createDriverMedia($driver, $request);
}
$this->createStandardCreateResponse($request, $response, $driver);
}
/**
* Method to create driver from request.
*
* @param RequestAbstract $request Request
*
* @return Driver Returns the created driver from the request
*
* @since 1.0.0
*/
public function createDriverFromRequest(RequestAbstract $request) : Driver
{
$driver = new Driver();
$driver->account = new NullAccount($request->getDataInt('account') ?? 1);
$driver->status = $request->getDataInt('status') ?? DriverStatus::INACTIVE;
return $driver;
}
/**
* Create media files for driver
*
* @param Driver $driver Driver
* @param RequestAbstract $request Request incl. media do upload
*
* @return void
*
* @since 1.0.0
*/
private function createDriverMedia(Driver $driver, RequestAbstract $request) : void
{
$path = $this->createDriverDir($driver);
if (!empty($uploadedFiles = $request->files)) {
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
names: [],
fileNames: [],
files: $uploadedFiles,
account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
virtualPath: $path,
pathSettings: PathSettings::FILE_PATH
);
$collection = null;
foreach ($uploaded as $media) {
$this->createModelRelation(
$request->header->account,
$driver->id,
$media->id,
DriverMapper::class,
'files',
'',
$request->getOrigin()
);
if ($collection === null) {
/** @var \Modules\Media\Models\Collection $collection */
$collection = MediaMapper::getParentCollection($path)->limit(1)->execute();
if ($collection->id === 0) {
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
$path,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files' . $path
);
}
}
$this->createModelRelation(
$request->header->account,
$collection->id,
$media->id,
CollectionMapper::class,
'sources',
'',
$request->getOrigin()
);
}
}
if (!empty($mediaFiles = $request->getDataJson('media'))) {
$collection = null;
foreach ($mediaFiles as $file) {
/** @var \Modules\Media\Models\Media $media */
$media = MediaMapper::get()->where('id', (int) $file)->limit(1)->execute();
$this->createModelRelation(
$request->header->account,
$driver->id,
$media->id,
DriverMapper::class,
'files',
'',
$request->getOrigin()
);
$ref = new Reference();
$ref->name = $media->name;
$ref->source = new NullMedia($media->id);
$ref->createdBy = new NullAccount($request->header->account);
$ref->setVirtualPath($path);
$this->createModel($request->header->account, $ref, ReferenceMapper::class, 'media_reference', $request->getOrigin());
if ($collection === null) {
/** @var \Modules\Media\Models\Collection $collection */
$collection = MediaMapper::getParentCollection($path)->limit(1)->execute();
if ($collection->id === 0) {
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
$path,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files' . $path
);
}
}
$this->createModelRelation(
$request->header->account,
$collection->id,
$ref->id,
CollectionMapper::class,
'sources',
'',
$request->getOrigin()
);
}
}
}
/**
* Validate driver create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool> Returns the validation array of the request
*
* @since 1.0.0
*/
private function validateDriverCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['account'] = !$request->hasData('account'))
) {
return $val;
}
return [];
}
/**
* Api method to create a bill
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiMediaAddToDriver(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateMediaAddToDriver($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidAddResponse($request, $response, $val);
return;
}
/** @var \Modules\FleetManagement\Models\Driver\Driver $driver */
$driver = DriverMapper::get()->where('id', (int) $request->getData('driver'))->execute();
$path = $this->createDriverDir($driver);
$uploaded = [];
if (!empty($uploadedFiles = $request->files)) {
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
names: [],
fileNames: [],
files: $uploadedFiles,
account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
virtualPath: $path,
pathSettings: PathSettings::FILE_PATH,
hasAccountRelation: false,
readContent: $request->getDataBool('parse_content') ?? false
);
$collection = null;
foreach ($uploaded as $media) {
$this->createModelRelation(
$request->header->account,
$driver->id,
$media->id,
DriverMapper::class,
'files',
'',
$request->getOrigin()
);
if ($request->hasData('type')) {
$this->createModelRelation(
$request->header->account,
$media->id,
$request->getDataInt('type'),
MediaMapper::class,
'types',
'',
$request->getOrigin()
);
}
if ($collection === null) {
/** @var \Modules\Media\Models\Collection $collection */
$collection = MediaMapper::getParentCollection($path)->limit(1)->execute();
if ($collection->id === 0) {
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
$path,
$request->header->account,
__DIR__ . '/../../../Modules/Media/Files' . $path,
);
}
}
$this->createModelRelation(
$request->header->account,
$collection->id,
$media->id,
CollectionMapper::class,
'sources',
'',
$request->getOrigin()
);
}
}
if (!empty($mediaFiles = $request->getDataJson('media'))) {
foreach ($mediaFiles as $media) {
$this->createModelRelation(
$request->header->account,
$driver->id,
(int) $media,
DriverMapper::class,
'files',
'',
$request->getOrigin()
);
}
}
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to driver.', [
'upload' => $uploaded,
'media' => $mediaFiles,
]);
}
/**
* Create media directory path
*
* @param Driver $driver Driver
*
* @return string
*
* @since 1.0.0
*/
private function createDriverDir(Driver $driver) : string
{
return '/Modules/FleetManagement/Driver/'
. $this->app->unitId . '/'
. $driver->id;
}
/**
* Method to validate bill creation from request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateMediaAddToDriver(RequestAbstract $request) : array
{
$val = [];
if (($val['media'] = (!$request->hasData('media') && empty($request->files)))
|| ($val['driver'] = !$request->hasData('driver'))
) {
return $val;
}
return [];
}
/**
* Api method to create a driver
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverInspectionTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateDriverInspectionTypeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
/** @var BaseStringL11nType $inspection */
$inspection = $this->createDriverInspectionTypeFromRequest($request);
$this->createModel($request->header->account, $inspection, DriverInspectionTypeMapper::class, 'driver_inspection_type', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $inspection);
}
/**
* Method to create driver from request.
*
* @param RequestAbstract $request Request
*
* @return BaseStringL11nType Returns the created driver from the request
*
* @since 1.0.0
*/
public function createDriverInspectionTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
{
$type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
return $type;
}
/**
* Validate driver create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool> Returns the validation array of the request
*
* @since 1.0.0
*/
private function validateDriverInspectionTypeCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['name'] = !$request->hasData('name'))
|| ($val['title'] = !$request->hasData('title'))
) {
return $val;
}
return [];
}
/**
* Api method to create driver attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiDriverInspectionTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateDriverInspectionTypeL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$typeL11n = $this->createDriverInspectionTypeL11nFromRequest($request);
$this->createModel($request->header->account, $typeL11n, DriverInspectionTypeL11nMapper::class, 'driver_inspection_type_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $typeL11n);
}
/**
* Method to create driver attribute l11n from request.
*
* @param RequestAbstract $request Request
*
* @return BaseStringL11n
*
* @since 1.0.0
*/
private function createDriverInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{
$typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage(
$request->getDataString('language') ?? $request->header->l11n->language
);
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n;
}
/**
* Validate driver attribute l11n create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateDriverInspectionTypeL11nCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['title'] = !$request->hasData('title'))
|| ($val['type'] = !$request->hasData('type'))
) {
return $val;
}
return [];
}
/**
* Api method to create notes
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateNoteCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$request->setData('virtualpath', '/Modules/FleetManagement/Driver/' . $request->getData('id'), true);
$this->app->moduleManager->get('Editor', 'Api')->apiEditorCreate($request, $response, $data);
if ($response->header->status !== RequestStatusCode::R_200) {
return;
}
$responseData = $response->get($request->uri->__toString());
if (!\is_array($responseData)) {
return;
}
$model = $responseData['response'];
$this->createModelRelation($request->header->account, (int) $request->getData('id'), $model->id, DriverMapper::class, 'notes', '', $request->getOrigin());
}
/**
* Validate item note create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateNoteCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))
) {
return $val;
}
return [];
}
/**
* Api method to update note
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiNoteUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
$this->app->moduleManager->get('Editor', 'Api')->apiEditorUpdate($request, $response, $data);
if ($response->header->status !== RequestStatusCode::R_200) {
return;
}
$responseData = $response->get($request->uri->__toString());
if (!\is_array($responseData)) {
return;
}
}
}

View File

@ -0,0 +1,523 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use Modules\Attribute\Models\Attribute;
use Modules\Attribute\Models\AttributeType;
use Modules\Attribute\Models\AttributeValue;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeL11nMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeValueL11nMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeValueMapper;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
/**
* FleetManagement class.
*
* @package Modules\FleetManagement
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class ApiVehicleAttributeController extends Controller
{
use \Modules\Attribute\Controller\ApiAttributeTraitController;
/**
* Api method to create item attribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attribute = $this->createAttributeFromRequest($request);
$this->createModel($request->header->account, $attribute, VehicleAttributeMapper::class, 'attribute', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attribute);
}
/**
* Api method to create vehicle attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrL11n = $this->createAttributeTypeL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, VehicleAttributeTypeL11nMapper::class, 'attr_type_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrL11n);
}
/**
* Api method to create vehicle attribute type
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrType = $this->createAttributeTypeFromRequest($request);
$this->createModel($request->header->account, $attrType, VehicleAttributeTypeMapper::class, 'attr_type', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrType);
}
/**
* Api method to create vehicle attribute value
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
/** @var \Modules\Attribute\Models\AttributeType $type */
$type = VehicleAttributeTypeMapper::get()
->where('id', $request->getDataInt('type') ?? 0)
->execute();
$attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, VehicleAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) {
$this->createModelRelation(
$request->header->account,
(int) $request->getData('type'),
$attrValue->id,
VehicleAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
);
}
$this->createStandardCreateResponse($request, $response, $attrValue);
}
/**
* Api method to create vehicle attribute l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrL11n = $this->createAttributeValueL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, VehicleAttributeValueL11nMapper::class, 'attr_value_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attrL11n);
}
/**
* Api method to update VehicleAttribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var Attribute $old */
$old = VehicleAttributeMapper::get()
->with('type')
->with('type/defaults')
->with('value')
->where('id', (int) $request->getData('id'))
->execute();
$new = $this->updateAttributeFromRequest($request, clone $old);
if ($new->id === 0) {
// Set response header to invalid request because of invalid data
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $new);
return;
}
$this->updateModel($request->header->account, $old, $new, VehicleAttributeMapper::class, 'vehicle_attribute', $request->getOrigin());
if ($new->value->getValue() !== $old->value->getValue()
&& $new->type->custom
) {
$this->updateModel($request->header->account, $old->value, $new->value, VehicleAttributeValueMapper::class, 'attribute_value', $request->getOrigin());
}
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete VehicleAttribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
$vehicleAttribute = VehicleAttributeMapper::get()
->with('type')
->where('id', (int) $request->getData('id'))
->execute();
if ($vehicleAttribute->type->isRequired) {
$this->createInvalidDeleteResponse($request, $response, []);
return;
}
$this->deleteModel($request->header->account, $vehicleAttribute, VehicleAttributeMapper::class, 'vehicle_attribute', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $vehicleAttribute);
}
/**
* Api method to update VehicleAttributeTypeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $old */
$old = VehicleAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateAttributeTypeL11nFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, VehicleAttributeTypeL11nMapper::class, 'vehicle_attribute_type_l11n', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete VehicleAttributeTypeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeL11nDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $vehicleAttributeTypeL11n */
$vehicleAttributeTypeL11n = VehicleAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $vehicleAttributeTypeL11n, VehicleAttributeTypeL11nMapper::class, 'vehicle_attribute_type_l11n', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $vehicleAttributeTypeL11n);
}
/**
* Api method to update VehicleAttributeType
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var AttributeType $old */
$old = VehicleAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateAttributeTypeFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, VehicleAttributeTypeMapper::class, 'vehicle_attribute_type', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete VehicleAttributeType
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @todo: implement
*
* @since 1.0.0
*/
public function apiVehicleAttributeTypeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeTypeDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var AttributeType $vehicleAttributeType */
$vehicleAttributeType = VehicleAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $vehicleAttributeType, VehicleAttributeTypeMapper::class, 'vehicle_attribute_type', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $vehicleAttributeType);
}
/**
* Api method to update VehicleAttributeValue
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var AttributeValue $old */
$old = VehicleAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
/** @var \Modules\Attribute\Models\Attribute $attr */
$attr = VehicleAttributeMapper::get()
->with('type')
->where('id', $request->getDataInt('attribute') ?? 0)
->execute();
$new = $this->updateAttributeValueFromRequest($request, clone $old, $attr);
$this->updateModel($request->header->account, $old, $new, VehicleAttributeValueMapper::class, 'vehicle_attribute_value', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete VehicleAttributeValue
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
// @todo: I don't think values can be deleted? Only Attributes
// However, It should be possible to remove UNUSED default values
// either here or other function?
// if (!empty($val = $this->validateAttributeValueDelete($request))) {
// $response->header->status = RequestStatusCode::R_400;
// $this->createInvalidDeleteResponse($request, $response, $val);
// return;
// }
// /** @var \Modules\FleetManagement\Models\VehicleAttributeValue $vehicleAttributeValue */
// $vehicleAttributeValue = VehicleAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
// $this->deleteModel($request->header->account, $vehicleAttributeValue, VehicleAttributeValueMapper::class, 'vehicle_attribute_value', $request->getOrigin());
// $this->createStandardDeleteResponse($request, $response, $vehicleAttributeValue);
}
/**
* Api method to update VehicleAttributeValueL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $old */
$old = VehicleAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'));
$new = $this->updateAttributeValueL11nFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, VehicleAttributeValueL11nMapper::class, 'vehicle_attribute_value_l11n', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Api method to delete VehicleAttributeValueL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiVehicleAttributeValueL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateAttributeValueL11nDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var BaseStringL11n $vehicleAttributeValueL11n */
$vehicleAttributeValueL11n = VehicleAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $vehicleAttributeValueL11n, VehicleAttributeValueL11nMapper::class, 'vehicle_attribute_value_l11n', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $vehicleAttributeValueL11n);
}
}

File diff suppressed because it is too large Load Diff

569
Controller/BackendController.php Executable file
View File

@ -0,0 +1,569 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeL11nMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeTypeMapper;
use Modules\FleetManagement\Models\Driver\DriverMapper;
use Modules\FleetManagement\Models\InspectionMapper;
use Modules\FleetManagement\Models\VehicleMapper;
use Modules\FleetManagement\Models\VehicleTypeMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
use Modules\Organization\Models\UnitMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
/**
* FleetManagement class.
*
* @package Modules\FleetManagement
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
* @codeCoverageIgnore
*/
final class BackendController extends Controller
{
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003503001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = VehicleAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributes'] = $attributes;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementDriverAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003503001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = VehicleAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributes'] = $attributes;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementVehicleList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
$list = VehicleMapper::getAll()
->with('type')
->with('type/l11n')
->where('type/l11n/language', $response->header->l11n->language)
->sort('id', 'DESC')
->execute();
$view->data['vehicles'] = $list;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementDriverList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/driver-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
$list = DriverMapper::getAll()
->with('account')
->sort('id', 'DESC')
->execute();
$view->data['drivers'] = $list;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementInspectionList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
$list = InspectionMapper::getAll()
->sort('id', 'DESC')
->execute();
$view->data['inspectionss'] = $list;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementInspectionTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
$list = InspectionMapper::getAll()
->sort('id', 'DESC')
->execute();
$view->data['inspectionss'] = $list;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementInspectionCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
$list = InspectionMapper::getAll()
->sort('id', 'DESC')
->execute();
$view->data['inspectionss'] = $list;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = VehicleAttributeTypeMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
->execute();
$l11ns = VehicleAttributeTypeL11nMapper::getAll()
->where('ref', $attribute->id)
->execute();
$view->data['attribute'] = $attribute;
$view->data['l11ns'] = $l11ns;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementDriverAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/attribute-type');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = VehicleAttributeTypeMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
->execute();
$l11ns = VehicleAttributeTypeL11nMapper::getAll()
->where('ref', $attribute->id)
->execute();
$view->data['attribute'] = $attribute;
$view->data['l11ns'] = $l11ns;
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementVehicleCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, [
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementDriverCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, [
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementInspectionProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/inspection-profile');
$view->data['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 array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementVehicleProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/vehicle-profile');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
// @todo: This langauge 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.
$vehicle = VehicleMapper::get()
->with('attributes')
->with('attributes/type')
->with('attributes/value')
->with('attributes/type/l11n')
->with('files')
->with('files/types')
->with('type')
->with('type/l11n')
->with('fuelType')
->with('fuelType/l11n')
->where('id', (int) $request->getData('id'))
->where('type/l11n/language', $response->header->l11n->language)
->where('fuelType/l11n/language', $response->header->l11n->language)
->where('attributes/type/l11n/language', $response->header->l11n->language)
->execute();
$view->data['vehicle'] = $vehicle;
$inspections = InspectionMapper::getAll()
->with('type')
->with('type/l11n')
->where('reference', $vehicle->id)
->where('type/l11n/language', $response->header->l11n->language)
->execute();
$view->data['inspections'] = $inspections;
$query = new Builder($this->app->dbPool->get());
$results = $query->selectAs(VehicleMapper::HAS_MANY['files']['external'], 'file')
->from(VehicleMapper::TABLE)
->leftJoin(VehicleMapper::HAS_MANY['files']['table'])
->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::HAS_MANY['files']['self'], '=', VehicleMapper::TABLE . '.' . VehicleMapper::PRIMARYFIELD)
->leftJoin(MediaMapper::TABLE)
->on(VehicleMapper::HAS_MANY['files']['table'] . '.' . VehicleMapper::HAS_MANY['files']['external'], '=', MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD)
->leftJoin(MediaMapper::HAS_MANY['types']['table'])
->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self'])
->leftJoin(MediaTypeMapper::TABLE)
->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD)
->where(VehicleMapper::HAS_MANY['files']['self'], '=', $vehicle->id)
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'vehicle_profile_image');
$vehicleImage = MediaMapper::get()
->with('types')
->where('id', $results)
->limit(1)
->execute();
$view->data['vehicleImage'] = $vehicleImage;
$vehicleTypes = VehicleTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['types'] = $vehicleTypes;
$units = UnitMapper::getAll()
->execute();
$view->data['units'] = $units;
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, [
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['vehicle-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewFleetManagementDriverProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/FleetManagement/Theme/Backend/driver-profile');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003502001, $request, $response);
// @todo: This langauge 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.
$driver = DriverMapper::get()
->with('attributes')
->with('attributes/type')
->with('attributes/value')
->with('attributes/type/l11n')
->with('files')
->with('files/types')
->where('id', (int) $request->getData('id'))
->where('attributes/type/l11n/language', $response->header->l11n->language)
->execute();
$view->data['driver'] = $driver;
$query = new Builder($this->app->dbPool->get());
$results = $query->selectAs(DriverMapper::HAS_MANY['files']['external'], 'file')
->from(DriverMapper::TABLE)
->leftJoin(DriverMapper::HAS_MANY['files']['table'])
->on(DriverMapper::HAS_MANY['files']['table'] . '.' . DriverMapper::HAS_MANY['files']['self'], '=', DriverMapper::TABLE . '.' . DriverMapper::PRIMARYFIELD)
->leftJoin(MediaMapper::TABLE)
->on(DriverMapper::HAS_MANY['files']['table'] . '.' . DriverMapper::HAS_MANY['files']['external'], '=', MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD)
->leftJoin(MediaMapper::HAS_MANY['types']['table'])
->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self'])
->leftJoin(MediaTypeMapper::TABLE)
->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD)
->where(DriverMapper::HAS_MANY['files']['self'], '=', $driver->id)
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'driver_profile_image');
$driverImage = MediaMapper::get()
->with('types')
->where('id', $results)
->limit(1)
->execute();
$view->data['driverImage'] = $driverImage;
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, [
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['driver-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
return $view;
}
}

76
Controller/Controller.php Executable file
View File

@ -0,0 +1,76 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Controller;
use phpOMS\Module\ModuleAbstract;
/**
* FleetManagement class.
*
* @package Modules\FleetManagement
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Controller extends ModuleAbstract
{
/**
* Module path.
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__ . '/../';
/**
* Module version.
*
* @var string
* @since 1.0.0
*/
public const VERSION = '1.0.0';
/**
* Module name.
*
* @var string
* @since 1.0.0
*/
public const NAME = 'FleetManagement';
/**
* Module id.
*
* @var int
* @since 1.0.0
*/
public const ID = 1003500000;
/**
* Providing.
*
* @var string[]
* @since 1.0.0
*/
public static array $providing = [];
/**
* Dependencies.
*
* @var string[]
* @since 1.0.0
*/
public static array $dependencies = [];
}

3
Docs/Dev/en/SUMMARY.md Executable file
View File

@ -0,0 +1,3 @@
# Developer Content
* [Structure]({%}&page=Dev/structure)

5
Docs/Dev/en/structure.md Executable file
View File

@ -0,0 +1,5 @@
# Structure
## ER
![ER](Modules/ClientManagement/Docs/Dev/img/er.png)

BIN
Docs/Dev/img/er.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

49
ICAL.txt Executable file
View File

@ -0,0 +1,49 @@
# Individual Contributor License Agreement ("CLA") 1.0
Thank you for your interest in Karaka-Management (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.
By contributing to the Company You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all right, title, and interest in and to Your Contributions.
## Definitions
**"You" (or "Your")**
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with the Company. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
**"Contribution"**
"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Company for inclusion in, or documentation of, any of the products owned or managed by the Company (the "Work"). This includes but is not limited to technical material, techniques, articles, sketches, drawings, images, models, inventions, know-how, processes, apparatus, equipment, algorithms, software programs, software source documents, and formula related to the current, future and proposed products and services regarding the Company". For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Company or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Company for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
## Grant of Copyright License
Subject to the terms and conditions of this Agreement, You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sub license, and distribute Your Contributions and such derivative works.
## Grant of Patent License
Subject to the terms and conditions of this Agreement, You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
## Authorization
You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Company, or that your employer has executed a separate Corporate CLA with the Company.
You represent that each of Your Contributions is Your original creation (see "Third-party Contribution" for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
## Support
You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
## Third-party Contribution
Should You wish to submit work that is not Your original creation, You may submit it to the Company separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
## Survival
This Agreement shall govern all communications between the parties. You understand that this Agreement stays active even if the connection with You gets terminated unless the project the Company gets officially canceled by the project manager "Dennis Eichhorn".
## Governing Law and Jurisdiction
This Agreement shall be governed exclusively by German law. The courts of Hessen, Germany shall have exclusive jurisdiction.
## Entire Agreement
This agreement constitutes the entire agreement and supersedes all prior or contemporaneous oral or written agreements concerning such Contribution. This agreement may only be changed by mutual agreement of authorized representatives of the parties in writing. You agree to notify the Company of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.

View File

@ -0,0 +1,86 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Fleet mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Attribute
* @extends DataMapperFactory<T>
*/
final class DriverAttributeMapper 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_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_type' => ['name' => 'fleetmgmt_driver_attr_type', 'type' => 'int', 'internal' => 'type'],
'fleetmgmt_driver_attr_value' => ['name' => 'fleetmgmt_driver_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' => DriverAttributeTypeMapper::class,
'external' => 'fleetmgmt_driver_attr_type',
],
'value' => [
'mapper' => DriverAttributeValueMapper::class,
'external' => 'fleetmgmt_driver_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_driver_attr';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_attr_id';
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Driver mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class DriverAttributeTypeL11nMapper 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_driver_attr_type_l11n_id' => ['name' => 'fleetmgmt_driver_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_attr_type_l11n_title' => ['name' => 'fleetmgmt_driver_attr_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_driver_attr_type_l11n_type' => ['name' => 'fleetmgmt_driver_attr_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_driver_attr_type_l11n_lang' => ['name' => 'fleetmgmt_driver_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver_attr_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\AttributeType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Driver mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of AttributeType
* @extends DataMapperFactory<T>
*/
final class DriverAttributeTypeMapper 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_driver_attr_type_id' => ['name' => 'fleetmgmt_driver_attr_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_attr_type_name' => ['name' => 'fleetmgmt_driver_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'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_custom' => ['name' => 'fleetmgmt_driver_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'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'],
];
/**
* 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' => DriverAttributeTypeL11nMapper::class,
'table' => 'fleetmgmt_driver_attr_type_l11n',
'self' => 'fleetmgmt_driver_attr_type_l11n_type',
'column' => 'content',
'external' => null,
],
'defaults' => [
'mapper' => DriverAttributeValueMapper::class,
'table' => 'fleetmgmt_driver_attr_default',
'self' => 'fleetmgmt_driver_attr_default_type',
'external' => 'fleetmgmt_driver_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_driver_attr_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_attr_type_id';
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Driver mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class DriverAttributeValueL11nMapper 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_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_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'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver_attr_value_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\AttributeValue;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Driver mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of AttributeValue
* @extends DataMapperFactory<T>
*/
final class DriverAttributeValueMapper 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_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_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_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_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_depvalue' => ['name' => 'fleetmgmt_driver_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' => DriverAttributeValueL11nMapper::class,
'table' => 'fleetmgmt_driver_attr_value_l11n',
'self' => 'fleetmgmt_driver_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_driver_attr_value';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_attr_value_id';
}

View File

@ -0,0 +1,86 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Fleet mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @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_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_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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\AttributeType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @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
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Attribute
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Attribute;
use Modules\Attribute\Models\AttributeValue;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Vehicle mapper class.
*
* @package Modules\FleetManagement\Models\Attribute
* @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';
}

48
Models/Cost.php Normal file
View File

@ -0,0 +1,48 @@
<?php
/**
* Jingga
*
* 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
/**
* Jingga
*
* 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();
}
}

79
Models/Driver/Driver.php Normal file
View File

@ -0,0 +1,79 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use Modules\Admin\Models\Account;
/**
* Driver class.
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Driver
{
/**
* ID value.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
/**
* Status value.
*
* @var int
* @since 1.0.0
*/
public int $status = DriverStatus::ACTIVE;
/**
* Account associated with the client.
*
* @var Account
* @since 1.0.0
*/
public Account $account;
public array $licenses = [];
public array $inspections = [];
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'status' => $this->status,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
use \Modules\Media\Models\MediaListTrait;
use \Modules\Editor\Models\EditorDocListTrait;
use \Modules\Attribute\Models\AttributeHolderTrait;
}

View File

@ -0,0 +1,86 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use Modules\FleetManagement\Models\Inspection;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* mapper class.
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Inspection
* @extends DataMapperFactory<T>
*/
final class DriverInspectionMapper 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_driver_inspection_id' => ['name' => 'fleetmgmt_driver_inspection_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_inspection_driver' => ['name' => 'fleetmgmt_driver_inspection_driver', 'type' => 'int', 'internal' => 'reference'],
'fleetmgmt_driver_inspection_description' => ['name' => 'fleetmgmt_driver_inspection_description', 'type' => 'string', 'internal' => 'description'],
'fleetmgmt_driver_inspection_status' => ['name' => 'fleetmgmt_driver_inspection_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_driver_inspection_interval' => ['name' => 'fleetmgmt_driver_inspection_interval', 'type' => 'int', 'internal' => 'interval'],
'fleetmgmt_driver_inspection_next' => ['name' => 'fleetmgmt_driver_inspection_next', 'type' => 'DateTime', 'internal' => 'next'],
'fleetmgmt_driver_inspection_date' => ['name' => 'fleetmgmt_driver_inspection_date', 'type' => 'DateTime', 'internal' => 'date'],
'fleetmgmt_driver_inspection_type' => ['name' => 'fleetmgmt_driver_inspection_type', 'type' => 'int', 'internal' => 'type'],
];
/**
* 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' => DriverInspectionTypeMapper::class,
'external' => 'fleetmgmt_driver_inspection_type',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver_inspection';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_inspection_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = Inspection::class;
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* mapper class.
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11n
* @extends DataMapperFactory<T>
*/
final class DriverInspectionTypeL11nMapper 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_driver_inspection_type_l11n_id' => ['name' => 'fleetmgmt_driver_inspection_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_inspection_type_l11n_title' => ['name' => 'fleetmgmt_driver_inspection_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_driver_inspection_type_l11n_type' => ['name' => 'fleetmgmt_driver_inspection_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_driver_inspection_type_l11n_lang' => ['name' => 'fleetmgmt_driver_inspection_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver_inspection_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_inspection_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,83 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11nType;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11nType
* @extends DataMapperFactory<T>
*/
final class DriverInspectionTypeMapper 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_driver_inspection_type_id' => ['name' => 'fleetmgmt_driver_inspection_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_inspection_type_name' => ['name' => 'fleetmgmt_driver_inspection_type_name', 'type' => 'string', 'internal' => 'title', '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' => DriverInspectionTypeL11nMapper::class,
'table' => 'fleetmgmt_driver_inspection_type_l11n',
'self' => 'fleetmgmt_driver_inspection_type_l11n_type',
'column' => 'content',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11nType::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver_inspection_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_inspection_type_id';
}

View File

@ -0,0 +1,103 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use Modules\Admin\Models\AccountMapper;
use Modules\Editor\Models\EditorDocMapper;
use Modules\FleetManagement\Models\Attribute\DriverAttributeMapper;
use Modules\Media\Models\MediaMapper;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* Mapper class.
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Driver
* @extends DataMapperFactory<T>
*/
final class DriverMapper 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_driver_id' => ['name' => 'fleetmgmt_driver_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_driver_status' => ['name' => 'fleetmgmt_driver_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_driver_account' => ['name' => 'fleetmgmt_driver_account', 'type' => 'int', 'internal' => 'account'],
];
/**
* 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 = [
'files' => [
'mapper' => MediaMapper::class,
'table' => 'fleetmgmt_driver_media',
'external' => 'fleetmgmt_driver_media_media',
'self' => 'fleetmgmt_driver_media_vehicle',
],
'attributes' => [
'mapper' => DriverAttributeMapper::class,
'table' => 'fleetmgmt_driver_attr',
'self' => 'fleetmgmt_driver_attr_driver',
'external' => null,
],
'notes' => [
'mapper' => EditorDocMapper::class, /* mapper of the related object */
'table' => 'fleetmgmt_driver_note', /* table of the related object, null if no relation table is used (many->1) */
'external' => 'fleetmgmt_driver_note_doc',
'self' => 'fleetmgmt_driver_note_driver',
],
];
/**
* 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 = [
'account' => [
'mapper' => AccountMapper::class,
'external' => 'fleetmgmt_driver_account',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_driver';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_driver_id';
}

View File

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

View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
/**
* Null model
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullDriver extends Driver
{
/**
* 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,48 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\FleetManagement\Models\Driver
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\FleetManagement\Models\Driver;
use Modules\FleetManagement\Models\Inspection;
/**
* Null model
*
* @package Modules\FleetManagement\Models\Driver
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullDriverInspection extends Inspection
{
/**
* 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,69 @@
<?php
/**
* Jingga
*
* 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;
}

83
Models/FuelTypeMapper.php Normal file
View File

@ -0,0 +1,83 @@
<?php
/**
* Jingga
*
* 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\BaseStringL11nType;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11nType
* @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' => 'title', '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 = BaseStringL11nType::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';
}

90
Models/Inspection.php Normal file
View File

@ -0,0 +1,90 @@
<?php
/**
* Jingga
*
* 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\Admin\Models\Account;
use phpOMS\Localization\BaseStringL11nType;
/**
* Inspection class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Inspection implements \JsonSerializable
{
public int $id = 0;
public string $description = '';
public BaseStringL11nType $type;
public int $status = InspectionStatus::TODO;
// Automatically get's filled from the previous inspection if available
// Alternatively define default interval from inspection type?
public ?\DateTime $next = null;
public ?\DateTime $date = null;
/**
* Inspection duration in hours
*/
public int $duration = 0;
/**
* Inspection interval in months
*
* @var int
* @since 1.0.0
*/
public int $interval = 0;
public int $reference = 0;
public ?Account $responsible = null;
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct()
{
$this->type = new BaseStringL11nType();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
use \Modules\Media\Models\MediaListTrait;
}

View File

@ -0,0 +1,85 @@
<?php
/**
* Jingga
*
* 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;
/**
* mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Inspection
* @extends DataMapperFactory<T>
*/
final class InspectionMapper 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_inspection_id' => ['name' => 'fleetmgmt_vehicle_inspection_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_vehicle_inspection_vehicle' => ['name' => 'fleetmgmt_vehicle_inspection_vehicle', 'type' => 'int', 'internal' => 'reference'],
'fleetmgmt_vehicle_inspection_description' => ['name' => 'fleetmgmt_vehicle_inspection_description', 'type' => 'string', 'internal' => 'description'],
'fleetmgmt_vehicle_inspection_status' => ['name' => 'fleetmgmt_vehicle_inspection_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_vehicle_inspection_interval' => ['name' => 'fleetmgmt_vehicle_inspection_interval', 'type' => 'int', 'internal' => 'interval'],
'fleetmgmt_vehicle_inspection_next' => ['name' => 'fleetmgmt_vehicle_inspection_next', 'type' => 'DateTime', 'internal' => 'next'],
'fleetmgmt_vehicle_inspection_date' => ['name' => 'fleetmgmt_vehicle_inspection_date', 'type' => 'DateTime', 'internal' => 'date'],
'fleetmgmt_vehicle_inspection_type' => ['name' => 'fleetmgmt_vehicle_inspection_type', 'type' => 'int', 'internal' => 'type'],
];
/**
* 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' => InspectionTypeMapper::class,
'external' => 'fleetmgmt_vehicle_inspection_type',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_vehicle_inspection';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_vehicle_inspection_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = Inspection::class;
}

View File

@ -0,0 +1,36 @@
<?php
/**
* Jingga
*
* 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;
/**
* Inspection status enum.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class InspectionStatus extends Enum
{
public const DONE = 1;
public const PASSED = 2;
public const ONGOING = 4;
public const TODO = 5;
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Jingga
*
* 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 InspectionTypeL11nMapper 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_inspection_type_l11n_id' => ['name' => 'fleetmgmt_inspection_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_inspection_type_l11n_title' => ['name' => 'fleetmgmt_inspection_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'fleetmgmt_inspection_type_l11n_type' => ['name' => 'fleetmgmt_inspection_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'fleetmgmt_inspection_type_l11n_lang' => ['name' => 'fleetmgmt_inspection_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_inspection_type_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_inspection_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,83 @@
<?php
/**
* Jingga
*
* 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\BaseStringL11nType;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11nType
* @extends DataMapperFactory<T>
*/
final class InspectionTypeMapper 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_inspection_type_id' => ['name' => 'fleetmgmt_inspection_type_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_inspection_type_name' => ['name' => 'fleetmgmt_inspection_type_name', 'type' => 'string', 'internal' => 'title', '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' => InspectionTypeL11nMapper::class,
'table' => 'fleetmgmt_inspection_type_l11n',
'self' => 'fleetmgmt_inspection_type_l11n_type',
'column' => 'content',
'external' => null,
],
];
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = BaseStringL11nType::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_inspection_type';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_inspection_type_id';
}

46
Models/License.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* 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;
/**
* License class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class License implements \JsonSerializable
{
public int $id = 0;
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

46
Models/LicenseType.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* 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;
/**
* LicenseType class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class LicenseType implements \JsonSerializable
{
public int $id = 0;
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

78
Models/Milage.php Normal file
View File

@ -0,0 +1,78 @@
<?php
/**
* Jingga
*
* 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\FleetManagement\Models\Driver\Driver;
/**
* Milage class.
*
* @package Modules\Attribute\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class Milage implements \JsonSerializable
{
public int $id = 0;
public int $vehicle = 0;
public ?Driver $driver = null;
public ?\DateTime $start = null;
public ?\DateTime $end = null;
public string $from = '';
public string $to = '';
/**
* Milage in km
*
* @var int
*/
public int $milage = 0;
/**
* Fuel usage in l
*
* @var int
*/
public int $fuelUsage = 0;
public string $description = '';
public int $status = 0;
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

91
Models/MilageMapper.php Normal file
View File

@ -0,0 +1,91 @@
<?php
/**
* Jingga
*
* 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\FleetManagement\Models\Driver\DriverMapper;
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 Milage
* @extends DataMapperFactory<T>
*/
final class MilageMapper 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_milage_id' => ['name' => 'fleetmgmt_milage_id', 'type' => 'int', 'internal' => 'id'],
'fleetmgmt_milage_description' => ['name' => 'fleetmgmt_milage_description', 'type' => 'string', 'internal' => 'description'],
'fleetmgmt_milage_status' => ['name' => 'fleetmgmt_milage_status', 'type' => 'int', 'internal' => 'status'],
'fleetmgmt_milage_driver' => ['name' => 'fleetmgmt_milage_driver', 'type' => 'int', 'internal' => 'driver'],
'fleetmgmt_milage_vehicle' => ['name' => 'fleetmgmt_milage_vehicle', 'type' => 'int', 'internal' => 'vehicle'],
'fleetmgmt_milage_start' => ['name' => 'fleetmgmt_milage_start', 'type' => 'DateTime', 'internal' => 'start'],
'fleetmgmt_milage_end' => ['name' => 'fleetmgmt_milage_end', 'type' => 'DateTime', 'internal' => 'end'],
'fleetmgmt_milage_milage' => ['name' => 'fleetmgmt_milage_milage', 'type' => 'int', 'internal' => 'milage'],
'fleetmgmt_milage_fuel' => ['name' => 'fleetmgmt_milage_fuel', 'type' => 'int', 'internal' => 'fuelUsage'],
];
/**
* 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 = [
'driver' => [
'mapper' => DriverMapper::class,
'external' => 'fleetmgmt_milage_driver',
],
'vehicle' => [
'mapper' => VehicleMapper::class,
'external' => 'fleetmgmt_milage_vehicle',
],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'fleetmgmt_milage';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'fleetmgmt_milage_id';
/**
* Model to use by the mapper.
*
* @var class-string<T>
* @since 1.0.0
*/
public const MODEL = Milage::class;
}

46
Models/NullInspection.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* 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 NullInspection extends Inspection
{
/**
* 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];
}
}

47
Models/NullVehicle.php Normal file
View File

@ -0,0 +1,47 @@
<?php
/**
* Jingga
*
* 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;
parent::__construct();
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

48
Models/PermissionCategory.php Executable file
View File

@ -0,0 +1,48 @@
<?php
/**
* Jingga
*
* 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;
/**
* Permision state enum.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class PermissionCategory extends Enum
{
public const VEHICLE = 1;
public const FUEL_TYPE = 2;
public const VEHICLE_TYPE = 3;
public const VEHICLE_INSPECTION_TYPE = 4;
public const VEHICLE_INSPECTION = 5;
public const VEHICLE_ATTRIBUTE_TYPE = 6;
public const DRIVER = 7;
public const DRIVER_INSPECTION_TYPE = 8;
public const DRIVER_INSPECTION = 9;
public const DRIVER_ATTRIBUTE_TYPE = 10;
}

86
Models/Vehicle.php Normal file
View File

@ -0,0 +1,86 @@
<?php
/**
* Jingga
*
* 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\BaseStringL11nType;
/**
* Vehicle 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 BaseStringL11nType $type;
public BaseStringL11nType $fuelType;
public string $info = '';
public array $drivers = [];
public array $inspections = [];
public array $milage = [];
public int $unit = 0;
public ?int $responsible = null;
public \DateTimeImmutable $createdAt;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->createdAt = new \DateTimeImmutable('now');
$this->type = new BaseStringL11nType();
$this->fuelType = new BaseStringL11nType();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
use \Modules\Media\Models\MediaListTrait;
use \Modules\Editor\Models\EditorDocListTrait;
use \Modules\Attribute\Models\AttributeHolderTrait;
}

120
Models/VehicleMapper.php Normal file
View File

@ -0,0 +1,120 @@
<?php
/**
* Jingga
*
* 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\Editor\Models\EditorDocMapper;
use Modules\FleetManagement\Models\Attribute\VehicleAttributeMapper;
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_type' => ['name' => 'fleetmgmt_vehicle_type', 'type' => 'int', 'internal' => 'type'],
'fleetmgmt_vehicle_fuel' => ['name' => 'fleetmgmt_vehicle_fuel', 'type' => 'int', 'internal' => 'fuelType'],
'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 = [
'files' => [
'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_vehicle',
'external' => null,
],
'notes' => [
'mapper' => EditorDocMapper::class, /* mapper of the related object */
'table' => 'fleetmgmt_vehicle_note', /* table of the related object, null if no relation table is used (many->1) */
'external' => 'fleetmgmt_vehicle_note_doc',
'self' => 'fleetmgmt_vehicle_note_vehicle',
],
];
/**
* 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';
}

38
Models/VehicleStatus.php Normal file
View File

@ -0,0 +1,38 @@
<?php
/**
* Jingga
*
* 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;
public const MAINTENANCE = 5;
}

View File

@ -0,0 +1,69 @@
<?php
/**
* Jingga
*
* 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,84 @@
<?php
/**
* Jingga
*
* 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\BaseStringL11nType;
/**
* Item mapper class.
*
* @package Modules\FleetManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of BaseStringL11nType
* @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' => 'title', '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 = BaseStringL11nType::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';
}

0
README.md Normal file → Executable file
View File

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'عميل',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'منطقة',
'SalesRep' => 'مندول المبيعات',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klienta',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Kraj',
'SalesRep' => 'Obchodní zástupce',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klient',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Område',
'SalesRep' => 'Salgsrepræsentant',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klient',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Region',
'SalesRep' => 'VerkäufeRep',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Πελάτης',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Περιοχή',
'SalesRep' => 'Αντιπρόσωπος Πωλήσεων',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => '',
'DriverAttributes' => 'Driver Attributes',
'DriverInspectionTypes' => 'Driver Inspection Types',
'Drivers' => 'Drivers',
'FleetManagement' => 'Fleet Management',
'Inspections' => 'Inspections',
'Region' => '',
'SalesRep' => '',
'VehicleAttributes' => 'Vehicle Attributes',
'VehicleInspectionTypes' => 'Vehicle Inspection Types',
'Vehicles' => 'Vehicles',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Cliente',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Región',
'SalesRep' => 'Vendedores',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Asiakas',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Alue',
'SalesRep' => 'Myyntiedustaja',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Client',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Région',
'SalesRep' => 'Représentant commercial',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Ügyfél',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Vidék',
'SalesRep' => 'Értékesítés',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Cliente',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Regione',
'SalesRep' => 'Rappresentante delle vendite',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'クライアント',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => '領域',
'SalesRep' => 'セールスレート',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => '고객',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => '지역',
'SalesRep' => '매출액',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klient',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Region',
'SalesRep' => 'SalesRep.',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klient',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Region',
'SalesRep' => 'Przedstawiciel handlowy',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Cliente',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Região',
'SalesRep' => 'Representante de vendas',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Клиент',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Область',
'SalesRep' => 'Торговый представитель',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Klient',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Område',
'SalesRep' => 'Säljare',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'ลูกค้า',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'ภูมิภาค',
'SalesRep' => 'ตัวแทนฝ่ายขาย',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Müşteri',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Bölge',
'SalesRep' => 'Satıcı',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => 'Клієнт',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => 'Регіон',
'SalesRep' => 'Торговий представник',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

View File

@ -0,0 +1,27 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Client' => '客户',
'DriverAttributes' => '',
'DriverInspectionTypes' => '',
'Drivers' => '',
'FleetManagement' => '',
'Inspections' => '',
'Region' => '地区',
'SalesRep' => '销售代表',
'VehicleAttributes' => '',
'VehicleInspectionTypes' => '',
'Vehicles' => '',
]];

152
Theme/Backend/Lang/ar.lang.php Executable file
View File

@ -0,0 +1,152 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['FleetManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Accounting' => 'محاسبة',
'Addition' => 'إضافة',
'Address' => 'تبوك',
'Addresses' => 'عناوين',
'Africa' => '#VALUE!',
'AllCustomers' => '#VALUE!',
'America' => '#VALUE!',
'Analyse' => '#VALUE!',
'AreaManager' => 'مدير المنطقة',
'Articlegroup' => 'articlegroup.',
'Articles' => 'مقالات',
'Asia' => '#VALUE!',
'Attribute' => '#VALUE!',
'Attributes' => '#VALUE!',
'Balance' => 'الرصيد',
'BaseTime' => '#VALUE!',
'Bills' => '#VALUE!',
'Bonus' => 'علاوة',
'Business' => 'اعمال',
'CIS' => '#VALUE!',
'CLV' => 'قذيفة',
'Calendar' => 'تقويم',
'City' => 'مدينة',
'Client' => 'عميل',
'ClientID' => '#VALUE!',
'Clients' => 'عملاء',
'ComparisonTime' => '#VALUE!',
'Contact' => 'اتصل',
'Costs' => '',
'Country' => 'دولة',
'Created' => 'خلقت',
'CreatedAt' => '#VALUE!',
'CreditRating' => 'التصنيف الائتماني',
'Creditcard' => 'بطاقة إئتمان',
'Customers' => '#VALUE!',
'DSO' => 'DSO.',
'Date' => 'تاريخ',
'Default' => 'تقصير',
'Delivery' => 'توصيل',
'Description' => '',
'Discount' => 'خصم',
'DiscountBonus' => '#VALUE!',
'DiscountP' => 'خصم ٪',
'Documents' => 'وثائق',
'Driver' => '',
'Drivers' => '',
'Due' => 'بسبب',
'Email' => 'بريد الالكتروني',
'End' => '',
'Europe' => '#VALUE!',
'Fax' => 'فاكس',
'Files' => 'الملفات',
'Filter' => 'منقي',
'Freightage' => 'شحن',
'From' => '',
'Group' => 'مجموعة',
'History' => '',
'ID' => 'بطاقة تعريف',
'Info' => 'معلومات',
'Inspections' => '',
'Invoice' => 'فاتورة',
'Invoices' => 'الفواتير',
'IsDefault' => 'افتراضي؟',
'Items' => '#VALUE!',
'LastContact' => 'آخر اتصال',
'LastOrder' => 'آخر طلب',
'LeasingFee' => '',
'Log' => 'سجل',
'Logs' => 'السجلات',
'LostCustomers' => '#VALUE!',
'MRR' => 'مرر',
'MTDSales' => 'مبيعات MTD',
'Make' => '',
'Margin' => 'هامش',
'Messages' => 'رسائل',
'Milage' => '',
'Model' => '',
'Modified' => 'تم التعديل',
'Modules' => 'وحدات',
'Name' => 'اسم',
'Name1' => 'اسم 1.',
'Name2' => 'اسم 2.',
'Name3' => 'اسم 3.',
'Net' => 'شبكة',
'NewCustomers' => '#VALUE!',
'Notes' => 'ملحوظات',
'Number' => 'عدد',
'Office' => 'مكتب. مقر. مركز',
'Other' => '#VALUE!',
'Payment' => 'دفع',
'PaymentTerm' => 'مصطلح الدفع',
'Permission' => 'إذن',
'Phone' => 'هاتف',
'Postal' => 'بريدي',
'Price' => 'السعر',
'Prices' => 'الأسعار.',
'Private' => 'نشر',
'Productgroup' => 'productgroup.',
'Profile' => 'الملف الشخصي',
'Profit' => '#VALUE!',
'Purchase' => 'شراء',
'PurchasePrice' => '',
'Quantity' => 'كمية',
'RecentInvoices' => 'الفواتير الأخيرة',
'Region' => '#VALUE!',
'Rep' => '#VALUE!',
'Responsible' => '',
'Retention' => '#VALUE!',
'Sales' => 'مبيعات',
'Segment' => 'قطعة',
'Segments' => 'شرائح',
'Start' => '',
'Status' => '',
'Subtype' => 'النوع الفرعي',
'Support' => 'يدعم',
'Tags' => 'كذا',
'Title' => '#VALUE!',
'To' => '',
'Total' => '#VALUE!',
'TotalPrice' => '#VALUE!',
'Type' => 'نوع',
'UnitPrice' => '#VALUE!',
'Upcoming' => '',
'VIN' => '',
'Value' => '#VALUE!',
'Vehicle' => '',
'Vehicles' => '',
'Vin' => '',
'Website' => 'موقع إلكتروني',
'Wire' => 'الأسلاك',
'YTDSales' => 'مبيعات YTD',
'Zip' => 'أزيز',
]];

152
Theme/Backend/Lang/cs.lang.php Executable file
View File

@ -0,0 +1,152 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['FleetManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Accounting' => 'Účetnictví',
'Addition' => 'Přidání',
'Address' => 'Adresa',
'Addresses' => 'Adresy',
'Africa' => '#VALUE!',
'AllCustomers' => '#VALUE!',
'America' => '#VALUE!',
'Analyse' => '#VALUE!',
'AreaManager' => 'Oblastní manažer',
'Articlegroup' => 'Článek',
'Articles' => 'Články',
'Asia' => '#VALUE!',
'Attribute' => '#VALUE!',
'Attributes' => '#VALUE!',
'Balance' => 'Zůstatek',
'BaseTime' => '#VALUE!',
'Bills' => '#VALUE!',
'Bonus' => 'Bonus',
'Business' => 'Business.',
'CIS' => '#VALUE!',
'CLV' => 'Clv.',
'Calendar' => 'Kalendář',
'City' => 'Město',
'Client' => 'Klienta',
'ClientID' => '#VALUE!',
'Clients' => 'Klienti',
'ComparisonTime' => '#VALUE!',
'Contact' => 'Kontakt',
'Costs' => '',
'Country' => 'Země',
'Created' => 'Vytvořený',
'CreatedAt' => '#VALUE!',
'CreditRating' => 'Úvěrový rating',
'Creditcard' => 'Kreditní karta',
'Customers' => '#VALUE!',
'DSO' => 'DSO.',
'Date' => 'datum',
'Default' => 'Výchozí hodnota',
'Delivery' => 'dodávka',
'Description' => '',
'Discount' => 'Sleva',
'DiscountBonus' => '#VALUE!',
'DiscountP' => 'Sleva%',
'Documents' => 'Dokumenty',
'Driver' => '',
'Drivers' => '',
'Due' => 'Způsoben',
'Email' => 'E-mailem',
'End' => '',
'Europe' => '#VALUE!',
'Fax' => 'Fax',
'Files' => 'Soubory',
'Filter' => 'Filtr',
'Freightage' => 'Dopravné',
'From' => '',
'Group' => 'Skupina',
'History' => '',
'ID' => 'ID.',
'Info' => 'Info.',
'Inspections' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Faktury',
'IsDefault' => 'Je výchozí?',
'Items' => '#VALUE!',
'LastContact' => 'Poslední kontakt',
'LastOrder' => 'Poslední objednávka',
'LeasingFee' => '',
'Log' => 'Log',
'Logs' => 'Protokoly',
'LostCustomers' => '#VALUE!',
'MRR' => 'Mrr.',
'MTDSales' => 'Prodej MTD.',
'Make' => '',
'Margin' => 'Okraj',
'Messages' => 'Zprávy',
'Milage' => '',
'Model' => '',
'Modified' => 'Upravený',
'Modules' => 'Moduly',
'Name' => 'název',
'Name1' => 'Jméno1.',
'Name2' => 'Jméno2.',
'Name3' => 'Jméno3.',
'Net' => 'Síť',
'NewCustomers' => '#VALUE!',
'Notes' => 'Poznámky',
'Number' => 'Číslo',
'Office' => 'Kancelář',
'Other' => '#VALUE!',
'Payment' => 'Způsob platby',
'PaymentTerm' => 'Platební termín',
'Permission' => 'Povolení',
'Phone' => 'Telefon',
'Postal' => 'Poštovní',
'Price' => 'Cena',
'Prices' => 'Ceny',
'Private' => 'Soukromý',
'Productgroup' => 'ProductSgroup.',
'Profile' => 'Profil',
'Profit' => '#VALUE!',
'Purchase' => 'Nákup',
'PurchasePrice' => '',
'Quantity' => 'Množství',
'RecentInvoices' => 'Nedávné faktury',
'Region' => '#VALUE!',
'Rep' => '#VALUE!',
'Responsible' => '',
'Retention' => '#VALUE!',
'Sales' => 'Odbyt',
'Segment' => 'Segment',
'Segments' => 'Segmenty',
'Start' => '',
'Status' => '',
'Subtype' => 'Podtyp',
'Support' => 'Podpěra, podpora',
'Tags' => 'Tagy',
'Title' => '#VALUE!',
'To' => '',
'Total' => '#VALUE!',
'TotalPrice' => '#VALUE!',
'Type' => 'Typ',
'UnitPrice' => '#VALUE!',
'Upcoming' => '',
'VIN' => '',
'Value' => '#VALUE!',
'Vehicle' => '',
'Vehicles' => '',
'Vin' => '',
'Website' => 'webová stránka',
'Wire' => 'Drát',
'YTDSales' => 'Prodej YTD.',
'Zip' => 'Zip',
]];

152
Theme/Backend/Lang/da.lang.php Executable file
View File

@ -0,0 +1,152 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['FleetManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Accounting' => 'Regnskab',
'Addition' => 'Tilsætning',
'Address' => 'Adresse',
'Addresses' => 'Adresser',
'Africa' => '#VALUE!',
'AllCustomers' => '#VALUE!',
'America' => '#VALUE!',
'Analyse' => '#VALUE!',
'AreaManager' => 'Områdechef',
'Articlegroup' => 'ArticleGroup.',
'Articles' => 'Artikler',
'Asia' => '#VALUE!',
'Attribute' => '#VALUE!',
'Attributes' => '#VALUE!',
'Balance' => 'Balance',
'BaseTime' => '#VALUE!',
'Bills' => '#VALUE!',
'Bonus' => 'Bonus',
'Business' => 'Forretning',
'CIS' => '#VALUE!',
'CLV' => 'CLV.',
'Calendar' => 'Kalender',
'City' => 'City.',
'Client' => 'Klient',
'ClientID' => '#VALUE!',
'Clients' => 'Klienter.',
'ComparisonTime' => '#VALUE!',
'Contact' => 'Kontakt',
'Costs' => '',
'Country' => 'Land',
'Created' => 'Oprettet',
'CreatedAt' => '#VALUE!',
'CreditRating' => 'Kreditvurdering',
'Creditcard' => 'Kreditkort',
'Customers' => '#VALUE!',
'DSO' => 'DSO.',
'Date' => 'Dato',
'Default' => 'Standard',
'Delivery' => 'Levering',
'Description' => '',
'Discount' => 'Rabat',
'DiscountBonus' => '#VALUE!',
'DiscountP' => 'Rabat%',
'Documents' => 'Dokumenter',
'Driver' => '',
'Drivers' => '',
'Due' => 'På grund',
'Email' => 'Email.',
'End' => '',
'Europe' => '#VALUE!',
'Fax' => 'Fax',
'Files' => 'Filer.',
'Filter' => 'Filter',
'Freightage' => 'Gods',
'From' => '',
'Group' => 'Gruppe',
'History' => '',
'ID' => 'ID.',
'Info' => 'Info.',
'Inspections' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Fakturaer.',
'IsDefault' => 'Er standard?',
'Items' => '#VALUE!',
'LastContact' => 'Sidste kontakt',
'LastOrder' => 'Sidste ordre',
'LeasingFee' => '',
'Log' => 'Log',
'Logs' => 'Logs.',
'LostCustomers' => '#VALUE!',
'MRR' => 'MRR.',
'MTDSales' => 'MTD Sales.',
'Make' => '',
'Margin' => 'Margin.',
'Messages' => 'Beskeder',
'Milage' => '',
'Model' => '',
'Modified' => 'Modificeret',
'Modules' => 'Moduler.',
'Name' => 'Navn',
'Name1' => 'NAME1.',
'Name2' => 'NAME2.',
'Name3' => 'NAME3.',
'Net' => 'Net',
'NewCustomers' => '#VALUE!',
'Notes' => 'Noter.',
'Number' => 'Nummer',
'Office' => 'Kontor',
'Other' => '#VALUE!',
'Payment' => 'Betaling',
'PaymentTerm' => 'Betalingsbetingelser',
'Permission' => 'Tilladelse',
'Phone' => 'telefon',
'Postal' => 'Postal.',
'Price' => 'Pris',
'Prices' => 'Priser.',
'Private' => 'Privat',
'Productgroup' => 'Produktgruppe',
'Profile' => 'Profil',
'Profit' => '#VALUE!',
'Purchase' => 'Køb',
'PurchasePrice' => '',
'Quantity' => 'Antal',
'RecentInvoices' => 'Nylige fakturaer.',
'Region' => '#VALUE!',
'Rep' => '#VALUE!',
'Responsible' => '',
'Retention' => '#VALUE!',
'Sales' => 'SALG',
'Segment' => 'Segment',
'Segments' => 'Segmenter.',
'Start' => '',
'Status' => '',
'Subtype' => 'Subtype.',
'Support' => 'Support',
'Tags' => 'Tags.',
'Title' => '#VALUE!',
'To' => '',
'Total' => '#VALUE!',
'TotalPrice' => '#VALUE!',
'Type' => 'Type',
'UnitPrice' => '#VALUE!',
'Upcoming' => '',
'VIN' => '',
'Value' => '#VALUE!',
'Vehicle' => '',
'Vehicles' => '',
'Vin' => '',
'Website' => 'Internet side',
'Wire' => 'Tråd',
'YTDSales' => 'YTD SALG',
'Zip' => 'Zip.',
]];

Some files were not shown because too many files have changed in this diff Show More