feat: login
BIN
gestaoRaul/gestaoRaul/__pycache__/decorators.cpython-313.pyc
Normal file
@@ -1,5 +1,7 @@
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.http import HttpResponseForbidden, HttpResponseRedirect
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
|
||||
|
||||
def group_required(groupName):
|
||||
@@ -11,7 +13,7 @@ def group_required(groupName):
|
||||
else:
|
||||
return HttpResponseForbidden('tu nao tem acesso rapa')
|
||||
else:
|
||||
return HttpResponseForbidden('Direcionar para tela de login aqui')
|
||||
return redirect('login')
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('admin/', admin.site.urls, name='admin'),
|
||||
path('', include('home.urls')),
|
||||
path('login/', include('login.urls')),
|
||||
path('products/', include('products.urls')),
|
||||
|
||||
@@ -22,7 +22,7 @@ def home(request):
|
||||
produtos_mais_vendidos = ProductComanda.objects.values('product').annotate(
|
||||
quantidade=Count('product'),
|
||||
nome=F('product__name') ).order_by('-quantidade')[:5]
|
||||
return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos, 'ticekMedio': ticekMedio})
|
||||
return render(request, 'home.html', {'total_pagamentos': total_pagamentos, 'pagamentos': pagamentos, 'qdt_pagamentos': qdt_pagamentos, 'produtos_mais_vendidos': produtos_mais_vendidos, 'ticekMedio': ticekMedio, })
|
||||
|
||||
@group_required(groupName='Gerente')
|
||||
def chartCuisine(request):
|
||||
|
||||
BIN
gestaoRaul/login/__pycache__/urls.cpython-313.pyc
Normal file
BIN
gestaoRaul/login/__pycache__/views.cpython-313.pyc
Normal file
@@ -1,13 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
{% load static %}
|
||||
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<form method="post">
|
||||
<head>
|
||||
<Title>Login Form</Title>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'pico.css' %}">
|
||||
|
||||
<link rel="stylesheet" href="{% static 'login/css/login.css' %}">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="c-form">
|
||||
<h2>
|
||||
<img src="{% static 'midia/logo.png' %}" width="140px">
|
||||
</h2>
|
||||
<div class="c-input">
|
||||
<form method="post" class="c-inputBox">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Entrar</button>
|
||||
<div class="c-inputBox">
|
||||
<input type="submit" name="" value="Entrar">
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</div>
|
||||
<!-- <p class="forgot">Forgot Password? <a href="#">Click Here</a></p> -->
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -3,4 +3,5 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.login_view, name='login'),
|
||||
path('logout', views.logout_view, name='logout'),
|
||||
]
|
||||
@@ -1,7 +1,13 @@
|
||||
from django.shortcuts import render, redirect
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.contrib.auth import authenticate, login, logout
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return redirect('login')
|
||||
|
||||
|
||||
def login_view(request):
|
||||
if request.method == 'POST':
|
||||
form = AuthenticationForm(data=request.POST)
|
||||
@@ -11,7 +17,7 @@ def login_view(request):
|
||||
user = authenticate(username=username, password=password)
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
return redirect('home') # Substitua 'home' pelo nome da sua URL inicial
|
||||
return redirect('home')
|
||||
else:
|
||||
pass
|
||||
# Mensagem de erro: Credenciais inválidas
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="shortcut icon" href="{% static 'midia/favicon/favicon.ico' %}" />
|
||||
|
||||
<link rel="stylesheet" href="{% static 'pico.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'base.css' %}">
|
||||
@@ -19,30 +20,37 @@
|
||||
<header class="p-header">
|
||||
<nav class="nav-bar">
|
||||
<div class="logo">
|
||||
<h1>RRBEC</h1>
|
||||
<h1>
|
||||
<!-- RRBEC -->
|
||||
<img src="{% static 'midia/logo.png' %}" width="60">
|
||||
|
||||
</h1>
|
||||
</div>
|
||||
<div class="nav-list">
|
||||
<ul>
|
||||
<li class="nav-item"><a href="{% url 'home' %}" class="nav-link">Início</a></li>
|
||||
<li class="nav-item"><a href="{% url 'comandas' %}" class="nav-link">Comandas</a></li>
|
||||
<li class="nav-item"><a href="{% url 'pedidos' %}" class="nav-link">Cozinha</a></li>
|
||||
<li class="nav-item"><a href="{% url 'viewBalcao' %}" class="nav-link"> Balcão</a></li>
|
||||
<li class="nav-item"><a href="{% url 'mapMesas' %}" class="nav-link"> Mapa</a></li>
|
||||
<li class="nav-item"><a href="{% url 'viewBalcao' %}" class="nav-link">Balcão</a></li>
|
||||
<li class="nav-item"><a href="{% url 'mapMesas' %}" class="nav-link">Mapa</a></li>
|
||||
|
||||
<div class="dropdown">
|
||||
<li class="nav-item">Cadastros </li>
|
||||
<li class="nav-item">Cadastros</li>
|
||||
<div class="dropdown-content">
|
||||
<a href="{% url 'products' %}" class="nav-link"> Produtos</a>
|
||||
<a href="{% url 'products' %}" class="nav-link"> Categorias</a>
|
||||
<a href="{% url 'products' %}" class="nav-link"> Clientes</a>
|
||||
<a href="{% url 'products' %}" class="nav-link">Produtos</a>
|
||||
<a href="{% url 'products' %}" class="nav-link">Categorias</a>
|
||||
<a href="{% url 'products' %}" class="nav-link">Clientes</a>
|
||||
<a href="{% url 'products' %}" class="nav-link">Admin</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
<div class="login-button">
|
||||
<button onclick="entrar()" ><a href="#">Entrar</a></button>
|
||||
|
||||
<div class="logout-button">
|
||||
<p>{{ user.first_name }} {{ user.last_name }}</p>
|
||||
<a href="{% url 'logout' %}"><img src="{% static 'midia/icons/logout.svg' %}" style="width: 40px;"></a>
|
||||
</div>
|
||||
|
||||
<div class="mobile-menu-icon">
|
||||
@@ -67,8 +75,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
<div class="login-button">
|
||||
<button onclick="entrar()"><a href="#">Entrar</a></button>
|
||||
<div class="logout-button">
|
||||
{{ user.first_name }} {{ user.last_name }}
|
||||
<a href="{% url 'logout' %}"><img src="{% static 'midia/icons/logout.svg' %}" style="width: 40px;"></a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -25,18 +25,16 @@ text-align: center;
|
||||
.nav-bar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.1rem 2rem;
|
||||
padding: 0.1rem 1rem;
|
||||
|
||||
}
|
||||
|
||||
.logo {
|
||||
display: flex;
|
||||
margin-top: 5px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.logo h1 {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.nav-list {
|
||||
display: flex;
|
||||
@@ -45,7 +43,7 @@ text-align: center;
|
||||
|
||||
.nav-list ul {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
justify-content: space-between;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
@@ -60,11 +58,13 @@ text-align: center;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.login-button button {
|
||||
.logout-button{
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
/* justify-content: center; */
|
||||
border: none;
|
||||
padding: 10px 15px;
|
||||
border-radius: 5px;
|
||||
margin-top: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.login-button button a {
|
||||
@@ -82,14 +82,7 @@ text-align: center;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* .dropbtn {
|
||||
background-color: #04AA6D;
|
||||
color: white;
|
||||
padding: 16px;
|
||||
font-size: 16px;
|
||||
border: none;
|
||||
}
|
||||
*/
|
||||
|
||||
.dropdown {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
@@ -135,7 +128,7 @@ text-align: center;
|
||||
.nav-item {
|
||||
display: none;
|
||||
}
|
||||
.login-button {
|
||||
.logout-button {
|
||||
display: none;
|
||||
}
|
||||
.mobile-menu-icon {
|
||||
@@ -156,11 +149,13 @@ text-align: center;
|
||||
display: block;
|
||||
padding-top: 1.2rem;
|
||||
}
|
||||
.mobile-menu .login-button {
|
||||
.mobile-menu .logout-button {
|
||||
display: block;
|
||||
justify-items: center;
|
||||
justify-self: center;
|
||||
padding: 1rem 2rem;
|
||||
}
|
||||
.mobile-menu .login-button button {
|
||||
.mobile-menu .logout-button button {
|
||||
width: 100%;
|
||||
}
|
||||
.open {
|
||||
|
||||
99
gestaoRaul/templates/static/login/css/login.css
Normal file
@@ -0,0 +1,99 @@
|
||||
/* @import url('https://fonts.googleapis.com/css2?family=Oswald&display=swap'); */
|
||||
*
|
||||
{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
font-family: 'Oswald', sans-serif;
|
||||
}
|
||||
body
|
||||
{
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
/* background: #060c21; */
|
||||
}
|
||||
.c-form
|
||||
{
|
||||
position: relative;
|
||||
background: #060c21d8;
|
||||
border: 1px solid #3f3f3f;
|
||||
box-shadow: 5px 5px 10px rgba(87, 86, 86, 0.788);
|
||||
width: 350px;
|
||||
padding: 40px 40px 60px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
.c-form::before
|
||||
{
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -2px;
|
||||
right: -2px;
|
||||
bottom: -2px;
|
||||
left: -2px;
|
||||
background: linear-gradient(315deg,#591309,#fee4c1);
|
||||
z-index: -1;
|
||||
transform: skew(2deg,1deg);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.c-form h2
|
||||
{
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 5px;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.c-form h2:hover
|
||||
{
|
||||
scale: 1.05;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
.c-form .c-input
|
||||
{
|
||||
margin-top: 40px;
|
||||
text-align: left;
|
||||
}
|
||||
.c-form .c-input .c-inputBox
|
||||
{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.c-form .c-input .c-inputBox label
|
||||
{
|
||||
display: block;
|
||||
color: #fff;
|
||||
margin-bottom: 5px;
|
||||
font-size: 18px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.c-form .c-input .c-inputBox input
|
||||
{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border: none;
|
||||
outline: none;
|
||||
padding: 5px 15px;
|
||||
background:linear-gradient(315deg,#591309,#fee4c1) ;
|
||||
color: #fff;
|
||||
font-size: 18px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.c-form .c-input .c-inputBox input[type="submit"]
|
||||
{
|
||||
cursor: pointer;
|
||||
margin-top: 20px;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
.c-form .c-input .c-inputBox input[type="submit"]:hover
|
||||
{
|
||||
background:linear-gradient(315deg,#fee4c1,#591309) ;
|
||||
}
|
||||
.c-form .c-input .c-inputBox input[type="submit"]:active
|
||||
{
|
||||
color: rgba(255, 255, 255, 0.521);
|
||||
background:linear-gradient(315deg,#fee4c1,#591309) ;
|
||||
}
|
||||
0
gestaoRaul/templates/static/login/js/login.js
Normal file
@@ -2,8 +2,8 @@
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 2fr);
|
||||
gap: 20px;
|
||||
max-width: 800px; /* Define a largura máxima do grid */
|
||||
margin: 0 auto; /* Centraliza o grid na página */
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.card {
|
||||
@@ -13,7 +13,7 @@
|
||||
border-radius: 15px;
|
||||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
line-height: 120px; /* Centraliza o texto verticalmente */
|
||||
line-height: 120px;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
@@ -26,11 +26,10 @@
|
||||
border-radius: 15px;
|
||||
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.2);
|
||||
text-align: center;
|
||||
line-height: 50px; /* Centraliza o texto verticalmente */
|
||||
line-height: 50px;
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
/* position: absolute; */
|
||||
transition: transform 0.2s;
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
BIN
gestaoRaul/templates/static/midia/favicon/apple-touch-icon.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
gestaoRaul/templates/static/midia/favicon/favicon-96x96.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
gestaoRaul/templates/static/midia/favicon/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
1
gestaoRaul/templates/static/midia/favicon/favicon.svg
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
21
gestaoRaul/templates/static/midia/favicon/site.webmanifest
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "MyWebSite",
|
||||
"short_name": "MySite",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
||||
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 185 KiB |
7
gestaoRaul/templates/static/midia/icons/logout.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Transformed by: SVG Repo Mixer Tools -->
|
||||
<svg width="118px" height="118px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<g id="SVGRepo_bgCarrier" stroke-width="0"/>
|
||||
|
||||
|
After Width: | Height: | Size: 1.4 KiB |