mirror of
https://github.com/Karaka-Management/oms-ItemManagement.git
synced 2026-01-11 11:48:41 +00:00
impl. basic item read functionality with attributes
This commit is contained in:
parent
85775f79e1
commit
dd7afdc98f
|
|
@ -32,6 +32,11 @@
|
|||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_item_l11n_type_title": {
|
||||
"name": "itemmgmt_item_l11n_type_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -57,8 +62,8 @@
|
|||
"foreignTable": "itemmgmt_item",
|
||||
"foreignKey": "itemmgmt_item_id"
|
||||
},
|
||||
"itemmgmt_item_l11n_type_ref": {
|
||||
"name": "itemmgmt_item_l11n_type_ref",
|
||||
"itemmgmt_item_l11n_typeref": {
|
||||
"name": "itemmgmt_item_l11n_typeref",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_item_l11n_type",
|
||||
|
|
@ -66,51 +71,183 @@
|
|||
},
|
||||
"itemmgmt_item_l11n_lang": {
|
||||
"name": "itemmgmt_item_l11n_lang",
|
||||
"type": "INT(11)",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_id"
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemmgmt_item_attr_l11n": {
|
||||
"name": "itemmgmt_item_attr_l11n",
|
||||
"itemmgmt_attr_type": {
|
||||
"name": "itemmgmt_attr_type",
|
||||
"fields": {
|
||||
"itemmgmt_item_attr_l11n_id": {
|
||||
"name": "itemmgmt_item_attr_l11n_id",
|
||||
"itemmgmt_attr_type_id": {
|
||||
"name": "itemmgmt_attr_type_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_item_attr_l11n_item": {
|
||||
"name": "itemmgmt_item_attr_l11n_item",
|
||||
"itemmgmt_attr_type_name": {
|
||||
"name": "itemmgmt_attr_type_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_attr_type_fields": {
|
||||
"name": "itemmgmt_attr_type_fields",
|
||||
"type": "INT(11)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_attr_type_custom": {
|
||||
"name": "itemmgmt_attr_type_custom",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemmgmt_attr_type_l11n": {
|
||||
"name": "itemmgmt_attr_type_l11n",
|
||||
"fields": {
|
||||
"itemmgmt_attr_type_l11n_id": {
|
||||
"name": "itemmgmt_attr_type_l11n_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_attr_type_l11n_title": {
|
||||
"name": "itemmgmt_attr_type_l11n_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_attr_type_l11n_type": {
|
||||
"name": "itemmgmt_attr_type_l11n_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_attr_type",
|
||||
"foreignKey": "itemmgmt_attr_type_id"
|
||||
},
|
||||
"itemmgmt_attr_type_l11n_lang": {
|
||||
"name": "itemmgmt_attr_type_l11n_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemmgmt_attr_value": {
|
||||
"name": "itemmgmt_attr_value",
|
||||
"fields": {
|
||||
"itemmgmt_attr_value_id": {
|
||||
"name": "itemmgmt_attr_value_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_attr_value_default": {
|
||||
"name": "itemmgmt_attr_value_default",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_attr_value_type": {
|
||||
"name": "itemmgmt_attr_value_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_attr_type",
|
||||
"foreignKey": "itemmgmt_attr_type_id"
|
||||
},
|
||||
"itemmgmt_attr_value_valueStr": {
|
||||
"name": "itemmgmt_attr_value_valueStr",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"itemmgmt_attr_value_valueInt": {
|
||||
"name": "itemmgmt_attr_value_valueInt",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"itemmgmt_attr_value_valueDec": {
|
||||
"name": "itemmgmt_attr_value_valueDec",
|
||||
"type": "DECIMAL(19,5)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"itemmgmt_attr_value_valueDat": {
|
||||
"name": "itemmgmt_attr_value_valueDat",
|
||||
"type": "DATETIME",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"itemmgmt_attr_value_lang": {
|
||||
"name": "itemmgmt_attr_value_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
},
|
||||
"itemmgmt_attr_value_country": {
|
||||
"name": "itemmgmt_attr_value_country",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "country",
|
||||
"foreignKey": "country_code2"
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemmgmt_item_attr": {
|
||||
"name": "itemmgmt_item_attr",
|
||||
"fields": {
|
||||
"itemmgmt_item_attr_id": {
|
||||
"name": "itemmgmt_item_attr_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_item_attr_item": {
|
||||
"name": "itemmgmt_item_attr_item",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_item",
|
||||
"foreignKey": "itemmgmt_item_id"
|
||||
},
|
||||
"itemmgmt_item_attr_l11n_attr": {
|
||||
"name": "itemmgmt_item_attr_l11n_attr",
|
||||
"type": "INT(3)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_item_attr_l11n_name": {
|
||||
"name": "itemmgmt_item_attr_l11n_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_item_attr_l11n_value": {
|
||||
"name": "itemmgmt_item_attr_l11n_value",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"itemmgmt_item_attr_l11n_lang": {
|
||||
"name": "itemmgmt_item_attr_l11n_lang",
|
||||
"itemmgmt_item_attr_type": {
|
||||
"name": "itemmgmt_item_attr_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_id"
|
||||
"foreignTable": "itemmgmt_attr_type",
|
||||
"foreignKey": "itemmgmt_attr_type_id"
|
||||
},
|
||||
"itemmgmt_item_attr_value": {
|
||||
"name": "itemmgmt_item_attr_value",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "itemmgmt_attr_value",
|
||||
"foreignKey": "itemmgmt_attr_value_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"itemmgmt_item_media_type": {
|
||||
"name": "itemmgmt_item_media_type",
|
||||
"fields": {
|
||||
"itemmgmt_item_media_type_id": {
|
||||
"name": "itemmgmt_item_media_type_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"itemmgmt_item_media_type_title": {
|
||||
"name": "itemmgmt_item_media_type_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -127,17 +264,19 @@
|
|||
"itemmgmt_item_media_type": {
|
||||
"name": "itemmgmt_item_media_type",
|
||||
"type": "INT",
|
||||
"null": false
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_item_media_type",
|
||||
"foreignKey": "itemmgmt_item_media_type_id"
|
||||
},
|
||||
"itemmgmt_item_media_src": {
|
||||
"name": "itemmgmt_item_media_src",
|
||||
"itemmgmt_item_media_item": {
|
||||
"name": "itemmgmt_item_media_item",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "itemmgmt_item",
|
||||
"foreignKey": "itemmgmt_item_id"
|
||||
},
|
||||
"itemmgmt_item_media_dst": {
|
||||
"name": "itemmgmt_item_media_dst",
|
||||
"itemmgmt_item_media_media": {
|
||||
"name": "itemmgmt_item_media_media",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "media",
|
||||
|
|
|
|||
|
|
@ -15,6 +15,16 @@ declare(strict_types=1);
|
|||
namespace Modules\ItemManagement\Admin;
|
||||
|
||||
use phpOMS\Module\InstallerAbstract;
|
||||
use phpOMS\DataStorage\Database\DatabasePool;
|
||||
use phpOMS\Module\ModuleInfo;
|
||||
use phpOMS\Config\SettingsInterface;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use Modules\ItemManagement\Models\ItemAttributeType;
|
||||
use Modules\ItemManagement\Models\ItemAttributeValue;
|
||||
use Modules\ItemManagement\Models\ItemAttributeTypeL11n;
|
||||
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
|
||||
use Modules\ItemManagement\Models\ItemAttributeTypeL11nMapper;
|
||||
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
|
||||
|
||||
/**
|
||||
* Installer class.
|
||||
|
|
@ -26,4 +36,80 @@ use phpOMS\Module\InstallerAbstract;
|
|||
*/
|
||||
final class Installer extends InstallerAbstract
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function install(DatabasePool $dbPool, ModuleInfo $info, SettingsInterface $cfgHandler) : void
|
||||
{
|
||||
parent::install($dbPool, $info, $cfgHandler);
|
||||
|
||||
$attrTypes = self::createItemAttributeTypes();
|
||||
self::createItemAttributeValues($attrTypes);
|
||||
}
|
||||
|
||||
private static function createItemAttributeTypes() : array
|
||||
{
|
||||
$itemAttrType = [];
|
||||
|
||||
$itemAttrType['color'] = new ItemAttributeType('color');
|
||||
ItemAttributeTypeMapper::create($itemAttrType['color']);
|
||||
ItemAttributeTypeL11nMapper::create(new ItemAttributeTypeL11n($itemAttrType['color']->getId(), 'Color', ISO639x1Enum::_EN));
|
||||
ItemAttributeTypeL11nMapper::create(new ItemAttributeTypeL11n($itemAttrType['color']->getId(), 'Farbe', ISO639x1Enum::_DE));
|
||||
|
||||
return $itemAttrType;
|
||||
}
|
||||
|
||||
private static function createItemAttributeValues(array $itemAttrType) : array
|
||||
{
|
||||
$itemAttrValue = [];
|
||||
|
||||
$id = $itemAttrType['color']->getId();
|
||||
$itemAttrValue['color'] = [];
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Red', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][0]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Rot', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][1]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Blue', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][2]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Blau', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][3]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Green', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][4]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Grün', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][5]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Yellow', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][6]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Gelb', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][7]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'White', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][8]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Weiss', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][9]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Black', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][10]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Schwarz', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][11]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Braun', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][12]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Braun', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][13]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Purple', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][14]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Lila', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][15]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Pink', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][16]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Rosa', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][17]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Orange', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][18]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Orange', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][19]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Grey', ISO639x1Enum::_EN);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][20]);
|
||||
$itemAttrValue['color'][] = new ItemAttributeValue($id, 'Grau', ISO639x1Enum::_DE);
|
||||
ItemAttributeValueMapper::create($itemAttrValue['color'][21]);
|
||||
|
||||
return $itemAttrType;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ use phpOMS\Contract\RenderableInterface;
|
|||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
use Model\SettingsEnum;
|
||||
use Modules\Admin\Models\LocalizationMapper;
|
||||
|
||||
/**
|
||||
* ItemManagement controller class.
|
||||
|
|
@ -48,7 +50,7 @@ final class BackendController extends Controller
|
|||
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/sales-item-list');
|
||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004805001, $request, $response));
|
||||
|
||||
$items = ItemMapper::getAll();
|
||||
$items = ItemMapper::withConditional('language', $response->getHeader()->getL11n()->getLanguage())::getAll();
|
||||
$view->addData('items', $items);
|
||||
|
||||
return $view;
|
||||
|
|
@ -180,6 +182,12 @@ final class BackendController extends Controller
|
|||
$item = ItemMapper::get((int) $request->getData('id'));
|
||||
$view->addData('item', $item);
|
||||
|
||||
$settings = $this->app->appSettings->get(null, [
|
||||
SettingsEnum::DEFAULT_LOCALIZATION,
|
||||
]);
|
||||
|
||||
$view->setData('defaultlocalization', LocalizationMapper::get((int) $settings['id']));
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
33
Docs/Dev/en/database.md
Normal file
33
Docs/Dev/en/database.md
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Database
|
||||
|
||||
## itemmgmt_item
|
||||
|
||||
Items
|
||||
|
||||
## itemmgmt_item_l11n
|
||||
|
||||
Item localizations
|
||||
|
||||
## itemmgmt_item_l11n_type
|
||||
|
||||
Item localization types (e.g. nam1, name2, description, ...)
|
||||
|
||||
## itemmgmt_attr_type
|
||||
|
||||
Available attribute types (e.g. size, color, weight, etc.)
|
||||
|
||||
## itemmgmt_attr_type_l11n
|
||||
|
||||
Attribute localizations
|
||||
|
||||
## itemmgmt_attr_value
|
||||
|
||||
Attribute values belonging to the attribute types (already localized). The localization can be omitted for globally valid values. Detailled numeric specifications should not be stored in here (e.g. size, length, weight etc.) since there are too many variations.
|
||||
|
||||
## itemmgmt_item_attr
|
||||
|
||||
Attribute types which a item has / should have. This references the selected default value from `itemmgmt_attr_value` or a custom value from `itemmgmt_item_attr_value`
|
||||
|
||||
## itemmgmt_item_attr_value
|
||||
|
||||
Custom attribute values of an item, in case globally defined attributes make no sense (e.g. color code, weight, length, size, ... usually numeric). These values are already localized. The localization can be omitted for globally valid values.
|
||||
|
|
@ -48,7 +48,7 @@ class Item
|
|||
|
||||
private $media = [];
|
||||
|
||||
private $l11n = null;
|
||||
private $l11n = [];
|
||||
|
||||
private $attributes = [];
|
||||
|
||||
|
|
@ -145,4 +145,38 @@ class Item
|
|||
{
|
||||
$this->number = $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add item l11n
|
||||
*
|
||||
* @param ItemL11n $l11n Item localization
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function addL11n(ItemL11n $l11n) : void
|
||||
{
|
||||
$this->l11n[] = $l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get l11n
|
||||
*
|
||||
* @param string $type Localization type
|
||||
*
|
||||
* @return ItemL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getL11n(string $type) : ItemL11n
|
||||
{
|
||||
foreach ($this->l11n as $l11n) {
|
||||
if ($l11n->getType()->getTitle() === $type) {
|
||||
return $l11n;
|
||||
}
|
||||
}
|
||||
|
||||
return new NullItemL11n();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
64
Models/ItemAttribute.php
Normal file
64
Models/ItemAttribute.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemAttribute implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
protected int $id = 0;
|
||||
|
||||
protected $item = 0;
|
||||
|
||||
protected $type = 0;
|
||||
|
||||
protected $value = 0;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
77
Models/ItemAttributeMapper.php
Normal file
77
Models/ItemAttributeMapper.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemAttributeMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_item_attr_id' => ['name' => 'itemmgmt_item_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_item_attr_item' => ['name' => 'itemmgmt_item_attr_item', 'type' => 'int', 'internal' => 'item'],
|
||||
'itemmgmt_item_attr_type' => ['name' => 'itemmgmt_item_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'itemmgmt_item_attr_value' => ['name' => 'itemmgmt_item_attr_value', 'type' => 'int', 'internal' => 'value'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string, by?:string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
'type' => [
|
||||
'mapper' => ItemAttributeTypeMapper::class,
|
||||
'self' => 'itemmgmt_item_l11n_typeref',
|
||||
],
|
||||
'value' => [
|
||||
'mapper' => ItemAttributeValueMapper::class,
|
||||
'self' => 'itemmgmt_item_l11n_typeref',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_item_attr';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_item_attr_id';
|
||||
}
|
||||
71
Models/ItemAttributeType.php
Normal file
71
Models/ItemAttributeType.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemAttributeType implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
protected int $id = 0;
|
||||
|
||||
protected string $name = '';
|
||||
|
||||
protected $fields = 0;
|
||||
|
||||
protected bool $custom = false;
|
||||
|
||||
protected $l11n = 0;
|
||||
|
||||
public function __construct(string $name = '')
|
||||
{
|
||||
$this->name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
103
Models/ItemAttributeTypeL11n.php
Normal file
103
Models/ItemAttributeTypeL11n.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemAttributeTypeL11n implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Item ID.
|
||||
*
|
||||
* @var int|ItemL11nType
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $type = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $title = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $description Title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($type = 0, string $title = '', string $language = ISO639x1Enum::_EN)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->title = $title;
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
76
Models/ItemAttributeTypeL11nMapper.php
Normal file
76
Models/ItemAttributeTypeL11nMapper.php
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemAttributeTypeL11nMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_attr_type_l11n_id' => ['name' => 'itemmgmt_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_attr_type_l11n_title' => ['name' => 'itemmgmt_attr_type_l11n_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||
'itemmgmt_attr_type_l11n_type' => ['name' => 'itemmgmt_attr_type_l11n_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'itemmgmt_attr_type_l11n_lang' => ['name' => 'itemmgmt_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string, by?:string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
'language' => [
|
||||
'mapper' => LanguageMapper::class,
|
||||
'self' => 'itemmgmt_attr_type_l11n_lang',
|
||||
'by' => 'code2',
|
||||
'column' => 'code2',
|
||||
'conditional' => true,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_attr_type_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_attr_type_l11n_id';
|
||||
}
|
||||
77
Models/ItemAttributeTypeMapper.php
Normal file
77
Models/ItemAttributeTypeMapper.php
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemAttributeTypeMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_attr_type_id' => ['name' => 'itemmgmt_attr_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_attr_type_name' => ['name' => 'itemmgmt_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'itemmgmt_attr_type_fields' => ['name' => 'itemmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||
'itemmgmt_attr_type_custom' => ['name' => 'itemmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $hasMany = [
|
||||
'l11n' => [
|
||||
'mapper' => ItemAttributeTypeL11nMapper::class,
|
||||
'table' => 'itemmgmt_attr_type_l11n',
|
||||
'external' => 'itemmgmt_attr_type_l11n_type',
|
||||
'column' => 'title',
|
||||
'conditional' => true,
|
||||
'self' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_attr_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_attr_type_id';
|
||||
}
|
||||
100
Models/ItemAttributeValue.php
Normal file
100
Models/ItemAttributeValue.php
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemAttributeValue implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
protected int $id = 0;
|
||||
|
||||
protected $type = 0;
|
||||
|
||||
protected ?int $valueInt = null;
|
||||
|
||||
protected ?string $valueStr = null;
|
||||
|
||||
protected ?float $valueDec = null;
|
||||
|
||||
protected ?\DateTime $valueDat = null;
|
||||
|
||||
protected bool $isDefault = false;
|
||||
|
||||
protected string $language = ISO639x1Enum::_EN;
|
||||
|
||||
protected string $country = ISO3166TwoEnum::_USA;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $description Title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($type = 0, $value = '', string $language = ISO639x1Enum::_EN)
|
||||
{
|
||||
$this->type = $type;
|
||||
|
||||
if (\is_string($value)) {
|
||||
$this->valueStr = $value;
|
||||
} elseif (\is_int($value)) {
|
||||
$this->valueInt = $value;
|
||||
} elseif (\is_float($value)) {
|
||||
$this->valueDec = $value;
|
||||
} elseif ($value instanceof \DateTimeInterface) {
|
||||
$this->valueDat = $value;
|
||||
}
|
||||
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
89
Models/ItemAttributeValueMapper.php
Normal file
89
Models/ItemAttributeValueMapper.php
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\CountryMapper;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemAttributeValueMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_attr_value_id' => ['name' => 'itemmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_attr_value_default' => ['name' => 'itemmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
||||
'itemmgmt_attr_value_type' => ['name' => 'itemmgmt_attr_value_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'itemmgmt_attr_value_valueStr' => ['name' => 'itemmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
||||
'itemmgmt_attr_value_valueInt' => ['name' => 'itemmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
||||
'itemmgmt_attr_value_valueDec' => ['name' => 'itemmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
||||
'itemmgmt_attr_value_valueDat' => ['name' => 'itemmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
||||
'itemmgmt_attr_value_lang' => ['name' => 'itemmgmt_attr_value_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
'itemmgmt_attr_value_country' => ['name' => 'itemmgmt_attr_value_country', 'type' => 'string', 'internal' => 'country'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string, by?:string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
'language' => [
|
||||
'mapper' => LanguageMapper::class,
|
||||
'self' => 'itemmgmt_attr_value_lang',
|
||||
'by' => 'code2',
|
||||
'column' => 'code2',
|
||||
'conditional' => true,
|
||||
],
|
||||
'country' => [
|
||||
'mapper' => CountryMapper::class,
|
||||
'self' => 'itemmgmt_attr_value_country',
|
||||
'by' => 'code2',
|
||||
'column' => 'code2',
|
||||
'conditional' => true,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_attr_value';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_attr_value_id';
|
||||
}
|
||||
220
Models/ItemL11n.php
Normal file
220
Models/ItemL11n.php
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemL11n implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Item ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $item = 0;
|
||||
|
||||
/**
|
||||
* Item ID.
|
||||
*
|
||||
* @var int|ItemL11nType
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $type = 0;
|
||||
|
||||
/**
|
||||
* Language.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $language = ISO639x1Enum::_EN;
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private string $description = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $description Title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct($type = 0, string $description = '', string $language = ISO639x1Enum::_EN)
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->description = $description;
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set item.
|
||||
*
|
||||
* @param int $item Item id
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setItem(int $item) : void
|
||||
{
|
||||
$this->item = $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getItem() : int
|
||||
{
|
||||
return $this->item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set type.
|
||||
*
|
||||
* @param int|ItemL11nType $type Item type
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setType($type) : void
|
||||
{
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get type
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get language
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getLanguage() : string
|
||||
{
|
||||
return $this->language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set language
|
||||
*
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setLanguage(string $language) : void
|
||||
{
|
||||
$this->language = $language;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item description.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getDescription() : string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description Description
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setDescription(string $description) : void
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'description' => $this->description,
|
||||
'item' => $this->item,
|
||||
'language' => $this->language,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
81
Models/ItemL11nMapper.php
Normal file
81
Models/ItemL11nMapper.php
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemL11nMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_item_l11n_id' => ['name' => 'itemmgmt_item_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_item_l11n_description' => ['name' => 'itemmgmt_item_l11n_description', 'type' => 'string', 'internal' => 'description', 'autocomplete' => true],
|
||||
'itemmgmt_item_l11n_item' => ['name' => 'itemmgmt_item_l11n_item', 'type' => 'int', 'internal' => 'item'],
|
||||
'itemmgmt_item_l11n_lang' => ['name' => 'itemmgmt_item_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
'itemmgmt_item_l11n_typeref' => ['name' => 'itemmgmt_item_l11n_typeref', 'type' => 'int', 'internal' => 'type'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:string, self:string, by?:string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $ownsOne = [
|
||||
'language' => [
|
||||
'mapper' => LanguageMapper::class,
|
||||
'self' => 'itemmgmt_item_l11n_lang',
|
||||
'by' => 'code2',
|
||||
'column' => 'code2',
|
||||
'conditional' => true,
|
||||
],
|
||||
'type' => [
|
||||
'mapper' => ItemL11nTypeMapper::class,
|
||||
'self' => 'itemmgmt_item_l11n_typeref',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_item_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_item_l11n_id';
|
||||
}
|
||||
110
Models/ItemL11nType.php
Normal file
110
Models/ItemL11nType.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Contract\ArrayableInterface;
|
||||
|
||||
/**
|
||||
* Item class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class ItemL11nType implements \JsonSerializable, ArrayableInterface
|
||||
{
|
||||
/**
|
||||
* Article ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
/**
|
||||
* Item type.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected string $title = '';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $description Title
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(string $title = '')
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getTitle() : string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title title
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function setTitle(string $title) : void
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize()
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
58
Models/ItemL11nTypeMapper.php
Normal file
58
Models/ItemL11nTypeMapper.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\Localization\Defaults\LanguageMapper;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @todo Do I really want to create a relation to the language mapper? It's not really needed right?
|
||||
*/
|
||||
final class ItemL11nTypeMapper extends DataMapperAbstract
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_item_l11n_type_id' => ['name' => 'itemmgmt_item_l11n_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_item_l11n_type_title' => ['name' => 'itemmgmt_item_l11n_type_title', 'type' => 'string', 'internal' => 'title'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $table = 'itemmgmt_item_l11n_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected static string $primaryField = 'itemmgmt_item_l11n_type_id';
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ final class ItemMapper extends DataMapperAbstract
|
|||
*/
|
||||
protected static array $columns = [
|
||||
'itemmgmt_item_id' => ['name' => 'itemmgmt_item_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'itemmgmt_item_no' => ['name' => 'itemmgmt_item_no', 'type' => 'string', 'internal' => 'number'],
|
||||
'itemmgmt_item_no' => ['name' => 'itemmgmt_item_no', 'type' => 'string', 'internal' => 'number', 'autocomplete' => true],
|
||||
'itemmgmt_item_info' => ['name' => 'itemmgmt_item_info', 'type' => 'string', 'internal' => 'info'],
|
||||
];
|
||||
|
||||
|
|
@ -66,11 +66,25 @@ final class ItemMapper extends DataMapperAbstract
|
|||
* @since 1.0.0
|
||||
*/
|
||||
protected static array $hasMany = [
|
||||
'media' => [
|
||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
'table' => 'itemmgmt_item_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
'external' => 'itemmgmt_item_media_dst',
|
||||
'self' => 'itemmgmt_item_media_src',
|
||||
// 'media' => [
|
||||
// 'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
// 'table' => 'itemmgmt_item_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
// 'external' => 'itemmgmt_item_media_dst',
|
||||
// 'self' => 'itemmgmt_item_media_src',
|
||||
// ],
|
||||
'l11n' => [
|
||||
'mapper' => ItemL11nMapper::class,
|
||||
'table' => 'itemmgmt_item_l11n',
|
||||
'external' => 'itemmgmt_item_l11n_item',
|
||||
'conditional' => true,
|
||||
'self' => null,
|
||||
],
|
||||
'attributes' => [
|
||||
'mapper' => ItemAttributeMapper::class,
|
||||
'table' => 'itemmgmt_item_attr',
|
||||
'external' => 'itemmgmt_item_attr_item',
|
||||
'conditional' => true,
|
||||
'self' => null,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
0
Models/ItemMedia.php
Normal file
0
Models/ItemMedia.php
Normal file
38
Models/NullItemAttribute.php
Normal file
38
Models/NullItemAttribute.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemAttribute extends ItemAttribute
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
38
Models/NullItemAttributeType.php
Normal file
38
Models/NullItemAttributeType.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemAttributeType extends ItemAttributeType
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
38
Models/NullItemAttributeTypeL11n.php
Normal file
38
Models/NullItemAttributeTypeL11n.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemAttributeTypeL11n extends ItemAttributeTypeL11n
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
38
Models/NullItemAttributeValue.php
Normal file
38
Models/NullItemAttributeValue.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemAttributeValue extends ItemAttributeValue
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
38
Models/NullItemL11n.php
Normal file
38
Models/NullItemL11n.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemL11n extends ItemL11n
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
38
Models/NullItemL11nType.php
Normal file
38
Models/NullItemL11nType.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\ItemManagement\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullItemL11nType extends ItemL11nType
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
}
|
||||
34
Models/StockManagementType.php
Normal file
34
Models/StockManagementType.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.4
|
||||
*
|
||||
* @package Model
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ItemManagement\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Default settings enum.
|
||||
*
|
||||
* @package Model
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class StockManagementType extends Enum
|
||||
{
|
||||
public const LOT = 1;
|
||||
|
||||
public const SN = 2;
|
||||
|
||||
public const NONE = 4;
|
||||
}
|
||||
|
|
@ -23,21 +23,41 @@ echo $this->getData('nav')->render(); ?>
|
|||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Items'); ?><i class="fa fa-download floatRight download btn"></i></div>
|
||||
<table class="default">
|
||||
<table id="iSalesItemList" class="default">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<input id="itemList-r1-asc" name="itemList-sort" type="radio"><label for="itemList-r1-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r1-desc" name="itemList-sort" type="radio"><label for="itemList-r1-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Name'); ?>
|
||||
<input id="itemList-r2-asc" name="itemList-sort" type="radio"><label for="itemList-r2-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r2-desc" name="itemList-sort" type="radio"><label for="itemList-r2-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Name'); ?>
|
||||
<input id="itemList-r3-asc" name="itemList-sort" type="radio"><label for="itemList-r3-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r3-desc" name="itemList-sort" type="radio"><label for="itemList-r3-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<input id="itemList-r4-asc" name="itemList-sort" type="radio"><label for="itemList-r4-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r4-desc" name="itemList-sort" type="radio"><label for="itemList-r4-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Price'); ?>
|
||||
<input id="itemList-r5-asc" name="itemList-sort" type="radio"><label for="itemList-r5-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r5-desc" name="itemList-sort" type="radio"><label for="itemList-r5-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Available'); ?>
|
||||
<input id="itemList-r6-asc" name="itemList-sort" type="radio"><label for="itemList-r6-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r6-desc" name="itemList-sort" type="radio"><label for="itemList-r6-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Reserved'); ?>
|
||||
<input id="itemList-r7-asc" name="itemList-sort" type="radio"><label for="itemList-r7-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r7-desc" name="itemList-sort" type="radio"><label for="itemList-r7-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<td><?= $this->getHtml('Ordered'); ?>
|
||||
<input id="itemList-r8-asc" name="itemList-sort" type="radio"><label for="itemList-r8-asc"><i class="sort-asc fa fa-chevron-up"></i></label>
|
||||
<input id="itemList-r8-desc" name="itemList-sort" type="radio"><label for="itemList-r8-desc"><i class="sort-desc fa fa-chevron-down"></i></label>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/prefix}sales/item/profile?{?}&id=' . $value->getId()); ?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNumber()); ?></a>
|
||||
<td>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name1')->getDescription()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name2')->getDescription()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name3')->getDescription()); ?></a>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -12,11 +12,17 @@
|
|||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Localization\NullLocalization;
|
||||
|
||||
/**
|
||||
* @var \Modules\ItemManagement\Models\Item $item
|
||||
*/
|
||||
$item = $this->getData('item');
|
||||
|
||||
$languages = \phpOMS\Localization\ISO639Enum::getConstants();
|
||||
|
||||
$l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
|
||||
|
||||
echo $this->getData('nav')->render();
|
||||
?>
|
||||
|
||||
|
|
@ -50,11 +56,11 @@ echo $this->getData('nav')->render();
|
|||
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($item->getNumber()); ?>" disabled></span>
|
||||
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml(''); ?>" required>
|
||||
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->getDescription()); ?>" required>
|
||||
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml(''); ?>">
|
||||
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->getDescription()); ?>">
|
||||
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml(''); ?>">
|
||||
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->getDescription()); ?>">
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
|
|
@ -200,7 +206,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iLanguages" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -209,7 +215,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iLanguages" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -268,7 +274,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iLanguages" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -277,7 +283,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iLanguages" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -286,13 +292,13 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iLanguages" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($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->getName5()); ?>">
|
||||
<td><input id="iName5" name="name5" type="text" value="<?= $this->printHtml('$item->getName1()'); ?>">
|
||||
<tr>
|
||||
<td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
|
||||
</table>
|
||||
|
|
@ -619,7 +625,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iEarningIndicator" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -628,7 +634,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iCostIndicator" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -637,7 +643,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iCostCenter" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<tr>
|
||||
|
|
@ -646,7 +652,7 @@ echo $this->getData('nav')->render();
|
|||
<td>
|
||||
<select id="iCostObject" name="settings_1000000020">
|
||||
<?php foreach ($languages as $code => $language) : ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === \strtolower($settings[1000000020]) ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->getLanguage() ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</table>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user