{% import 'macros/forms.html' as forms %} {% import 'macros/modal.html' as modal %} {% macro batch_add_form(form, endpoint, method, id, consumable_id) %} {% if id == -1 %} {% set action = url_for(endpoint, consumable_id=consumable_id) %} {% set title = 'Add Batch' %} {% else %} {% set action = url_for(endpoint, id_=id, consumable_id=consumable_id) %} {% set title = 'Edit Batch' %} {% endif %} {% set modal_id = 'modal-edit-batch-' ~ id %} {% set form_id = 'form-edit-batch-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}