byceps/byceps

View on GitHub
byceps/blueprints/admin/shop/article/templates/admin/shop/article/update_form.html

Summary

Maintainability
Test Coverage
{% extends 'layout/admin/shop/article.html' %}
{% from 'macros/admin.html' import render_backlink %}
{% from 'macros/forms.html' import form_buttons, form_datalist, form_field_check, form_field %}
{% set current_page_shop = shop %}
{% set page_title = _('Edit article') %}

{% block before_body %}
{{ render_backlink(url_for('.view', article_id=article.id), article.item_number) }}
{%- endblock %}

{% block body %}

  <h1 class="title">{{ page_title }}</h1>

  <form action="{{ url_for('.update', article_id=article.id) }}" method="post">
    <div class="box">
      {{ form_field(form.name, maxlength=100, autofocus='autofocus') }}

      <div class="row">
        <div>
          {{ form_field(form.price_amount, size=7, maxlength=7, style='text-align: right; width: 5.5rem;', suffix=shop.currency.code) }}
        </div>
        <div>
          {{ form_field(form.tax_rate, list='tax_rates', size=5, maxlength=5, style='text-align: right; width: 5.5rem;', suffix='%') }}
          {{ form_datalist('tax_rates', ['0.0', '7.0', '19.0']) }}
        </div>
      </div>

      <div class="row">
        <div>{{ form_field(form.available_from_date) }}</div>
        <div>{{ form_field(form.available_from_time) }}</div>
      </div>

      <div class="row">
        <div>{{ form_field(form.available_until_date) }}</div>
        <div>{{ form_field(form.available_until_time) }}</div>
      </div>

      {{ form_field(form.total_quantity, type='number', min=0, max=99999, style='width: 5.5rem;') }}
      {{ form_field(form.max_quantity_per_order, type='number', min=1, max=99, style='width: 5.5rem;') }}
      {{ form_field_check(form.not_directly_orderable) }}
      {{ form_field_check(form.separate_order_required) }}
    </div>

    {{ form_buttons(_('Save')) }}
  </form>

{%- endblock %}