make id public, organigram impl. media password/encryption, settings bug fix, Money->FloatInt change, ...

This commit is contained in:
Dennis Eichhorn 2023-05-06 11:42:06 +00:00
parent 5b3e51c237
commit 203eccb933
30 changed files with 902 additions and 377 deletions

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Admin;
use Modules\Attribute\Models\AttributeTypeMapper;
use Modules\Attribute\Models\AttributeValue;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
@ -139,7 +138,7 @@ final class Installer extends InstallerAbstract
continue;
}
$itemId = $responseData['response']->getId();
$itemId = $responseData['response']->id;
$itemArray[] = !\is_array($responseData['response'])
? $responseData['response']->toArray()
@ -154,7 +153,7 @@ final class Installer extends InstallerAbstract
$request->header->account = 1;
$request->setData('item', $itemId);
$request->setData('type', $l11nType->getId());
$request->setData('type', $l11nType->id);
$request->setData('language', (string) $language);
$request->setData('description', (string) $l11n);
@ -170,7 +169,7 @@ final class Installer extends InstallerAbstract
$request->header->account = 1;
$request->setData('item', $itemId);
$request->setData('type', $attrType->getId());
$request->setData('type', $attrType->id);
if ($attribute['custom'] ?? true) {
$request->setData('custom', $attribute['value']);
@ -202,7 +201,7 @@ final class Installer extends InstallerAbstract
|| $val->valueInt === $value
|| $val->valueDec === $value
) {
return $val->getId();
return $val->id;
}
}
@ -318,7 +317,7 @@ final class Installer extends InstallerAbstract
$request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('is_custom_allowed', $attribute['is_custom_allowed'] ?? false);
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
$request->setData('datatype', (int) $attribute['value_type']);

View File

@ -28,5 +28,25 @@ return [
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/item/attribute.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemAttributeCreate',
'verb' => RouteVerb::PUT,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemAttributeUpdate',
'verb' => RouteVerb::SET,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
]
];

View File

