ref: master
core/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 77 78 79 80 81 82 83 |
{% 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 and cycle.status.value == 'published' %}
<strong>Você não tem um pedido nesse ciclo. <a href="{{ url_for('orders.create') }}">Abrir um</a></strong>
{% endif %}
</section>
<section class="products pb-5">
<form action="{{url_for('orders.update', id = current_order.id)}}" method="POST">
<table class="umbo-table">
<thead>
<tr>
<th class="umbo-table-header"></th>
<th class="umbo-table-header">Nome do Produto</th>
<th class="umbo-table-header">Grupo</th>
<th class="umbo-table-header">Categoria</th>
<th class="umbo-table-header umbo-table-header-numeric">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 class="umbo-table-cell mt-5">
{% 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 class="umbo-table-cell"> {{ product.title }} </td>
<td class="umbo-table-cell"> {{ product.group.name }} </td>
<td class="umbo-table-cell"> {{ product.category.name }}</td>
<td class="umbo-table-cell umbo-table-cell-numeric"> {{ product.price_on(cycle) | as_currency }} </td>
</tr>
{% endfor %}
{% endwith %}
</tbody>
</table>
{% if current_order %}
<section class="box p-5 mt-5">
<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 pb-5">
{% if current_order %}
{#
TODO: There's gotta a simpler way to this.
Instead of having two actions we could have only one.
If you added something to your order, you already confirmed it
#}
<button type="submit" class="btn btn-primary f-right" {{ "disabled" if current_order.status.value == 'confirmed' }} name="confirm" rel="button">
Fechar pedido
</button>
{% if current_order.status.value == 'draft' %}
<button type="submit" name="draft" rel="button" class="btn btn-secondary">Adicionar a cesta os produtos selecionados</button>
{% endif %}
<a class=" destructive" href="{{url_for('orders.cancel', id = current_order.id)}}">Cancelar Pedido</a>
{% endif %}
</div>
</form>
</section>
{% endblock %}
|