ciclos

commit fd7b1027111b6c925048e1931284648d8cc62177

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

Drop in a bunch of views for all basic cruds

 core/templates/edit_product_balance.html | 16 +++++++
 core/templates/groups.html | 18 ++++++++
 core/templates/new_group.html | 42 +++++++++++++++++++
 core/templates/new_product.html | 56 ++++++++++++++++++++++++++
 core/templates/new_product_category.html | 33 +++++++++++++++
 core/templates/product_categories.html | 18 ++++++++
 core/templates/products.html | 27 ++++++++++++


diff --git a/core/templates/edit_product_balance.html b/core/templates/edit_product_balance.html
new file mode 100644
index 0000000000000000000000000000000000000000..ca7908b01465c004cca558f4d625bcf4d772d345
--- /dev/null
+++ b/core/templates/edit_product_balance.html
@@ -0,0 +1,16 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+
+<form action="{{ url_for('products.balance', id = product.id) }}" method="POST">
+  <div class="form-section">
+    <label for="">Total</label>
+    <input name="value" type="number" value="{{product.balance.value}}">
+  </div>
+
+  <div class="form-action">
+    <button type="submit">Salvar</button>
+  </div>
+</form>
+
+{% endblock %}




diff --git a/core/templates/groups.html b/core/templates/groups.html
new file mode 100644
index 0000000000000000000000000000000000000000..5a1bd70e376f234e8cc39bf269437ccdcd0d867e
--- /dev/null
+++ b/core/templates/groups.html
@@ -0,0 +1,18 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="mb-5">
+    <a href="{{ url_for('groups.new') }}">Novo Fornecedor</a>
+  </section>
+
+  {% for group in groups %}
+    <div class="p-5 mb-5 box">
+      <div class="box box-header mb-5">
+        <h2>{{ group.name }}</h2>
+      </div>
+      <em class="white-space-pre">{{ group.location }}</em>
+    </div>
+  {% endfor %}
+
+{% endblock %}
+




diff --git a/core/templates/new_group.html b/core/templates/new_group.html
new file mode 100644
index 0000000000000000000000000000000000000000..7b654c6b845bce228168dde80df45c3fbe5c5001
--- /dev/null
+++ b/core/templates/new_group.html
@@ -0,0 +1,42 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="messages">
+    {% with messages = get_flashed_messages() %}
+    {% if messages %}
+      <section>
+        {{ messages[0] }}
+      </section>
+    {% endif %}
+    {% endwith %}
+  </section>
+
+  <form action='{{ url_for('groups.index') }}' method="POST">
+
+    <div class="form-section">
+      <label for="name">Name</label>
+      <input type="text" placeholder="Name" name="name">
+    </div>
+
+    <div class="form-section">
+      <label for="location">Location</label>
+      <input type="text" placeholder="Location" name="location">
+    </div>
+
+    <div class="form-section">
+      <label for="lat">Lat</label>
+      <input type="text" placeholder="Lat" name="lat">
+    </div>
+
+    <div class="form-section">
+      <label for="lng">Lng</label>
+      <input type="text" placeholder="Lng" name="lng">
+    </div>
+
+    <div class="form-action">
+      <button type="submit" rel="button">Criar Grupo </button>
+    </div>
+
+  </form>
+{% endblock %}
+




diff --git a/core/templates/new_product.html b/core/templates/new_product.html
new file mode 100644
index 0000000000000000000000000000000000000000..6e66fa9dcc96847e377a41226af0f929467f1fdb
--- /dev/null
+++ b/core/templates/new_product.html
@@ -0,0 +1,56 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="messages">
+    {% with messages = get_flashed_messages() %}
+    {% if messages %}
+      <section>
+        {{ messages[0] }}
+      </section>
+    {% endif %}
+    {% endwith %}
+  </section>
+
+  <form action='{{ url_for('products.index') }}' method="POST">
+
+    <div class="form-section">
+      <label for="title">Title</label>
+      <input type="text" placeholder="Title" name="title">
+    </div>
+
+    <div class="form-section">
+      <label for="description">Description</label>
+      <textarea rows="10" columns="50" placeholder="Description" name="description"></textarea>
+    </div>
+
+    <div class="form-section">
+      <label for="group_id">Group</label>
+      <select id="" name="group_id">
+        {% for group in groups %}
+          <option value="{{group.id}}">{{group.name}}</option>
+        {% endfor %}
+      </select>
+    </div>
+
+    <div class="form-section">
+      <label for="category_id">Category</label>
+      <select id="" name="category_id">
+        {% for category in categories %}
+          <option value="{{ category.id }}">{{ category.name }}</option>
+        {% endfor %}
+      </select>
+    </div>
+
+    <div class="form-section">
+      <label for="price">Price</label>
+      <input type="text" placeholder="14.20" name="price" />
+    </div>
+
+    <div class="form-action">
+      <button type="submit" rel="button">Criar Produto</button>
+    </div>
+
+  </form>
+{% endblock %}
+
+




diff --git a/core/templates/new_product_category.html b/core/templates/new_product_category.html
new file mode 100644
index 0000000000000000000000000000000000000000..a9fa5af3c7b61e4e08b73eeadf02b8be735a3c63
--- /dev/null
+++ b/core/templates/new_product_category.html
@@ -0,0 +1,33 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="messages">
+    {% with messages = get_flashed_messages() %}
+    {% if messages %}
+      <section>
+        {{ messages[0] }}
+      </section>
+    {% endif %}
+    {% endwith %}
+  </section>
+
+  <form action='{{ url_for('product_categories.index') }}' method="POST">
+
+    <div class="form-section">
+      <label for="name">Name</label>
+      <input type="text" placeholder="Name" name="name">
+    </div>
+
+    <div class="form-section">
+      <label for="description">Description</label>
+      <textarea rows="10" columns="50" placeholder="Description" name="description"></textarea>
+    </div>
+
+    <div class="form-action">
+      <button type="submit" rel="button">Criar Categoria</button>
+    </div>
+
+  </form>
+{% endblock %}
+
+




diff --git a/core/templates/product_categories.html b/core/templates/product_categories.html
new file mode 100644
index 0000000000000000000000000000000000000000..d11a6b4c9e1b0e527851e6525045aa9b00b17df2
--- /dev/null
+++ b/core/templates/product_categories.html
@@ -0,0 +1,18 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="mb-5">
+    <a href="{{ url_for('product_categories.new') }}">Nova Categoria de Produto</a>
+  </section>
+
+  {% for category in categories %}
+    <div class="p-5 mb-5 box">
+      <div class="box box-header mb-5">
+        <h2>{{ category.name }}</h2>
+      </div>
+      <em class="white-space-pre">{{ category.description }}</em>
+    </div>
+  {% endfor %}
+
+{% endblock %}
+




diff --git a/core/templates/products.html b/core/templates/products.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e74bbcab3727b565cbdc44df9ba15f8d860fb0c
--- /dev/null
+++ b/core/templates/products.html
@@ -0,0 +1,27 @@
+{% extends 'layout.html' %}
+
+{% block body %}
+  <section class="mb-5">
+    <a href="{{ url_for('products.new') }}">Novo Produto</a>
+  </section>
+
+  {% for product in products %}
+    <div class="p-5 mb-5 box">
+      <div class="box box-header mb-5">
+        <h2>{{ product.title }}</h2>
+      </div>
+      <div>
+        <small>{{ product.group.name }} - {{ product.category.name }}</small>
+      </div>
+      <em class="white-space-pre">{{ product.description }}</em>
+      <div>
+        <strong> {{ product.price | as_currency }} </strong>
+      </div>
+      <div>
+        <a href="{{ url_for('products.balance', id = product.id) }}">Editar Saldo</a>
+      </div>
+    </div>
+  {% endfor %}
+
+{% endblock %}
+