@ -45,7 +45,6 @@ use Modules\Media\Models\PathSettings;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\Money;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode;
@ -53,6 +52,7 @@ use phpOMS\Message\NotificationLevel;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Model\Message\FormValidation;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\System\MimeType;
use phpOMS\Uri\HttpUri;
@ -138,7 +138,7 @@ final class ApiController extends Controller
private function createItemDir(Item $item) : string
{
return '/Modules/ItemManagement/Item/'
. $item->getId();
. $item->id;
}
/**
@ -177,7 +177,7 @@ final class ApiController extends Controller
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('name', 'base_price');
$internalRequest->setData('item', $item->getId());
$internalRequest->setData('item', $item->id);
$internalRequest->setData('price', $request->getDataInt('salesprice') ?? 0);
$billing->apiPriceCreate($internalRequest, $internalResponse);
@ -208,8 +208,8 @@ final class ApiController extends Controller
$this->createModelRelation(
$request->header->account,
$uploaded[0]->getId(),
$profileImageType->getId(),
$uploaded[0]->id,
$profileImageType->id,
MediaMapper::class,
'types',
'',
@ -219,8 +219,8 @@ final class ApiController extends Controller
// create item relation
$this->createModelRelation(
$request->header->account,
$item->getId(),
$uploaded[0]->getId(),
$item->id,
$uploaded[0]->id,
ItemMapper::class,
'files',
'',
@ -267,8 +267,8 @@ final class ApiController extends Controller
{
$item = new Item();
$item->number = $request->getDataString('number') ?? '';
$item->salesPrice = new Money($request->getDataInt('salesprice') ?? 0);
$item->purchasePrice = new Money($request->getDataInt('purchaseprice') ?? 0);
$item->salesPrice = new FloatInt($request->getDataInt('salesprice') ?? 0);
$item->purchasePrice = new FloatInt($request->getDataInt('purchaseprice') ?? 0);
$item->info = $request->getDataString('info') ?? '';
$item->parent = $request->getDataInt('parent');
$item->unit = $request->getDataInt('unit');
@ -336,7 +336,7 @@ final class ApiController extends Controller
{
$item = new ItemPrice();
$item->currency = $request->getDataString('currency') ?? '';
$item->price = new Money($request->getDataInt('price') ?? 0);
$item->price = new FloatInt($request->getDataInt('price') ?? 0);
$item->minQuantity = $request->getDataInt('minquantity') ?? 0;
$item->relativeDiscount = $request->getDataInt('relativediscount') ?? 0;
$item->absoluteDiscount = $request->getDataInt('absolutediscount') ?? 0;
@ -450,6 +450,96 @@ final class ApiController extends Controller
return [];
}
/**
* Api method to create item attribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemAttributeUpdate(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if (!empty($val = $this->validateItemAttributeUpdate($request))) {
$response->set('attribute_update', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
return;
}
$old = ItemAttributeMapper::get()
->with('type')
->with('type/defaults')
->with('value')
->where('id', (int) $request->getData('id'))
->execute();
$new = $this->updateItemAttributeFromRequest($request, $old->deepClone());
$this->updateModel($request->header->account, $old, $new, ItemAttributeMapper::class, 'attribute', $request->getOrigin());
if ($new->value->getValue() !== $old->value->getValue()) {
$this->updateModel($request->header->account, $old->value, $new->value, ItemAttributeValueMapper::class, 'attribute_value', $request->getOrigin());
}
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Attribute', 'Attribute successfully updated', $new);
}
/**
* Method to create item attribute from request.
*
* @param RequestAbstract $request Request
*
* @return Attribute
*
* @since 1.0.0
*/
private function updateItemAttributeFromRequest(RequestAbstract $request, Attribute $attribute) : Attribute
{
if ($attribute->type->custom) {
if ($request->hasData('value')) {
// @question: we are overwriting the old value, could there be a use case where we want to create a new value and keep the old one?
$attribute->value->setValue($request->getData('value'), $attribute->type->datatype);
}
} else {
if ($request->hasData('value')) {
// @todo: fix by only accepting the value id to be used
// this is a workaround for now because the front end doesn't allow to dynamically show default values.
$value = $attribute->type->getDefaultByValue($request->getData('value'));
if ($value->id !== 0) {
$attribute->value = $attribute->type->getDefaultByValue($request->getData('value'));
}
}
}
return $attribute;
}
/**
* Validate item attribute create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateItemAttributeUpdate(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))
) {
return $val;
}
return [];
}
/**
* Api method to create item attribute l11n
*
@ -619,7 +709,7 @@ final class ApiController extends Controller
$this->createModelRelation(
$request->header->account,
(int) $request->getData('type'),
$attrValue->getId(),
$attrValue->id,
ItemAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
);
}
@ -744,6 +834,33 @@ final class ApiController extends Controller
return [];
}
/**
* Api method to handle api item attributes
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemAttribute(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if (!empty($val = $this->validateItemAttributeValueL11nCreate($request))) {
$response->set('attr_value_l11n_create', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
return;
}
$attrL11n = $this->createAttributeValueL11nFromRequest($request);
$this->createModel($request->header->account, $attrL11n, ItemAttributeValueL11nMapper::class, 'attr_value_l11n', $request->getOrigin());
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Localization', 'Localization successfully created', $attrL11n);
}
/**
* Api method to create item l11n type
*
@ -994,7 +1111,7 @@ final class ApiController extends Controller
foreach ($uploaded as $file) {
$this->createModelRelation(
$request->header->account,
$file->getId(),
$file->id,
$request->getDataInt('type'),
MediaMapper::class,
'types',
@ -1007,7 +1124,7 @@ final class ApiController extends Controller
$this->createModelRelation(
$request->header->account,
(int) $request->getData('item'),
\reset($uploaded)->getId(),
\reset($uploaded)->id,
ItemMapper::class, 'files', '', $request->getOrigin()
);
@ -1069,7 +1186,7 @@ final class ApiController extends Controller
}
$model = $responseData['response'];
$this->createModelRelation($request->header->account, (int) $request->getData('id'), $model->getId(), ItemMapper::class, 'notes', '', $request->getOrigin());
$this->createModelRelation($request->header->account, (int) $request->getData('id'), $model->id, ItemMapper::class, 'notes', '', $request->getOrigin());
}
/**

View File

@ -16,13 +16,20 @@ namespace Modules\ItemManagement\Controller;
use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\Auditor\Models\AuditMapper;
use Modules\Billing\Models\BillTransferType;
use Modules\Billing\Models\Price\PriceMapper;
use Modules\Billing\Models\Price\PriceType;
use Modules\Billing\Models\SalesBillMapper;
use Modules\ItemManagement\Models\ItemAttributeTypeL11nMapper;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
use Modules\ItemManagement\Models\ItemL11nMapper;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
use Modules\Organization\Models\UnitMapper;
use phpOMS\Asset\AssetType;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\Builder;
@ -33,6 +40,7 @@ use phpOMS\Localization\Money;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Stdlib\Base\SmartDateTime;
use phpOMS\Utils\StringUtils;
use phpOMS\Views\View;
/**
@ -129,7 +137,12 @@ final class BackendController extends Controller
->where('l11n/language', $response->getLanguage())
->execute();
$l11ns = ItemAttributeTypeL11nMapper::getAll()
->where('ref', $attribute->id)
->execute();
$view->addData('attribute', $attribute);
$view->addData('l11ns', $l11ns);
return $view;
}
@ -342,11 +355,16 @@ final class BackendController extends Controller
->with('l11n/type')
->with('files')
->with('files/types')
->with('attributes')
->with('attributes/type')
->with('attributes/type/l11n')
->with('attributes/value')
->with('notes')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->getLanguage())
->where('attributes/type/l11n/language', $response->getLanguage())
->where('l11n/type/title', ['name1', 'name2', 'name3'], 'IN')
->limit(5, 'files')->sort('files/id', OrderType::DESC) // @todo: limit not working!!!
->limit(5, 'files')->sort('files/id', OrderType::DESC)
->limit(5, 'notes')->sort('notes/id', OrderType::DESC)
->execute();
@ -368,7 +386,7 @@ final class BackendController extends Controller
->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self'])
->leftJoin(MediaTypeMapper::TABLE)
->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD)
->where(ItemMapper::HAS_MANY['files']['self'], '=', $item->getId())
->where(ItemMapper::HAS_MANY['files']['self'], '=', $item->id)
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'item_profile_image');
$itemImage = MediaMapper::get()
@ -384,15 +402,60 @@ final class BackendController extends Controller
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->setData('defaultlocalization', LocalizationMapper::get()->where('id', (int) $settings->getId())->execute());
$view->setData('defaultlocalization', LocalizationMapper::get()->where('id', (int) $settings->id)->execute());
$l11nTypes = ItemL11nTypeMapper::getAll()
->execute();
$view->setData('l11nTypes', $l11nTypes);
$l11nValues = ItemL11nMapper::getAll()
->with('type')
->where('item', $item->id)
->execute();
$view->setData('l11nValues', $l11nValues);
$attributeTypes = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->getLanguage())
->execute();
$view->setData('attributeTypes', $attributeTypes);
$units = UnitMapper::getAll()
->execute();
$view->setData('units', $units);
$prices = PriceMapper::getAll()
->where('item', $item->id)
->where('type', PriceType::SALES)
->where('client', null)
->execute();
$view->setData('prices', $prices);
$audits = AuditMapper::getAll()
->where('type', StringUtils::intHash(ItemMapper::class))
->where('module', 'ItemManagement')
->where('ref', $item->id)
->execute();
$view->setData('audits', $audits);
$files = MediaMapper::getAll()
->with('types')
->join('id', ItemMapper::class, 'files') // id = media id, files = item relations
->on('id', $item->id, relation: 'files') // id = item id
->execute();
$view->setData('files', $files);
$mediaListView = new \Modules\Media\Theme\Backend\Components\Media\ListView($this->app->l11nManager, $request, $response);
$mediaListView->setTemplate('/Modules/Media/Theme/Backend/Components/Media/list');
$view->addData('medialist', $mediaListView);
// stats
if ($this->app->moduleManager->isActive('Billing')) {
$ytd = SalesBillMapper::getSalesByItemId($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$mtd = SalesBillMapper::getSalesByItemId($item->getId(), new SmartDateTime('Y-m-01'), new SmartDateTime('now'));
$avg = SalesBillMapper::getAvgSalesPriceByItemId($item->getId(), (new SmartDateTime('now'))->smartModify(-1), new SmartDateTime('now'));
$ytd = SalesBillMapper::getSalesByItemId($item->id, new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$mtd = SalesBillMapper::getSalesByItemId($item->id, new SmartDateTime('Y-m-01'), new SmartDateTime('now'));
$avg = SalesBillMapper::getAvgSalesPriceByItemId($item->id, (new SmartDateTime('now'))->smartModify(-1), new SmartDateTime('now'));
$lastOrder = SalesBillMapper::getLastOrderDateByItemId($item->getId());
$lastOrder = SalesBillMapper::getLastOrderDateByItemId($item->id);
$newestInvoices = SalesBillMapper::getAll()
->with('type')
@ -403,11 +466,11 @@ final class BackendController extends Controller
->limit(5)
->execute();
$topCustomers = SalesBillMapper::getItemTopClients($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
$allInvoices = SalesBillMapper::getItemBills($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$regionSales = SalesBillMapper::getItemRegionSales($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$countrySales = SalesBillMapper::getItemCountrySales($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts($item->getId(), (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
$topCustomers = SalesBillMapper::getItemTopClients($item->id, new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
$allInvoices = SalesBillMapper::getItemBills($item->id, new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$regionSales = SalesBillMapper::getItemRegionSales($item->id, new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$countrySales = SalesBillMapper::getItemCountrySales($item->id, new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
$monthlySalesCosts = SalesBillMapper::getItemMonthlySalesCosts($item->id, (new SmartDateTime('now'))->createModify(-1), new SmartDateTime('now'));
} else {
$ytd = new Money();
$mtd = new Money();

View File

@ -15,9 +15,7 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use Modules\Editor\Models\EditorDoc;
use Modules\Media\Models\Media;
use Modules\Media\Models\NullMedia;
use phpOMS\Localization\Money;
use phpOMS\Stdlib\Base\FloatInt;
/**
* Item class.
@ -35,7 +33,7 @@ class Item implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Item number/id
@ -49,11 +47,11 @@ class Item implements \JsonSerializable
public ?int $parent = null;
private int $status = ItemStatus::ACTIVE;
public int $status = ItemStatus::ACTIVE;
public Money $salesPrice;
public FloatInt $salesPrice;
public Money $purchasePrice;
public FloatInt $purchasePrice;
/**
* Notes.
@ -101,8 +99,8 @@ class Item implements \JsonSerializable
public function __construct()
{
$this->createdAt = new \DateTimeImmutable('now');
$this->salesPrice = new Money();
$this->purchasePrice = new Money();
$this->salesPrice = new FloatInt();
$this->purchasePrice = new FloatInt();
}
/**

View File

@ -25,7 +25,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
* @link https://jingga.app
* @since 1.0.0
*
* @template T of Attribte
* @template T of Attribute
* @extends DataMapperFactory<T>
*/
final class ItemAttributeMapper extends DataMapperFactory

