fix templates

This commit is contained in:
Dennis Eichhorn 2024-04-17 17:45:07 +00:00
parent 739cb19abd
commit 80ca580e66
6 changed files with 197 additions and 32 deletions

View File

@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Modules\LoanManagement\Controller;
use Modules\LoanManagement\Models\LoanMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
@ -47,6 +48,9 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $request, $response);
$view->data['loans'] = LoanMapper::getAll()
->executeGetArray();
return $view;
}
@ -65,12 +69,39 @@ final class BackendController extends Controller
public function viewLoanCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-list');
$view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $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 viewLoanView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/LoanManagement/Theme/Backend/loan-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008301001, $request, $response);
$view->data['loan'] = LoanMapper::get()
->with('loanProvider')
->with('loanProvider/account')
->where('id', (int) $request->getData('id'))
->execute();
return $view;
}
/**
* Routing end-point for application behavior.
*

24
Theme/Backend/Lang/de.lang.php Executable file
View File

@ -0,0 +1,24 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\LoanManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['LoanManagement' => [
'Loans' => 'Darlehen',
'Loan' => 'Darlehen',
'Name' => 'Name',
'Description' => 'Beschreibung',
'Supplier' => 'Anbieter',
'Start' => 'Start',
'End' => 'Ende',
'Rate%' => 'Zinsen %',
]];

View File

@ -14,4 +14,11 @@ declare(strict_types=1);
return ['LoanManagement' => [
'Loans' => 'Loans',
'Loan' => 'Loan',
'Name' => 'Name',
'Description' => 'Description',
'Supplier' => 'Supplier',
'Start' => 'Start',
'End' => 'End',
'Rate%' => 'Rate %',
]];

View File

@ -12,4 +12,44 @@
*/
declare(strict_types=1);
echo $this->data['nav']->render();
use phpOMS\Uri\UriFactory;
/**
* @var \phpOMS\Views\View $this
*/
$loans = $this->data['loans'];
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Loans'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Loan'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Start'); ?>
<td><?= $this->getHtml('End'); ?>
<tbody>
<?php $c = 0;
foreach ($loans as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/finance/loan/view?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"></a>
<td><a href="<?= $url; ?>"><?= $value->name; ?></a>
<td><a href="<?= $url; ?>"><?= $value->start?->format('Y-m-d'); ?></a>
<td><a href="<?= $url; ?>"><?= $value->end?->format('Y-m-d'); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -16,36 +16,12 @@ echo $this->data['nav']->render();
$length = \max(12, 12);
?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Loans'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="iVehicleList" class="default sticky">
<thead>
<tr>
<td>Loan
<td>
<?php for ($i = 0; $i < $length; ++$i) : ?>
<td>
<?php endfor; ?>
<tbody>
<tr>
<td>Test
<td><span>Interest</span><br><span>Other costs</span><br><span>Repayment</span><br><span>Payout</span>
<?php for ($i = 0; $i < $length; ++$i) : ?>
<td>
<?php endfor; ?>
<tr>
<td>Test
<td><span>Interest</span><br><span>Other costs</span><br><span>Repayment</span><br><span>Payout</span>
<?php for ($i = 0; $i < $length; ++$i) : ?>
<td>
<?php endfor; ?>
<tr>
<td>Test
<td><span>Interest</span><br><span>Other costs</span><br><span>Repayment</span><br><span>Payout</span>
<?php for ($i = 0; $i < $length; ++$i) : ?>
<td>
<?php endfor; ?>
<div class="portlet-body">
<img height="100%" width="100%" src="Web/Backend/img/under_construction.svg">
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,87 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\LoanManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\LoanManagement\Models\NullLoan;
$loan = $this->data['loan'] ?? new NullLoan();
$isNew = $loan->id === 0;
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">
<?php if (!$isNew) : ?>
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Loan'); ?></label>
<li><label for="c-tab-2"><?= $this->getHtml('Timeline'); ?></label>
</ul>
</div>
<?php endif; ?>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="fLoan" method="POST" action="<?= \phpOMS\Uri\UriFactory::build('{/api}finance/loan?{?}&csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Loan'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" name="id" id="iId" value="<?= $loan->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name'); ?></label>
<input type="text" name="name" id="iName" value="<?= $this->printHtml($loan->name); ?>" required>
</div>
<div class="form-group">
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
<textarea name="description" id="iDescription"><?= $this->printTextarea($loan->description); ?></textarea>
</div>
<div class="form-group">
<label for="iSupplier"><?= $this->getHtml('Supplier'); ?></label>
<input type="text" name="name" id="iSupplier" value="<?= $this->printHtml($loan->loanProvider->account->name1); ?>" required>
</div>
<div class="form-group">
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($loan->start?->format('Y-m-d\TH:i:s')); ?>">
</div>
<div class="form-group">
<label for="iEnd"><?= $this->getHtml('End'); ?></label>
<input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($loan->end?->format('Y-m-d\TH:i:s')); ?>">
</div>
<div class="form-group">
<label for="iRate"><?= $this->getHtml('Rate%'); ?></label>
<input type="number" step="any" id="iRate" name="rate" value="<?= $this->getCurrency($loan->nominalBorrowingRate, symbol: ''); ?>">
</div>
</div>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</section>
</div>
</div>
</div>
</div>
</div>