template fixes + bug fixes + style fixes

This commit is contained in:
Dennis Eichhorn 2024-04-02 21:40:47 +00:00
parent d364e7c680
commit 9963f7bff0
8 changed files with 203 additions and 78 deletions

View File

@ -134,10 +134,10 @@ final class Installer extends InstallerAbstract
$module2 = $app->moduleManager->get('ItemManagement', 'ApiAttribute');
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->executeGetArray();
/** @var \phpOMS\Localization\BaseStringL11nType[] $l11nTypes */
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();
$l11nTypes = ItemL11nTypeMapper::getAll()->executeGetArray();
// Change indexing for easier search later on.
foreach ($attributeTypes as $e) {

View File

@ -276,4 +276,15 @@ return [
],
],
],
'^/item/material/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemMaterialCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::MATERIAL,
],
],
],
];

View File

@ -92,7 +92,7 @@ final class ApiController extends Controller
->where('language', $response->header->l11n->language)
->where('content', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE')
->limit($request->getDataInt('limit') ?? 50)
->execute();
->executeGetArray();
if (empty($l11n)) {
/** @var BaseStringL11n[] $l11n */
@ -102,7 +102,7 @@ final class ApiController extends Controller
->where('language', $response->header->l11n->language)
->where('content', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE')
->limit($request->getDataInt('limit') ?? 50)
->execute();
->executeGetArray();
}
if (empty($l11n)) {
@ -115,7 +115,7 @@ final class ApiController extends Controller
->where('language', $response->header->l11n->language)
->where('content', '%' . $search . '%', 'LIKE')
->limit($request->getDataInt('limit') ?? 50)
->execute();
->executeGetArray();
if (!empty($l11n)) {
break;
@ -131,7 +131,7 @@ final class ApiController extends Controller
->where('language', $response->header->l11n->language)
->where('content', '%' . $search . '%', 'LIKE')
->limit($request->getDataInt('limit') ?? 50)
->execute();
->executeGetArray();
if (!empty($l11n)) {
break;
@ -153,7 +153,7 @@ final class ApiController extends Controller
->where('l11n/type/title', ['name1', 'name2'], 'IN')
->where('l11n/language', $request->header->l11n->language)
->where('id', $itemIds, 'IN')
->execute();
->executeGetArray();
}
$response->header->set('Content-Type', MimeType::M_JSON, true);
@ -256,7 +256,7 @@ final class ApiController extends Controller
/** @var \Modules\Attribute\Models\AttributeType[] $types */
$types = ItemAttributeTypeMapper::getAll()
->where('name', ['default_sales_container', 'default_purchase_container'], 'IN')
->execute();
->executeGetArray();
$primaryContainer = \reset($item->container);
if ($primaryContainer !== false) {
@ -379,7 +379,7 @@ final class ApiController extends Controller
/** @var \Modules\Attribute\Models\AttributeType[] $types */
$types = ItemAttributeTypeMapper::getAll()
->where('name', \array_keys($segmentation), 'IN')
->execute();
->executeGetArray();
foreach ($types as $type) {
$internalResponse = clone $response;
@ -397,7 +397,7 @@ final class ApiController extends Controller
/**
* Create directory for an account
*
* @param int $id Item number
* @param int $id Item number
* @param int $createdBy Creator of the directory
*
* @return Collection

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Controller;
use Modules\Attribute\Models\NullAttributeType;
use Modules\Attribute\Models\NullAttributeValue;
use Modules\Auditor\Models\AuditMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeValueL11nMapper;
@ -73,13 +75,13 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->attributes = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
->executeGetArray();
$view->path = 'item';
@ -100,7 +102,7 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->attribute = ItemAttributeTypeMapper::get()
@ -114,7 +116,7 @@ final class BackendController extends Controller
$view->l11ns = ItemAttributeTypeL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
->executeGetArray();
$view->path = 'item';
@ -135,9 +137,11 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeValue(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->type = ItemAttributeTypeMapper::get()->where('id', (int) $request->getData('type'))->execute();
$view->attribute = ItemAttributeValueMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
@ -146,7 +150,7 @@ final class BackendController extends Controller
$view->l11ns = ItemAttributeValueL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
->executeGetArray();
// @todo Also find the ItemAttributeType
@ -183,7 +187,7 @@ final class BackendController extends Controller
->where('files/types/name', 'item_profile_image')
->where('unit', $this->app->unitId)
->limit(50)
->execute();
->executeGetArray();
$view->data['items'] = $items;
@ -275,7 +279,11 @@ final class BackendController extends Controller
*/
public function viewItemManagementItemCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
return $this->viewItemManagementItem($request, $response, $data);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004803001, $request, $response);
return $view;
}
/**
@ -460,20 +468,20 @@ final class BackendController extends Controller
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
$view->data['l11nTypes'] = ItemL11nTypeMapper::getAll()
->execute();
->executeGetArray();
$view->data['l11nValues'] = ItemL11nMapper::getAll()
->with('type')
->where('ref', $view->data['item']->id)
->execute();
->executeGetArray();
$view->data['attributeTypes'] = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
->executeGetArray();
$view->data['units'] = UnitMapper::getAll()
->execute();
->executeGetArray();
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
@ -483,7 +491,7 @@ final class BackendController extends Controller
->with('supplier/account')
->where('item', $view->data['item']->id)
->where('client', null)
->execute()
->executeGetArray()
: [];
/** @var \Modules\Attribute\Models\AttributeType[] $tmp */
@ -498,7 +506,7 @@ final class BackendController extends Controller
->where('defaults/l11n', (new Where($this->app->dbPool->get()))
->where(ItemAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null)
->orWhere(ItemAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language))
->execute();
->executeGetArray();
$defaultAttributeTypes = [];
foreach ($tmp as $t) {
@ -515,7 +523,7 @@ final class BackendController extends Controller
->where('defaults/l11n', (new Where($this->app->dbPool->get()))
->where(ClientAttributeValueL11nMapper::getColumnByMember('ref') ?? '', '=', null)
->orWhere(ClientAttributeValueL11nMapper::getColumnByMember('language') ?? '', '=', $response->header->l11n->language))
->execute();
->executeGetArray();
$clientSegmentationTypes = [];
foreach ($tmp as $t) {
@ -538,7 +546,7 @@ final class BackendController extends Controller
->where('type', StringUtils::intHash(ItemMapper::class))
->where('module', 'ItemManagement')
->where('ref', (string) $view->data['item']->id)
->execute();
->executeGetArray();
}
$view->data['logs'] = $logs;
@ -549,7 +557,7 @@ final class BackendController extends Controller
->with('types')
->join('id', ItemMapper::class, 'files') // id = media id, files = item relations
->on('id', $view->data['item']->id, relation: 'files') // id = item id
->execute();
->executeGetArray();
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
@ -820,7 +828,7 @@ final class BackendController extends Controller
$view->data['types'] = MaterialTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
->executeGetArray();
return $view;
}
@ -849,15 +857,84 @@ final class BackendController extends Controller
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
$l11nValues = MaterialTypeL11nMapper::getAll()
->where('ref', $view->data['type']->id)
->execute();
->executeGetArray();
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
$view->data['l11nValues'] = $l11nValues;
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 viewItemMaterialCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/material-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $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 viewItemManagementAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->attribute = new NullAttributeType();
$view->path = 'item';
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 viewItemManagementAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeValueView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->type = ItemAttributeTypeMapper::get()->where('id', (int) $request->getData('type'))->execute();
$view->attribute = new NullAttributeValue();
$view->path = 'item';
return $view;
}
}

View File

@ -124,7 +124,7 @@ return ['ItemManagement' => [
'Text' => 'Text',
'TimeUnit' => 'Zeiteinheit',
'Title' => 'Titel',
'Defaults' => 'Standard',
'Defaults' => 'Standard',
'TopCustomers' => 'Top Kunden',
'Tracking' => 'Verfolgung',
'TradingUnit' => 'Handelseinheit',
@ -151,7 +151,7 @@ return ['ItemManagement' => [
'LeadTime' => 'Lieferzeit',
'UnitQuantity' => 'Einheitsmenge',
'UnitPrice' => 'Einheitspreis',
'Suppliers' => 'Lieferanten',
'Suppliers' => 'Lieferanten',
'CostCenter' => 'Kostenstelle',
'CostObject' => 'Kostenträger',
'DefaultStock' => 'Standard Lager',
@ -159,4 +159,8 @@ return ['ItemManagement' => [
'Inventory' => 'Bestandsführung',
'Identifier' => 'Identifizierung',
'Stocktaking' => 'Inventur',
':status-1' => 'Aktiv',
':status-2' => 'Entwurf',
':status-3' => 'Inaktiv',
':status-4' => 'Eingestellt',
]];

View File

@ -125,7 +125,7 @@ return ['ItemManagement' => [
'Text' => 'Text',
'TimeUnit' => 'Unit of time',
'Title' => 'Title',
'Defaults' => 'Defaults',
'Defaults' => 'Defaults',
'TopCustomers' => 'Top Customers',
'Tracking' => 'Tracking',
'TradingUnit' => 'Trading Unit',
@ -159,4 +159,8 @@ return ['ItemManagement' => [
'Inventory' => 'Inventory',
'Identifier' => 'Identifier',
'Stocktaking' => 'Stocktaking',
':status-1' => 'Active',
':status-2' => 'Draft',
':status-3' => 'Inactive',
':status-4' => 'Discontinued',
]];

View File

@ -12,13 +12,13 @@
*/
declare(strict_types=1);
use Modules\Billing\Models\BillTransferType;
use Modules\Billing\Models\Price\PriceType;
use Modules\Billing\Models\SalesBillMapper;
use Modules\ItemManagement\Models\ItemStatus;
use Modules\ItemManagement\Models\NullItem;
use Modules\Media\Models\NullMedia;
use Modules\WarehouseManagement\Models\StockLocationMapper;
use Modules\WarehouseManagement\Models\StockMapper;
use phpOMS\DataStorage\Database\Query\OrderType;
use phpOMS\Localization\ISO3166CharEnum;
use phpOMS\Localization\ISO3166NameEnum;
use phpOMS\Localization\ISO4217CharEnum;
@ -31,29 +31,27 @@ use phpOMS\Stdlib\Base\SmartDateTime;
use phpOMS\Uri\UriFactory;
/** @var \Modules\ItemManagement\Models\Item $item */
$item = $this->data['item'];
$item = $this->data['item'] ?? new NullItem();
$isNew = $item->id === 0;
$logs = $this->data['logs'] ?? [];
$notes = $item->notes;
$files = $item->files;
$logs = $this->data['logs'] ?? [];
$itemImage = $this->getData('itemImage') ?? new NullMedia();
$allInvoices = $this->data['allInvoices'] ?? [];
$topCustomers = $this->getData('topCustomers') ?? [[], []];
$attributeView = $this->data['attributeView'];
$l11nView = $this->data['l11nView'];
$languages = ISO639Enum::getConstants();
$allInvoices = $this->data['allInvoices'] ?? [];
$topCustomers = $this->getData('topCustomers') ?? [[], []];
$languages = ISO639Enum::getConstants();
$regions = RegionEnum::getConstants();
$countries = ISO3166CharEnum::getConstants();
$currencies = ISO4217CharEnum::getConstants();
$itemStatus = ItemStatus::getConstants();
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('Profile'); ?></label>
@ -72,10 +70,11 @@ echo $this->data['nav']->render();
<?php if (!empty($logs)) : ?><li><label for="c-tab-15"><?= $this->getHtml('Logs'); ?></label><?php endif; ?>
</ul>
</div>
<?php endif; ?>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<?php if (!empty($notes) && ($warning = $item->getEditorDocByTypeName('item_backend_warning'))->id !== 0) : ?>
<?php if (!empty($item->notes) && ($warning = $item->getEditorDocByTypeName('item_backend_warning'))->id !== 0) : ?>
<!-- If note warning exists -->
<div class="row">
<div class="col-xs-12">
@ -89,24 +88,44 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-lg-3 last-lg">
<section class="portlet">
<form>
<form id="itemForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item?csrf={$CSRF}'); ?>">
<div class="portlet-body">
<table class="layout wf-100">
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>" spellcheck="false" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->content); ?>" spellcheck="false">
</table>
<div class="form-group">
<?= $this->getHtml('ID', '0', '0'); ?></label>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>"<?= $isNew ? ' required' : ' disabled'; ?>></span>
</div>
<div class="form-group">
<label for="iStatus"><?= $this->getHtml('Status'); ?></label>
<select id="iStatus" name="status">
<?php foreach ($itemStatus as $status) : ?>
<option value="<?= $status; ?>"<?= $item->status === $status ? ' selected': ''; ?>><?= $this->getHtml(':status-' . $status); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>" spellcheck="false" required>
</div>
<div class="form-group">
<label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->content); ?>" spellcheck="false">
</div>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
<input class="right-xs cancel" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-item">
<?php if ($isNew) : ?>
<input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-item">
<?php else : ?>
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
<input class="cancel end-xs" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-item">
<?php endif; ?>
</div>
</form>
</section>
<?php if (!$isNew) : ?>
<section class="portlet">
<div class="portlet-body">
<img alt="<?= $this->printHtml($itemImage->name); ?>" width="100%" loading="lazy" class="item-image"
@ -121,9 +140,12 @@ echo $this->data['nav']->render();
<textarea class="undecorated"></textarea>
</div>
</section>
<?php endif; ?>
</div>
<?php if (!$isNew) : ?>
<div class="col-xs-12 col-lg-9 plain-grid">
<?php if ($this->data['hasBilling']) : ?>
<?php if ($this->data['hasBilling'] ?? false) : ?>
<div class="row">
<div class="col-xs-12 col-lg-4">
<section class="portlet hl-7">
@ -192,7 +214,7 @@ echo $this->data['nav']->render();
<tbody>
<?php
$count = 0;
foreach ($notes as $note) :
foreach ($item->notes as $note) :
++$count;
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
?>
@ -224,7 +246,7 @@ echo $this->data['nav']->render();
<tbody>
<?php
$count = 0;
foreach ($files as $file) :
foreach ($item->files as $file) :
++$count;
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
?>
@ -242,7 +264,7 @@ echo $this->data['nav']->render();
</div>
</div>
<?php if ($this->data['hasBilling']) : ?>
<?php if ($this->data['hasBilling'] ?? false) : ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
@ -265,12 +287,13 @@ echo $this->data['nav']->render();
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
$url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $invoice->id);
$clientUrl = UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->getNumber()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->type->getL11n()); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a class="content" href="<?= $clientUrl; ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->performanceDate->format('Y-m-d')); ?></a>
<?php endforeach; ?>
@ -284,7 +307,7 @@ echo $this->data['nav']->render();
</div>
<?php endif; ?>
<?php if ($this->data['hasBilling']) :
<?php if ($this->data['hasBilling'] ?? false) :
$topCustomers = SalesBillMapper::getItemTopClients($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'), 5);
?>
<div class="row">
@ -467,12 +490,15 @@ echo $this->data['nav']->render();
</div>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php if (!$isNew) : ?>
<input type="radio" id="c-tab-2" name="tabular-2" checked>
<div class="tab">
<div class="row">
<?= $l11nView->render(
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
$this->data['l11nTypes'] ?? [],
'{/api}item/l11n?csrf={$CSRF}'
@ -484,7 +510,7 @@ echo $this->data['nav']->render();
<input type="radio" id="c-tab-3" name="tabular-2" checked>
<div class="tab">
<div class="row">
<?= $attributeView->render(
<?= $this->data['attributeView']->render(
$item->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
@ -1266,7 +1292,7 @@ echo $this->data['nav']->render();
$costcenters = \Modules\Accounting\Models\CostCenterMapper::getAll()
->with('l11n')
->where('l11n/language', $this->response->header->l11n->language)
->execute();
->executeGetArray();
foreach ($costcenters as $cc) : ?>
<option value="<?= $cc->id; ?>"><?= $this->printHtml($cc->code . ' ' . $cc->getL11n()); ?>
<?php endforeach; ?>
@ -1281,7 +1307,7 @@ echo $this->data['nav']->render();
$costobjects = \Modules\Accounting\Models\CostObjectMapper::getAll()
->with('l11n')
->where('l11n/language', $this->response->header->l11n->language)
->execute();
->executeGetArray();
foreach ($costobjects as $co) : ?>
<option value="<?= $co->id; ?>"><?= $this->printHtml($co->code . ' ' . $co->getL11n()); ?>
<?php endforeach; ?>
@ -1310,7 +1336,7 @@ echo $this->data['nav']->render();
<label for="iItemStockDefault"><?= $this->getHtml('DefaultStock'); ?></label>
<select id="iItemStockDefault" name="stockdefaultstock">
<?php
$stocks = StockMapper::getAll()->execute();
$stocks = StockMapper::getAll()->executeGetArray();
foreach ($stocks as $stock) :
?>
<option value="<?= $stock->id; ?>"><?= $this->printHtml($stock->name); ?>
@ -1322,7 +1348,7 @@ echo $this->data['nav']->render();
<label for="iItemStockLocation"><?= $this->getHtml('DefaultStockLocation'); ?></label>
<select id="iItemStockLocation" name="stockdefaultlocation">
<?php
$stocks = StockLocationMapper::getAll()->execute();
$stocks = StockLocationMapper::getAll()->executeGetArray();
foreach ($stocks as $stock) :
?>
<option value="<?= $stock->id; ?>"><?= $this->printHtml($stock->name); ?>
@ -1409,12 +1435,13 @@ echo $this->data['nav']->render();
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) :
++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
$url = UriFactory::build('{/base}/sales/bill/view?{?}&id=' . $invoice->id);
$clientUrl = UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
<td><a class="content" href="<?= $clientUrl; ?>"><?= $invoice->billTo; ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->performanceDate->format('Y-m-d'); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
@ -1492,5 +1519,6 @@ echo $this->data['nav']->render();
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>

View File

@ -16,8 +16,7 @@ use phpOMS\Localization\NullBaseStringL11nType;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Localization\BaseStringL11nType */
$type = $this->data['type'] ?? new NullBaseStringL11nType();
$type = $this->data['type'] ?? new NullBaseStringL11nType();
$isNew = $type->id === 0;
/** @var \phpOMS\Views\View $this */
@ -47,6 +46,7 @@ echo $this->data['nav']->render(); ?>
</div>
</div>
<?php if (!$isNew) : ?>
<div class="row">
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
@ -54,4 +54,5 @@ echo $this->data['nav']->render(); ?>
'{/api}item/material/l11n?csrf={$CSRF}'
);
?>
</div>
</div>
<?php endif; ?>