View File

@ -32,7 +32,7 @@ class ItemL11n implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Item ID.

View File

@ -30,7 +30,7 @@ class ItemL11nType implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Identifier for the l11n type.

View File

@ -15,7 +15,9 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use Modules\Editor\Models\EditorDocMapper;
use Modules\Media\Models\Media;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
@ -96,4 +98,91 @@ final class ItemMapper extends DataMapperFactory
'external' => null,
],
];
// @todo: experimental (not 100% working)
public static function getItemList(string $langugae) : array
{
// items
$query = <<<SQL
select itemmgmt_item.itemmgmt_item_id,
itemmgmt_item.itemmgmt_item_no,
itemmgmt_item.itemmgmt_item_salesprice,
media.media_id,
media.media_file,
media_type.media_type_id,
media_type.media_type_name
from itemmgmt_item
left join itemmgmt_item_media on itemmgmt_item.itemmgmt_item_id = itemmgmt_item_media.itemmgmt_item_media_item
left join media on itemmgmt_item_media.itemmgmt_item_media_media = media.media_id
left join media_type_rel on media.media_id = media_type_rel.media_type_rel_src
left join media_type on media_type_rel.media_type_rel_dst = media_type.media_type_id and media_type.media_type_name = 'item_profile_image'
SQL;
$itemsResult = self::$db->con->query($query)->fetchAll();
$items = [];
foreach ($itemsResult as $res) {
$media = null;
if ($res['media_id'] !== null) {
$mediaType = new MediaType();
$mediaType->id = $res['media_type_id'];
$mediaType->name = $res['media_type_name'];
$media = new Media();
$media->id = $res['media_id'];
$media->setPath($res['media_file']);
}
$item = new Item();
$item->id = $res['itemmgmt_item_id'];
$item->number = $res['itemmgmt_item_no'];
$item->salesPrice->setInt($res['itemmgmt_item_salesprice']);
if ($media !== null) {
$item->addFile($media);
}
$items[$item->id] = $item;
}
// l11ns
$query = <<<SQL
select itemmgmt_item.itemmgmt_item_id,
itemmgmt_item_l11n.itemmgmt_item_l11n_id,
itemmgmt_item_l11n.itemmgmt_item_l11n_lang,
itemmgmt_item_l11n.itemmgmt_item_l11n_typeref,
itemmgmt_item_l11n.itemmgmt_item_l11n_description,
itemmgmt_item_l11n_type.itemmgmt_item_l11n_type_title
from itemmgmt_item
left join itemmgmt_item_l11n
on itemmgmt_item.itemmgmt_item_id = itemmgmt_item_l11n.itemmgmt_item_l11n_item
left join itemmgmt_item_l11n_type
on itemmgmt_item_l11n.itemmgmt_item_l11n_typeref = itemmgmt_item_l11n_type.itemmgmt_item_l11n_type_id
where
itemmgmt_item_l11n_type.itemmgmt_item_l11n_type_title in ('name1', 'name2', 'name3')
and itemmgmt_item_l11n.itemmgmt_item_l11n_lang = :lang
SQL;
$sth = self::$db->con->prepare($query);
$sth->execute(['lang' => $langugae]);
$l11nsResult = $sth->fetchAll();
foreach ($l11nsResult as $res) {
$l11nType = new ItemL11nType();
$l11nType->id = $res['itemmgmt_item_l11n_typeref'];
$l11nType->title= $res['itemmgmt_item_l11n_type_title'];
$l11n = new ItemL11n();
$l11n->id = $res['itemmgmt_item_l11n_id'];
$l11n->item = $res['itemmgmt_item_id'];
$l11n->type = $l11nType;
$l11n->description = $res['itemmgmt_item_l11n_description'];
$l11n->setLanguage($res['itemmgmt_item_l11n_lang']);
$items[$l11n->item]->addL11n($l11n);
}
return $items;
}
}

