diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index f7beb18..ac80b4e 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -42,6 +42,21 @@ "permission": { "permission": 2, "category": null, "element": null }, "parent": 1007901001, "children": [] + }, + { + "id": 1007903001, + "pid": "/contract", + "type": 3, + "subtype": 1, + "name": "Attributes", + "uri": "{/base}/contract/attribute/list?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "Kanban", + "permission": { "permission": 2, "category": null, "element": null }, + "parent": 1007901001, + "children": [] } ] } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index c80d92e..650adec 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\ContractManagement\Controller; +use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeMapper; use Modules\ContractManagement\Models\ContractMapper; use Modules\ContractManagement\Models\ContractTypeMapper; use Modules\Organization\Models\UnitMapper; @@ -153,32 +154,40 @@ final class BackendController extends Controller $view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-view'); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response); - $contract = ContractMapper::get() + $view->data['contract'] = ContractMapper::get() ->with('account') + ->with('attributes') + ->with('attributes/type') + ->with('attributes/value') + ->with('attributes/type/l11n') ->with('files') ->with('notes') ->where('id', (int) $request->getData('id')) + ->where('attributes/type/l11n/language', $response->header->l11n->language) ->sort('files/id', 'DESC') ->execute(); - $view->data['contract'] = $contract; - - $contractTypes = ContractTypeMapper::getAll() + $view->data['contractTypes'] = ContractTypeMapper::getAll() ->with('l11n') ->where('l11n/language', $response->header->l11n->language) ->execute(); - $view->data['contractTypes'] = $contractTypes; - - $units = UnitMapper::getAll() + $view->data['units'] = UnitMapper::getAll() ->execute(); - $view->data['units'] = $units; + /** @var \Modules\Attribute\Models\AttributeType[] */ + $view->data['attributeTypes'] = ContractAttributeTypeMapper::getAll() + ->with('l11n') + ->where('l11n/language', $response->header->l11n->language) + ->execute(); $view->data['editor'] = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); $view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response); + $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); + $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer; + return $view; } } diff --git a/Models/Attribute/ContractAttributeMapper.php b/Models/Attribute/ContractAttributeMapper.php index 75c7281..21ae3e6 100644 --- a/Models/Attribute/ContractAttributeMapper.php +++ b/Models/Attribute/ContractAttributeMapper.php @@ -52,11 +52,11 @@ final class ContractAttributeMapper extends DataMapperFactory public const OWNS_ONE = [ 'type' => [ 'mapper' => ContractAttributeTypeMapper::class, - 'external' => 'contractmgmt_attr_type', + 'external' => 'contractmgmt_contract_attr_type', ], 'value' => [ 'mapper' => ContractAttributeValueMapper::class, - 'external' => 'contractmgmt_attr_value', + 'external' => 'contractmgmt_contract_attr_value', ], ]; diff --git a/Theme/Backend/Lang/Navigation.de.lang.php b/Theme/Backend/Lang/Navigation.de.lang.php index 7c87f9f..8220574 100755 --- a/Theme/Backend/Lang/Navigation.de.lang.php +++ b/Theme/Backend/Lang/Navigation.de.lang.php @@ -13,6 +13,7 @@ declare(strict_types=1); return ['Navigation' => [ + 'Attributes' => 'Attribute', 'Contract' => 'Vertrag', 'ContractTypes' => 'Vertragsarten', 'Contracts' => 'Verträge', diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 590c3a1..ec21d29 100755 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -13,6 +13,7 @@ declare(strict_types=1); return ['Navigation' => [ + 'Attributes' => 'Attributes', 'Contract' => 'Contract', 'ContractTypes' => 'Types', 'Contracts' => 'Contracts', diff --git a/Theme/Backend/contract-view.tpl.php b/Theme/Backend/contract-view.tpl.php index 1e3ad8a..d194834 100644 --- a/Theme/Backend/contract-view.tpl.php +++ b/Theme/Backend/contract-view.tpl.php @@ -26,6 +26,7 @@ echo $this->data['nav']->render(); ?>