Add IntelliJ IDEA project configuration files
This commit adds IntelliJ IDEA-specific configuration files for the project, including module setup, version control integration, inspection profiles, and workspace settings. These files facilitate development environment configuration for contributors using IntelliJ IDEA.
This commit is contained in:
@@ -24,4 +24,5 @@ urlpatterns = [
|
||||
path('user/', include('accounts.urls')),
|
||||
path('preinfo/', include('preinfo.urls')),
|
||||
path('container/', include('containers.urls')),
|
||||
path('booking/', include('booking.urls')),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
from django import forms
|
||||
|
||||
from booking.models import Booking
|
||||
|
||||
|
||||
class BookingBaseForm(forms.ModelForm):
|
||||
"""
|
||||
Base form for booking-related forms.
|
||||
This can be extended by other booking forms.
|
||||
"""
|
||||
|
||||
class Meta:
|
||||
fields = '__all__'
|
||||
model = Booking
|
||||
|
||||
class BookingCreateForm(BookingBaseForm):
|
||||
|
||||
class Meta(BookingBaseForm.Meta):
|
||||
fields = ['number', 'vehicles', 'container_type', 'container_count', 'carrier', 'line', 'container_number']
|
||||
+2
-1
@@ -2,7 +2,7 @@ from django.db import models
|
||||
from common.models import ContainerTypeModel, LinesModel, OperationModel
|
||||
|
||||
# Create your models here.
|
||||
class BookingModel(models.Model):
|
||||
class Booking(models.Model):
|
||||
number = models.CharField(max_length=50, unique=True)
|
||||
vehicles = models.CharField(blank=True, null=True)
|
||||
container_type = models.ForeignKey(
|
||||
@@ -11,6 +11,7 @@ class BookingModel(models.Model):
|
||||
related_name='booking_container_types',
|
||||
)
|
||||
container_count = models.IntegerField()
|
||||
container_expedited_count = models.IntegerField(default=0)
|
||||
carrier = models.CharField(max_length=100, blank=True, null=True)
|
||||
line = models.ForeignKey(
|
||||
LinesModel,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.urls import path
|
||||
|
||||
from booking.views import CreateBookingView
|
||||
|
||||
urlpatterns = [
|
||||
path('client/', CreateBookingView.as_view(), name='client_booking'),
|
||||
]
|
||||
+28
-7
@@ -1,14 +1,35 @@
|
||||
from django.shortcuts import render
|
||||
from django.urls import reverse_lazy
|
||||
from django.views.generic import CreateView
|
||||
|
||||
from booking.forms import BookingCreateForm
|
||||
from booking.models import Booking
|
||||
from common.utils import filter_queryset_by_user
|
||||
|
||||
|
||||
# Create your views here.
|
||||
class CreateBookingView(CreateView):
|
||||
template_name = 'create-booking.html'
|
||||
extra_context = {
|
||||
'title': 'Create Booking',
|
||||
'description': 'This is the create booking page.',
|
||||
}
|
||||
template_name = 'client-booking-content.html'
|
||||
model = Booking
|
||||
form_class = BookingCreateForm
|
||||
success_url = reverse_lazy('dashboard')
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
return render(request, self.template_name, self.extra_context)
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
queryset = self.model.objects.all().order_by('-created_on')
|
||||
user = self.request.user
|
||||
# !!! important
|
||||
queryset = filter_queryset_by_user( queryset, user)[:10]
|
||||
# !!! important
|
||||
|
||||
context['recent'] = queryset
|
||||
return context
|
||||
|
||||
|
||||
def form_valid(self, form):
|
||||
# todo more validation
|
||||
form.instance.created_by = self.request.user.id
|
||||
form.instance.updated_by = self.request.user.id
|
||||
if self.request.user.line:
|
||||
form.instance.line = self.request.user.line
|
||||
return super().form_valid(form)
|
||||
@@ -43,7 +43,7 @@ class Container(models.Model):
|
||||
null=True
|
||||
)
|
||||
booking = models.ForeignKey(
|
||||
'booking.BookingModel',
|
||||
'booking.Booking',
|
||||
on_delete=models.CASCADE,
|
||||
related_name='container_bookings',
|
||||
blank = True,
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
</head>
|
||||
<body class="flex h-screen overflow-hidden">
|
||||
<!-- Sidebar -->
|
||||
{% include 'sidebar.html' %}
|
||||
{% include 'client-sidebar.html' %}
|
||||
<!-- Main Content -->
|
||||
<main class="content-area flex-1 overflow-y-auto">
|
||||
<!-- Top Navigation -->
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<div class="p-6">
|
||||
<form id="preinfoForm" class="space-y-6" method="POST" >
|
||||
|
||||
{{ form.as_p }}
|
||||
{{ form }}
|
||||
{% csrf_token %}
|
||||
|
||||
<div class="form-section flex justify-end space-x-3">
|
||||
@@ -31,19 +31,24 @@
|
||||
<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">Booking №</th>
|
||||
<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">Est. Arrival</th>
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Container count</th>
|
||||
{# <th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vehicles</th>#}
|
||||
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Vehicles</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">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-200">
|
||||
{% for preinfo in recent %}
|
||||
{% for booking in recent %}
|
||||
<tr>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">{{ preinfo.container_number }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">{{ preinfo.container_type }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">{{ preinfo.created_on }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">{{ booking.number }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">{{ booking.container_number }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">{{ booking.container_type }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">{{ booking.container_count }}</td>
|
||||
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-700">{{ booking.vehicles_left }}</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">Pending</span>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</svg>
|
||||
Container Preinfo
|
||||
</a>
|
||||
<a href="{% url 'container_search' %}?param=container_receive" id="ordersNav" class="nav-item flex items-center px-6 py-3 text-white">
|
||||
<a href="{% url 'client_booking' %}" id="ordersNav" class="nav-item flex items-center px-6 py-3 text-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-3" 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>
|
||||
@@ -51,11 +51,11 @@
|
||||
<p class="text-sm font-medium">{{ request.user }}</p>
|
||||
<p class="text-xs text-blue-300">{{ request.user.company }}</p>
|
||||
</div>
|
||||
<button class="ml-auto text-white" onclick="{% url 'relogin' %}">
|
||||
<a href="{% url 'relogin' %}" class="ml-auto text-white" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" 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" />
|
||||
</svg>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
Reference in New Issue
Block a user