View File

@ -33,7 +33,7 @@ class ItemPrice implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
public string $name = '';

View File

@ -30,7 +30,7 @@ class ItemRelation implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Item source.

View File

@ -30,7 +30,7 @@ class ItemRelationType implements \JsonSerializable
* @var int
* @since 1.0.0
*/
protected int $id = 0;
public int $id = 0;
/**
* Identifier for the l11n type.

View File

@ -13,6 +13,15 @@
declare(strict_types=1);
return ['ItemManagement' => [
'SalesPricing' => 'Sales Pricing',
'ItemGroup' => 'Item Group',
'ItemSegment' => 'Item Segment',
'ItemSection' => 'Item Section',
'ItemType' => 'Item Type',
'ClientGroup' => 'Client Group',
'ClientSegment' => 'Client Segment',
'ClientSection' => 'Client Section',
'ClientType' => 'Client Type',
'Accounting' => 'Accounting',
'Address' => 'Address',
'All' => 'All',

View File

@ -55,10 +55,10 @@ echo $this->getData('nav')->render(); ?>
<?php
$count = 0;
foreach ($attributes as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/attribute/type?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/item/attribute/type?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>

View File

@ -0,0 +1,65 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Tasks
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use phpOMS\Localization\ISO639Enum;
$attribute = $this->getData('attribute');
$l11ns = $this->getData('l11ns');
echo $this->getData('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'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID'); ?></label>
<input type="text" value="<?= $this->printHtml((string) $attribute->id); ?>" disabled>
</div>
<div class="form-group">
<label for="iName"><?= $this->getHtml('Name'); ?></label>
<input type="text" value="<?= $this->printHtml($attribute->name); ?>" disabled>
</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="fa fa-download floatRight download btn"></i></div>
<table class="default">
<thead>
<tr>
<td>
<td>
<td><?= $this->getHtml('Language', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<tbody>
<?php $c = 0; foreach ($l11ns as $key => $value) : ++$c; ?>
<tr>
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="#"><i class="fa fa-cogs"></i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?>
<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

@ -129,19 +129,19 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_item'); ?>" width="30" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia
src="<?= $image->id === 0
? 'Web/Backend/img/logo_grey.png'
: UriFactory::build($image->getPath()); ?>"></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name1')->description); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name2')->description); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name3')->description); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->salesPrice->getCurrency()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->salesPrice); ?></a>
<td>
<td>
<td>

View File

@ -16,13 +16,13 @@ use Modules\Media\Models\NullMedia;
use phpOMS\Localization\ISO639Enum;
use phpOMS\Localization\Money;
use phpOMS\Localization\NullLocalization;
use phpOMS\Message\Http\HttpHeader;
use phpOMS\Uri\UriFactory;
/** @var \Modules\ItemManagement\Models\Item $item */
$item = $this->getData('item');
$itemL11n = $item->getL11ns();
$Attribute = $item->getAttributes();
$attribute = $item->getAttributes();
$notes = $item->getNotes();
$files = $item->getFiles();
@ -49,7 +49,7 @@ echo $this->getData('nav')->render();
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Attributes'); ?></label></li>
<li><label for="c-tab-4"><?= $this->getHtml('Pricing'); ?></label></li>
<li><label for="c-tab-4"><?= $this->getHtml('SalesPricing'); ?></label></li>
<li><label for="c-tab-5"><?= $this->getHtml('Procurement'); ?></label></li>
<li><label for="c-tab-6"><?= $this->getHtml('Production'); ?></label></li>
<li><label for="c-tab-7"><?= $this->getHtml('QA'); ?></label></li>
@ -91,7 +91,7 @@ echo $this->getData('nav')->render();
<section class="portlet">
<div class="portlet-body">
<img alt="<?= $this->printHtml($image->name); ?>" width="100%" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia
src="<?= $image->id === 0
? 'Web/Backend/img/logo_grey.png'
: UriFactory::build($image->getPath()); ?>">
</div>
@ -110,9 +110,9 @@ echo $this->getData('nav')->render();
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>:
<td><?= $this->getData('ytd')->getCurrency(); ?>
<td><?= $this->getCurrency($this->getData('ytd')); ?>
<tr><td><?= $this->getHtml('MTDSales'); ?>:
<td><?= $this->getData('mtd')->getCurrency(); ?>
<td><?= $this->getCurrency($this->getData('mtd')); ?>
<tr><td><?= $this->getHtml('ILV'); ?>:
<td>
<tr><td><?= $this->getHtml('MRR'); ?>:
@ -144,9 +144,9 @@ echo $this->getData('nav')->render();
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('SalesPrice'); ?>:
<td><?= $item->salesPrice->getCurrency(); ?>
<td><?= $this->getCurrency($item->salesPrice); ?>
<tr><td><?= $this->getHtml('PurchasePrice'); ?>:
<td><?= $item->purchasePrice->getCurrency(); ?>
<td><?= $this->getCurrency($item->purchasePrice); ?>
<tr><td><?= $this->getHtml('Margin'); ?>:
<td><?= \round(
$item->salesPrice->getInt() === 0
@ -154,7 +154,7 @@ echo $this->getData('nav')->render();
: ($item->salesPrice->getInt() - $item->purchasePrice->getInt()) / $item->salesPrice->getInt() * 100, 2
); ?> %
<tr><td><?= $this->getHtml('AvgPrice'); ?>:
<td><?= $this->getData('avg')->getCurrency(); ?>
<td><?= $this->getCurrency($this->getData('avg')); ?>
</table>
</div>
</section>
@ -173,7 +173,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->getId());
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->title); ?></a>
@ -196,7 +196,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->getId());
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->name); ?></a>
@ -226,12 +226,12 @@ echo $this->getData('nav')->render();
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->getId());
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->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/profile?{?}&id=' . $invoice->client->getId()); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->netSales->getCurrency()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
@ -254,7 +254,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach (($topCustomers[0] ?? []) as $client) : ++$i;
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->getId());
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
@ -426,33 +426,32 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Description'); ?></div>
<div class="portlet-head"><?= $this->getHtml('Localization'); ?></div>
<div class="portlet-body">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iLanguages"><?= $this->getHtml('Language'); ?></label>
<tr>
<td>
<select id="iLanguages" name="settings_1000000020">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
<tr>
<td><label for="iLanguages"><?= $this->getHtml('Type'); ?></label>
<tr>
<td>
<select id="iLanguages" name="settings_1000000020">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
<tr>
<td><label for="iText1"><?= $this->getHtml('Text'); ?></label>
<tr>
<td><textarea id="iText1" name="text1"></textarea>
</table>
<div class="form-group">
<label for="iLocalizationLanguage"><?= $this->getHtml('Language'); ?></label>
<select id="iLocalizationLanguage" name="language">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iLocalizationType"><?= $this->getHtml('Type'); ?></label>
<select id="iLocalizationType" name="type">
<?php
$types = $this->getData('l11nTypes') ?? [];
foreach ($types as $type) : ?>
<option value="<?= $type->id; ?>"><?= $this->printHtml($type->title); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iLocalizationText"><?= $this->getHtml('Text'); ?></label>
<textarea id="iLocalizationText" name="content"></textarea>
</div>
</div>
<div class="portlet-foot"><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>"></div>
</form>
@ -462,28 +461,33 @@ echo $this->getData('nav')->render();
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Localizations'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="groupTable" class="default">
<div class="slider">
<table id="groupTable" class="default sticky">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Language'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Localization'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $c = 0;
foreach ($itemL11n as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
$itemL11n = $this->getData('l11nValues');
foreach ($itemL11n as $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->type->title); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getLanguage()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->description); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
@ -493,75 +497,110 @@ echo $this->getData('nav')->render();
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Attribute'); ?></div class="portlet-head">
<div class="portlet-body">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iLanguages"><?= $this->getHtml('Language'); ?></label>
<tr>
<td>
<select id="iLanguages" name="settings_1000000020">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
<tr>
<td><label for="iLanguages"><?= $this->getHtml('Type'); ?></label>
<tr>
<td>
<select id="iLanguages" name="settings_1000000020">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
<tr>
<td><label for="iLanguages"><?= $this->getHtml('Unit'); ?></label>
<tr>
<td>
<select id="iLanguages" name="settings_1000000020">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
<tr>
<td><label for="iText1"><?= $this->getHtml('Value'); ?></label>
<tr>
<td><input id="iName5" name="name5" type="text" value="<?= $this->printHtml($item->getL11n('name1')->description); ?>">
<tr>
<td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
<form id="attributeForm" action="<?= UriFactory::build('{/api}item/attribute'); ?>" method="post"
data-ui-container="#attributeTable tbody"
data-add-form="attributeForm"
data-add-tpl="#attributeTable tbody .oms-add-tpl-attribute">
<div class="portlet-head"><?= $this->getHtml('Attribute'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID'); ?></label>
<input type="text" id="iId" name="id" data-tpl-text="/id" data-tpl-value="/id" disabled>
</div>
<!--
<div class="form-group">
<label for="iAttributesLanguage"><?= $this->getHtml('Language'); ?></label>
<select id="iAttributesLanguage" name="language" data-tpl-text="/language" data-tpl-value="/language">
<option value="">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
</div>
-->
<div class="form-group">
<label for="iAttributesType"><?= $this->getHtml('Type'); ?></label>
<select id="iAttributesType" name="type" data-tpl-text="/type" data-tpl-value="/type">
<?php
$types = $this->getData('attributeTypes') ?? [];
foreach ($types as $type) : ?>
<option value="<?= $type->id; ?>"><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iAttributesUnit"><?= $this->getHtml('Unit'); ?></label>
<select id="iAttributesUnit" name="unit" data-tpl-text="/unit" data-tpl-value="/unit">
<?php
$units = $this->getData('units') ?? [];
foreach ($units as $unit) : ?>
<option value="<?= $unit->id; ?>"><?= $this->printHtml($unit->name); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iAttributeValue"><?= $this->getHtml('Value'); ?></label>
<textarea id="iAttributeValue" name="value" data-tpl-text="/value" data-tpl-value="/value"></textarea>
</div>
</div>
<div class="portlet-foot">
<input id="bAttributeAdd" formmethod="put" type="submit" class="add-form" value="<?= $this->getHtml('Add', '0', '0'); ?>">
<input id="bAttributeSave" formmethod="post" type="submit" class="save-form hidden button save" value="<?= $this->getHtml('Update', '0', '0'); ?>">
<input type="submit" class="cancel-form hidden button close" value="<?= $this->getHtml('Cancel', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Groups'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="groupTable" class="default">
<div class="portlet-head"><?= $this->getHtml('Attributes'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="slider">
<table id="attributeTable" class="default"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-attribute"
data-update-form="attributeForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Value'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Unit'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<template class="oms-add-tpl-attribute">
<tr data-id="" draggable="false">
<td>
<i class="fa fa-cogs btn update-form"></i>
<i class="fa fa-times btn remove-form"></i>
<td>
<td data-tpl-text="/type" data-tpl-value="/type" data-value=""></td>
<td data-tpl-text="/value" data-tpl-value="/value" data-value=""></td>
</tr>
</template>
<?php $c = 0;
foreach ($Attribute as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->type->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
foreach ($attribute as $key => $value) : ++$c; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="fa fa-cogs btn update-form"></i>
<i class="fa fa-times btn remove-form"></i>
<td data-tpl-text="/id" data-tpl-value="/id" data-value=""><?= $value->id; ?>
<td data-tpl-text="/type" data-tpl-value="/type" data-value="<?= $value->type->id; ?>"><?= $this->printHtml($value->type->getL11n()); ?>
<td data-tpl-text="/value" data-tpl-value="/value" data-value=""><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $this->printHtml($value->value->unit); ?>"><?= $this->printHtml($value->value->unit); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
@ -570,79 +609,121 @@ echo $this->getData('nav')->render();
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header>
<h1><?= $this->getHtml('Pricing'); ?></h1>
</header>
<div class="inner">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iCustomerGroup"><?= $this->getHtml('CustomerGroup'); ?></label>
<tr>
<td><input id="iCustomerGroup" name="customergroup" type="text" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iGeneralPriceStart"><?= $this->getHtml('Start'); ?></label>
<tr>
<td><input id="iGeneralPriceStart" name="generalpricestart" type="datetime-local" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iGeneralPriceEnd"><?= $this->getHtml('End'); ?></label>
<tr>
<td><input id="iGeneralPriceEnd" name="generalpriceend" type="datetime-local" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr>
<td><input id="iPQuantity" name="quantity" type="text" placeholder="">
<tr>
<td><label for="iGeneralPrice"><?= $this->getHtml('Price'); ?></label>
<tr>
<td><input id="iGeneralPrice" name="generalprice" type="number" step="0.0001" value="<?= $this->printHtml('0.00'); ?>">
<!-- todo: maybe add promotion key/password here for online shop to provide special prices for certain customer groups -->
<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><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr>
<td><input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder="">
<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 type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
<section class="portlet">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Pricing'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="portlet-body">
<div class="form-group">
<label for="iAttributesLanguage"><?= $this->getHtml('CustomerGroup'); ?></label>
<select id="iAttributesLanguage" name="language">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>"><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iGeneralPriceStart"><?= $this->getHtml('Start'); ?></label>
<input id="iGeneralPriceStart" name="generalpricestart" type="datetime-local" value="<?= $this->printHtml(''); ?>">
</div>
<div class="form-group">
<label for="iGeneralPriceEnd"><?= $this->getHtml('End'); ?></label>
<input id="iGeneralPriceEnd" name="generalpriceend" type="datetime-local" value="<?= $this->printHtml(''); ?>">
</div>
<div class="form-group">
<label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<input id="iPQuantity" name="quantity" type="text" placeholder="">
</div>
<div class="form-group">
<label for="iGeneralPrice"><?= $this->getHtml('Price'); ?></label>
<input id="iGeneralPrice" name="generalprice" type="number" step="0.0001" value="<?= $this->printHtml('0.00'); ?>">
<!-- todo: maybe add promotion key/password here for online shop to provide special prices for certain customer groups -->
</div>
<div class="form-group">
<label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
</div>
<div class="form-group">
<label for="iDiscountP"><?= $this->getHtml('DiscountP'); ?></label>
<input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder="">
</div>
<div class="form-group">
<label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<input id="iBonus" name="bonus" type="number" step="any" min="0" placeholder="">
</div>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Prices'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="slider">
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Price'); ?>
<td><?= $this->getHtml('Quantity'); ?>
<td><?= $this->getHtml('Discount'); ?>
<td><?= $this->getHtml('DiscountP'); ?>
<td><?= $this->getHtml('Bonus'); ?>
<td><?= $this->getHtml('ItemGroup'); ?>
<td><?= $this->getHtml('ItemSegment'); ?>
<td><?= $this->getHtml('ItemSection'); ?>
<td><?= $this->getHtml('ItemType'); ?>
<td><?= $this->getHtml('ClientGroup'); ?>
<td><?= $this->getHtml('ClientSegment'); ?>
<td><?= $this->getHtml('ClientSection'); ?>
<td><?= $this->getHtml('ClientType'); ?>
<td><?= $this->getHtml('Country'); ?>
<td><?= $this->getHtml('Start'); ?>
<td><?= $this->getHtml('End'); ?>
<tbody>
<?php $c = 0;
$l11ns = [];
foreach ($l11ns as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
<?php
$c = 0;
$prices = $this->getData('prices');
foreach ($prices as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->price->getAmount()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->quantity); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->discount); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->discountPercentage); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->bonus); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->itemgroup->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->itemsegment->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->itemsection->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->itemtype->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->clientgroup->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->clientsegment->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->clientsection->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->clienttype->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->clientcountry); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->start?->format('Y-m-d')); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->end?->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
@ -650,13 +731,11 @@ echo $this->getData('nav')->render();
<input type="radio" id="c-tab-5" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header>
<h1><?= $this->getHtml('Purchase'); ?></h1>
</header>
<div class="inner">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Purchase'); ?></div>
<div class="portlet-body">
<table class="layout wf-100">
<tbody>
<tr>
@ -682,121 +761,170 @@ echo $this->getData('nav')->render();
<tr>
<td><input id="iPName" name="pname" type="number" min="0" step="1" placeholder="">
<tr>
<td><input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
<td>
</table>
</form>
</div>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6 col-lg-4">
<section class="box wf-100">
<header>
<h1><?= $this->getHtml('Supplier'); ?></h1>
</header>
<div class="inner">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iSupplierGroup"><?= $this->getHtml('ID'); ?></label>
<tr>
<td><input id="iSupplierGroup" name="Suppliergroup" type="text" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iGeneralPriceStart"><?= $this->getHtml('Start'); ?></label>
<tr>
<td><input id="iGeneralPriceStart" name="generalpricestart" type="datetime-local" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iGeneralPriceEnd"><?= $this->getHtml('End'); ?></label>
<tr>
<td><input id="iGeneralPriceEnd" name="generalpriceend" type="datetime-local" value="<?= $this->printHtml(''); ?>">
<tr>
<td><label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<tr>
<td><input id="iPQuantity" name="quantity" type="text" placeholder="">
<tr>
<td><label for="iGeneralPrice"><?= $this->getHtml('Price'); ?></label>
<tr>
<td><input id="iGeneralPrice" name="generalprice" type="number" step="0.0001" value="<?= $this->printHtml('0.00'); ?>">
<!-- todo: maybe add promotion key/password here for online shop to provide special prices for certain customer groups -->
<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><label for="iDiscount"><?= $this->getHtml('DiscountP'); ?></label>
<tr>
<td><input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder="">
<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><label for="iPPriceUnit"><?= $this->getHtml('PriceUnit'); ?></label>
<tr>
<td><select id="iPPriceUnit" name="ppriceunit">
<option value="0">
</select>
<tr>
<td><label for="iPQuantityUnit"><?= $this->getHtml('QuantityUnit'); ?></label>
<tr>
<td><select id="iPQuantityUnit" name="pquantityunit">
<option value="0">
</select>
<tr>
<td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('Pricing'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="portlet-body">
<div class="form-group">
<label for="iAttributesLanguage"><?= $this->getHtml('CustomerGroup'); ?></label>
<select id="iAttributesLanguage" name="language">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>"><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iGeneralPriceStart"><?= $this->getHtml('Start'); ?></label>
<input id="iGeneralPriceStart" name="generalpricestart" type="datetime-local" value="<?= $this->printHtml(''); ?>">
</div>
<div class="form-group">
<label for="iGeneralPriceEnd"><?= $this->getHtml('End'); ?></label>
<input id="iGeneralPriceEnd" name="generalpriceend" type="datetime-local" value="<?= $this->printHtml(''); ?>">
</div>
<div class="form-group">
<label for="iPQuantity"><?= $this->getHtml('Quantity'); ?></label>
<input id="iPQuantity" name="quantity" type="text" placeholder="">
</div>
<div class="form-group">
<label for="iGeneralPrice"><?= $this->getHtml('Price'); ?></label>
<input id="iGeneralPrice" name="generalprice" type="number" step="0.0001" value="<?= $this->printHtml('0.00'); ?>">
<!-- todo: maybe add promotion key/password here for online shop to provide special prices for certain customer groups -->
</div>
<div class="form-group">
<label for="iDiscount"><?= $this->getHtml('Discount'); ?></label>
<input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
</div>
<div class="form-group">
<label for="iDiscountP"><?= $this->getHtml('DiscountP'); ?></label>
<input id="iDiscountP" name="discountp" type="number" step="any" min="0" placeholder="">
</div>
<div class="form-group">
<label for="iBonus"><?= $this->getHtml('Bonus'); ?></label>
<input id="iBonus" name="bonus" type="number" step="any" min="0" placeholder="">
</div>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6 col-lg-4">
<table id="groupTable" class="box table default">
<caption><?= $this->getHtml('Prices'); ?><i class="fa fa-download floatRight download btn"></i></caption>
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $c = 0;
$l11ns = [];
foreach ($l11ns as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Prices'); ?><i class="fa fa-download floatRight download btn"></i></div>
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<?php $c = 0;
$l11ns = [];
foreach ($l11ns as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-6" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('PartsList'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('UsedIn'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('ProductionSteps'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Machines'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Documents'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-7" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Issues'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('UsedIn'); ?></div>
<div class="portlet-body"></div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-8" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header>
<h1><?= $this->getHtml('General'); ?></h1>
</header>
<div class="inner">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<section class="portlet">
<form action="<?= UriFactory::build('{/api}...'); ?>" method="post">
<div class="portlet-head"><?= $this->getHtml('General'); ?></div>
<div class="portlet-body">
<table class="layout wf-100">
<tbody>
<tr>
@ -833,11 +961,12 @@ echo $this->getData('nav')->render();
<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 type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</div>
</form>
</section>
</div>
</div>
@ -913,6 +1042,9 @@ echo $this->getData('nav')->render();
<input type="radio" id="c-tab-12" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12">
<?= $this->getData('medialist')->render($this->getData('files')); ?>
</div>
</div>
</div>
@ -934,7 +1066,7 @@ echo $this->getData('nav')->render();
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) :
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->getId());
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
@ -953,26 +1085,59 @@ echo $this->getData('nav')->render();
<div class="tab">
<div class="row">
<div class="col-xs-12">
<table class="default">
<caption><?= $this->getHtml('Logs'); ?><i class="fa fa-download floatRight download btn"></i></caption>
<thead>
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Audits', 'Auditor'); ?><i class="fa fa-download floatRight download btn"></i></div>
<div class="slider">
<table class="default">
<colgroup>
<col style="width: 75px">
<col style="width: 150px">
<col style="width: 100px">
<col>
<col>
<col style="width: 125px">
<col style="width: 75px">
<col style="width: 150px">
</colgroup>
<thead>
<tr>
<td>IP
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Name'); ?>
<td class="wf-100"><?= $this->getHtml('Log'); ?>
<td><?= $this->getHtml('Date'); ?>
<tfoot>
<tr>
<td colspan="6">
<tbody>
<tr>
<td><?= $this->printHtml($this->request->getOrigin()); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td><?= $this->printHtml((string) $this->request->header->account); ?>
<td>Creating item
<td><?= $this->printHtml((new \DateTime('now'))->format('Y-m-d H:i:s')); ?>
</table>
<td><?= $this->getHtml('Module', 'Auditor'); ?>
<td><?= $this->getHtml('Type', 'Auditor'); ?>
<td><?= $this->getHtml('Trigger', 'Auditor'); ?>
<td><?= $this->getHtml('Content', 'Auditor'); ?>
<td><?= $this->getHtml('By', 'Auditor'); ?>
<td><?= $this->getHtml('Ref', 'Auditor'); ?>
<td><?= $this->getHtml('Date', 'Auditor'); ?>
<tbody>
<?php
$count = 0;
$audits = $this->getData('audits') ?? [];
$previous = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \reset($audits)->id . '&ptype=p#{\#}';
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \end($audits)->id . '&ptype=n#{\#}';
foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->id; ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>
<td><?= $this->printHtml((string) $audit->content); ?>
<td><?= $this->printHtml($audit->createdBy->login); ?>
<td><?= $this->printHtml((string) $audit->ref); ?>
<td><?= $audit->createdAt->format('Y-m-d H:i'); ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?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>
</div>

View File

@ -127,14 +127,14 @@ echo $this->getData('nav')->render(); ?>
</label>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/purchase/item/profile?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/purchase/item/profile?{?}&id=' . $value->id);
$image = $value->getFileByType('backend_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_item'); ?>" width="30" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
src="<?= $image->id === 0 ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name1')->description); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name2')->description); ?></a>

View File

@ -129,12 +129,12 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/sales/item/profile?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/sales/item/profile?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_item'); ?>" width="30" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia ?
src="<?= $image->id === 0 ?
UriFactory::build('Web/Backend/img/user_default_' . \mt_rand(1, 6) .'.png') :
UriFactory::build('{/base}/' . $image->getPath()); ?>"></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>

View File

@ -88,7 +88,7 @@ echo $this->getData('nav')->render();
</section>
<?php $image = $item->getFileByType(0);
if (!($image instanceof NullMedia)) : ?>
if ($image->id > 0) : ?>
<section class="portlet">
<div class="portlet-body">
<img alt="<?= $this->printHtml($image->name); ?>" width="100%" loading="lazy" class="item-image"
@ -171,7 +171,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->getId());
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->title); ?></a>
@ -194,7 +194,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->getId());
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->name); ?></a>
@ -224,12 +224,12 @@ echo $this->getData('nav')->render();
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->getId());
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->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/profile?{?}&id=' . $invoice->client->getId()); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->netSales->getCurrency()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
@ -252,7 +252,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach ($topCustomers as $client) : ++$i;
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->getId());
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
@ -470,10 +470,10 @@ echo $this->getData('nav')->render();
<tbody>
<?php $c = 0;
foreach ($itemL11n as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->type->title); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->description); ?></a>
<?php endforeach; ?>
@ -548,10 +548,10 @@ echo $this->getData('nav')->render();
<tbody>
<?php $c = 0;
foreach ($Attribute as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->type->getL11n()); ?></a>
<td><a href="<?= $url; ?>"><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?></a>
<?php endforeach; ?>
@ -630,10 +630,10 @@ echo $this->getData('nav')->render();
<?php $c = 0;
$l11ns = [];
foreach ($l11ns as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
@ -761,10 +761,10 @@ echo $this->getData('nav')->render();
<?php $c = 0;
$l11ns = [];
foreach ($l11ns as $key => $value) : ++$c;
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->getId()); ?>
$url = UriFactory::build('{/base}/admin/group/settings?{?}&id=' . $value->id); ?>
<tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->getId(); ?></a>
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
@ -932,7 +932,7 @@ echo $this->getData('nav')->render();
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) :
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->getId());
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>

