This commit is contained in:
Dennis Eichhorn 2024-03-10 02:24:56 +00:00
parent bd948cc161
commit dc08ab1343
6 changed files with 195 additions and 120 deletions

View File

@ -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,

View File

@ -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,
],
],

View File

@ -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;
}
}

View File

@ -1,67 +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://jingga.app
*/
declare(strict_types=1);
use phpOMS\Localization\ISO639Enum;
/** @var \phpOMS\Views\View $this */
$object = $this->data['object'] ?? null;
$attributeView = $this->data['attributeView'];
$languages = ISO639Enum::getConstants();
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Object'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Attributes'); ?></label>
<li><label for="c-tab-3"><?= $this->getHtml('Amounts'); ?></label>
<li><label for="c-tab-4"><?= $this->getHtml('Files'); ?></label>
<li><label for="c-tab-5"><?= $this->getHtml('Notes'); ?></label>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
</div>
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<?= $attributeView->render(
$object->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}finance/investment/object',
$object->id
);
?>
</div>
</div>
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab">
</div>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab col-simple">
<?= $this->data['media-upload']->render('object-file', 'files', '', $object->files); ?>
</div>
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab col-simple">
<?= $this->data['note']->render('object-note', 'notes', $object->notes); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,123 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\HumanResourceTimeRecording
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\InvestmentManagement\Models\InvestmentStatus;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
?>
<div class="row">
<a class="button" href="<?= UriFactory::build('{/base}/finance/investment/view?id=' . $request->uri->getQuery('id')); ?>"><?= $this->getHtml('Back', '0', '0'); ?></a>
</div>
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Option'); ?> <?= $count; ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iObjectName-<?= $count; ?>"><?= $this->getHtml('Name'); ?></label>
<input type="text" id="iObjectName-<?= $count; ?>" name="name" value="<?= $this->printHtml($option->name); ?>">
</div>
<div class="form-group">
<label for="iObjectDescription-<?= $count; ?>"><?= $this->getHtml('Description'); ?></label>
<textarea id="iObjectDescription-<?= $count; ?>" name="description"><?= $this->printHtml($option->description); ?></textarea>
</div>
<div class="form-group">
<label for="iObjectLink-<?= $count; ?>"><?= $this->getHtml('Link'); ?></label>
<input type="text" id="iObjectLink-<?= $count; ?>" name="link" value="<?= $this->printHtml($option->link); ?>">
</div>
<div class="form-group">
<span class="checkbox">
<label class="checkbox" for="iApproved-<?= $count; ?>">
<input id="iApproved-<?= $count; ?>" type="checkbox" name="approved" value="1" disabled>
<span class="checkmark"></span>
<?= $this->getHtml('Approved'); ?>
</label>
</span>
</div>
<div class="form-group">
<table class="default">
<thead>
<tr>
<td><?= $this->getHtml('Attributes'); ?>
<tbody>
<?php foreach ($option->attributes as $attribute) : ?>
<tr>
<td>
<?php endforeach; ?>
<?php if (empty($option->attributes)) : ?>
<tr><td colspan="1" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
<div class="form-group">
<table class="default">
<thead>
<tr>
<td><?= $this->getHtml('Amounts'); ?>
<tbody>
<?php foreach ($option->amountGroups as $group) : ?>
<tr>
<td><?= $this->getCurrency($group->sum(), '', 'medium'); ?>
<?php endforeach; ?>
<?php if (empty($option->files)) : ?>
<tr><td colspan="1" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
<div class="form-group">
<table class="default">
<thead>
<tr>
<td><?= $this->getHtml('Files'); ?>
<tbody>
<?php foreach ($option->files as $file) : ?>
<tr>
<td>
<?php endforeach; ?>
<?php if (empty($option->files)) : ?>
<tr><td colspan="1" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
<div class="form-group">
<table class="default">
<thead>
<tr>
<td><?= $this->getHtml('Notes'); ?>
<tbody>
<?php foreach ($option->notes as $note) : ?>
<tr>
<td>
<?php endforeach; ?>
<?php if (empty($option->notes)) : ?>
<tr><td colspan="1" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
<div class="portlet-foot">
<a class="button edit" href="<?= UriFactory::build('{/base}/finance/investment/object?id=' . $option->id); ?>"><?= $this->getHtml('Edit', '0', '0'); ?></a>
</div>
</section>
</div>
</div>

View File

@ -130,6 +130,10 @@ echo $this->data['nav']->render(); ?>
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<a class="button" href="<?= UriFactory::build('{/base}/finance/investment/option/create?investment=' . $investment->id); ?>"><?= $this->getHtml('Create', '0', '0'); ?></a>
</div>
<div class="row">
<?php
$count = 0;
@ -234,7 +238,7 @@ echo $this->data['nav']->render(); ?>
</div>
</div>
<div class="portlet-foot">
<a class="button edit" href="<?= UriFactory::build('{/base}/finance/investment/object?id=' . $option->id); ?>"><?= $this->getHtml('Edit', '0', '0'); ?></a>
<a class="button edit" href="<?= UriFactory::build('{/base}/finance/investment/option/view?id=' . $option->id); ?>"><?= $this->getHtml('Edit', '0', '0'); ?></a>
</div>
</section>
</div>