This commit is contained in:
Dennis Eichhorn 2024-01-02 23:34:17 +00:00
parent 8ca76d9c0d
commit 6a460b8e48
11 changed files with 70 additions and 121 deletions

View File

@ -55,7 +55,7 @@ use phpOMS\Views\View;
final class ApiController extends Controller
{
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param HttpRequest $request Request
* @param HttpResponse $response Response
@ -346,7 +346,10 @@ final class ApiController extends Controller
}
}
$view = new View($this->app->l11nManager, $request, $response);
$view = new View($this->app->l11nManager, $request, $response);
$rcoll = [];
$report = null;
if (!$template->isStandalone) {
/** @var Report $report */
$report = ReportMapper::get()
@ -358,9 +361,6 @@ final class ApiController extends Controller
->limit(1)
->execute();
$rcoll = [];
$report = $report === false ? new NullReport() : $report;
if ($report->id > 0) {
$files = $report->source->getSources();
@ -368,11 +368,10 @@ final class ApiController extends Controller
$rcoll[$media->name . '.' . $media->extension] = $media;
}
}
$view->data['report'] = $report;
$view->data['rcoll'] = $rcoll;
}
$view->data['report'] = $report;
$view->data['rcoll'] = $rcoll;
$view->data['tcoll'] = $tcoll;
$view->data['lang'] = $request->getData('lang') ?? $request->header->l11n->language;
$view->data['template'] = $template;
@ -382,7 +381,7 @@ final class ApiController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -557,7 +556,7 @@ final class ApiController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response

View File

@ -38,7 +38,7 @@ use phpOMS\Views\View;
final class BackendController extends Controller
{
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -77,7 +77,7 @@ final class BackendController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -103,7 +103,7 @@ final class BackendController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -129,7 +129,7 @@ final class BackendController extends Controller
}
/**
* Routing end-point for application behaviour.
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -199,17 +199,19 @@ final class BackendController extends Controller
}
}
$rcoll = [];
$report = null;
if (!$template->isStandalone) {
if (!isset($tcoll['template'])) {
throw new \Exception('No template file detected.');
}
/** @var \Modules\Helper\Models\Report[] $report */
$report = ReportMapper::get()->where('template', $template->id)->sort('id', OrderType::DESC)->limit(1)->execute();
$rcoll = [];
$report = \end($report);
$report = $report === false ? new NullReport() : $report;
/** @var \Modules\Helper\Models\Report $report */
$report = ReportMapper::get()
->where('template', $template->id)
->sort('id', OrderType::DESC)
->limit(1)
->execute();
if ($report->id > 0) {
/** @var Media[] $files */
@ -219,13 +221,12 @@ final class BackendController extends Controller
$rcoll[$media->name . '.' . $media->extension] = $media;
}
}
$view->data['report'] = $report;
$view->data['rcoll'] = $rcoll;
}
$view->data['report'] = $report;
$view->data['unit'] = $this->app->unitId;
$view->data['tcoll'] = $tcoll;
$view->data['rcoll'] = $rcoll;
$view->data['lang'] = $request->getData('lang') ?? $request->header->l11n->language;
$view->data['template'] = $template;
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002701001, $request, $response);

View File

@ -17,7 +17,7 @@ namespace Modules\Helper\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
* Permission category enum.
*
* @package Modules\Helper\Models
* @license OMS License 2.0

View File

@ -17,7 +17,7 @@ namespace Modules\Helper\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Permision state enum.
* Permission category enum.
*
* @package Modules\Helper\Models
* @license OMS License 2.0

View File

@ -30,7 +30,7 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<tr><td><input id="iTitle" name="name" type="text" placeholder="&#xf040; P&L Reporting 2015 December v1.0" required>
<tr><td><input id="iTitle" name="name" type="text" placeholder="P&L Reporting 2015 December v1.0" required>
<tr><td><label for="iTemplate"><?= $this->getHtml('Template'); ?></label>
<tr><td><select id="iTemplate" name="template">
<?php foreach ($templateList as $key => $value) : ?>

