mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
108 lines
3.4 KiB
HTML
108 lines
3.4 KiB
HTML
{% extends "base.html" %}
|
|
{% load static %}
|
|
|
|
|
|
{% block 'head' %}
|
|
<link rel="stylesheet" href="{% static 'products/css/products.css' %}">
|
|
|
|
|
|
{% endblock %}
|
|
|
|
{% block 'title' %}
|
|
Produtos
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block 'body' %}
|
|
|
|
|
|
<body>
|
|
<div class="grid-container">
|
|
<div >
|
|
<input type="text" id="search-product" name="search-product" placeholder="Buscar Produto" hx-get="{% url 'searchProduct' %}" hx-trigger="keyup" hx-target="#product-list"><br>
|
|
</div>
|
|
<button onclick="openModal()" id="openModal">Adicionar Novo Produto</button>
|
|
|
|
<table id="product-list">
|
|
<tr>
|
|
<th style="text-align: left;">Produto</th>
|
|
<th style="text-align: left;width: 20%;">Preço</th>
|
|
<th style="text-align: left;">Quantidade</th>
|
|
<th style="text-align: left;">Categoria</th>
|
|
<th style="text-align: left;width: 20%;">Ações</th>
|
|
</tr>
|
|
|
|
{% for product in products %}
|
|
|
|
<tr>
|
|
<td id="name-{{product.id}}" >{{product.name}}</td>
|
|
<td id="price-{{product.id}}" >R$ {{product.price}}</td>
|
|
<td id="quantity-{{product.id}}" >{{product.quantity}}</td>
|
|
<td id="category-{{product.id}}" >{{product.category.name}}</td>
|
|
<td>
|
|
<div class="grid-buttons">
|
|
<h2 onclick="editProduct({{product.id}})" style="cursor: pointer;" >📝</h2>
|
|
<input type="hidden" id="h-category-{{product.id}}" value="{{ product.category.id }}">
|
|
<input type="hidden" id="description-{{product.id}}" value="{{ product.description }}">
|
|
|
|
<form action="{% url 'onOffproduct' %}" method="post">
|
|
{% csrf_token %}
|
|
<input type="hidden" name="id-product" id="id-{{product.id}}" value="{{ product.id }}">
|
|
|
|
{% if product.active == True %}
|
|
<button style="background-color: rgba(255, 0, 0, 0);">✅</button>
|
|
{% else %}
|
|
<button style="background-color: rgba(0, 128, 0, 0);" >🚫</button>
|
|
|
|
{% endif %}
|
|
|
|
</form>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
{% endfor %}
|
|
|
|
</table>
|
|
|
|
|
|
</div>
|
|
</body>
|
|
|
|
|
|
|
|
<dialog id='Modal-create-product' >
|
|
<article >
|
|
|
|
<form action="{% url 'create_product' %}" id="productForm" method="post" >
|
|
{% csrf_token %}
|
|
<h2>Cadastro de Produto</h2>
|
|
<input type="text" id="productId" name="productId" hidden ><br>
|
|
<input type="text" id="productName" name="name" required placeholder="Nome"><br>
|
|
<input type="number" step="0.01" id="productPrice" name="price" required placeholder="Preço"><br>
|
|
<input type="number" step="1" id="productqtd" name="qtd" placeholder="Quantidade"><br>
|
|
<select id="select-categorie" name="select-categorie" >
|
|
|
|
{% for categorie in categories %}
|
|
<option value="{{categorie.id}}">{{categorie.name}}</option>
|
|
{% endfor %}
|
|
|
|
</select>
|
|
<textarea id="productDescription" name="description" rows="4" placeholder="Descrição"></textarea><br>
|
|
<footer class="grid-buttons">
|
|
<button type="submit">Salvar</button>
|
|
<button type="button" onclick="closeModal()" style="background-color:red;">Fechar</button>
|
|
</footer>
|
|
</form>
|
|
|
|
</article>
|
|
</dialog>
|
|
|
|
|
|
|
|
|
|
<script src="{% static 'products/js/products.js' %}"></script>
|
|
|
|
{% endblock %} |