diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json index 0de0c69..3dde405 100755 --- a/Admin/Install/Navigation.install.json +++ b/Admin/Install/Navigation.install.json @@ -5,7 +5,7 @@ "type": 2, "subtype": 1, "name": "Investments", - "uri": "{/base}finance/investment/list?{?}", + "uri": "{/base}/finance/investment/list?{?}", "target": "self", "icon": null, "order": 1, @@ -18,8 +18,8 @@ "pid": "/finance/investment", "type": 3, "subtype": 1, - "name": "Dashboard", - "uri": "{/base}finance/investment/list?{?}", + "name": "List", + "uri": "{/base}/finance/investment/list?{?}", "target": "self", "icon": null, "order": 1, @@ -27,6 +27,21 @@ "permission": { "permission": 2, "type": null, "element": null }, "parent": 1007101001, "children": [] + }, + { + "id": 1007102002, + "pid": "/finance/investment", + "type": 3, + "subtype": 1, + "name": "Create", + "uri": "{/base}/finance/investment/create?{?}", + "target": "self", + "icon": null, + "order": 5, + "from": "InvestmentManagement", + "permission": { "permission": 2, "type": null, "element": null }, + "parent": 1007101001, + "children": [] } ] }, @@ -35,7 +50,7 @@ "pid": "/", "type": 2, "subtype": 1, - "name": "PurchaseInquiries", + "name": "InvestmentInquiries", "uri": "{/base}/private/investment/list?{?}", "target": "self", "icon": null, diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 71a510a..a4a8174 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -75,6 +75,8 @@ "investmgmt_investment_type": { "name": "investmgmt_investment_type", "type": "INT", + "null": true, + "default": null, "foreignTable": "investmgmt_investment_type", "foreignKey": "investmgmt_investment_type_id" }, diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php index eb26dc9..af696f0 100755 --- a/Admin/Routes/Web/Backend.php +++ b/Admin/Routes/Web/Backend.php @@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType; use phpOMS\Router\RouteVerb; return [ - '^.*/controlling/investment/list.*$' => [ + '^.*/finance/investment/list.*$' => [ [ 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentList', 'verb' => RouteVerb::GET, @@ -17,7 +17,7 @@ return [ ], ], ], - '^.*/controlling/investment/single.*$' => [ + '^.*/finance/investment/single.*$' => [ [ 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentSingle', 'verb' => RouteVerb::GET, @@ -28,7 +28,7 @@ return [ ], ], ], - '^.*/controlling/investment/create.*$' => [ + '^.*/finance/investment/create.*$' => [ [ 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentCreate', 'verb' => RouteVerb::GET, diff --git a/Controller/ApiController.php b/Controller/ApiController.php index c3b510c..a61043a 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -108,7 +108,7 @@ final class ApiController extends Controller $investment->name = $request->getDataString('name') ?? ''; $investment->description = $request->getDataString('description') ?? ''; $investment->status = (int) ($request->getDataInt('status') ?? InvestmentStatus::DRAFT); - $investment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); + //$investment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); $investment->description = $request->getDataString('description') ?? ''; $investment->unit = $request->getDataInt('unit') ?? $this->app->unitId; $investment->createdBy = new NullAccount($request->header->account); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index ab5322f..e209ead 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -14,6 +14,7 @@ declare(strict_types=1); namespace Modules\InvestmentManagement\Controller; +use Modules\InvestmentManagement\Models\InvestmentMapper; use phpOMS\Contract\RenderableInterface; use phpOMS\Message\RequestAbstract; use phpOMS\Message\ResponseAbstract; @@ -45,7 +46,14 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-list'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004601001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); + + $list = InvestmentMapper::getAll() + ->with('createdBy') + ->sort('id', 'DESC') + ->execute(); + + $view->data['investments'] = $list; return $view; } @@ -66,7 +74,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-create'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004601001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); return $view; } @@ -87,7 +95,7 @@ final class BackendController extends Controller { $view = new View($this->app->l11nManager, $request, $response); $view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-create'); - $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004601001, $request, $response); + $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response); return $view; } diff --git a/Models/Investment.php b/Models/Investment.php index 0fd028a..fbee735 100644 --- a/Models/Investment.php +++ b/Models/Investment.php @@ -39,7 +39,7 @@ class Investment public int $status = InvestmentStatus::DRAFT; - public BaseStringL11nType $type; + public ?BaseStringL11nType $type = null; public array $options = []; @@ -68,7 +68,6 @@ class Investment $this->createdBy = new NullAccount(); $this->createdAt = new \DateTimeImmutable('now'); $this->performanceDate = new \DateTime('now'); - $this->type = new BaseStringL11nType(); } use \Modules\Media\Models\MediaListTrait; diff --git a/Theme/Backend/Lang/Navigation.en.lang.php b/Theme/Backend/Lang/Navigation.en.lang.php index 9b38377..1310c68 100755 --- a/Theme/Backend/Lang/Navigation.en.lang.php +++ b/Theme/Backend/Lang/Navigation.en.lang.php @@ -13,6 +13,6 @@ declare(strict_types=1); return ['Navigation' => [ - 'PurchaseInquiries' => 'Purchase Inquiries', + 'InvestmentInquiries' => 'Investment Inquiries', 'Investments' => 'Investments', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index b3e23a5..320a4f2 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -13,4 +13,10 @@ declare(strict_types=1); return ['InvestmentManagement' => [ + 'Investment' => 'Investment', + 'Investments' => 'Investments', + ':status1' => 'Draft', + ':status2' => 'Open', + ':status3' => 'Approved', + ':status4' => 'Denied', ]]; diff --git a/Theme/Backend/investment-dashboard.tpl.php b/Theme/Backend/investment-dashboard.tpl.php deleted file mode 100755 index 56f4289..0000000 --- a/Theme/Backend/investment-dashboard.tpl.php +++ /dev/null @@ -1,15 +0,0 @@ -data['nav']->render(); diff --git a/Theme/Backend/investment-list.tpl.php b/Theme/Backend/investment-list.tpl.php new file mode 100644 index 0000000..def1420 --- /dev/null +++ b/Theme/Backend/investment-list.tpl.php @@ -0,0 +1,99 @@ +data['investments'] ?? []; + +echo $this->data['nav']->render(); ?> +
+
+
+
getHtml('Investments'); ?>
+
+ + + + + $value) : + ++$count; + $url = UriFactory::build('{/base}/finance/investment/profile?{?}&id=' . $value->id); + ?> + +
+ getHtml('ID', '0', '0'); ?> + + + + getHtml('Status'); ?> + + + + getHtml('Name'); ?> + + + + getHtml('Creator'); ?> + + + +
+ printHtml((string) $value->id); ?> + getHtml(':status' . $value->status); ?> + printHtml($value->name); ?> + printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->createdBy->name1, $value->createdBy->name2, $value->createdBy->name3, $value->createdBy->login ?? ''])); ?> + + +
getHtml('Empty', '0', '0'); ?> + +
+
+
+
+