View File

@ -33,38 +33,6 @@ $previous = empty($templates) ? '{/base}/helper/list' : '{/base}/helper/list?{?}
$next = empty($templates) ? '{/base}/helper/list' : 'helper/list?{?}&id=' . \end($templates)->id . '&ptype=n';
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="box">
<ul class="crumbs-2">
<li data-href="<?= UriFactory::build('{/base}/helper/list?path=/Accounts/' . $accountDir); ?>"><a href="<?= UriFactory::build('{/base}/helper/list?path=/Accounts/' . $accountDir); ?>"><i class="g-icon">home</i></a>
<li data-href="<?= UriFactory::build('{/base}/helper/list?path=/'); ?>"><a href="<?= UriFactory::build('{/base}/helper/list?path=/'); ?>">/</a></li>
<?php
$subPath = '';
$paths = \explode('/', \ltrim($mediaPath, '/'));
$length = \count($paths);
$parentPath = '';
for ($i = 0; $i < $length; ++$i) :
if ($paths[$i] === '') {
continue;
}
if ($i === $length - 1) {
$parentPath = $subPath === '' ? '/' : $subPath;
}
$subPath .= '/' . $paths[$i];
$url = UriFactory::build('{/base}/helper/list?path=' . $subPath);
?>
<li data-href="<?= $url; ?>"<?= $i === $length - 1 ? 'class="active"' : ''; ?>><a href="<?= $url; ?>"><?= $this->printHtml($paths[$i]); ?></a></li>
<?php endfor; ?>
</ul>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
@ -127,32 +95,7 @@ echo $this->data['nav']->render(); ?>
<i class="filter g-icon">filter_alt</i>
</label>
<tbody>
<?php if (!empty($parentPath)) : $url = UriFactory::build('{/base}/helper/list?path=' . $parentPath); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td>
<td data-label="<?= $this->getHtml('Type'); ?>"><a href="<?= $url; ?>"><i class="g-icon">folder_open</i></a>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>">..
</a>
<td>
<td>
<td>
<td>
<?php endif; ?>
<?php $count = 0; foreach ($collections as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/helper/list?path=' . \rtrim($value->getVirtualPath(), '/') . '/' . $value->name);
?>
<tr data-href="<?= $url; ?>">
<td><label class="checkbox" for="helperList-<?= $key; ?>">
<input type="checkbox" id="helperList-<?= $key; ?>" name="helperselect">
<span class="checkmark"></span>
</label>
<td><a href="<?= $url; ?>"><i class="g-icon">folder_open</i></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td>
<td><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>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php foreach ($templates as $key => $template) : ++$count;
<?php $count = 0; foreach ($templates as $key => $template) : ++$count;
$url = UriFactory::build('{/base}/helper/report/view?{?}&id=' . $template->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><label class="checkbox" for="helperList-<?= $key; ?>">
@ -162,16 +105,17 @@ echo $this->data['nav']->render(); ?>
<td>
<td data-label="<?= $this->getHtml('Name'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->name); ?></a>
<td data-label="<?= $this->getHtml('Tag'); ?>">
<?php $tags = $template->getTags(); foreach ($tags as $tag) : ?>
<?php $tags = $template->getTags();
foreach ($tags as $tag) : ?>
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>"><?= empty($tag->icon) ? '' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $template->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$template->createdBy->name1, $template->createdBy->name2, $template->createdBy->name3, $template->createdBy->login ?? ''])); ?></a>
<td data-label="<?= $this->getHtml('Updated'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($template->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr tabindex="0" class="empty">
<td colspan="4"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
<?php endif; ?>
</table>
</div>
<div class="portlet-foot">

View File

@ -19,10 +19,10 @@ use phpOMS\Uri\UriFactory;
* @var \phpOMS\Views\View $this
*/
/** @var \Modules\Media\Models\Collection $tcoll */
/** @var \Modules\Media\Models\Collection[] $tcoll */
$tcoll = $this->data['tcoll'];
/** @var \Modules\Media\Models\Collection $rcoll */
/** @var \Modules\Media\Models\Collection[] $rcoll */
$rcoll = $this->data['rcoll'];
/** @var string $cLang */
@ -43,11 +43,11 @@ $lang = $reportLanguage[$cLang] ?? [];
$settings = isset($tcoll['cfg']) ? \json_decode(\file_get_contents(__DIR__ . '/../../../../' . \ltrim($tcoll['cfg']->getPath(), '/')), true) : [];
echo $this->data['nav']->render(); ?>
<div class="row" style="height: calc(100% - 85px);">
<div class="col-xs-12 col-md-9">
<div class="portlet">
<div class="portlet-body">
<iframe data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/api}helper/report/export/?{?}&id=' . $template->id); ?>&u=<?= $this->data['unit']; ?>" allowfullscreen></iframe>
<div class="row">
<div class="col-xs-12 col-md-9 col-simple">
<div class="portlet col-simple">
<div class="portlet-body col-simple">
<iframe class="col-simple" data-form="iUiSettings" data-name="iframeHelper" id="iHelperFrame" src="<?= UriFactory::build('{/api}helper/report/export/?{?}&id=' . $template->id); ?>&u=<?= $this->data['unit']; ?>" allowfullscreen></iframe>
</div>
</div>
</div>
@ -97,7 +97,7 @@ echo $this->data['nav']->render(); ?>
<option value="json"<?= $this->printHtml((isset($tcoll['json'])) ? '' : ' disabled'); ?>>Json
</select>
<tr>
<td><a tabindex="0" target="_blank" class="button" href="<?= UriFactory::build('{/base}/{/api}helper/report/export?{?}'); ?>&type={#iExport}&lang={#iLang}{#iUiSettings}"><?= $this->getHtml('Export'); ?></a>
<td><a tabindex="0" target="_blank" class="button" href="<?= UriFactory::build('{/api}helper/report/export?{?}'); ?>&type={#iExport}&lang={#iLang}{#iUiSettings}"><?= $this->getHtml('Export'); ?></a>
</table>
</form>
</div>
@ -116,7 +116,7 @@ echo $this->data['nav']->render(); ?>
<?php endforeach; ?>
</table>
</div>
<div class="portlet-foot"><a tabindex="0" class="button" href="<?= UriFactory::build('{/base}/{%}'); ?>&lang={#iLang}{#iUiSettings}"><?= $this->getHtml('Load'); ?></a></div>
<div class="portlet-foot"><a tabindex="0" class="button" href="<?= UriFactory::build('{%}'); ?>&lang={#iLang}{#iUiSettings}"><?= $this->getHtml('Load'); ?></a></div>
</form>
</div>
<?php endif; ?>
@ -126,7 +126,9 @@ echo $this->data['nav']->render(); ?>
<div class="portlet-body">
<table class="list wf-100">
<tbody>
<?php if (!$template->isStandalone && !($report instanceof \Modules\Helper\Models\NullReport)) : ?>
<?php if (!$template->isStandalone
&& !($report instanceof \Modules\Helper\Models\NullReport)
) : ?>
<tr>
<th colspan="2"><?= $this->getHtml('Report'); ?>
<tr>
@ -153,7 +155,9 @@ echo $this->data['nav']->render(); ?>
<tr>
<td><?= $this->getHtml('Tags'); ?>
<td>
<?php $tags = $template->getTags(); foreach ($tags as $tag) : ?>
<?php
$tags = $template->getTags();
foreach ($tags as $tag) : ?>
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>"><?= empty($tag->icon) ? '' : ''; ?><?= $this->printHtml($tag->getL11n()); ?></span>
<?php endforeach; ?>
</table>

View File

@ -24,7 +24,7 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100" style="table-layout: fixed">
<tbody>
<tr><td><label for="iTitle"><?= $this->getHtml('Title'); ?></label>
<tr><td><input id="iTitle" name="name" type="text" placeholder="&#xf040; P&L Reporting" required>
<tr><td><input id="iTitle" name="name" type="text" placeholder="P&L Reporting" required>
<tr><td><label for="iDescription"><?= $this->getHtml('Description'); ?></label>
<tr><td><?= $this->getData('editor')->render('report-editor'); ?>
<tr><td><?= $this->getData('editor')->getData('text')->render('report-editor', 'description', 'helper-template-create'); ?>
@ -37,7 +37,7 @@ echo $this->data['nav']->render(); ?>
<tr><td><label for="iExpected"><?= $this->getHtml('Expected'); ?></label>
<tr><td>
<div class="ipt-wrap">
<div class="ipt-first"><input id="iExpected" type="text" placeholder="&#xf15b; file.csv"><input name="expected" type="hidden"></div>
<div class="ipt-first"><input id="iExpected" type="text" placeholder="file.csv"><input name="expected" type="hidden"></div>
<div class="ipt-second"><button><?= $this->getHtml('Add', '0', '0'); ?></button></div>
</div>
</table>

View File

@ -60,6 +60,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
$this->app = new class() extends ApplicationAbstract
{
protected string $appName = 'Api';
protected int $appId = 1;
};

View File

@ -31,18 +31,18 @@ require __DIR__ . '/Worker.php';
<div class="tabview tab-2">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $lang['Overview']; ?></label></li>
<li><label for="c-tab-2"><?= $lang['Type']; ?></label></li>
<li><label for="c-tab-3"><?= $lang['CostObject']; ?></label></li>
<li><label for="c-tab-4"><?= $lang['CostCenter']; ?></label></li>
<li><label for="c-tab-5"><?= $lang['Account']; ?></label></li>
<li><label for="c-tab-1"><?= $lang['Overview']; ?></label>
<li><label for="c-tab-2"><?= $lang['Type']; ?></label>
<li><label for="c-tab-3"><?= $lang['CostObject']; ?></label>
<li><label for="c-tab-4"><?= $lang['CostCenter']; ?></label>
<li><label for="c-tab-5"><?= $lang['Account']; ?></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 class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Budget']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -92,7 +92,7 @@ require __DIR__ . '/Worker.php';
</div>
<div class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostObject']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -131,7 +131,7 @@ require __DIR__ . '/Worker.php';
</div>
<div class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostCenter']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -170,7 +170,7 @@ require __DIR__ . '/Worker.php';
</div>
<div class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Account']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -211,7 +211,7 @@ require __DIR__ . '/Worker.php';
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
<div class="tab">
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostObject']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -238,7 +238,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostCenter']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -261,7 +261,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Account']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -286,7 +286,7 @@ require __DIR__ . '/Worker.php';
<input type="radio" id="c-tab-3" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-3' ? ' checked' : ''; ?>>
<div class="tab">
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Account']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -309,7 +309,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostCenter']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -334,7 +334,7 @@ require __DIR__ . '/Worker.php';
<input type="radio" id="c-tab-4" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-4' ? ' checked' : ''; ?>>
<div class="tab">
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Account']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -357,7 +357,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Type']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -380,7 +380,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostObject']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -405,7 +405,7 @@ require __DIR__ . '/Worker.php';
<input type="radio" id="c-tab-5" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-5' ? ' checked' : ''; ?>>
<div class="tab">
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['Type']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>
@ -428,7 +428,7 @@ require __DIR__ . '/Worker.php';
</section>
<section class="box">
<table class="default">
<table class="default sticky">
<caption><?= $lang['CostCenter']; ?><i class="g-icon end-xs download btn">download</i></caption>
<thead>
<tr>

View File

@ -38,7 +38,7 @@ $duration = (int) ($this->request->getData('duration') ?? 10);
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="<?= UriFactory::build('{/base}/{/base}/' . \ltrim($tcoll['css']['styles.css']->getPath(), '/')); ?>">
<link rel="stylesheet" type="text/css" href="<?= UriFactory::build('{/base}/' . \ltrim($tcoll['css']['styles.css']->getPath(), '/')); ?>">
</head>
<body>
<table>