mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-08-04 18:25:04 +02:00
66 lines
No EOL
2.1 KiB
Twig
66 lines
No EOL
2.1 KiB
Twig
{% form_theme form with ['Parts/edit/edit_form_styles.html.twig', "bootstrap_4_layout.html.twig"] %}
|
|
|
|
<table class="table table-striped table-sm" id="orderdetails_table" data-prototype="{{ form_widget(form.orderdetails.vars.prototype)|e('html_attr') }}">
|
|
<tbody>
|
|
{% for detail in form.orderdetails %}
|
|
{{ form_widget(detail) }}
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<button type="button" class="btn btn-success" onclick="create_orderdetail_entry(this)">
|
|
<i class="fas fa-plus-square fa-fw"></i>
|
|
{% trans %}orderdetail.create{% endtrans %}
|
|
</button>
|
|
|
|
<script>
|
|
function delete_pricedetail_entry(btn) {
|
|
window.bootbox.confirm('{% trans %}pricedetails.edit.delete.confirm{% endtrans %}', function (result) {
|
|
if(result) {
|
|
$(btn).closest("tr").remove();
|
|
}
|
|
});
|
|
}
|
|
|
|
function create_pricedetail_entry(btn) {
|
|
//Determine the table, so we can determine, how many entries there are already.
|
|
$holder = $(btn).siblings("table");
|
|
|
|
var index = $holder.find(":input").length;
|
|
var newForm = $holder.data("prototype");
|
|
|
|
//Increase the index
|
|
newForm = newForm.replace(/__name__/g, index);
|
|
|
|
$holder.children("tbody").append(newForm);
|
|
|
|
//Reinit the selectpickers
|
|
$(".selectpicker").selectpicker();
|
|
|
|
}
|
|
|
|
function delete_orderdetail_entry(btn) {
|
|
window.bootbox.confirm('{% trans %}orderdetails.edit.delete.confirm{% endtrans %}', function (result) {
|
|
if(result) {
|
|
$(btn).parents("tr").remove();
|
|
}
|
|
});
|
|
}
|
|
|
|
function create_orderdetail_entry(btn) {
|
|
//Determine the table, so we can determine, how many entries there are already.
|
|
$holder = $("#orderdetails_table");
|
|
|
|
var index = $holder.find(":input").length;
|
|
var newForm = $holder.data("prototype");
|
|
|
|
//Increase the index
|
|
newForm = newForm.replace(/__name__/g, index);
|
|
|
|
$holder.children("tbody").append(newForm);
|
|
|
|
//Reinit the selectpickers
|
|
$(".selectpicker").selectpicker();
|
|
|
|
}
|
|
</script> |