View File

@ -117,12 +117,12 @@ echo $this->getData('nav')->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->getId());
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->getHtml('IMG_alt_item'); ?>" width="30" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia ?
src="<?= $image->id === 0 ?
'Web/Backend/img/logo_grey.png' :
UriFactory::build($image->getPath()); ?>"></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->number); ?></a>

View File

@ -39,7 +39,7 @@ trait ApiControllerAttributeTrait
$request->setData('language', ISO639x1Enum::_EN);
$this->module->apiItemL11nTypeCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -57,7 +57,7 @@ trait ApiControllerAttributeTrait
$request->setData('description', 'Description');
$this->module->apiItemL11nCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -75,7 +75,7 @@ trait ApiControllerAttributeTrait
$request->setData('language', ISO639x1Enum::_EN);
$this->module->apiItemAttributeTypeCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -93,7 +93,7 @@ trait ApiControllerAttributeTrait
$request->setData('language', ISO639x1Enum::_DE);
$this->module->apiItemAttributeTypeL11nCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -113,7 +113,7 @@ trait ApiControllerAttributeTrait
$request->setData('country', ISO3166TwoEnum::_DEU);
$this->module->apiItemAttributeValueCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -132,7 +132,7 @@ trait ApiControllerAttributeTrait
$request->setData('country', ISO3166TwoEnum::_DEU);
$this->module->apiItemAttributeValueCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -151,7 +151,7 @@ trait ApiControllerAttributeTrait
$request->setData('country', ISO3166TwoEnum::_DEU);
$this->module->apiItemAttributeValueCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -170,7 +170,7 @@ trait ApiControllerAttributeTrait
$request->setData('country', ISO3166TwoEnum::_DEU);
$this->module->apiItemAttributeValueCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -188,7 +188,7 @@ trait ApiControllerAttributeTrait
$request->setData('type', '1');
$this->module->apiItemAttributeCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**

