Extended store location options can be edited via Admin page now.

This commit is contained in:
Jan Böhmer 2019-08-14 18:45:28 +02:00
parent fd4b474dbd
commit fbc5b1fc8d
3 changed files with 36 additions and 5 deletions

View file

@ -92,19 +92,19 @@ class Storelocation extends PartsContainingDBElement
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected $is_full; protected $is_full = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected $only_single_part; protected $only_single_part = false;
/** /**
* @var bool * @var bool
* @ORM\Column(type="boolean") * @ORM\Column(type="boolean")
*/ */
protected $limit_to_existing_parts; protected $limit_to_existing_parts = false;
/** /**
* @var MeasurementUnit|null The measurement unit, which parts can be stored in here * @var MeasurementUnit|null The measurement unit, which parts can be stored in here

View file

@ -33,7 +33,9 @@ namespace App\Form\AdminPages;
use App\Entity\Base\NamedDBElement; use App\Entity\Base\NamedDBElement;
use App\Entity\Parts\MeasurementUnit;
use App\Form\AdminPages\BaseEntityAdminForm; use App\Form\AdminPages\BaseEntityAdminForm;
use App\Form\Type\StructuralEntityType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
@ -45,7 +47,24 @@ class StorelocationAdminForm extends BaseEntityAdminForm
$is_new = $entity->getID() === null; $is_new = $entity->getID() === null;
$builder->add('is_full', CheckboxType::class, ['required' => false, $builder->add('is_full', CheckboxType::class, ['required' => false,
'label' => 'is_full.label', 'help' => 'is_full.help', 'label_attr'=> ['class' => 'checkbox-custom'], 'label' => 'storelocation.is_full.label', 'help' => 'storelocation.is_full.help',
'label_attr'=> ['class' => 'checkbox-custom'],
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity)]); 'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity)]);
$builder->add('limit_to_existing_parts', CheckboxType::class, ['required' => false,
'label' => 'storelocation.limit_to_existing.label', 'help' => 'storelocation.limit_to_existing.help',
'label_attr'=> ['class' => 'checkbox-custom'],
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity)]);
$builder->add('only_single_part', CheckboxType::class, ['required' => false,
'label' => 'storelocation.only_single_part.label', 'help' => 'storelocation.only_single_part.help',
'label_attr'=> ['class' => 'checkbox-custom'],
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity)]);
$builder->add('storage_type', StructuralEntityType::class, ['required' => false,
'label' => 'storelocation.storage_type.label', 'help' => 'storelocation.storage_type.help',
'class' => MeasurementUnit::class, 'disable_not_selectable' => true,
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity)]);
} }
} }

View file

@ -5,5 +5,17 @@
{% endblock %} {% endblock %}
{% block additional_controls %} {% block additional_controls %}
{{ form_row(form.is_full) }} {% endblock %}
{% block additional_pills %}
<li class="nav-item"><a data-toggle="tab" class="nav-link link-anchor" href="#home_options">{% trans %}admin.options{% endtrans %}</a></li>
{% endblock %}
{% block additional_panes %}
<div class="tab-pane" id="home_options">
{{ form_row(form.storage_type) }}
{{ form_row(form.is_full) }}
{{ form_row(form.limit_to_existing_parts) }}
{{ form_row(form.only_single_part) }}
</div>
{% endblock %} {% endblock %}