continue implementation

This commit is contained in:
Dennis Eichhorn 2023-06-09 17:39:31 +00:00
parent 6aac7e8192
commit c2556519c3
4 changed files with 15 additions and 127 deletions

View File

@ -402,7 +402,8 @@ final class BackendController extends Controller
SettingsEnum::DEFAULT_LOCALIZATION,
]);
$view->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$l11nTypes = ItemL11nTypeMapper::getAll()
->execute();

View File

@ -594,7 +594,7 @@ echo $this->data['nav']->render(); ?>
?>
<div class="box w-100">
<table class="default">
<caption><?= $this->getHtml('Logs'); ?><i class="fa fa-download floatRight download btn"></i></caption>
<caption><?= $this->getHtml('Logs'); ?><i class="fa fa-download end-xs download btn"></i></caption>
<thead>
<tr>
<td>IP

View File

@ -35,6 +35,7 @@ $topCustomers = $this->getData('topCustomers') ?? [[], []];
$regionSales = $this->data['regionSales'] ?? [];
$countrySales = $this->data['countrySales'] ?? [];
$monthlySalesCosts = $this->data['monthlySalesCosts'] ?? [];
$attributeView = $this->data['attributeView'];
$languages = ISO639Enum::getConstants();
@ -45,7 +46,7 @@ echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<div class="box wf-100 col-xs-12">
<div class="box">
<ul class="tab-links">
<li><label for="c-tab-1"><?= $this->getHtml('Profile'); ?></label></li>
<li><label for="c-tab-2"><?= $this->getHtml('Localization'); ?></label></li>
@ -571,127 +572,13 @@ echo $this->data['nav']->render();
<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">
<form id="attributeForm" action="<?= UriFactory::build('{/api}item/attribute'); ?>" method="post"
data-ui-container="#attributeTable tbody"
data-add-form="attributeForm"
data-add-tpl="#attributeTable tbody .oms-add-tpl-attribute">
<div class="portlet-head"><?= $this->getHtml('Attribute'); ?></div>
<div class="portlet-body">
<div class="form-group">
<label for="iAttributeId"><?= $this->getHtml('ID'); ?></label>
<input type="text" id="iAttributeId" name="id" data-tpl-text="/id" data-tpl-value="/id" disabled>
</div>
<!--
<div class="form-group">
<label for="iAttributesLanguage"><?= $this->getHtml('Language'); ?></label>
<select id="iAttributesLanguage" name="language" data-tpl-text="/language" data-tpl-value="/language">
<option value="">
<?php foreach ($languages as $code => $language) : ?>
<option value="<?= $this->printHtml($code); ?>" <?= $this->printHtml(\strtolower($code) === $l11n->language ? ' selected' : ''); ?>><?= $this->printHtml($language); ?>
<?php endforeach; ?>
</select>
</div>
-->
<div class="form-group">
<label for="iAttributesType"><?= $this->getHtml('Type'); ?></label>
<select id="iAttributesType" name="type" data-tpl-text="/type" data-tpl-value="/type">
<?php
$types = $this->data['attributeTypes'] ?? [];
foreach ($types as $type) : ?>
<option value="<?= $type->id; ?>"><?= $this->printHtml($type->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iAttributesUnit"><?= $this->getHtml('Unit'); ?></label>
<select id="iAttributesUnit" name="unit" data-tpl-text="/unit" data-tpl-value="/unit">
<option value="">
<?php
$units = $this->data['units'] ?? [];
foreach ($units as $unit) : ?>
<option value="<?= $unit->id; ?>"><?= $this->printHtml($unit->name); ?>
<?php endforeach; ?>
</select>
</div>
<div class="form-group">
<label for="iAttributeValue"><?= $this->getHtml('Value'); ?></label>
<pre class="textarea contenteditable" id="iAttributeValue" data-name="value" data-tpl-value="/value" contenteditable></pre>
</div>
</div>
<div class="portlet-foot">
<input id="bAttributeAdd" formmethod="put" type="submit" class="add-form" value="<?= $this->getHtml('Add', '0', '0'); ?>">
<input id="bAttributeSave" formmethod="post" type="submit" class="save-form hidden button save" value="<?= $this->getHtml('Update', '0', '0'); ?>">
<input type="submit" class="cancel-form hidden 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('Attributes'); ?><i class="lni lni-download download btn end-xs"></i></div>
<div class="slider">
<table id="attributeTable" class="default"
data-tag="form"
data-ui-element="tr"
data-add-tpl=".oms-add-tpl-attribute"
data-update-form="attributeForm">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<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('Value'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td><?= $this->getHtml('Unit'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody>
<template class="oms-add-tpl-attribute">
<tr data-id="" draggable="false">
<td>
<i class="fa fa-cogs btn update-form"></i>
<input id="attributeTable-remove-0" type="checkbox" class="hidden">
<label for="attributeTable-remove-0" class="checked-visibility-alt"><i class="fa fa-times btn form-action"></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="/value" data-tpl-value="/value"></td>
<td data-tpl-text="/unit" data-tpl-value="/unit"></td>
</tr>
</template>
<?php $c = 0;
foreach ($attribute as $key => $value) : ++$c; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="fa fa-cogs btn update-form"></i>
<?php if (!$value->type->isRequired) : ?>
<input id="attributeTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="attributeTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="fa fa-times btn form-action"></i></label>
<span class="checked-visibility">
<label for="attributeTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="attributeTable-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->getL11n()); ?>
<td data-tpl-text="/value" data-tpl-value="/value"><?= $value->value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?>
<td data-tpl-text="/unit" data-tpl-value="/unit" data-value="<?= $value->value->unit; ?>"><?= $this->printHtml($value->value->unit); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
</div>
<?= $attributeView->render(
$item->getAttributes(),
$this->data['attributeTypes'] ?? [],
$this->data['units'] ?? [],
'{/api}item/attribute'
);
?>
</div>
</div>
<input type="radio" id="c-tab-4" name="tabular-2" checked>

View File

@ -42,7 +42,7 @@ echo $this->data['nav']->render();
?>
<div class="tabview tab-2">
<div class="box wf-100 col-xs-12">
<div class="box">
<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>
@ -750,7 +750,7 @@ echo $this->data['nav']->render();
<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>
<caption><?= $this->getHtml('Prices'); ?><i class="fa fa-download end-xs download btn"></i></caption>
<thead>
<tr>
<td>
@ -951,7 +951,7 @@ echo $this->data['nav']->render();
<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>
<caption><?= $this->getHtml('Logs'); ?><i class="fa fa-download end-xs download btn"></i></caption>
<thead>
<tr>
<td>IP