beta v.1.1

This commit is contained in:
2025-10-12 10:03:31 -03:00
parent c476b0171f
commit 4c05c3b6af
39 changed files with 410 additions and 11 deletions

4
.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# created by virtualenv automatically
.venv
venv
.idea

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

25
.idea/WevertonOrg.iml generated Normal file
View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="FacetManager">
<facet type="django" name="Django">
<configuration>
<option name="rootFolder" value="$MODULE_DIR$" />
<option name="settingsModule" value="Setup/settings.py" />
<option name="manageScript" value="$MODULE_DIR$/manage.py" />
<option name="environment" value="&lt;map/&gt;" />
<option name="doNotUseTestRunner" value="false" />
<option name="trackFilePattern" value="migrations" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.12 (WevertonOrg)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Django" />
</component>
</module>

View File

@@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

6
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (WevertonOrg)" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/WevertonOrg.iml" filepath="$PROJECT_DIR$/.idea/WevertonOrg.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,11 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard {% endblock %}
{% block content %}
<div class="row">
<div class="col-12">
<h1> {{ Day }} </h1>
</div>
</div>
<br>
{% endblock %}

View File

@@ -0,0 +1,5 @@
{% extends "Base.html" %}
{% block title %} Home {% endblock %}
{% block content %}
<p class="text-center"> Home </p>
{% endblock %}

14
Base/urls.py Normal file
View File

@@ -0,0 +1,14 @@
from django.urls import path
from django.contrib.auth import views as auth_views
from Base.views import (
views,
)
urlpatterns = [
# base das URLs
path('', views.Home, name='Home'),
path('login/', auth_views.LoginView.as_view(), name='login'),
path('logout/', auth_views.LogoutView.as_view(), name='logout'),
path('dashboard', views.Dashboard.as_view(), name='Dashboard'),
]

View File

@@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

Binary file not shown.

21
Base/views/views.py Normal file
View File

@@ -0,0 +1,21 @@
from django.shortcuts import render
from django.views.generic import TemplateView
from django.contrib.auth.mixins import LoginRequiredMixin #, PermissionRequiredMixin
from django.utils import timezone
# Create your views here.
def Home(request):
context = { 'ok':'ok', }
return render(request,'Login/Home.html',context )
class Dashboard(LoginRequiredMixin, TemplateView):
template_name = 'Login/Dashboard.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
Day = timezone.localtime(timezone.now())
context['User'] = self.request.user.username.capitalize()
context['Day'] = Day
return context

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -25,7 +25,7 @@ SECRET_KEY = 'django-insecure-as6)9knap6(+0)#l=h&aq8j&dyjb9w0ao_uv(&q4epoccp6c&0
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = ['192.168.0.201','weverton.org']
ALLOWED_HOSTS = ['127.0.0.1','192.168.0.201','weverton.org']
# Application definition
@@ -37,6 +37,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#Apps
'Base',
]
MIDDLEWARE = [
@@ -54,7 +56,7 @@ ROOT_URLCONF = 'Setup.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': ['Templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@@ -102,9 +104,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/5.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'pt-br'
TIME_ZONE = 'UTC'
TIME_ZONE = 'America/Sao_Paulo'
USE_I18N = True
@@ -115,12 +117,16 @@ USE_TZ = True
# https://docs.djangoproject.com/en/5.2/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = BASE_DIR / 'static'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# Default primary key field type
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
STATIC_ROOT = BASE_DIR / 'static'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
#Login
LOGIN_URL = 'login'
LOGIN_REDIRECT_URL = '/dashboard'
LOGOUT_REDIRECT_URL = '/login'

View File

@@ -15,8 +15,9 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('Base.urls')),
]

7
Templates/403.html Normal file
View File

@@ -0,0 +1,7 @@
{% extends "BaseLogin.html" %}
{% block title %} Dashboard {% endblock %}
{% block content %}
<br> Erro 403 <br>
{% endblock %}

11
Templates/404.html Normal file
View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Não Encontrado</title>
</head>
<body>
<h1> Algo deu ruim ai . </h1>
<a href="{% url 'Home' %}" class="btn btn-secondary mt-3 "> Home </a>
</body>
</html>

