many small fixes

This commit is contained in:
Dennis Eichhorn 2023-02-10 18:20:57 +01:00
parent 000bd7fa11
commit f892ebcb7a
13 changed files with 1734 additions and 139 deletions

View File

@ -9,7 +9,7 @@
{
"type": "collection",
"create_directory": true,
"name": "Articles",
"name": "Items",
"virtualPath": "/Modules/ItemManagement",
"user": 1
},

View File

@ -8,7 +8,7 @@
"uri": null,
"target": "self",
"icon": "fa fa-usd",
"order": 20,
"order": 35,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 0,
@ -22,8 +22,8 @@
"uri": "{/lang}/{/app}/item/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "Sales",
"order": 5,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004801001,
"children": [
@ -36,8 +36,8 @@
"uri": "{/lang}/{/app}/item/attribute/type/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "Sales",
"order": 5,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004802001,
"children": []
@ -51,13 +51,75 @@
"uri": "{/lang}/{/app}/item/attribute/value/list?{?}",
"target": "self",
"icon": null,
"order": 15,
"from": "Sales",
"order": 10,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004802001,
"children": []
}
]
},
{
"id": 1004803001,
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Items",
"uri": "{/lang}/{/app}/item/list",
"target": "self",
"icon": null,
"order": 10,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004801001,
"children": [
{
"id": 1004803002,
"pid": "/item",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/lang}/{/app}/item/list",
"target": "self",
"icon": null,
"order": 1,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004803001,
"children": [
{
"id": 1004803003,
"pid": "/item",
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/lang}/{/app}/item/profile?{?}",
"target": "self",
"icon": null,
"order": 1,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004803002,
"children": []
}
]
},
{
"id": 1004803004,
"pid": "/item",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "{/lang}/{/app}/item/create?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "ItemManagement",
"permission": { "permission": 4, "category": null, "element": null },
"parent": 1004803001,
"children": []
}
]
}
]
},
@ -66,7 +128,7 @@
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Articles",
"name": "Items",
"uri": "{/lang}/{/app}/sales/item/list",
"target": "self",
"icon": null,
@ -94,7 +156,7 @@
"pid": "/sales/item",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/sales/item/single?{?}",
"target": "self",
"icon": null,
@ -128,7 +190,7 @@
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Articles",
"name": "Items",
"uri": "{/lang}/{/app}/purchase/item/list",
"target": "self",
"icon": null,
@ -156,7 +218,7 @@
"pid": "/purchase/item",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/purchase/item/single?{?}",
"target": "self",
"icon": null,
@ -190,7 +252,7 @@
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Articles",
"name": "Items",
"uri": "{/lang}/{/app}/warehouse/item/list",
"target": "self",
"icon": null,
@ -218,7 +280,7 @@
"pid": "/warehouse/item",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/warehouse/item/single?{?}",
"target": "self",
"icon": null,
@ -252,7 +314,7 @@
"pid": "/",
"type": 2,
"subtype": 1,
"name": "Articles",
"name": "Items",
"uri": "{/lang}/{/app}/production/item/list",
"target": "self",
"icon": null,
@ -280,7 +342,7 @@
"pid": "ac2ed3d0212c51b3ba19a5c862eca728c3cb9d18",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/production/item/single?{?}",
"target": "self",
"icon": null,
@ -314,7 +376,7 @@
"pid": "/sales/analysis",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/sales/analysis/item",
"target": "self",
"icon": null,
@ -329,7 +391,7 @@
"pid": "/purchase/analysis",
"type": 3,
"subtype": 1,
"name": "Article",
"name": "Item",
"uri": "{/lang}/{/app}/purchase/analysis/item",
"target": "self",
"icon": null,

View File

