started with template fixes

This commit is contained in:
Dennis Eichhorn 2024-03-29 15:26:00 +00:00
parent da15426b38
commit 6e34f86530
12 changed files with 244 additions and 230 deletions

View File

@ -6,6 +6,13 @@
"virtualPath": "/Modules",
"user": 1
},
{
"type": "collection",
"create_directory": true,
"name": "Clients",
"virtualPath": "/Modules/ClientManagement",
"user": 1
},
{
"type": "type",
"name": "client_profile_image",

View File

@ -245,7 +245,7 @@
{ "value": "FI" },
{ "value": "FR" },
{ "value": "DE" },
{ "value": "DE_0" },
{ "value": "DE_S" },
{ "value": "GR" },
{ "value": "HU" },
{ "value": "IE" },
@ -264,6 +264,7 @@
{ "value": "SE" },
{ "value": "GB" },
{ "value": "INT" },
{ "value": "EU_S" },
{ "value": "EU" }
]
},

View File

@ -22,6 +22,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiController:apiClientFind',
'verb' => RouteVerb::GET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -33,6 +34,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -42,6 +44,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -53,6 +56,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeTypeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -62,6 +66,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeTypeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -73,6 +78,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeTypeL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -82,6 +88,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeTypeL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -93,6 +100,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeValueCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -102,6 +110,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeValueUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -109,10 +118,11 @@ return [
],
],
],
'^.*/client/attribute/value$' => [
'^.*/client/attribute/value/l11n$' => [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeValueL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -122,6 +132,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiAttributeController:apiClientAttributeValueL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -133,6 +144,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiController:apiClientL11nCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -142,6 +154,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiController:apiClientL11nUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -153,6 +166,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiController:apiClientL11nTypeCreate',
'verb' => RouteVerb::PUT,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
@ -162,6 +176,7 @@ return [
[
'dest' => '\Modules\ClientManagement\Controller\ApiController:apiClientL11nTypeUpdate',
'verb' => RouteVerb::SET,
'csrf' => true,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,

View File

@ -25,18 +25,51 @@ return [
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::CLIENT,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^.*/sales/client/attribute/type(\?.*$|$)' => [
'^.*/sales/client/attribute/type/view(\?.*$|$)' => [
[
'dest' => '\Modules\ClientManagement\Controller\BackendController:viewClientManagementAttributeType',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::CLIENT,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^.*/sales/client/attribute/type/create(\?.*$|$)' => [
[
'dest' => '\Modules\ClientManagement\Controller\BackendController:viewClientManagementAttributeType',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^.*/sales/client/attribute/value/view(\?.*$|$)' => [
[
'dest' => '\Modules\ClientManagement\Controller\BackendController:viewClientManagementAttributeValue',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],
'^.*/sales/client/attribute/value/create(\?.*$|$)' => [
[
'dest' => '\Modules\ClientManagement\Controller\BackendController:viewClientManagementAttributeValueCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::ATTRIBUTE,
],
],
],

View File

@ -48,6 +48,7 @@ omsApp.Modules.ClientManagement = class {
const self = this;
const data = JSON.parse(chart.getAttribute('data-chart'));
/** global: Chart */
const myChart = new Chart(chart.getContext('2d'), data);
};
@ -60,6 +61,7 @@ omsApp.Modules.ClientManagement = class {
return;
}
/** global: OpenLayers */
const mapObj = new OpenLayers.Map(map.getAttribute('id'), {
controls: [
new OpenLayers.Control.Navigation(

View File

@ -27,6 +27,8 @@ use Modules\ClientManagement\Models\ClientL11nTypeMapper;
use Modules\ClientManagement\Models\ClientMapper;
use Modules\ClientManagement\Models\PermissionCategory;
use Modules\ClientManagement\Models\SettingsEnum;
use Modules\Media\Models\Collection;
use Modules\Media\Models\CollectionMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\PathSettings;
use Modules\Organization\Models\UnitMapper;
@ -239,6 +241,10 @@ final class ApiController extends Controller
$request->getOrigin()
);
// Create media dir
// @todo should this collection get added to the parent collection?
$this->createMediaDirForClient($client->id, $request->header->account);
// Create stock
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
$internalResponse = new HttpResponse();
@ -276,6 +282,29 @@ final class ApiController extends Controller
$this->createStandardCreateResponse($request, $response, $client);
}
/**
* Create directory for an account
*
* @param int $id Item number
* @param int $createdBy Creator of the directory
*
* @return Collection
*
* @since 1.0.0
*/
private function createMediaDirForClient(int $id, int $createdBy) : Collection
{
$collection = new Collection();
$collection->name = $id;
$collection->setVirtualPath('/Modules/ClientManagement/Clients');
$collection->setPath('/Modules/Media/Files/Modules/ClientManagement/Clients/' . $id);
$collection->createdBy = new NullAccount($createdBy);
CollectionMapper::create()->execute($collection);
return $collection;
}
/**
* Create client segmentation.
*
@ -600,8 +629,8 @@ final class ApiController extends Controller
fileNames: $request->getDataList('filenames'),
files: $uploadedFiles,
account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ClientManagement/' . ($request->getData('client') ?? '0'),
virtualPath: '/Modules/ClientManagement/' . ($request->getData('client') ?? '0'),
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ClientManagement/Clients/' . ($request->getData('client') ?? '0'),
virtualPath: '/Modules/ClientManagement/Clients/' . ($request->getData('client') ?? '0'),
pathSettings: PathSettings::FILE_PATH
);
@ -650,7 +679,7 @@ final class ApiController extends Controller
*/
public function apiNoteCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
$request->setData('virtualpath', '/Modules/ClientManagement/' . ((int) $request->getData('id')), true);
$request->setData('virtualpath', '/Modules/ClientManagement/Clients/' . ((int) $request->getData('id')), true);
$this->app->moduleManager->get('Editor')->apiEditorCreate($request, $response, $data);
$responseData = $response->getDataArray($request->uri->__toString());

View File

@ -62,17 +62,15 @@ final class BackendController extends Controller
*/
public function viewClientManagementAttributeTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeListView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = ClientAttributeTypeMapper::getAll()
$view->attributes = ClientAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributes'] = $attributes;
$view->path = 'sales/client';
return $view;
}
@ -93,7 +91,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-value-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
$attributes = ClientAttributeValueMapper::getAll()
@ -120,23 +118,55 @@ final class BackendController extends Controller
*/
public function viewClientManagementAttributeType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ClientManagement/Theme/Backend/attribute-type');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view = new \Modules\Attribute\Theme\Backend\Components\AttributeTypeView($this->app->l11nManager, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1003101001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = ClientAttributeTypeMapper::get()
$view->attribute = ClientAttributeTypeMapper::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 = ClientAttributeTypeL11nMapper::getAll()
->where('ref', $attribute->id)
$view->l11ns = ClientAttributeTypeL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
$view->data['attribute'] = $attribute;
$view->data['l11ns'] = $l11ns;
$view->path = 'sales/client';
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 viewClientManagementAttributeValue(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(1003101001, $request, $response);
$view->attribute = ClientAttributeValueMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', [$response->header->l11n->language, null])
->execute();
$view->l11ns = ClientAttributeValueL11nMapper::getAll()
->where('ref', $view->attribute->id)
->execute();
// @todo Also find the ItemAttributeType
return $view;
}

View File

@ -32,5 +32,7 @@ abstract class PermissionCategory extends Enum
public const CLIENT_NOTE = 3;
public const ATTRIBUTE = 4;
public const CLIENT_LOG = 101;
}

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}/sales/client/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,98 +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 phpOMS\Localization\ISO639Enum;
$types = AttributeValueType::getConstants();
$attribute = $this->data['attribute'];
$l11ns = $this->data['l11ns'];
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-md-6 col-xs-12">
<section id="task" class="portlet">
<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>
</section>
</div>
<div class="col-xs-12 col-md-6">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Language', '0', '0'); ?><i class="g-icon download btn end-xs">download</i></div>
<table class="default sticky">
<thead>
<tr>
<td>
<td>
<td><?= $this->getHtml('Language', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Title', 'Attribute', 'Backend'); ?>
<tbody>
<?php $c = 0; foreach ($l11ns as $key => $value) : ++$c; ?>
<tr>
<td><a href="#"><i class="g-icon">close</i></a>
<td><a href="#"><i class="g-icon">settings</i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
<td><?= $value->content; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>

View File

@ -44,11 +44,11 @@ echo $this->data['nav']->render(); ?>
<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="number" id="iId" min="1" name="id" required></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" placeholder="" required>
<tr><td><input type="text" id="iName1" name="name1" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input type="text" id="iName2" name="name2" placeholder="">
<tr><td><input type="text" id="iName2" name="name2">
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
<tr><td><input type="text" id="iName3" name="name3" placeholder="">
<tr><td><input type="text" id="iName3" name="name3">
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-client">
</table>
</form>
@ -134,15 +134,15 @@ echo $this->data['nav']->render(); ?>
<form>
<table class="layout wf-100">
<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="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><label for="iTerm"><?= $this->getHtml('Type'); ?></label>
<tr><td><select id="iTerm" name="term" required>
<option>
@ -193,25 +193,25 @@ echo $this->data['nav']->render(); ?>
<option>
</select><td>
<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="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><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><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=""><td>
<tr><td><input id="iDiscount" name="discount" type="number" step="any" min="0"><td>
<tr><td><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><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><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
@ -231,17 +231,17 @@ echo $this->data['nav']->render(); ?>
<table class="layout wf-100">
<tbody>
<tr><td><label for="iManager"><?= $this->getHtml('AreaManager'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iManager" name="source" type="text" placeholder=""></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iManager" name="source" type="text"></span>
<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="iSegment"><?= $this->getHtml('Segment'); ?></label>
<tr><td><input id="iSegment" name="segment" type="text" placeholder="">
<tr><td><input id="iSegment" name="segment" type="text">
<tr><td><label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<tr><td><input id="iProductgroup" name="productgroup" type="text" placeholder="">
<tr><td><input id="iProductgroup" name="productgroup" type="text">
<tr><td><label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<tr><td><input id="iGroup" name="group" type="text" placeholder="">
<tr><td><input id="iGroup" name="group" type="text">
<tr><td><label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<tr><td><input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<tr><td><input id="iArticlegroup" name="articlegroup" type="text">
<tr><td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>

View File

@ -25,6 +25,7 @@ use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\ISO639Enum;
use phpOMS\Localization\RegionEnum;
use phpOMS\Message\Http\HttpHeader;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\Stdlib\Base\SmartDateTime;
use phpOMS\Uri\UriFactory;
@ -373,7 +374,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->createdAt->format('Y-m-d'); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->performanceDate->format('Y-m-d'); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
@ -388,11 +389,65 @@ echo $this->data['nav']->render();
<?php if ($this->data['hasBilling']) :
$monthlySalesCosts = SalesBillMapper::getClientMonthlySalesCosts($client->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
?>
<?php if (!empty($monthlySalesCosts)) : ?>
<div class="row">
<?php $segmentSales = SalesBillMapper::getClientAttributeNetSales($client->id, 'segment', 'en', (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now')); ?>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Segments'); ?></div>
<div class="portlet-body"></div>
<div class="portlet-body">
<div style="position: relative; width: 100%; height: 100%; aspect-ratio: 2;">
<canvas id="sales-region" data-chart='{
"type": "bar",
"data": {
"labels": [
<?php
$temp = [];
foreach ($segmentSales as $segment) {
$temp[] = $segment['title'];
}
?>
<?= '"' . \implode('", "', $temp) . '"'; ?>
],
"datasets": [
{
"label": "<?= $this->getHtml('Sales'); ?>",
"type": "bar",
"data": [
<?php
$temp = [];
foreach ($segmentSales as $segment) {
$temp[] = (float) (((int) $segment['net_sales']) / FloatInt::DIVISOR);
}
?>
<?= \implode(',', $temp); ?>
],
"yAxisID": "axis1",
"backgroundColor": "rgb(54, 162, 235)"
}
]
},
"options": {
"responsive": true,
"scales": {
"axis1": {
"id": "axis1",
"display": true,
"position": "left",
"ticks": {
"precision": 0
}
}
},
"plugins": {
"legend": {
"display": false
}
}
}
}'></canvas>
</div>
</div>
</section>
</div>
@ -400,6 +455,7 @@ echo $this->data['nav']->render();
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Sales'); ?></div>
<div class="portlet-body">
<div style="position: relative; width: 100%; height: 100%; aspect-ratio: 2;">
<canvas id="sales-region" data-chart='{
"type": "bar",
"data": {
@ -437,7 +493,7 @@ echo $this->data['nav']->render();
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = (float) (((int) $monthly['net_sales']) / 1000);
$temp[] = (float) (((int) $monthly['net_sales']) / FloatInt::DIVISOR);
}
?>
<?= \implode(',', $temp); ?>
@ -453,7 +509,10 @@ echo $this->data['nav']->render();
"axis1": {
"id": "axis1",
"display": true,
"position": "left"
"position": "left",
"ticks": {
"precision": 0
}
},
"axis2": {
"id": "axis2",
@ -476,11 +535,13 @@ echo $this->data['nav']->render();
}
}
}'></canvas>
</div>
</div>
</section>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
</div>
@ -521,27 +582,27 @@ echo $this->data['nav']->render();
<div class="portlet-body">
<div class="form-group">
<label for="iSource"><?= $this->getHtml('ID', '0', '0'); ?></label>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text" placeholder=""></span>
<span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input id="iSource" name="source" type="text"></span>
</div>
<div class="form-group">
<label for="iSegment"><?= $this->getHtml('Segment'); ?></label>
<input id="iSegment" name="segment" type="text" placeholder="">
<input id="iSegment" name="segment" type="text">
</div>
<div class="form-group">
<label for="iProductgroup"><?= $this->getHtml('Productgroup'); ?></label>
<input id="iProductgroup" name="productgroup" type="text" placeholder="">
<input id="iProductgroup" name="productgroup" type="text">
</div>
<div class="form-group">
<label for="iGroup"><?= $this->getHtml('Group'); ?></label>
<input id="iGroup" name="group" type="text" placeholder="">
<input id="iGroup" name="group" type="text">
</div>
<div class="form-group">
<label for="iArticlegroup"><?= $this->getHtml('Articlegroup'); ?></label>
<input id="iArticlegroup" name="articlegroup" type="text" placeholder="">
<input id="iArticlegroup" name="articlegroup" type="text">
</div>
<div class="form-group">
@ -568,7 +629,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="clientSalesPriceForm" action="<?= UriFactory::build('{/api}bill/price'); ?>" method="post"
<form id="clientSalesPriceForm" action="<?= UriFactory::build('{/api}bill/price?csrf={$CSRF}'); ?>" method="post"
data-ui-container="#clientSalesPriceTable tbody"
data-add-form="clientSalesPriceForm"
data-add-tpl="#clientSalesPriceTable tbody .oms-add-tpl-clientSalesPrice">
@ -921,7 +982,7 @@ echo $this->data['nav']->render();
$client->attributes,
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}client/attribute',
'{/api}client/attribute?csrf={$CSRF}',
$client->id
);
?>
@ -948,6 +1009,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 = BillMapper::getAll()
@ -956,7 +1018,6 @@ echo $this->data['nav']->render();
->where('client', $client->id)
->where('type/l11n/language', $this->response->header->l11n->language)
->where('billDate', SmartDateTime::startOfYear($this->data['business_start']), '>=')
->where('billDate', new \DateTime('now'), '<=')
->execute();
$count = 0;
@ -970,6 +1031,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) : ?>
@ -987,7 +1049,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">
@ -1245,10 +1307,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>