{% import 'macros/forms.html' as forms %} {% import 'macros/modal.html' as modal %} {% macro primer_add_form(form, endpoint, method, id) %} {% if id == -1 %} {% set action = url_for(endpoint) %} {% set title = 'Add Oligonucleotide' %} {% else %} {% set action = url_for(endpoint, id_=id) %} {% set title = 'Edit Oligonucleotide' %} {% endif %} {% set modal_id = 'modal-edit-primer-' ~ id %} {% set form_id = 'form-edit-primer-' ~ id %} {% call modal.modal(id=modal_id, title=title) %}
{{ form.hidden_tag() }}
{{ forms.field_row(form.label, 'Name') }}
{{ forms.field_row(form.date_ordered, 'Order Date') }}
{{ forms.field_row(form.sequence, 'Sequence') }}
{{ forms.field_row(form.storage_place, 'Storage place') }}
{{ forms.field_row(form.owner_id, 'Owner') }}
{{ forms.field_row(form.description, 'Description') }}
{{ form.submit() }}
{{ forms.script_send_form( form=form, form_name=form_id, method=method, message_field=form_id ~ '-messages' ) }} {% endcall %} {% endmacro %}