@ -128,11 +128,17 @@ final class Installer extends InstallerAbstract
$request->setData('number', (string) $item['number']);
$module->apiItemCreate($request, $response);
$itemId = $response->get('')['response']->getId();
$itemArray[] = !\is_array($response['response'])
? $response['response']->toArray()
: $response['response'];
$responseData = $response->get('');
if (!\is_array($responseData)) {
continue;
}
$itemId = $responseData['response']->getId();
$itemArray[] = !\is_array($responseData['response'])
? $responseData['response']->toArray()
: $responseData['response'];
foreach ($item['l11ns'] as $name => $l11ns) {
$l11nType = $l11nTypes[$name];

32
Admin/Routes/Web/Api.php Normal file
View File

@ -0,0 +1,32 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\ItemManagement\Controller\ApiController;
use Modules\ItemManagement\Models\PermissionCategory;
use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/item/find.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemFind',
'verb' => RouteVerb::GET,
'permission' => [
'module' => ApiController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
];

View File

@ -51,9 +51,9 @@ return [
],
],
],
'^.*/sales/item/list.*$' => [
'^/item/list.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesList',
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
@ -62,25 +62,37 @@ return [
],
],
],
'^.*/purchase/item/list.*$' => [
'^/item/create.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseList',
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::PURCHASE_ITEM,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/warehouse/item/list.*$' => [
'^/item/profile.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingList',
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemItem',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::STOCK_ITEM,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/sales/item/list.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
@ -95,28 +107,6 @@ return [
],
],
],
'^.*/purchase/item/create.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::PURCHASE_ITEM,
],
],
],
'.*/warehouse/item/create.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::STOCK_ITEM,
],
],
],
'^.*/sales/item/profile.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesItem',
@ -128,6 +118,29 @@ return [
],
],
],
'^.*/purchase/item/list.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::PURCHASE_ITEM,
],
],
],
'^.*/purchase/item/create.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::PURCHASE_ITEM,
],
],
],
'^.*/purchase/item/profile.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseItem',
@ -139,6 +152,29 @@ return [
],
],
],
'^.*/warehouse/item/list.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::STOCK_ITEM,
],
],
],
'.*/warehouse/item/create.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::STOCK_ITEM,
],
],
],
'^.*/warehouse/item/profile.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehouseItem',

View File