View File

@ -48,7 +48,7 @@ trait ApiControllerItemTrait
$request->setData('info', 'Info text');
$this->module->apiItemCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**
@ -95,7 +95,7 @@ trait ApiControllerItemTrait
$this->module->apiFileCreate($request, $response);
$file = $response->get('')['response'];
self::assertGreaterThan(0, \reset($file)->getId());
self::assertGreaterThan(0, \reset($file)->id);
}
/**
@ -125,7 +125,7 @@ trait ApiControllerItemTrait
$this->module->apiFileCreate($request, $response);
$file = $response->get('')['response'];
self::assertGreaterThan(0, \reset($file)->getId());
self::assertGreaterThan(0, \reset($file)->id);
}
/**
@ -146,7 +146,7 @@ trait ApiControllerItemTrait
$request->setData('plain', \preg_replace('/^.+\n/', '', $MARKDOWN));
$this->module->apiNoteCreate($request, $response);
self::assertGreaterThan(0, $response->get('')['response']->getId());
self::assertGreaterThan(0, $response->get('')['response']->id);
}
/**

View File

@ -38,7 +38,7 @@ final class ItemL11nTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->l11n->getId());
self::assertEquals(0, $this->l11n->id);
self::assertEquals('', $this->l11n->description);
self::assertEquals(0, $this->l11n->item);
self::assertEquals(ISO639x1Enum::_EN, $this->l11n->getLanguage());

View File

@ -37,7 +37,7 @@ final class ItemL11nTypeTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->l11n->getId());
self::assertEquals(0, $this->l11n->id);
self::assertEquals('', $this->l11n->title);
}

View File

@ -32,7 +32,7 @@ final class ItemMapperTest extends \PHPUnit\Framework\TestCase
$item->number = '123456789';
$id = ItemMapper::create()->execute($item);
self::assertGreaterThan(0, $item->getId());
self::assertEquals($id, $item->getId());
self::assertGreaterThan(0, $item->id);
self::assertEquals($id, $item->id);
}
}

View File

@ -42,7 +42,7 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
*/
public function testDefault() : void
{
self::assertEquals(0, $this->item->getId());
self::assertEquals(0, $this->item->id);
self::assertEquals('', $this->item->number);
self::assertEquals(0, $this->item->successor);
self::assertEquals('', $this->item->info);

View File

@ -37,6 +37,6 @@ final class NullItemL11nTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullItemL11n(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullItemL11nTypeTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullItemL11nType(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}

View File

@ -37,6 +37,6 @@ final class NullItemTest extends \PHPUnit\Framework\TestCase
public function testId() : void
{
$null = new NullItem(2);
self::assertEquals(2, $null->getId());
self::assertEquals(2, $null->id);
}
}