{% 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) %}
{{ form.hidden_tag() }}
{{ forms.field_row(form.date_ordered, 'Order date') }}
{{ forms.field_row(form.supplier, 'Supplier') }}
{{ forms.field_row(form.article_number, 'Article number') }}
{{ forms.field_row(form.price, 'Price (€)') }}
{{ forms.field_row(form.amount, 'Amount') }}
{{ forms.field_row(form.lot, 'Lot number') }}
{{ forms.field_row(form.storage_place, 'Storage place') }}
{{ forms.field_row(form.date_expiration, 'Expiration date') }}
{{ form.submit() }}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}