added some filters to templates

This commit is contained in:
2025-08-03 10:50:59 +03:00
parent e824e87953
commit 13c4c324fc
29 changed files with 180 additions and 89 deletions
+21 -39
View File
@@ -5,38 +5,35 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="7410a44d-51b9-408b-85ad-4fa46776b372" name="Changes" comment="commit unversioned files ;)"> <list default="true" id="7410a44d-51b9-408b-85ad-4fa46776b372" name="Changes" comment="commit unversioned files ;)">
<change afterPath="$PROJECT_DIR$/containers/views/client_views.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/accounts/templatetags/permission_tags.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/minio_backend/__init__.py" afterDir="false" /> <change afterPath="$PROJECT_DIR$/templates/common/payment-list.html" afterDir="false" />
<change afterPath="$PROJECT_DIR$/minio_backend/storage.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/production.env" afterDir="false" />
<change afterPath="$PROJECT_DIR$/static/images/test.jpg" afterDir="false" />
<change afterPath="$PROJECT_DIR$/templates/common/allowed-vehicles.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/DepoT/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/DepoT/settings.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/accounts/migrations/0008_populate_permissions.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/migrations/0008_populate_permissions.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/accounts/admin.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/admin.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/accounts/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/models.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/accounts/backends.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/backends.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/accounts/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/accounts/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/views.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/accounts/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/accounts/views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/booking/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/booking/views/client_views.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/booking/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/booking/views/client_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/urls.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/booking/views/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/booking/views/employee_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/client_views.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/common/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/client_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/views/shared_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/shared_views.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/common/views/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/employee_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/containers/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/containers/urls.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/containers/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/containers/views/client_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docker-compose-deploy.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose-deploy.yml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/containers/views/common.py" beforeDir="false" afterPath="$PROJECT_DIR$/containers/views/common.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/docker-compose.dev.yml" beforeDir="false" afterPath="$PROJECT_DIR$/docker-compose.dev.yml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/containers/views/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/containers/views/employee_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/dockerfile" beforeDir="false" afterPath="$PROJECT_DIR$/dockerfile" afterDir="false" /> <change beforePath="$PROJECT_DIR$/payments/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/payments/urls.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/payments/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/payments/views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/preinfo/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/preinfo/views/client_views.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/preinfo/views/client_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/preinfo/views/client_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/requirements.txt" beforeDir="false" afterPath="$PROJECT_DIR$/requirements.txt" afterDir="false" /> <change beforePath="$PROJECT_DIR$/preinfo/views/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/preinfo/views/employee_views.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/static/styles/sidebar.css" beforeDir="false" afterPath="$PROJECT_DIR$/static/styles/sidebar.css" afterDir="false" /> <change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/client-dashboard-content.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client-dashboard-content.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/client-sidebar.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client-sidebar.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/client-sidebar.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client-sidebar.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/client/booking-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client/booking-list.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/client/booking-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client/booking-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/client/line-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client/line-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/client/preinfo-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client/preinfo-list.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/client/preinfo-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/client/preinfo-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee-dashboard-content.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee-dashboard-content.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/common/container-details.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/common/container-details.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee-sidebar.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee-sidebar.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/employee-sidebar.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee-sidebar.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/landing-page.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/landing-page.html" afterDir="false" /> <change beforePath="$PROJECT_DIR$/templates/employee/booking-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee/booking-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee/containers-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee/containers-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee/payment-create.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee/payment-create.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee/payment-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee/unpaid-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/employee/preinfo-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee/preinfo-list.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web_depot.tar" beforeDir="false" afterPath="$PROJECT_DIR$/web_depot.tar" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -77,7 +74,7 @@
"RunOnceActivity.git.unshallow": "true", "RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.pycharm.django.structure.promotion.once.per.project": "true", "RunOnceActivity.pycharm.django.structure.promotion.once.per.project": "true",
"django.template.preview.state": "SHOW_EDITOR_AND_PREVIEW", "django.template.preview.state": "SHOW_EDITOR_AND_PREVIEW",
"git-widget-placeholder": "master", "git-widget-placeholder": "deploy__branch",
"ignore.virus.scanning.warn.message": "true", "ignore.virus.scanning.warn.message": "true",
"last_opened_file_path": "C:/dev_projects/python/Django/DepoT", "last_opened_file_path": "C:/dev_projects/python/Django/DepoT",
"list.type.of.created.stylesheet": "CSS", "list.type.of.created.stylesheet": "CSS",
@@ -282,21 +279,6 @@
<line>7</line> <line>7</line>
<option name="timeStamp" value="55" /> <option name="timeStamp" value="55" />
</line-breakpoint> </line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/common/views/client_views.py</url>
<line>131</line>
<option name="timeStamp" value="61" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/payments/views.py</url>
<line>41</line>
<option name="timeStamp" value="98" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/payments/views.py</url>
<line>56</line>
<option name="timeStamp" value="99" />
</line-breakpoint>
<line-breakpoint enabled="true" suspend="THREAD" type="python-line"> <line-breakpoint enabled="true" suspend="THREAD" type="python-line">
<url>file://$PROJECT_DIR$/DepoT/settings.py</url> <url>file://$PROJECT_DIR$/DepoT/settings.py</url>
<line>12</line> <line>12</line>
@@ -9,6 +9,8 @@ def create_permissions(apps, schema_editor):
(1, 'can_manage_containers', 'Can manage containers'), (1, 'can_manage_containers', 'Can manage containers'),
(2, 'can_view_reports', 'Can view reports'), (2, 'can_view_reports', 'Can view reports'),
(3, 'can_handle_operations', 'Can handle operations'), (3, 'can_handle_operations', 'Can handle operations'),
(4, 'can_view_payments', 'Can view payments'),
(5, 'can_manage_payments', 'Can Manage payments'),
] ]
for _id, codename, name in employee_permissions: for _id, codename, name in employee_permissions:
EmployeePermission.objects.create(id=_id, codename=codename, name=name) EmployeePermission.objects.create(id=_id, codename=codename, name=name)
+2
View File
@@ -37,6 +37,8 @@ class EmployeePermission(models.Model):
('can_manage_containers', 'Can manage containers'), ('can_manage_containers', 'Can manage containers'),
('can_view_reports', 'Can view reports'), ('can_view_reports', 'Can view reports'),
('can_handle_operations', 'Can handle operations'), ('can_handle_operations', 'Can handle operations'),
('can_view_payments', 'Can view payments'),
('can_manage_payments', 'Can manage payments'),
) )
def __str__(self): def __str__(self):
+11
View File
@@ -0,0 +1,11 @@
from django import template
register = template.Library()
@register.filter
def has_company_perm(user, perm_codename):
return user.has_company_perm(perm_codename)
@register.filter
def has_employee_perm(user, perm_codename):
return user.has_employee_perm(perm_codename)
+3 -3
View File
@@ -8,7 +8,7 @@ from django.views import View
from django.views.generic import TemplateView, FormView, ListView, UpdateView from django.views.generic import TemplateView, FormView, ListView, UpdateView
from rest_framework.generics import get_object_or_404 from rest_framework.generics import get_object_or_404
from accounts.forms import LoginForm, RegisterForm, UserChangePasswordForm from accounts.forms import LoginForm, RegisterForm, UserChangePasswordForm, UserEditForm
from accounts.models import DepotUser from accounts.models import DepotUser
from django.contrib.auth.decorators import login_required, user_passes_test from django.contrib.auth.decorators import login_required, user_passes_test
@@ -94,7 +94,7 @@ class UserListView(ListView):
template_name = 'registration/user-list.html' template_name = 'registration/user-list.html'
model = get_user_model() model = get_user_model()
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 # Number of containers per page paginate_by = 20 # Number of containers per page
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
# def get_context_data(self, **kwargs): # def get_context_data(self, **kwargs):
@@ -121,7 +121,7 @@ class UserListView(ListView):
class UserUpdateView(UpdateView): class UserUpdateView(UpdateView):
template_name = 'registration/register.html' template_name = 'registration/register.html'
form_class = RegisterForm form_class = UserEditForm
model = get_user_model() model = get_user_model()
success_url = reverse_lazy('user_list') success_url = reverse_lazy('user_list')
+1 -1
View File
@@ -11,7 +11,7 @@ from common.utils.utils import filter_queryset_by_user
class ClientBookingView(LoginRequiredMixin, UserPassesTestMixin, ListView): class ClientBookingView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = Booking model = Booking
template_name = 'client/booking-list.html' template_name = 'client/booking-list.html'
paginate_by = 4 paginate_by = 20
context_object_name = 'objects' context_object_name = 'objects'
# base_template = 'client-base.html' # base_template = 'client-base.html'
+1 -1
View File
@@ -7,7 +7,7 @@ class BookingListView(ListView):
template_name = 'employee/booking-list.html' template_name = 'employee/booking-list.html'
model = Booking model = Booking
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 # Number of containers per page paginate_by = 20 # Number of containers per page
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
# def get_context_data(self, **kwargs): # def get_context_data(self, **kwargs):
+2 -2
View File
@@ -26,7 +26,7 @@ class ClientCompanyListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = CompanyModel model = CompanyModel
template_name = 'common/../../templates/employee/company-list.html' template_name = 'common/../../templates/employee/company-list.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 3 paginate_by = 20
# base_template = 'client-base.html' # base_template = 'client-base.html'
def test_func(self): def test_func(self):
@@ -86,7 +86,7 @@ class ClientLineListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = LinesModel model = LinesModel
template_name = 'client/line-list.html' template_name = 'client/line-list.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 3 paginate_by = 20
# base_template = 'client-base.html' # base_template = 'client-base.html'
def test_func(self): def test_func(self):
+2 -2
View File
@@ -32,7 +32,7 @@ class EmployeeCompanyListView(LoginRequiredMixin, UserPassesTestMixin, ListView)
model = CompanyModel model = CompanyModel
template_name = 'common/../../templates/employee/company-list.html' template_name = 'common/../../templates/employee/company-list.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 3 paginate_by = 20
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
def test_func(self): def test_func(self):
@@ -88,7 +88,7 @@ class EmployeeLineListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = LinesModel model = LinesModel
template_name = 'employee/line-list.html' template_name = 'employee/line-list.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 3 paginate_by = 20
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
def test_func(self): def test_func(self):
+3 -3
View File
@@ -11,7 +11,7 @@ class ClientContainersListView(ListView):
template_name = 'employee/containers-list.html' template_name = 'employee/containers-list.html'
model = Container model = Container
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 paginate_by = 20
def get_queryset(self): def get_queryset(self):
queryset = super().get_queryset() queryset = super().get_queryset()
@@ -26,10 +26,10 @@ class ClientContainersListView(ListView):
class ReportContainersUnpaidListView(ListView): class ReportContainersUnpaidListView(ListView):
template_name = 'employee/payment-list.html' template_name = 'employee/unpaid-list.html'
model = Container model = Container
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 paginate_by = 20
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
+1 -1
View File
@@ -82,7 +82,7 @@ class ContainerDetails(ListView):
model = Container model = Container
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 10 paginate_by = 20
def get_queryset(self): def get_queryset(self):
container_number = self.request.session.get('container_number') container_number = self.request.session.get('container_number')
+3 -3
View File
@@ -11,7 +11,7 @@ class ContainersListView(ListView):
template_name = 'employee/containers-list.html' template_name = 'employee/containers-list.html'
model = Container model = Container
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 # Number of containers per page paginate_by = 20 # Number of containers per page
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
# def get_context_data(self, **kwargs): # def get_context_data(self, **kwargs):
@@ -31,10 +31,10 @@ class ContainersListView(ListView):
class ReportContainersUnpaidListView(ListView): class ReportContainersUnpaidListView(ListView):
template_name = 'employee/payment-list.html' template_name = 'employee/unpaid-list.html'
model = Container model = Container
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 # Number of payments per page paginate_by = 20 # Number of payments per page
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
+2 -1
View File
@@ -1,8 +1,9 @@
from django.urls import path from django.urls import path
from payments.views import PaymentCreateView, some_view from payments.views import PaymentCreateView, some_view, PaymentListView
urlpatterns = [ urlpatterns = [
path('payments-list/', PaymentListView.as_view(), name='payments_list'),
path("create/", PaymentCreateView.as_view(), name="payments_create"), path("create/", PaymentCreateView.as_view(), name="payments_create"),
path('invoice/', some_view, name='payments_invoice'), path('invoice/', some_view, name='payments_invoice'),
] ]
+21 -1
View File
@@ -10,7 +10,7 @@ from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import Table, TableStyle, Spacer, Paragraph, SimpleDocTemplate from reportlab.platypus import Table, TableStyle, Spacer, Paragraph, SimpleDocTemplate
from common.models import CompanyModel from common.models import CompanyModel
from common.utils.utils import send_test_email from common.utils.utils import send_test_email, filter_queryset_by_user
from containers.models import Container from containers.models import Container
from payments.forms import PaymentCreateForm from payments.forms import PaymentCreateForm
from payments.models import Payment, PaymentItem from payments.models import Payment, PaymentItem
@@ -108,6 +108,26 @@ class PaymentCreateView(CreateView):
form.fields['total_amount'].initial = total_charges['total'] form.fields['total_amount'].initial = total_charges['total']
return form return form
class PaymentListView(ListView):
model = Payment
template_name = 'common/payment-list.html'
context_object_name = 'objects'
paginate_by = 20
def get_queryset(self):
queryset = super().get_queryset()
user = self.request.user
queryset = filter_queryset_by_user(queryset, user)
data_filter = self.request.GET.get('filter')
if data_filter != 'all':
queryset = queryset.filter(paid=False)
queryset = queryset.order_by('-created_on')
return queryset
def some_view(request): def some_view(request):
buffer = io.BytesIO() buffer = io.BytesIO()
doc = SimpleDocTemplate(buffer, pagesize=A4) doc = SimpleDocTemplate(buffer, pagesize=A4)
+1 -1
View File
@@ -21,7 +21,7 @@ class ClientPreinfoView(LoginRequiredMixin, UserPassesTestMixin, ListView):
# ListView # ListView
model = Preinfo model = Preinfo
template_name = 'client/preinfo-list.html' template_name = 'client/preinfo-list.html'
paginate_by = 4 paginate_by = 20
# CRUDListView template # CRUDListView template
context_object_name = 'objects' context_object_name = 'objects'
+1 -1
View File
@@ -7,7 +7,7 @@ class EmployeePreinfoView(LoginRequiredMixin, UserPassesTestMixin, ListView):
model = Preinfo model = Preinfo
template_name = 'employee/preinfo-list.html' template_name = 'employee/preinfo-list.html'
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 30 paginate_by = 20
form_class = PreinfoEditForm form_class = PreinfoEditForm
# base_template = 'employee-base.html' # base_template = 'employee-base.html'
+5
View File
@@ -33,4 +33,9 @@ password: shushunka1
След стартиране на системата, се отваря landing страницата на DepoT. В нея има малко информация за депото, login бутон и бутон за таблото за шофьорите. След стартиране на системата, се отваря landing страницата на DepoT. В нея има малко информация за депото, login бутон и бутон за таблото за шофьорите.
При логване, в зависимост от типа на потребителя, се отваря различен dashboard. За служители и клиенти той изглежда почти еднакво, а за операторите е различен, тъй като те ползват таблети и интерфейса трябва да е по-опростен и удобен за работа с пръст(ръкавици). При логване, в зависимост от типа на потребителя, се отваря различен dashboard. За служители и клиенти той изглежда почти еднакво, а за операторите е различен, тъй като те ползват таблети и интерфейса трябва да е по-опростен и удобен за работа с пръст(ръкавици).
## Deployment
На адрес https://depot.kikimor.com/ е качена продукционна версия на проекта.
В repository (https://git.kikimor.com) има нов branch (deploy_branch). В него има docker-compose-deploy.yml,с който се стартират всички контейнери (postgres, minio, createbuckets и самото приложение).
Тук в контейнера се прави collectstatic, след което се качват в bucket "static" на minio и се сервират през него.
P.S.Тъй като не остана много време, не знам дали ще успея да обединя двата branch-а, затова последните промени засега ще са само в deploy_branch, който вие няма да можете да стартирате.
+6 -2
View File
@@ -1,4 +1,5 @@
{% load static %} {% load static %}
{% load permission_tags %}
<aside class="sidebar"> <aside class="sidebar">
<div class="header"> <div class="header">
<a href="{% url 'index' %}" class="link-no-style"> <a href="{% url 'index' %}" class="link-no-style">
@@ -14,6 +15,7 @@
{% url 'client_company' as client_company_url %} {% url 'client_company' as client_company_url %}
{% url 'client_line' as client_line_url %} {% url 'client_line' as client_line_url %}
{% url 'user_list' as user_list_url %} {% url 'user_list' as user_list_url %}
{% url 'payments_list' as payments_list_url %}
<nav class="nav-menu"> <nav class="nav-menu">
<div class="section-title">Main</div> <div class="section-title">Main</div>
<a href="{{ dashboard_url }}" class="nav-item {% if request.path == dashboard_url %}active{% endif %}"> <a href="{{ dashboard_url }}" class="nav-item {% if request.path == dashboard_url %}active{% endif %}">
@@ -40,8 +42,9 @@
</svg> </svg>
Bookings Bookings
</a> </a>
{% if request.user|has_company_perm:'can_view_payment' or request.user.user_type == 'CA'%}
<div class="section-title account">Reports</div> <div class="section-title account">Reports</div>
<a href="#" class="nav-item"> <a href="{{ payments_list_url }}" class="nav-item">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<g> <g>
<path fill="none" d="M0 0h24v24H0z"/> <path fill="none" d="M0 0h24v24H0z"/>
@@ -50,7 +53,8 @@
</svg> </svg>
Reports Reports
</a> </a>
{% if request.user.UserType == 'CA' or 1 == 1 %} {% endif %}
{% if request.user.user_type == 'CA' %}
<div class="section-title account">Nomenclatures</div> <div class="section-title account">Nomenclatures</div>
<a href="{{ user_list_url }}" class="nav-item {% if request.path == user_list_url %}active{% endif %}"> <a href="{{ user_list_url }}" class="nav-item {% if request.path == user_list_url %}active{% endif %}">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load static %} {% load static %}
{% load filters %}
{% block filter %} {% block filter %}
<form id="filterForm" method="get" style="display: inline;"> <form id="filterForm" method="get" style="display: inline;">
@@ -33,7 +34,7 @@
<td>{{ object.containers_left }}</td> <td>{{ object.containers_left }}</td>
<td>{{ object.vehicles }}</td> <td>{{ object.vehicles }}</td>
<td>{{ object.vehicles_left }}</td> <td>{{ object.vehicles_left }}</td>
<td>{{ object.created_on }}</td> <td>{{ object.created_on|bg_date }}</td>
<td>{{ object.created_by.username }}</td> <td>{{ object.created_by.username }}</td>
<td>{{ object.status }}</td> <td>{{ object.status }}</td>
{% endblock %} {% endblock %}
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load static %} {% load static %}
{% load filters %}
{% block filter %} {% block filter %}
<form id="filterForm" method="get" style="display: inline;"> <form id="filterForm" method="get" style="display: inline;">
@@ -25,7 +26,7 @@
<td>{{ object.container_number|upper }}</td> <td>{{ object.container_number|upper }}</td>
<td>{{ object.container_type }}</td> <td>{{ object.container_type }}</td>
<td>{{ object.line.short_name }}</td> <td>{{ object.line.short_name }}</td>
<td>{{ object.created_on|date:"d.m.Y h:m" }}</td> <td>{{ object.created_on|bg_date }}</td>
<td>{{ object.created_by.username }}</td> <td>{{ object.created_by.username }}</td>
<td>{{ object.received|yesno:"Received,Pending" }}</td> <td>{{ object.received|yesno:"Received,Pending" }}</td>
{% endblock %} {% endblock %}
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load static %} {% load static %}
{% load filters %}
{% block extra_styles %} {% block extra_styles %}
<link rel="stylesheet" href="{% static 'styles/details.css' %}"> <link rel="stylesheet" href="{% static 'styles/details.css' %}">
@@ -170,7 +171,7 @@
</div> </div>
<div class="detail-row"> <div class="detail-row">
<div class="detail-label">Expedited On:</div> <div class="detail-label">Expedited On:</div>
<div class="detail-value">{{ container.expedited_on|date:"Y-m-d H:i"|default:"-" }}</div> <div class="detail-value">{{ container.expedited_on|bg_date|default:"-" }}</div>
</div> </div>
<div class="detail-row"> <div class="detail-row">
<div class="detail-label">Expedition Vehicle:</div> <div class="detail-label">Expedition Vehicle:</div>
+41
View File
@@ -0,0 +1,41 @@
{% extends 'list-crud.html' %}
{% load static %}
{% load filters %}
{% block filter %}
<form id="filterForm" method="get" style="display: inline;">
<input type="hidden" name="filter" id="filterInput" value="{{ request.GET.filter|default:'active' }}">
<button type="button" class="btn btn-primary" id="activeBtn">Active</button>
<button type="button" class="btn btn-primary" id="allBtn">All</button>
</form>
{% endblock filter %}
{% block table_header %}
<th style="display: none;">Select</th>
<th>Company</th>
<th>Invoice №</th>
<th>Total amount</th>
<th>Created on</th>
<th>Paid</th>
<th>Paid on</th>
{% endblock table_header %}
{% block table_data %}
<td>{{ object.company.name }}</td>
<td>{{ object.invoice_number }}</td>
<td>{{ object.total_amount }}</td>
<td>{{ object.created_on|bg_date }}</td>
<td>{{ object.paid|yesno:"Yes,No" }}</td>
<td>{{ object.paid_on|bg_date|default:"" }}</td>
{% endblock %}
{% block buttons %}
{# <a href="{% url 'client_booking_create' %}" class="btn btn-primary">Create booking</a>#}
{# <a href="#" id="editBtn" data-url="{% url 'client_booking_update' pk=0 %}" class="btn btn-primary" disabled>Edit Preinfo</a>#}
{# <button id="deleteButton" class="btn btn-danger">Delete Preinfo</button>#}
{# #}
{# <button class="btn btn-primary" type="button" onclick="window.location.href='{% url 'client_booking_create' %}'">Create booking</button>#}
{# <button class="btn btn-primary" type="button" id="editBtn" data-url="{% url 'client_booking_update' pk=0 %}" data-requires-selection disabled>Edit booking</button>#}
{# <button class="btn btn-primary" type="button" id="deleteBtn" data-url="{% url 'client_booking_active' pk=0 %}" data-requires-selection disabled>Delete booking</button> #}
{% endblock buttons %}
+17
View File
@@ -1,4 +1,6 @@
{% load static %} {% load static %}
{% load permission_tags %}
<aside class="sidebar"> <aside class="sidebar">
<div class="header"> <div class="header">
<a href="{% url 'index' %}" class="link-no-style"> <a href="{% url 'index' %}" class="link-no-style">
@@ -16,6 +18,7 @@
{% url 'employee_line' as employee_line_url %} {% url 'employee_line' as employee_line_url %}
{% url 'user_list' as user_list_url %} {% url 'user_list' as user_list_url %}
{% url 'not_paid' as not_paid_list_url %} {% url 'not_paid' as not_paid_list_url %}
{% url 'payments_list' as payments_list_url %}
<nav class="nav-menu"> <nav class="nav-menu">
<div class="section-title">Main</div> <div class="section-title">Main</div>
@@ -49,7 +52,9 @@
</svg> </svg>
Bookings Bookings
</a> </a>
{% if request.user|has_employee_perm:'can_view_payments' %}
<div class="section-title account">Reports</div> <div class="section-title account">Reports</div>
{% if request.user|has_employee_perm:'can_manage_payments' %}
<a href="{{ not_paid_list_url }}" class="nav-item {% if request.path == not_paid_list_url %}active{% endif %}" id="ordersNav"> <a href="{{ not_paid_list_url }}" class="nav-item {% if request.path == not_paid_list_url %}active{% endif %}" id="ordersNav">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<g> <g>
@@ -59,6 +64,18 @@
</svg> </svg>
Reports Reports
</a> </a>
{% endif %}
<a href="{{ payments_list_url }}" class="nav-item {% if request.path == payments_list_url %}active{% endif %}" id="ordersNav">
<svg xmlns="http://www.w3.org/2000/svg" class="icon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<g>
<path fill="none" d="M0 0h24v24H0z"/>
<path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-1.95-9H15v2h-4.95a2.5 2.5 0 0 0 4.064 1.41l1.7 1.133A4.5 4.5 0 0 1 8.028 13H7v-2h1.027a4.5 4.5 0 0 1 7.788-2.543L14.114 9.59A2.5 2.5 0 0 0 10.05 11z"/>
</g>
</svg>
Payments
</a>
{% endif %}
{% if request.user.UserType == 'CA' or 1 == 1 %} {% if request.user.UserType == 'CA' or 1 == 1 %}
<div class="section-title account">Nomenclatures</div> <div class="section-title account">Nomenclatures</div>
<a href="{{ user_list_url }}" class="nav-item {% if request.path == user_list_url %}active{% endif %}"> <a href="{{ user_list_url }}" class="nav-item {% if request.path == user_list_url %}active{% endif %}">
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load custom_filters %} {% load custom_filters %}
{% load filters %}
{% load static %} {% load static %}
{% block filter %} {% block filter %}
@@ -34,7 +35,7 @@
<td>{{ object.containers_left }}</td> <td>{{ object.containers_left }}</td>
<td>{{ object.vehicles|distinct_vehicles }}</td> <td>{{ object.vehicles|distinct_vehicles }}</td>
<td>{{ object.vehicles_left|distinct_vehicles }}</td> <td>{{ object.vehicles_left|distinct_vehicles }}</td>
<td>{{ object.created_on }}</td> <td>{{ object.created_on|bg_date }}</td>
<td>{{ object.created_by.username }}</td> <td>{{ object.created_by.username }}</td>
<td>{{ object.status }}</td> <td>{{ object.status }}</td>
{% endblock %} {% endblock %}
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load static %} {% load static %}
{% load filters %}
{% block filter %} {% block filter %}
<form id="filterForm" method="get" style="display: inline;"> <form id="filterForm" method="get" style="display: inline;">
@@ -24,7 +25,7 @@
<td>{{ object.number }}</td> <td>{{ object.number }}</td>
<td>{{ object.container_type }}</td> <td>{{ object.container_type }}</td>
<td>{{ object.line.short_name }}</td> <td>{{ object.line.short_name }}</td>
<td>{{ object.received_on|date:"y.m.d h:m" }}</td> <td>{{ object.received_on|bg_date }}</td>
<td>{{ object.position }}</td> <td>{{ object.position }}</td>
<td>{{ object.swept|yesno:"Yes," }}</td> <td>{{ object.swept|yesno:"Yes," }}</td>
<td>{{ object.washed|yesno:"Yes," }}</td> <td>{{ object.washed|yesno:"Yes," }}</td>
+3 -3
View File
@@ -1,5 +1,5 @@
{% extends 'common/base.html' %} {% extends 'common/base.html' %}
{% load filters %}
{% block content %} {% block content %}
<form method="POST"> <form method="POST">
{% csrf_token %} {% csrf_token %}
@@ -32,8 +32,8 @@
<td>{{ container.number }}</td> <td>{{ container.number }}</td>
<td>{{ container.container_type }}</td> <td>{{ container.container_type }}</td>
<td>{{ container.line.company.short_name }}</td> <td>{{ container.line.company.short_name }}</td>
<td>{{ container.received_on|date:"Y-m-d" }}</td> <td>{{ container.received_on|bg_date }}</td>
<td>{{ container.expedited_on|date:"Y-m-d" }}</td> <td>{{ container.expedited_on|bg_date }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
+2 -1
View File
@@ -1,5 +1,6 @@
{% extends 'list-crud.html' %} {% extends 'list-crud.html' %}
{% load static %} {% load static %}
{% load filters %}
{% block filter %} {% block filter %}
<form id="filterForm" method="get" style="display: inline;"> <form id="filterForm" method="get" style="display: inline;">
@@ -25,7 +26,7 @@
<td>{{ object.container_number }}</td> <td>{{ object.container_number }}</td>
<td>{{ object.container_type }}</td> <td>{{ object.container_type }}</td>
<td>{{ object.line.short_name }}</td> <td>{{ object.line.short_name }}</td>
<td>{{ object.created_on }}</td> <td>{{ object.created_on|bg_date }}</td>
<td>{{ object.created_by.username }}</td> <td>{{ object.created_by.username }}</td>
<td>{{ object.received|yesno:"Received,Pending" }}</td> <td>{{ object.received|yesno:"Received,Pending" }}</td>
{% endblock %} {% endblock %}
BIN
View File
Binary file not shown.