development branch created to preserve working deploy project

This commit is contained in:
2025-08-02 17:37:16 +03:00
parent 5e65ea0f7c
commit e824e87953
659 changed files with 90008 additions and 137 deletions
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.
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.
Binary file not shown.
+3 -1
View File
@@ -4,9 +4,11 @@ from common.views.employee_views import EmployeeDashboardView, EmployeeCompanyLi
EmployeeCompanyUpdateView, EmployeeLineListView, EmployeeLineCreateView, EmployeeLineUpdateView
from common.views.client_views import ClientDashboardView, ClientCompanyListView, ClientCompanyCreateView, \
ClientCompanyUpdateView, ClientLineListView, ClientLineCreateView, ClientLineUpdateView
from common.views.shared_views import IndexView, DashboardRedirectView
from common.views.shared_views import IndexView, DashboardRedirectView, AllowedVehiclesView
urlpatterns = [
path('', IndexView.as_view(), name='index'),
path('allowed-vehicles/', AllowedVehiclesView.as_view(), name='allowed_vehicles'),
path('dashboard/', include([
path('', DashboardRedirectView.as_view(), name='dashboard'),
path('client/', ClientDashboardView.as_view(), name='client_dashboard'),
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+17 -4
View File
@@ -40,8 +40,14 @@ class ClientCompanyListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
def get_queryset(self):
queryset = super().get_queryset()
user = self.request.user
result = filter_queryset_by_user(queryset, user)
return result
queryset = filter_queryset_by_user(queryset, user)
data_filter = self.request.GET.get('filter')
if data_filter != 'all':
queryset = queryset.filter(status='active')
queryset = queryset.order_by('-name')
return queryset
@@ -94,8 +100,15 @@ class ClientLineListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
def get_queryset(self):
queryset = super().get_queryset()
user = self.request.user
result = queryset.filter(company=user.company)
return result
queryset = queryset.filter(company=user.company)
data_filter = self.request.GET.get('filter')
if data_filter != 'all':
queryset = queryset.filter(active=True)
queryset = queryset.order_by('-name')
return queryset
class ClientLineCreateView(LoginRequiredMixin, UserPassesTestMixin, CreateView):
+30 -1
View File
@@ -1,5 +1,6 @@
from django.db.models import QuerySet
from django.urls import reverse_lazy
from django.views.generic import TemplateView, RedirectView
from django.views.generic import TemplateView, RedirectView, ListView
from django.shortcuts import render
from accounts.models import DepotUser
@@ -39,6 +40,34 @@ class DashboardRedirectView(RedirectView):
return reverse_lazy('index')
class AllowedVehiclesView(ListView):
template_name = 'common/allowed-vehicles.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
lines_vehicles = {}
queryset = Booking.objects.filter(status='active')
for booking in queryset:
if lines_vehicles.get(booking.line.name) is None:
lines_vehicles[booking.line.name] = set()
vehicles = lines_vehicles[booking.line.name]
vehicles.update(booking.vehicles_left.split(','))
lines_vehicles[booking.line.name] = vehicles
context['objects'] = lines_vehicles
context['objects'] = [
type('Obj', (), {
'id': line_name,
'line': line_name,
'vehicles': ', '.join(sorted(vehicles))
}) for line_name, vehicles in lines_vehicles.items()
]
return context
def get_queryset(self):
return DepotUser.objects.none()