diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json
index 3bbb810..0c88dfe 100755
--- a/Admin/Install/Navigation.install.json
+++ b/Admin/Install/Navigation.install.json
@@ -93,7 +93,7 @@
"pid": "/equipment/inspection",
"type": 3,
"subtype": 1,
- "name": "EquipmentInspectionTypes",
+ "name": "InspectionTypes",
"uri": "{/base}/equipment/inspection/type/list?{?}",
"target": "self",
"icon": null,
@@ -110,7 +110,7 @@
"pid": "/",
"type": 2,
"subtype": 1,
- "name": "EquipmentAttributes",
+ "name": "Attributes",
"uri": "{/base}/equipment/attribute/type/list?{?}",
"target": "self",
"icon": null,
diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php
index 8d0e16b..0b42472 100755
--- a/Admin/Routes/Web/Api.php
+++ b/Admin/Routes/Web/Api.php
@@ -22,6 +22,7 @@ return [
[
'dest' => '\Modules\EquipmentManagement\Controller\ApiController:apiEquipmentFind',
'verb' => RouteVerb::GET,
+ 'csrf' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
@@ -34,6 +35,7 @@ return [
[
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentAttributeController:apiEquipmentAttributeCreate',
'verb' => RouteVerb::PUT,
+ 'csrf' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
@@ -43,6 +45,7 @@ return [
[
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentAttributeController:apiEquipmentAttributeUpdate',
'verb' => RouteVerb::SET,
+ 'csrf' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
@@ -55,6 +58,7 @@ return [
[
'dest' => '\Modules\EquipmentManagement\Controller\ApiController:apiNoteCreate',
'verb' => RouteVerb::PUT,
+ 'csrf' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
@@ -64,6 +68,7 @@ return [
[
'dest' => '\Modules\EquipmentManagement\Controller\ApiController:apiNoteUpdate',
'verb' => RouteVerb::SET,
+ 'csrf' => true,
'permission' => [
'module' => Controller::NAME,
'type' => PermissionType::READ,
diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php
index 75c50ca..7fc72c1 100755
--- a/Admin/Routes/Web/Backend.php
+++ b/Admin/Routes/Web/Backend.php
@@ -25,18 +25,51 @@ return [
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
- 'state' => PermissionCategory::EQUIPMENT,
+ 'state' => PermissionCategory::ATTRIBUTE,
],
],
],
- '^.*/equipment/attribute/type(\?.*$|$)' => [
+ '^.*/equipment/attribute/type/view(\?.*$|$)' => [
[
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeType',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
- 'state' => PermissionCategory::EQUIPMENT,
+ 'state' => PermissionCategory::ATTRIBUTE,
+ ],
+ ],
+ ],
+ '^.*/equipment/attribute/type/create(\?.*$|$)' => [
+ [
+ 'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeTypeCreate',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::CREATE,
+ 'state' => PermissionCategory::ATTRIBUTE,
+ ],
+ ],
+ ],
+ '^.*/equipment/attribute/value/view(\?.*$|$)' => [
+ [
+ 'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeValue',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::READ,
+ 'state' => PermissionCategory::ATTRIBUTE,
+ ],
+ ],
+ ],
+ '^.*/equipment/attribute/value/create(\?.*$|$)' => [
+ [
+ 'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeValueCreate',
+ 'verb' => RouteVerb::GET,
+ 'permission' => [
+ 'module' => BackendController::NAME,
+ 'type' => PermissionType::CREATE,
+ 'state' => PermissionCategory::ATTRIBUTE,
],
],
],
diff --git a/Controller/BackendController.php b/Controller/BackendController.php
index c99bddc..64be6ef 100755
--- a/Controller/BackendController.php
+++ b/Controller/BackendController.php
@@ -16,6 +16,8 @@ namespace Modules\EquipmentManagement\Controller;
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeL11nMapper;
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeMapper;
+use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeValueL11nMapper;
+use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeValueMapper;
use Modules\EquipmentManagement\Models\EquipmentMapper;
use Modules\EquipmentManagement\Models\EquipmentTypeMapper;
use Modules\EquipmentManagement\Models\InspectionMapper;
@@ -54,17 +56,15 @@ final class BackendController extends Controller
*/
public function viewEquipmentManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
- $view = new View($this->app->l11nManager, $request, $response);
- $view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/attribute-type-list');
+ $view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008405001, $request, $response);
- /** @var \Modules\Attribute\Models\AttributeType[] $attributes */
- $attributes = EquipmentAttributeTypeMapper::getAll()
+ $view->attributes = EquipmentAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
- $view->data['attributes'] = $attributes;
+ $view->path = 'equipment';
return $view;
}
@@ -114,23 +114,55 @@ final class BackendController extends Controller
*/
public function viewEquipmentManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
- $view = new View($this->app->l11nManager, $request, $response);
- $view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/attribute-type');
- $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
+ $view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
+ $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008405001, $request, $response);
- /** @var \Modules\Attribute\Models\AttributeType $attribute */
- $attribute = EquipmentAttributeTypeMapper::get()
+ $view->attribute = EquipmentAttributeTypeMapper::get()
->with('l11n')
+ ->with('defaults')
+ ->with('defaults/l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
+ ->where('defaults/l11n/language', [$response->header->l11n->language, null])
->execute();
- $l11ns = EquipmentAttributeTypeL11nMapper::getAll()
- ->where('ref', $attribute->id)
+ $view->l11ns = EquipmentAttributeTypeL11nMapper::getAll()
+ ->where('ref', $view->attribute->id)
->execute();
- $view->data['attribute'] = $attribute;
- $view->data['l11ns'] = $l11ns;
+ $view->path = 'fleet/vehicle';
+
+ return $view;
+ }
+
+ /**
+ * Routing end-point for application behavior.
+ *
+ * @param RequestAbstract $request Request
+ * @param ResponseAbstract $response Response
+ * @param array $data Generic data
+ *
+ * @return RenderableInterface
+ *
+ * @since 1.0.0
+ * @codeCoverageIgnore
+ */
+ public function viewEquipmentManagementAttributeValue(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
+ {
+ $view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
+ $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008405001, $request, $response);
+
+ $view->attribute = EquipmentAttributeValueMapper::get()
+ ->with('l11n')
+ ->where('id', (int) $request->getData('id'))
+ ->where('l11n/language', [$response->header->l11n->language, null])
+ ->execute();
+
+ $view->l11ns = EquipmentAttributeValueL11nMapper::getAll()
+ ->where('ref', $view->attribute->id)
+ ->execute();
+
+ // @todo Also find the ItemAttributeType
return $view;
}
@@ -275,13 +307,11 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/inspection-list');
- $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008401001, $request, $response);
+ $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008404001, $request, $response);
- $list = InspectionMapper::getAll()
+ $view->data['inspections'] = InspectionMapper::getAll()
->sort('id', 'DESC')
- ->execute();
-
- $view->data['inspections'] = $list;
+ ->executeGetArray();
return $view;
}
diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php
index b59eb82..a3c3ab9 100755
--- a/Models/PermissionCategory.php
+++ b/Models/PermissionCategory.php
@@ -37,4 +37,6 @@ abstract class PermissionCategory extends Enum
public const EQUIPMENT_ATTRIBUTE_TYPE = 6;
public const EQUIPMENT_NOTE = 7;
+
+ public const ATTRIBUTE = 8;
}
diff --git a/Theme/Backend/Lang/Navigation.de.lang.php b/Theme/Backend/Lang/Navigation.de.lang.php
index a860634..0e6fe28 100755
--- a/Theme/Backend/Lang/Navigation.de.lang.php
+++ b/Theme/Backend/Lang/Navigation.de.lang.php
@@ -13,8 +13,8 @@
declare(strict_types=1);
return ['Navigation' => [
- 'EquipmentAttributes' => 'Equipment Attribute',
- 'EquipmentInspectionTypes' => 'Equipment Inspektionstypen',
+ 'Attributes' => 'Attribute',
+ 'InspectionTypes' => 'Inspektionsarten',
'EquipmentManagement' => 'Equipment Management',
'Equipments' => 'Equipments',
'Inspections' => 'Inspektionen',
diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php
index 744492a..f89701e 100755
--- a/Theme/Backend/Lang/Navigation.en.lang.php
+++ b/Theme/Backend/Lang/Navigation.en.lang.php
@@ -13,8 +13,8 @@
declare(strict_types=1);
return ['Navigation' => [
- 'EquipmentAttributes' => 'Equipment Attributes',
- 'EquipmentInspectionTypes' => 'Equipment Inspection Types',
+ 'Attributes' => 'Attributes',
+ 'InspectionTypes' => 'Inspection Types',
'EquipmentManagement' => 'Equipment Management',
'Equipments' => 'Equipments',
'Inspections' => 'Inspections',
diff --git a/Theme/Backend/attribute-type-list.tpl.php b/Theme/Backend/attribute-type-list.tpl.php
deleted file mode 100755
index df572e2..0000000
--- a/Theme/Backend/attribute-type-list.tpl.php
+++ /dev/null
@@ -1,71 +0,0 @@
-data['attributes'];
-
-echo $this->data['nav']->render(); ?>
-
-
-
-
- = $this->getHtml('AttributeTypes', 'Attribute', 'Backend'); ?>download
-
-
-
-
diff --git a/Theme/Backend/attribute-type.tpl.php b/Theme/Backend/attribute-type.tpl.php
deleted file mode 100755
index c6c3533..0000000
--- a/Theme/Backend/attribute-type.tpl.php
+++ /dev/null
@@ -1,98 +0,0 @@
-data['attribute'];
-$l11ns = $this->data['l11ns'];
-
-echo $this->data['nav']->render(); ?>
-
-
-
-
- = $this->getHtml('Attribute', 'Attribute', 'Backend'); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
= $this->getHtml('Language', '0', '0'); ?>download
-
-
-
- |
- |
- | = $this->getHtml('Language', '0', '0'); ?>
- | = $this->getHtml('Title', 'Attribute', 'Backend'); ?>
- |
- $value) : ++$c; ?>
-
- | close
- | settings
- | = ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
- | = $value->content; ?>
-
-
- |
| = $this->getHtml('Empty', '0', '0'); ?>
-
- |
-
-
-
diff --git a/Theme/Backend/equipment-list.tpl.php b/Theme/Backend/equipment-list.tpl.php
index 97beafa..300da95 100755
--- a/Theme/Backend/equipment-list.tpl.php
+++ b/Theme/Backend/equipment-list.tpl.php
@@ -85,7 +85,7 @@ echo $this->data['nav']->render(); ?>
?>
|
- | = $this->printHtml((string) $value->id); ?>
+ | = $value->id; ?>
| = $this->getHtml(':status' . $value->status); ?>
| = $this->printHtml($value->name); ?>
| = $this->printHtml($value->type->getL11n()); ?>
diff --git a/Theme/Backend/equipment-view.tpl.php b/Theme/Backend/equipment-view.tpl.php
index e6567a6..ace2d6c 100755
--- a/Theme/Backend/equipment-view.tpl.php
+++ b/Theme/Backend/equipment-view.tpl.php
@@ -136,7 +136,7 @@ echo $this->data['nav']->render();
$equipment->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
- '{/api}fleet/equipment/attribute',
+ '{/api}fleet/equipment/attribute?csrf={$CSRF}',
$equipment->id
);
?>
diff --git a/Theme/Backend/inspection-list.tpl.php b/Theme/Backend/inspection-list.tpl.php
index ceb8b89..1eb571e 100755
--- a/Theme/Backend/inspection-list.tpl.php
+++ b/Theme/Backend/inspection-list.tpl.php
@@ -13,3 +13,67 @@
declare(strict_types=1);
echo $this->data['nav']->render();
+?>
+
+
+
+
+ = $this->getHtml('Upcoming'); ?>
+
+
+
+ | = $this->getHtml('Date'); ?>
+ | = $this->getHtml('Type'); ?>
+ | = $this->getHtml('Responsible'); ?>
+ |
+ data['inspections'] ?? []) as $inspection) :
+ // @todo handle old inspections in the past? maybe use a status?!
+ if ($inspection->next === null) {
+ continue;
+ }
+
+ ++$count;
+ ?>
+
+ | = $inspection->next->format('Y-m-d H:i'); ?>
+ | = $this->printHtml($inspection->type->getL11n()); ?>
+ |
+
+
+ | | = $this->getHtml('Empty', '0', '0'); ?>
+
+ |
+
+
+
+
+
+
+
+ = $this->getHtml('History'); ?>
+
+
+
+ | = $this->getHtml('Date'); ?>
+ | = $this->getHtml('Type'); ?>
+ | = $this->getHtml('Responsible'); ?>
+ |
+ data['inspections'] ?? []) as $inspection) :
+ ++$count;
+ ?>
+
+ | = $inspection->date->format('Y-m-d H:i'); ?>
+ | = $this->printHtml($inspection->type->getL11n()); ?>
+ |
+
+
+ | | = $this->getHtml('Empty', '0', '0'); ?>
+
+ |
+
+
+
|