diff --git a/gestaoRaul/products/__pycache__/urls.cpython-310.pyc b/gestaoRaul/products/__pycache__/urls.cpython-310.pyc
index 83134cf..bbd0c4f 100644
Binary files a/gestaoRaul/products/__pycache__/urls.cpython-310.pyc and b/gestaoRaul/products/__pycache__/urls.cpython-310.pyc differ
diff --git a/gestaoRaul/products/__pycache__/views.cpython-310.pyc b/gestaoRaul/products/__pycache__/views.cpython-310.pyc
index 5d277e5..309fb18 100644
Binary files a/gestaoRaul/products/__pycache__/views.cpython-310.pyc and b/gestaoRaul/products/__pycache__/views.cpython-310.pyc differ
diff --git a/gestaoRaul/products/templates/products.html b/gestaoRaul/products/templates/products.html
index 901a571..80cefda 100644
--- a/gestaoRaul/products/templates/products.html
+++ b/gestaoRaul/products/templates/products.html
@@ -4,8 +4,7 @@
{% block 'head' %}
-
-
+
{% endblock %}
@@ -21,9 +20,8 @@ Produtos
-
-
-
-
- Conteúdo do seu modal.
-
-
-
+
+
+
{% endblock %}
\ No newline at end of file
diff --git a/gestaoRaul/products/urls.py b/gestaoRaul/products/urls.py
index 824f3c5..51cf851 100644
--- a/gestaoRaul/products/urls.py
+++ b/gestaoRaul/products/urls.py
@@ -4,6 +4,7 @@ from . import views
urlpatterns = [
path('', views.products, name='products'),
+ path('create_product', views.createProduct, name='create_product'),
diff --git a/gestaoRaul/products/views.py b/gestaoRaul/products/views.py
index dc2f45d..dcde59c 100644
--- a/gestaoRaul/products/views.py
+++ b/gestaoRaul/products/views.py
@@ -1,8 +1,22 @@
-from django.shortcuts import render
+from django.shortcuts import render, redirect
+from categories.models import Categories
from products.models import Product
def products(request):
protucts = Product.objects.all()
- return render(request, 'products.html', {'products': protucts})
\ No newline at end of file
+ categories = Categories.objects.all()
+ return render(request, 'products.html', {'products': protucts, 'categories': categories})
+
+
+def createProduct(request):
+ print(request.POST)
+ name = request.POST.get('name')
+ description = request.POST.get('description')
+ price = request.POST.get('price')
+ category = request.POST.get('category')
+ product = Product(name=name, description=description, price=price, category=category)
+ product.save()
+ return redirect('/products')
+ # return render(request, 'products.html')
\ No newline at end of file
diff --git a/gestaoRaul/templates/base.html b/gestaoRaul/templates/base.html
index 599fe3e..7cc6df3 100644
--- a/gestaoRaul/templates/base.html
+++ b/gestaoRaul/templates/base.html
@@ -7,9 +7,11 @@
-
+
- {% block 'head' %}{% endblock %}
+ {% block 'head' %}
+
+ {% endblock %}
{% block 'title' %}{% endblock %}
diff --git a/gestaoRaul/templates/static/products/css/products.css b/gestaoRaul/templates/static/products/css/products.css
index df8cd95..d8506fc 100644
--- a/gestaoRaul/templates/static/products/css/products.css
+++ b/gestaoRaul/templates/static/products/css/products.css
@@ -1,52 +1,71 @@
-/* style.css */
+
+button {
+ background-color: #007BFF;
+ color: white;
+ padding: 10px 20px;
+ border: none;
+ border-radius: 5px;
+ cursor: pointer;
+}
+
+button:hover {
+ background-color: #0056b3;
+}
.modal {
- display: none; /* Oculta o modal por padrão */
- position: fixed; /* Posiciona o modal fixo na tela */
- z-index: 1; /* Garante que o modal fique acima de outros elementos */
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- overflow: auto; /* Permite rolagem se o conteúdo for muito grande */
- background-color: rgba(0,0,0,0.4); /* Fundo escurecido */
+ display: none;
+ position: fixed;
+ padding: 20px;
+ top: 50%;
+ left: 50%;
+ width: 100%;
+ height: 100%;
+ overflow: auto;
+ background-color: rgba(0, 0, 0, 0.4);
+ transform: translate(-50%, -50%);
}
.modal-content {
- background-color: #fefefe;
- margin: 15% auto; /* 15% from the top and centered */
- padding: 20px;
- border: 1px solid #888;
- width: 80%;
+ background-color: #fefefe;
+ margin: 15% auto;
+ padding: 20px;
+ border: 1px solid #888;
+ border-radius: 10px;
+ width: 90%;
+ max-width: 500px;
}
-.close {
- color: #aaa;
- float: right;
- font-size: 28px;
- font-weight: bold;
+
+form {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
}
-.close:hover,
-.close:focus {
- color: black;
- text-decoration: none;
- cursor: pointer;
+input, textarea {
+ width: 95%;
+ max-width: 95%;
+ padding: 8px;
+ margin-top: 5px;
+ border-radius: 5px;
+ border: 1px solid #ccc;
}
+
+
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 20px;
- max-width: 1100px; /* Define a largura máxima do grid */
+ max-width: 800px; /* Define a largura máxima do grid */
margin: 0 auto; /* Centraliza o grid na página */
}
.card {
width: 100%;
- height: 80px;
+ height: 120px;
background-color: #f2f2f2;
border-radius: 15px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
@@ -61,17 +80,4 @@
.card:hover {
transform: scale(1.05);
box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.3);
- }
-
-
- dialog::backdrop {
- background-color: rgb(0 0 0 / .5);
- }
-
- dialog {
- border: none;
- border-radius: .5rem;
- box-shadow: 0 0 1em rgb(0 0 0 / .3);
- width: 80%;
- }
-
+ }
\ No newline at end of file
diff --git a/gestaoRaul/templates/static/products/js/products.js b/gestaoRaul/templates/static/products/js/products.js
index c7dec7f..53c34a0 100644
--- a/gestaoRaul/templates/static/products/js/products.js
+++ b/gestaoRaul/templates/static/products/js/products.js
@@ -1,2 +1,20 @@
+function openModal() {
+ document.getElementById('myModal').style.display = 'block';
+}
+function closeModal() {
+ document.getElementById('myModal').style.display = 'none';
+}
+
+document.getElementById('openModal').addEventListener('click', openModal);
+
+document.getElementById('productForm').addEventListener('submit', function(event) {
+ event.preventDefault();
+
+ // const productName = document.getElementById('productName').value;
+ // const productPrice = document.getElementById('productPrice').value;
+ // const productDescription = document.getElementById('productDescription').value;
+
+ // closeModal();
+});
\ No newline at end of file