fix demoSetup

This commit is contained in:
Dennis Eichhorn 2023-04-16 01:55:35 +02:00
parent e2e89813d2
commit 7572b3af04
7 changed files with 202 additions and 38 deletions

View File

@ -467,11 +467,171 @@
"de": "Dual use"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": 0,
"values": [
{
"value": 0
},
{
"value": 1
}
]
},
{
"name": "contract",
"l11n": {
"en": "Contract",
"de": "Vertrag"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": 0,
"values": [
]
},
{
"name": "subscription",
"l11n": {
"en": "Subscription",
"de": "Abonoment"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": 0,
"values": [
{
"value": 0
},
{
"value": 1
}
]
},
{
"name": "subscription_interval_types",
"l11n": {
"en": "Subscription type",
"de": "Abonoment Typ"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": 0,
"l11n": {
"en": "Manual",
"de": "Manuell"
}
},
{
"value": 1,
"l11n": {
"en": "Daily",
"de": "Daily"
}
},
{
"value": 2,
"l11n": {
"en": "Weekly",
"de": "Weekly"
}
},
{
"value": 3,
"l11n": {
"en": "Monthly",
"de": "Monthly"
}
},
{
"value": 4,
"l11n": {
"en": "Annually",
"de": "Annually"
}
}
]
},
{
"name": "subscription_interval_value",
"l11n": {
"en": "Subscription interval",
"de": "Abonoment Intervall"
},
"value_type": 2,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": []
"values": [
]
},
{
"name": "subscription_renewal_type",
"l11n": {
"en": "Subscription renewal type",
"de": "Abonoment Verlaengerung Art"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": 0,
"l11n": {
"en": "Manual",
"de": "Manuell"
}
},
{
"value": 1,
"l11n": {
"en": "Automatic",
"de": "Automatic"
}
}
]
},
{
"name": "subscription_interval_end",
"l11n": {
"en": "Subscription renewal end",
"de": "Abonoment Verlaengerung Ende"
},
"value_type": 1,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"default_value": "",
"values": [
{
"value": 0,
"l11n": {
"en": "Exact",
"de": "Exakt"
}
},
{
"value": 1,
"l11n": {
"en": "End of interval",
"de": "Intervallende"
}
}
]
},
{
"name": "download_link",

View File

@ -16,6 +16,7 @@ namespace Modules\ItemManagement\Admin;
use Modules\Attribute\Models\AttributeTypeMapper;
use Modules\Attribute\Models\AttributeValue;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Config\SettingsInterface;
@ -110,7 +111,7 @@ final class Installer extends InstallerAbstract
$module = $app->moduleManager->getModuleInstance('ItemManagement');
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
$attributeTypes = AttributeTypeMapper::getAll()->with('defaults')->execute();
$attributeTypes = ItemAttributeTypeMapper::getAll()->with('defaults')->execute();
/** @var \Modules\ItemManagement\Models\ItemL11nType[] $l11nTypes */
$l11nTypes = ItemL11nTypeMapper::getAll()->execute();

View File

@ -75,7 +75,7 @@ return [
],
'^/item/profile.*$' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemItem',
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItem',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::NAME,

View File

@ -18,8 +18,8 @@ use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\Billing\Models\BillTransferType;
use Modules\Billing\Models\SalesBillMapper;
use Modules\Attribute\Models\AttributeTypeMapper;
use Modules\Attribute\Models\AttributeValueMapper;
use Modules\ItemManagement\Models\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\ItemAttributeValueMapper;
use Modules\ItemManagement\Models\ItemMapper;
use phpOMS\Asset\AssetType;
use phpOMS\Contract\RenderableInterface;
@ -62,7 +62,7 @@ final class BackendController extends Controller
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
/** @var \Modules\Attribute\Models\AttributeType[] $attributes */
$attributes = AttributeTypeMapper::getAll()
$attributes = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->getLanguage())
->execute();
@ -91,7 +91,7 @@ final class BackendController extends Controller
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
/** @var \Modules\Attribute\Models\AttributeValue[] $attributes */
$attributes = AttributeValueMapper::getAll()
$attributes = ItemAttributeValueMapper::getAll()
->with('l11n')
->where('l11n/language', $response->getLanguage())
->execute();
@ -120,7 +120,7 @@ final class BackendController extends Controller
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
/** @var \Modules\Attribute\Models\AttributeType $attribute */
$attribute = AttributeTypeMapper::get()
$attribute = ItemAttributeTypeMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->getLanguage())
@ -150,7 +150,7 @@ final class BackendController extends Controller
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1004801001, $request, $response));
/** @var \Modules\Attribute\Models\AttributeValue $attribute */
$attribute = AttributeValueMapper::get()
$attribute = ItemAttributeValueMapper::get()
->with('l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->getLanguage())
@ -322,7 +322,7 @@ final class BackendController extends Controller
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewItemManagementItemItem(RequestAbstract $request, ResponseAbstract $response, $data = null) : View
public function viewItemManagementItem(RequestAbstract $request, ResponseAbstract $response, $data = null) : View
{
$head = $response->get('Content')->getData('head');
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
@ -366,12 +366,14 @@ final class BackendController extends Controller
$newestInvoices = SalesBillMapper::getAll()
->with('type')
->with('type/l11n')
->where('type/transferType', BillTransferType::SALES)
->where('type/l11n/language', $response->getLanguage())
->sort('id', OrderType::DESC)
->limit(5)
->execute();
$topCustomers = [];
$topCustomers = SalesBillMapper::getItemTopClients($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
$allInvoices = SalesBillMapper::getItemBills($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$regionSales = SalesBillMapper::getItemRegionSales($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'));
$countrySales = SalesBillMapper::getItemCountrySales($item->getId(), new SmartDateTime('Y-01-01'), new SmartDateTime('now'), 5);
@ -417,7 +419,7 @@ final class BackendController extends Controller
*/
public function viewItemManagementSalesItem(RequestAbstract $request, ResponseAbstract $response, $data = null) : View
{
return $this->viewItemManagementItemItem($request, $response, $data);
return $this->viewItemManagementItem($request, $response, $data);
}
/**
@ -434,7 +436,7 @@ final class BackendController extends Controller
*/
public function viewItemManagementPurchaseItem(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
return $this->viewItemManagementItemItem($request, $response, $data);
return $this->viewItemManagementItem($request, $response, $data);
}
/**
@ -451,7 +453,7 @@ final class BackendController extends Controller
*/
public function viewItemManagementWarehouseItem(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{
return $this->viewItemManagementItemItem($request, $response, $data);
return $this->viewItemManagementItem($request, $response, $data);
}
/**

View File

@ -101,6 +101,7 @@ return ['ItemManagement' => [
'Properties' => 'Properties',
'Property' => 'Property',
'Purchase' => 'Purchase',
'Procurement' => 'Procurement',
'PurchasePrice' => 'Purchase Price',
'Purchasing' => 'Purchasing',
'QA' => 'QA',
@ -137,5 +138,6 @@ return ['ItemManagement' => [
'Volume' => 'Volume',
'Warehouse' => 'Warehouse',
'Width' => 'Width',
'TopCustomers' => 'Top Customers',
'YTDSales' => 'YTD Sales',
]];

View File

@ -134,9 +134,9 @@ echo $this->getData('nav')->render(); ?>
?>
<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>
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>

View File

@ -29,7 +29,7 @@ $files = $item->getFiles();
$newestInvoices = $this->getData('newestInvoices') ?? [];
$allInvoices = $this->getData('allInvoices') ?? [];
$topCustomers = $this->getData('topCustomers') ?? [];
$topCustomers = $this->getData('topCustomers') ?? [[], []];
$regionSales = $this->getData('regionSales') ?? [];
$countrySales = $this->getData('countrySales') ?? [];
$monthlySalesCosts = $this->getData('monthlySalesCosts') ?? [];
@ -46,31 +46,30 @@ echo $this->getData('nav')->render();
<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>
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
<li><label for="c-tab-3"><?= $this->getHtml('Attributes'); ?></label></li>
<li><label for="c-tab-4"><?= $this->getHtml('Pricing'); ?></label></li>
<li><label for="c-tab-5"><?= $this->getHtml('Procurement'); ?></label></li>
<li><label for="c-tab-6"><?= $this->getHtml('Production'); ?></label></li>
<li><label for="c-tab-7"><?= $this->getHtml('QA'); ?></label></li>
<li><label for="c-tab-8"><?= $this->getHtml('Packaging'); ?></label></li>
<li><label for="c-tab-9"><?= $this->getHtml('Accounting'); ?></label></li>
<li><label for="c-tab-10"><?= $this->getHtml('Stock'); ?></label></li>
<li><label for="c-tab-11"><?= $this->getHtml('Disposal'); ?></label></li>
<li><label for="c-tab-12"><?= $this->getHtml('Media'); ?></label></li>
<li><label for="c-tab-13"><?= $this->getHtml('Bills'); ?></label></li>
<li><label for="c-tab-14"><?= $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="row">
<div class="col-xs-12 col-lg-3 last-lg">
<section class="portlet">
<form>
<div class="portlet-body">
<table class="layout wf-100">
<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>
@ -79,7 +78,7 @@ echo $this->getData('nav')->render();
<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>
</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">
@ -244,7 +243,7 @@ echo $this->getData('nav')->render();
<div class="row">
<div class="col-xs-12 col-lg-6">
<section class="portlet">
<div class="portlet-head">Top Customers</div>
<div class="portlet-head"><?= $this->getHtml('TopCustomers'); ?></div>
<table id="iSalesItemList" class="default">
<thead>
<tr>
@ -253,12 +252,12 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Country'); ?>
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach ($topCustomers as $client) : ++$i;
<?php $i = -1; foreach (($topCustomers[0] ?? []) as $client) : ++$i;
$url = UriFactory::build('{/base}/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->account->name1); ?> <?= $this->printHtml($client->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; ?>