@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Controller;
use Modules\Admin\Models\NullAccount;
use Modules\Billing\Models\PricingMapper;
use Modules\ItemManagement\Models\Item;
use Modules\ItemManagement\Models\ItemAttribute;
use Modules\ItemManagement\Models\ItemAttributeMapper;
@ -35,7 +37,10 @@ use Modules\ItemManagement\Models\ItemRelationTypeMapper;
use Modules\ItemManagement\Models\NullItemAttributeType;
use Modules\ItemManagement\Models\NullItemAttributeValue;
use Modules\ItemManagement\Models\NullItemL11nType;
use Modules\Media\Models\Collection;
use Modules\Media\Models\CollectionMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
use Modules\Media\Models\PathSettings;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\ISO4217CharEnum;
@ -46,6 +51,7 @@ use phpOMS\Message\NotificationLevel;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Model\Message\FormValidation;
use phpOMS\System\MimeType;
/**
* ItemManagement class.
@ -57,6 +63,64 @@ use phpOMS\Model\Message\FormValidation;
*/
final class ApiController extends Controller
{
/**
* Api method to find items
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemFind(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
$l11n = ItemL11nMapper::getAll()
->with('type')
->where('type/title', ['name1', 'name2', 'name3'], 'IN')
->where('language', $request->getLanguage())
->where('description', '%' . ($request->getData('search') ?? '') . '%', 'LIKE')
->execute();
$items = [];
foreach ($l11n as $item) {
$items[] = $item->item;
}
$response->header->set('Content-Type', MimeType::M_JSON, true);
$response->set(
$request->uri->__toString(),
\array_values(
ItemMapper::getAll()
->with('l11n')
->with('l11n/type')
->where('id', $items, 'IN')
->where('l11n/type/title', ['name1', 'name2', 'name3'], 'IN')
->where('l11n/language', $request->getLanguage())
->execute()
)
);
/*
@todo: BIG TODO.
This is the query I want to be used internally:
select itemmgmt_item.itemmgmt_item_no, itemmgmt_item_l11n.itemmgmt_item_l11n_description
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 = "en"
AND itemmgmt_item_l11n.itemmgmt_item_l11n_description LIKE "%Doc%"
It is not used because they are defined as has many relations and therefore queried as a loop internally. I as the person making the request know its a 1 to 1 result despite the 1 to many db relation.
*/
}
/**
* Api method to create item
*
@ -85,9 +149,74 @@ final class ApiController extends Controller
$this->createModel($request->header->account, $item, ItemMapper::class, 'item', $request->getOrigin());
$this->app->dbPool->get()->con->commit();
$this->createMediaDirForItem($item->number, $request->header->account);
$uploadedFiles = $request->getFile('item_profile_image');
if (!empty($uploadedFiles)) {
// upload image
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
names: [],
fileNames: [],
files: $uploadedFiles,
account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ItemManagement/Items/' . $item->number,
virtualPath: '/Modules/ItemManagement/Items/' . $item->number,
pathSettings: PathSettings::FILE_PATH
);
// create type / media relation
$profileImageType = MediaTypeMapper::get()
->where('name', 'item_profile_image')
->execute();
$this->createModelRelation(
$request->header->account,
$uploaded[0]->getId(),
$profileImageType->getId(),
MediaMapper::class,
'types',
'',
$request->getOrigin()
);
// create item relation
$this->createModelRelation(
$request->header->account,
$item->getId(),
$uploaded[0]->getId(),
ItemMapper::class,
'files',
'',
$request->getOrigin()
);
}
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Item', 'Item successfully created', $item);
}
/**
* Create directory for an account
*
* @param string $number Item number
* @param int $createdBy Creator of the directory
*
* @return Collection
*
* @since 1.0.0
*/
private function createMediaDirForItem(string $number, int $createdBy) : Collection
{
$collection = new Collection();
$collection->name = $number;
$collection->setVirtualPath('/Modules/ItemManagement/Items');
$collection->setPath('/Modules/Media/Files/Modules/ItemManagement/Items/' . $number);
$collection->createdBy = new NullAccount($createdBy);
CollectionMapper::create()->execute($collection);
return $collection;
}
/**
* Method to create item from request.
*
@ -104,8 +233,8 @@ final class ApiController extends Controller
$item->salesPrice = new Money($request->getData('salesprice', 'int') ?? 0);
$item->purchasePrice = new Money($request->getData('purchaseprice', 'int') ?? 0);
$item->info = (string) ($request->getData('info') ?? '');
$item->parent = ($request->getData('parent') !== null) ? (int) $request->getData('parent') : null;
$item->unit = ($request->getData('unit') !== null) ? (int) $request->getData('unit') : null;
$item->parent = $request->getData('parent', 'int');
$item->unit = $request->getData('unit', 'int');
return $item;
}
@ -817,8 +946,8 @@ final class ApiController extends Controller
fileNames: $request->getDataList('filenames'),
files: $uploadedFiles,
account: $request->header->account,
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
virtualPath: '/Modules/ItemManagement/Articles/' . ($request->getData('item') ?? '0'),
basePath: __DIR__ . '/../../../Modules/Media/Files/Modules/ItemManagement/Items/' . ($request->getData('item') ?? '0'),
virtualPath: '/Modules/ItemManagement/Items/' . ($request->getData('item') ?? '0'),
pathSettings: PathSettings::FILE_PATH
);
@ -888,7 +1017,7 @@ final class ApiController extends Controller
return;
}
$request->setData('virtualpath', '/Modules/ItemManagement/Articles/' . $request->getData('id'), true);
$request->setData('virtualpath', '/Modules/ItemManagement/Items/' . $request->getData('id'), true);
$this->app->moduleManager->get('Editor')->apiEditorCreate($request, $response, $data);
if ($response->header->status !== RequestStatusCode::R_200) {

View File

@ -161,6 +161,41 @@ final class BackendController extends Controller
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementItemList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = ItemMapper::getAll()
->with('l11n')
->with('l11n/type')
->with('files')
->with('files/types')
->where('l11n/language', $response->getLanguage())
->where('l11n/type/title', ['name1', 'name2', 'name3'], 'IN')
->where('files/types/name', 'item_profile_image')
->limit(25)
->execute();
$view->addData('items', $items);
return $view;
}
/**
* Routing end-point for application behaviour.
*
@ -239,7 +274,7 @@ final class BackendController extends Controller
public function viewItemManagementWarehousingList(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/stock-list');
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/stock-item-list');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004807001, $request, $response));
$items = ItemMapper::getAll()->execute();
@ -311,6 +346,99 @@ final class BackendController extends Controller
return $view;
}
/**
* Routing end-point for application behaviour.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return View
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementItemItem(RequestAbstract $request, ResponseAbstract $response, $data = null) : View
{
$head = $response->get('Content')->getData('head');
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ItemManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-profile');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004803001, $request, $response));
/** @var \Modules\ItemManagement\Models\Item $item */
$item = ItemMapper::get()
->with('l11n')
->with('l11n/type')
->with('files')
->with('files/types')
->with('notes')
->where('id', (int) $request->getData('id'))
->where('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, 'notes')->sort('notes/id', OrderType::DESC)
->execute();
$view->addData('item', $item);
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, [
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->setData('defaultlocalization', LocalizationMapper::get()->where('id', (int) $settings->getId())->execute());
// 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'));
$lastOrder = SalesBillMapper::getLastOrderDateByItemId($item->getId());
$newestInvoices = SalesBillMapper::getAll()
->with('type')
->where('type/transferType', BillTransferType::SALES)
->sort('id', OrderType::DESC)
->limit(5)
->execute();
$topCustomers = [];
$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'));
} else {
$ytd = new Money();
$mtd = new Money();
$avg = new Money();
$lastOrder = null;
$newestInvoices = [];
$allInvoices = [];
$topCustomers = [];
$regionSales = [];
$countrySales = [];
$monthlySalesCosts = [];
}
$view->addData('ytd', $ytd);
$view->addData('mtd', $mtd);
$view->addData('avg', $avg);
$view->addData('lastOrder', $lastOrder);
$view->addData('newestInvoices', $newestInvoices);
$view->addData('allInvoices', $allInvoices);
$view->addData('topCustomers', $topCustomers);
$view->addData('regionSales', $regionSales);
$view->addData('countrySales', $countrySales);
$view->addData('monthlySalesCosts', $monthlySalesCosts);
return $view;
}
/**
* Routing end-point for application behaviour.
*

View File

@ -27,7 +27,7 @@ use phpOMS\Localization\Money;
* @link https://jingga.app
* @since 1.0.0
*/
class Item
class Item implements \JsonSerializable
{
/**
* ID.
@ -374,6 +374,7 @@ class Item
'number' => $this->number,
'status' => $this->status,
'info' => $this->info,
'l11n' => $this->l11n,
];
}

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
return ['Navigation' => [
'Analyze' => 'Analyze',
'Article' => 'Article',
'Items' => 'Items',
'Attributes' => 'Attributes',
'Create' => 'Create',
'ItemManagement' => 'Item Management',

156
Theme/Backend/item-list.tpl.php Executable file
View File

@ -0,0 +1,156 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = $this->getData('items') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<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>
<div class="slider">
<table id="iSalesItemList" class="default sticky">
<thead>
<tr>
<td>
<td><?= $this->getHtml('Number'); ?>
<label for="iSalesItemList-sort-1">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-1">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-2">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-2">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-3">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-3">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-4">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-4">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-5">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-6">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-7">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-8">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-8">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Price'); ?>
<label for="iSalesItemList-sort-9">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-9">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-10">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-10">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Available'); ?>
<label for="iSalesItemList-sort-11">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-11">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-12">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-12">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Reserved'); ?>
<label for="iSalesItemList-sort-13">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-13">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-14">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-14">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Ordered'); ?>
<label for="iSalesItemList-sort-15">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-15">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-16">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-16">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/lang}/{/app}/item/profile?{?}&id=' . $value->getId());
$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 ?
'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>
<td>
<td>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -0,0 +1,980 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Media\Models\NullMedia;
use phpOMS\Localization\ISO639Enum;
use phpOMS\Localization\Money;
use phpOMS\Localization\NullLocalization;
use phpOMS\Uri\UriFactory;
/** @var \Modules\ItemManagement\Models\Item $item */
$item = $this->getData('item');
$itemL11n = $item->getL11ns();
$itemAttribute = $item->getAttributes();
$notes = $item->getNotes();
$files = $item->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? [];
$allInvoices = $this->getData('allInvoices') ?? [];
$topCustomers = $this->getData('topCustomers') ?? [];
$regionSales = $this->getData('regionSales') ?? [];
$countrySales = $this->getData('countrySales') ?? [];
$monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
$languages = ISO639Enum::getConstants();
/** @var \phpOMS\Localization\Localization $l11n */
$l11n = $this->getData('defaultlocalization') ?? new NullLocalization();
echo $this->getData('nav')->render();
?>
<div class="tabview tab-2">
<div class="box wf-100 col-xs-12">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
<li><label for="c-tab-2"><?= $this->getHtml('Address'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Localization'); ?></label></li>
<li><label for="c-tab-4"><?= $this->getHtml('Attributes'); ?></label></li>
<li><label for="c-tab-5"><?= $this->getHtml('Sales'); ?></label></li>
<li><label for="c-tab-6"><?= $this->getHtml('Purchasing'); ?></label></li>
<li><label for="c-tab-7"><?= $this->getHtml('Production'); ?></label></li>
<li><label for="c-tab-8"><?= $this->getHtml('QA'); ?></label></li>
<li><label for="c-tab-9"><?= $this->getHtml('Packaging'); ?></label></li>
<li><label for="c-tab-10"><?= $this->getHtml('Accounting'); ?></label></li>
<li><label for="c-tab-11"><?= $this->getHtml('Stock'); ?></label></li>
<li><label for="c-tab-12"><?= $this->getHtml('Disposal'); ?></label></li>
<li><label for="c-tab-13"><?= $this->getHtml('Media'); ?></label></li>
<li><label for="c-tab-14"><?= $this->getHtml('Bills'); ?></label></li>
<li><label for="c-tab-15"><?= $this->getHtml('Logs'); ?></label></li>
</ul>
</div>
<div class="tab-content">
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
<div class="tab">
<div class="row">
<div class="col-xs-12 col-lg-3 last-lg">
<section class="portlet">
<form>
<div class="portlet-body">
<table class="layout wf-100">
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="fa fa-book"></i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->description); ?>" spellcheck="false" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
<tr><td><input type="text" id="iName2" name="name2" value="<?= $this->printHtml($item->getL11n('name2')->description); ?>" spellcheck="false">
<tr><td><label for="iName3"><?= $this->getHtml('Name3'); ?></label>
<tr><td><input type="text" id="iName3" name="name3" value="<?= $this->printHtml($item->getL11n('name3')->description); ?>" spellcheck="false">
</table>
</div>
<div class="portlet-foot">
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item"> <input type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-item">
</div>
</form>
</section>
<?php $image = $item->getFileByTypeName('item_profile_image'); ?>
<section class="portlet">
<div class="portlet-body">
<img alt="<?= $this->printHtml($image->name); ?>" width="100%" loading="lazy" class="item-image"
src="<?= $image instanceof NullMedia ?
'Web/Backend/img/logo_grey.png' :
UriFactory::build($image->getPath()); ?>">
</div>
</section>
<section class="portlet highlight-4">
<div class="portlet-body">
<textarea class="undecorated"></textarea>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-9 plain-grid">
<div class="row">
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-1">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>:
<td><?= $this->getData('ytd')->getCurrency(); ?>
<tr><td><?= $this->getHtml('MTDSales'); ?>:
<td><?= $this->getData('mtd')->getCurrency(); ?>
<tr><td><?= $this->getHtml('ILV'); ?>:
<td>
<tr><td><?= $this->getHtml('MRR'); ?>:
<td>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('LastOrder'); ?>:
<td><?= $this->getData('lastOrder') !== null ? $this->getData('lastOrder')->format('Y-m-d H:i') : ''; ?>
<tr><td><?= $this->getHtml('PriceChange'); ?>:
<td>
<tr><td><?= $this->getHtml('Created'); ?>:
<td><?= $item->createdAt->format('Y-m-d H:i'); ?>
<tr><td><?= $this->getHtml('Modified'); ?>:
<td>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3">
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('SalesPrice'); ?>:
<td><?= $item->salesPrice->getCurrency(); ?>
<tr><td><?= $this->getHtml('PurchasePrice'); ?>:
<td><?= $item->purchasePrice->getCurrency(); ?>
<tr><td><?= $this->getHtml('Margin'); ?>:
<td><?= \round(
$item->salesPrice->getInt() === 0
? 0
: ($item->salesPrice->getInt() - $item->purchasePrice->getInt()) / $item->salesPrice->getInt() * 100, 2
); ?> %
<tr><td><?= $this->getHtml('AvgPrice'); ?>:
<td><?= $this->getData('avg')->getCurrency(); ?>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Notes'); ?></div>
<div class="slider">
<table id="iNotesItemList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/lang}/{/app}/editor/single?{?}&id=' . $note->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->title); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Documents'); ?></div>
<div class="slider">
<table id="iFilesItemList" class="default">
<thead>
<tr>
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/lang}/{/app}/media/single?{?}&id=' . $file->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->name); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->extension); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('RecentInvoices'); ?></div>
<div class="slider">
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Number'); ?>
<td><?= $this->getHtml('Type'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Net'); ?>
<td><?= $this->getHtml('Date'); ?>
<tbody>
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
$url = UriFactory::build('{/lang}/{/app}/sales/bill?{?}&id=' . $invoice->getId());
?>
<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('{/lang}/{/app}/sales/client/profile?{?}&id=' . $invoice->client->getId()); ?>"><?= $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; ?>
</table>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head">Top Customers</div>
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Number'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Country'); ?>
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach ($topCustomers as $client) : ++$i;
$url = UriFactory::build('{/lang}/{/app}/sales/client/profile?id=' . $client->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->profile->account->name1); ?> <?= $this->printHtml($client->profile->account->name2); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->getCountry()); ?></a>
<td><a href="<?= $url; ?>"><?= (new Money((int) $topCustomers[1][$i]['net_sales']))->getCurrency(); ?></a>
<?php endforeach; ?>
</table>
</section>
</div>
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Sales'); ?></div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
"data": {
"labels": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = $monthly['month'] . '/' . \substr((string) $monthly['year'], -2);
}
?>
<?= '"' . \implode('", "', $temp) . '"'; ?>
],
"datasets": [
{
"label": "<?= $this->getHtml('Margin'); ?>",
"type": "line",
"data": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = \round(((((int) $monthly['net_sales']) - ((int) $monthly['net_costs'])) / ((int) $monthly['net_sales'])) * 100, 2);
}
?>
<?= \implode(',', $temp); ?>
],
"yAxisID": "axis-2",
"fill": false,
"borderColor": "rgb(255, 99, 132)",
"backgroundColor": "rgb(255, 99, 132)"
},
{
"label": "<?= $this->getHtml('Sales'); ?>",
"type": "bar",
"data": [
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = ((int) $monthly['net_sales']) / 1000;
}
?>
<?= \implode(',', $temp); ?>
],
"yAxisID": "axis-1",
"backgroundColor": "rgb(54, 162, 235)"
}
]
},
"options": {
"scales": {
"yAxes": [
{
"id": "axis-1",
"display": true,
"position": "left"
},
{
"id": "axis-2",
"display": true,
"position": "right",
"scaleLabel": {
"display": true,
"labelString": "<?= $this->getHtml('Margin'); ?> %"
},
"gridLines": {
"display": false
},
"beginAtZero": true,
"ticks": {
"min": 0,
"max": 100,
"stepSize": 10
}
}
]
}
}
}'></canvas>
</div>
</section>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head">Regions</div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "pie",
"data": {
"labels": [
"Europe", "America", "Asia", "Africa", "CIS", "Other"
],
"datasets": [{
"data": [
<?= (int) ($regionSales['Europe'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['America'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Asia'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Africa'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['CIS'] ?? 0) / 1000; ?>,
<?= (int) ($regionSales['Other'] ?? 0) / 1000; ?>
],
"backgroundColor": [
"rgb(255, 99, 132)",
"rgb(255, 159, 64)",
"rgb(255, 205, 86)",
"rgb(75, 192, 192)",
"rgb(54, 162, 235)",
"rgb(153, 102, 255)"
]
}]
}
}'></canvas>
</div>
</section>
</div>
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Countries'); ?></div>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
"data": {
"labels": [
<?= '"' . \implode('", "', \array_keys($countrySales)) . '"'; ?>
],
"datasets": [{
"label": "YTD",
"type": "bar",
"data": [
<?php
$temp = [];
foreach ($countrySales as $country) {
$temp[] = ((int) $country) / 1000;
}
?>
<?= \implode(',', $temp); ?>
],
"backgroundColor": "rgb(54, 162, 235)"
}]
}
}'></canvas>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
<input type="radio" id="c-tab-2" name="tabular-2" checked>
<div class="tab">
<div class="row">
<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-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>
<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">
<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">
<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('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('{/lang}/{/app}/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->title); ?></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; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-3" 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('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>
</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">
<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>
<tbody>
<?php $c = 0;
foreach ($itemAttribute as $key => $value) : ++$c;
$url = UriFactory::build('{/lang}/{/app}/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; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-4" 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('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>
</div>
<div class="col-xs-12 col-md-6">
<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>
<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('{/lang}/{/app}/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) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</section>
</div>
</div>
</div>
<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">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iPVariation"><?= $this->getHtml('Stock'); ?></label>
<tr>
<td><select id="iPVariation" name="pvariation">
<option value="0">
</select>
<tr>
<td><label for="iPName"><?= $this->getHtml('ReorderLevel'); ?></label>
<tr>
<td><input id="iPName" name="pname" type="text" placeholder="">
<tr>
<td><label for="iPName"><?= $this->getHtml('MinimumLevel'); ?></label>
<tr>
<td><input id="iPName" name="pname" type="text" placeholder="">
<tr>
<td><label for="iPName"><?= $this->getHtml('MaximumLevel'); ?></label>
<tr>
<td><input id="iPName" name="pname" type="text" placeholder="">
<tr>
<td><label for="iPName"><?= $this->getHtml('Leadtime'); ?></label>
<tr>
<td><input id="iPName" name="pname" type="number" min="0" step="1" placeholder="">
<tr>
<td><input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-item">
</table>
</form>
</div>
</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>
</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('{/lang}/{/app}/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) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>
<input type="radio" id="c-tab-6" name="tabular-2" checked>
<div class="tab">
<div class="row">
</div>
</div>
<input type="radio" id="c-tab-7" name="tabular-2" checked>
<div class="tab">
<div class="row">
</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">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iPVariation"><?= $this->getHtml('Container'); ?></label>
<tr>
<td><select id="iPVariation" name="pvariation">
<option value="0">
</select>
<tr>
<td><label for="iDiscount"><?= $this->getHtml('Quantity'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('GrossWeight'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('NetWeight'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('Width'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('Height'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('Length'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><label for="iDiscount"><?= $this->getHtml('Volume'); ?></label>
<tr>
<td><input id="iDiscount" name="discount" type="number" step="any" min="0" placeholder="">
<tr>
<td><input type="submit" value="<?= $this->getHtml('Add', '0', '0'); ?>">
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-9" 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 id="item-edit" action="<?= UriFactory::build('{/api}itemmgmt/item'); ?>" method="post">
<table class="layout wf-100">
<tbody>
<tr>
<td><label for="iEarningIndicator"><?= $this->getHtml('EarningIndicator'); ?></label>
<tr>
<td>
<select id="iEarningIndicator" 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="iCostIndicator"><?= $this->getHtml('CostIndicator'); ?></label>
<tr>
<td>
<select id="iCostIndicator" 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="iCostCenter"><?= $this->getHtml('CostCenter'); ?></label>
<tr>
<td>
<select id="iCostCenter" 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="iCostObject"><?= $this->getHtml('CostObject'); ?></label>
<tr>
<td>
<select id="iCostObject" 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>
</table>
</form>
</div>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-10" name="tabular-2" checked>
<div class="tab">
<div class="row">
</div>
</div>
<input type="radio" id="c-tab-11" name="tabular-2" checked>
<div class="tab">
<div class="row">
</div>
</div>
<input type="radio" id="c-tab-12" name="tabular-2" checked>
<div class="tab">
<div class="row">
</div>
</div>
<input type="radio" id="c-tab-13" name="tabular-2" checked>
<div class="tab">
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('RecentInvoices'); ?></div>
<table id="iSalesItemList" class="default">
<thead>
<tr>
<td><?= $this->getHtml('Number'); ?>
<td><?= $this->getHtml('Type'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Net'); ?>
<td><?= $this->getHtml('Date'); ?>
<tbody>
<?php
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) :
$url = UriFactory::build('{/lang}/{/app}/sales/bill?{?}&id=' . $invoice->getId());
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->netSales->getCurrency(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
</table>
</section>
</div>
</div>
</div>
<input type="radio" id="c-tab-14" name="tabular-2" checked>
<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>
<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>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,143 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = $this->getData('items') ?? [];
echo $this->getData('nav')->render(); ?>
<div class="row">
<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>
<div class="slider">
<table id="iSalesItemList" class="default sticky">
<thead>
<tr>
<td>
<td><?= $this->getHtml('Number'); ?>
<label for="iSalesItemList-sort-1">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-1">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-2">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-2">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-3">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-3">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-4">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-4">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-5">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-6">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesItemList-sort-7">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-7">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-8">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-8">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Available'); ?>
<label for="iSalesItemList-sort-11">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-11">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-12">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-12">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Reserved'); ?>
<label for="iSalesItemList-sort-13">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-13">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-14">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-14">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Ordered'); ?>
<label for="iSalesItemList-sort-15">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-15">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="iSalesItemList-sort-16">
<input type="radio" name="iSalesItemList-sort" id="iSalesItemList-sort-16">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/lang}/{/app}/item/profile?{?}&id=' . $value->getId());
$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 ?
'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>
<td>
<td>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>

View File

@ -1,78 +0,0 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\ItemManagement
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\Media\Models\NullMedia;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$items = $this->getData('items');
echo $this->getData('nav')->render(); ?>
<div class="row">
<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>
<div class="slider">
<table id="iWarehouseItemList" class="default sticky">
<thead>
<tr>
<td>
<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('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('{/lang}/{/app}/warehouse/item/profile?{?}&id=' . $value->getId());
$image = $value->getFileByType('backend_image');
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><img alt="<?= $this->printHtml($image->name); ?>" 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('{/lang}/{/app}/' . $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>
<td>
<td>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>