diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 3dde405..8d24ce7 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -8,7 +8,7 @@ "uri": "{/base}/finance/investment/list?{?}", "target": "self", "icon": null, - "order": 1, + "order": 5, "from": "InvestmentManagement", "permission": { "permission": 2, "type": null, "element": null }, "parent": 1008101001, diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index ed067c9..99f43d7 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -28,24 +28,35 @@ return [ ], ], ], + '^.*/finance/investment/option/create(\?.*$|$)' => [ + [ + 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentOptionCreate', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::INVESTMENT, + ], + ], + ], + '^.*/finance/investment/option/view(\?.*$|$)' => [ + [ + 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentOptionView', + 'verb' => RouteVerb::GET, + 'permission' => [ + 'module' => BackendController::MODULE_NAME, + 'type' => PermissionType::CREATE, + 'state' => PermissionCategory::INVESTMENT, + ], + ], + ], '^.*/finance/investment/create(\?.*$|$)' => [ [ 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentCreate', 'verb' => RouteVerb::GET, 'permission' => [ 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::READ, - 'state' => PermissionCategory::INVESTMENT, - ], - ], - ], - '^.*/finance/investment/object(\?.*$|$)' => [ - [ - 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentObjectView', - 'verb' => RouteVerb::GET, - 'permission' => [ - 'module' => BackendController::MODULE_NAME, - 'type' => PermissionType::READ, + 'type' => PermissionType::CREATE, 'state' => PermissionCategory::INVESTMENT, ], ], diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 1a2e79a..19171d3 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -15,7 +15,6 @@ declare(strict_types=1); namespace Modules\InvestmentManagement\Controller; use Modules\InvestmentManagement\Models\InvestmentMapper; -use Modules\InvestmentManagement\Models\InvestmentObjectMapper; use Modules\InvestmentManagement\Models\InvestmentTypeMapper; use Modules\Organization\Models\UnitMapper; use phpOMS\Contract\RenderableInterface; @@ -24,7 +23,7 @@ use phpOMS\Message\ResponseAbstract; use phpOMS\Views\View; /** - * Investmenting controller class. + * Investment controller class. * * @package Modules\InvestmentManagement * @license OMS License 2.0 @@ -61,43 +60,6 @@ final class BackendController extends Controller 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 viewInvestmentObjectView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface - { - $view = new View($this->app->l11nManager, $request, $response); - $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-object-view'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); - - $object = InvestmentObjectMapper::get() - ->with('files') - ->with('notes') - ->with('amountGroups') - ->with('amountGroups/type') - ->with('amountGroups/amounts') - ->where('id', (int) $request->getData('id')) - ->execute(); - - $view->data['object'] = $object; - - $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); - $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer; - - $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); - - return $view; - } - /** * Routing end-point for application behavior. * @@ -180,4 +142,46 @@ final class BackendController extends Controller 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 viewInvestmentOptionCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-option-view'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); + + 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 viewInvestmentOptionView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app->l11nManager, $request, $response); + $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-option-view'); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); + + return $view; + } } diff --git a/Theme/Backend/investment-object-view.tpl.php b/Theme/Backend/investment-object-view.tpl.php deleted file mode 100644 index 213c7ec..0000000 --- a/Theme/Backend/investment-object-view.tpl.php +++ /dev/null @@ -1,67 +0,0 @@ -data['object'] ?? null; - -$attributeView = $this->data['attributeView']; -$languages = ISO639Enum::getConstants(); - -echo $this->data['nav']->render(); ?> -
-
- -
-
- request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>> -
-
- - request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>> -
-
- render( - $object->attributes, - $this->data['attributeTypes'] ?? [], - $this->data['units'] ?? [], - '{/api}finance/investment/object', - $object->id - ); - ?> -
-
- - request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>> -
-
- - request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>> -
- data['media-upload']->render('object-file', 'files', '', $object->files); ?> -
- - request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>> -
- data['note']->render('object-note', 'notes', $object->notes); ?> -
-
-
\ No newline at end of file diff --git a/Theme/Backend/investment-option-view.tpl.php b/Theme/Backend/investment-option-view.tpl.php new file mode 100644 index 0000000..1250c15 --- /dev/null +++ b/Theme/Backend/investment-option-view.tpl.php @@ -0,0 +1,123 @@ + +
+ getHtml('Back', '0', '0'); ?> +
+ +
+
+
+
getHtml('Option'); ?>
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + +
+ +
+ + + + + attributes as $attribute) : ?> + +
getHtml('Attributes'); ?> +
+ + attributes)) : ?> +
getHtml('Empty', '0', '0'); ?> + +
+
+ +
+ + + + + amountGroups as $group) : ?> + +
getHtml('Amounts'); ?> +
getCurrency($group->sum(), '', 'medium'); ?> + + files)) : ?> +
getHtml('Empty', '0', '0'); ?> + +
+
+ +
+ + + + + files as $file) : ?> + +
getHtml('Files'); ?> +
+ + files)) : ?> +
getHtml('Empty', '0', '0'); ?> + +
+
+ +
+ + + + + notes as $note) : ?> + +
getHtml('Notes'); ?> +
+ + notes)) : ?> +
getHtml('Empty', '0', '0'); ?> + +
+
+
+ +
+
+
\ No newline at end of file diff --git a/Theme/Backend/investment-view.tpl.php b/Theme/Backend/investment-view.tpl.php index 154a916..cc40d27 100644 --- a/Theme/Backend/investment-view.tpl.php +++ b/Theme/Backend/investment-view.tpl.php @@ -130,6 +130,10 @@ echo $this->data['nav']->render(); ?> request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
+
+ getHtml('Create', '0', '0'); ?> +
+
data['nav']->render(); ?>
- getHtml('Edit', '0', '0'); ?> + getHtml('Edit', '0', '0'); ?>