continue impl.

This commit is contained in:
Dennis Eichhorn 2023-06-28 12:17:38 +00:00
parent 9cd68d4459
commit b615a3bcb0
10 changed files with 143 additions and 29 deletions

View File

@ -5,7 +5,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Investments", "name": "Investments",
"uri": "{/base}finance/investment/list?{?}", "uri": "{/base}/finance/investment/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -18,8 +18,8 @@
"pid": "/finance/investment", "pid": "/finance/investment",
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Dashboard", "name": "List",
"uri": "{/base}finance/investment/list?{?}", "uri": "{/base}/finance/investment/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -27,6 +27,21 @@
"permission": { "permission": 2, "type": null, "element": null }, "permission": { "permission": 2, "type": null, "element": null },
"parent": 1007101001, "parent": 1007101001,
"children": [] "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": "/", "pid": "/",
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "PurchaseInquiries", "name": "InvestmentInquiries",
"uri": "{/base}/private/investment/list?{?}", "uri": "{/base}/private/investment/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,

View File

@ -75,6 +75,8 @@
"investmgmt_investment_type": { "investmgmt_investment_type": {
"name": "investmgmt_investment_type", "name": "investmgmt_investment_type",
"type": "INT", "type": "INT",
"null": true,
"default": null,
"foreignTable": "investmgmt_investment_type", "foreignTable": "investmgmt_investment_type",
"foreignKey": "investmgmt_investment_type_id" "foreignKey": "investmgmt_investment_type_id"
}, },

View File

@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb; use phpOMS\Router\RouteVerb;
return [ return [
'^.*/controlling/investment/list.*$' => [ '^.*/finance/investment/list.*$' => [
[ [
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentList', 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentList',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -17,7 +17,7 @@ return [
], ],
], ],
], ],
'^.*/controlling/investment/single.*$' => [ '^.*/finance/investment/single.*$' => [
[ [
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentSingle', 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentSingle',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,
@ -28,7 +28,7 @@ return [
], ],
], ],
], ],
'^.*/controlling/investment/create.*$' => [ '^.*/finance/investment/create.*$' => [
[ [
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentCreate', 'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentCreate',
'verb' => RouteVerb::GET, 'verb' => RouteVerb::GET,

View File

@ -108,7 +108,7 @@ final class ApiController extends Controller
$investment->name = $request->getDataString('name') ?? ''; $investment->name = $request->getDataString('name') ?? '';
$investment->description = $request->getDataString('description') ?? ''; $investment->description = $request->getDataString('description') ?? '';
$investment->status = (int) ($request->getDataInt('status') ?? InvestmentStatus::DRAFT); $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->description = $request->getDataString('description') ?? '';
$investment->unit = $request->getDataInt('unit') ?? $this->app->unitId; $investment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
$investment->createdBy = new NullAccount($request->header->account); $investment->createdBy = new NullAccount($request->header->account);

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Modules\InvestmentManagement\Controller; namespace Modules\InvestmentManagement\Controller;
use Modules\InvestmentManagement\Models\InvestmentMapper;
use phpOMS\Contract\RenderableInterface; use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract; use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract; use phpOMS\Message\ResponseAbstract;
@ -45,7 +46,14 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-list'); $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; return $view;
} }
@ -66,7 +74,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-create'); $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; return $view;
} }
@ -87,7 +95,7 @@ final class BackendController extends Controller
{ {
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-create'); $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; return $view;
} }

View File

@ -39,7 +39,7 @@ class Investment
public int $status = InvestmentStatus::DRAFT; public int $status = InvestmentStatus::DRAFT;
public BaseStringL11nType $type; public ?BaseStringL11nType $type = null;
public array $options = []; public array $options = [];
@ -68,7 +68,6 @@ class Investment
$this->createdBy = new NullAccount(); $this->createdBy = new NullAccount();
$this->createdAt = new \DateTimeImmutable('now'); $this->createdAt = new \DateTimeImmutable('now');
$this->performanceDate = new \DateTime('now'); $this->performanceDate = new \DateTime('now');
$this->type = new BaseStringL11nType();
} }
use \Modules\Media\Models\MediaListTrait; use \Modules\Media\Models\MediaListTrait;

View File

@ -13,6 +13,6 @@
declare(strict_types=1); declare(strict_types=1);
return ['Navigation' => [ return ['Navigation' => [
'PurchaseInquiries' => 'Purchase Inquiries', 'InvestmentInquiries' => 'Investment Inquiries',
'Investments' => 'Investments', 'Investments' => 'Investments',
]]; ]];

View File

@ -13,4 +13,10 @@
declare(strict_types=1); declare(strict_types=1);
return ['InvestmentManagement' => [ return ['InvestmentManagement' => [
'Investment' => 'Investment',
'Investments' => 'Investments',
':status1' => 'Draft',
':status2' => 'Open',
':status3' => 'Approved',
':status4' => 'Denied',
]]; ]];

View File

@ -1,15 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\HumanResourceTimeRecording
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
echo $this->data['nav']->render();

View File

@ -0,0 +1,99 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\HumanResourceTimeRecording
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://orange-management.org
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$investments = $this->data['investments'] ?? [];
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Investments'); ?><i class="lni lni-download download btn end-xs"></i></div>
<div class="slider">
<table id="iSalesClientList" class="default sticky">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="iSalesClientList-sort-1">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-2">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-2">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Status'); ?>
<label for="iSalesClientList-sort-3">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-4">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-4">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesClientList-sort-5">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-6">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Creator'); ?>
<label for="iSalesClientList-sort-7">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesClientList-sort-8">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-8">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php
$count = 0;
foreach ($investments as $key => $value) :
++$count;
$url = UriFactory::build('{/base}/finance/investment/profile?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->id); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><?= $this->getHtml(':status' . $value->status); ?></a>
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $value->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->createdBy->name1, $value->createdBy->name2, $value->createdBy->name3, $value->createdBy->login ?? ''])); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>