diff --git a/action/management/commands/create_default_states.py b/action/management/commands/create_default_states.py
index 6daccb2..1995c4e 100644
--- a/action/management/commands/create_default_states.py
+++ b/action/management/commands/create_default_states.py
@@ -11,17 +11,22 @@ class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('institution_name', type=str, help='The name of the institution')
+ parser.add_argument(
+ 'language_code',
+ type=str,
+ help='The language code to set (e.g., "es", "en", "ca")',
+ )
def handle(self, *args, **kwargs):
default_states = [
- _("INBOX"),
- _("VISUAL INSPECTION"),
- _("REPAIR"),
- _("INSTALL"),
- _("TEST"),
- _("PACKAGING"),
- _("DONATION"),
- _("DISMANTLE")
+ "INBOX",
+ "VISUAL INSPECTION",
+ "REPAIR",
+ "INSTALL",
+ "TEST",
+ "PACKAGING",
+ "DONATION",
+ "DISMANTLE"
]
institution_name = kwargs['institution_name']
@@ -32,6 +37,37 @@ class Command(BaseCommand):
logger.error(txt, institution.name)
return
+ # If using djangos localization framework for initial states, then we would need institution-wide languange preferences
+ lang_code = kwargs['language_code']
+ match lang_code:
+ case "en":
+ pass
+ case "es":
+ default_states = [
+ "ENTRADA",
+ "INSPECCION VISUAL",
+ "REPARACIÓN",
+ "INSTALADO",
+ "PRUEBAS",
+ "EMPAQUETADO",
+ "DONACION",
+ "DESMANTELADO"
+ ]
+ case "ca":
+ default_states = [
+ "ENTRADA",
+ "INSPECCIÓ VISUAL",
+ "REPARACIÓ",
+ "INSTAL·LAT",
+ "PROVES",
+ "EMPAQUETAT",
+ "DONACIÓ",
+ "DESMANTELLAT"
+ ]
+ case _:
+ logger.error("Language not supported %s", lang_code)
+ return
+
for state in default_states:
state_def, created = StateDefinition.objects.get_or_create(
institution=institution,
diff --git a/admin/templates/admin_panel.html b/admin/templates/admin_panel.html
index 3dd5ed1..d5568fe 100644
--- a/admin/templates/admin_panel.html
+++ b/admin/templates/admin_panel.html
@@ -1,19 +1,30 @@
{% extends "base.html" %}
{% load i18n %}
+
{% block content %}
-
+
-
-
-
- {% translate "Institution" %}
-
+
+
+
+
+
+ {% translate "Institution" %}
+
+
+ {% translate "Edit and manage the institution's details and settings." %}
+
+
+
+
+
-
+
{% endblock %}
diff --git a/admin/templates/admin_users.html b/admin/templates/admin_users.html
index 37fbf96..c68ef1d 100644
--- a/admin/templates/admin_users.html
+++ b/admin/templates/admin_users.html
@@ -1,36 +1,40 @@
{% extends "base.html" %}
{% load i18n %}
+{% block actions %}
+
+
+
+ {% translate "New user" %}
+
+{% endblock %}
+
+
{% block content %}
-
+
{{ subtitle }}
-
-
-
- Email
- is Admin
-
-
-
+
+
+
+ {% trans "Email" %}
+ {% trans "Admin" %}
+ {% trans "Actions" %}
+
-
{% for u in users %}
+
{{ u.email }}
- {{ u.is_admin }}
-
-
-
- {% endfor %}
+ {% if u.is_admin %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}
+
+
+
+
+
+
+ {% endfor %}
diff --git a/admin/templates/delete_user.html b/admin/templates/delete_user.html
index 5aa402d..452b61a 100644
--- a/admin/templates/delete_user.html
+++ b/admin/templates/delete_user.html
@@ -1,19 +1,24 @@
{% extends "base.html" %}
{% load i18n %}
+{% load django_bootstrap5 %}
+
{% block content %}
-
-{% load django_bootstrap5 %}
-
-
- Are you sure than want remove the lot {{ object.name }} with {{ object.devices.count }} devices.
+
+
+
+
+ {% blocktranslate %}
+ Are you sure you want to remove the lot {{ object.name }} with {{ object.devices.count }} devices?
+ {% endblocktranslate %}
+
+
-
diff --git a/admin/templates/institution.html b/admin/templates/institution.html
index 88014b9..1d0977b 100644
--- a/admin/templates/institution.html
+++ b/admin/templates/institution.html
@@ -1,32 +1,49 @@
{% extends "base.html" %}
-{% load i18n %}
+{% load i18n django_bootstrap5 %}
{% block content %}
-
-
-
{{ subtitle }}
+
-{% load django_bootstrap5 %}
-
+ {% if form.errors %}
+
+
{% translate "Please fix the following errors:" %}
+
+ {% for field, errors in form.errors.items %}
+ {{ field|title }}: {{ errors|join:", " }}
+ {% endfor %}
+
+
+
+ {% endif %}
+
+
+
+ {% bootstrap_field form.name addon_before=' ' %}
+ {% bootstrap_field form.location addon_before=' ' %}
+
+
+ {% bootstrap_field form.responsable_person addon_before=' ' %}
+ {% bootstrap_field form.supervisor_person addon_before=' ' %}
+ {% bootstrap_field form.logo addon_before=' ' %}
+
+
+
+
+
+
{% endblock %}
diff --git a/admin/templates/states_panel.html b/admin/templates/states_panel.html
index 503b3fa..78a21d9 100644
--- a/admin/templates/states_panel.html
+++ b/admin/templates/states_panel.html
@@ -1,18 +1,17 @@
{% extends "base.html" %}
{% load i18n django_bootstrap5 %}
-{% block content %}
-
-
-
{{ subtitle }}
-
-
+{% block actions %}
- {% trans "Add" %}
+
+ {% trans "New State" %}
-
-
-
+{% endblock %}
+
+{% block content %}
+
{{ subtitle }}
+
+
{% if state_definitions %}
diff --git a/admin/views.py b/admin/views.py
index df4cf16..0f51dc4 100644
--- a/admin/views.py
+++ b/admin/views.py
@@ -31,7 +31,7 @@ class AdminView(DashboardView):
class PanelView(AdminView, TemplateView):
template_name = "admin_panel.html"
title = _("Admin")
- breadcrumb = _("admin") + " /"
+ breadcrumb = _("Admin") + " / " + _("Panel") + " /"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@@ -41,7 +41,7 @@ class PanelView(AdminView, TemplateView):
class UsersView(AdminView, TemplateView):
template_name = "admin_users.html"
title = _("Users")
- breadcrumb = _("admin / Users") + " /"
+ breadcrumb = _("Admin") + " / " + _("Panel") + " / " + _("Users")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
@@ -54,7 +54,7 @@ class UsersView(AdminView, TemplateView):
class CreateUserView(AdminView, NotifyActivateUserByEmail, CreateView):
template_name = "user.html"
title = _("User")
- breadcrumb = _("admin / User") + " /"
+ breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("New")
success_url = reverse_lazy('admin:users')
model = User
fields = (
@@ -79,7 +79,7 @@ class CreateUserView(AdminView, NotifyActivateUserByEmail, CreateView):
class DeleteUserView(AdminView, DeleteView):
template_name = "delete_user.html"
title = _("Delete user")
- breadcrumb = "admin / Delete user"
+ breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("Delete")
success_url = reverse_lazy('admin:users')
model = User
fields = (
@@ -96,7 +96,7 @@ class DeleteUserView(AdminView, DeleteView):
class EditUserView(AdminView, UpdateView):
template_name = "user.html"
title = _("Edit user")
- breadcrumb = "admin / Edit user"
+ breadcrumb = _("Admin") + " / " + _("Users") + " / " +_("Edit")
success_url = reverse_lazy('admin:users')
model = User
fields = (
@@ -116,6 +116,7 @@ class InstitutionView(AdminView, UpdateView):
template_name = "institution.html"
title = _("Edit institution")
section = "admin"
+ breadcrumb = _("Admin") + " / " + _("Institution") + " / "
subtitle = _('Edit institution')
model = Institution
success_url = reverse_lazy('admin:panel')
@@ -127,6 +128,16 @@ class InstitutionView(AdminView, UpdateView):
"supervisor_person"
)
+ def get_form(self, form_class=None):
+ form = super().get_form(form_class)
+ form.fields["name"].help_text = _("Full name of the institution.")
+ form.fields["logo"].help_text = _("URL to the institution's logo.")
+ form.fields["location"].help_text = _("The address or city of the institution.")
+ form.fields["responsable_person"].help_text = _("Name of the institution's responsable person.")
+ form.fields["supervisor_person"].help_text = _("The supervisor's full name.")
+
+ return form
+
def get_form_kwargs(self):
self.object = self.request.user.institution
kwargs = super().get_form_kwargs()
@@ -146,7 +157,7 @@ class StateDefinitionContextMixin(ContextMixin):
class StatesPanelView(AdminView, StateDefinitionContextMixin, TemplateView):
template_name = "states_panel.html"
title = _("States Panel")
- breadcrumb = _("admin / States Panel") + " /"
+ breadcrumb = _("Admin") + " / " + _("States") + " / "
class AddStateDefinitionView(AdminView, StateDefinitionContextMixin, CreateView):
diff --git a/api/views.py b/api/views.py
index 188bcd7..acee54a 100644
--- a/api/views.py
+++ b/api/views.py
@@ -122,7 +122,6 @@ class NewSnapshotView(ApiMixing):
owner=self.tk.owner.institution
).first()
-
if not prop:
logger.error("Error: No property for uuid: %s", ev_uuid)
return JsonResponse({'status': 'fail'}, status=500)
diff --git a/dashboard/static/css/dashboard.css b/dashboard/static/css/dashboard.css
index 7f2f108..6033408 100644
--- a/dashboard/static/css/dashboard.css
+++ b/dashboard/static/css/dashboard.css
@@ -174,3 +174,15 @@ h3 {
.btn-orange {
background-color: #f5b587;
}
+
+/* Clase para botones con funcionalidad no implementados */
+.btn-todo {
+ background-color: #6c757d;
+ color: #fff; /* texto en blanco*/
+ opacity: 0.65;
+ cursor: not-allowed;
+
+.btn-todo:disabled {
+ pointer-events: none;
+ }
+}
diff --git a/dashboard/templates/base.html b/dashboard/templates/base.html
index 57bf0fb..6ebd539 100644
--- a/dashboard/templates/base.html
+++ b/dashboard/templates/base.html
@@ -1,4 +1,4 @@
-{% load i18n static %}
+{% load i18n static language_code %}
@@ -7,7 +7,7 @@
{% block meta %}
-
+
{% endblock %}
@@ -64,17 +64,24 @@
{{ user.institution.name|upper }}
-
-
+
+
+
+
+
+ {% block actions %}
+ {% endblock %}
+
+
{% block content %}
{% endblock content %}
-
+
-