Merge branch 'develop'

This commit is contained in:
Dennis Eichhorn 2024-04-24 23:44:29 +00:00
commit ff9e9dd03d
112 changed files with 775 additions and 296 deletions

View File

@ -13,10 +13,15 @@ on:
- cron: '0 0 1,15 * *'
jobs:
general_module_workflow:
general_module_workflow_php:
uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
general_module_workflow_js:
uses: Karaka-Management/Karaka/.github/workflows/js_template.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin\Install
* @copyright Dennis Eichhorn

View File

@ -19,7 +19,7 @@
"type": 2,
"subtype": 1,
"name": "Stock",
"uri": "{/base}/warehouse/stock/list?{?}",
"uri": "{/base}/warehouse/stock/list",
"target": "self",
"icon": null,
"order": 1,
@ -33,7 +33,7 @@
"type": 3,
"subtype": 1,
"name": "Stocks",
"uri": "{/base}/warehouse/stock/list?{?}",
"uri": "{/base}/warehouse/stock/list",
"target": "self",
"icon": null,
"order": 1,
@ -48,7 +48,7 @@
"type": 3,
"subtype": 1,
"name": "Locations",
"uri": "{/base}/warehouse/stock/location/list?{?}",
"uri": "{/base}/warehouse/stock/location/list",
"target": "self",
"icon": null,
"order": 5,
@ -63,7 +63,7 @@
"type": 3,
"subtype": 1,
"name": "Types",
"uri": "{/base}/warehouse/stock/type/list?{?}",
"uri": "{/base}/warehouse/stock/type/list",
"target": "self",
"icon": null,
"order": 10,

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin\Install
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin\Install
* @copyright Dennis Eichhorn

View File

