fixed client dashboard

fixed employee sidebar nomenclatures buttons
deploy_branch
kikimor 7 months ago
parent 9167092f27
commit f501be9794

@ -6,10 +6,17 @@
<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 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$/common/templatetags/filters.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/templatetags/filters.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/common/utils/utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/utils/utils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/common/views/barrier_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/barrier_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/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/common/views/employee_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/views/common.py" beforeDir="false" afterPath="$PROJECT_DIR$/containers/views/common.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/employee_views.py" beforeDir="false" afterPath="$PROJECT_DIR$/preinfo/views/employee_views.py" 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/common/container-details.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/common/container-details.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/templates/common/payment-list.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/common/payment-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/employee-dashboard-content.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/employee-dashboard-content.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$/web_depot.tar" beforeDir="false" afterPath="$PROJECT_DIR$/web_depot.tar" 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" />
@ -50,7 +57,7 @@
"RunOnceActivity.ShowReadmeOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true",
"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",
"git-widget-placeholder": "deploy__branch", "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",

@ -10,12 +10,7 @@ from django.core.mail import send_mail, EmailMessage
def filter_queryset_by_user(queryset, user): def filter_queryset_by_user(queryset, user):
""" # print(f'user: {user}, user company: {user.company}, user line: {user.line}, user type: {user.user_type}')
Filters the queryset based on the user's line or company.
If the user has a line, it filters by that line.
If the user has a company, it filters by all lines associated with that company.
"""
print(f'user: {user}, user company: {user.company}, user line: {user.line}, user type: {user.user_type}')
if user.line: if user.line:
filtered = queryset.filter(line=user.line) filtered = queryset.filter(line=user.line)
print(f"Filtering by line: {user.line.id}, count: {filtered.count()}") print(f"Filtering by line: {user.line.id}, count: {filtered.count()}")

