started with template fixes

This commit is contained in:
Dennis Eichhorn 2024-03-29 15:26:00 +00:00
parent debfa19fb5
commit ef72ee0b0b
15 changed files with 184 additions and 362 deletions

View File

@ -47,8 +47,8 @@
"pid": "/item/attribute",
"type": 3,
"subtype": 1,
"name": "Values",
"uri": "{/base}/item/attribute/value/list?{?}",
"name": "Create",
"uri": "{/base}/item/attribute/type/create?{?}",
"target": "self",
"icon": null,
"order": 10,

View File

@ -22,6 +22,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemListExport',
'verb' => RouteVerb::GET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -33,6 +34,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemFind',
'verb' => RouteVerb::GET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -44,6 +46,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -53,6 +56,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -64,6 +68,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeTypeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -73,6 +78,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeTypeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -84,6 +90,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeTypeL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -93,6 +100,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeTypeL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -104,6 +112,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeValueCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -113,6 +122,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeValueUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -120,10 +130,11 @@ return [
],
],
],
'^.*/item/attribute/value$' => [
'^.*/item/attribute/value/l11n$' => [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeValueL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -133,6 +144,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiAttributeController:apiItemAttributeValueL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -144,6 +156,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -153,6 +166,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -164,6 +178,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemL11nTypeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -173,6 +188,7 @@ return [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemL11nTypeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,

View File

@ -29,7 +29,7 @@ return [
],
],
],
'^.*/item/attribute/type(\?.*$|$)' => [
'^.*/item/attribute/type/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeType',
'verb' => RouteVerb::GET,
@ -40,9 +40,20 @@ return [
],
],
],
'^.*/item/attribute/value(\?.*$|$)' => [
'^.*/item/attribute/type/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeValues',
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeTypeCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^.*/item/attribute/value/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeValue',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
@ -51,6 +62,17 @@ return [
],
],
],
'^.*/item/attribute/value/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeValueCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemList',

View File

@ -41,6 +41,7 @@ omsApp.Modules.ItemManagement = class {
const self = this;
const data = JSON.parse(chart.getAttribute('data-chart'));
/** global: Chart */
const myChart = new Chart(chart.getContext('2d'), data);
};
};

View File

