mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-04 02:05:16 +02:00
Fixed issue with removing the bom entries caused by the multiple collapse rows
This commit is contained in:
parent
a3ee51e76b
commit
39ed00c7c0
6 changed files with 83 additions and 40 deletions
|
@ -23,31 +23,6 @@
|
|||
{% block additional_panes %}
|
||||
<div class="tab-pane" id="bom">
|
||||
{% form_theme form.bom_entries with ['Form/collection_types_layout.html.twig'] %}
|
||||
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
<div {{ collection.controller(form.bom_entries, 'project.bom.delete.confirm') }}>
|
||||
<table class="table table-striped table-bordered table-sm" {{ collection.target() }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th> {# expand button #}
|
||||
<th>{% trans %}project.bom.quantity{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.part{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.name{% endtrans %}</th>
|
||||
<th></th> {# Remove button #}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for entry in form.bom_entries %}
|
||||
{{ form_widget(entry) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" class="btn btn-success mb-2" {{ collection.create_btn() }}>
|
||||
<i class="fas fa-plus-square fa-fw"></i>
|
||||
{% trans %}project.bom.add_entry{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
{{ form_widget(form.bom_entries) }}
|
||||
</div>
|
||||
{% endblock %}
|
|
@ -1,3 +1,32 @@
|
|||
{% block project_bom_entry_collection_widget %}
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
<div {{ collection.controller(form, 'project.bom.delete.confirm', 3) }}>
|
||||
<table class="table table-striped table-bordered table-sm" {{ collection.target() }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th> {# expand button #}
|
||||
<th>{% trans %}project.bom.quantity{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.part{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.name{% endtrans %}</th>
|
||||
<th></th> {# Remove button #}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for entry in form %}
|
||||
{{ form_widget(entry) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" class="btn btn-success mb-2" {{ collection.create_btn() }}>
|
||||
<i class="fas fa-plus-square fa-fw"></i>
|
||||
{% trans %}project.bom.add_entry{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block project_bom_entry_widget %}
|
||||
{% set target_id = 'expand_row-' ~ random() %}
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
{% macro controller(form, deleteMessage) %}
|
||||
{% macro controller(form, deleteMessage, rowsToDelete) %}
|
||||
{% if form.vars.prototype is defined %}
|
||||
{{ stimulus_controller('elements/collection_type', {
|
||||
'deleteMessage': deleteMessage|trans,
|
||||
'prototype': form_widget(form.vars.prototype)|e('html_attr')
|
||||
'prototype': form_widget(form.vars.prototype)|e('html_attr'),
|
||||
'rowsToDelete': rowsToDelete,
|
||||
}) }}
|
||||
{% else %} {# If add_element is disabled/forbidden, prototype is not available #}
|
||||
{{ stimulus_controller('elements/collection_type', {
|
||||
'deleteMessage': deleteMessage|trans,
|
||||
'rowsToDelete': rowsToDelete
|
||||
}) }}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue