This commit is contained in:
2025-07-15 20:57:15 +03:00
parent f6c78a20a3
commit 0ffd79cee9
51 changed files with 1227 additions and 653 deletions
+14
View File
@@ -73,3 +73,17 @@ class ContainerHistory(Container):
on_delete=models.CASCADE,
related_name='history_containers'
)
class ContainerPhotos(models.Model):
container = models.ForeignKey(
Container,
on_delete=models.CASCADE,
related_name='photos',
)
photo = models.TextField(blank=True, null=True)
uploaded_on = models.DateTimeField(auto_now_add=True)
uploaded_by = models.ForeignKey(
'accounts.DepotUser',
on_delete=models.CASCADE,
related_name='container_photos_uploaded_by',
)
+2 -1
View File
@@ -1,11 +1,12 @@
from django.urls import include, path
from containers.views.employee_views import ContainersListView
from containers.views.employee_views import ContainersListView, ReportContainersUnpaidListView
from containers.views.barrier_views import ContainerReceive, ContainerExpedition, ContainerSearchView
urlpatterns = [
path('search/', ContainerSearchView.as_view(), name='container_search'),
path('employee/', ContainersListView.as_view(), name='employee_containers'),
path('not-paid', ReportContainersUnpaidListView.as_view(), name='not_paid'),
path('barrier/<int:pk>/', include([
path('receive/', ContainerReceive.as_view(), name='container_receive'),
path('expedition/', ContainerExpedition.as_view(), name='container_expedition'),
+41 -2
View File
@@ -1,13 +1,52 @@
from django.views.generic import ListView
from common.models import CompanyModel
from containers.models import Container
class ContainersListView(ListView):
template_name = 'employee/containers-list.html'
model = Container
context_object_name = 'containers'
context_object_name = 'objects'
paginate_by = 30 # Number of containers per page
base_template = 'employee-base.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['base_template'] = self.base_template
return context
def get_queryset(self):
return Container.objects.filter(expedited=False).order_by('-received_on')
return Container.objects.filter(expedited=False).order_by('-received_on')
class ReportContainersUnpaidListView(ListView):
template_name = 'employee/payment-list.html'
model = Container
context_object_name = 'objects'
paginate_by = 30 # Number of payments per page
base_template = 'employee-base.html'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['base_template'] = self.base_template
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.GET.get('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')