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.
+2
View File
@@ -1,5 +1,6 @@
from django.urls import include, path
from containers.views.client_views import ClientContainersListView
from containers.views.common import ContainerDetails
from containers.views.employee_views import ContainersListView, ReportContainersUnpaidListView
from containers.views.barrier_views import ContainerReceiveView, ContainerExpedition, ContainerSearchView, \
@@ -11,6 +12,7 @@ urlpatterns = [
path('container-search/', ContainerSearchView.as_view(), name='barrier_photos'),
# path('search/', ContainerSearchView.as_view(), name='container_search'),
path('employee/', ContainersListView.as_view(), name='employee_containers'),
path('client/', ClientContainersListView.as_view(), name='client_containers'),
path('not-paid', ReportContainersUnpaidListView.as_view(), name='not_paid'),
path('barrier/receive/', ContainerReceiveView.as_view(), name='container_receive'),
path('barrier/expedition/', ContainerExpedition.as_view(), name='container_expedition'),
Binary file not shown.
+81
View File
@@ -0,0 +1,81 @@
from django.shortcuts import render, redirect
from django.views import View
from django.views.generic import ListView
from common.models import CompanyModel
from common.utils.utils import get_preinfo_by_number, get_container_by_number, filter_queryset_by_user
from containers.models import Container
class ClientContainersListView(ListView):
template_name = 'employee/containers-list.html'
model = Container
context_object_name = 'objects'
paginate_by = 30
def get_queryset(self):
queryset = super().get_queryset()
queryset = filter_queryset_by_user(queryset, self.request.user)
data_filter = self.request.GET.get('filter')
if data_filter != 'all':
queryset = queryset.filter(expedited=False)
queryset = queryset.order_by('-received_on')
return queryset
class ReportContainersUnpaidListView(ListView):
template_name = 'employee/payment-list.html'
model = Container
context_object_name = 'objects'
paginate_by = 30
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['companies'] = CompanyModel.objects.all().order_by('name')
return context
def get_queryset(self):
queryset = self.model.objects.filter(expedited=True)
# Get date from request parameters
date = self.request.GET.get('date')
if date:
queryset = queryset.filter(expedited_on__date__lte=date)
# Get company from request parameters
company = self.request.user.company
if company:
queryset = queryset.filter(line__company_id=company)
# Add payment filter to show only unpaid containers
queryset = queryset.filter(payment_containers__isnull=True)
return queryset.order_by('-expedited_on')
class ContainerSearchView(View):
template_name = 'barrier/container-search.html' # Single template for all searches
def get(self, request):
search_type = request.GET.get('param') # container_receive or container_expedition
return render(request, self.template_name, {'search_type': search_type})
def post(self, request):
number = request.POST.get('number')
search_type = request.POST.get('search_type')
if search_type == 'container_receive':
preinfo = get_preinfo_by_number(number)
if preinfo:
return redirect('receive_container', pk=preinfo.pk)
else: # container_expedition
container = get_container_by_number(number)
if container:
return redirect('expedite_container', pk=container.pk)
return render(request, self.template_name, {
'error': 'Not found',
'search_type': search_type
})