diff --git a/src/Entity/ProjectSystem/ProjectBOMEntry.php b/src/Entity/ProjectSystem/ProjectBOMEntry.php index 053aea35..6d0a68da 100644 --- a/src/Entity/ProjectSystem/ProjectBOMEntry.php +++ b/src/Entity/ProjectSystem/ProjectBOMEntry.php @@ -207,6 +207,10 @@ class ProjectBOMEntry extends AbstractDBElement $this->quantity = round($this->quantity); } } + //Non-Part BOM entries are rounded + if ($this->part === null) { + $this->quantity = round($this->quantity); + } //Check that every part name in the mountnames list is unique (per bom_entry) $mountnames = explode(',', $this->mountnames); diff --git a/src/Form/ProjectSystem/ProjectBOMEntryType.php b/src/Form/ProjectSystem/ProjectBOMEntryType.php index 774eb6b1..99730375 100644 --- a/src/Form/ProjectSystem/ProjectBOMEntryType.php +++ b/src/Form/ProjectSystem/ProjectBOMEntryType.php @@ -5,6 +5,7 @@ namespace App\Form\ProjectSystem; use App\Entity\Parts\Part; use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Form\Type\PartSelectType; +use App\Form\Type\RichTextEditorType; use App\Form\Type\SIUnitType; use Svg\Tag\Text; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -53,10 +54,14 @@ class ProjectBOMEntryType extends AbstractType 'data-controller' => 'elements--tagsinput', ] ]) - ->add('comment', TextType::class, [ + ->add('comment', RichTextEditorType::class, [ 'required' => false, 'label' => 'project.bom.comment', - 'empty_data' => '' + 'empty_data' => '', + 'mode' => 'markdown-single_line', + 'attr' => [ + 'rows' => 2, + ], ]) ; diff --git a/templates/AdminPages/DeviceAdmin.html.twig b/templates/AdminPages/DeviceAdmin.html.twig index e40efea6..869b3d95 100644 --- a/templates/AdminPages/DeviceAdmin.html.twig +++ b/templates/AdminPages/DeviceAdmin.html.twig @@ -25,18 +25,28 @@ {% form_theme form.bom_entries with ['Form/collection_types_layout.html.twig'] %} {% import 'components/collection_type.macro.html.twig' as collection %} -
- +
+
+ + + {# expand button #} + + + + {# Remove button #} + + + - {% for attachment in form.bom_entries %} - {{ form_widget(attachment) }} + {% for entry in form.bom_entries %} + {{ form_widget(entry) }} {% endfor %}
{% trans %}project.bom.quantity{% endtrans %}{% trans %}project.bom.part{% endtrans %}{% trans %}project.bom.name{% endtrans %}
-
diff --git a/templates/Form/collection_types_layout.html.twig b/templates/Form/collection_types_layout.html.twig index def3d6e3..ccd8bdef 100644 --- a/templates/Form/collection_types_layout.html.twig +++ b/templates/Form/collection_types_layout.html.twig @@ -1,15 +1,39 @@ {% block project_bom_entry_widget %} + {% set target_id = 'expand_row-' ~ random() %} + {% import 'components/collection_type.macro.html.twig' as collection %} - {{ form_widget(form) }} + + + + {{ form_errors(form.quantity) }} + {{ form_widget(form.quantity) }} + + + {{ form_errors(form.part) }} + {{ form_widget(form.part) }} + + + {{ form_errors(form.name) }} + {{ form_widget(form.name) }} {{ form_errors(form) }} + + + +
+ {{ form_row(form.mountnames) }} + {{ form_row(form.comment) }} +
+ + {% endblock %} \ No newline at end of file diff --git a/templates/Form/extendedBootstrap4_layout.html.twig b/templates/Form/extendedBootstrap4_layout.html.twig index 8ab3abb9..a409d8d4 100644 --- a/templates/Form/extendedBootstrap4_layout.html.twig +++ b/templates/Form/extendedBootstrap4_layout.html.twig @@ -41,7 +41,7 @@
{{ form_widget(form.value) }} {% if form.prefix is defined %} - {{ form_widget(form.prefix, {'attr': {'class': 'form-select'}}) }} + {{ form_widget(form.prefix, {'attr': {'class': '', 'style': 'max-width: 40px;'}}) }} {% endif %} {% if unit is not empty %} diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index 913baae9..391c3803 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -9971,5 +9971,17 @@ Element 3 Notes + + + project.bom.part + Part + + + + + project.bom.add_entry + Add entry + +