add pages to manage returnable products

This commit is contained in:
imperosol
2025-03-07 02:03:22 +01:00
committed by Thomas Girod
parent e7bb08448c
commit eee78008b1
11 changed files with 278 additions and 40 deletions

View File

@ -55,6 +55,14 @@
width: 80%;
}
.card-top-left {
position: absolute;
top: 10px;
right: 10px;
padding: 10px;
text-align: center;
}
.card-content {
color: black;
display: flex;

View File

@ -10,10 +10,17 @@
{% block nav %}
{% endblock %}
{# if the template context has the `object_name` variable,
then this one will be used,
instead of the result of `str(object)` #}
{% if object and not object_name %}
{% set object_name=object %}
{% endif %}
{% block content %}
<h2>{% trans %}Delete confirmation{% endtrans %}</h2>
<form action="" method="post">{% csrf_token %}
<p>{% trans obj=object %}Are you sure you want to delete "{{ obj }}"?{% endtrans %}</p>
<p>{% trans name=object_name %}Are you sure you want to delete "{{ name }}"?{% endtrans %}</p>
<input type="submit" value="{% trans %}Confirm{% endtrans %}" />
</form>
<form method="GET" action="javascript:history.back();">

View File

@ -62,6 +62,11 @@
{% trans %}Product types management{% endtrans %}
</a>
</li>
<li>
<a href="{{ url("counter:returnable_list") }}">
{% trans %}Returnable products management{% endtrans %}
</a>
</li>
<li>
<a href="{{ url('counter:cash_summary_list') }}">
{% trans %}Cash register summaries{% endtrans %}

View File

@ -1,3 +1,5 @@
from typing import ClassVar
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.views import View
@ -6,20 +8,24 @@ from django.views import View
class TabedViewMixin(View):
"""Basic functions for displaying tabs in the template."""
current_tab: ClassVar[str | None] = None
list_of_tabs: ClassVar[list | None] = None
tabs_title: ClassVar[str | None] = None
def get_tabs_title(self):
if hasattr(self, "tabs_title"):
return self.tabs_title
raise ImproperlyConfigured("tabs_title is required")
if not self.tabs_title:
raise ImproperlyConfigured("tabs_title is required")
return self.tabs_title
def get_current_tab(self):
if hasattr(self, "current_tab"):
return self.current_tab
raise ImproperlyConfigured("current_tab is required")
if not self.current_tab:
raise ImproperlyConfigured("current_tab is required")
return self.current_tab
def get_list_of_tabs(self):
if hasattr(self, "list_of_tabs"):
return self.list_of_tabs
raise ImproperlyConfigured("list_of_tabs is required")
if not self.list_of_tabs:
raise ImproperlyConfigured("list_of_tabs is required")
return self.list_of_tabs
def get_context_data(self, **kwargs):
kwargs = super().get_context_data(**kwargs)

View File

@ -28,7 +28,6 @@ from datetime import date, timedelta
from operator import itemgetter
from smtplib import SMTPException
from django.conf import settings
from django.contrib.auth import login, views
from django.contrib.auth.forms import PasswordChangeForm
from django.contrib.auth.mixins import LoginRequiredMixin