Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions essenza/essenza/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@

STATIC_URL = 'static/'
STATICFILES_DIRS = [BASE_DIR / 'static']
STATIC_ROOT = BASE_DIR / 'staticfiles'

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

Expand Down
7 changes: 6 additions & 1 deletion essenza/essenza/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
from django.urls import path, include
from info.views import info_view
from product.views import DashboardView
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
path('info/', info_view, name='info-home'),
path("user/", include("user.urls")),
path('admin/', admin.site.urls),
path('', DashboardView.as_view(), name='dashboard')
]
]

if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion essenza/product/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Product(models.Model):
category = models.CharField(max_length=20, choices=Category.choices)
brand = models.CharField(max_length=255)
price = models.DecimalField(max_digits=10, decimal_places=2)
photo = models.ImageField(upload_to='profile_pics/', null=True, blank=True)
photo = models.ImageField(upload_to='products/', null=True, blank=True)
stock = models.IntegerField()
is_active = models.BooleanField(default=False)

Expand Down
5 changes: 5 additions & 0 deletions essenza/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
asgiref==3.10.0
Django==5.2.8
pillow==12.0.0
sqlparse==0.5.3
tzdata==2025.2
Binary file added essenza/static/images/default_user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion essenza/templates/product/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@

{% if user.is_authenticated %}

<a href="/info">Mi perfil</a>
<a href="{% url 'profile' %}">Mi perfil</a>
<form action="{% url 'logout' %}" method="post" style="margin:0;">
{% csrf_token %}
<button type="submit" class="dropdown-logout-btn">Log out</button>
Expand Down
101 changes: 101 additions & 0 deletions essenza/templates/user/confirm_delete_profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{% load static %}
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Eliminar Cuenta · Essenza</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<style>
body {
/* --- Variables de Color --- */
--color-principal: #c06b3e;
--color-principal-hover: #a35a34;
--color-fondo: #faf7f2;
--color-fondo-tarjeta: #fff;
--color-texto-base: #333;
--color-borde-claro: #eee;
--color-error: #b00020;
--color-error-hover: #8e0019;
--color-foco-sombra: rgba(192, 107, 62, 0.2);

background-color: var(--color-fondo);
margin: 0;
font-family: 'Segoe UI', Arial, sans-serif;
}
.page {
min-height:100dvh;
display:flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap:2rem;
}
.brand {
color: var(--color-principal);
font-size: 48px;
margin-bottom: 10px;
text-align: center;
}
.form-card {
width: min(420px, 88vw);
background: var(--color-fondo-tarjeta);
border: 2px solid var(--color-error); /* Borde rojo de advertencia */
border-radius: 16px;
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
padding: 22px 24px;
box-sizing: border-box;
text-align: center; /* Centramos el contenido */
}

/* Botón de peligro (copiado de .btn-primary) */
.btn-danger {
width: 100%;
margin-top: 14px;
padding: 10px 12px;
border-radius: 10px;
background: var(--color-error); /* Color rojo */
color: var(--color-fondo-tarjeta);
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
.btn-danger:hover {
background-color: var(--color-error-hover); /* Rojo más oscuro */
}
.login-link {
margin-top: 15px;
text-align: center;
font-size: 13px;
}
.login-link a {
color: var(--color-principal);
text-decoration: underline;
}
</style>
</head>
<body>
<div class="page">
<h1 class="brand">ESSENZA</h1>
<div class="form-card">
<h2 style="color: var(--color-error); margin-top: 0;">Eliminar Cuenta</h2>
<p style="color: var(--color-texto-base); font-size: 16px;">
¿Estás seguro de que quieres eliminar tu cuenta permanentemente?
</p>
<p style="color: var(--color-texto-base); font-size: 14px; font-weight: bold;">
Toda tu información será borrada y esta acción no se puede deshacer.
</p>

<form method="post">
{% csrf_token %}

<button type="submit" class="btn-danger">Sí, eliminar mi cuenta ahora</button>
</form>

<p class="login-link">
<a href="{% url 'profile' %}">No, cancelar y volver a mi perfil</a>
</p>
</div>
</div>
</body>
</html>
215 changes: 215 additions & 0 deletions essenza/templates/user/edit_profile.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
{% load static %}
<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<title>Editar Perfil · Essenza</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
/* --- Variables de Color --- */
--color-principal: #c06b3e;
--color-principal-hover: #a35a34;
--color-fondo: #faf7f2;
--color-fondo-tarjeta: #fff;
--color-texto-base: #333;
--color-borde-claro: #eee;
--color-error: #b00020;
--color-foco-sombra: rgba(192, 107, 62, 0.2);

background-color: var(--color-fondo);
margin: 0;
font-family: 'Segoe UI', Arial, sans-serif;
}