25
Templates/Base.html Normal file
View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="pt-br" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>{% block title %} {% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
</head>
<body>
{% include 'components/_header.html' %}
<div class="row">
{% block content %}
{% endblock %}
</div>
{% include 'components/_footer.html' %}
<script async src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
</html>

43
Templates/BaseLogin.html Normal file
View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="pt-br" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<title>{% block title %} {% endblock %}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
</head>
<body class="">
{% include 'components/_header.html' %}
<div class="row">
<div class="col-2 bg-body-tertiary " id="sidebar" >
{% include 'components/_sidebar.html' %}
{# {% include 'components/_sidebar_admin.html' %}#}
</div>
<div class="col-10">
<div class="container-fluid">
<div class="col py-3">
<main>
{% include 'components/_msg.html' %}
{% block content %}
{% endblock %}
</main>
</div>
</div>
</div>
</div>
{% include 'components/_footer.html' %}
<script async src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
crossorigin="anonymous"></script>
</body>
<style>
#sidebar {
height: 100%;
}
</style>
</html>

View File

@@ -0,0 +1,12 @@
<footer class="footer mt-auto py-3 text-center bg-body-tertiary">
<div class="container">
<a class="navbar-brand --bs-success-text-emphasis" href="{% url 'Home' %}"> © Weverton </a>
</div>
</footer>
<style>
footer {
position: fixed;
bottom: 0;
width: 100%;
}
</style>

View File

@@ -0,0 +1,34 @@
{% load tz %}
</nav>
<nav class="navbar navbar-expand-lg bg-body-tertiary">
&nbsp; <i class="bi bi-balloon-heart"></i>
<div class="container-fluid">
{% if not user.is_authenticated %}
<a class="navbar-brand --bs-success-text-emphasis" href="{% url 'Home' %}"> Wevertom </a>
{% endif %}
{% if user.is_authenticated %}
<a class="navbar-brand --bs-success-text-emphasis" href="{% url 'Dashboard' %}"> Weverton </a>
{% endif %}
<ul class="nav justify-content-center">
<li class="navbar-brand --bs-success-text-emphasis">
Hoje dia {% now "d" %} de {% now "F" %} de {% now "Y" %} ({% now "d/m/Y" %})
</li>
</ul>
<ul class="nav justify-content-end">
{% if not user.is_authenticated %}
<li class="nav-item">
<a class="btn btn-primary" aria-current="page" href="{% url 'login' %}">Login</a>
</li>
{% endif %}
{% if user.is_authenticated %}
<li class="navbar-brand --bs-success-text-emphasis">
Ola, {{ user.username.capitalize }}
</li>
<form action="{% url 'logout' %}" method="post" id="logout-form" class="">
{% csrf_token %}
<button type="submit" class="btn btn-danger" aria-current="true"> Logout </button>
</form>
{% endif %}
</ul>
</div>
</nav>

View File

@@ -0,0 +1,17 @@
{% if messages %}
{% for message in messages %}
<div class="alert {% if 'success' in message.tags %}alert-primary{% elif 'error' in message.tags %}alert-danger{% endif %} message" role="alert">
{{ message }}
</div>
{% endfor %}
{% endif %}
<script>
// Espera 5 segundos e depois remove as mensagens
setTimeout(function() {
const messages = document.querySelectorAll('.message');
messages.forEach(function(message) {
message.style.display = 'none';
});
}, 9000);
</script>

View File

@@ -0,0 +1,49 @@
{% if page_obj.has_other_pages %}
<nav>
<ul class="pagination justify-content-center">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="?page=1">
Primeira
</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.previous_page_number }}">
Anterior
</a>
</li>
{% endif %}
{% for page_number in page_obj.paginator.page_range %}
{% if page_number <= page_obj.number|add:3 and page_number >= page_obj.number|add:-3 %}
{% if page_obj.number == page_number %}
<li class="page-item active">
<a class="page-link" href="?page={{ page_number }}">
{{ page_number }}
</a>
</li>
{% else %}
<li class="page-item">
<a class="page-link" href="?page={{ page_number }}">
{{ page_number }}
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.next_page_number }}">
Próxima
</a>
</li>
<li class="page-item">
<a class="page-link" href="?page={{ page_obj.paginator.num_pages }}">
Última
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}

View File

@@ -0,0 +1,10 @@
{% if user.is_authenticated %}
<div class="" >
<div class="list-group" >
<a class="list-group-item list-group-item-action list-group-item-primary"
aria-current="true" href="{% url 'Home' %}"> Home </a>
<a class="list-group-item list-group-item-action list-group-item-primary"
aria-current="true" href="{% url 'Dashboard' %}"> Dashboard </a>
</div>
</div>
{% endif %}

View File

@@ -0,0 +1,29 @@
{% if user.is_authenticated %}
{% if user.is_superuser %}
<div class="" >
<div class="list-group" >
{% if user.is_superuser %}
<a class="list-group-item list-group-item-action list-group-item-primary" aria-current="true"
href="{% url 'DashboardAdmin' %}"> Dashboard Admin </a> {% endif %}
{% if user.is_superuser %}
<a class="list-group-item list-group-item-action list-group-item-danger" aria-current="true"
href="{% url 'DashboardTest' %}"> Dashboard Test </a>{% endif %}
{% if perms.Base.view_bankaccount %}
<a class="list-group-item list-group-item-action" href="{% url 'BankAccountsListView' %}" > Banks </a> {% endif %}
{% if perms.Movement.view_paymentmethod %}
<a class="list-group-item list-group-item-action" href="{% url 'PaymentMethodListView' %}" > Metodos de Pag. </a>{% endif %}
{% if perms.Base.view_product %}
<a class="list-group-item list-group-item-action" href="{% url 'ProductListListView' %}" > Lista de Produtos </a> {% endif %}
{% if perms.Base.view_professional %}
<a class="list-group-item list-group-item-action" href="{% url 'ProfessionalListView' %}" > Professional </a> {% endif %}
{% if perms.Calendar.view_time %}
<a class="list-group-item list-group-item-action" href="{% url 'TimeListView' %}" > Horarios </a> {% endif %}
{% if perms.Base.view_service %}
<a class="list-group-item list-group-item-action" href="{% url 'ServiceListListView' %}" > Lista de Service </a> {% endif %}
{% if perms.Movement.view_expensemovementt %}
<a class="list-group-item list-group-item-action" href="{% url 'AccountListListView' %}" > Lista de Despesa </a> {% endif %}
</div>
</div>
{% endif %}
{% endif %}

View File

@@ -0,0 +1,44 @@
{% extends 'Base.html' %}
{% block title %}Login{% endblock %}
{% block content %}
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-body">
<h5 class="card-title text-center mb-4">Login</h5>
<form method="post">
{% csrf_token %}
<div class="mb-3">
<label for="username" class="form-label">Usuário</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Senha</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="d-grid gap-2">
<button type="submit" class="btn btn-primary">Entrar</button>
</div>
</form>
{% if form.errors %}
<div class="alert alert-danger mt-4">
<ul class="mb-0">
{% for field in form %}
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}

BIN
db.sqlite3 Normal file

Binary file not shown.

BIN
requirements_win.txt Normal file

Binary file not shown.