@ -1,24 +1,60 @@
from datetime import timedelta
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone
from django.views.generic import TemplateView, ListView, CreateView, UpdateView from django.views.generic import TemplateView, ListView, CreateView, UpdateView
from DepoT.mixins.LineFiltweFormMixin import LineFilterFormMixin from DepoT.mixins.LineFiltweFormMixin import LineFilterFormMixin
from booking.models import Booking
from common.forms.company import CompanyCreateForm, CompanyUpdateForm from common.forms.company import CompanyCreateForm, CompanyUpdateForm
from common.forms.line import LineCreateForm, LineUpdateForm from common.forms.line import LineCreateForm, LineUpdateForm
from common.models import CompanyModel, LinesModel from common.models import CompanyModel, LinesModel
from common.utils.utils import filter_queryset_by_user from common.utils.utils import filter_queryset_by_user
from containers.models import Container
from payments.models import Payment
from preinfo.models import Preinfo
from django.db.models import Q
class ClientDashboardView(LoginRequiredMixin, TemplateView):
class ClientDashboardView(TemplateView):
template_name = 'client-dashboard-content.html' template_name = 'client-dashboard-content.html'
extra_context = { extra_context = {
'title': 'Client Dashboard', 'title': 'Client Dashboard',
'description': 'This is the client dashboard page.', 'description': 'This is the client dashboard page.',
} }
def get(self, request, *args, **kwargs): def test_func(self):
return render(request, self.template_name, self.extra_context) return self.request.user.user_type in ('CA', 'CL')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
user = self.request.user
today = timezone.now()
last_week = today - timedelta(days=7)
containers_queryset = filter_queryset_by_user(Container.objects, user)
preinfo_queryset = filter_queryset_by_user(Preinfo.objects.filter(deleted=False), user)
bookings_queryset = filter_queryset_by_user(Booking.objects.filter(~Q(status='deleted')), user)
payment_queryset = Payment.objects.filter(company=user.company)
containers = containers_queryset.filter(expedited=False).count()
containers_week = containers_queryset.filter(received_on__gte=last_week).count()
preinfos = preinfo_queryset.filter(received=False).count()
preinfos_week = preinfo_queryset.filter(created_on__gte=last_week).count()
bookings = bookings_queryset.filter(status='active').count()
bookings_week = bookings_queryset.filter(created_on__gte=last_week).count()
context['containers'] = containers
context['preinfos'] = preinfos
context['bookings'] = bookings
context['containers_week'] = containers_week
context['preinfos_week'] = preinfos_week
context['bookings_week'] = bookings_week
context['recent_containers'] = containers_queryset.order_by('-expedited_on', '-received_on')[:10]
context['recent_payments'] = payment_queryset.order_by('-created_on')[:10]
return context
@ -30,7 +66,7 @@ class ClientCompanyListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
# base_template = 'client-base.html' # base_template = 'client-base.html'
def test_func(self): def test_func(self):
return True # self.request.user.has_employee_perm('can_view_preinfo') or self.request.user.user_type == 'CA' return self.request.user.user_type in ('CA', 'CL')
# 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,5 +1,8 @@
from datetime import timedelta
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.utils import timezone
from django.views.generic import TemplateView, ListView, CreateView, UpdateView from django.views.generic import TemplateView, ListView, CreateView, UpdateView
from booking.models import Booking from booking.models import Booking
@ -22,15 +25,33 @@ class EmployeeDashboardView(LoginRequiredMixin, UserPassesTestMixin, TemplateVie
return self.request.user.user_type == 'EM' or self.request.user.is_superuser return self.request.user.user_type == 'EM' or self.request.user.is_superuser
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
today = timezone.now()
last_week = today - timedelta(days=7)
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
containers = Container.objects.filter(expedited=False).count()
preinfos = Preinfo.objects.filter(received=False).count() containers_queryset = Container.objects.all()
bookings = Booking.objects.filter(status='active').count() containers = containers_queryset.filter(expedited=False).count()
containers_week = containers_queryset.filter(received_on__gte=last_week).count()
preinfos_queryset = Preinfo.objects.all()
preinfos = preinfos_queryset.filter(received=False).count()
preinfos_week = preinfos_queryset.filter(created_on__gte=last_week).count()
bookings_queryset = Booking.objects.filter(status='active')
bookings = bookings_queryset.filter(status='active').count()
bookings_week = bookings_queryset.filter(created_on__gte=last_week).count()
context['containers'] = containers context['containers'] = containers
context['preinfos'] = preinfos context['preinfos'] = preinfos
context['bookings'] = bookings context['bookings'] = bookings
context['recent_containers'] = Container.objects.order_by('-expedited_on', '-received_on')[:10] context['containers_week'] = containers_week
context['preinfos_week'] = preinfos_week
context['bookings_week'] = bookings_week
context['recent_containers'] = containers_queryset.order_by('-expedited_on', '-received_on')[:10]
context['recent_payments'] = Payment.objects.order_by('-created_on')[:10] context['recent_payments'] = Payment.objects.order_by('-created_on')[:10]
print('context prepared')
return context return context

@ -82,7 +82,7 @@ class ContainerDetails(LoginRequiredMixin, ListView):
template_name = 'common/container-details.html' template_name = 'common/container-details.html'
model = Container model = Container
context_object_name = 'objects' context_object_name = 'objects'
paginate_by = 20 paginate_by = 8
def get_queryset(self): def get_queryset(self):
container_number = self.request.session.get('container_number') container_number = self.request.session.get('container_number')

@ -129,7 +129,9 @@ class PaymentListView(LoginRequiredMixin, UserPassesTestMixin, ListView):
def get_queryset(self): def get_queryset(self):
queryset = super().get_queryset() queryset = super().get_queryset()
user = self.request.user user = self.request.user
queryset = filter_queryset_by_user(queryset, user)
if user.company:
queryset = queryset.filter(company=user.company)
data_filter = self.request.GET.get('filter') data_filter = self.request.GET.get('filter')
if data_filter != 'all': if data_filter != 'all':

@ -11,7 +11,7 @@ class EmployeePreinfoView(LoginRequiredMixin, UserPassesTestMixin, ListView):
form_class = PreinfoEditForm form_class = PreinfoEditForm
def test_func(self): def test_func(self):
return self.request.user.user_type in ('EM', 'CA') return self.request.user.user_type == 'EM' or self.request.user.is_superuser
def get_queryset(self): def get_queryset(self):
queryset = super().get_queryset() queryset = super().get_queryset()

@ -1,166 +1,8 @@
{% extends 'common/base.html' %} {% extends 'common/base.html' %}
{% block content %} {% load filters %}
{% load permission_tags %}
{# <div id="dashboardContent" class="tab-content active">#}
{# <div class="grid grid-cols-1 md:grid-cols-3 gap-6 mb-6">#}
{# <div class="card bg-white rounded-lg shadow p-6">#}
{# <div class="flex items-center">#}
{# <div class="p-3 rounded-full bg-blue-100 text-blue-600">#}
{# <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">#}
{# <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />#}
{# </svg>#}
{# </div>#}
{# <div class="ml-4">#}
{# <h3 class="text-lg font-semibold text-gray-700">Active Containers</h3>#}
{# <p class="text-3xl font-bold text-gray-900">42</p>#}
{# <p class="text-sm text-green-600">+3 since last week</p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{##}
{# <div class="card bg-white rounded-lg shadow p-6">#}
{# <div class="flex items-center">#}
{# <div class="p-3 rounded-full bg-green-100 text-green-600">#}
{# <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">#}
{# <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />#}
{# </svg>#}
{# </div>#}
{# <div class="ml-4">#}
{# <h3 class="text-lg font-semibold text-gray-700">Preinfo Sent</h3>#}
{# <p class="text-3xl font-bold text-gray-900">18</p>#}
{# <p class="text-sm text-green-600">+5 since last week</p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{##}
{# <div class="card bg-white rounded-lg shadow p-6">#}
{# <div class="flex items-center">#}
{# <div class="p-3 rounded-full bg-orange-100 text-orange-600">#}
{# <svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">#}
{# <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" />#}
{# </svg>#}
{# </div>#}
{# <div class="ml-4">#}
{# <h3 class="text-lg font-semibold text-gray-700">Bookings</h3>#}
{# <p class="text-3xl font-bold text-gray-900">7</p>#}
{# <p class="text-sm text-orange-600">2 require attention</p>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
{##}
{# <div class="grid grid-cols-1 lg:grid-cols-2 gap-6">#}
{# <div class="bg-white rounded-lg shadow">#}
{# <div class="px-6 py-4 border-b border-gray-200">#}
{# <h3 class="text-lg font-semibold text-gray-800">Recent Container Activity</h3>#}
{# </div>#}
{# <div class="p-6">#}
{# <div class="overflow-x-auto">#}
{# <table class="min-w-full divide-y divide-gray-200">#}
{# <thead>#}
{# <tr>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Container</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>#}
{# </tr>#}
{# </thead>#}
{# <tbody class="divide-y divide-gray-200">#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">MSCU1234567</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">40HC</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Received</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-15</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">MSCU7654321</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">20DV</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-blue-100 text-blue-800">Preinfo</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-14</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">MSCU2468135</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">40DV</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-orange-100 text-orange-800">Order</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-13</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">MSCU1357924</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">20RF</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-800">Expedited</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-12</td>#}
{# </tr>#}
{# </tbody>#}
{# </table>#}
{# </div>#}
{# </div>#}
{# </div>#}
{##}
{# <div class="bg-white rounded-lg shadow">#}
{# <div class="px-6 py-4 border-b border-gray-200">#}
{# <h3 class="text-lg font-semibold text-gray-800">Payment Status</h3>#}
{# </div>#}
{# <div class="p-6">#}
{# <div class="overflow-x-auto">#}
{# <table class="min-w-full divide-y divide-gray-200">#}
{# <thead>#}
{# <tr>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Invoice</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>#}
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Due Date</th>#}
{# </tr>#}
{# </thead>#}
{# <tbody class="divide-y divide-gray-200">#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">INV-2023-0042</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">$1,250.00</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Paid</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-10</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">INV-2023-0041</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">$875.50</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-yellow-100 text-yellow-800">Pending</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-20</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">INV-2023-0040</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">$2,100.00</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-red-100 text-red-800">Overdue</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-06-05</td>#}
{# </tr>#}
{# <tr>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">INV-2023-0039</td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">$950.25</td>#}
{# <td class="px-4 py-3 whitespace-nowrap">#}
{# <span class="px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800">Paid</span>#}
{# </td>#}
{# <td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">2023-05-28</td>#}
{# </tr>#}
{# </tbody>#}
{# </table>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
{% block content %}
<div class="dashboard-wrapper"> <div class="dashboard-wrapper">
<div class="stats-grid"> <div class="stats-grid">
<div class="dashboard-card"> <div class="dashboard-card">
@ -172,8 +14,8 @@
</div> </div>
<div class="stat-info"> <div class="stat-info">
<h3>Active Containers</h3> <h3>Active Containers</h3>
<p class="stat-number">42</p> <p class="stat-number">{{ containers }}</p>
<p class="stat-change">+3 since last week</p> <p class="stat-change">+{{ containers_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
@ -186,8 +28,8 @@
</div> </div>
<div class="stat-info"> <div class="stat-info">
<h3>Preinfo sent</h3> <h3>Preinfo sent</h3>
<p class="stat-number">17</p> <p class="stat-number">{{ preinfos }}</p>
<p class="stat-change">+7 since last week</p> <p class="stat-change">+{{ preinfos_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
@ -200,13 +42,12 @@
</div> </div>
<div class="stat-info"> <div class="stat-info">
<h3>Bookings active</h3> <h3>Bookings active</h3>
<p class="stat-number">4</p> <p class="stat-number">{{ bookings }}</p>
<p class="stat-change">+8 since last week</p> <p class="stat-change">+{{ bookings_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
<!-- Other two cards similar structure -->
</div> </div>
<div class="tables-grid"> <div class="tables-grid">
@ -225,17 +66,28 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for container in recent_containers %}
<tr> <tr>
<td>MSCU1234567</td> <td>{{ container.number }}</td>
<td>40HC</td> <td>{{ container.container_type.name }}</td>
{% if container.expedited %}
<td><span class="status-tag status-expedited">Expedited</span></td>
<td>{{ container.expedited_on|bg_date }}</td>
{% else %}
<td><span class="status-tag status-received">Received</span></td> <td><span class="status-tag status-received">Received</span></td>
<td>2023-06-15</td> <td>{{ container.received_on|bg_date }}</td>
{% endif %}
</tr> </tr>
<!-- Other rows similar structure --> {% empty %}
<tr>
<td> No recent history</td>
</tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
{% if request.user|has_company_perm:"can_view_payment" %}
<div class="dashboard-card"> <div class="dashboard-card">
<div class="card-header"> <div class="card-header">
@ -245,24 +97,30 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>Container</th> <th>Invoice №</th>
<th>Type</th> <th>Company</th>
<th>Status</th> <th>Amount</th>
<th>Date</th> <th>Paid</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for payment in recent_payments %}
<tr> <tr>
<td>MSCU1234567</td> <td>{{ payment.invoice_number }}</td>
<td>40HC</td> <td>{{ payment.company.name }}</td>
<td><span class="status-tag status-received">Received</span></td> <td>{{ payment.total_amount }}</td>
<td>2023-06-15</td> <td><span class="status-tag status-received">{{ payment.paid }}</span></td>
</tr>
{% empty %}
<tr>
<td> No recent history</td>
</tr> </tr>
<!-- Other rows similar structure --> {% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
{% endif %}
</div> </div>
</div> </div>

@ -139,11 +139,11 @@
</div> </div>
<div class="detail-row"> <div class="detail-row">
<div class="detail-label">Preinfo:</div> <div class="detail-label">Preinfo:</div>
<div class="detail-value">{{ container.preinfo }}</div> <div class="detail-value">{{ container.preinfo.id }}</div>
</div> </div>
<div class="detail-row"> <div class="detail-row">
<div class="detail-label">Received On:</div> <div class="detail-label">Received On:</div>
<div class="detail-value">{{ container.received_on|date:"Y-m-d H:i" }}</div> <div class="detail-value">{{ container.received_on|bg_date }}</div>
</div> </div>
<div class="detail-row"> <div class="detail-row">
<div class="detail-label">Receive Vehicle:</div> <div class="detail-label">Receive Vehicle:</div>
@ -163,7 +163,7 @@
<div class="detail-label">Booking:</div> <div class="detail-label">Booking:</div>
<div class="detail-value"> <div class="detail-value">
{% if container.booking %} {% if container.booking %}
{{ container.booking.name }} {{ container.booking.id }}
{% else %} {% else %}
- -
{% endif %} {% endif %}
@ -204,15 +204,19 @@
{% block table_header %} {% block table_header %}
<th style="display: none;">Select</th> <th style="display: none;">Select</th>
<th>Company name</th> <th>Company</th>
<th>Company short name</th> <th>Receive date</th>
<th>Description</th> <th>Swept</th>
<th>Washed</th>
<th>Expedited date</th>
{% endblock table_header %} {% endblock table_header %}
{% block table_data %} {% block table_data %}
<td>{{ object.number }}</td> <td>{{ object.line.company.short_name }}</td>
<td>{{ object.number }}</td> <td>{{ object.received_on|bg_date }}</td>
<td>{{ object.number }}</td> <td>{{ object.swept|yesno:"Yes,-" }}</td>
<td>{{ object.washed|yesno:"Yes,-" }}</td>
<td>{{ object.expedited_on|bg_date }}</td>
{% endblock %} {% endblock %}
{% block buttons %} {% block buttons %}

@ -30,12 +30,5 @@
{% endblock %} {% endblock %}
{% block buttons %} {% 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 %} {% endblock buttons %}

@ -1,7 +1,7 @@
{% extends 'common/base.html' %} {% extends 'common/base.html' %}
{% block content %}
{% load filters %} {% load filters %}
{% load permission_tags %} {% load permission_tags %}
{% block content %}
<div class="dashboard-wrapper"> <div class="dashboard-wrapper">
<div class="stats-grid"> <div class="stats-grid">
<div class="dashboard-card"> <div class="dashboard-card">
@ -14,7 +14,7 @@
<div class="stat-info"> <div class="stat-info">
<h3>Active Containers</h3> <h3>Active Containers</h3>
<p class="stat-number">{{ containers }}</p> <p class="stat-number">{{ containers }}</p>
<p class="stat-change">+3 since last week</p> <p class="stat-change">+{{ containers_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
@ -28,7 +28,7 @@
<div class="stat-info"> <div class="stat-info">
<h3>Active preinfos</h3> <h3>Active preinfos</h3>
<p class="stat-number">{{ preinfos }}</p> <p class="stat-number">{{ preinfos }}</p>
<p class="stat-change">+7 since last week</p> <p class="stat-change">+{{ preinfos_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
@ -42,7 +42,7 @@
<div class="stat-info"> <div class="stat-info">
<h3>Active bookings</h3> <h3>Active bookings</h3>
<p class="stat-number">{{ bookings }}</p> <p class="stat-number">{{ bookings }}</p>
<p class="stat-change">+8 since last week</p> <p class="stat-change">+{{ bookings_week }} since last week</p>
</div> </div>
</div> </div>
</div> </div>
@ -83,7 +83,6 @@
<td> No recent history</td> <td> No recent history</td>
</tr> </tr>
{% endfor %} {% endfor %}
<!-- Other rows similar structure -->
</tbody> </tbody>
</table> </table>
</div> </div>

@ -76,7 +76,7 @@
</a> </a>
{% endif %} {% endif %}
{% if request.user.UserType == 'CA' or 1 == 1 %} {% if request.user.is_superuser %}
<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">
@ -109,11 +109,14 @@
<div class="user-info"> <div class="user-info">
<p class="username">{{ request.user }}</p> <p class="username">{{ request.user }}</p>
</div> </div>
<a href="{% url 'login' %}" class="logout"> <form action="{% url 'relogin' %}" method="post" style="display:inline;">
{% csrf_token %}
<button type="submit" class="logout" style="background:none; border:none; padding:0;">
<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">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1" />
</svg> </svg>
</a> </button>
</form>
</div> </div>
</aside> </aside>

Binary file not shown.
Loading…
Cancel
Save