From 95b57f9acb0bd1128d17a68c9bde55b8b866f4c1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 29 Mar 2024 15:26:00 +0000 Subject: [PATCH] started with template fixes --- Admin/Install/Navigation.install.json | 2 +- Admin/Routes/Web/Api.php | 6 ++ Admin/Routes/Web/Backend.php | 77 ++++++++++++++++++++++++ Models/PermissionCategory.php | 2 + Theme/Backend/Lang/de.lang.php | 1 + Theme/Backend/Lang/en.lang.php | 1 + Theme/Backend/contract-list.tpl.php | 2 + Theme/Backend/contract-type-list.tpl.php | 6 +- Theme/Backend/contract-view.tpl.php | 2 +- 9 files changed, 96 insertions(+), 3 deletions(-) diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 6c98a52..f82abda 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -49,7 +49,7 @@ "type": 3, "subtype": 1, "name": "Attributes", - "uri": "{/base}/contract/attribute/list?{?}", + "uri": "{/base}/contract/attribute/type/list?{?}", "target": "self", "icon": null, "order": 1, diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php index ed73d1a..2f0927f 100644 --- a/Admin/Routes/Web/Api.php +++ b/Admin/Routes/Web/Api.php @@ -22,6 +22,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiContractTypeController:apiContractTypeCreate', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => Controller::NAME, 'type' => PermissionType::READ, @@ -31,6 +32,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiContractTypeController:apiContractTypeUpdate', 'verb' => RouteVerb::SET, + 'csrf' => true, 'permission' => [ 'module' => Controller::NAME, 'type' => PermissionType::READ, @@ -43,6 +45,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiController:apiContractCreate', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => Controller::NAME, 'type' => PermissionType::READ, @@ -52,6 +55,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiController:apiContractUpdate', 'verb' => RouteVerb::SET, + 'csrf' => true, 'permission' => [ 'module' => Controller::NAME, 'type' => PermissionType::READ, @@ -64,6 +68,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiAttributeController:apiContractAttributeCreate', 'verb' => RouteVerb::PUT, + 'csrf' => true, 'permission' => [ 'module' => Controller::NAME, 'type' => PermissionType::READ, @@ -73,6 +78,7 @@ return [ [ 'dest' => '\Modules\ContractManagement\Controller\ApiAttributeController:apiContractAttributeUpdate', '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 b83d696..28717a3 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -40,6 +40,17 @@ return [ ], ], ], + '^.*/contract/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractCreate', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::CONTRACT, + ], + ], + ], '^.*/contract/type/list(\?.*$|$)' => [ [ 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractTypeList', @@ -62,4 +73,70 @@ return [ ], ], ], + '^.*/contract/type/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractTypeCreate', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::CONTRACT_TYPE, + ], + ], + ], + '^.*/contract/attribute/type/list(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractManagementAttributeTypeList', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::ATTRIBUTE, + ], + ], + ], + '^.*/contract/attribute/type/view(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractManagementAttributeType', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::ATTRIBUTE, + ], + ], + ], + '^.*/contract/attribute/type/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractManagementAttributeTypeCreate', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::ATTRIBUTE, + ], + ], + ], + '^.*/contract/attribute/value/view(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractManagementAttributeValue', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::READ, + 'state' => PermissionCategory::ATTRIBUTE, + ], + ], + ], + '^.*/contract/attribute/value/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractManagementAttributeValueCreate', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::ATTRIBUTE, + ], + ], + ], ]; diff --git a/Models/PermissionCategory.php b/Models/PermissionCategory.php index fbd3e15..1a98194 100755 --- a/Models/PermissionCategory.php +++ b/Models/PermissionCategory.php @@ -31,4 +31,6 @@ abstract class PermissionCategory extends Enum public const CONTRACT_TYPE = 2; public const NOTE = 3; + + public const ATTRIBUTE = 4; } diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index ee600c7..3038944 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -30,4 +30,5 @@ return ['ContractManagement' => [ 'Type' => 'Typ', 'Unit' => 'Unit', 'With' => 'Mit', + 'ContractTypes' => 'Vertragsarten', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 4d3d659..b562737 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -30,4 +30,5 @@ return ['ContractManagement' => [ 'Type' => 'Type', 'Unit' => 'Unit', 'With' => 'With', + 'ContractTypes' => 'Contract Types', ]]; diff --git a/Theme/Backend/contract-list.tpl.php b/Theme/Backend/contract-list.tpl.php index a17c49e..a5d2010 100755 --- a/Theme/Backend/contract-list.tpl.php +++ b/Theme/Backend/contract-list.tpl.php @@ -99,10 +99,12 @@ echo $this->data['nav']->render(); ?> + diff --git a/Theme/Backend/contract-type-list.tpl.php b/Theme/Backend/contract-type-list.tpl.php index 2d94d95..0bdee36 100644 --- a/Theme/Backend/contract-type-list.tpl.php +++ b/Theme/Backend/contract-type-list.tpl.php @@ -22,7 +22,11 @@ echo $this->data['nav']->render(); ?>
-
getHtml('ContractTypes', 'Contract', 'Backend'); ?>download
+
+ getHtml('ContractTypes'); ?> + getHtml('New', '0', '0'); ?> + download +
diff --git a/Theme/Backend/contract-view.tpl.php b/Theme/Backend/contract-view.tpl.php index 669a746..8ca6bb9 100644 --- a/Theme/Backend/contract-view.tpl.php +++ b/Theme/Backend/contract-view.tpl.php @@ -131,7 +131,7 @@ echo $this->data['nav']->render(); ?> $contract->attributes, $this->data['attributeTypes'] ?? [], $this->data['units'] ?? [], - '{/api}contract/attribute', + '{/api}contract/attribute?csrf={$CSRF}', $contract->id ); ?>