@ -188,7 +188,7 @@ final class ApiController extends Controller
private function createItemDir(Item $item) : string
{
return '/Modules/ItemManagement/Items/'
. (empty($item->number) ? $item->id : $item->number);
. $item->id;
}
/**
@ -302,7 +302,8 @@ final class ApiController extends Controller
$billing->apiPriceCreate($internalRequest, $internalResponse);
}
$this->createMediaDirForItem($item->number, $request->header->account);
// @todo should this collection get added to the parent collection?
$this->createMediaDirForItem($item->id, $request->header->account);
$path = $this->createItemDir($item);
$uploadedFiles = $request->files['item_profile_image'] ?? [];
@ -396,19 +397,19 @@ final class ApiController extends Controller
/**
* Create directory for an account
*
* @param string $number Item number
* @param int $createdBy Creator of the directory
* @param int $id Item number
* @param int $createdBy Creator of the directory
*
* @return Collection
*
* @since 1.0.0
*/
private function createMediaDirForItem(string $number, int $createdBy) : Collection
private function createMediaDirForItem(int $id, int $createdBy) : Collection
{
$collection = new Collection();
$collection->name = $number;
$collection->name = $id;
$collection->setVirtualPath('/Modules/ItemManagement/Items');
$collection->setPath('/Modules/Media/Files/Modules/ItemManagement/Items/' . $number);
$collection->setPath('/Modules/Media/Files/Modules/ItemManagement/Items/' . $id);
$collection->createdBy = new NullAccount($createdBy);
CollectionMapper::create()->execute($collection);

View File

@ -73,46 +73,15 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-type-list');
$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);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = ItemAttributeTypeMapper::getAll()
$view->attributes = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributes'] = $attributes;
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 viewItemManagementAttributeValues(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-value-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
$attributes = ItemAttributeValueMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributes'] = $attributes;
$view->path = 'item';
return $view;
}
@ -131,25 +100,23 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-type');
$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);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = ItemAttributeTypeMapper::get()
$view->attribute = ItemAttributeTypeMapper::get()
->with('l11n')
->with('defaults')
->with('defaults/l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
->where('defaults/l11n/language', [$response->header->l11n->language, null])
->execute();
$l11ns = ItemAttributeTypeL11nMapper::getAll()
->where('ref', $attribute->id)
$view->l11ns = ItemAttributeTypeL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
$view->data['attribute'] = $attribute;
$view->data['l11nValues'] = $l11ns;
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
$view->path = 'item';
return $view;
}
@ -168,18 +135,20 @@ final class BackendController extends Controller
*/
public function viewItemManagementAttributeValue(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-value');
$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);
/** @var \Modules\Attribute\Models\AttributeValue $attribute */
$attribute = ItemAttributeValueMapper::get()
$view->attribute = ItemAttributeValueMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
->where('l11n/language', [$response->header->l11n->language, null])
->execute();
$view->data['attribute'] = $attribute;
$view->l11ns = ItemAttributeValueL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
// @todo Also find the ItemAttributeType
return $view;
}
@ -846,7 +815,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/material-type-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002901101, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->data['types'] = MaterialTypeMapper::getAll()
->with('l11n')
@ -872,7 +841,7 @@ final class BackendController extends Controller
{
$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(1002901101, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
$view->data['type'] = MaterialTypeMapper::get()
->with('l11n')

View File

@ -124,6 +124,7 @@ return ['ItemManagement' => [
'Text' => 'Text',
'TimeUnit' => 'Zeiteinheit',
'Title' => 'Titel',
'Defaults' => 'Standard',
'TopCustomers' => 'Top Kunden',
'Tracking' => 'Verfolgung',
'TradingUnit' => 'Handelseinheit',

View File

@ -125,6 +125,7 @@ return ['ItemManagement' => [
'Text' => 'Text',
'TimeUnit' => 'Unit of time',
'Title' => 'Title',
'Defaults' => 'Defaults',
'TopCustomers' => 'Top Customers',
'Tracking' => 'Tracking',
'TradingUnit' => 'Trading Unit',

View File

@ -1,71 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\ItemManagement
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$attributes = $this->data['attributes'];
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('AttributeTypes'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="iAttributeTypeList" class="default sticky">
<thead>
<tr>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="iAttributeTypeList-sort-1">
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-1">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iAttributeTypeList-sort-2">
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-2">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
<i class="filter g-icon">filter_alt</i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iAttributeTypeList-sort-2">
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-2">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iAttributeTypeList-sort-3">
<input type="radio" name="iAttributeTypeList-sort" id="iAttributeTypeList-sort-3">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
<i class="filter g-icon">filter_alt</i>
</label>
<tbody>
<?php
$count = 0;
foreach ($attributes as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/attribute/type?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -1,92 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Tasks
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Attribute\Models\AttributeValueType;
use Modules\Attribute\Models\NullAttributeType;
use phpOMS\Uri\UriFactory;
$types = AttributeValueType::getConstants();
$attribute = $this->data['attribute'] ?? new NullAttributeType();
$isNew = $attribute->id === 0;
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-md-6 col-xs-12">
<section id="task" class="portlet">
<form id="attributeForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item/attribute/type'); ?>">
<div class="portlet-head"><?= $this->getHtml('Attribute', 'Attribute', 'Backend'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" value="<?= $this->printHtml((string) $attribute->id); ?>" disabled>
</div>
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
<input id="iNAme" type="text" value="<?= $this->printHtml($attribute->name); ?>" disabled>
</div>
<div class="form-group">
<label for="iType"><?= $this->getHtml('Datatype', 'Attribute', 'Backend'); ?></label>
<select id="iType" name="type" disabled>
<?php foreach ($types as $key => $type) : ?>
<option value="<?= $type; ?>"<?= $type === $attribute->datatype ? ' selected' : ''; ?>><?= $this->printHtml($key); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iPattern"><?= $this->getHtml('Pattern', 'Attribute', 'Backend'); ?></label>
<input id="iPattern" type="text" value="<?= $this->printHtml($attribute->validationPattern); ?>">
</div>
<div class="form-group">
<label class="checkbox" for="iRequired">
<input id="iRequired" type="checkbox" name="required" value="1"<?= $attribute->isRequired ? ' checked' : ''; ?>>
<span class="checkmark"></span>
<?= $this->getHtml('IsRequired', 'Attribute', 'Backend'); ?>
</label>
</div>
<div class="form-group">
<label class="checkbox" for="iCustom">
<input id="iCustom" type="checkbox" name="custom" value="1" <?= $attribute->custom ? ' checked' : ''; ?>>
<span class="checkmark"></span>
<?= $this->getHtml('CustomValue', 'Attribute', 'Backend'); ?>
</label>
</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 class="row">
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
[],
'{/api}item/attribute/l11n'
);
?>
</div>

View File

@ -48,17 +48,17 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text" placeholder="" required></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text" required></span>
<tr><td><label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="" required>
<tr><td><input id="iSegment" name="segment" type="text" required>
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="" required>
<tr><td><input id="iProductgroup" name="productgroup" type="text" required>
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="" required>
<tr><td><input id="iGroup" name="group" type="text" required>
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="" required>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" required>
<tr><td><label for="iSSuccessor"><?= $this->getHtml('Successor'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
<tr><td><input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-item">
</table>
</form>
@ -78,11 +78,11 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iName"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input id="iName" name="name" type="text" placeholder="">
<tr><td><input id="iName" name="name" type="text">
<tr><td><label for="iName"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input id="iName" name="name" type="text" placeholder="">
<tr><td><input id="iName" name="name" type="text">
<tr><td><label for="iName"><?= $this->getHtml('Name3'); ?></label>
<tr><td><input id="iName" name="name" type="text" placeholder="">
<tr><td><input id="iName" name="name" type="text">
<tr><td><label for="iDescription"><?= $this->getHtml('Description'); ?></label>
<tr><td><textarea id="iDescription" name="description"></textarea>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
@ -102,13 +102,13 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Name'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPTradingUnit"><?= $this->getHtml('Unit'); ?></label>
<tr><td><select id="iPTracking" name="tracking">
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Value'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -125,9 +125,9 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Property'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Translation'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -144,9 +144,9 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Value'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Translation'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -160,13 +160,13 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Name'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPTradingUnit"><?= $this->getHtml('Unit'); ?></label>
<tr><td><select id="iPTracking" name="tracking">
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Value'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -183,9 +183,9 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Attribute'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Translation'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -202,9 +202,9 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Value'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iPCustomsId" name="customsid" type="text"></span>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('Translation'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -224,7 +224,7 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iPrice">GTIN</label>
<tr><td><input id="iPrice" name="price" type="text" placeholder="">
<tr><td><input id="iPrice" name="price" type="text">
<tr><td colspan="2"><label for="iPPriceUnit"><?= $this->getHtml('PriceUnit'); ?></label>
<tr><td><select id="iPPriceUnit" name="ppriceunit">
<option value="0">
@ -234,7 +234,7 @@ echo $this->data['nav']->render(); ?>
<option value="0">
</select><td>
<tr><td><label for="iPTradingUnit"><?= $this->getHtml('TradingUnit'); ?></label>
<tr><td><input id="iPTradingUnit" name="tradingunit" type="number" min="0" step="any" placeholder="">
<tr><td><input id="iPTradingUnit" name="tradingunit" type="number" min="0" step="any">
<tr><td><label for="iPTracking"><?= $this->getHtml('Tracking'); ?></label>
<tr><td><select id="iPTracking" name="tracking">
<option><?= $this->getHtml('None'); ?>
@ -247,7 +247,7 @@ echo $this->data['nav']->render(); ?>
<option value="0">
</select>
<tr><td><label for="iPCustomsId"><?= $this->getHtml('CustomsID'); ?></label>
<tr><td><input id="iPCustomsId" name="customsid" type="text" placeholder="">
<tr><td><input id="iPCustomsId" name="customsid" type="text">
<tr><td><label for="iSInfo"><?= $this->getHtml('Info'); ?></label>
<tr><td><textarea id="iSInfo" name="sinfo"></textarea>
</table>
@ -262,7 +262,7 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iPName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder=""><td>
<tr><td><input id="iPName" name="pname" type="text"><td>
<tr><td colspan="2"><label for="iPrice"><?= $this->getHtml('Start'); ?></label>
<tr><td><input id="iPrice" name="price" type="datetime-local"><td>
<tr><td colspan="2"><label for="iPrice"><?= $this->getHtml('End'); ?></label>
@ -272,17 +272,17 @@ echo $this->data['nav']->render(); ?>
<option>
</select><td>
<tr><td colspan="2"><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iPQuantity" name="quantity" type="text" placeholder=""><td>
<tr><td><input id="iPQuantity" name="quantity" type="text"><td>
<tr><td colspan="2"><label for="iPrice"><?= $this->getHtml('Price'); ?></label>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0"><td>
<tr><td colspan="2"><label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0"><td>
<tr><td colspan="2"><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0"><td>
<tr><td colspan="2"><label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0"><td>
<tr><td colspan="2"><label for="iGroup"><?= $this->getHtml('ClientGroup'); ?></label>
<tr><td><input id="iGroup" name="price" type="text" placeholder=""><td><button><?= $this->getHtml('Add', '0', '0'); ?></button>
<tr><td><input id="iGroup" name="price" type="text"><td><button><?= $this->getHtml('Add', '0', '0'); ?></button>
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -298,9 +298,9 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iSupplierId"><?= $this->getHtml('Supplier'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSupplierId" name="supplierid" type="text" placeholder="" required></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSupplierId" name="supplierid" type="text" required></span>
<tr><td><label for="iPrice">GTIN</label>
<tr><td><input id="iPrice" name="price" type="text" placeholder="">
<tr><td><input id="iPrice" name="price" type="text">
<tr><td><label for="iPPriceUnit"><?= $this->getHtml('PriceUnit'); ?></label>
<tr><td><select id="iPPriceUnit" name="ppriceunit">
<option value="0">
@ -310,7 +310,7 @@ echo $this->data['nav']->render(); ?>
<option value="0">
</select><td>
<tr><td><label for="iPTradingUnit"><?= $this->getHtml('TradingUnit'); ?></label>
<tr><td><input id="iPTradingUnit" name="tradingunit" type="number" min="0" step="any" placeholder="">
<tr><td><input id="iPTradingUnit" name="tradingunit" type="number" min="0" step="any">
<tr><td><label for="iPTracking"><?= $this->getHtml('Tracking'); ?></label>
<tr><td><select id="iPTracking" name="tracking">
<option><?= $this->getHtml('None'); ?>
@ -331,17 +331,17 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder="">
<tr><td><input id="iPName" name="pname" type="text">
<tr><td><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iPQuantity" name="quantity" type="text" placeholder="">
<tr><td><input id="iPQuantity" name="quantity" type="text">
<tr><td><label for="iPrice"><?= $this->getHtml('Price'); ?></label>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0" placeholder=""><td>
<tr><td><input id="iPrice" name="price" type="number" step="any" min="0"><td>
<tr><td><label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscountP" name="discountp" type="number" step="any" min="0">
<tr><td><label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iBonus" name="bonus" type="number" step="any" min="0">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -359,13 +359,13 @@ echo $this->data['nav']->render(); ?>
<option value="0">
</select>
<tr><td><label for="iPName"><?= $this->getHtml('ReorderLevel'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder="">
<tr><td><input id="iPName" name="pname" type="text">
<tr><td><label for="iPName"><?= $this->getHtml('MinimumLevel'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder="">
<tr><td><input id="iPName" name="pname" type="text">
<tr><td><label for="iPName"><?= $this->getHtml('MaximumLevel'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder="">
<tr><td><input id="iPName" name="pname" type="text">
<tr><td><label for="iPName"><?= $this->getHtml('Leadtime'); ?></label>
<tr><td><input id="iPName" name="pname" type="number" min="0" step="1" placeholder="">
<tr><td><input id="iPName" name="pname" type="number" min="0" step="1">
<tr><td><input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
</table>
</form>
@ -379,7 +379,7 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iPName"><?= $this->getHtml('Name'); ?></label>
<tr><td><input id="iPName" name="pname" type="text" placeholder="">
<tr><td><input id="iPName" name="pname" type="text">
<tr><td><label for="iPName"><?= $this->getHtml('Description'); ?></label>
<tr><td><textarea></textarea>
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
@ -397,13 +397,13 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td colspan="2"><label for="iACostIndicator"><?= $this->getHtml('CostIndicator'); ?></label>
<tr><td><input id="iACostIndicator" name="costindicator" type="text" placeholder="">
<tr><td><input id="iACostIndicator" name="costindicator" type="text">
<tr><td colspan="2"><label for="iAEarningIndicator"><?= $this->getHtml('EarningIndicator'); ?></label>
<tr><td><input id="iAEarningIndicator" name="earningindicator" type="text" placeholder="">
<tr><td><input id="iAEarningIndicator" name="earningindicator" type="text">
<tr><td colspan="2"><label for="iACostIndicator"><?= $this->getHtml('CostCenter'); ?></label>
<tr><td><input id="iACostIndicator" name="costindicator" type="text" placeholder="">
<tr><td><input id="iACostIndicator" name="costindicator" type="text">
<tr><td colspan="2"><label for="iAEarningIndicator"><?= $this->getHtml('CostObject'); ?></label>
<tr><td><input id="iAEarningIndicator" name="earningindicator" type="text" placeholder="">
<tr><td><input id="iAEarningIndicator" name="earningindicator" type="text">
</table>
</form>
</div>
@ -422,7 +422,7 @@ echo $this->data['nav']->render(); ?>
<option>
</select>
<tr><td><label for="iDiscount"><?= $this->getHtml('Makespan'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iPType"><?= $this->getHtml('TimeUnit'); ?></label>
<tr><td><select id="iPType" name="ptye">
<option value="0">ms
@ -448,9 +448,9 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iSource"><?= $this->getHtml('ID'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
<tr><td><label for="iDiscount"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -483,19 +483,19 @@ echo $this->data['nav']->render(); ?>
<option value="0">
</select>
<tr><td><label for="iDiscount"><?= $this->getHtml('Quantity'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('GrossWeight'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('NetWeight'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('Width'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('Height'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('Length'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><label for="iDiscount"><?= $this->getHtml('Volume'); ?></label>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>

View File

@ -26,6 +26,7 @@ use phpOMS\Localization\ISO639Enum;
use phpOMS\Localization\Money;
use phpOMS\Localization\RegionEnum;
use phpOMS\Message\Http\HttpHeader;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\Stdlib\Base\SmartDateTime;
use phpOMS\Uri\UriFactory;
@ -257,16 +258,7 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('Date'); ?>
<tbody>
<?php
$newestInvoices = SalesBillMapper::getAll()
->with('client')
->with('client/account')
->with('type')
->with('type/l11n')
->where('type/transferType', BillTransferType::SALES)
->where('type/l11n/language', $this->response->header->l11n->language)
->sort('id', OrderType::DESC)
->limit(5)
->execute();
$newestInvoices = SalesBillMapper::getItemBills($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'), 5);
$count = 0;
@ -280,7 +272,7 @@ echo $this->data['nav']->render();
<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 href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->performanceDate->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
@ -293,7 +285,7 @@ echo $this->data['nav']->render();
<?php endif; ?>
<?php if ($this->data['hasBilling']) :
$topCustomers = SalesBillMapper::getItemTopClients($item->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now'), 5);
$topCustomers = SalesBillMapper::getItemTopClients($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'), 5);
?>
<div class="row">
<?php if (!empty($topCustomers[0])) : ?>
@ -313,7 +305,7 @@ echo $this->data['nav']->render();
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->account->name1); ?> <?= $this->printHtml($client->account->name2); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/view?{?}&id=' . $client->id); ?>"><?= $this->printHtml($client->account->name1); ?> <?= $this->printHtml($client->account->name2); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->country); ?></a>
<td><a href="<?= $url; ?>"><?= (new Money((int) $topCustomers[1][$i]['net_sales']))->getCurrency(); ?></a>
<?php endforeach; ?>
@ -329,7 +321,8 @@ echo $this->data['nav']->render();
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Sales'); ?></div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
<div style="position: relative; width: 100%; height: 100%; aspect-ratio: 2;">
<canvas id="sales-history" data-chart='{
"type": "bar",
"data": {
"labels": [
@ -366,7 +359,7 @@ echo $this->data['nav']->render();
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = ((int) $monthly['net_sales']) / 1000;
$temp[] = ((int) $monthly['net_sales']) / 10000;
}
?>
<?= \implode(',', $temp); ?>
@ -383,7 +376,10 @@ echo $this->data['nav']->render();
"id": "axis1",
"display": true,
"position": "left",
"suggestedMin": 0
"suggestedMin": 0,
"ticks": {
"precision": 0
}
},
"axis2": {
"id": "axis2",
@ -406,61 +402,31 @@ echo $this->data['nav']->render();
}
}
}'></canvas>
</div>
</div>
</section>
</div>
<?php endif; ?>
<?php
$regionSales = [];
if (!empty($regionSales)) : ?>
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head">Regions</div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "pie",
"data": {
"labels": [
"Europe", "America", "Asia", "Africa", "CIS", "Other"
],
"datasets": [{
"data": [
<?= (int) ($regionSales['Europe'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['America'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Asia'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Africa'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['CIS'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Other'] ?? 0) / 1000; ?>
],
"backgroundColor": [
"rgb(255, 99, 132)",
"rgb(255, 159, 64)",
"rgb(255, 205, 86)",
"rgb(75, 192, 192)",
"rgb(54, 162, 235)",
"rgb(153, 102, 255)"
]
}]
}
}'></canvas>
</div>
</section>
</div>
<?php endif; ?>
<?php
$countrySales = SalesBillMapper::getItemCountrySales($item->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now'), 5);
$countrySales = SalesBillMapper::getItemCountrySales($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'), 5);
if (!empty($countrySales)) : ?>
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Countries'); ?></div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
<div style="position: relative; width: 100%; height: 100%; aspect-ratio: 2;">
<canvas id="sales-countries" data-chart='{
"type": "bar",
"data": {
"labels": [
<?= '"' . \implode('", "', \array_keys($countrySales)) . '"'; ?>
<?php
$temp = [];
foreach ($countrySales as $country) {
$temp[] = ISO3166NameEnum::getBy2Code($country['country']);
}
?>
<?= '"' . \implode('", "', $temp) . '"'; ?>
],
"datasets": [{
"label": "YTD",
@ -469,7 +435,7 @@ echo $this->data['nav']->render();
<?php
$temp = [];
foreach ($countrySales as $country) {
$temp[] = ((int) $country) / 1000;
$temp[] = (float) (((int) $country['net_sales']) / FloatInt::DIVISOR);
}
?>
<?= \implode(',', $temp); ?>
@ -485,11 +451,15 @@ echo $this->data['nav']->render();
"id": "axis1",
"display": true,
"position": "left",
"suggestedMin": 0
"suggestedMin": 0,
"ticks": {
"precision": 0
}
}
}
}
}'></canvas>
}'></canvas>
</div>
</div>
</section>
</div>
@ -505,7 +475,7 @@ echo $this->data['nav']->render();
<?= $l11nView->render(
$this->data['l11nValues'],
$this->data['l11nTypes'] ?? [],
'{/api}item/l11n'
'{/api}item/l11n?csrf={$CSRF}'
);
?>
</div>
@ -518,7 +488,7 @@ echo $this->data['nav']->render();
$item->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}item/attribute',
'{/api}item/attribute?csrf={$CSRF}',
$item->id
);
?>
@ -530,7 +500,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemContainerForm" action="<?= UriFactory::build('{/api}bill/price'); ?>" method="post"
<form id="itemContainerForm" action="<?= UriFactory::build('{/api}bill/price?csrf={$CSRF}'); ?>" method="post"
data-ui-container="#itemContainerTable tbody"
data-add-form="itemContainerForm"
data-add-tpl="#itemContainerTable tbody .oms-add-tpl-itemContainer">
@ -669,7 +639,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemSalesPriceForm" action="<?= UriFactory::build('{/api}bill/price'); ?>" method="post"
<form id="itemSalesPriceForm" action="<?= UriFactory::build('{/api}bill/price?csrf={$CSRF}'); ?>" method="post"
data-ui-container="#itemSalesPriceTable tbody"
data-add-form="itemSalesPriceForm"
data-add-tpl="#itemSalesPriceTable tbody .oms-add-tpl-itemSalesPrice">
@ -1020,7 +990,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemProcurementForm" action="<?= UriFactory::build('{/api}item/procurement'); ?>" method="post">
<form id="itemProcurementForm" action="<?= UriFactory::build('{/api}item/procurement?csrf={$CSRF}'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Procurement'); ?></div>
<div class="portlet-body">
<div class="form-group">
@ -1032,14 +1002,14 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPName"><?= $this->getHtml('MinimumLevel'); ?></label>
<input id="iPName" name="pname" type="text" placeholder="">
<input id="iPName" name="pname" type="text">
</div>
</div>
<div>
<div class="form-group">
<label for="iPName"><?= $this->getHtml('MaximumLevel'); ?></label>
<input id="iPName" name="pname" type="text" placeholder="">
<input id="iPName" name="pname" type="text">
</div>
</div>
</div>
@ -1048,14 +1018,14 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPName"><?= $this->getHtml('MaximumOrderInterval'); ?></label>
<input id="iPName" name="pname" type="text" placeholder="">
<input id="iPName" name="pname" type="text">
</div>
</div>
<div>
<div class="form-group">
<label for="iPName"><?= $this->getHtml('MinimumOrderQuantity'); ?></label>
<input id="iPName" name="pname" type="text" placeholder="">
<input id="iPName" name="pname" type="text">
</div>
</div>
</div>
@ -1069,7 +1039,7 @@ echo $this->data['nav']->render();
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemPurchasePriceForm" action="<?= UriFactory::build('{/api}bill/price'); ?>" method="post"
<form id="itemPurchasePriceForm" action="<?= UriFactory::build('{/api}bill/price?csrf={$CSRF}'); ?>" method="post"
data-ui-container="#itemPurchasePriceTable tbody"
data-add-form="itemPurchasePriceForm"
data-add-tpl="#itemPurchasePriceTable tbody .oms-add-tpl-itemPurchasePrice">
@ -1261,7 +1231,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemAccounting" action="<?= UriFactory::build('{/api}item/accounting'); ?>" method="post">
<form id="itemAccounting" action="<?= UriFactory::build('{/api}item/accounting?csrf={$CSRF}'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Accounting'); ?></div>
<div class="portlet-body">
<div class="form-group">
@ -1332,7 +1302,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="itemAccounting" action="<?= UriFactory::build('{/api}item/stock'); ?>" method="post">
<form id="itemAccounting" action="<?= UriFactory::build('{/api}item/stock?csrf={$CSRF}'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Stock'); ?></div>
<div class="portlet-body">
<!--
@ -1429,6 +1399,7 @@ echo $this->data['nav']->render();
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Net'); ?>
<td><?= $this->getHtml('Date'); ?>
<td><?= $this->getHtml('Created'); ?>
<tbody>
<?php
$allInvoices = SalesBillMapper::getItemBills($item->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now'));
@ -1445,6 +1416,7 @@ echo $this->data['nav']->render();
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $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>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
@ -1509,10 +1481,12 @@ echo $this->data['nav']->render();
<?php endif; ?>
</table>
</div>
<!--
<div class="portlet-foot">
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
</div>
-->
</div>
</div>
</div>

View File

@ -25,12 +25,12 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="materialForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item/material'); ?>">
<form id="materialForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item/material?csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Material'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name'); ?></label>
<input type="text" name="code" id="iName" placeholder="" value="<?= $this->printHtml($type->title); ?>">
<input type="text" name="code" id="iName" value="<?= $this->printHtml($type->title); ?>">
</div>
</div>
@ -51,7 +51,7 @@ echo $this->data['nav']->render(); ?>
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
[],
'{/api}item/material/l11n'
'{/api}item/material/l11n?csrf={$CSRF}'
);
?>
</div>