This commit is contained in:
Dennis Eichhorn 2024-03-10 02:24:56 +00:00
parent 99167eff50
commit 259657c410
6 changed files with 186 additions and 65 deletions

View File

@ -29,7 +29,7 @@
"children": [
{
"id": 1004802002,
"pid": "/item",
"pid": "/item/attribute",
"type": 3,
"subtype": 1,
"name": "Types",
@ -44,7 +44,7 @@
},
{
"id": 1004802003,
"pid": "/item",
"pid": "/item/attribute",
"type": 3,
"subtype": 1,
"name": "Values",
@ -134,7 +134,38 @@
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004801001,
"children": []
"children": [
{
"id": 1004804002,
"pid": "/item/material",
"type": 3,
"subtype": 1,
"name": "List",
"uri": "{/base}/item/material/list?{?}",
"target": "self",
"icon": null,
"order": 5,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004802001,
"children": []
},
{
"id": 1004804003,
"pid": "/item/material",
"type": 3,
"subtype": 1,
"name": "Create",
"uri": "{/base}/item/material/create?{?}",
"target": "self",
"icon": null,
"order": 10,
"from": "ItemManagement",
"permission": { "permission": 2, "category": null, "element": null },
"parent": 1004802001,
"children": []
}
]
}
]
},
@ -340,7 +371,7 @@
"children": [
{
"id": 1004808101,
"pid": "ac2ed3d0212c51b3ba19a5c862eca728c3cb9d18",
"pid": "/production/item",
"type": 3,
"subtype": 1,
"name": "List",
@ -354,7 +385,7 @@
"children": [
{
"id": 1004808301,
"pid": "ac2ed3d0212c51b3ba19a5c862eca728c3cb9d18",
"pid": "/production/item",
"type": 3,
"subtype": 1,
"name": "Item",
@ -371,7 +402,7 @@
},
{
"id": 1004808201,
"pid": "ac2ed3d0212c51b3ba19a5c862eca728c3cb9d18",
"pid": "/production/item",
"type": 3,
"subtype": 1,
"name": "Create",

View File

@ -197,6 +197,41 @@ return [
],
],
],
'^.*/production/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementProductionList',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/production/item/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementProductionCreate',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::CREATE,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/production/item/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementProductionItem',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,
'type' => PermissionType::READ,
'state' => PermissionCategory::SALES_ITEM,
],
],
],
'^.*/item/material/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemMaterialList',

View File

