mirror of
https://github.com/Karaka-Management/oms-Balance.git
synced 2026-01-11 15:18:41 +00:00
auto fixes + some impl.
This commit is contained in:
parent
a91a083bfb
commit
d9a6471683
|
|
@ -21,7 +21,6 @@ use phpOMS\Message\Http\HttpRequest;
|
|||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
use phpOMS\Module\ModuleInfo;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
|
||||
/**
|
||||
* Installer class.
|
||||
|
|
@ -72,7 +71,7 @@ final class Installer extends InstallerAbstract
|
|||
}
|
||||
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
$request = new HttpRequest();
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('code', \strtolower(\basename($file)));
|
||||
|
|
@ -86,21 +85,18 @@ final class Installer extends InstallerAbstract
|
|||
: $responseData['response']->toArray();
|
||||
|
||||
$json = \json_decode(\file_get_contents(__DIR__ . '/Install/Coa/' . $file), true);
|
||||
|
||||
foreach ($json as $element) {
|
||||
self::createElement($module, [$element], (int) $balance['id'], null);
|
||||
}
|
||||
self::createElement($module, $json, (int) $balance['id'], null);
|
||||
}
|
||||
}
|
||||
|
||||
private static function createElement(ApiController $module, array $elements, int $structure, int $parent = null)
|
||||
private static function createElement(ApiController $module, array $elements, int $structure, ?int $parent = null) : void
|
||||
{
|
||||
$order = 0;
|
||||
foreach ($elements as $element) {
|
||||
++$order;
|
||||
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
$request = new HttpRequest();
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('code', $element['name']);
|
||||
|
|
@ -131,7 +127,7 @@ final class Installer extends InstallerAbstract
|
|||
}
|
||||
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
$request = new HttpRequest();
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', $l11n);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
|
|||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/controlling/balance/dashboard.*$' => [
|
||||
'^.*/controlling/balance/dashboard(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Balance\Controller\BackendController:viewBalanceDashboard',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ use Modules\Balance\Models\BalanceElementMapper;
|
|||
use Modules\Balance\Models\BalanceMapper;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
|
@ -166,8 +165,12 @@ final class ApiController extends Controller
|
|||
$element->code = $request->getDataString('code') ?? '';
|
||||
$element->balance = $request->getDataInt('balance') ?? 0;
|
||||
$element->order = $request->getDataInt('order') ?? 0;
|
||||
$element->parent = $request->getDataInt('parent');
|
||||
|
||||
$element->setL11n($request->getDataString('content') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
||||
$element->setL11n(
|
||||
$request->getDataString('content') ?? '',
|
||||
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
|
||||
);
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
|
@ -212,9 +215,7 @@ final class ApiController extends Controller
|
|||
{
|
||||
$elementL11n = new BaseStringL11n();
|
||||
$elementL11n->ref = $request->getDataInt('ref') ?? 0;
|
||||
$elementL11n->setLanguage(
|
||||
$request->getDataString('language') ?? $request->header->l11n->language
|
||||
);
|
||||
$elementL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||
$elementL11n->content = $request->getDataString('content') ?? '';
|
||||
|
||||
return $elementL11n;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,9 @@ class BalanceElement
|
|||
public string $code = '';
|
||||
|
||||
public int $type = 0;
|
||||
|
||||
public string $formula = '';
|
||||
|
||||
public int $order = 0;
|
||||
|
||||
public int $balance = 0;
|
||||
|
|
@ -69,11 +71,11 @@ class BalanceElement
|
|||
$this->l11n = $l11n;
|
||||
} elseif (isset($this->l11n) && $this->l11n instanceof BaseStringL11n) {
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
$this->l11n->language = $lang;
|
||||
} else {
|
||||
$this->l11n = new BaseStringL11n();
|
||||
$this->l11n->content = $l11n;
|
||||
$this->l11n->setLanguage($lang);
|
||||
$this->l11n->language = $lang;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class BalanceElementMapper extends DataMapperFactory
|
|||
'self' => 'balance_balance_element_l11n_element',
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Balance
|
||||
* @package Modules\IncomeStatement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
|
|
@ -12,14 +12,71 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
function render_elements(array $elements, ?int $parent = null) : string
|
||||
{
|
||||
$row = '';
|
||||
$fn = 'render_elements';
|
||||
|
||||
foreach ($elements as $element) {
|
||||
if ($element->parent !== $parent) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$row .= <<<ROW
|
||||
<div>
|
||||
<div style="display: flex; flex-direction: row; align-items: center; background: #ff000099;">
|
||||
<div style="flex: 0; width: 30px; min-width: 30px; padding: 1px;"><label for="iElement{$element->id}-expand" class="btn"><i class="g-icon">add_circle</i></label></div>
|
||||
<div style="flex: 0; width: 150px; min-width: 150px; box-sizing: border-box; padding-left: 0px;">{$element->getL11n()}</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
</div>
|
||||
|
||||
<input id="iElement{$element->id}-expand" type="checkbox" class="hidden">
|
||||
<div class="checked-visibility">
|
||||
{$fn($elements, $element->id)}
|
||||
</div>
|
||||
</div>
|
||||
ROW;
|
||||
}
|
||||
|
||||
return $row;
|
||||
}
|
||||
|
||||
echo $this->data['nav']->render();
|
||||
?>
|
||||
<div class="row" style="font-size: 0.8rem;">
|
||||
|
||||
<div class="row" style="font-size: 0.8rem; margin-top: 1rem;">
|
||||
<div class="col-xs-12">
|
||||
<div style="background: #ff00ff99;">
|
||||
<div style="display: flex; flex-direction: row; align-items: center;">
|
||||
<div style="flex: 1; text-align: center;"></div>
|
||||
<div style="box-sizing: border-box; width: 150px; text-align: center;">Category</div>
|
||||
<div style="flex: 0; width: 30px; min-width: 30px; text-align: center;"></div>
|
||||
<div style="flex: 0; width: 150px; min-width: 150px; box-sizing: border-box; text-align: center;">Category</div>
|
||||
<div style="flex: 1; text-align: center;">1</div>
|
||||
<div style="flex: 1; text-align: center;">2</div>
|
||||
<div style="flex: 1; text-align: center;">3</div>
|
||||
|
|
@ -53,49 +110,6 @@ echo $this->data['nav']->render();
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
foreach ($this->data['elements'] as $element) :
|
||||
if ($element->parent !== null) {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<div class="row" style="font-size: 0.8rem;">
|
||||
<div class="col-xs-12">
|
||||
<div style="display: flex; flex-direction: row; align-items: center; background: #ff000099;">
|
||||
<div style="flex: 1; padding: 1px;"><label for="iSegment1-expand" class="btn"><i class="g-icon">add_circle</i></label></div>
|
||||
<div style="box-sizing: border-box; width: 120px; padding-left: 0px;"><?= $this->printHtml($element->getL11n()); ?></div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div style="flex: 1; padding: 1px;">+0.00%</div>
|
||||
<div class="col-xs-12"><?= \render_elements($this->data['elements'], null); ?></div>
|
||||
</div>
|
||||
|
||||
<!-- Input here -->
|
||||
<!-- Child here -->
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Balance\tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
\ini_set('memory_limit', '2048M');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user