ref: responsive
src/templates/cycle.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76  | 
{% extends 'layout.html' %}
{% block body %}
<section class="a">
  <h1>{{ cycle.name }}</h1>
  <em class="white-space-pre">{{ cycle.description }}</em> 
</section>
{% if current_order and current_order.status.value == 'confirmed' %}
<strong> Seu pedido está {{ current_order.status.value }} <a href="{{ url_for('orders.reopen', id = current_order.id) }}">Deseja reabrir?</a></strong>
{% endif %}
<section>
  {% if not current_order %}
  <strong>Você não tem um pedido nesse ciclo. <a href="{{ url_for('orders.create') }}">Abrir um</a></strong>
  {% endif %}
</section>
<section class="products">
  <form action="{{url_for('orders.update', id = current_order.id)}}" method="POST">
    <table>
      <thead>
        <tr>
          <th></th>
          <th>Nome do Produto</th>
          <th>Grupo</th>
          <th>Categoria</th>
          <th>Preço</th>
        </tr>
      </thead>
      <tbody>
        {% with selected_product_ids = current_order.selected_product_ids() if current_order else [] %}
        {% for product in products %}
        <tr>
          <td>
            {% if current_order %}
            <input type="checkbox" name="product_ids" {{ 'checked' if product.id in selected_product_ids }} {{ 'disabled' if current_order.status.value == 'confirmed' }} value="{{product.id}}"> 
              {% endif %}
            </td>
            <td> {{ product.title }} </td>
            <td> {{ product.group.name }} </td>
            <td> {{ product.category.name }}</td>
            <td> {{ product.price_on(cycle) | as_currency }} </td>
        </tr>
        {% endfor %}
        {% endwith %}
      </tbody>
    </table>
    {% if current_order %}
    <section>
      <h4> O que você vai levar: </h4>
      <ul>
        {% for product in current_order.products() %}
          <li>{{ product.title }} - {{ product.group.name }}</li>
        {% endfor %}
      </ul>
      
      <div style="text-align: left;">
        Total: <em>{{ current_order.total() | as_currency }}</em>
      </div>
    </section>
    {% endif %}
    <div class="form-action">
      <button type="submit" class="btn" {{ "disabled" if current_order and current_order.status.value == 'confirmed' }} name="confirm" rel="button">Confirmar produtos</button>
      {% if current_order and current_order.status.value == 'draft' %}
        <button type="submit" name="draft" rel="button" class="btn">Salvar pedido como rascunho</button>
      {% endif %}
    
      {% if current_order %}
        <a class=" destructive" href="{{url_for('orders.cancel', id = current_order.id)}}">Cancelar Pedido</a>
      {% endif %}
    </div>
  </form> 
</section>
{% endblock %}
 |