@ -6,6 +6,13 @@
"de": "Standard"
}
},
{
"name": "virtual",
"l11n": {
"en": "Virtual",
"de": "Virtuell"
}
},
{
"name": "incoming",
"l11n": {
@ -47,5 +54,19 @@
"en": "Retention sample",
"de": "Rückstellmuster"
}
},
{
"name": "consignment",
"l11n": {
"en": "Consignment stock",
"de": "Konsignationslager"
}
},
{
"name": "duty_free",
"l11n": {
"en": "Duty-free",
"de": "Zollfreilager"
}
}
]

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -18,10 +18,11 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/warehouse/stock/list(\?.*$|$)' => [
'^/warehouse/stock/list(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockList',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
@ -29,10 +30,11 @@ return [
],
],
],
'^.*/warehouse/stock(\?.*)?$' => [
'^/warehouse/stock/view(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStock',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
@ -40,10 +42,23 @@ return [
],
],
],
'^.*/warehouse/stock/type/list(\?.*$|$)' => [
'^/warehouse/stock/create(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockCreate',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::STOCK,
],
],
],
'^/warehouse/stock/type/list(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockTypeList',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
@ -51,10 +66,11 @@ return [
],
],
],
'^.*/warehouse/stock/type(\?.*)?$' => [
'^/warehouse/stock/type/view(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockType',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
@ -62,10 +78,23 @@ return [
],
],
],
'^.*/warehouse/stock/location/list(\?.*$|$)' => [
'^/warehouse/stock/type/create(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockTypeCreate',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::STOCK,
],
],
],
'^/warehouse/stock/location/list(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocationList',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
@ -73,10 +102,23 @@ return [
],
],
],
'^.*/warehouse/stock/location(\?.*)?$' => [
'^/warehouse/stock/location/view(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocation',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::STOCK_LOCATION,
],
],
],
'^/warehouse/stock/location/create(\?.*$|$)' => [
[
'dest' => '\Modules\WarehouseManagement\Controller\BackendController:viewStockLocationCreate',
'verb' => RouteVerb::GET,
'active' => true,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Admin
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -42,7 +42,7 @@ use phpOMS\Message\ResponseAbstract;
final class ApiAttributeController extends Controller
{
/**
* Api method to create item attribute
* Api method to create Attribute
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -69,7 +69,7 @@ final class ApiAttributeController extends Controller
}
/**
* Method to create item attribute from request.
* Method to create lot attribute from request.
*
* @param RequestAbstract $request Request
*

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -21,6 +21,8 @@ use Modules\Billing\Models\BillTransferType;
use Modules\ClientManagement\Models\NullClient;
use Modules\ItemManagement\Models\StockIdentifierType;
use Modules\SupplierManagement\Models\NullSupplier;
use Modules\WarehouseManagement\Models\NullStock;
use Modules\WarehouseManagement\Models\NullStockType;
use Modules\WarehouseManagement\Models\Stock;
use Modules\WarehouseManagement\Models\StockDistribution;
use Modules\WarehouseManagement\Models\StockDistributionMapper;
@ -184,7 +186,9 @@ final class ApiController extends Controller
{
$location = new StockLocation();
$location->name = $request->getDataString('name') ?? '';
$location->stock = $request->getDataInt('stock') ?? 1;
$location->stock = new NullStock($request->getDataInt('stock') ?? 1);
$location->type = $request->hasData('type') ? new NullStockType((int) $request->getDataInt('type')) : null;
return $location;
}
@ -434,7 +438,7 @@ final class ApiController extends Controller
/** @var \Modules\WarehouseManagement\Models\StockTransaction[] $transactions */
$transactions = StockTransactionMapper::getAll()
->where('billElement', $new->id)
->execute();
->executeGetArray();
/*
if ($new->item === $old->item) {
@ -463,7 +467,7 @@ final class ApiController extends Controller
/** @var \Modules\WarehouseManagement\Models\StockTransaction[] $transactions */
$transactions = StockTransactionMapper::getAll()
->where('billElement', $new->id)
->execute();
->executeGetArray();
StockTransactionMapper::delete()->execute($transactions);
} elseif ($trigger === 'Billing-bill-delete') {
@ -471,7 +475,7 @@ final class ApiController extends Controller
/** @var \Modules\WarehouseManagement\Models\StockTransaction[] $transactions */
$transactions = StockTransactionMapper::getAll()
->where('billElement', $element->id)
->execute();
->executeGetArray();
StockTransactionMapper::delete()->execute($transactions);
// @todo consider not to delete but mark as deleted?
@ -491,7 +495,7 @@ final class ApiController extends Controller
/** @var \Modules\WarehouseManagement\Models\StockTransaction[] $transactions */
$transactions = StockTransactionMapper::getAll()
->where('billElement', $element->id)
->execute();
->executeGetArray();
foreach ($transactions as $transaction) {
$transaction->state = StockTransactionState::TRANSIT; // @todo change to more specific

View File

@ -3,7 +3,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -62,7 +62,7 @@ final class ApiStockTypeController extends Controller
}
/**
* Method to create item attribute from request.
* Method to create StockType from request.
*
* @param RequestAbstract $request Request
*
@ -83,7 +83,7 @@ final class ApiStockTypeController extends Controller
}
/**
* Validate item attribute create request
* Validate StockType create request
*
* @param RequestAbstract $request Request
*
@ -104,7 +104,7 @@ final class ApiStockTypeController extends Controller
}
/**
* Api method to create item attribute l11n
* Api method to create StockType l11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
@ -131,7 +131,7 @@ final class ApiStockTypeController extends Controller
}
/**
* Method to create item attribute l11n from request.
* Method to create StockType l11n from request.
*
* @param RequestAbstract $request Request
*
@ -150,7 +150,7 @@ final class ApiStockTypeController extends Controller
}
/**
* Validate item attribute l11n create request
* Validate StockType l11n create request
*
* @param RequestAbstract $request Request
*

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -70,7 +70,7 @@ final class BackendController extends Controller
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->limit(25)
->execute();
->executeGetArray();
}
return $view;
@ -106,7 +106,7 @@ final class BackendController extends Controller
} else {
$view->data['stocks'] = StockMapper::getAll()
->limit(25)
->execute();
->executeGetArray();
}
return $view;
@ -128,10 +128,43 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock');
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->data['stock'] = StockMapper::get()->where('id', (int) $request->getData('id'))->execute();
$view->data['stock'] = StockMapper::get()
->with('locations')
->with('locations/type')
->with('locations/type/l11n')
->where('id', (int) $request->getData('id'))
->where('locations/type/l11n/language', [$request->header->l11n->language, null])
->execute();
$view->data['types'] = StockTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $request->header->l11n->language)
->executeGetArray();
return $view;
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
return $view;
}
@ -155,18 +188,42 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-type-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->data['type'] = StockMapper::get()->where('id', (int) $request->getData('id'))->execute();
$view->data['type'] = StockMapper::get()
->where('id', (int) $request->getData('id'))->execute();
$l11nValues = StockTypeL11nMapper::getAll()
->with('type')
->where('ref', $view->data['type']->id)
->execute();
->executeGetArray();
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
$view->data['l11nValues'] = $l11nValues;
return $view;
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-type-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
return $view;
}
/**
* Routing end-point for application behavior.
*
@ -186,22 +243,13 @@ final class BackendController extends Controller
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
if ($request->getData('ptype') === 'p') {
$view->data['locations'] = StockLocationMapper::getAll()
->with('stock')
->limit(25)
->execute();
} elseif ($request->getData('ptype') === 'n') {
$view->data['locations'] = StockLocationMapper::getAll()
->with('stock')
->limit(25)
->execute();
} else {
$view->data['locations'] = StockLocationMapper::getAll()
->with('stock')
->limit(25)
->execute();
}
$view->data['locations'] = StockLocationMapper::getAll()
->with('stock')
->with('type')
->with('type/l11n')
->where('type/l11n/language', [$request->header->l11n->language, null])
->limit(25)
->executeGetArray();
return $view;
}
@ -222,10 +270,49 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location');
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->data['location'] = StockLocationMapper::get()->where('id', (int) $request->getData('id'))->execute();
$view->data['location'] = StockLocationMapper::get()
->with('stock')
->with('shelfs')
->with('type')
->with('type/l11n')
->where('type/l11n/language', [$request->header->l11n->language, null])
->where('id', (int) $request->getData('id'))
->execute();
$view->data['types'] = StockTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $request->header->l11n->language)
->executeGetArray();
return $view;
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface Returns a renderable object
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewStockLocationCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/WarehouseManagement/Theme/Backend/stock-location-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001302001, $request, $response);
$view->data['types'] = StockTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $request->header->l11n->language)
->executeGetArray();
return $view;
}

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn

0
ICAL.txt → ICLA.txt Executable file → Normal file
View File

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models\Attribute
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models\Attribute
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models\Attribute
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models\Attribute
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models\Attribute
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

46
Models/NullStockType.php Normal file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\WarehouseManagement\Models;
/**
* Null model
*
* @package Modules\WarehouseManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullStockType extends StockType
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
@ -59,6 +59,8 @@ class Stock
public bool $inventory = false;
public array $locations = [];
/**
* Constructor.
*

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
@ -41,4 +41,6 @@ class StockDistribution
public int $stock = 0;
public int $stockType = 0;
// @remark We don't care about the location because that is just an internal thing and not all companies really care about that.
}

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn
@ -34,9 +34,9 @@ class StockLocation
public string $name = '';
public int | Stock $stock = 0;
public Stock $stock;
public ?int $type = null;
public ?StockType $type = null;
public int $x = 0;
@ -44,6 +44,8 @@ class StockLocation
public int $z = 0;
public array $shelfs = [];
/**
* Constructor.
*
@ -54,5 +56,6 @@ class StockLocation
public function __construct(string $name = '')
{
$this->name = $name;
$this->stock = new NullStock();
}
}

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
@ -58,6 +58,34 @@ final class StockLocationMapper extends DataMapperFactory
],
];
/**
* Has one relation.
*
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
* @since 1.0.0
*/
public const OWNS_ONE = [
'type' => [
'mapper' => StockTypeMapper::class,
'external' => 'warehousemgmt_stocklocation_type',
],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'shelfs' => [
'mapper' => StockShelfMapper::class,
'table' => 'warehousemgmt_stockshelf',
'self' => 'warehousemgmt_stockshelf_location',
'external' => null,
],
];
/**
* Primary table.
*

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn
@ -80,6 +80,21 @@ final class StockMapper extends DataMapperFactory
],
];
/**
* Has many relation.
*
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
* @since 1.0.0
*/
public const HAS_MANY = [
'locations' => [
'mapper' => StockLocationMapper::class,
'table' => 'warehousemgmt_stocklocation',
'self' => 'warehousemgmt_stocklocation_stock',
'external' => null,
],
];
/**
* Primary table.
*
@ -125,7 +140,7 @@ final class StockMapper extends DataMapperFactory
/** @var \Modules\WarehouseManagement\Models\StockDistribution[] $temp */
$temp = StockDistributionMapper::getAll()
->where('item', $items, 'IN')
->execute();
->executeGetArray();
foreach ($temp as $t) {
if (!isset($dists[$t->item])) {

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Warehousing\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement\Models
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
@ -13,12 +13,12 @@
declare(strict_types=1);
return ['WarehouseManagement' => [
'Language' => '',
'Localization' => '',
'Localizations' => '',
'Locations' => '',
'Name' => 'Name',
'Stock' => 'Aktie',
'Stocks' => '',
'Type' => 'Typ',
'Locations' => 'Lagerplätze',
'Name' => 'Name',
'Stock' => 'Lager',
'Stocks' => 'Lager',
'Shelfs' => 'Fächer',
'Shelf' => 'Fach',
'Type' => 'Typ',
'Location' => 'Lagerplatz',
]];

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
@ -13,12 +13,12 @@
declare(strict_types=1);
return ['WarehouseManagement' => [
'Language' => '',
'Localization' => '',
'Localizations' => '',
'Locations' => 'Locations',
'Name' => 'Name',
'Stock' => 'Stock',
'Stocks' => 'Stocks',
'Type' => 'Type',
'Locations' => 'Locations',
'Name' => 'Name',
'Stock' => 'Stock',
'Stocks' => 'Stocks',
'Shelfs' => 'Shelfs',
'Shelf' => 'Shelf',
'Type' => 'Type',
'Location' => 'Location',
]];

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Localization
* @copyright Dennis Eichhorn

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -21,7 +21,11 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Stocks'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="portlet-head">
<?= $this->getHtml('Stocks'); ?>
<i class="g-icon download btn end-xs">download</i>
<a class="button end-xs save" href="<?= UriFactory::build('{/base}/warehouse/stock/create'); ?>"><?= $this->getHtml('New', '0', '0'); ?></a>
</div>
<div class="slider">
<table id="stockList" class="default sticky">
<thead>
@ -31,7 +35,7 @@ echo $this->data['nav']->render(); ?>
<tbody>
<?php $count = 0; foreach ($stocks as $key => $value) :
++$count;
$url = UriFactory::build('{/base}/warehouse/stock?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/warehouse/stock/view?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -29,15 +29,17 @@ echo $this->data['nav']->render(); ?>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Stock'); ?>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<td><?= $this->getHtml('Type'); ?>
<tbody>
<?php $count = 0; foreach ($locations as $key => $value) :
++$count;
$url = UriFactory::build('{/base}/warehouse/stock/location?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/warehouse/stock/location/view?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
<td><a href="<?= $url; ?>"><?= $value->stock->name; ?></a>
<td><a href="<?= $url; ?>"><?= $value->name; ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->type->getL11n()); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>

View File

@ -0,0 +1,153 @@
<?php
/**
* Jingga
*
* PHP Version 8.2
*
* @package Modules\Profile
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
use Modules\WarehouseManagement\Models\NullStockLocation;
use phpOMS\Uri\UriFactory;
$location = $this->data['location'] ?? new NullStockLocation();
$isNew = $location->id === 0;
echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="locationForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}warehouse/stock/location?csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Location'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iLocationId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" id="iLocationId" name="id" value="<?= $location->id; ?>" disabled>
</div>
<div class="form-group">
<label for="iLocationStock"><?= $this->getHtml('Stock'); ?></label>
<input type="text" id="iLocationStock" name="stock" value="<?= $location->stock->id; ?>"<?= $isNew ? ' required' : ' disabled'; ?>>
</div>
<div class="form-group">
<label for="iLocationName"><?= $this->getHtml('Name', '0', '0'); ?></label>
<input type="text" name="name" value="<?= $this->printHtml($location->name); ?>">
</div>
<div class="form-group">
<label for="iLocationType"><?= $this->getHtml('Type'); ?></label>
<select id="iLocationType" name="type">
<?php foreach ($this->data['types'] as $type) : ?>
<option value="<?= $type->id; ?>"<?= $type->id === $location->type?->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
</div>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-location">
<?php else : ?>
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-location">
<input class="cancel end-xs" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-location">
<?php endif; ?>
</div>
</form>
</section>
</div>
</div>
<?php if (!$isNew) : ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="shelfForm" action="<?= UriFactory::build('{/api}warehouse/stock/location/shelf?csrf={$CSRF}'); ?>" method="post"
data-ui-container="#shelfTable tbody"
data-add-form="shelfForm"
data-add-tpl="#shelfTable tbody .oms-add-tpl-shelf">
<div class="portlet-head"><?= $this->getHtml('Shelf'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iShelfId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" id="iShelfId" name="id" data-tpl-text="/id" data-tpl-value="/id" disabled>
</div>
<div class="form-group">
<label for="iShelfName"><?= $this->getHtml('Name', '0', '0'); ?></label>
<input type="text" name="name" data-tpl-value="/name" value="">
</div>
<input type="hidden" name="location" value="<?= $location->id; ?>">
</div>
<div class="portlet-foot">
<input id="bShelfAdd" formmethod="put" type="submit" class="add-form" value="<?= $this->getHtml('Add', '0', '0'); ?>">
<input id="bShelfSave" formmethod="post" type="submit" class="save-form vh button save" value="<?= $this->getHtml('Update', '0', '0'); ?>">
<input type="submit" class="cancel-form vh button close" value="<?= $this->getHtml('Cancel', '0', '0'); ?>">
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Shelfs'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="shelfTable" class="default sticky"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-shelf"
data-update-form="shelfForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Name', '0', '0'); ?>
<tbody>
<template class="oms-add-tpl-shelf">
<tr class="animated medium-duration greenCircleFade" data-id="" draggable="false">
<td>
<i class="g-icon btn update-form">settings</i>
<input id="shelfTable-remove-0" type="checkbox" class="vh">
<label for="shelfTable-remove-0" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="shelfTable-remove-0" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="shelfTable-remove-0" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<td data-tpl-text="/id" data-tpl-value="/id"></td>
<td data-tpl-text="/name" data-tpl-value="/name"></td>
</tr>
</template>
<?php $c = 0;
foreach ($location->shelfs as $key => $value) :
++$c;
$url = UriFactory::build('{/base}/warehouse/stock/location/shelf/view?id=' . $value->id);
?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<input id="shelfTable-remove-<?= $value->id; ?>" type="checkbox" class="vh">
<label for="shelfTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="shelfTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="shelfTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/name" data-tpl-value="/name"><a class="content" href="<?= $url; ?>"><?= $value->name; ?></a>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
</div>
<?php endif; ?>

View File

@ -1,26 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Profile
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
$location = $this->data['location'];
echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12">
<section class="portlet">
<div class="portlet-head"><?= $this->printHtml($location->name); ?></div>
<div class="portlet-body"></div>
</section>
</div>
</div>

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\WarehouseManagement
* @copyright Dennis Eichhorn
@ -21,7 +21,11 @@ echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Stocks'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="portlet-head">
<?= $this->getHtml('Stocks'); ?>
<i class="g-icon download btn end-xs">download</i>
<a class="button end-xs save" href="<?= UriFactory::build('{/base}/warehouse/stock/type/create'); ?>"><?= $this->getHtml('New', '0', '0'); ?></a>
</div>
<div class="slider">
<table id="stockList" class="default sticky">
<thead>
@ -31,7 +35,7 @@ echo $this->data['nav']->render(); ?>
<tbody>
<?php $count = 0; foreach ($types as $key => $value) :
++$count;
$url = UriFactory::build('{/base}/warehouse/stock/type?id=' . $value->id);
$url = UriFactory::build('{/base}/warehouse/stock/type/view?id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>

View File

@ -2,7 +2,7 @@
/**
* Jingga
*
* PHP Version 8.1
* PHP Version 8.2
*
* @package Modules\Profile
* @copyright Dennis Eichhorn
@ -12,82 +12,50 @@
*/
declare(strict_types=1);
$type = $this->data['type'];
use Modules\WarehouseManagement\Models\NullStockType;
use phpOMS\Uri\UriFactory;
$type = $this->data['type'] ?? new NullStockType();
$isNew = $type->id === 0;
echo $this->data['nav']->render();
?>
<div class="row">
<div class="col-xs-12">
<div class="col-xs-12 col-md-6">
<section class="portlet">
<form id="typeForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}warehouse/stock/type?csrf={$CSRF}'); ?>">
<div class="portlet-head"><?= $this->getHtml('Type'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iTypeId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" id="iTypeId" name="id" value="<?= $type->id; ?>" disabled>
</div>
<div class="form-group">
<label for="name"><?= $this->getHtml('Name'); ?></label>
<input id="name" name="name" value="<?= $this->printHtml($type->name); ?>" disabled>
<input id="name" type="text" name="name" value="<?= $this->printHtml($type->name); ?>"<?= $isNew ? ' required' : ' disabled'; ?>>
</div>
</div>
</section>
</div>
<div class="col-xs-12 col-md-6">
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Localizations'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="localizationTable" class="default sticky fixed-5"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-localization"
data-update-form="localizationForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<td><?= $this->getHtml('Name'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Language'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td class="wf-100"><?= $this->getHtml('Localization'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<tbody>
<template class="oms-add-tpl-attribute">
<tr data-id="" draggable="false">
<td>
<i class="g-icon btn update-form">settings</i>
<input id="attributeTable-remove-0" type="checkbox" class="vh">
<label for="attributeTable-remove-0" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="attributeTable-remove-0" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="attributeTable-remove-0" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<td data-tpl-text="/id" data-tpl-value="/id"></td>
<td data-tpl-text="/type" data-tpl-value="/type" data-value=""></td>
<td data-tpl-text="/language" data-tpl-value="/language"></td>
<td data-tpl-text="/l11n" data-tpl-value="/l11n"></td>
</tr>
</template>
<?php
$c = 0;
$itemL11n = $this->data['l11nValues'];
foreach ($itemL11n as $value) : ++$c; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if (!$value->type->isRequired) : ?>
<input id="localizationTable-remove-<?= $value->id; ?>" type="checkbox" class="vh">
<label for="localizationTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="localizationTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="localizationTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<?php endif; ?>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/type" data-tpl-value="/type" data-value="<?= $value->type->id; ?>"><?= $this->printHtml($value->type->title); ?>
<td data-tpl-text="/language" data-tpl-value="/language"><?= $this->printHtml($value->language); ?>
<td data-tpl-text="/l11n" data-tpl-value="/l11n" data-value="<?= \nl2br($this->printHtml($value->content)); ?>"><?= \nl2br($this->printHtml(\substr($value->content, 0, 100))); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input type="submit" value="<?= $this->getHtml('Create', '0', '0'); ?>" name="create-location">
<?php else : ?>
<input type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>" name="save-location">
<input class="cancel end-xs" type="submit" value="<?= $this->getHtml('Delete', '0', '0'); ?>" name="delete-location">
<?php endif; ?>
</div>
</form>
</section>
</div>
</div>
<?php if (!$isNew) : ?>
<div class="row">
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
[],
'{/api}warehouse/stock/type/l11n?csrf={$CSRF}'
);
?>
</div>
<?php endif; ?>

Some files were not shown because too many files have changed in this diff Show More