{% import 'macros/forms.html' as forms %} {% import 'macros/modal.html' as modal %} {% macro stock_solution_add_form(form, endpoint, method, id, chemical_id) %} {% if id == -1 %} {% set action = url_for(endpoint, chemical_id=chemical_id) %} {% set title = 'Add Stock Solution' %} {% else %} {% set action = url_for(endpoint, id_=id, chemical_id=chemical_id) %} {% set title = 'Edit Stock Solution' %} {% endif %} {% set modal_id = 'modal-edit-solution-' ~ id %} {% set form_id = 'form-edit-solution-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ form.hidden_tag() }}
{{ forms.field_row(form.solvent, 'Solvent') }}
{{ forms.field_row(form.concentration, 'Concentration') }}
{{ forms.field_row(form.storage_place, 'Storage place') }}
{{ forms.field_row(form.date_created, 'Created') }}
{{ forms.field_row(form.date_emptied, 'Emptied') }}
{{ forms.field_row(form.details, 'Details') }}
{{ form.submit() }}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}