mirror of
https://github.com/Karaka-Management/oms-Attribute.git
synced 2026-01-11 16:48:41 +00:00
template fixes + bug fixes + style fixes
This commit is contained in:
parent
20e330a825
commit
071c876af7
|
|
@ -14,12 +14,10 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Attribute\Theme\Backend\Components;
|
namespace Modules\Attribute\Theme\Backend\Components;
|
||||||
|
|
||||||
use Modules\Attribute\Models\AttributeType;
|
|
||||||
use phpOMS\Localization\L11nManager;
|
use phpOMS\Localization\L11nManager;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
use phpOMS\Views\View;
|
use phpOMS\Views\View;
|
||||||
use Web\Backend\Views\L11nView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component view.
|
* Component view.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Attribute\Theme\Backend\Components;
|
namespace Modules\Attribute\Theme\Backend\Components;
|
||||||
|
|
||||||
|
use Modules\Attribute\Models\AttributeType;
|
||||||
use Modules\Attribute\Models\AttributeValue;
|
use Modules\Attribute\Models\AttributeValue;
|
||||||
use phpOMS\Localization\L11nManager;
|
use phpOMS\Localization\L11nManager;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
|
|
@ -32,6 +33,14 @@ use Web\Backend\Views\L11nView;
|
||||||
*/
|
*/
|
||||||
class AttributeValueView extends View
|
class AttributeValueView extends View
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Attributes
|
||||||
|
*
|
||||||
|
* @var \Modules\Attribute\Models\AttributeType
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public AttributeType $type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attributes
|
* Attributes
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,21 @@ use phpOMS\Uri\UriFactory;
|
||||||
$types = AttributeValueType::getConstants();
|
$types = AttributeValueType::getConstants();
|
||||||
|
|
||||||
$isNew = $this->attribute->id === 0;
|
$isNew = $this->attribute->id === 0;
|
||||||
$path = $this->path;
|
$path = $this->path;
|
||||||
|
|
||||||
echo $this->data['nav']->render(); ?>
|
echo $this->data['nav']->render(); ?>
|
||||||
|
|
||||||
<div class="tabview tab-2">
|
<div class="tabview tab-2">
|
||||||
|
<?php if (!$isNew) : ?>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<ul class="tab-links">
|
<ul class="tab-links">
|
||||||
<li><label for="c-tab-1"><?= $this->getHtml('Type', 'Attribute', 'Backend'); ?></label>
|
<li><label for="c-tab-1"><?= $this->getHtml('Type', 'Attribute', 'Backend'); ?></label>
|
||||||
<li><label for="c-tab-2"><?= $this->getHtml('Defaults', 'Attribute', 'Backend'); ?></label>
|
<li><label for="c-tab-2"><?= $this->getHtml('Defaults', 'Attribute', 'Backend'); ?></label>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
<input type="radio" id="c-tab-1" name="tabular-2"<?= $isNew || $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-6 col-xs-12">
|
<div class="col-md-6 col-xs-12">
|
||||||
|
|
@ -45,12 +47,12 @@ echo $this->data['nav']->render(); ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
|
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
|
||||||
<input id="iNAme" type="text" value="<?= $this->printHtml($this->attribute->name); ?>" disabled>
|
<input id="iNAme" type="text" value="<?= $this->printHtml($this->attribute->name); ?>"<?= $isNew ? ' required' : ' disabled'; ?>>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iType"><?= $this->getHtml('Datatype', 'Attribute', 'Backend'); ?></label>
|
<label for="iType"><?= $this->getHtml('Datatype', 'Attribute', 'Backend'); ?></label>
|
||||||
<select id="iType" name="type" disabled>
|
<select id="iType" name="type"<?= $isNew ? '' : ' disabled'; ?>>
|
||||||
<?php foreach ($types as $key => $type) : ?>
|
<?php foreach ($types as $key => $type) : ?>
|
||||||
<option value="<?= $type; ?>"<?= $type === $this->attribute->datatype ? ' selected' : ''; ?>><?= $this->getHtml($key, 'Attribute', 'Backend'); ?>
|
<option value="<?= $type; ?>"<?= $type === $this->attribute->datatype ? ' selected' : ''; ?>><?= $this->getHtml($key, 'Attribute', 'Backend'); ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|
@ -90,6 +92,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (!$isNew) : ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<?= $this->l11nView->render(
|
<?= $this->l11nView->render(
|
||||||
$this->l11ns,
|
$this->l11ns,
|
||||||
|
|
@ -98,14 +101,20 @@ echo $this->data['nav']->render(); ?>
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (!$isNew) : ?>
|
||||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
<div class="portlet-head"><?= $this->getHtml('Defaults'); ?><i class="g-icon download btn end-xs">download</i></div>
|
<div class="portlet-head">
|
||||||
|
<?= $this->getHtml('Defaults'); ?>
|
||||||
|
<i class="g-icon download btn end-xs">download</i>
|
||||||
|
<a class="button end-xs save" href="<?= UriFactory::build('{/base}/' . $path . '/attribute/value/create?type=' . $this->attribute->id); ?>"><?= $this->getHtml('New', '0', '0'); ?></a>
|
||||||
|
</div>
|
||||||
<div class="slider">
|
<div class="slider">
|
||||||
<table id="iAttributeValueList" class="default sticky">
|
<table id="iAttributeValueList" class="default sticky">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
@ -166,5 +175,6 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -32,20 +32,25 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iName"><?= $this->getHtml('Name', 'Attribute', 'Backend'); ?></label>
|
<label for="iLocalization"><?= $this->getHtml('Localization', 'Attribute', 'Backend'); ?></label>
|
||||||
<input id="iName" type="text" value="<?= $this->printHtml($this->attribute->getL11n()); ?>" disabled>
|
<input id="iLocalization" type="text" name="content" value="<?= $this->printHtml($this->attribute->getL11n()); ?>"<?= $isNew ? '' : ' disabled'; ?>>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="iValue"><?= $this->getHtml('Value', 'Attribute', 'Backend'); ?></label>
|
<label for="iValue"><?= $this->getHtml('Value', 'Attribute', 'Backend'); ?></label>
|
||||||
<?php if ($this->attribute->valueInt !== null) : ?>
|
<?php if ($this->type->datatype === AttributeValueType::_INT || $this->type->datatype === AttributeValueType::_FLOAT_INT) : ?>
|
||||||
<input id="iValue" type="number" name="value" value="<?= $this->attribute->valueInt; ?>">
|
<input id="iValue" type="number" name="value" value="<?= $this->attribute->valueInt; ?>">
|
||||||
<?php elseif ($this->attribute->valueDec !== null) : ?>
|
<?php elseif ($this->type->datatype === AttributeValueType::_FLOAT) : ?>
|
||||||
<input id="iValue" type="number" name="value" step="any" value="<?= $this->attribute->valueDec; ?>">
|
<input id="iValue" type="number" name="value" step="any" value="<?= $this->attribute->valueDec; ?>">
|
||||||
<?php elseif ($this->attribute->valueStr !== null) : ?>
|
<?php elseif ($this->type->datatype === AttributeValueType::_STRING) : ?>
|
||||||
<input id="iValue" type="text" name="value" value="<?= $this->printHtml($this->attribute->valueStr); ?>">
|
<input id="iValue" type="text" name="value" value="<?= $this->printHtml($this->attribute->valueStr); ?>">
|
||||||
<?php elseif ($this->attribute->valueDat !== null) : ?>
|
<?php elseif ($this->type->datatype === AttributeValueType::_DATETIME) : ?>
|
||||||
<input id="iValue" type="text" name="value" value="<?= $this->attribute->valueDat->format('Y-m-d\TH:i'); ?>">
|
<input id="iValue" type="text" name="value" value="<?= $this->attribute->valueDat->format('Y-m-d\TH:i'); ?>">
|
||||||
|
<?php elseif ($this->type->datatype === AttributeValueType::_BOOL) : ?>
|
||||||
|
<label class="checkbox" for="iValue">
|
||||||
|
<input type="checkbox" id="iValue" name="value" value="1"<?= $this->attribute->valueInt > 0 ? ' checked' : ''; ?>>
|
||||||
|
<span class="checkmark"></span>
|
||||||
|
</label>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -61,6 +66,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php if (!$isNew) : ?>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<?= $this->l11nView->render(
|
<?= $this->l11nView->render(
|
||||||
$this->l11ns,
|
$this->l11ns,
|
||||||
|
|
@ -68,4 +74,5 @@ echo $this->data['nav']->render(); ?>
|
||||||
'{/api}' . $this->path . '/attribute/value/l11n?csrf={$CSRF}'
|
'{/api}' . $this->path . '/attribute/value/l11n?csrf={$CSRF}'
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
@ -27,11 +27,12 @@ return ['Attribute' => [
|
||||||
'Type' => 'Type',
|
'Type' => 'Type',
|
||||||
'Unit' => 'Unit',
|
'Unit' => 'Unit',
|
||||||
'Value' => 'Value',
|
'Value' => 'Value',
|
||||||
'_INT' => 'INTEGER',
|
'_INT' => 'INTEGER',
|
||||||
'_STRING' => 'STRING',
|
'_STRING' => 'STRING',
|
||||||
'_FLOAT' => 'FLOAT',
|
'_FLOAT' => 'FLOAT',
|
||||||
'_FLOAT_INT' => 'FLOAT_INT',
|
'_FLOAT_INT' => 'FLOAT_INT',
|
||||||
'_DATETIME' => 'DATETIME',
|
'_DATETIME' => 'DATETIME',
|
||||||
'_BOOL' => 'BOOL',
|
'_BOOL' => 'BOOL',
|
||||||
'Defaults' => 'Standards',
|
'Defaults' => 'Standards',
|
||||||
|
'Localization' => 'Lokalisierung',
|
||||||
]];
|
]];
|
||||||
|
|
|
||||||
|
|
@ -27,11 +27,12 @@ return ['Attribute' => [
|
||||||
'Type' => 'Type',
|
'Type' => 'Type',
|
||||||
'Unit' => 'Unit',
|
'Unit' => 'Unit',
|
||||||
'Value' => 'Value',
|
'Value' => 'Value',
|
||||||
'_INT' => 'INTEGER',
|
'_INT' => 'INTEGER',
|
||||||
'_FLOAT_INT' => 'FLOAT_INT',
|
'_FLOAT_INT' => 'FLOAT_INT',
|
||||||
'_STRING' => 'STRING',
|
'_STRING' => 'STRING',
|
||||||
'_FLOAT' => 'FLOAT',
|
'_FLOAT' => 'FLOAT',
|
||||||
'_DATETIME' => 'DATETIME',
|
'_DATETIME' => 'DATETIME',
|
||||||
'_BOOL' => 'BOOL',
|
'_BOOL' => 'BOOL',
|
||||||
'Defaults' => 'Defaults',
|
'Defaults' => 'Defaults',
|
||||||
|
'Localization' => 'Localization',
|
||||||
]];
|
]];
|
||||||
|
|
|
||||||
|
|
@ -76,11 +76,11 @@ final class AttributeValueTest extends \PHPUnit\Framework\TestCase
|
||||||
$value = new AttributeValue();
|
$value = new AttributeValue();
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'valueInt' => null,
|
'valueInt' => null,
|
||||||
'valueStr' => null,
|
'valueStr' => null,
|
||||||
'valueDec' => null,
|
'valueDec' => null,
|
||||||
'valueDat' => null,
|
'valueDat' => null,
|
||||||
'isDefault' => false,
|
'isDefault' => false,
|
||||||
],
|
],
|
||||||
$value->toArray()
|
$value->toArray()
|
||||||
|
|
@ -92,11 +92,11 @@ final class AttributeValueTest extends \PHPUnit\Framework\TestCase
|
||||||
$value = new AttributeValue();
|
$value = new AttributeValue();
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
[
|
[
|
||||||
'id' => 0,
|
'id' => 0,
|
||||||
'valueInt' => null,
|
'valueInt' => null,
|
||||||
'valueStr' => null,
|
'valueStr' => null,
|
||||||
'valueDec' => null,
|
'valueDec' => null,
|
||||||
'valueDat' => null,
|
'valueDat' => null,
|
||||||
'isDefault' => false,
|
'isDefault' => false,
|
||||||
],
|
],
|
||||||
$value->jsonSerialize()
|
$value->jsonSerialize()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user