ciclos

commit 168beef59eda3c8e5a2dc7f94b42332d300407fe

Author: Pedro Lucas Porcellis <pedrolucasporcellis@gmail.com>

Only display confirmation buttons if there's an order issued

 src/templates/cycle.html | 19 +++++++++++++------


diff --git a/src/templates/cycle.html b/src/templates/cycle.html
index e5653bb055914756403b54e92093c4d938962d17..4c02cf64603112d3861ca62b234b2e3e32a8eb9a 100644
--- a/src/templates/cycle.html
+++ b/src/templates/cycle.html
@@ -47,7 +47,7 @@       
     </table>
 
     {% if current_order %}
-    <section>
+    <section class="box p-5 mt-5">
       <h4> O que vocĂȘ vai levar: </h4>
       <ul>
         {% for product in current_order.products() %}
@@ -62,12 +62,19 @@     
     {% 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 %}
+        {# 
+          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" {{ "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">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>