.page {
min-height: 100dvh;
display: grid;
place-items: start center; /* Centrado horizontal, arriba vertical */
padding: 56px 0;
}

.brand {
color: var(--color-principal);
font-size: 48px;
margin-bottom: 10px;
text-align: center;
}

.form-card {
width: min(420px, 88vw);
background: var(--color-fondo-tarjeta);
border: 2px solid var(--color-principal);
border-radius: 16px;
box-shadow: 0 12px 28px rgba(0, 0, 0, 0.06);
padding: 22px 24px;
box-sizing: border-box;
}

/* --- Elementos del Formulario (Inputs y Labels) --- */
label {
display: block;
font-size: 13px;
color: var(--color-texto-base);
margin: 10px 0 6px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
width: 100%;
padding: 10px 12px;
border: 1px solid var(--color-borde-claro);
border-radius: 10px;
background: #fafafa;
outline: none;
box-sizing: border-box;
}

/* Estilo para el email deshabilitado */
input[type="email"]:disabled {
background: #eee;
color: #777;
cursor: not-allowed;
}

/* Estilo para el input de archivo */
input[type="file"] {
width: 100%;
font-size: 13px;
color: #555;
margin: 10px 0 15px;
padding: 8px;
border: 1px solid var(--color-borde-claro);
border-radius: 10px;
background: #fafafa;
box-sizing: border-box;
}

/* (NUEVO) Estilo simple para el label del checkbox */
label[for="id_remove_photo"] {
display: inline; /* Para que esté al lado del checkbox */
color: var(--color-error);
font-weight: 500;
margin-left: 5px;
}

/* (NUEVO) Estilo para el checkbox */
input[type="checkbox"] {
accent-color: var(--color-principal);
width: 16px;
height: 16px;
vertical-align: middle;
}

input:focus {
border-color: var(--color-principal);
box-shadow: 0 0 0 3px var(--color-foco-sombra);
}

/* --- Botones y Clases de Ayuda --- */
.btn-primary {
width: 100%;
margin-top: 14px;
padding: 10px 12px;
border-radius: 10px;
background: var(--color-principal);
color: var(--color-fondo-tarjeta); /* Blanco */
border: none;
cursor: pointer;
transition: background-color 0.3s;
}
.btn-primary:hover {
background-color: var(--color-principal-hover);
}

.login-link {
margin-top: 15px;
text-align: center;
font-size: 13px;
}
.login-link a {
color: var(--color-principal);
text-decoration: underline;
}

/* Mensajes de error */
.form-error {
color: var(--color-error);
font-size: 13px;
margin: 6px 0;
}
</style>
</head>
<body class="login-bg">
<div class="page">
<h1 class="brand">ESSENZA</h1>
<div class="form-card">
<form method="post" enctype="multipart/form-data" novalidate>
{% csrf_token %}

<label for="{{ form.first_name.id_for_label }}">Nombre</label>
{{ form.first_name }}

<label for="{{ form.last_name.id_for_label }}">Apellidos</label>
{{ form.last_name }}

<label for="{{ form.email.id_for_label }}">Correo electrónico</label>
{{ form.email }}

<label for="{{ form.photo.id_for_label }}">Foto (Opcional)</label>
{{ form.photo }}

{% if not form.remove_photo.is_hidden %}
<div style="margin-bottom: 15px;">
{{ form.remove_photo }}
<label for="{{ form.remove_photo.id_for_label }}">{{ form.remove_photo.label }}</label>
</div>
{% endif %}

{% if form.errors %}
<div style="margin-top: 15px;">
{% for field in form %}
{% for error in field.errors %}
<p class="form-error">{{ error }}</p>
{% endfor %}
{% endfor %}
{% for error in form.non_field_errors %}
<p class="form-error">{{ error }}</p>
{% endfor %}
</div>
{% endif %}

{% if form.errors %}
<div style="background: #fff0f0; border: 2px solid var(--color-error); border-radius: 10px; padding: 15px; margin-bottom: 15px;">
<p style="color: var(--color-error); margin-top: 0; font-weight: bold;">¡El formulario tiene errores!</p>
{% for field in form %}
{% if field.errors %}
<div class="form-error">
<strong>{{ field.label }}:</strong>
<ul>
{% for error in field.errors %}
<li>{{ error }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endfor %}
{% for error in form.non_field_errors %}
<div class="form-error">
<strong>Error general:</strong> {{ error }}
</div>
{% endfor %}
</div>
{% endif %}

<button type="submit" class="btn-primary">Guardar Cambios</button>

<p class="login-link">
<a href="{% url 'profile' %}">Cancelar y volver al perfil</a>
</p>
</form>
</div>
</div>
</body>
</html>
Loading