@ -75,7 +75,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-type-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = ItemAttributeTypeMapper::getAll()
@ -104,7 +104,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-value-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
$attributes = ItemAttributeValueMapper::getAll()
@ -133,7 +133,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-type');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = ItemAttributeTypeMapper::get()
@ -146,8 +146,10 @@ final class BackendController extends Controller
->where('ref', $attribute->id)
->execute();
$view->data['attribute'] = $attribute;
$view->data['l11ns'] = $l11ns;
$view->data['attribute'] = $attribute;
$view->data['l11nValues'] = $l11ns;
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
return $view;
}
@ -168,7 +170,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/attribute-value');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004802001, $request, $response);
/** @var \Modules\Attribute\Models\AttributeValue $attribute */
$attribute = ItemAttributeValueMapper::get()
@ -198,7 +200,7 @@ final class BackendController extends Controller
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-list');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response);
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004803001, $request, $response);
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = ItemMapper::getAll()
@ -273,6 +275,23 @@ final class BackendController extends Controller
return $this->viewItemManagementItemList($request, $response, $data);
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementProductionList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
return $this->viewItemManagementItemList($request, $response, $data);
}
/**
* Routing end-point for application behavior.
*
@ -349,6 +368,27 @@ final class BackendController extends Controller
return $view;
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementProductionCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-create');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004806001, $request, $response);
return $view;
}
/**
* Routing end-point for application behavior.
*
@ -571,6 +611,23 @@ final class BackendController extends Controller
return $this->viewItemManagementItem($request, $response, $data);
}
/**
* Routing end-point for application behavior.
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return RenderableInterface
*
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementProductionItem(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
return $this->viewItemManagementItem($request, $response, $data);
}
/**
* Routing end-point for application behavior.
*

View File

@ -13,22 +13,24 @@
declare(strict_types=1);
use Modules\Attribute\Models\AttributeValueType;
use phpOMS\Localization\ISO639Enum;
use Modules\Attribute\Models\NullAttributeType;
use phpOMS\Uri\UriFactory;
$types = AttributeValueType::getConstants();
$attribute = $this->data['attribute'];
$l11ns = $this->data['l11ns'];
$attribute = $this->data['attribute'] ?? new NullAttributeType();
$isNew = $attribute->id === 0;
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-md-6 col-xs-12">
<section id="task" class="portlet">
<form id="attributeForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item/attribute/type'); ?>">
<div class="portlet-head"><?= $this->getHtml('Attribute', 'Attribute', 'Backend'); ?></div>
<div class="portlet-body">
<div class="form-group">
<div class="form-group">
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<input type="text" value="<?= $this->printHtml((string) $attribute->id); ?>" disabled>
</div>
@ -68,31 +70,23 @@ echo $this->data['nav']->render(); ?>
</label>
</div>
</div>
<div class="portlet-foot">
<?php if ($isNew) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</section>
</div>
<div class="col-xs-12 col-md-6">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Language', '0', '0'); ?><i class="g-icon download btn end-xs">download</i></div>
<table class="default sticky">
<thead>
<tr>
<td>
<td>
<td><?= $this->getHtml('Language', '0', '0'); ?>
<td class="wf-100"><?= $this->getHtml('Title', 'Attribute', 'Backend'); ?>
<tbody>
<?php $c = 0; foreach ($l11ns as $key => $value) : ++$c; ?>
<tr>
<td><a href="#"><i class="g-icon">close</i></a>
<td><a href="#"><i class="g-icon">settings</i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
<td><?= $value->content; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</div>
</div>
<div class="row">
<?= $this->data['l11nView']->render(
$this->data['l11nValues'],
[],
'{/api}item/attribute/l11n'
);
?>
</div>

View File

@ -547,32 +547,32 @@ echo $this->data['nav']->render();
<div class="form-group">
<label for="iContainerQuantity"><?= $this->getHtml('Quantity'); ?></label>
<input id="iContainerQuantity" name="quantity" type="number" data-tpl-text="/quantity" data-tpl-value="/quantity">
<input id="iContainerQuantity" name="quantity" type="number" step="any" data-tpl-text="/quantity" data-tpl-value="/quantity">
</div>
<div class="form-group">
<label for="iContainerWeight"><?= $this->getHtml('Weight'); ?></label>
<input id="iContainerWeight" name="weight" type="number" data-tpl-text="/weight" data-tpl-value="/weight">
<input id="iContainerWeight" name="weight" type="number" step="any" data-tpl-text="/weight" data-tpl-value="/weight">
</div>
<div class="form-group">
<label for="iContainerWidth"><?= $this->getHtml('WidthLength'); ?></label>
<input id="iContainerWidth" name="width" type="number" data-tpl-text="/width" data-tpl-value="/width">
<input id="iContainerWidth" name="width" type="number" step="any" data-tpl-text="/width" data-tpl-value="/width">
</div>
<div class="form-group">
<label for="iContainerHeight"><?= $this->getHtml('Height'); ?></label>
<input id="iContainerHeight" name="height" type="number" data-tpl-text="/height" data-tpl-value="/height">
<input id="iContainerHeight" name="height" type="number" step="any" data-tpl-text="/height" data-tpl-value="/height">
</div>
<div class="form-group">
<label for="iContainerDepth"><?= $this->getHtml('Depth'); ?></label>
<input id="iContainerDepth" name="depth" type="number" data-tpl-text="/depth" data-tpl-value="/depth">
<input id="iContainerDepth" name="depth" type="number" step="any" data-tpl-text="/depth" data-tpl-value="/depth">
</div>
<div class="form-group">
<label for="iContainerVolume"><?= $this->getHtml('Volume'); ?></label>
<input id="iContainerVolume" name="volume" type="number" data-tpl-text="/volume" data-tpl-value="/volume">
<input id="iContainerVolume" name="volume" type="number" step="any" data-tpl-text="/volume" data-tpl-value="/volume">
</div>
</div>
<div class="portlet-foot">
@ -704,7 +704,7 @@ echo $this->data['nav']->render();
</select>
</div>
<div>
<input id="iPricePrice" class="wf-100" name="price_new" type="number" data-tpl-text="/price" data-tpl-value="/price">
<input id="iPricePrice" class="wf-100" name="price_new" type="number" step="any" data-tpl-text="/price" data-tpl-value="/price">
</div>
</div>
</div>
@ -712,7 +712,7 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPriceQuantity"><?= $this->getHtml('Quantity'); ?></label>
<input id="iPriceQuantity" name="quantity" type="number" data-tpl-text="/quantity" data-tpl-value="/quantity">
<input id="iPriceQuantity" name="quantity" type="number" step="any" data-tpl-text="/quantity" data-tpl-value="/quantity">
</div>
</div>
</div>
@ -721,21 +721,21 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPriceDiscount"><?= $this->getHtml('Discount'); ?></label>
<input id="iPriceDiscount" name="discount" type="number" data-tpl-text="/discount" data-tpl-value="/discount">
<input id="iPriceDiscount" name="discount" type="number" step="any" data-tpl-text="/discount" data-tpl-value="/discount">
</div>
</div>
<div>
<div class="form-group">
<label for="iPriceDiscountR"><?= $this->getHtml('DiscountP'); ?></label>
<input id="iPriceDiscountR" name="discountPercentage" type="number" data-tpl-text="/discountr" data-tpl-value="/discountr">
<input id="iPriceDiscountR" name="discountPercentage" type="number" step="any" data-tpl-text="/discountr" data-tpl-value="/discountr">
</div>
</div>
</div>
<div class="form-group">
<label for="iPriceBonus"><?= $this->getHtml('Bonus'); ?></label>
<input id="iPriceBonus" name="bonus" type="number" data-tpl-text="/bonus" data-tpl-value="/bonus">
<input id="iPriceBonus" name="bonus" type="number" step="any" data-tpl-text="/bonus" data-tpl-value="/bonus">
</div>
</div>
<div class="portlet-separator"></div>
@ -1104,7 +1104,7 @@ echo $this->data['nav']->render();
</select>
</div>
<div>
<input id="iPurchasePricePrice" class="wf-100" name="price_new" type="number" data-tpl-text="/price" data-tpl-value="/price">
<input id="iPurchasePricePrice" class="wf-100" name="price_new" type="number" step="any" data-tpl-text="/price" data-tpl-value="/price">
</div>
</div>
</div>
@ -1112,7 +1112,7 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPurchasePriceQuantity"><?= $this->getHtml('Quantity'); ?></label>
<input id="iPurchasePriceQuantity" name="quantity" type="number" data-tpl-text="/quantity" data-tpl-value="/quantity">
<input id="iPurchasePriceQuantity" name="quantity" type="number" step="any" data-tpl-text="/quantity" data-tpl-value="/quantity">
</div>
</div>
</div>
@ -1121,21 +1121,21 @@ echo $this->data['nav']->render();
<div>
<div class="form-group">
<label for="iPurchasePriceDiscount"><?= $this->getHtml('Discount'); ?></label>
<input id="iPurchasePriceDiscount" name="discount" type="number" data-tpl-text="/discount" data-tpl-value="/discount">
<input id="iPurchasePriceDiscount" name="discount" type="number" step="any" data-tpl-text="/discount" data-tpl-value="/discount">
</div>
</div>
<div>
<div class="form-group">
<label for="iPurchasePriceDiscountP"><?= $this->getHtml('DiscountP'); ?></label>
<input id="iPurchasePriceDiscountP" name="discountPercentage" type="number" data-tpl-text="/discountr" data-tpl-value="/discountr">
<input id="iPurchasePriceDiscountP" name="discountPercentage" type="number" step="any" data-tpl-text="/discountr" data-tpl-value="/discountr">
</div>
</div>
</div>
<div class="form-group">
<label for="iPurchasePriceBonus"><?= $this->getHtml('Bonus'); ?></label>
<input id="iPurchasePriceBonus" name="bonus" type="number" data-tpl-text="/bonus" data-tpl-value="/bonus">
<input id="iPurchasePriceBonus" name="bonus" type="number" step="any" data-tpl-text="/bonus" data-tpl-value="/bonus">
</div>
</div>
<div class="portlet-separator"></div>

View File

@ -12,20 +12,20 @@
*/
declare(strict_types=1);
use phpOMS\Localization\NullBaseStringL11nType;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Localization\BaseStringL11nType */
$type = $this->data['type'];
$type = $this->data['type'] ?? new NullBaseStringL11nType();
$isNew = $type->id === 0;
/** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<div class="portlet">
<form id="materialForm" method="POST" action="<?= UriFactory::build('{/api}item/material'); ?>"
data-ui-container="#materialTable tbody"
data-add-form="materialForm"
data-add-tpl="#materialTable tbody .oms-add-tpl-material">
<form id="materialForm" method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}item/material'); ?>">
<div class="portlet-head"><?= $this->getHtml('Material'); ?></div>
<div class="portlet-body">
<div class="form-group">
@ -36,7 +36,11 @@ echo $this->data['nav']->render(); ?>
<div class="portlet-foot">
<input type="hidden" name="id" value="<?= $type->id; ?>">
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php if ($isNew) : ?>
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
<?php else : ?>
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
<?php endif; ?>
</div>
</form>
</div>