From fbc5b1fc8dea8c6fd1abd0544cb336523765ef20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 14 Aug 2019 18:45:28 +0200 Subject: [PATCH] Extended store location options can be edited via Admin page now. --- src/Entity/Parts/Storelocation.php | 6 +++--- .../AdminPages/StorelocationAdminForm.php | 21 ++++++++++++++++++- .../AdminPages/StorelocationAdmin.html.twig | 14 ++++++++++++- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index d58d64de..f0aee50b 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -92,19 +92,19 @@ class Storelocation extends PartsContainingDBElement * @var bool * @ORM\Column(type="boolean") */ - protected $is_full; + protected $is_full = false; /** * @var bool * @ORM\Column(type="boolean") */ - protected $only_single_part; + protected $only_single_part = false; /** * @var bool * @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 diff --git a/src/Form/AdminPages/StorelocationAdminForm.php b/src/Form/AdminPages/StorelocationAdminForm.php index 6edf8f51..a6755ec0 100644 --- a/src/Form/AdminPages/StorelocationAdminForm.php +++ b/src/Form/AdminPages/StorelocationAdminForm.php @@ -33,7 +33,9 @@ namespace App\Form\AdminPages; use App\Entity\Base\NamedDBElement; +use App\Entity\Parts\MeasurementUnit; 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\TextType; use Symfony\Component\Form\FormBuilderInterface; @@ -45,7 +47,24 @@ class StorelocationAdminForm extends BaseEntityAdminForm $is_new = $entity->getID() === null; $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)]); + + $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)]); + } } \ No newline at end of file diff --git a/templates/AdminPages/StorelocationAdmin.html.twig b/templates/AdminPages/StorelocationAdmin.html.twig index dfa4cf55..60bc95ba 100644 --- a/templates/AdminPages/StorelocationAdmin.html.twig +++ b/templates/AdminPages/StorelocationAdmin.html.twig @@ -5,5 +5,17 @@ {% endblock %} {% block additional_controls %} - {{ form_row(form.is_full) }} +{% endblock %} + +{% block additional_pills %} + +{% endblock %} + +{% block additional_panes %} +
+ {{ form_row(form.storage_type) }} + {{ form_row(form.is_full) }} + {{ form_row(form.limit_to_existing_parts) }} + {{ form_row(form.only_single_part) }} +
{% endblock %} \ No newline at end of file